diff --git a/activemq-jms-server/pom.xml b/activemq-jms-server/pom.xml index c39a31e6b6..73215aebf2 100644 --- a/activemq-jms-server/pom.xml +++ b/activemq-jms-server/pom.xml @@ -36,6 +36,11 @@ activemq-server ${project.version} + + org.apache.activemq + activemq-service-extensions + ${project.version} + org.jboss.spec.javax.jms jboss-jms-api_2.0_spec diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridge.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridge.java index b50923a85f..986d6d123b 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridge.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridge.java @@ -86,14 +86,6 @@ public interface JMSBridge extends ActiveMQComponent void setClientID(String clientID); - String getTransactionManagerLocatorClass(); - - void setTransactionManagerLocatorClass(String transactionManagerLocatorClass); - - String getTransactionManagerLocatorMethod(); - - void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod); - boolean isAddMessageIDInHeader(); void setAddMessageIDInHeader(boolean value); diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridgeControl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridgeControl.java index 1b1dc012f2..3f1c503a26 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridgeControl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/JMSBridgeControl.java @@ -78,14 +78,6 @@ public interface JMSBridgeControl extends ActiveMQComponentControl void setClientID(String clientID); - String getTransactionManagerLocatorClass(); - - void setTransactionManagerLocatorClass(String transactionManagerLocatorClass); - - String getTransactionManagerLocatorMethod(); - - void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod); - boolean isAddMessageIDInHeader(); void setAddMessageIDInHeader(boolean value); diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeControlImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeControlImpl.java index 68f5ec4a1f..59af74b1ea 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeControlImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeControlImpl.java @@ -136,16 +136,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont return bridge.getTargetUsername(); } - public String getTransactionManagerLocatorClass() - { - return bridge.getTransactionManagerLocatorClass(); - } - - public String getTransactionManagerLocatorMethod() - { - return bridge.getTransactionManagerLocatorMethod(); - } - public boolean isAddMessageIDInHeader() { return bridge.isAddMessageIDInHeader(); @@ -233,16 +223,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont bridge.setTargetUsername(name); } - public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass) - { - bridge.setTransactionManagerLocatorClass(transactionManagerLocatorClass); - } - - public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod) - { - bridge.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod); - } - // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeImpl.java index 4e77486ea7..169bce8d9c 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/bridge/impl/JMSBridgeImpl.java @@ -36,7 +36,6 @@ import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.TransactionRolledbackException; import javax.transaction.xa.XAResource; -import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; @@ -66,6 +65,7 @@ import org.apache.activemq.jms.client.ActiveMQMessage; import org.apache.activemq.jms.server.ActiveMQJMSServerBundle; import org.apache.activemq.jms.server.recovery.ActiveMQRegistryBase; import org.apache.activemq.jms.server.recovery.XARecoveryConfig; +import org.apache.activemq.service.extensions.ServiceUtils; import org.apache.activemq.utils.ClassloadingUtil; import org.apache.activemq.utils.DefaultSensitiveStringCodec; import org.apache.activemq.utils.PasswordMaskingUtil; @@ -167,10 +167,6 @@ public final class JMSBridgeImpl implements JMSBridge private int forwardMode; - private String transactionManagerLocatorClass = "org.apache.activemq.integration.jboss.tm.JBoss5TransactionManagerLocator"; - - private String transactionManagerLocatorMethod = "getTm"; - private MBeanServer mbeanServer; private ObjectName objectName; @@ -404,7 +400,7 @@ public final class JMSBridgeImpl implements JMSBridge checkParams(); - TransactionManager tm = getTm(); + TransactionManager tm = ServiceUtils.getTransactionManager(); // There may already be a JTA transaction associated to the thread @@ -839,27 +835,6 @@ public final class JMSBridgeImpl implements JMSBridge this.clientID = clientID; } - public String getTransactionManagerLocatorClass() - { - return transactionManagerLocatorClass; - } - - public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass) - { - checkBridgeNotStarted(); - this.transactionManagerLocatorClass = transactionManagerLocatorClass; - } - - public String getTransactionManagerLocatorMethod() - { - return transactionManagerLocatorMethod; - } - - public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod) - { - this.transactionManagerLocatorMethod = transactionManagerLocatorMethod; - } - public boolean isAddMessageIDInHeader() { return addMessageIDInHeader; @@ -1038,7 +1013,7 @@ public final class JMSBridgeImpl implements JMSBridge ActiveMQJMSBridgeLogger.LOGGER.trace("Starting JTA transaction"); } - TransactionManager tm = getTm(); + TransactionManager tm = ServiceUtils.getTransactionManager(); // Set timeout to a large value since we do not want to time out while waiting for messages // to arrive - 10 years should be enough @@ -1061,33 +1036,6 @@ public final class JMSBridgeImpl implements JMSBridge return tx; } - private TransactionManager getTm() - { - if (tm == null) - { - try - { - Object o = safeInitNewInstance(transactionManagerLocatorClass); - Method m = o.getClass().getMethod(transactionManagerLocatorMethod); - tm = (TransactionManager) m.invoke(o); - } - catch (Exception e) - { - throw new IllegalStateException("unable to create TransactionManager from " + transactionManagerLocatorClass + - "." + - transactionManagerLocatorMethod, - e); - } - - if (tm == null) - { - throw new IllegalStateException("Cannot locate a transaction manager"); - } - } - - return tm; - } - private Connection createConnection(final String username, final String password, final ConnectionFactoryFactory cff, final String clientID, diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRALogger.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRALogger.java index fbad1e6a38..caa35d2d56 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRALogger.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRALogger.java @@ -75,10 +75,6 @@ public interface ActiveMQRALogger extends BasicLogger @Message(id = 151005, value = "awaiting ActiveMQ Server availability", format = Message.Format.MESSAGE_FORMAT) void awaitingJMSServerCreation(); - @LogMessage(level = Logger.Level.WARN) - @Message(id = 152000, value = "It wasn''t possible to lookup for a Transaction Manager through the configured properties TransactionManagerLocatorClass and TransactionManagerLocatorMethod\nActiveMQ Resource Adapter won''t be able to set and verify transaction timeouts in certain cases.", format = Message.Format.MESSAGE_FORMAT) - void noTXLocator(); - @LogMessage(level = Logger.Level.WARN) @Message(id = 152001, value = "problem resetting ActiveMQ xa session after failure", format = Message.Format.MESSAGE_FORMAT) void problemResettingXASession(); diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRAProperties.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRAProperties.java index 703ed77398..51282f6895 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRAProperties.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRAProperties.java @@ -58,18 +58,6 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements */ private Boolean localTx = false; - - /** - * Class used to locate the Transaction Manager. - * Using JBoss5 as the default locator - */ - private String transactionManagerLocatorClass = "org.apache.activemq.integration.jboss.tm.JBoss5TransactionManagerLocator;org.apache.activemq.integration.jboss.tm.JBoss4TransactionManagerLocator"; - - /** - * Method used to locate the TM - */ - private String transactionManagerLocatorMethod = "getTm;getTM"; - private static final int DEFAULT_SETUP_ATTEMPTS = -1; private static final long DEFAULT_SETUP_INTERVAL = 2 * 1000; @@ -236,27 +224,6 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements this.localTx = localTx; } - - public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass) - { - this.transactionManagerLocatorClass = transactionManagerLocatorClass; - } - - public String getTransactionManagerLocatorClass() - { - return transactionManagerLocatorClass; - } - - public String getTransactionManagerLocatorMethod() - { - return transactionManagerLocatorMethod; - } - - public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod) - { - this.transactionManagerLocatorMethod = transactionManagerLocatorMethod; - } - public int getSetupAttempts() { return setupAttempts; diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRaUtils.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRaUtils.java index 676abfc12e..5911723e78 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRaUtils.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQRaUtils.java @@ -17,7 +17,6 @@ package org.apache.activemq.ra; import javax.naming.Context; -import javax.transaction.TransactionManager; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; @@ -254,39 +253,6 @@ public final class ActiveMQRaUtils return res; } - - /** - * The Resource adapter can't depend on any provider's specific library. Because of that we use reflection to locate the - * transaction manager during startup. - *

- *

- * TODO: https://jira.jboss.org/browse/HORNETQ-417 - * We should use a proper SPI instead of reflection - * We would need to define a proper SPI package for this. - */ - public static TransactionManager locateTM(final String locatorClass, final String locatorMethod) - { - return AccessController.doPrivileged(new PrivilegedAction() - { - public TransactionManager run() - { - try - { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - Class aClass = loader.loadClass(locatorClass); - Object o = aClass.newInstance(); - Method m = aClass.getMethod(locatorMethod); - return (TransactionManager) m.invoke(o); - } - catch (Throwable e) - { - ActiveMQRALogger.LOGGER.debug(e.getMessage(), e); - return null; - } - } - }); - } - /** * Within AS7 the RA is loaded by JCA. properties can only be passed in String form. However if * RA is configured using jgroups stack, we need to pass a Channel object. As is impossible with diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java index 3aa392ef2e..1675f3f11a 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java @@ -53,6 +53,7 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.ra.inflow.ActiveMQActivation; import org.apache.activemq.ra.inflow.ActiveMQActivationSpec; import org.apache.activemq.ra.recovery.RecoveryManager; +import org.apache.activemq.service.extensions.ServiceUtils; import org.apache.activemq.utils.SensitiveDataCodec; import org.jgroups.JChannel; @@ -247,7 +248,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable ActiveMQRALogger.LOGGER.trace("start(" + ctx + ")"); } - locateTM(); + tm = ServiceUtils.getTransactionManager(); recoveryManager.start(useAutoRecovery); @@ -1810,24 +1811,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable return defaultActiveMQConnectionFactory; } - /** - * @param transactionManagerLocatorClass - * @see ActiveMQRAProperties#setTransactionManagerLocatorClass(java.lang.String) - */ - public void setTransactionManagerLocatorClass(String transactionManagerLocatorClass) - { - raProperties.setTransactionManagerLocatorClass(transactionManagerLocatorClass); - } - - /** - * @return - * @see ActiveMQRAProperties#getTransactionManagerLocatorClass() - */ - public String getTransactionManagerLocatorClass() - { - return raProperties.getTransactionManagerLocatorClass(); - } - /** * @return * @see ActiveMQRAProperties#getJgroupsChannelLocatorClass() @@ -1864,24 +1847,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable raProperties.setJgroupsChannelRefName(jgroupsChannelRefName); } - /** - * @return - * @see ActiveMQRAProperties#getTransactionManagerLocatorMethod() - */ - public String getTransactionManagerLocatorMethod() - { - return raProperties.getTransactionManagerLocatorMethod(); - } - - /** - * @param transactionManagerLocatorMethod - * @see ActiveMQRAProperties#setTransactionManagerLocatorMethod(java.lang.String) - */ - public void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod) - { - raProperties.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod); - } - public ActiveMQConnectionFactory createActiveMQConnectionFactory(final ConnectionFactoryProperties overrideProperties) { ActiveMQConnectionFactory cf; @@ -2173,31 +2138,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable return map; } - private void locateTM() - { - String[] locatorClasses = raProperties.getTransactionManagerLocatorClass().split(";"); - String[] locatorMethods = raProperties.getTransactionManagerLocatorMethod().split(";"); - - for (int i = 0; i < locatorClasses.length; i++) - { - tm = ActiveMQRaUtils.locateTM(locatorClasses[i], locatorMethods[i]); - if (tm != null) - { - break; - } - } - - if (tm == null) - { - ActiveMQRALogger.LOGGER.noTXLocator(); - } - else - { - ActiveMQRALogger.LOGGER.debug("TM located = " + tm); - } - } - - private void setParams(final ActiveMQConnectionFactory cf, final ConnectionFactoryProperties overrideProperties) { diff --git a/activemq-service-extensions/pom.xml b/activemq-service-extensions/pom.xml index ea44ad2b33..c0072b3d46 100644 --- a/activemq-service-extensions/pom.xml +++ b/activemq-service-extensions/pom.xml @@ -26,6 +26,10 @@ org.jboss.logging jboss-logging-processor + + org.apache.geronimo.specs + geronimo-jta_1.1_spec + junit junit diff --git a/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/ServiceUtils.java b/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/ServiceUtils.java index 1e38f62399..240916ccf0 100644 --- a/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/ServiceUtils.java +++ b/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/ServiceUtils.java @@ -16,10 +16,13 @@ */ package org.apache.activemq.service.extensions; +import javax.transaction.TransactionManager; import javax.transaction.xa.XAResource; +import java.util.Iterator; import java.util.Map; import java.util.ServiceLoader; +import org.apache.activemq.service.extensions.transactions.TransactionManagerLocator; import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapper; import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapperFactory; import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapperFactoryImpl; @@ -32,6 +35,10 @@ public class ServiceUtils { private static ActiveMQXAResourceWrapperFactory activeMQXAResourceWrapperFactory; + private static TransactionManager transactionManager; + + private static boolean transactionManagerLoaded = false; + private static ActiveMQXAResourceWrapperFactory getActiveMQXAResourceWrapperFactory() { if (activeMQXAResourceWrapperFactory == null) @@ -46,6 +53,20 @@ public class ServiceUtils return getActiveMQXAResourceWrapperFactory().wrap(xaResource, properties); } + public static synchronized TransactionManager getTransactionManager() + { + if (!transactionManagerLoaded) + { + Iterator it = ServiceLoader.load(TransactionManagerLocator.class).iterator(); + if (it.hasNext()) + { + transactionManager = it.next().getTransactionManager(); + } + transactionManagerLoaded = true; + } + return transactionManager; + } + private static void setActiveMQXAResourceWrapperFactory(Iterable iterable) { if (iterable.iterator().hasNext()) diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss4TransactionManagerLocator.java b/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/transactions/TransactionManagerLocator.java similarity index 78% rename from integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss4TransactionManagerLocator.java rename to activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/transactions/TransactionManagerLocator.java index 17e6910a8c..d0d249b152 100644 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss4TransactionManagerLocator.java +++ b/activemq-service-extensions/src/main/java/org/apache/activemq/service/extensions/transactions/TransactionManagerLocator.java @@ -14,19 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.integration.jboss.tm; +package org.apache.activemq.service.extensions.transactions; import javax.transaction.TransactionManager; -import org.jboss.tm.TransactionManagerLocator; - /** * @author Andy Taylor */ -public class JBoss4TransactionManagerLocator +public interface TransactionManagerLocator { - public TransactionManager getTm() - { - return TransactionManagerLocator.getInstance().locate(); - } + TransactionManager getTransactionManager(); } diff --git a/activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/DummyTransactionManagerLocator.java b/activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/DummyTransactionManagerLocator.java new file mode 100644 index 0000000000..d26efc3efc --- /dev/null +++ b/activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/DummyTransactionManagerLocator.java @@ -0,0 +1,94 @@ +/** + * 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.activemq.service.extensions.tests.transactions; + +import org.apache.activemq.service.extensions.transactions.TransactionManagerLocator; + +import javax.transaction.HeuristicMixedException; +import javax.transaction.HeuristicRollbackException; +import javax.transaction.InvalidTransactionException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.SystemException; +import javax.transaction.Transaction; +import javax.transaction.TransactionManager; + +/** + * @author Andy Taylor + */ +public class DummyTransactionManagerLocator implements TransactionManagerLocator,TransactionManager +{ + @Override + public void begin() throws NotSupportedException, SystemException + { + + } + + @Override + public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException + { + + } + + @Override + public int getStatus() throws SystemException + { + return 0; + } + + @Override + public Transaction getTransaction() throws SystemException + { + return null; + } + + @Override + public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException + { + + } + + @Override + public void rollback() throws IllegalStateException, SecurityException, SystemException + { + + } + + @Override + public void setRollbackOnly() throws IllegalStateException, SystemException + { + + } + + @Override + public void setTransactionTimeout(int i) throws SystemException + { + + } + + @Override + public Transaction suspend() throws SystemException + { + return null; + } + + @Override + public TransactionManager getTransactionManager() + { + return this; + } +} diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss5TransactionManagerLocator.java b/activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/TransactionManagerLocatorTest.java similarity index 67% rename from integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss5TransactionManagerLocator.java rename to activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/TransactionManagerLocatorTest.java index f5fa9ddc67..ee4b8de667 100644 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/tm/JBoss5TransactionManagerLocator.java +++ b/activemq-service-extensions/src/test/java/org/apache/activemq/service/extensions/tests/transactions/TransactionManagerLocatorTest.java @@ -14,19 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.integration.jboss.tm; +package org.apache.activemq.service.extensions.tests.transactions; -import javax.transaction.TransactionManager; - -import org.jboss.tm.TransactionManagerLocator; +import org.apache.activemq.service.extensions.ServiceUtils; +import org.junit.Assert; +import org.junit.Test; /** * @author Andy Taylor */ -public class JBoss5TransactionManagerLocator +public class TransactionManagerLocatorTest extends Assert { - public TransactionManager getTm() + @Test + public void getTM() { - return TransactionManagerLocator.locateTransactionManager(); + assertNotNull(ServiceUtils.getTransactionManager()); + assertEquals(ServiceUtils.getTransactionManager().getClass(), DummyTransactionManagerLocator.class); } } diff --git a/activemq-service-extensions/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator b/activemq-service-extensions/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator new file mode 100644 index 0000000000..c4bc639d2f --- /dev/null +++ b/activemq-service-extensions/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator @@ -0,0 +1 @@ +org.apache.activemq.service.extensions.tests.transactions.DummyTransactionManagerLocator \ No newline at end of file diff --git a/integration/activemq-jboss-as-integration/pom.xml b/integration/activemq-jboss-as-integration/pom.xml deleted file mode 100644 index bb7eaa3099..0000000000 --- a/integration/activemq-jboss-as-integration/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - 4.0.0 - - - org.apache.activemq - activemq-pom - 6.0.0-SNAPSHOT - ../../pom.xml - - - activemq-jboss-as-integration - jar - ActiveMQ6 JBoss AS Integration - - - ${project.basedir}/../.. - - - - - org.jboss.logging - jboss-logging-processor - - - - - org.jboss.logging - jboss-logging - - - org.apache.activemq - activemq-server - ${project.version} - - - org.jboss.security - jboss-security-spi - - - org.jboss.security - jbosssx - - - org.apache.geronimo.specs - geronimo-ejb_3.0_spec - - - org.jboss - jboss-transaction-spi - - - - org.jboss.jbossts.jts - jbossjts-jacorb - - - - diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossBundle.java b/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossBundle.java deleted file mode 100644 index beb074f4a0..0000000000 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossBundle.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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.activemq.integration.jboss; - - -import org.jboss.logging.annotations.MessageBundle; - -/** - * @author Andy Taylor - * 3/12/12 - * - * Logger Code 13 - * - * each message id must be 6 digits long starting with 13, the 3rd digit should be 9 - * - * so 139000 to 139999 - */ -@MessageBundle(projectCode = "AMQ") -public class ActiveMQJBossBundle -{ -} diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossLogger.java b/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossLogger.java deleted file mode 100644 index ad79bdcc7a..0000000000 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/ActiveMQJBossLogger.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * 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.activemq.integration.jboss; - -import javax.security.auth.Subject; - -import org.jboss.logging.BasicLogger; -import org.jboss.logging.Logger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; - -/** - * @author Andy Taylor - * 3/15/12 - * - * Logger Code 13 - * - * each message id must be 6 digits long starting with 13, the 3rd digit donates the level so - * - * INF0 1 - * WARN 2 - * DEBUG 3 - * ERROR 4 - * TRACE 5 - * FATAL 6 - * - * so an INFO message would be 131000 to 131999 - */ -@MessageLogger(projectCode = "AMQ") -public interface ActiveMQJBossLogger extends BasicLogger -{ - /** - * The jboss integration logger. - */ - ActiveMQJBossLogger LOGGER = Logger.getMessageLogger(ActiveMQJBossLogger.class, ActiveMQJBossLogger.class.getPackage().getName()); - - @LogMessage(level = Logger.Level.INFO) - @Message(id = 131001, value = "Security Context Setting Subject = {0}", - format = Message.Format.MESSAGE_FORMAT) - void settingSecuritySubject(Subject subject); - - @LogMessage(level = Logger.Level.WARN) - @Message(id = 132001, value = "An error happened while setting the context", - format = Message.Format.MESSAGE_FORMAT) - void errorSettingSecurityContext(@Cause Throwable Throwable); -} diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/AS4SecurityActions.java b/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/AS4SecurityActions.java deleted file mode 100644 index 5823ce4b11..0000000000 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/AS4SecurityActions.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * 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.activemq.integration.jboss.security; - -import java.security.AccessController; -import java.security.Principal; -import java.security.PrivilegedAction; - -import javax.security.auth.Subject; - -import org.jboss.security.SecurityAssociation; - -/** A collection of privileged actions for this package - * @author Scott.Stark@jboss.org - * @author Alexey Loubyansky - * @author Tim Fox - * @author anil saldhana - * @version $Revison: 1.0$ - */ - -/** - * @author Andy Taylor - * Created Oct 21, 2009 - */ -public class AS4SecurityActions -{ - interface PrincipalInfoAction - { - PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction() - { - public void push(final Principal principal, final Object credential, final Subject subject) - { - AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - SecurityAssociation.pushSubjectContext(subject, principal, credential); - return null; - } - }); - } - - public void dup() - { - AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - SecurityAssociation.dupSubjectContext(); - return null; - } - }); - } - - public void pop() - { - AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - SecurityAssociation.popSubjectContext(); - return null; - } - }); - } - }; - - PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction() - { - public void push(final Principal principal, final Object credential, final Subject subject) - { - SecurityAssociation.pushSubjectContext(subject, principal, credential); - } - - public void dup() - { - SecurityAssociation.dupSubjectContext(); - } - - public void pop() - { - SecurityAssociation.popSubjectContext(); - } - }; - - void push(Principal principal, Object credential, Subject subject); - - void dup(); - - void pop(); - } - - static void pushSubjectContext(final Principal principal, final Object credential, final Subject subject) - { - if (System.getSecurityManager() == null) - { - PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject); - } - else - { - PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject); - } - } - - static void popSubjectContext() - { - if (System.getSecurityManager() == null) - { - PrincipalInfoAction.NON_PRIVILEGED.pop(); - } - else - { - PrincipalInfoAction.PRIVILEGED.pop(); - } - } -} diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/JBossASSecurityManager.java b/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/JBossASSecurityManager.java deleted file mode 100644 index 8292eadd71..0000000000 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/JBossASSecurityManager.java +++ /dev/null @@ -1,313 +0,0 @@ -/** - * 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.activemq.integration.jboss.security; - -import java.security.AccessController; -import java.security.Principal; -import java.security.PrivilegedAction; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.InitialContext; -import javax.security.auth.Subject; - -import org.apache.activemq.core.security.CheckType; -import org.apache.activemq.core.security.Role; -import org.apache.activemq.core.server.ActiveMQComponent; -import org.apache.activemq.integration.jboss.ActiveMQJBossLogger; -import org.apache.activemq.spi.core.security.ActiveMQSecurityManager; -import org.jboss.security.AuthenticationManager; -import org.jboss.security.RealmMapping; -import org.jboss.security.SecurityContext; -import org.jboss.security.SecurityContextAssociation; -import org.jboss.security.SimplePrincipal; - -/** - * This implementation delegates to the JBoss AS security interfaces (which in turn use JAAS) - * It can be used when running ActiveMQ in JBoss AS - * - * @author Andy Taylor - * @author Tim Fox - */ -public class JBossASSecurityManager implements ActiveMQSecurityManager, ActiveMQComponent -{ - // Static -------------------------------------------------------- - - // Attributes ---------------------------------------------------- - - private final boolean trace = ActiveMQJBossLogger.LOGGER.isTraceEnabled(); - - /** - * the realmmapping - */ - private RealmMapping realmMapping; - - /** - * the JAAS Authentication Manager - */ - private AuthenticationManager authenticationManager; - - /** - * The JNDI name of the AuthenticationManager(and RealmMapping since they are the same object). - */ - private String securityDomainName = "java:/jaas/activemq"; - - private boolean started; - - private boolean isAs5 = true; - - private boolean allowClientLogin = false; - - private boolean authoriseOnClientLogin = false; - - public boolean validateUser(final String user, final String password) - { - SimplePrincipal principal = new SimplePrincipal(user); - - char[] passwordChars = null; - - if (password != null) - { - passwordChars = password.toCharArray(); - } - - Subject subject = new Subject(); - - return authenticationManager.isValid(principal, passwordChars, subject); - } - - public boolean validateUserAndRole(final String user, - final String password, - final Set roles, - final CheckType checkType) - { - if (allowClientLogin && SecurityContextAssociation.isClient()) - { - return authoriseOnClientLogin ? useClientAuthentication(roles, checkType) : true; - } - else - { - return useConnectionAuthentication(user, password, roles, checkType); - } - } - - private boolean useConnectionAuthentication(final String user, - final String password, - final Set roles, - final CheckType checkType) - { - return AccessController.doPrivileged(new PrivilegedAction() - { - public Boolean run() - { - - SimplePrincipal principal = user == null ? null : new SimplePrincipal(user); - - char[] passwordChars = null; - - if (password != null) - { - passwordChars = password.toCharArray(); - } - - Subject subject = new Subject(); - - boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject); - // Authenticate. Successful authentication will place a new SubjectContext on thread local, - // which will be used in the authorization process. However, we need to make sure we clean up - // thread local immediately after we used the information, otherwise some other people - // security my be screwed up, on account of thread local security stack being corrupted. - if (authenticated) - { - pushSecurityContext(principal, passwordChars, subject); - Set rolePrincipals = getRolePrincipals(checkType, roles); - - authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals); - - if (trace) - { - ActiveMQJBossLogger.LOGGER.trace("user " + user + - (authenticated ? " is " : " is NOT ") + - "authorized"); - } - popSecurityContext(); - } - return authenticated; - } - }); - } - - private boolean useClientAuthentication(final Set roles, final CheckType checkType) - { - return AccessController.doPrivileged(new PrivilegedAction() - { - public Boolean run() - { - SecurityContext sc = SecurityContextAssociation.getSecurityContext(); - Principal principal = sc.getUtil().getUserPrincipal(); - - char[] passwordChars = (char[])sc.getUtil().getCredential(); - - Subject subject = sc.getSubjectInfo().getAuthenticatedSubject(); - - boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject); - - if (authenticated) - { - Set rolePrincipals = getRolePrincipals(checkType, roles); - - authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals); - - if (trace) - { - ActiveMQJBossLogger.LOGGER.trace("user " + principal.getName() + - (authenticated ? " is " : " is NOT ") + - "authorized"); - } - } - return authenticated; - } - - }); - - } - - private void popSecurityContext() - { - if (isAs5) - { - SecurityActions.popSubjectContext(); - } - else - { - AS4SecurityActions.popSubjectContext(); - } - } - - private void pushSecurityContext(final SimplePrincipal principal, final char[] passwordChars, final Subject subject) - { - if (isAs5) - { - SecurityActions.pushSubjectContext(principal, passwordChars, subject, securityDomainName); - } - else - { - AS4SecurityActions.pushSubjectContext(principal, passwordChars, subject); - } - } - - public void addRole(final String user, final String role) - { - // NO-OP - } - - public void addUser(final String user, final String password) - { - // NO-OP - } - - public void removeRole(final String user, final String role) - { - // NO-OP - } - - public void removeUser(final String user) - { - // NO-OP - } - - public void setDefaultUser(final String username) - { - // NO-OP - } - - private Set getRolePrincipals(final CheckType checkType, final Set roles) - { - Set principals = new HashSet(); - for (Role role : roles) - { - if (checkType.hasRole(role)) - { - principals.add(new SimplePrincipal(role.getName())); - } - } - return principals; - } - - public void setRealmMapping(final RealmMapping realmMapping) - { - this.realmMapping = realmMapping; - } - - public void setAuthenticationManager(final AuthenticationManager authenticationManager) - { - this.authenticationManager = authenticationManager; - } - - /** - * lifecycle method, needs to be called - * - * @throws Exception - */ - public synchronized void start() throws Exception - { - if (started) - { - return; - } - - InitialContext ic = new InitialContext(); - authenticationManager = (AuthenticationManager)ic.lookup(securityDomainName); - realmMapping = (RealmMapping)authenticationManager; - - started = true; - } - - public synchronized void stop() - { - if (!started) - { - return; - } - started = false; - } - - public synchronized boolean isStarted() - { - return started; - } - - public void setSecurityDomainName(final String securityDomainName) - { - this.securityDomainName = securityDomainName; - } - - public void setAs5(final boolean as5) - { - isAs5 = as5; - } - - public void setAllowClientLogin(final boolean allowClientLogin) - { - this.allowClientLogin = allowClientLogin; - } - - public void setAuthoriseOnClientLogin(final boolean authoriseOnClientLogin) - { - this.authoriseOnClientLogin = authoriseOnClientLogin; - } -} diff --git a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/SecurityActions.java b/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/SecurityActions.java deleted file mode 100644 index 006880da0b..0000000000 --- a/integration/activemq-jboss-as-integration/src/main/java/org/apache/activemq/integration/jboss/security/SecurityActions.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * 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.activemq.integration.jboss.security; - -import java.security.AccessController; -import java.security.Principal; -import java.security.PrivilegedAction; - -import javax.security.auth.Subject; - -import org.apache.activemq.integration.jboss.ActiveMQJBossLogger; -import org.jboss.security.SecurityContext; -import org.jboss.security.SecurityContextAssociation; -import org.jboss.security.SecurityContextFactory; - -/** A collection of privileged actions for this package - * @author Scott.Stark@jboss.org - * @author Alexey Loubyansky - * @author Tim Fox - * @version $Revison: 1.0$ - */ -class SecurityActions -{ - interface PrincipalInfoAction - { - PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction() - { - public void push(final Principal principal, - final Object credential, - final Subject subject, - final String securityDomain) - { - AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - - try - { - ActiveMQJBossLogger.LOGGER.settingSecuritySubject(subject); - // SecurityAssociation.pushSubjectContext(subject, principal, credential); - SecurityContext sc = SecurityContextAssociation.getSecurityContext(); - if (sc == null) - { - try - { - sc = SecurityContextFactory.createSecurityContext(principal, - credential, - subject, - securityDomain); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - else - { - sc.getUtil().createSubjectInfo(principal, credential, subject); - } - - SecurityContextAssociation.setSecurityContext(sc); - } - catch (Throwable t) - { - ActiveMQJBossLogger.LOGGER.errorSettingSecurityContext(t); - } - - return null; - } - }); - } - - public void pop() - { - AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - // SecurityAssociation.popSubjectContext(); - SecurityContextAssociation.clearSecurityContext(); - return null; - } - }); - } - }; - - PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction() - { - public void push(final Principal principal, - final Object credential, - final Subject subject, - final String securityDomain) - { - // SecurityAssociation.pushSubjectContext(subject, principal, credential); - SecurityContext sc = SecurityContextAssociation.getSecurityContext(); - if (sc == null) - { - try - { - sc = SecurityContextFactory.createSecurityContext(principal, credential, subject, securityDomain); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - else - { - sc.getUtil().createSubjectInfo(principal, credential, subject); - } - SecurityContextAssociation.setSecurityContext(sc); - } - - public void pop() - { - // SecurityAssociation.popSubjectContext(); - SecurityContextAssociation.clearSecurityContext(); - } - }; - - void push(Principal principal, Object credential, Subject subject, String securityDomain); - - void pop(); - } - - static void pushSubjectContext(final Principal principal, - final Object credential, - final Subject subject, - final String securityDomainName) - { - if (System.getSecurityManager() == null) - { - PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject, securityDomainName); - } - else - { - PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject, securityDomainName); - } - } - - static void popSubjectContext() - { - if (System.getSecurityManager() == null) - { - PrincipalInfoAction.NON_PRIVILEGED.pop(); - } - else - { - PrincipalInfoAction.PRIVILEGED.pop(); - } - } -} diff --git a/pom.xml b/pom.xml index f236376f06..f9fa4d143f 100644 --- a/pom.xml +++ b/pom.xml @@ -220,6 +220,11 @@ geronimo-jta_1.1_spec 1.1.1 + + org.apache.geronimo.specs + geronimo-jta_1.1_spec + 1.1.1 + @@ -489,7 +494,6 @@ activemq-rest activemq-tools activemq-service-extensions - integration/activemq-jboss-as-integration integration/activemq-spring-integration integration/activemq-aerogear-integration integration/activemq-vertx-integration @@ -516,7 +520,6 @@ activemq-rest activemq-tools activemq-service-extensions - integration/activemq-jboss-as-integration integration/activemq-spring-integration integration/activemq-aerogear-integration integration/activemq-vertx-integration @@ -554,7 +557,6 @@ activemq-rest activemq-tools activemq-service-extensions - integration/activemq-jboss-as-integration integration/activemq-spring-integration integration/activemq-aerogear-integration integration/activemq-vertx-integration @@ -588,7 +590,6 @@ activemq-rest activemq-tools activemq-service-extensions - integration/activemq-jboss-as-integration integration/activemq-spring-integration integration/activemq-aerogear-integration integration/activemq-vertx-integration diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java b/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java index 0afbdf8537..fe07bd09e7 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java +++ b/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java @@ -90,9 +90,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); resourceAdapter = qResourceAdapter; - qResourceAdapter.setTransactionManagerLocatorClass(DummyTMLocator.class.getName()); - qResourceAdapter.setTransactionManagerLocatorMethod("getTM"); - MyBootstrapContext ctx = new MyBootstrapContext(); qResourceAdapter.setConnectorClassName(NETTY_CONNECTOR_FACTORY); @@ -170,9 +167,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); resourceAdapter = qResourceAdapter; - qResourceAdapter.setTransactionManagerLocatorClass(DummyTMLocator.class.getName()); - qResourceAdapter.setTransactionManagerLocatorMethod("getTM"); - MyBootstrapContext ctx = new MyBootstrapContext(); qResourceAdapter.setConnectorClassName(NETTY_CONNECTOR_FACTORY); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java index bf83708deb..19dddd65c4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java @@ -2371,8 +2371,6 @@ public class JMSBridgeTest extends BridgeTestBase null, null, false); - bridge.setTransactionManagerLocatorClass(this.getClass().getName()); - bridge.setTransactionManagerLocatorMethod("getNewTm"); bridge.start(); } finally diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQMessageHandlerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQMessageHandlerTest.java index 9b072d2d51..cdf90f7bd8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQMessageHandlerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQMessageHandlerTest.java @@ -197,8 +197,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase protected ActiveMQResourceAdapter newResourceAdapter() { ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter(); - qResourceAdapter.setTransactionManagerLocatorClass(""); - qResourceAdapter.setTransactionManagerLocatorMethod(""); qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY); return qResourceAdapter; } @@ -209,8 +207,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); qResourceAdapter.setReconnectAttempts(-1); qResourceAdapter.setCallTimeout(500L); - qResourceAdapter.setTransactionManagerLocatorClass(""); - qResourceAdapter.setTransactionManagerLocatorMethod(""); qResourceAdapter.setRetryInterval(500L); MyBootstrapContext ctx = new MyBootstrapContext(); qResourceAdapter.start(ctx); @@ -551,8 +547,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase public void testNonDurableSubscriptionDeleteAfterCrash() throws Exception { ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); - qResourceAdapter.setTransactionManagerLocatorClass(""); - qResourceAdapter.setTransactionManagerLocatorMethod(""); MyBootstrapContext ctx = new MyBootstrapContext(); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java index 7778a45674..307f827332 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java @@ -99,9 +99,6 @@ public abstract class ActiveMQRATestBase extends JMSTestBase protected ActiveMQResourceAdapter newResourceAdapter() { ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter(); - // We don't have a TM on these tests.. This would cause the lookup to take at least 10 seconds if we didn't set to "" - qResourceAdapter.setTransactionManagerLocatorClass(""); - qResourceAdapter.setTransactionManagerLocatorMethod(""); qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY); return qResourceAdapter; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java index 0224c3fecd..aeed55cbee 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java @@ -60,8 +60,6 @@ public class JMSContextTest extends ActiveMQRATestBase roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); resourceAdapter = new ActiveMQResourceAdapter(); - resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName()); - resourceAdapter.setTransactionManagerLocatorMethod("getTm"); resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName()); MyBootstrapContext ctx = new MyBootstrapContext(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/OutgoingConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/OutgoingConnectionTest.java index 9f0c3ef2df..4dbf1afaa3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/OutgoingConnectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/OutgoingConnectionTest.java @@ -96,8 +96,6 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); resourceAdapter = new ActiveMQResourceAdapter(); - resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName()); - resourceAdapter.setTransactionManagerLocatorMethod("getTm"); resourceAdapter.setEntries("[\"java://jmsXA\"]"); resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName()); @@ -288,8 +286,6 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase { setupDLQ(10); resourceAdapter = newResourceAdapter(); - resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName()); - resourceAdapter.setTransactionManagerLocatorMethod("getTm"); DummyTransactionManager.tm.tx = new DummyTransaction(); MyBootstrapContext ctx = new MyBootstrapContext(); resourceAdapter.start(ctx); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java index 9387ab571e..d9f7c699e0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java @@ -69,8 +69,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase ra.setConnectorClassName("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory"); ra.setUserName("userGlobal"); ra.setPassword("passwordGlobal"); - ra.setTransactionManagerLocatorClass(""); - ra.setTransactionManagerLocatorMethod(""); ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext()); Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection(); @@ -131,7 +129,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -363,7 +360,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -390,7 +386,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -419,7 +414,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -446,7 +440,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setDiscoveryInitialWaitTimeout(1L); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -469,10 +462,8 @@ public class ResourceAdapterTest extends ActiveMQRATestBase ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter(); qResourceAdapter.setDiscoveryAddress("231.7.7.7"); - // qResourceAdapter.getTransactionManagerLocatorClass ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); @@ -504,7 +495,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setHA(true); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -528,7 +518,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -552,7 +541,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -577,7 +565,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setReconnectAttempts(100); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -601,7 +588,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -625,7 +611,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setConnectionParameters("server-id=0"); ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext(); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); ActiveMQActivationSpec spec = new ActiveMQActivationSpec(); spec.setResourceAdapter(qResourceAdapter); @@ -654,7 +639,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setUseMaskedPassword(true); qResourceAdapter.setPassword(mask); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); assertEquals("helloworld", qResourceAdapter.getPassword()); @@ -699,7 +683,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase qResourceAdapter.setPassword(mask); - qResourceAdapter.setTransactionManagerLocatorClass(""); qResourceAdapter.start(ctx); assertEquals("helloworld", qResourceAdapter.getPassword()); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java index 5a7c4d10e1..4f3d414c65 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java @@ -280,18 +280,6 @@ public class ActiveMQResourceAdapterConfigTest extends UnitTestCase " long\n" + " \n" + " \n" + - " " + - " " + - " TransactionManagerLocatorMethod" + - " java.lang.String" + - " " + - " " + - " " + - " " + - " TransactionManagerLocatorClass" + - " java.lang.String" + - " " + - " " + " \n" + " How many attempts should be made when connecting the MDB\n" + " SetupAttempts\n" + diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ConnectionFactoryPropertiesTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ConnectionFactoryPropertiesTest.java index 9c68c13e8e..481d96960c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ConnectionFactoryPropertiesTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ConnectionFactoryPropertiesTest.java @@ -50,8 +50,6 @@ public class ConnectionFactoryPropertiesTest extends UnitTestCase UNSUPPORTED_RA_PROPERTIES.add("discoveryInitialWaitTimeout"); UNSUPPORTED_RA_PROPERTIES.add("connectionParameters"); UNSUPPORTED_RA_PROPERTIES.add("connectorClassName"); - UNSUPPORTED_RA_PROPERTIES.add("transactionManagerLocatorClass"); - UNSUPPORTED_RA_PROPERTIES.add("transactionManagerLocatorMethod"); UNSUPPORTED_RA_PROPERTIES.add("managedConnectionFactory"); UNSUPPORTED_RA_PROPERTIES.add("jndiParams"); UNSUPPORTED_RA_PROPERTIES.add("password"); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java index 320acb9de1..3d524e89a2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java @@ -476,8 +476,6 @@ public class ResourceAdapterTest extends ServiceTestBase ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); ra.setUserName("userGlobal"); ra.setPassword("passwordGlobal"); - ra.setTransactionManagerLocatorClass(""); - ra.setTransactionManagerLocatorMethod(""); ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext()); Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection(); @@ -532,8 +530,6 @@ public class ResourceAdapterTest extends ServiceTestBase ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); ra.setUserName("badUser"); ra.setPassword("badPassword"); - ra.setTransactionManagerLocatorClass(""); - ra.setTransactionManagerLocatorMethod(""); ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext()); ActiveMQActivationSpec spec = new ActiveMQActivationSpec();