Search in sources :

Example 1 with EnableInterceptorsInterceptor

use of org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor in project deltaspike by apache.

the class EnableInterceptorsTest method war.

@Deployment
public static WebArchive war() {
    String simpleName = EnableInterceptorsTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
    // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor
    BeansDescriptor beansWithEnablingInterceptor = Descriptors.create(BeansDescriptor.class);
    beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName());
    // war archive needs MyBeanInterceptor enabled
    BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
    beans.getOrCreateInterceptors().clazz(MyBeanInterceptor.class.getName());
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar").addPackage(EnableInterceptorsTest.class.getPackage()).addAsManifestResource(new StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml");
    return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()).addAsLibraries(testJar).addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) EnableInterceptorsInterceptor(org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

EnableInterceptorsInterceptor (org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)1 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)1 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)1 BeansDescriptor (org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor)1