Search in sources :

Example 26 with WebAppDescriptor

use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.

the class ServletListenerEjbLocalInjectionTest method createDeployment.

@Deployment(testable = false)
public static WebArchive createDeployment() {
    final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version("3.0").createListener().listenerClass(PojoServletContextListener.class.getName()).up().createListener().listenerClass(PojoServletSessionListener.class.getName()).up().createServlet().servletName("check").servletClass(ServletToCheckListener.class.getName()).up().createServletMapping().servletName("check").urlPattern("/" + TEST_NAME).up();
    addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
    addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
    addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
    addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
    addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
    addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
    addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
    addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
    // addEnvEntry(descriptor, "defaultCode", "java.lang.Enum", "org.apache.openejb.arquillian.ServletListenerPojoInjectionTest$Code.OK");
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(PojoServletContextListener.class).addClass(PojoServletSessionListener.class).addClass(ServletToCheckListener.class).addClass(Car.class).addClass(CompanyLocal.class).addClass(Company.class).addClass(DefaultCompany.class).addClass(SuperMarket.class).addClass(Code.class).addClass(ContextAttributeName.class).setWebXML(new StringAsset(descriptor.exportAsString())).addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
    return archive;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 27 with WebAppDescriptor

use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.

the class ServletListenerPersistenceInjectionTest method createDeployment.

@Deployment(testable = false)
public static WebArchive createDeployment() {
    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version("3.0").createListener().listenerClass(PersistenceServletContextListener.class.getName()).up().createListener().listenerClass(PersistenceServletSessionListener.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(PersistenceServletContextListener.class).addClass(PersistenceServletSessionListener.class).addClass(ServletToCheckListener.class).addClass(Address.class).addClass(ContextAttributeName.class).addAsManifestResource("persistence.xml", ArchivePaths.create("persistence.xml")).setWebXML(new StringAsset(descriptor.exportAsString())).addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
    return archive;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 28 with WebAppDescriptor

use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.

the class ServletPersistenceInjectionTest method createDeployment.

@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;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) Runner(org.apache.openejb.arquillian.tests.Runner) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) Test(org.junit.Test) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 29 with WebAppDescriptor

use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor 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)

Example 30 with WebAppDescriptor

use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.

the class DeployInWebAppsDirectoryTest method createDeployment.

public static EnterpriseArchive createDeployment() {
    final JavaArchive apiJar = ShrinkWrap.create(JavaArchive.class, "connector-sample-api.jar");
    apiJar.addPackage("org.superbiz.connector.api");
    System.out.println("API JAR:\n" + apiJar.toString(true));
    final JavaArchive implJar = ShrinkWrap.create(JavaArchive.class, "connector-sample-impl.jar");
    implJar.addPackage("org.superbiz.connector.adapter");
    System.out.println("IMPL JAR:\n" + implJar.toString(true));
    final ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, "connector-sample-ra.rar");
    rar.addAsLibraries(implJar);
    final File raXml = Basedir.basedir("../connector-sample-rar/src/main/rar/META-INF/ra.xml");
    rar.setResourceAdapterXML(raXml);
    System.out.println("RAR:\n" + rar.toString(true));
    final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "connector-sample-war.war");
    webArchive.addPackage("org.superbiz.application");
    final WebAppDescriptor webAppDescriptor = Descriptors.create(WebAppDescriptor.class);
    webAppDescriptor.version("3.0");
    final File resourcesXml = Basedir.basedir("../connector-sample-war/src/main/webapp/WEB-INF/resources.xml");
    webArchive.addAsWebInfResource(resourcesXml);
    webArchive.setWebXML(new StringAsset(webAppDescriptor.exportAsString()));
    webArchive.addAsWebInfResource(resourcesXml);
    webArchive.addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml");
    System.out.println("Webapp:\n" + webArchive.toString(true));
    final EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class, "connector-sample.ear");
    enterpriseArchive.addAsLibraries(apiJar);
    enterpriseArchive.addAsModule(rar);
    enterpriseArchive.addAsModule(webArchive);
    ApplicationDescriptor applicationXml = Descriptors.create(ApplicationDescriptor.class);
    applicationXml.displayName("connector-sample-ear");
    applicationXml.createModule().getOrCreateWeb().webUri("connector-sample-war.war").contextRoot("/sample").up().up().createModule().connector("connector-sample-ra.rar").up().libraryDirectory("lib");
    enterpriseArchive.setApplicationXML(new StringAsset(applicationXml.exportAsString()));
    System.out.println(enterpriseArchive.toString(true));
    return enterpriseArchive;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ResourceAdapterArchive(org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ApplicationDescriptor(org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor)

Aggregations

WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)28 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)26 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)25 Deployment (org.jboss.arquillian.container.test.api.Deployment)21 Test (org.junit.Test)14 HashMap (java.util.HashMap)7 Runner (org.apache.openejb.arquillian.tests.Runner)7 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor)7 ClassLoaderAsset (org.jboss.shrinkwrap.api.asset.ClassLoaderAsset)6 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)4 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)4 ResourceAdapterArchive (org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive)4 ApplicationDescriptor (org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor)4 File (java.io.File)2 InputStream (java.io.InputStream)2 Map (java.util.Map)2 Yaml (org.yaml.snakeyaml.Yaml)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 GatewayServlet (org.apache.knox.gateway.GatewayServlet)1