openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1796619 - in /openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src: main/java/org/apache/webbeans/arquillian/standalone/ test/java/org/apache/webbeans/arquillian/test/
Date Mon, 29 May 2017 12:31:25 GMT
Author: struberg
Date: Mon May 29 12:31:25 2017
New Revision: 1796619

URL: http://svn.apache.org/viewvc?rev=1796619&view=rev
Log:
OWB-1184 move our Arquillian connector to implement the BdaScannerService

This is needed to also support trimmed BDAs in the TCKs

Added:
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianTrimmedBdaJarDeploymentTest.java
      - copied, changed from r1796598, openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianImplicitBdaJarDeploymentTest.java
Modified:
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java?rev=1796619&r1=1796618&r2=1796619&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
Mon May 29 12:31:25 2017
@@ -22,8 +22,8 @@ import javax.enterprise.inject.spi.BeanM
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.spi.BDABeansXmlScanner;
+import org.apache.webbeans.spi.BdaScannerService;
 import org.apache.webbeans.spi.BeanArchiveService;
-import org.apache.webbeans.spi.ScannerService;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.ArchivePath;
 import org.jboss.shrinkwrap.api.Filters;
@@ -41,6 +41,8 @@ import java.lang.annotation.Annotation;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -48,7 +50,7 @@ import java.util.Set;
 /**
  *
  */
-public class OwbArquillianScannerService implements ScannerService
+public class OwbArquillianScannerService implements BdaScannerService
 {
 
     private static final String WEB_INF_CLASS_FOLDER = "/WEB-INF/classes/";
@@ -62,7 +64,7 @@ public class OwbArquillianScannerService
     private Archive archive;
 
     private UrlSet beansXmls = new UrlSet();
-    private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+    private Map<BeanArchiveService.BeanArchiveInformation, Set<Class<?>>>
beanClassesPerBda = new HashMap<>();
 
 
     public OwbArquillianScannerService()
@@ -123,14 +125,20 @@ public class OwbArquillianScannerService
     @Override
     public Set<Class<?>> getBeanClasses()
     {
-        return beanClasses;
+        return Collections.EMPTY_SET;
+    }
+
+    @Override
+    public Map<BeanArchiveService.BeanArchiveInformation, Set<Class<?>>>
getBeanClassesPerBda()
+    {
+        return beanClassesPerBda;
     }
 
     @Override
     public void release()
     {
         beansXmls.clear();
-        beanClasses.clear();
+        beanClassesPerBda.clear();
     }
 
     @Override
@@ -214,6 +222,12 @@ public class OwbArquillianScannerService
     private void scanClasses(final BeanArchiveService.BeanArchiveInformation info,
                              final Map<ArchivePath, Node> classes, String classBasePath)
     {
+        Set<Class<?>> bdaClasses = beanClassesPerBda.get(info);
+        if (bdaClasses == null)
+        {
+            bdaClasses = new HashSet<>();
+            beanClassesPerBda.put(info, bdaClasses);
+        }
         if (info != null && info.getBeanDiscoveryMode() == BeanArchiveService.BeanDiscoveryMode.NONE)
         {
             // this jar should not get scanned at all.
@@ -272,7 +286,7 @@ public class OwbArquillianScannerService
                 }
             }
 
-            beanClasses.add(beanClass);
+            bdaClasses.add(beanClass);
         }
     }
 
@@ -340,6 +354,6 @@ public class OwbArquillianScannerService
         archive = null;
 
         beansXmls = new UrlSet();
-        beanClasses = new HashSet<Class<?>>();
+        beanClassesPerBda = new HashMap<>();
     }
 }

Copied: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianTrimmedBdaJarDeploymentTest.java
(from r1796598, openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianImplicitBdaJarDeploymentTest.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianTrimmedBdaJarDeploymentTest.java?p2=openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianTrimmedBdaJarDeploymentTest.java&p1=openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianImplicitBdaJarDeploymentTest.java&r1=1796598&r2=1796619&rev=1796619&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianImplicitBdaJarDeploymentTest.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianTrimmedBdaJarDeploymentTest.java
Mon May 29 12:31:25 2017
@@ -26,6 +26,7 @@ import org.apache.webbeans.arquillian.te
 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.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,11 +34,10 @@ import org.junit.runner.RunWith;
 
 
 /**
- * This test verifies the deployment of a JAR packaging with implicit BDAs.
- * This is if NO beans.xml is present!
+ * This test verifies the deployment of a JAR packaging with &lt;trim/&gt; BDAs.
  */
 @RunWith(Arquillian.class)
-public class OwbArquillianImplicitBdaJarDeploymentTest
+public class OwbArquillianTrimmedBdaJarDeploymentTest
 {
     private @Inject SampleUser sampleUser;
 
@@ -48,8 +48,9 @@ public class OwbArquillianImplicitBdaJar
     {
         JavaArchive testJar = ShrinkWrap
                 .create(JavaArchive.class, "sampleImplicitBdaTest.jar")
-                .addClass(OwbArquillianImplicitBdaJarDeploymentTest.class)
-                .addPackage(SampleUser.class.getPackage());
+                .addClass(OwbArquillianTrimmedBdaJarDeploymentTest.class)
+                .addPackage(SampleUser.class.getPackage())
+                .addAsManifestResource(new StringAsset("<beans><trim/></beans>"),
"beans.xml");
 
         return testJar;
     }



Mime
View raw message