WIP
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/85799f93 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/85799f93 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/85799f93 Branch: refs/heads/master Commit: 85799f936236b21f684e27dbb5c770c7a3f45997 Parents: 2b72bc8 Author: Otavio Santana <[email protected]> Authored: Mon Jul 10 08:12:47 2017 -0300 Committer: Otavio Santana <[email protected]> Committed: Tue Jul 11 08:42:48 2017 -0300 ---------------------------------------------------------------------- .../ActivationConfigPropertyOverride.java | 5 ++- .../openejb/activemq/AMQXASupportTest.java | 43 ++++++++++---------- .../apache/openejb/jee/MessageDrivenBean.java | 12 ++++++ 3 files changed, 37 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/85799f93/container/openejb-core/src/main/java/org/apache/openejb/config/ActivationConfigPropertyOverride.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ActivationConfigPropertyOverride.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ActivationConfigPropertyOverride.java index dc0d93f..249bfe7 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/ActivationConfigPropertyOverride.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ActivationConfigPropertyOverride.java @@ -88,8 +88,8 @@ public class ActivationConfigPropertyOverride implements DynamicDeployer { } } - Map<String, String> containerConfiguration = mdb.getConfiguation(); - List<String> keysToRemove = new ArrayList<>(); + //get all the configurations here + Map<String, String> containerConfiguration = mdb.getConfiguration(); // now try to use special keys @@ -98,6 +98,7 @@ public class ActivationConfigPropertyOverride implements DynamicDeployer { overrides.putAll(ConfigurationFactory.getOverrides(properties, ejbName + ".activation", "EnterpriseBean")); overrides.putAll(ConfigurationFactory.getOverrides(properties, ejbDeployment.getDeploymentId() + ".activation", "EnterpriseBean")); + //overides any configuration there already exist for (String key : containerConfiguration.keySet()) { String mdbKey = "mdb." + key; if (overrides.contains(mdbKey)) { http://git-wip-us.apache.org/repos/asf/tomee/blob/85799f93/container/openejb-core/src/test/java/org/apache/openejb/activemq/AMQXASupportTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/activemq/AMQXASupportTest.java b/container/openejb-core/src/test/java/org/apache/openejb/activemq/AMQXASupportTest.java index 1391f1e..4b79fb5 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/activemq/AMQXASupportTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/activemq/AMQXASupportTest.java @@ -5,14 +5,14 @@ * 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. + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.openejb.activemq; @@ -57,22 +57,22 @@ public class AMQXASupportTest { public Properties config() { return new PropertiesBuilder() - .p("amq", "new://Resource?type=ActiveMQResourceAdapter") - .p("amq.DataSource", "") - .p("amq.BrokerXmlConfig", "broker:(vm://localhost)") + .p("amq", "new://Resource?type=ActiveMQResourceAdapter") + .p("amq.DataSource", "") + .p("amq.BrokerXmlConfig", "broker:(vm://localhost)") - .p("target", "new://Resource?type=Queue") + .p("target", "new://Resource?type=Queue") - .p("mdbs", "new://Container?type=MESSAGE") - .p("mdbs.ResourceAdapter", "amq") + .p("mdbs", "new://Container?type=MESSAGE") + .p("mdbs.ResourceAdapter", "amq") - .p("cf", "new://Resource?type=" + ConnectionFactory.class.getName()) - .p("cf.ResourceAdapter", "amq") + .p("cf", "new://Resource?type=" + ConnectionFactory.class.getName()) + .p("cf.ResourceAdapter", "amq") - .p("xaCf", "new://Resource?class-name=" + ActiveMQXAConnectionFactory.class.getName()) - .p("xaCf.BrokerURL", "vm://localhost") + .p("xaCf", "new://Resource?class-name=" + ActiveMQXAConnectionFactory.class.getName()) + .p("xaCf.BrokerURL", "vm://localhost") - .build(); + .build(); } @Module @@ -128,8 +128,9 @@ public class AMQXASupportTest { } @MessageDriven(activationConfig = { - @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), - @ActivationConfigProperty(propertyName = "destination", propertyValue = "target") + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "target"), + @ActivationConfigProperty(propertyName = "configuration", propertyValue = "aaaa") }) public static class Listener implements MessageListener { public static CountDownLatch latch; http://git-wip-us.apache.org/repos/asf/tomee/blob/85799f93/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java ---------------------------------------------------------------------- diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java index 57ae0e0..db43e5d 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java @@ -29,6 +29,7 @@ import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -174,6 +175,9 @@ public class MessageDrivenBean implements EnterpriseBean, TimerConsumer, Invokab @XmlID protected String id; + @XmlAttribute + protected Map<String, String> configuration = new HashMap<>(); + public MessageDrivenBean() { } @@ -639,6 +643,14 @@ public class MessageDrivenBean implements EnterpriseBean, TimerConsumer, Invokab getAroundTimeout().add(new AroundTimeout(ejbClass, method)); } + public Map<String, String> getConfiguration() { + return configuration; + } + + public void setConfiguration(Map<String, String> configuration) { + this.configuration = configuration; + } + @Override public String getTimerConsumerName() { return ejbName;
