myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1296809 - in /myfaces/extensions/cdi/trunk: core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/ test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/
Date Sun, 04 Mar 2012 14:07:59 GMT
Author: gpetracek
Date: Sun Mar  4 14:07:59 2012
New Revision: 1296809

URL: http://svn.apache.org/viewvc?rev=1296809&view=rev
Log:
EXTCDI-271 root-bean-manager support

Modified:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/BeanManagerProvider.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/BeanManagerProvider.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/BeanManagerProvider.java?rev=1296809&r1=1296808&r2=1296809&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/BeanManagerProvider.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/provider/BeanManagerProvider.java
Sun Mar  4 14:07:59 2012
@@ -50,6 +50,8 @@ import java.util.concurrent.ConcurrentHa
  */
 public class BeanManagerProvider implements Extension
 {
+    private static Boolean testMode;
+
     private static BeanManagerProvider bmp = null;
 
     private volatile Map<ClassLoader, BeanManagerHolder> bms = new ConcurrentHashMap<ClassLoader,
BeanManagerHolder>();
@@ -266,6 +268,23 @@ public class BeanManagerProvider impleme
             bmpFirst.bms.put(cl, beanManagerHolder);
         }
 
+        //override in any case in test-mode
+        /*
+         * use:
+         * new BeanManagerProvider() {
+         * @Override
+         * public void setTestMode() {
+         *     super.setTestMode();
+         *   }
+         * }.setTestMode();
+         *
+         * to activate it
+         */
+        if (Boolean.TRUE.equals(testMode))
+        {
+            bmpFirst.bms.put(cl, beanManagerHolder);
+        }
+
         CodiStartupBroadcaster.broadcastStartup();
     }
 
@@ -293,4 +312,14 @@ public class BeanManagerProvider impleme
 
         return bmp;
     }
+
+    protected void setTestMode()
+    {
+        activateTestMode();
+    }
+
+    private static void activateTestMode()
+    {
+        testMode = true;
+    }
 }

Modified: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java?rev=1296809&r1=1296808&r2=1296809&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java
(original)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java
Sun Mar  4 14:07:59 2012
@@ -69,6 +69,15 @@ public abstract class AbstractCdiAwareTe
     //@Before
     public void before()
     {
+        new BeanManagerProvider()
+        {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         this.testContainer = TestContainerFactory.createTestContainer(CdiTestContainer.class);
         this.testContainer.initEnvironment();
         this.testContainer.startContainer();



Mime
View raw message