deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject deltaspike git commit: DELTASPIKE-1141 fix EnableInterceptorsTest for CDI 1.0/Weld 1.x
Date Mon, 09 May 2016 16:40:19 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master d2558b7dd -> 07f519952


DELTASPIKE-1141 fix EnableInterceptorsTest for CDI 1.0/Weld 1.x


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/07f51995
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/07f51995
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/07f51995

Branch: refs/heads/master
Commit: 07f5199529a0e2cdb6dfbda20e4b16f060378b84
Parents: d2558b7
Author: Matej Novotny <manovotn@redhat.com>
Authored: Thu May 5 11:58:55 2016 +0200
Committer: Matej Novotny <manovotn@redhat.com>
Committed: Thu May 5 11:58:55 2016 +0200

----------------------------------------------------------------------
 deltaspike/modules/proxy/impl-asm5/pom.xml      |  7 ++++++
 .../EnableInterceptorsTest.java                 | 23 ++++++++++++--------
 2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/07f51995/deltaspike/modules/proxy/impl-asm5/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/impl-asm5/pom.xml b/deltaspike/modules/proxy/impl-asm5/pom.xml
index 473d3b9..d7153fc 100644
--- a/deltaspike/modules/proxy/impl-asm5/pom.xml
+++ b/deltaspike/modules/proxy/impl-asm5/pom.xml
@@ -120,6 +120,13 @@
             <artifactId>deltaspike-core-impl</artifactId>
             <scope>test</scope>
         </dependency>
+        
+        <!-- Allows to easily create beans.xml files with certain content -->     
  
+        <dependency>
+            <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/07f51995/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
index fe4ac33..adf4b09 100644
--- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
+++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
@@ -19,14 +19,17 @@
 package org.apache.deltaspike.proxy.impl.enableinterceptors;
 
 import javax.inject.Inject;
+
+import org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor;
 import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.Asset;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -37,23 +40,25 @@ public class EnableInterceptorsTest
     @Deployment
     public static WebArchive war()
     {
-        Asset beansXml = new StringAsset(
-            "<beans><interceptors><class>" +
-                    MyBeanInterceptor.class.getName() +
-            "</class></interceptors></beans>"
-        );
-
         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(beansXml, "beans.xml");
+                .addAsManifestResource(new StringAsset(beansWithEnablingInterceptor.exportAsString()),
"beans.xml");
 
         return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
                 .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive())
                 .addAsLibraries(testJar)
-                .addAsWebInfResource(beansXml, "beans.xml");
+                .addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml");
     }
 
     @Inject


Mime
View raw message