use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project camel by apache.
the class ArquillianPackager method addSpringbootPackage.
private static JavaArchive addSpringbootPackage(JavaArchive ark, String... packageNames) throws Exception {
Iterable<ClassLoader> classLoaders = Collections.singleton(Thread.currentThread().getContextClassLoader());
for (String packageName : packageNames) {
for (final ClassLoader classLoader : classLoaders) {
final URLPackageScanner.Callback callback = new URLPackageScanner.Callback() {
@Override
public void classFound(String className) {
ArchivePath classNamePath = AssetUtil.getFullPathForClassResource(className);
Asset asset = new ClassLoaderAsset(classNamePath.get().substring(1), classLoader);
ArchivePath location = new BasicPath(CLASSES_FOLDER + "/", classNamePath);
ark.add(asset, location);
}
};
final URLPackageScanner scanner = URLPackageScanner.newInstance(true, classLoader, callback, packageName);
scanner.scanPackage();
}
}
return ark;
}
use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project tomee by apache.
the class JPAInjectionTest method getArchive.
@Deployment(testable = false)
public static WebArchive getArchive() {
PersistenceDescriptor persistenceDescriptor = Descriptors.create(PersistenceDescriptor.class).createPersistenceUnit().name("test-pu").transactionType("JTA").clazz(PersistenceDescriptor.class.getName()).jtaDataSource("test-ds").up();
Asset persistenceAsset = new StringAsset(persistenceDescriptor.exportAsString());
return base("jsf-jpa-test.war").addAsWebInfResource(persistenceAsset, "persistence.xml").addClasses(DummyManagedBean.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsWebResource(new ClassLoaderAsset(JPAInjectionTest.class.getPackage().getName().replace('.', '/').concat("/").concat("dummy.xhtml")), "dummy.xhtml");
}
use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project tomee by apache.
the class IvmContextTest method createDeployment.
@Deployment(testable = false)
public static WebArchive createDeployment() {
WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createServlet().servletName(SERVLET_NAME).servletClass(IvmContextServlet.class.getName()).up().createServletMapping().servletName(SERVLET_NAME).urlPattern("/" + TEST_NAME).up();
WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(IvmContextTest.class).addClass(IvmContextServlet.class).addClass(NamingBean.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;
}
use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project tomee by apache.
the class SessionSynchronizationCallbackTest method createDeployment.
@Deployment(testable = false)
public static WebArchive createDeployment() {
WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createServlet().servletName(SERVLET_NAME).servletClass(SessionSynchronizationCallbackServlet.class.getName()).up().createServletMapping().servletName(SERVLET_NAME).urlPattern("/" + TEST_NAME).up();
WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(SessionSynchronizationCallbackServlet.class).addClass(StatefulBean.class).addClass(TestEntity.class).addClass(Runner.class).addAsLibraries(JarLocation.jarLocation(Test.class)).addAsResource(new ClassLoaderAsset(PERSISTENCE_XML_SOURCE), PERSISTENCE_XML_DESTINATION).setWebXML(new StringAsset(descriptor.exportAsString()));
return archive;
}
use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project tomee by apache.
the class MultiplePersistenceTest method createDeployment.
@Deployment(testable = false)
public static WebArchive createDeployment() {
WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createServlet().servletName("check").servletClass(MultiplePUServlet.class.getName()).up().createServletMapping().servletName("check").urlPattern("/" + TEST_NAME).up();
WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(MultiplePUServlet.class).addClass(Person1.class).addClass(Person2.class).addClass(Runner.class).addAsLibraries(JarLocation.jarLocation(Test.class)).addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/persistence/multiple/persistence.xml"), "META-INF/persistence.xml").setWebXML(new StringAsset(descriptor.exportAsString()));
return archive;
}
Aggregations