org.jboss.shrinkwrap.descriptor.api.Descriptors Java Examples
The following examples show how to use
org.jboss.shrinkwrap.descriptor.api.Descriptors.
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: 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 #2
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 #3
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 #4
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 #5
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 #6
Source File: TomcatNamingFailOnWriteConfigurationTest.java From tomee with Apache License 2.0 | 6 votes |
private static WebArchive createWebArchive(String archiveName, String contextXmlLocation) { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version(WebAppVersionType._3_0) .createServlet() .servletName(SERVLET_NAME) .servletClass(NamingServlet.class.getName()).up() .createServletMapping() .servletName(SERVLET_NAME) .urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName + ".war") .addClass(TomcatNamingFailOnWriteConfigurationTest.class) .addClass(NamingServlet.class) .addClass(Runner.class) .addAsLibraries(JarLocation.jarLocation(Test.class)) .add(new ClassLoaderAsset(contextXmlLocation), RESOURCE_CONTEXT_XML) .setWebXML(new StringAsset(descriptor.exportAsString())); return archive; }
Example #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: JPAInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
@Deployment(testable = false) public static WebArchive getArchive() { PersistenceDescriptor persistenceDescriptor = Descriptors.create(PersistenceDescriptor.class) .createPersistenceUnit() .name("test-pu") .transactionType("JTA") .clazz(PersistenceDescriptor.class.getName()) .jtaDataSource("test-ds") .up(); Asset persistenceAsset = new StringAsset(persistenceDescriptor.exportAsString()); return base("jsf-jpa-test.war").addAsWebInfResource(persistenceAsset, "persistence.xml") .addClasses(DummyManagedBean.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsWebResource(new ClassLoaderAsset( JPAInjectionTest.class.getPackage().getName().replace('.', '/').concat("/").concat("dummy.xhtml")), "dummy.xhtml"); }
Example #13
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 #14
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 #15
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 #16
Source File: WebXmlAsset.java From thorntail with Apache License 2.0 | 6 votes |
public WebXmlAsset(InputStream fromStream) { this.descriptor = withTCCL(Descriptors.class.getClassLoader(), () -> Descriptors.importAs(WebAppDescriptor.class).fromStream(fromStream)); // Import servlets and security constraints into internal structure List<ServletType<WebAppDescriptor>> servlets = this.descriptor.getAllServlet(); if (servlets != null) { this.servlets.addAll( servlets.stream() .map(this::convert) .collect(Collectors.toList()) ); } // TODO unfortunately, our class SecurityConstraint isn't well equipped to fully represent // the relevant part of web.xml, so we allow duplicity for now }
Example #17
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 #18
Source File: HttpSecurityPreparerTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test public void set_2_security_constraints() throws Exception { Map<String, Object> deploymentConfig = createConfigStub(); Map<String, Object> webConfig = findWebConfig(deploymentConfig); Map<String, Object> securityConstraint1 = new HashMap<>(); securityConstraint1.put("url-pattern", "/aaa"); Map<String, Object> securityConstraint2 = new HashMap<>(); securityConstraint2.put("url-pattern", "/bbb"); webConfig.put("security-constraints", Arrays.asList(securityConstraint1, securityConstraint2)); preparer.deploymentConfigs = deploymentConfig; preparer.process(); WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream()); assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(2); assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/aaa"); assertThat(webXml.getAllSecurityConstraint().get(1).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/bbb"); }
Example #19
Source File: HttpSecurityPreparerTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test public void set_1_method() throws Exception { Map<String, Object> deploymentConfig = createConfigStub(); Map<String, Object> webConfig = findWebConfig(deploymentConfig); Map<String, Object> securityConstraint = new HashMap<>(); securityConstraint.put("methods", Arrays.asList("GET")); webConfig.put("security-constraints", Collections.singletonList(securityConstraint)); preparer.deploymentConfigs = deploymentConfig; preparer.process(); WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream()); assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1); assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(0)).isEqualTo("GET"); }
Example #20
Source File: HttpSecurityPreparerTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test public void set_2_methods() throws Exception { Map<String, Object> deploymentConfig = createConfigStub(); Map<String, Object> webConfig = findWebConfig(deploymentConfig); Map<String, Object> securityConstraint = new HashMap<>(); securityConstraint.put("methods", Arrays.asList("GET", "POST")); webConfig.put("security-constraints", Collections.singletonList(securityConstraint)); preparer.deploymentConfigs = deploymentConfig; preparer.process(); WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream()); assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1); assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(0)).isEqualTo("GET"); assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(1)).isEqualTo("POST"); }
Example #21
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 #22
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 #23
Source File: SimpleCacheTest.java From deltaspike with Apache License 2.0 | 6 votes |
@Deployment public static WebArchive war() { String simpleName = SimpleCacheTest.class.getSimpleName(); String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor BeansDescriptor beansWithEnablingInterceptor = Descriptors.create(BeansDescriptor.class); beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName()); // war archive needs SimpleCacheInterceptor enabled BeansDescriptor beans = Descriptors.create(BeansDescriptor.class); beans.getOrCreateInterceptors().clazz(SimpleCacheInterceptor.class.getName()); JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") .addPackage(SimpleCacheTest.class.getPackage()) .addAsManifestResource(new StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml"); return ShrinkWrap.create(WebArchive.class, archiveName + ".war") .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()) .addAsLibraries(testJar) .addAsServiceProvider(Extension.class, SimpleCacheExtension.class) .addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml"); }
Example #24
Source File: ResourceAdapterFactory.java From ironjacamar with Eclipse Public License 1.0 | 6 votes |
/** * Create the work.rar deployment * * @param bc The BootstrapContext name; <code>null</code> if default * @return The resource adapter descriptor */ public static ResourceAdaptersDescriptor createWorkDeploymentMCFNoHashCode(String bc) { ResourceAdaptersDescriptor dashRaXml = Descriptors.create(ResourceAdaptersDescriptor.class, "work-ra.xml"); ResourceAdapterType dashRaXmlRt = dashRaXml.createResourceAdapter().archive("work.rar"); if (bc != null) dashRaXmlRt.bootstrapContext(bc); ConnectionDefinitionsType dashRaXmlCdst = dashRaXmlRt.getOrCreateConnectionDefinitions(); org.ironjacamar.embedded.dsl.resourceadapters20.api.ConnectionDefinitionType dashRaXmlCdt = dashRaXmlCdst .createConnectionDefinition().className(WorkManagedConnectionFactoryNoHashCode.class.getName()) .jndiName("java:/eis/WorkConnectionFactory").id("WorkConnectionFactory"); org.ironjacamar.embedded.dsl.resourceadapters20.api.PoolType dashRaXmlPt = dashRaXmlCdt.getOrCreatePool() .minPoolSize(0).initialPoolSize(0).maxPoolSize(10); return dashRaXml; }
Example #25
Source File: ResourceAdapterFactory.java From ironjacamar with Eclipse Public License 1.0 | 6 votes |
/** * Create the work.rar deployment * * @param bc The BootstrapContext name; <code>null</code> if default * @return The resource adapter descriptor */ public static ResourceAdaptersDescriptor createWorkDeployment(String bc) { ResourceAdaptersDescriptor dashRaXml = Descriptors.create(ResourceAdaptersDescriptor.class, "work-ra.xml"); ResourceAdapterType dashRaXmlRt = dashRaXml.createResourceAdapter().archive("work.rar"); if (bc != null) dashRaXmlRt.bootstrapContext(bc); ConnectionDefinitionsType dashRaXmlCdst = dashRaXmlRt.getOrCreateConnectionDefinitions(); org.ironjacamar.embedded.dsl.resourceadapters20.api.ConnectionDefinitionType dashRaXmlCdt = dashRaXmlCdst .createConnectionDefinition().className(WorkManagedConnectionFactory.class.getName()) .jndiName("java:/eis/WorkConnectionFactory").id("WorkConnectionFactory"); org.ironjacamar.embedded.dsl.resourceadapters20.api.PoolType dashRaXmlPt = dashRaXmlCdt.getOrCreatePool() .minPoolSize(0).initialPoolSize(0).maxPoolSize(10); return dashRaXml; }
Example #26
Source File: ResourceAdapterFactory.java From ironjacamar with Eclipse Public License 1.0 | 6 votes |
/** * Create the txlog.rar * * @return The resource adapter archive */ public static ResourceAdapterArchive createTxLogRar() { org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor raXml = Descriptors .create(org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor.class, "ra.xml").version("1.5"); org.jboss.shrinkwrap.descriptor.api.connector15.ResourceadapterType rt = raXml.getOrCreateResourceadapter(); org.jboss.shrinkwrap.descriptor.api.connector15.OutboundResourceadapterType ort = rt .getOrCreateOutboundResourceadapter().transactionSupport("XATransaction").reauthenticationSupport(false); org.jboss.shrinkwrap.descriptor.api.connector15.ConnectionDefinitionType cdt = ort.createConnectionDefinition() .managedconnectionfactoryClass(TxLogManagedConnectionFactory.class.getName()) .connectionfactoryInterface(TxLogConnectionFactory.class.getName()) .connectionfactoryImplClass(TxLogConnectionFactoryImpl.class.getName()) .connectionInterface(TxLogConnection.class.getName()) .connectionImplClass(TxLogConnectionImpl.class.getName()); ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "txlog.rar"); JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "txlog.jar"); ja.addPackages(true, TxLogConnection.class.getPackage()); raa.addAsLibrary(ja); raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml"); return raa; }
Example #27
Source File: ResourceAdapterFactory.java From ironjacamar with Eclipse Public License 1.0 | 6 votes |
/** * Create the perf.rar * * @return The resource adapter archive */ public static ResourceAdapterArchive createPerfRar() { org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor raXml = Descriptors .create(org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor.class, "ra.xml").version("1.5"); org.jboss.shrinkwrap.descriptor.api.connector15.ResourceadapterType rt = raXml.getOrCreateResourceadapter(); org.jboss.shrinkwrap.descriptor.api.connector15.OutboundResourceadapterType ort = rt .getOrCreateOutboundResourceadapter().transactionSupport("XATransaction").reauthenticationSupport(false); org.jboss.shrinkwrap.descriptor.api.connector15.ConnectionDefinitionType cdt = ort.createConnectionDefinition() .managedconnectionfactoryClass(PerfManagedConnectionFactory.class.getName()) .connectionfactoryInterface(PerfConnectionFactory.class.getName()) .connectionfactoryImplClass(PerfConnectionFactoryImpl.class.getName()) .connectionInterface(PerfConnection.class.getName()) .connectionImplClass(PerfConnectionImpl.class.getName()); ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "perf.rar"); JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "perf.jar"); ja.addPackages(true, PerfConnection.class.getPackage()); raa.addAsLibrary(ja); raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml"); return raa; }
Example #28
Source File: FaultToleranceInterceptorEnableByXmlTest.java From microprofile-fault-tolerance with Apache License 2.0 | 6 votes |
@Deployment public static WebArchive deploy() { BeansDescriptor beans = Descriptors.create(BeansDescriptor.class) .getOrCreateInterceptors() .clazz("org.eclipse.microprofile.fault.tolerance.tck.interceptor.xmlInterceptorEnabling.EarlyFtInterceptor").up() .getOrCreateInterceptors() .clazz("org.eclipse.microprofile.fault.tolerance.tck.interceptor.xmlInterceptorEnabling.LateFtInterceptor").up(); JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "interceptorFtXml.jar") .addClasses(InterceptorComponent.class, EarlyFtInterceptor.class, LateFtInterceptor.class, OrderQueueProducer.class) .addAsManifestResource(new StringAsset(beans.exportAsString()), "beans.xml") .as(JavaArchive.class); return ShrinkWrap.create(WebArchive.class, "interceptorFtXml.war") .addAsLibrary(testJar); }
Example #29
Source File: SessionScopeTest.java From tomee with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.create(WebArchive.class, "SessionScopeTest.war") .addClass(PojoSessionScoped.class).addClass(PojoSessionScopedServletWrapper.class) .addAsLibraries(new File("target/test-libs/commons-httpclient.jar")) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")) .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class) .version("3.0") .createServlet().servletName("servlet").servletClass(PojoSessionScopedServletWrapper.class.getName()).up() .createServletMapping().servletName("servlet").urlPattern("/session").up() .exportAsString())); }
Example #30
Source File: ServletListenerEjbRemoteTest.java From tomee with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class) .version("3.0") .createListener() .listenerClass(RemoteServletContextListener.class.getName()).up() .createListener() .listenerClass(RemoteServletSessionListener.class.getName()).up() .createServlet() .servletName("check").servletClass(ServletToCheckListener.class.getName()).up() .createServletMapping() .servletName("check").urlPattern("/" + TEST_NAME).up(); WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war") .addClass(RemoteServletContextListener.class) .addClass(RemoteServletSessionListener.class) .addClass(ServletToCheckListener.class) .addClass(CompanyRemote.class) .addClass(DefaultCompany.class) .addClass(ContextAttributeName.class) .setWebXML(new StringAsset(descriptor.exportAsString())) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return archive; }