Search in sources :

Example 6 with NodeDescriptor

use of org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptor 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 7 with NodeDescriptor

use of org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptor in project tomee by apache.

the class ServletListenerEjbLocalInjectionTest method addEnvEntry.

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);
}
Also used : Node(org.jboss.shrinkwrap.descriptor.spi.node.Node) NodeDescriptor(org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptor)

Aggregations

Node (org.jboss.shrinkwrap.descriptor.spi.node.Node)7 NodeDescriptor (org.jboss.shrinkwrap.descriptor.spi.node.NodeDescriptor)7 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)1 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)1 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)1