Search in sources :

Example 1 with ConnectorDescriptor

use of org.jboss.shrinkwrap.descriptor.api.connector10.ConnectorDescriptor in project tomee by apache.

the class Runner method createDeployment.

@Deployment(testable = false)
public static EnterpriseArchive createDeployment() {
    final JavaArchive apiJar = ShrinkWrap.create(JavaArchive.class, "api.jar");
    apiJar.addPackages(true, "org.tomitribe.connector.starter.api");
    System.out.println(apiJar.toString(true));
    System.out.println();
    final JavaArchive rarLib = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    rarLib.addPackages(false, "org.tomitribe.connector.starter.adapter", "org.tomitribe.connector.starter.authenticator");
    System.out.println(rarLib.toString(true));
    System.out.println();
    final ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, "test.rar");
    rar.addAsLibraries(rarLib);
    final ConnectorDescriptor raXml = Descriptors.create(ConnectorDescriptor.class);
    rar.setResourceAdapterXML(new StringAsset(raXml.exportAsString()));
    System.out.println(rar.toString(true));
    System.out.println();
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");
    final WebAppDescriptor webXml = Descriptors.create(WebAppDescriptor.class);
    webXml.description("Test webapp");
    war.addPackages(true, "org.superbiz");
    war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    war.setWebXML(new StringAsset(webXml.exportAsString()));
    System.out.println(war.toString(true));
    System.out.println();
    // Make the EAR
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear").addAsModule(rar).addAsModule(war).addAsLibraries(apiJar);
    final ApplicationDescriptor applicationDescriptor = Descriptors.create(ApplicationDescriptor.class);
    applicationDescriptor.libraryDirectory("lib");
    applicationDescriptor.createModule().getOrCreateWeb().contextRoot("test").webUri("test.war");
    applicationDescriptor.getOrCreateModule().connector("test.rar");
    System.out.println(applicationDescriptor.exportAsString());
    ear.setApplicationXML(new StringAsset(applicationDescriptor.exportAsString()));
    System.out.println(ear.toString(true));
    System.out.println();
    return ear;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) ConnectorDescriptor(org.jboss.shrinkwrap.descriptor.api.connector10.ConnectorDescriptor) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ResourceAdapterArchive(org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ApplicationDescriptor(org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

Deployment (org.jboss.arquillian.container.test.api.Deployment)1 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)1 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)1 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)1 ResourceAdapterArchive (org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive)1 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)1 ApplicationDescriptor (org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor)1 ConnectorDescriptor (org.jboss.shrinkwrap.descriptor.api.connector10.ConnectorDescriptor)1 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)1