Search in sources :

Example 21 with WebAppDescriptor

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

the class ServletCdiProducerTest method createDeployment.

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

Example 22 with WebAppDescriptor

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

the class DescriptorComplementsAnnotationsTest method createDeployment.

@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;
}
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) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 23 with WebAppDescriptor

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

the class ServletEnvEntryInjectionTest method createDeployment.

@Deployment(testable = false)
public static WebArchive createDeployment() {
    final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createServlet().servletName("servlet").servletClass(PojoServlet.class.getName()).up().createServletMapping().servletName("servlet").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", Code.class.getName(), "OK");
    final Node appNode = ((NodeDescriptor) descriptor).getRootNode();
    appNode.createChild("/env-entry").createChild("env-entry-name").text("name").getParent().createChild("lookup-name").text("java:module/ModuleName");
    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(PojoServlet.class).addClass(Code.class).setWebXML(new StringAsset(descriptor.exportAsString()));
    return archive;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) Node(org.jboss.shrinkwrap.descriptor.spi.node.Node) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) NodeDescriptor(org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptor) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 24 with WebAppDescriptor

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

the class ServletFilterEnvEntryInjectionTest method createDeployment.

@Deployment(testable = false)
public static WebArchive createDeployment() {
    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createFilter().filterName("filter").filterClass(PojoServletFilter.class.getName()).up().createFilterMapping().filterName("filter").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", "Code.OK");
    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(Code.class).addClass(PojoServletFilter.class).addClass(Car.class).addClass(CompanyLocal.class).addClass(Company.class).addClass(DefaultCompany.class).addClass(SuperMarket.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 25 with WebAppDescriptor

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

the class ServletListenerEnvEntryInjectionTest 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)

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