deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-763 check usage of disabled feature
Date Fri, 31 Oct 2014 07:44:19 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 3063a7693 -> 2a94f8c23


DELTASPIKE-763 check usage of disabled feature


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

Branch: refs/heads/master
Commit: 2a94f8c23f7c42936c36056fa1e8ed889a502b01
Parents: 3063a76
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Oct 31 08:43:56 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Oct 31 08:43:56 2014 +0100

----------------------------------------------------------------------
 .../testcontrol/impl/mock/AbstractMockManager.java    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2a94f8c2/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java
b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java
index bd0c21f..24a9f84 100644
--- a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java
+++ b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.testcontrol.impl.mock;
 
+import org.apache.deltaspike.core.api.config.ConfigResolver;
 import org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;
 import org.apache.deltaspike.testcontrol.api.mock.TypedMock;
 
@@ -33,6 +34,19 @@ public abstract class AbstractMockManager implements DynamicMockManager
     @Override
     public void addMock(Object mockInstance, Annotation... qualifiers)
     {
+        //check if this method gets used without changing the default-config
+        if (!Boolean.parseBoolean(ConfigResolver.getPropertyValue(
+            "deltaspike.testcontrol.mock-support.allow_mocked_beans", Boolean.FALSE.toString()))
&&
+                !Boolean.parseBoolean(ConfigResolver.getPropertyValue(
+                    "deltaspike.testcontrol.mock-support.allow_mocked_producers", Boolean.FALSE.toString())))
+        {
+            throw new IllegalStateException("The support for mocked CDI-Beans is disabled
" +
+                "due to a reduced portability across different CDI-implementations. " +
+                "Please set 'deltaspike.testcontrol.mock-support.allow_mocked_beans' and/or
" +
+                "'deltaspike.testcontrol.mock-support.allow_mocked_producers' to 'true' "
+
+                "(in 'META-INF/apache-deltaspike.properties') on your test-classpath.");
+        }
+
         Class<?> mockClass = mockInstance.getClass();
         Class<?> beanClass = mockClass.getSuperclass();
 


Mime
View raw message