You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/12/19 11:31:25 UTC

tomee git commit: adding FailOnUnknowActivationSpec property to MDB container

Repository: tomee
Updated Branches:
  refs/heads/develop 5e45e0394 -> 1fd02e8ed


adding FailOnUnknowActivationSpec property to MDB container


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

Branch: refs/heads/develop
Commit: 1fd02e8ed31926454d581c049ba64f1edc8bd227
Parents: 5e45e03
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Fri Dec 19 11:31:18 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Fri Dec 19 11:31:18 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/openejb/core/mdb/MdbContainer.java | 13 +++++++++++--
 .../META-INF/org.apache.openejb/service-jar.xml        |  6 +++++-
 tck/cdi-embedded/pom.xml                               |  2 ++
 tck/cdi-embedded/src/test/resources/failing.xml        |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/1fd02e8e/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
index 8e7a8ba..268b0fd 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
@@ -79,18 +79,22 @@ public class MdbContainer implements RpcContainer {
     private final Class messageListenerInterface;
     private final Class activationSpecClass;
     private final int instanceLimit;
+    private final boolean failOnUnknowActivationSpec;
 
     private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<Object, BeanContext>();
     private final XAResourceWrapper xaResourceWrapper;
     private final InboundRecovery inboundRecovery;
 
-    public MdbContainer(final Object containerID, final SecurityService securityService, final ResourceAdapter resourceAdapter, final Class messageListenerInterface, final Class activationSpecClass, final int instanceLimit) {
+    public MdbContainer(final Object containerID, final SecurityService securityService, final ResourceAdapter resourceAdapter,
+                        final Class messageListenerInterface, final Class activationSpecClass, final int instanceLimit,
+                        final boolean failOnUnknowActivationSpec) {
         this.containerID = containerID;
         this.securityService = securityService;
         this.resourceAdapter = resourceAdapter;
         this.messageListenerInterface = messageListenerInterface;
         this.activationSpecClass = activationSpecClass;
         this.instanceLimit = instanceLimit;
+        this.failOnUnknowActivationSpec = failOnUnknowActivationSpec;
         xaResourceWrapper = SystemInstance.get().getComponent(XAResourceWrapper.class);
         inboundRecovery = SystemInstance.get().getComponent(InboundRecovery.class);
     }
@@ -213,7 +217,12 @@ public class MdbContainer implements RpcContainer {
             unusedProperties.remove("destinationType");
             unusedProperties.remove("beanClass");
             if (!unusedProperties.isEmpty()) {
-                throw new IllegalArgumentException("No setter found for the activation spec properties: " + unusedProperties);
+                final String text = "No setter found for the activation spec properties: " + unusedProperties;
+                if (failOnUnknowActivationSpec) {
+                    throw new IllegalArgumentException(text);
+                } else {
+                    logger.warning(text);
+                }
             }
 
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/1fd02e8e/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml b/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml
index a914854..b415e6a 100644
--- a/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml
+++ b/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml
@@ -462,7 +462,7 @@
           id="Default MDB Container"
           service="Container"
           types="MESSAGE"
-          constructor="id, securityService, ResourceAdapter, MessageListenerInterface, ActivationSpecClass, InstanceLimit"
+          constructor="id, securityService, ResourceAdapter, MessageListenerInterface, ActivationSpecClass, InstanceLimit, FailOnUnknowActivationSpec"
           class-name="org.apache.openejb.core.mdb.MdbContainer">
 
     # The resource adapter delivers messages to the container
@@ -482,6 +482,10 @@
 
     InstanceLimit 10
 
+    # log a warning if true or throw an exception if false is an activation spec can't be respected
+
+    FailOnUnknowActivationSpec = true
+
   </ServiceProvider>
 
   <!--

http://git-wip-us.apache.org/repos/asf/tomee/blob/1fd02e8e/tck/cdi-embedded/pom.xml
----------------------------------------------------------------------
diff --git a/tck/cdi-embedded/pom.xml b/tck/cdi-embedded/pom.xml
index b610046..5a9271a 100644
--- a/tck/cdi-embedded/pom.xml
+++ b/tck/cdi-embedded/pom.xml
@@ -142,6 +142,8 @@
             </property>
           </properties>
           <systemPropertyVariables>
+            <MDB>new://Container?type=Message</MDB>
+            <MDB.FailOnUnknowActivationSpec>false</MDB.FailOnUnknowActivationSpec>
             <!-- this is a nice perf optimization to have by default but TCKs play with it -->
             <openejb.cdi.applicationScope.cached>false</openejb.cdi.applicationScope.cached>
             <!-- not supported by the spec -->

http://git-wip-us.apache.org/repos/asf/tomee/blob/1fd02e8e/tck/cdi-embedded/src/test/resources/failing.xml
----------------------------------------------------------------------
diff --git a/tck/cdi-embedded/src/test/resources/failing.xml b/tck/cdi-embedded/src/test/resources/failing.xml
index b06474a..83b1d24 100644
--- a/tck/cdi-embedded/src/test/resources/failing.xml
+++ b/tck/cdi-embedded/src/test/resources/failing.xml
@@ -18,7 +18,7 @@
 <suite name="CDI TCK" verbose="0">
   <test name="CDI TCK">
     <classes>
-      <class name="org.jboss.cdi.tck.tests.alternative.selection.enterprise.EnterpriseSelectedAlternative03Test"/>
+      <class name="org.jboss.cdi.tck.tests.context.jms.MessageDrivenBeanContextTest"/>
     </classes>
   </test>
 </suite>