incubator-deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-112 root-bean-manager support
Date Sun, 04 Mar 2012 14:23:34 GMT
Updated Branches:
  refs/heads/master 8eddde6c6 -> 1aa44c213


DELTASPIKE-112 root-bean-manager support


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

Branch: refs/heads/master
Commit: 1aa44c213a9b1f6cdbf83e033f6e266177471352
Parents: 8eddde6
Author: gpetracek <gpetracek@apache.org>
Authored: Sun Mar 4 14:13:09 2012 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Sun Mar 4 15:18:19 2012 +0100

----------------------------------------------------------------------
 .../core/api/provider/BeanManagerHolder.java       |   38 +++++
 .../core/api/provider/BeanManagerProvider.java     |  105 ++++++++++++---
 .../core/api/provider/RootBeanManagerHolder.java   |   31 +++++
 .../alternative/global/GlobalAlternativeTest.java  |    9 ++
 .../api/alternative/local/BdaAlternativeTest.java  |    9 ++
 .../test/core/api/exclude/ExcludeTest.java         |    9 ++
 .../ExcludeTestProjectStageDevelopment.java        |    9 ++
 .../core/api/provider/BeanManagerProviderTest.java |    8 +
 .../test/core/api/provider/BeanProviderTest.java   |    9 ++
 .../impl/activation/TestClassDeactivation.java     |    9 ++
 .../test/core/impl/util/JndiUtilsTest.java         |    9 ++
 .../core/api/exclude/ExcludeIntegrationTest.java   |    9 ++
 .../impl/secured/SecuredAnnotationTest.java        |    9 ++
 13 files changed, 245 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerHolder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerHolder.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerHolder.java
new file mode 100644
index 0000000..66324f5
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerHolder.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.core.api.provider;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.spi.BeanManager;
+
+@Typed()
+class BeanManagerHolder
+{
+    private BeanManager beanManager;
+
+    BeanManagerHolder(BeanManager beanManager)
+    {
+        this.beanManager = beanManager;
+    }
+
+    BeanManager getBeanManager()
+    {
+        return beanManager;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
index db44228..cd13c7c 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
@@ -38,9 +38,9 @@ import org.apache.deltaspike.core.util.ClassUtils;
  * <p>This is really handy if you like to access CDI functionality
  * from places where no injection is available.</p>
  * <p>If a simple but manual bean-lookup is needed, it's easier to use the {@link BeanProvider}.</p>
- *
+ * <p/>
  * <p>As soon as an application shuts down, the reference to the {@link BeanManager}
will be removed.<p>
- *
+ * <p/>
  * <p>Usage:<p/>
  * <pre>
  * BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
@@ -48,9 +48,11 @@ import org.apache.deltaspike.core.util.ClassUtils;
  */
 public class BeanManagerProvider implements Extension
 {
+    private static Boolean testMode;
+
     private static BeanManagerProvider bmp = null;
 
-    private volatile Map<ClassLoader, BeanManager> bms = new ConcurrentHashMap<ClassLoader,
BeanManager>();
+    private volatile Map<ClassLoader, BeanManagerHolder> bms = new ConcurrentHashMap<ClassLoader,
BeanManagerHolder>();
 
     /**
      * Returns if the {@link BeanManagerProvider} has been initialized.
@@ -86,8 +88,8 @@ public class BeanManagerProvider implements Extension
         if (bmp == null)
         {
             throw new IllegalStateException("No " + BeanManagerProvider.class.getName() +
" in place! " +
-                "Please ensure that you configured the CDI implementation of your choice
properly. " +
-                "If your setup is correct, please clear all caches and compiled artifacts.");
+                    "Please ensure that you configured the CDI implementation of your choice
properly. " +
+                    "If your setup is correct, please clear all caches and compiled artifacts.");
         }
         return bmp;
     }
@@ -96,30 +98,53 @@ public class BeanManagerProvider implements Extension
     /**
      * The active {@link BeanManager} for the current application (/{@link ClassLoader}).
This method will throw an
      * {@link IllegalStateException} if the BeanManager cannot be found.
-     * 
+     *
      * @return the current bean-manager, never <code>null</code>
-     * @throws IllegalStateException
-     *             if the BeanManager cannot be found
+     * @throws IllegalStateException if the BeanManager cannot be found
      */
     public BeanManager getBeanManager()
     {
         ClassLoader classLoader = ClassUtils.getClassLoader(null);
 
-        BeanManager result = bms.get(classLoader);
+        BeanManagerHolder resultHolder = bms.get(classLoader);
+        BeanManager result;
 
-        if (result == null)
+        if (resultHolder == null)
         {
             result = resolveBeanManagerViaJndi();
 
-            if (result == null)
+            if (result != null)
             {
-                throw new IllegalStateException("Unable to find BeanManager. " +
-                        "Please ensure that you configured the CDI implementation of your
choice properly.");
+                bms.put(classLoader, new RootBeanManagerHolder(result));
             }
+        }
+        else
+        {
+            result = resultHolder.getBeanManager();
+
+            if (!(resultHolder instanceof RootBeanManagerHolder))
+            {
+                BeanManager jndiBeanManager = resolveBeanManagerViaJndi();
 
-            bms.put(classLoader, result);
+                if (jndiBeanManager != null && /*same instance check:*/jndiBeanManager
!= result)
+                {
+                    setRootBeanManager(jndiBeanManager);
 
+                    result = jndiBeanManager;
+                }
+                else
+                {
+                    setRootBeanManager(result);
+                }
+            }
+        }
+
+        if (result == null)
+        {
+            throw new IllegalStateException("Unable to find BeanManager. " +
+                    "Please ensure that you configured the CDI implementation of your choice
properly.");
         }
+
         return result;
     }
 
@@ -129,14 +154,47 @@ public class BeanManagerProvider implements Extension
      * {@link BeanManagerProvider} for all events which occur after the {@link AfterBeanDiscovery}
event.
      *
      * @param afterBeanDiscovery event which we don't actually use ;)
-     * @param beanManager the BeanManager we store and make available.
+     * @param beanManager        the BeanManager we store and make available.
      */
     protected void setBeanManager(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager
beanManager)
     {
+        setBeanManager(new BeanManagerHolder(beanManager));
+    }
+
+    public void setRootBeanManager(BeanManager beanManager)
+    {
+        setBeanManager(new RootBeanManagerHolder(beanManager));
+    }
+
+    private void setBeanManager(BeanManagerHolder beanManagerHolder)
+    {
         BeanManagerProvider bmpFirst = setBeanManagerProvider(this);
 
         ClassLoader cl = ClassUtils.getClassLoader(null);
-        bmpFirst.bms.put(cl, beanManager);
+
+        if (beanManagerHolder instanceof RootBeanManagerHolder ||
+                //the lat bm wins - as before, but don't replace a root-bmh with a normal
bmh
+                (!(bmpFirst.bms.get(cl) instanceof RootBeanManagerHolder)))
+        {
+            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);
+        }
 
         //X TODO Java-EE5 support needs to be discussed
         //CodiStartupBroadcaster.broadcastStartup();
@@ -144,16 +202,17 @@ public class BeanManagerProvider implements Extension
 
     /**
      * Cleanup on container shutdown
+     *
      * @param beforeShutdown cdi shutdown event
      */
-    protected void cleanupStoredBeanManagerOnShutdown(@Observes BeforeShutdown beforeShutdown)
+    public void cleanupStoredBeanManagerOnShutdown(@Observes BeforeShutdown beforeShutdown)
     {
         bms.remove(ClassUtils.getClassLoader(null));
     }
 
     /**
      * Get the BeanManager from the JNDI registry.
-     *
+     * <p/>
      * Workaround for JBossAS 6 (see EXTCDI-74)
      * {@link #setBeanManager(javax.enterprise.inject.spi.AfterBeanDiscovery, javax.enterprise.inject.spi.BeanManager)}
      * is called in context of a different {@link ClassLoader}
@@ -189,4 +248,14 @@ public class BeanManagerProvider implements Extension
 
         return bmp;
     }
+
+    protected void setTestMode()
+    {
+        activateTestMode();
+    }
+
+    private static void activateTestMode()
+    {
+        testMode = true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/RootBeanManagerHolder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/RootBeanManagerHolder.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/RootBeanManagerHolder.java
new file mode 100644
index 0000000..00c2038
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/RootBeanManagerHolder.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.core.api.provider;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.spi.BeanManager;
+
+@Typed()
+class RootBeanManagerHolder extends BeanManagerHolder
+{
+    RootBeanManagerHolder(BeanManager beanManager)
+    {
+        super(beanManager);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
index 8b5d4b8..3949c3a 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.alternative.global;
 
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.test.category.SeCategory;
 import org.apache.deltaspike.test.core.api.alternative.global.qualifier.AlternativeBaseBeanB;
@@ -66,6 +67,14 @@ public class GlobalAlternativeTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         return ShrinkWrap.create(WebArchive.class, "globalAlternative.war")
                 .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
                         "META-INF/beans.xml",

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
index 56fe49c..2ffba19 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.alternative.local;
 
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
 import org.jboss.arquillian.container.test.api.Deployment;
@@ -51,6 +52,14 @@ public class BdaAlternativeTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         return ShrinkWrap.create(WebArchive.class, "bdaAlternative.war")
                 .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
                         "META-INF/beans.xml",

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java
index eb5bf34..2f92d7b 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.exclude;
 
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.impl.exclude.ExcludeExtension;
 import org.apache.deltaspike.core.util.ProjectStageProducer;
@@ -46,6 +47,14 @@ public class ExcludeTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         System.setProperty("org.apache.deltaspike.ProjectStage", "Production");
         ProjectStageProducer.setProjectStage(null);
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java
index 9b10a57..cc337d5 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.exclude;
 
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.util.ProjectStageProducer;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
@@ -43,6 +44,14 @@ public class ExcludeTestProjectStageDevelopment
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         System.setProperty("org.apache.deltaspike.ProjectStage", "Development");
         ProjectStageProducer.setProjectStage(null);
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
index d184d4c..f7be1dc 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
@@ -41,6 +41,14 @@ public class BeanManagerProviderTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         return ShrinkWrap.create(WebArchive.class, "beanManagerProvider.war")
                 .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
                         "META-INF/beans.xml",

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
index 645487c..2fbbecc 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.provider;
 
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
 import org.jboss.arquillian.container.test.api.Deployment;
@@ -41,6 +42,14 @@ public class BeanProviderTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         return ShrinkWrap.create(WebArchive.class, "beanProvider.war")
                 .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
                           "META-INF/beans.xml",

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
index 6e75c19..5866df4 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.test.core.impl.activation;
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.util.ClassDeactivation;
 import org.apache.deltaspike.test.core.api.provider.TestBean;
 import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
@@ -45,6 +46,14 @@ public class TestClassDeactivation
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         URL fileUrl = TestClassDeactivation.class.getClassLoader()
                 .getResource("META-INF/apache-deltaspike.properties");
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
index b9bbb3c..4cdcc23 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.test.core.impl.util;
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.impl.util.JndiUtils;
 import org.apache.deltaspike.test.category.WebProfileCategory;
 import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
@@ -42,6 +43,14 @@ public class JndiUtilsTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         return ShrinkWrap.create(WebArchive.class, "jndiUtils.war")
                 .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
                         "META-INF/beans.xml",

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/core/integration-test/src/test/java/org/apache/deltaspike/integration/core/api/exclude/ExcludeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/integration-test/src/test/java/org/apache/deltaspike/integration/core/api/exclude/ExcludeIntegrationTest.java
b/deltaspike/core/integration-test/src/test/java/org/apache/deltaspike/integration/core/api/exclude/ExcludeIntegrationTest.java
index a6e4600..bdba9ba 100644
--- a/deltaspike/core/integration-test/src/test/java/org/apache/deltaspike/integration/core/api/exclude/ExcludeIntegrationTest.java
+++ b/deltaspike/core/integration-test/src/test/java/org/apache/deltaspike/integration/core/api/exclude/ExcludeIntegrationTest.java
@@ -20,6 +20,7 @@ package org.apache.deltaspike.integration.core.api.exclude;
 
 
 import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.util.ProjectStageProducer;
 import org.apache.deltaspike.integration.core.api.projectstage.IntegrationTestProjectStageProducer;
@@ -57,6 +58,14 @@ public class ExcludeIntegrationTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         URL deltaSpikeConfig = ExcludeIntegrationTest.class.getClassLoader()
                 .getResource("META-INF/apache-deltaspike.properties");
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1aa44c21/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
index d914ba1..18b44c2 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.test.security.impl.secured;
 
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.impl.exclude.ExcludeExtension;
 import org.apache.deltaspike.core.util.ClassUtils;
@@ -45,6 +46,14 @@ public class SecuredAnnotationTest
     @Deployment
     public static WebArchive deploy()
     {
+        new BeanManagerProvider() {
+            @Override
+            public void setTestMode()
+            {
+                super.setTestMode();
+            }
+        }.setTestMode();
+
         //X TODO remove this workaround
         boolean isOwbAvailable = ClassUtils.tryToLoadClassForName("org.apache.webbeans.spi.ContainerLifecycle")
!= null;
 


Mime
View raw message