use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.
the class ServletEjbRemoteTest method createDeployment.
@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;
}
use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.
the class TomcatNamingFailOnWriteConfigurationTest method createWebArchive.
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;
}
use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.
the class ConnectorWithApplicationResourcesInEarTest method createDeployment.
@Deployment
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);
rar.setResourceAdapterXML(ConnectorWithApplicationResourcesInEarTest.class.getResource("/connector/ra.xml"));
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");
webArchive.addAsWebInfResource(ConnectorWithApplicationResourcesInEarTest.class.getResource("/connector/resources.xml"), "resources.xml");
webArchive.setWebXML(new StringAsset(webAppDescriptor.exportAsString()));
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;
}
use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.
the class TestSetup method createDeployment.
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;
}
use of org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor in project tomee by apache.
the class ServletCdiConstructorInjectionTest method createDeployment.
@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;
}
Aggregations