org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor Java Examples
The following examples show how to use
org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSetup.java From tomee with Apache License 2.0 | 6 votes |
public WebArchive createDeployment(Class...archiveClasses) { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version("3.0"); decorateDescriptor(descriptor); WebArchive archive = ShrinkWrap.create(WebArchive.class, getTestContextName() + ".war") .setWebXML(new StringAsset(descriptor.exportAsString())) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); if (archiveClasses != null) { for (Class c: archiveClasses) { archive.addClass(c); } } decorateArchive(archive); return archive; }
Example #2
Source File: WsRsTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.create(WebArchive.class, WsRsTest.class.getName().concat(".war")) .addClasses(Bean.class) // jaxws and jaxrs are "servlets" so if one (jaxrs here) binds to /* then the other one is not accessible depending deployment order .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .getOrCreateServlet() .servletName("jaxrs") .servletClass(Application.class.getName()) .createInitParam() .paramName(Application.class.getName()) .paramValue(Application.class.getName()) .up() .up() .getOrCreateServletMapping() .servletName("jaxrs") .urlPattern("/api") .up() .exportAsString())); }
Example #3
Source File: AvoidConflictWithWebXmlWithNoResourceMatchingWithRestSubPathTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static Archive<?> war() { return ShrinkWrap.create(WebArchive.class, "AvoidConflictWithWebXmlWithNoResourceMatchingWithRestSubPathTest.war") .addClasses(TheResource.class, SimpleServlet.class, PreviousFilter.class) .addAsWebResource(new StringAsset("JSP <%= 5 %>"), "sample.jsp") .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("home") .jspFile("/sample.jsp") .up() .createServlet() .servletName(Application.class.getName()) .up() .createServletMapping() .servletName("home") .urlPattern("/*") .up() .createServletMapping() .servletName(Application.class.getName()) .urlPattern("/api") .up() .exportAsString())); }
Example #4
Source File: AvoidConflictWithWebXmlWithNoResourceMatchingTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static Archive<?> war() { return ShrinkWrap.create(WebArchive.class, "AvoidConflictWithWebXmlWithNoResourceMatchingTest.war") .addClasses(TheResource.class, SimpleServlet.class, PreviousFilter.class) .addAsWebResource(new StringAsset("JSP <%= 5 %>"), "sample.jsp") .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("home") .jspFile("/sample.jsp") .up() .createServletMapping() .servletName("home") .urlPattern("/*") .up() .exportAsString())); }
Example #5
Source File: AvoidConflictWithWebXmlTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static Archive<?> war() { return ShrinkWrap.create(WebArchive.class, "AvoidConflictWithWebXmlTest.war") .addClasses(TheResource.class, SimpleServlet.class, PreviousFilter.class) .addAsWebResource(new StringAsset("JSP <%= 5 %>"), "index.jsp") // works cause name is welcome-file .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("home") .jspFile("/index.jsp") .up() .createServletMapping() .servletName("home") .urlPattern("/*") .up() .exportAsString())); }
Example #6
Source File: JMSInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive getArchive() { return ShrinkWrap.create(WebArchive.class, "jsf-jms-test.war") .addClasses(DummyManagedBean.class) .addAsWebResource(new ClassLoaderAsset( JMSInjectionTest.class.getPackage().getName().replace('.', '/').concat("/").concat("dummy.xhtml")), "dummy.xhtml") .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class) .version("3.0") .createServlet() .servletName("jsf") .servletClass(FacesServlet.class.getName()) .loadOnStartup(1) .up() .createServletMapping() .servletName("jsf") .urlPattern("*.xhtml") // not the default .up() .exportAsString())); }
Example #7
Source File: DescriptorComplementsAnnotationsTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(SERVLET_NAME) .servletClass(DescriptorComplementsAnnotationsServlet.class.getName()).up() .createServletMapping() .servletName(SERVLET_NAME) .urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(DescriptorComplementsAnnotationsTest.class) .addClass(DescriptorComplementsAnnotationsServlet.class) .addClass(Bean.class) .addClass(FirstBean.class) .addClass(SecondBean.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsWebInfResource(new ClassLoaderAsset(CONTENT_LOCATION_EJB_JAR_XML), RESOURCE_EJB_JAR_XML) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #8
Source File: IntegrationTestUtils.java From trimou with Apache License 2.0 | 6 votes |
public static WebArchive createTestArchiveBase() { WebArchive testArchive = ShrinkWrap.create(WebArchive.class); // Suppressing implicit bean archives without beans.xml testArchive.addAsManifestResource(CDI11_JBOSSALL_WORKAROUND_ASSET, "jboss-all.xml"); // Add Weld servlet for embedded containers if (isServletContainer()) { testArchive.addAsLibraries(resolve("org.jboss.weld.servlet:weld-servlet")); testArchive.setWebXML(new StringAsset(Descriptors .create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createListener() .listenerClass( "org.jboss.weld.environment.servlet.Listener").up() .exportAsString())); } return testArchive; }
Example #9
Source File: WebXmlOverrideTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static Archive<?> war() { return ShrinkWrap.create(WebArchive.class, "WebXmlOverrideTest.war") .addClasses(TheResource.class, RSApp.class) .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(RSApp.class.getName()) .createInitParam().paramName(Application.class.getName()).paramValue(RSApp.class.getName()).up() .up() .createServletMapping() .servletName(RSApp.class.getName()) .urlPattern("/xml/*") .up() .exportAsString())); }
Example #10
Source File: DeploymentFactory.java From knox with Apache License 2.0 | 6 votes |
private static void initialize( DeploymentContext context, Map<String,List<ProviderDeploymentContributor>> providers, Map<String,List<ServiceDeploymentContributor>> services, Map.Entry<String,ServiceDeploymentContributor> applications ) { WebAppDescriptor wad = context.getWebAppDescriptor(); String topoName = context.getTopology().getName(); if( applications == null ) { String servletName = topoName + SERVLET_NAME_SUFFIX; wad.createServlet().servletName( servletName ).servletClass( GatewayServlet.class.getName() ); wad.createServletMapping().servletName( servletName ).urlPattern( "/*" ); } else { String filterName = topoName + FILTER_NAME_SUFFIX; wad.createFilter().filterName( filterName ).filterClass( GatewayServlet.class.getName() ); wad.createFilterMapping().filterName( filterName ).urlPattern( "/*" ); } if (gatewayServices != null) { gatewayServices.initializeContribution(context); } else { log.gatewayServicesNotInitialized(); } initializeProviders( context, providers ); initializeServices( context, services ); initializeApplications( context, applications ); }
Example #11
Source File: ServletEjbRemoteTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("check").servletClass(RemoteServlet.class.getName()).up() .createServletMapping() .servletName("check").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(RemoteServlet.class) .addClass(CompanyRemote.class) .addClass(DefaultCompany.class) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #12
Source File: ServletCdiInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up() .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(TestRun.class) .addClass(SimpleServlet.class) .addClass(Car.class) .setWebXML(new StringAsset(descriptor.exportAsString())) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return archive; }
Example #13
Source File: ServletCdiConstructorInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version("3.0") .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up() .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(TestRun.class) .addClass(SimpleServlet.class) .addClass(Car.class) .setWebXML(new StringAsset(descriptor.exportAsString())) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return archive; }
Example #14
Source File: ServletCdiProducerTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up() .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(TestRun.class) .addClass(SimpleServlet.class) .addClass(Car.class) .addClass(AssemblyLine.class) .setWebXML(new StringAsset(descriptor.exportAsString())) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return archive; }
Example #15
Source File: ServletEjbLocalInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("check").servletClass(PojoServlet.class.getName()).up() .createServletMapping() .servletName("check").urlPattern("/" + TEST_NAME).up(); return ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(PojoServlet.class) .addClass(CompanyLocal.class) .addClass(Company.class) .addClass(DefaultCompany.class) .addClass(OtherCompany.class) .addClass(SuperMarket.class) .setWebXML(new StringAsset(descriptor.exportAsString())); }
Example #16
Source File: ServletFilterEnvEntryInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
private static void addEnvEntry(WebAppDescriptor descriptor, String name, String type, String value) { Node appNode = ((NodeDescriptor) descriptor).getRootNode(); appNode.createChild("/env-entry") .createChild("env-entry-name").text(name).getParent() .createChild("env-entry-type").text(type).getParent() .createChild("env-entry-value").text(value) /* .parent() .create("injection-target") .create("injection-target-class").text("org.apache.openejb.arquillian.ServletPojoInjectionTest$PojoServletFilter") .parent() .create("injection-target-name").text(name) */ ; }
Example #17
Source File: TimedMethodBeanTestJava8.java From metrics-cdi with Apache License 2.0 | 6 votes |
@Deployment public static Archive<?> createTestArchive() { return ShrinkWrap.create(WebArchive.class) // TODO: understand why this is duplicated in the Archive and fails since Weld 2.2.5.Final /* .addAsLibraries( Maven.configureResolver() .workOffline() .loadPomFromFile("pom.xml") .resolve("io.astefanutti.metrics.cdi:metrics-cdi", "org.jboss.weld.servlet:weld-servlet") .withTransitivity() .as(JavaArchive.class)) */ .addClass(TimedMethodBean.class) .addClass(TimedMethodServlet.class) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")) .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class) .version("3.1") .createServlet() .servletClass(TimedMethodServlet.class.getName()) .servletName("TimedMethod").up() .createServletMapping() .servletName("TimedMethod") .urlPattern("/timedMethod").up() .createListener() .listenerClass(Listener.class.getName()).up() .exportAsString())); }
Example #18
Source File: ServletListenerEnvEntryInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
private static void addEnvEntry(WebAppDescriptor descriptor, String name, String type, String value) { Node appNode = ((NodeDescriptor) descriptor).getRootNode(); appNode.createChild("/env-entry") .createChild("env-entry-name").text(name).getParent() .createChild("env-entry-type").text(type).getParent() .createChild("env-entry-value").text(value) /* .parent() .create("injection-target") .create("injection-target-class").text("org.apache.openejb.arquillian.ServletPojoInjectionTest$PojoServletContextListener") .parent() .create("injection-target-name").text(name) */ ; }
Example #19
Source File: TomEEContainerEarWithExplodedWarTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment public static WebArchive createDeployment() throws Exception { final WebArchive web = ShrinkWrap.create(WebArchive.class, WAR_FILE) .addClass(TestServlet.class) .addClass(TestEjb.class) .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class) .createServlet().servletName(SERVLET_NAME).servletClass(TestServlet.class.getName()).up() .createServletMapping().servletName(SERVLET_NAME).urlPattern(URL_PATTERN).up() .exportAsString())); ShrinkWrap.create(EnterpriseArchive.class, EAR_FILE).addAsModule(web) .setApplicationXML(new StringAsset(Descriptors.create(ApplicationDescriptor.class) .createModule().getOrCreateWeb().contextRoot(CONTEXT_PATH).webUri(WAR_FILE).up().up() .exportAsString())) .as(ExplodedExporter.class).exportExploded(new File(TARGET_FOLDER)); return ShrinkWrap.create(WebArchive.class); }
Example #20
Source File: ServletListenerEjbLocalInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
private static void addEnvEntry(WebAppDescriptor descriptor, String name, String type, String value) { Node appNode = ((NodeDescriptor) descriptor).getRootNode(); appNode.createChild("/env-entry") .createChild("env-entry-name").text(name).getParent() .createChild("env-entry-type").text(type).getParent() .createChild("env-entry-value").text(value) /* .parent() .create("injection-target") .create("injection-target-class").text("org.apache.openejb.arquillian.ServletPojoInjectionTest$PojoServletContextListener") .parent() .create("injection-target-name").text(name) */ ; }
Example #21
Source File: DataSourceDefinitionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(SERVLET_NAME) .servletClass(DataSourceServlet.class.getName()).up() .createServletMapping() .servletName(SERVLET_NAME) .urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(DataSourceDefinitionTest.class) .addClass(DataSourceServlet.class) .addClass(DataSourceBean.class) .addClass(DataSourcePojo.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsWebInfResource(new ClassLoaderAsset(CONTENT_LOCATION_EJB_JAR_XML), RESOURCE_EJB_JAR_XML) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #22
Source File: SessionSynchronizationCallbackTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(SERVLET_NAME) .servletClass(SessionSynchronizationCallbackServlet.class.getName()).up() .createServletMapping() .servletName(SERVLET_NAME) .urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(SessionSynchronizationCallbackServlet.class) .addClass(StatefulBean.class) .addClass(TestEntity.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsResource(new ClassLoaderAsset(PERSISTENCE_XML_SOURCE), PERSISTENCE_XML_DESTINATION) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #23
Source File: ServletPersistenceInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version("3.0") .createServlet() .servletName("check").servletClass(PersistenceServlet.class.getName()).up() .createServletMapping() .servletName("check").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(PersistenceServlet.class) .addClass(Address.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsManifestResource("persistence.xml", ArchivePaths.create("persistence.xml")) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #24
Source File: MultiplePersistenceTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName("check").servletClass(MultiplePUServlet.class.getName()).up() .createServletMapping() .servletName("check").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(MultiplePUServlet.class) .addClass(Person1.class).addClass(Person2.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/persistence/multiple/persistence.xml"), "META-INF/persistence.xml") .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #25
Source File: JSFs.java From tomee with Apache License 2.0 | 6 votes |
public static WebArchive base(final String name) { final String webXml = Descriptors.create(WebAppDescriptor.class) .version("3.0") .createServlet() .servletName("jsf") .servletClass(FacesServlet.class.getName()) .loadOnStartup(1) .up() .createServletMapping() .servletName("jsf") .urlPattern("*.xhtml") // not the default .up() .exportAsString(); return ShrinkWrap.create(WebArchive.class, name) .setWebXML(new StringAsset(webXml)); }
Example #26
Source File: IvmContextTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(SERVLET_NAME) .servletClass(IvmContextServlet.class.getName()).up() .createServletMapping() .servletName(SERVLET_NAME) .urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(IvmContextTest.class) .addClass(IvmContextServlet.class) .addClass(NamingBean.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .addAsWebInfResource(new ClassLoaderAsset(CONTENT_LOCATION_EJB_JAR_XML), RESOURCE_EJB_JAR_XML) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #27
Source File: AgentServlet2xITSessionWithCookieSomeFilter.java From HttpSessionReplacer with MIT License | 6 votes |
@Deployment(testable = false) public static WebArchive startFirst() { return ShrinkWrap.create(WebArchive.class, "session-cookie-agent.war") .addClasses(FirstServlet2x.class, OtherServlet2x.class, BaseServlet.class, SomeFilter.class, SessionListenerCalled2x.class, InvalidateSession2x.class, CallCountingSessionListener.class) .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("2.5") .getOrCreateContextParam().paramName(SessionConfiguration.DEFAULT_SESSION_TIMEOUT).paramValue("2").up() .createFilter().filterName("someFilter").filterClass(SomeFilter.class.getName()).up() .createServlet().servletName("firstServlet").servletClass(FirstServlet2x.class.getName()).up() .createServlet().servletName("secondServlet").servletClass(OtherServlet2x.class.getName()).up() .createServlet().servletName("invalidateServlet").servletClass(InvalidateSession2x.class.getName()).up() .createServlet().servletName("sessionListenerServlet").servletClass(SessionListenerCalled2x.class.getName()).up() .createListener().listenerClass(CallCountingSessionListener.class.getName()).up() .createFilterMapping().filterName("someFilter").urlPattern("/*").up() .createServletMapping().servletName("firstServlet").urlPattern("/FirstServlet").up() .createServletMapping().servletName("secondServlet").urlPattern("/OtherServlet").up() .createServletMapping().servletName("invalidateServlet").urlPattern("/InvalidateServlet").up() .createServletMapping().servletName("sessionListenerServlet").urlPattern("/SessionListener").up() .exportAsString())); }
Example #28
Source File: UnpackTest.java From tomee with Apache License 2.0 | 5 votes |
@Deployment public static WebArchive createDeployment() { return ShrinkWrap .create(WebArchive.class, "test.war") .addAsLibraries(JarLocation.jarLocation(Test.class)) .addClass(TestServlet.class) .addClass(TestEjb.class) .addClass(UnpackTest.class) .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("3.0") .createServlet().servletName("servlet").servletClass(TestServlet.class.getName()).up() .createServletMapping().servletName("servlet").urlPattern("/ejb").up() .exportAsString())); }
Example #29
Source File: Servlet2xITSessionWithCookieUsingSessionFilter.java From HttpSessionReplacer with MIT License | 5 votes |
@Deployment(testable = false) public static WebArchive startFirst() { return Helpers.createWebAppFromDependency("session-cookie.war") .addClasses(FirstServlet2x.class, OtherServlet2x.class, BaseServlet.class) .addClass("com.amadeus.session.servlet.SessionFilter") .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("2.5") .getOrCreateContextParam().paramName(SessionConfiguration.DEFAULT_SESSION_TIMEOUT).paramValue("2").up() .createFilter().filterName("sessionFilter").filterClass(SessionFilter.class.getName()).up() .createServlet().servletName("firstServlet").servletClass(FirstServlet2x.class.getName()).up() .createServlet().servletName("secondServlet").servletClass(OtherServlet2x.class.getName()).up() .createFilterMapping().filterName("sessionFilter").urlPattern("/*").up() .createServletMapping().servletName("firstServlet").urlPattern("/FirstServlet").up() .createServletMapping().servletName("secondServlet").urlPattern("/OtherServlet").up() .exportAsString())); }
Example #30
Source File: ServletTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static Archive<?> war() { final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "batchee-gui.war") .addAsWebInfResource(new StringAsset( Descriptors.create(WebAppDescriptor.class) .metadataComplete(true) .createListener() .listenerClass(CreateSomeJobs.class.getName()) .up() .createFilter() .filterName("JBatch Private Filter") .filterClass(JBatchServletInitializer.PrivateFilter.class.getName()) .up() .createServlet() .servletName("JBatch") .servletClass(JBatchController.class.getName()) .loadOnStartup(1) .up() .createFilterMapping() .filterName("JBatch Private Filter") .urlPattern("/*") .up() .createServletMapping() .servletName("JBatch") .urlPattern("/jbatch/*") .up() .exportAsString()), "web.xml") // GUI .addPackages(true, JBatchController.class.getPackage()) // test data to create some job things to do this test .addPackage(CreateSomeJobs.class.getPackage()) .addAsWebInfResource("META-INF/batch-jobs/init.xml", "classes/META-INF/batch-jobs/init.xml"); for (final String resource : Arrays.asList("layout.jsp", "jobs.jsp", "job-instances.jsp", "step-executions.jsp", "css/bootstrap.min.3.0.0.css", "js/bootstrap.min.3.0.0.js")) { webArchive.addAsWebResource("META-INF/resources/internal/batchee/" + resource, "internal/batchee/" + resource); } return webArchive; }