use of org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive in project tomee by apache.
the class EARTest 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);
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;
}
use of org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive 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;
}
use of org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive 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;
}
use of org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive in project javaee7-samples by javaee-samples.
the class FileWatcherTest method deploy.
@Deployment
public static EnterpriseArchive deploy() throws Exception {
final JavaArchive fsWatcherFileAdapter = ShrinkWrap.create(JavaArchive.class, "rar.jar").addPackages(true, Created.class.getPackage(), FileSystemWatcher.class.getPackage());
final ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, "fswatcher.rar").addAsLibrary(fsWatcherFileAdapter);
final JavaArchive fileWatcher = ShrinkWrap.create(JavaArchive.class, "mdb.jar").addClasses(FileEvent.class, FileWatchingMDB.class).addAsManifestResource("glassfish-ejb-jar.xml").addAsManifestResource("jboss-ejb3.xml").addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
final JavaArchive test = ShrinkWrap.create(JavaArchive.class, "test.jar").addClasses(FileWatcherTest.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
final JavaArchive[] testArchives = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.assertj:assertj-core", "com.jayway.awaitility:awaitility").withTransitivity().as(JavaArchive.class);
return ShrinkWrap.create(EnterpriseArchive.class, "test.ear").addAsModules(rar, fileWatcher).addAsLibraries(testArchives).addAsLibrary(test);
}
use of org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive in project wildfly by wildfly.
the class TransactionInflowTestCase method getResourceAdapterDeployment.
@Deployment(name = TransactionInflowMdb.RESOURCE_ADAPTER_NAME, order = 1)
public static ResourceAdapterArchive getResourceAdapterDeployment() {
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "inflow-txn-inside.jar").addClasses(TransactionInflowResourceAdapter.class).addClasses(TransactionInflowXid.class, TransactionInflowWork.class, TransactionInflowRaSpec.class, TransactionInflowTextMessage.class, TransactionInflowWorkListener.class, TimeoutUtil.class);
ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, TransactionInflowMdb.RESOURCE_ADAPTER_NAME + ".rar").addAsResource(TransactionInflowTestCase.class.getPackage(), "ra.xml", "META-INF/ra.xml").addAsManifestResource(createPermissionsXmlAsset(new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new RuntimePermission("defineClassInPackage.org.jboss.as.test.integration.transaction.inflow"), new PropertyPermission("ts.timeout.factor", "read")), "jboss-permissions.xml").addAsLibrary(jar);
System.out.println(rar.toString(true));
return rar;
}
Aggregations