http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java index dd1b5ca..4dcd4fe 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java @@ -28,17 +28,13 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; -import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Before; import org.junit.Test; public class StompWebSocketTest extends ActiveMQTestBase { - private JMSServerManager server; + private ActiveMQServer server; /** * to test the Stomp over Web Sockets protocol, @@ -63,7 +59,7 @@ public class StompWebSocketTest extends ActiveMQTestBase { * @return * @throws Exception */ - private JMSServerManager createServer() throws Exception { + private ActiveMQServer createServer() throws Exception { Map<String, Object> params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT + 1); @@ -71,11 +67,7 @@ public class StompWebSocketTest extends ActiveMQTestBase { Configuration config = createBasicConfig().addAcceptorConfiguration(stompTransport).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addQueueConfiguration(new CoreQueueConfiguration().setAddress(getQueueName()).setName(getQueueName()).setDurable(false)); - ActiveMQServer activeMQServer = addServer(ActiveMQServers.newActiveMQServer(config)); - - JMSConfiguration jmsConfig = new JMSConfigurationImpl(); - server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setRegistry(null); + server = addServer(ActiveMQServers.newActiveMQServer(config)); return server; }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithClientIdValidationTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithClientIdValidationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithClientIdValidationTest.java index 49f3de5..8a5077d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithClientIdValidationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithClientIdValidationTest.java @@ -22,20 +22,14 @@ import java.lang.management.ManagementFactory; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; -import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; -import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection; import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory; -import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext; import org.junit.Test; @SuppressWarnings("deprecation") @@ -47,7 +41,7 @@ public class StompWithClientIdValidationTest extends StompTestBase { } @Override - protected JMSServerManager createServer() throws Exception { + protected ActiveMQServer createServer() throws Exception { Configuration config = createBasicConfig() .setSecurityEnabled(isSecurityEnabled()) .setPersistenceEnabled(isPersistenceEnabled()) @@ -79,11 +73,7 @@ public class StompWithClientIdValidationTest extends StompTestBase { securityManager.getConfiguration().addUser(defUser, defPass); - ActiveMQServer activeMqServer = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager)); - - JMSConfiguration jmsConfig = new JMSConfigurationImpl(); - server = new JMSServerManagerImpl(activeMqServer, jmsConfig); - server.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); + server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager)); return server; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java index eb515bd..3f9cb6e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java @@ -71,7 +71,7 @@ public class StompWithLargeMessagesTest extends StompTestBase { try { String address = "testLargeMessageAddress"; - server.getActiveMQServer().createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false); + server.createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false); // STOMP default is UTF-8 == 1 byte per char. int largeMessageStringSize = 10 * 1024 * 1024; // 10MB http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java index 7bdc18b..5ed8832 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java @@ -34,7 +34,7 @@ public class StompWithSecurityTest extends StompTestBase { @Test public void testJMSXUserID() throws Exception { - server.getActiveMQServer().getConfiguration().setPopulateValidatedUser(true); + server.getConfiguration().setPopulateValidatedUser(true); MessageConsumer consumer = session.createConsumer(queue); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java index 0647ae8..167ad46 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java @@ -96,7 +96,7 @@ public class StompV11Test extends StompTestBase { @Test public void testConnection() throws Exception { - server.getActiveMQServer().getSecurityStore().setSecurityEnabled(true); + server.getSecurityStore().setSecurityEnabled(true); StompClientConnection connection = StompClientConnectionFactory.createClientConnection(v10Uri); connection.connect(defUser, defPass); @@ -708,7 +708,7 @@ public class StompV11Test extends StompTestBase { uri = createStompClientUri(scheme, hostname, port); - server.getActiveMQServer().getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?connectionTtl=1000&connectionTtlMin=5000&connectionTtlMax=10000").start(); + server.getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?connectionTtl=1000&connectionTtlMin=5000&connectionTtlMax=10000").start(); StompClientConnection connection = StompClientConnectionFactory.createClientConnection(uri); //no heart beat at all if heat-beat absent @@ -857,7 +857,7 @@ public class StompV11Test extends StompTestBase { StompClientConnection connection; int port = 61614; - server.getActiveMQServer().getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?heartBeatToConnectionTtlModifier=1").start(); + server.getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?heartBeatToConnectionTtlModifier=1").start(); connection = StompClientConnectionFactory.createClientConnection(uri); frame = connection.createFrame(Stomp.Commands.CONNECT) @@ -881,8 +881,8 @@ public class StompV11Test extends StompTestBase { connection.closeTransport(); } - server.getActiveMQServer().getRemotingService().destroyAcceptor("test"); - server.getActiveMQServer().getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?heartBeatToConnectionTtlModifier=1.5").start(); + server.getRemotingService().destroyAcceptor("test"); + server.getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + port + "?heartBeatToConnectionTtlModifier=1.5").start(); connection = StompClientConnectionFactory.createClientConnection(uri); frame = connection.createFrame(Stomp.Commands.CONNECT) @@ -1518,11 +1518,11 @@ public class StompV11Test extends StompTestBase { long start = System.currentTimeMillis(); SimpleString queueName = SimpleString.toSimpleString(CLIENT_ID + "." + getName()); - while (server.getActiveMQServer().locateQueue(queueName) != null && (System.currentTimeMillis() - start) < 5000) { + while (server.locateQueue(queueName) != null && (System.currentTimeMillis() - start) < 5000) { Thread.sleep(100); } - assertNull(server.getActiveMQServer().locateQueue(queueName)); + assertNull(server.locateQueue(queueName)); conn.disconnect(); } @@ -2165,8 +2165,8 @@ public class StompV11Test extends StompTestBase { conn.startPinger(100); - Assert.assertEquals(1, server.getActiveMQServer().getRemotingService().getConnections().size()); - StompConnection stompConnection = (StompConnection)server.getActiveMQServer().getRemotingService().getConnections().iterator().next(); + Assert.assertEquals(1, server.getRemotingService().getConnections().size()); + StompConnection stompConnection = (StompConnection)server.getRemotingService().getConnections().iterator().next(); StompFrameHandlerV11 stompFrameHandler = (StompFrameHandlerV11)stompConnection.getStompVersionHandler(); Thread.sleep(1000); @@ -2177,7 +2177,7 @@ public class StompV11Test extends StompTestBase { conn.stopPinger(); //((AbstractStompClientConnection)conn).killReaderThread(); Wait.waitFor(() -> { - return server.getActiveMQServer().getRemotingService().getConnections().size() == 0; + return server.getRemotingService().getConnections().size() == 0; }); Assert.assertFalse(stompFrameHandler.getHeartBeater().isStarted()); @@ -2202,7 +2202,7 @@ public class StompV11Test extends StompTestBase { // Obtain a reference to the server StompConnection object RemotingConnection remotingConnection = null; StompConnection stompConnection = null; - Iterator<RemotingConnection> iterator = server.getActiveMQServer().getRemotingService().getConnections().iterator(); + Iterator<RemotingConnection> iterator = server.getRemotingService().getConnections().iterator(); while (iterator.hasNext()) { remotingConnection = iterator.next(); if (remotingConnection instanceof StompConnection) { @@ -2236,7 +2236,7 @@ public class StompV11Test extends StompTestBase { Thread.sleep(2000); Wait.waitFor(() -> { - return server.getActiveMQServer().getRemotingService().getConnections().size() == 0; + return server.getRemotingService().getConnections().size() == 0; }); Assert.assertFalse("HeartBeater is still running!!", stompFrameHandler.getHeartBeater().isStarted()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java index c91e5a8..61ef22c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java @@ -97,7 +97,7 @@ public class StompV12Test extends StompTestBase { @Test public void testConnection() throws Exception { - server.getActiveMQServer().getSecurityStore().setSecurityEnabled(true); + server.getSecurityStore().setSecurityEnabled(true); StompClientConnection connection = StompClientConnectionFactory.createClientConnection(v10Uri); connection.connect(defUser, defPass); @@ -375,7 +375,7 @@ public class StompV12Test extends StompTestBase { AddressSettings addressSettings = new AddressSettings(); addressSettings.setAutoCreateQueues(false); addressSettings.setAutoCreateAddresses(false); - server.getActiveMQServer().getAddressSettingsRepository().addMatch("#", addressSettings); + server.getAddressSettingsRepository().addMatch("#", addressSettings); conn.connect(defUser, defPass); @@ -1502,11 +1502,11 @@ public class StompV12Test extends StompTestBase { long start = System.currentTimeMillis(); SimpleString queueName = SimpleString.toSimpleString(CLIENT_ID + "." + getName()); - while (server.getActiveMQServer().locateQueue(queueName) != null && (System.currentTimeMillis() - start) < 5000) { + while (server.locateQueue(queueName) != null && (System.currentTimeMillis() - start) < 5000) { Thread.sleep(100); } - assertNull(server.getActiveMQServer().locateQueue(queueName)); + assertNull(server.locateQueue(queueName)); conn.disconnect(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/integration-tests/src/test/resources/spring-jms-beans.xml ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/resources/spring-jms-beans.xml b/tests/integration-tests/src/test/resources/spring-jms-beans.xml index 1d5bce3..854de87 100644 --- a/tests/integration-tests/src/test/resources/spring-jms-beans.xml +++ b/tests/integration-tests/src/test/resources/spring-jms-beans.xml @@ -20,7 +20,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean id="EmbeddedJms" class="org.apache.activemq.artemis.integration.spring.SpringJmsBootstrap" init-method="start"> + <bean id="EmbeddedActiveMQ" class="org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ" init-method="start" destroy-method="stop"> <property name="configResourcePath" value="spring-activemq-config.xml"/> </bean> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AcknowledgementTest.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AcknowledgementTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AcknowledgementTest.java index 9d72dc5..767b27a 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AcknowledgementTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AcknowledgementTest.java @@ -33,9 +33,7 @@ import javax.jms.TopicSession; import javax.jms.TopicSubscriber; import java.util.concurrent.CountDownLatch; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.api.jms.JMSFactoryType; -import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; +import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport; import org.junit.Assert; import org.junit.Test; @@ -1309,13 +1307,8 @@ public class AcknowledgementTest extends JMSTestCase { */ @Test public void testNonBlockingAckPerf() throws Exception { - getJmsServerManager().createConnectionFactory("testsuitecf1", false, JMSFactoryType.CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, Ac tiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/testsuitecf1"); - getJmsServerManager().createConnectionFactory("testsuitecf2", false, JMSFactoryType.CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, Ac tiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/testsuitecf2"); - - ActiveMQJMSConnectionFactory cf1 = (ActiveMQJMSConnectionFactory) getInitialContext().lookup("/testsuitecf1"); - cf1.setBlockOnAcknowledge(false); - ActiveMQJMSConnectionFactory cf2 = (ActiveMQJMSConnectionFactory) getInitialContext().lookup("/testsuitecf2"); - cf2.setBlockOnAcknowledge(true); + ConnectionFactory cf1 = ActiveMQJMSClient.createConnectionFactory("tcp://127.0.0.1:61616?blockOnNonDurableSend=true&blockOnAcknowledge=false", "testsuitecf1"); + ConnectionFactory cf2 = ActiveMQJMSClient.createConnectionFactory("tcp://127.0.0.1:61616?blockOnNonDurableSend=true&blockOnAcknowledge=true", "testsuitecf2"); int messageCount = 100; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java index 7a45f29..e7a7910 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java @@ -43,7 +43,6 @@ import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; -import org.apache.activemq.artemis.jms.server.JMSServerManager; import org.apache.activemq.artemis.jms.tests.tools.ServerManagement; import org.apache.activemq.artemis.jms.tests.tools.container.Server; import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport; @@ -248,10 +247,6 @@ public abstract class ActiveMQServerTestCase { return ActiveMQServerTestCase.servers.get(0).getActiveMQServer(); } - protected JMSServerManager getJmsServerManager() throws Exception { - return ActiveMQServerTestCase.servers.get(0).getJMSServerManager(); - } - protected void checkNoSubscriptions(final Topic topic) throws Exception { } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java index f124575..e86fee9 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java @@ -20,11 +20,8 @@ import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.MessageProducer; import javax.jms.Session; -import java.util.ArrayList; -import java.util.List; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.api.jms.JMSFactoryType; +import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.junit.After; import org.junit.Before; @@ -41,21 +38,13 @@ public class CTSMiscellaneousTest extends JMSTest { // Attributes ---------------------------------------------------- protected static ActiveMQConnectionFactory cf; - private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY = "StrictTCKConnectionFactory"; - // Constructors -------------------------------------------------- @Override @Before public void setUp() throws Exception { try { super.setUp(); - // Deploy a connection factory with load balancing but no failover on node0 - List<String> bindings = new ArrayList<>(); - bindings.add("StrictTCKConnectionFactory"); - - getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory", false, JMSFactoryType.CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_ POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/StrictTCKConnectionFactory"); - - CTSMiscellaneousTest.cf = (ActiveMQConnectionFactory) getInitialContext().lookup("/StrictTCKConnectionFactory"); + CTSMiscellaneousTest.cf = ActiveMQJMSClient.createConnectionFactory("tcp://127.0.0.1:61616?blockOnAcknowledge=true&blockOnDurableSend=true&blockOnNonDurableSend=true", "StrictTCKConnectionFactory"); } catch (Exception e) { e.printStackTrace(); } @@ -101,7 +90,6 @@ public class CTSMiscellaneousTest extends JMSTest { @After public void tearDown() throws Exception { super.tearDown(); - ActiveMQServerTestCase.undeployConnectionFactory(CTSMiscellaneousTest.ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY); } // Package protected --------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java index 8c66e7a..45f5a49 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java @@ -26,8 +26,6 @@ import javax.jms.XAConnection; import javax.naming.InitialContext; import java.util.ArrayList; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.api.jms.JMSFactoryType; import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQQueueConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQTopicConnectionFactory; @@ -68,16 +66,9 @@ public class JMSTestCase extends ActiveMQServerTestCase { // All jms tests should use a specific cg which has blockOnAcknowledge = true and // both np and p messages are sent synchronously - - getJmsServerManager().createConnectionFactory("testsuitecf", false, JMSFactoryType.CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, Act iveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/testsuitecf"); - - getJmsServerManager().createConnectionFactory("testsuitecf_queue", false, JMSFactoryType.QUEUE_CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_M AX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/testsuitecf_queue"); - - getJmsServerManager().createConnectionFactory("testsuitecf_topic", false, JMSFactoryType.TOPIC_CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_M AX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/testsuitecf_topic"); - - cf = (ActiveMQJMSConnectionFactory) getInitialContext().lookup("/testsuitecf"); - queueCf = (ActiveMQQueueConnectionFactory) getInitialContext().lookup("/testsuitecf_queue"); - topicCf = (ActiveMQTopicConnectionFactory) getInitialContext().lookup("/testsuitecf_topic"); + cf = new ActiveMQJMSConnectionFactory("tcp://127.0.0.1:61616?blockOnAcknowledge=true&blockOnDurableSend=true&blockOnNonDurableSend=true"); + queueCf = new ActiveMQQueueConnectionFactory("tcp://127.0.0.1:61616?blockOnAcknowledge=true&blockOnDurableSend=true&blockOnNonDurableSend=true"); + topicCf = new ActiveMQTopicConnectionFactory("tcp://127.0.0.1:61616?blockOnAcknowledge=true&blockOnDurableSend=true&blockOnNonDurableSend=true"); assertRemainingMessages(0); } @@ -119,7 +110,6 @@ public class JMSTestCase extends ActiveMQServerTestCase { @After public void tearDown() throws Exception { super.tearDown(); - getJmsServerManager().destroyConnectionFactory("testsuitecf"); if (cf != null) { cf.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java index d7137ae..e83d815 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java @@ -64,6 +64,7 @@ public class SecurityTest extends JMSTestCase { } else { System.setProperty(DefaultConnectionProperties.BROKER_BIND_URL, originalBrokerBindUrl); } + DefaultConnectionProperties.initialize(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java ---------------------------------------------------------------------- diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java index 17d1c7a..3e559e8 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java @@ -26,14 +26,11 @@ import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.utils.FileUtil; public class SpawnedJMSServer { public static ActiveMQServer server; - public static JMSServerManager serverManager; // Using files may be useful for debugging (through print-data for instance) private static final boolean useFiles = false; @@ -92,18 +89,16 @@ public class SpawnedJMSServer { // set DLA and expiry to avoid spamming the log with warnings server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); - serverManager = new JMSServerManagerImpl(server); - serverManager.start(); + server.start(); } return server; } public static void stopServer() throws Exception { if (server != null) { - serverManager.stop(); + server.stop(); } server = null; - serverManager = null; } // Constructors -------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d35f01d2/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java ---------------------------------------------------------------------- diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java index f6a08a0..3bcaeac 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java @@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; @@ -51,20 +52,16 @@ import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.JMSFactoryType; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; +import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.jms.bridge.ConnectionFactoryFactory; import org.apache.activemq.artemis.jms.bridge.DestinationFactory; import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode; import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl; import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.tests.unit.UnitTestLogger; -import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Assert; @@ -84,7 +81,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { private static final String TARGET = RandomUtil.randomString(); - private JMSServerManager jmsServer; + private ActiveMQServer server; private static final AtomicBoolean tcclClassFound = new AtomicBoolean(false); @@ -701,14 +698,11 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { super.setUp(); Configuration config = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())); - InVMNamingContext context = new InVMNamingContext(); - jmsServer = new JMSServerManagerImpl(addServer(ActiveMQServers.newActiveMQServer(config, false))); - jmsServer.setRegistry(new JndiBindingRegistry(context)); - jmsServer.start(); - - jmsServer.createQueue(false, JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE); - jmsServer.createQueue(false, JMSBridgeImplTest.TARGET, null, true, "/queue/" + JMSBridgeImplTest.TARGET); + server = addServer(ActiveMQServers.newActiveMQServer(config, false)); + server.start(); + server.createQueue(SimpleString.toSimpleString(JMSBridgeImplTest.SOURCE), RoutingType.ANYCAST, SimpleString.toSimpleString(JMSBridgeImplTest.SOURCE), null, true, false); + server.createQueue(SimpleString.toSimpleString(JMSBridgeImplTest.TARGET), RoutingType.ANYCAST, SimpleString.toSimpleString(JMSBridgeImplTest.TARGET), null, true, false); } @Test