You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2009/08/27 22:57:50 UTC

svn commit: r808626 - in /openejb/trunk/openejb3/container/openejb-jee/src: main/java/org/apache/openejb/jee/MessageDrivenBean.java test/java/org/apache/openejb/jee/JeeTest.java test/resources/ejb-jar-mdb-2.0.xml

Author: dblevins
Date: Thu Aug 27 20:57:49 2009
New Revision: 808626

URL: http://svn.apache.org/viewvc?rev=808626&view=rev
Log:
OPENEJB-1065: EJB 2.0 deprecated acknowledge-mode tag not supported
OPENEJB-1066: EJB 2.0 deprecated message-selector tag not supported
Relates to OPENEJB-701: EJB 2.0 depricated message-driven-destination tag not supported

Added:
    openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml   (with props)
Modified:
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java
    openejb/trunk/openejb3/container/openejb-jee/src/test/java/org/apache/openejb/jee/JeeTest.java

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java?rev=808626&r1=808625&r2=808626&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java Thu Aug 27 20:57:49 2009
@@ -91,6 +91,8 @@
         "messagingType",
         "timeoutMethod",
         "transactionType",
+        "messageSelector",
+        "acknowledgeMode",
         "messageDrivenDestination",
         "messageDestinationType",
         "messageDestinationLink",
@@ -130,8 +132,6 @@
     protected NamedMethod timeoutMethod;
     @XmlElement(name = "transaction-type")
     protected TransactionType transactionType;
-    @XmlElement(name = "message-driven-destination")
-    protected MessageDrivenDestination messageDrivenDestination;
     @XmlElement(name = "message-destination-type")
     protected String messageDestinationType;
     @XmlElement(name = "message-destination-link")
@@ -300,12 +300,46 @@
         this.timeoutMethod = value;
     }
 
+
     public MessageDrivenDestination getMessageDrivenDestination() {
-        return messageDrivenDestination;
+        return null;
     }
 
+    @XmlElement(name = "message-driven-destination")
     public void setMessageDrivenDestination(MessageDrivenDestination value) {
-        this.messageDrivenDestination = value;
+        if (activationConfig == null) activationConfig = new ActivationConfig();
+        DestinationType destinationType = value.getDestinationType();
+        if (destinationType != null) {
+            activationConfig.addProperty("destinationType", destinationType.getvalue());
+        }
+        SubscriptionDurability subscriptionDurability = value.getSubscriptionDurability();
+        if (subscriptionDurability != null) {
+            activationConfig.addProperty("subscriptionDurability", subscriptionDurability.getvalue());
+        }
+    }
+
+    @XmlElement(name = "message-selector")
+    public String getMessageSelector() {
+        return null;
+    }
+
+    public void setMessageSelector(String messageSelector) {
+        if (messageSelector != null) {
+            if (activationConfig == null) activationConfig = new ActivationConfig();
+            activationConfig.addProperty("messageSelector", messageSelector);
+        }
+    }
+
+    @XmlElement(name = "acknowledge-mode")
+    public String getAcknowledgeMode() {
+        return null;
+    }
+
+    public void setAcknowledgeMode(String acknowledgeMode) {
+        if (acknowledgeMode != null) {
+            if (activationConfig == null) activationConfig = new ActivationConfig();
+            activationConfig.addProperty("acknowledgeMode", acknowledgeMode);
+        }
     }
 
     public TransactionType getTransactionType() {
@@ -350,23 +384,6 @@
     }
 
     public ActivationConfig getActivationConfig() {
-        // convert the message-driven-destination to activation-config-property
-        // OPENEJB-701 EJB 2.0 depricated message-driven-destination tag not supported
-        // https://issues.apache.org/jira/browse/OPENEJB-701
-        if (messageDrivenDestination != null) {
-            if (activationConfig == null) {
-                activationConfig = new ActivationConfig();
-            }
-            DestinationType destinationType = messageDrivenDestination.getDestinationType();
-            if (destinationType != null) {
-                activationConfig.addProperty("destinationType", destinationType.getvalue());
-            }
-            SubscriptionDurability subscriptionDurability = messageDrivenDestination.getSubscriptionDurability();
-            if (subscriptionDurability != null) {
-                activationConfig.addProperty("subscriptionDurability", subscriptionDurability.getvalue());
-            }
-            messageDrivenDestination = null;
-        }
         return activationConfig;
     }
 

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/java/org/apache/openejb/jee/JeeTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/java/org/apache/openejb/jee/JeeTest.java?rev=808626&r1=808625&r2=808626&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/java/org/apache/openejb/jee/JeeTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/java/org/apache/openejb/jee/JeeTest.java Thu Aug 27 20:57:49 2009
@@ -42,6 +42,7 @@
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 
 /**
  * @version $Revision$ $Date$
@@ -85,6 +86,33 @@
         System.out.println("time: " + (System.currentTimeMillis() - start));
     }
 
+    public void testEjbJarMdb20() throws Exception {
+        String fileName = "ejb-jar-mdb-2.0.xml";
+        InputStream in = this.getClass().getClassLoader().getResourceAsStream(fileName);
+
+        Object o = JaxbJavaee.unmarshal(EjbJar.class, in);
+
+        EjbJar ejbJar = (EjbJar) o;
+
+        MessageDrivenBean bean = (MessageDrivenBean) ejbJar.getEnterpriseBean("MyMdb");
+
+        Properties properties = bean.getActivationConfig().toProperties();
+
+        assertEquals(4, properties.size());
+        /*
+      <message-selector>mySelector</message-selector>
+      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
+      <message-driven-destination>
+        <destination-type>javax.jms.Queue</destination-type>
+        <subscription-durability>Durable</subscription-durability>
+
+         */
+        assertEquals("mySelector", properties.get("messageSelector"));
+        assertEquals("Auto-acknowledge", properties.get("acknowledgeMode"));
+        assertEquals("javax.jms.Queue", properties.get("destinationType"));
+        assertEquals("Durable", properties.get("subscriptionDurability"));
+    }
+
     public void testApplication() throws Exception {
         marshalAndUnmarshal(Application.class, "application-example.xml");
     }

Added: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml?rev=808626&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml (added)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml Thu Aug 27 20:57:49 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    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.
+-->
+
+<!-- $Rev: 600204 $ $Date: 2007-12-01 14:35:03 -0800 (Sat, 01 Dec 2007) $ -->
+
+<ejb-jar>
+  <enterprise-beans>
+    <message-driven>
+      <ejb-name>MyMdb</ejb-name>
+      <ejb-class>org.superbiz.MyMdb</ejb-class>
+      <transaction-type>Bean</transaction-type>
+      <message-selector>mySelector</message-selector>
+      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
+      <message-driven-destination>
+        <destination-type>javax.jms.Queue</destination-type>
+        <subscription-durability>Durable</subscription-durability>
+      </message-driven-destination>
+    </message-driven>
+  </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Propchange: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-mdb-2.0.xml
------------------------------------------------------------------------------
    svn:eol-style = native