Refactor base test classes

This has bothered me for awhile, but writing the hacking guide has
given me an opportunity to refactor some of our test-suite to be
simpler, more consistent, and easier to understand. This is
important if we want users to provide well-written tests. Our
test-suite is an important part of the code-base and it should be
easy to write good tests.

Basically I just consolidated CoreUnitTestCase, UnitTestCase, and
ServiceTestBase into a single class named ServiceTestBase. I also
simplified some of the configuration creation methods to reduce
duplicated code.
This commit is contained in:
jbertram 2015-05-18 11:07:28 -05:00
parent 70258865a5
commit 99147d0713
225 changed files with 3232 additions and 3710 deletions
artemis-core-client/src/test/java/org/apache/activemq/artemis
artemis-server/src
docs/hacking-guide/en
tests
extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras
integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration
DuplicateDetectionTest.javaString64KLimitTest.java
aerogear
client
cluster
discovery
divert
embedded
http
jms
journal

View File

@ -1,89 +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.artemis.tests;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
public abstract class CoreUnitTestCase extends Assert
{
public static void assertEqualsByteArrays(final byte[] expected, final byte[] actual)
{
for (int i = 0; i < expected.length; i++)
{
Assert.assertEquals("byte at index " + i, expected[i], actual[i]);
}
}
private static final ActiveMQClientLogger log = ActiveMQClientLogger.LOGGER;
@Rule
public TestRule watcher = new TestWatcher()
{
@Override
protected void starting(Description description)
{
log.info(String.format("#*#*# Starting test: %s()...", description.getMethodName()));
}
@Override
protected void finished(Description description)
{
log.info(String.format("#*#*# Finished test: %s()...", description.getMethodName()));
}
};
/**
* Asserts that latch completes within a (rather large interval).
* <p/>
* Use this instead of just calling {@code latch.await()}. Otherwise your test may hang the whole
* test run if it fails to count-down the latch.
*
* @param latch
* @throws InterruptedException
*/
public static void waitForLatch(CountDownLatch latch) throws InterruptedException
{
assertTrue("Latch has got to return within a minute", latch.await(1, TimeUnit.MINUTES));
}
public static int countOccurrencesOf(String str, String sub)
{
if (str == null || sub == null || str.length() == 0 || sub.length() == 0)
{
return 0;
}
int count = 0;
int pos = 0;
int idx;
while ((idx = str.indexOf(sub, pos)) != -1)
{
++count;
pos = idx + sub.length();
}
return count;
}
}

View File

@ -16,16 +16,13 @@
*/
package org.apache.activemq.artemis.util;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import org.junit.Assert;
import org.apache.activemq.artemis.tests.CoreUnitTestCase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
import java.util.concurrent.TimeUnit;
public class TimeAndCounterIDGeneratorTest extends Assert
{
@ -105,7 +102,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert
try
{
latchAlign.countDown();
CoreUnitTestCase.waitForLatch(latchStart);
assertTrue("Latch has got to return within a minute", latchStart.await(1, TimeUnit.MINUTES));
long lastValue = 0L;
for (int i = 0; i < NUMBER_OF_IDS; i++)
@ -136,7 +133,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert
arrays[i].start();
}
CoreUnitTestCase.waitForLatch(latchAlign);
assertTrue("Latch has got to return within a minute", latchAlign.await(1, TimeUnit.MINUTES));
latchStart.countDown();

View File

@ -359,4 +359,7 @@ public interface ActiveMQMessageBundle
@Message(id = 119111, value = "Too many queues created by user ''{0}''. Queues allowed: {1}.", format = Message.Format.MESSAGE_FORMAT)
ActiveMQSessionCreationException queueLimitReached(String username, int limit);
@Message(id = 119112, value = "Cannot set MBeanServer during startup or while started")
IllegalStateException cannotSetMBeanserver();
}

View File

@ -48,6 +48,8 @@ import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import javax.management.MBeanServer;
/**
* This interface defines the internal interface of the ActiveMQ Artemis Server exposed to other components
* of the server.
@ -278,4 +280,6 @@ public interface ActiveMQServer extends ActiveMQComponent
HAPolicy getHAPolicy();
void setHAPolicy(HAPolicy haPolicy);
void setMBeanServer(MBeanServer mBeanServer);
}

View File

@ -183,7 +183,7 @@ public class ActiveMQServerImpl implements ActiveMQServer
private final Configuration configuration;
private final MBeanServer mbeanServer;
private MBeanServer mbeanServer;
private volatile SecurityStore securityStore;
@ -519,6 +519,16 @@ public class ActiveMQServerImpl implements ActiveMQServer
this.haPolicy = haPolicy;
}
@Override
public void setMBeanServer(MBeanServer mbeanServer)
{
if (state == SERVER_STATE.STARTING || state == SERVER_STATE.STARTED)
{
throw ActiveMQMessageBundle.BUNDLE.cannotSetMBeanserver();
}
this.mbeanServer = mbeanServer;
}
public ExecutorService getThreadPool()
{
return threadPool;

View File

@ -15,10 +15,17 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.junit.Before;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayInputStream;
@ -26,16 +33,7 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
public class ConfigurationImplTest extends UnitTestCase
public class ConfigurationImplTest extends ServiceTestBase
{
protected Configuration conf;

View File

@ -16,20 +16,20 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
import org.junit.Test;
public class FileConfigurationParserTest extends UnitTestCase
public class FileConfigurationParserTest extends ServiceTestBase
{
/**
* These "InvalidConfigurationTest*.xml" files are modified copies of {@value

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy;
@ -25,21 +26,20 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.ColocatedActivation;
import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
import java.util.List;
public class HAPolicyConfigurationTest extends UnitTestCase
public class HAPolicyConfigurationTest extends ServiceTestBase
{
@Test
public void liveOnlyTest() throws Exception

View File

@ -16,21 +16,21 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
/**
* When running this test from an IDE add this to the test command line so that the AssertionLoggerHandler works properly:
* -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:<path_to_source>/tests/config/logging.properties
*/
public class WrongRoleFileConfigurationParserTest extends UnitTestCase
public class WrongRoleFileConfigurationParserTest extends ServiceTestBase
{
@BeforeClass
public static void prepareLogger()

View File

@ -17,12 +17,6 @@
package org.apache.activemq.artemis.core.server.group.impl;
import javax.management.ObjectName;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -39,8 +33,8 @@ import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.remoting.server.RemotingService;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.QueueFactory;
import org.apache.activemq.artemis.core.server.ServerMessage;
@ -54,18 +48,24 @@ import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.ResourceManager;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.junit.Assert;
import org.junit.Test;
import javax.management.ObjectName;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* this is testing the case for resending notifications from RemotingGroupHandler
* There is a small window where you could receive notifications wrongly
* this test will make sure the component would play well with that notification
*/
public class ClusteredResetMockTest extends UnitTestCase
public class ClusteredResetMockTest extends ServiceTestBase
{
public static final SimpleString ANYCLUSTER = SimpleString.toSimpleString("anycluster");

View File

@ -19,11 +19,11 @@ package org.apache.activemq.artemis.core.settings;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
public class AddressSettingsTest extends UnitTestCase
public class AddressSettingsTest extends ServiceTestBase
{
@Test
public void testDefaults()

View File

@ -16,18 +16,18 @@
*/
package org.apache.activemq.artemis.core.settings;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class RepositoryTest extends UnitTestCase
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
public class RepositoryTest extends ServiceTestBase
{
HierarchicalRepository<HashSet<Role>> securityRepository;

View File

@ -38,6 +38,6 @@ public class RemoveFolder extends ExternalResource
*/
protected void after()
{
UnitTestCase.deleteDirectory(new File(folderName));
ServiceTestBase.deleteDirectory(new File(folderName));
}
}

View File

@ -437,7 +437,7 @@ public class SimpleStringTest extends Assert
x[i].start();
}
UnitTestCase.waitForLatch(latch);
ServiceTestBase.waitForLatch(latch);
start.countDown();
for (T t : x)

View File

@ -59,7 +59,7 @@ public abstract class SingleServerTestBase extends ServiceTestBase
protected ServerLocator createLocator()
{
ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
addServerLocator(retlocator);
return retlocator;
}

View File

@ -1,5 +1,7 @@
# Tests
## Running Tests
To run the unit tests:
$ mvn -Ptests test
@ -12,4 +14,14 @@ Running tests individually
$ mvn -Ptests -DfailIfNoTests=false -Dtest=<test-name> test
where &lt;test-name> is the name of the Test class without its package name
where &lt;test-name> is the name of the Test class without its package name
## Writing Tests
The broker is comprised of POJOs so it's simple to configure and run a broker instance and test particular functionality.
Even complex test-cases involving multiple clustered brokers are relatively easy to write. Almost every test in the
test-suite follows this pattern - configure broker, start broker, test functionality, stop broker.
The test-suite uses JUnit to manage test execution and life-cycle. Most tests extend [org.apache.activemq.artemis.tests.util.ServiceTestBase](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServiceTestBase.java)
which contains JUnit setup and tear-down methods as well as a wealth of utility functions to configure, start, manage,
and stop brokers as well as perform other common tasks.

View File

@ -179,7 +179,8 @@ public class ClosingConnectionTest extends ServiceTestBase
private ActiveMQServer newActiveMQServer() throws Exception
{
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), mBeanServer);
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()));
server.setMBeanServer(mBeanServer);
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(10 * 1024);

View File

@ -60,12 +60,12 @@ import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
public abstract class BridgeTestBase extends UnitTestCase
public abstract class BridgeTestBase extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -392,7 +392,7 @@ public abstract class BridgeTestBase extends UnitTestCase
if (largeMessage)
{
BytesMessage msg = sess.createBytesMessage();
((ActiveMQMessage) msg).setInputStream(UnitTestCase.createFakeLargeStream(1024L * 1024L));
((ActiveMQMessage) msg).setInputStream(ServiceTestBase.createFakeLargeStream(1024L * 1024L));
msg.setStringProperty("msg", "message" + i);
prod.send(msg);
}

View File

@ -16,34 +16,31 @@
*/
package org.apache.activemq.artemis.tests.integration;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
public class DuplicateDetectionTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -57,7 +54,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testSimpleDuplicateDetecion() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -165,7 +162,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
{
final int TEST_SIZE = 100;
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnNonDurableSend(true);
@ -242,7 +239,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testSimpleDuplicateDetectionWithString() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -313,7 +310,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testCacheSize() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -473,7 +470,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection1() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -526,7 +523,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection2() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -573,7 +570,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection3() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -639,7 +636,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testRollbackThenSend() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -688,7 +685,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testEntireTransactionRejected() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -784,7 +781,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection1() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -864,7 +861,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection2() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -946,7 +943,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection3() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1027,7 +1024,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetectionPrepareAndRollback() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1100,7 +1097,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetectionPrepareAndRollbackStopServer() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1187,7 +1184,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection4() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1296,7 +1293,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1383,7 +1380,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1465,7 +1462,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1558,7 +1555,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1659,7 +1656,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1745,7 +1742,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1834,7 +1831,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1954,7 +1951,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -2057,7 +2054,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -2158,7 +2155,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
*
@ -43,7 +43,7 @@ import org.apache.activemq.artemis.tests.util.UnitTestCase;
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4806007
* http://jira.jboss.com/jira/browse/JBAS-2641
*/
public class String64KLimitTest extends UnitTestCase
public class String64KLimitTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -17,32 +17,23 @@
package org.apache.activemq.artemis.tests.integration.aerogear;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConstants;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONException;
import org.apache.activemq.artemis.utils.json.JSONObject;
@ -54,6 +45,14 @@ import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.nio.SelectChannelConnector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class AeroGearBasicServerTest extends ServiceTestBase
{
@ -128,7 +127,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
CountDownLatch latch = new CountDownLatch(1);
AeroGearHandler aeroGearHandler = new AeroGearHandler(latch);
jetty.addHandler(aeroGearHandler);
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -277,7 +276,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -331,7 +330,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -369,7 +368,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);

View File

@ -15,13 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Interceptor;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -29,7 +24,6 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -41,14 +35,16 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
*
* From https://jira.jboss.org/jira/browse/HORNETQ-144
*
*/
public class ActiveMQCrashTest extends UnitTestCase
public class ActiveMQCrashTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -156,7 +152,6 @@ public class ActiveMQCrashTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
addServerLocator(locator);
locator = createInVMNonHALocator();
}
}

View File

@ -62,7 +62,7 @@ public class ConcurrentCreateDeleteProduceTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false)
.setJournalSyncTransactional(false);

View File

@ -16,9 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.SimpleString;
@ -28,10 +25,8 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
@ -44,6 +39,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class ConsumerCloseTest extends ServiceTestBase
{
@ -72,7 +70,7 @@ public class ConsumerCloseTest extends ServiceTestBase
Assert.assertTrue(consumer.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -80,7 +78,7 @@ public class ConsumerCloseTest extends ServiceTestBase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -88,7 +86,7 @@ public class ConsumerCloseTest extends ServiceTestBase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -314,9 +312,7 @@ public class ConsumerCloseTest extends ServiceTestBase
address = RandomUtil.randomSimpleString();
queue = RandomUtil.randomSimpleString();
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);

View File

@ -17,19 +17,17 @@
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.Test;
@ -59,7 +57,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTest() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
locator.setConnectionTTL(1000);
locator.setClientFailureCheckPeriod(100);
locator.setConsumerWindowSize(10 * 1024 * 1024);
@ -170,7 +168,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTestWithDirectDelivery() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
locator.setConnectionTTL(1000);
locator.setClientFailureCheckPeriod(100);
locator.setConsumerWindowSize(10 * 1024 * 1024);
@ -228,7 +226,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void run()
{
try (
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = factory.createSession(false, true, true, true);
ClientProducer producer = session.createProducer(QUEUE);

View File

@ -15,27 +15,17 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -46,7 +36,14 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class DeadLetterAddressTest extends ServiceTestBase
{
@ -512,7 +509,7 @@ public class DeadLetterAddressTest extends ServiceTestBase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -523,7 +520,7 @@ public class DeadLetterAddressTest extends ServiceTestBase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = addClientSession(sessionFactory.createSession(false, true, false));
}

View File

@ -15,31 +15,28 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
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.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ExpiryAddressTest extends ServiceTestBase
{
@ -236,7 +233,7 @@ public class ExpiryAddressTest extends ServiceTestBase
clientSession.createQueue(qName, qName, null, false);
ServerLocator locator1 =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator1);
@ -388,7 +385,7 @@ public class ExpiryAddressTest extends ServiceTestBase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)

View File

@ -93,7 +93,7 @@ public class HangConsumerTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
.setMessageExpiryScanPeriod(10);
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();

View File

@ -15,21 +15,6 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import java.util.HashMap;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -42,8 +27,18 @@ import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
public class HeuristicXATest extends ServiceTestBase
{
@ -70,7 +65,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(false, configuration);
server.setMBeanServer(mbeanServer);
server.start();
ActiveMQServerControl jmxServer = ManagementControlHelper.createActiveMQServerControl(mbeanServer);
@ -95,7 +91,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(false, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -190,7 +187,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -290,7 +288,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -399,7 +398,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();

View File

@ -261,7 +261,7 @@ public class IncompatibleVersionTest extends ServiceTestBase
}
}
private static class ClientStarter
private class ClientStarter
{
public void perform() throws Exception
{
@ -269,7 +269,7 @@ public class IncompatibleVersionTest extends ServiceTestBase
ClientSessionFactory sf = null;
try
{
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
locator = createNettyNonHALocator();
sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
log.info("### client: connected. server incrementingVersion = " + session.getVersion());
@ -284,6 +284,12 @@ public class IncompatibleVersionTest extends ServiceTestBase
}
public static void main(String[] args) throws Exception
{
IncompatibleVersionTest incompatibleVersionTest = new IncompatibleVersionTest();
incompatibleVersionTest.execute(args);
}
private void execute(String[] args) throws Exception
{
if (args[0].equals("server"))
{

View File

@ -38,7 +38,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
import org.apache.activemq.artemis.core.persistence.StorageManager;
@ -128,7 +128,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.stop(false);
UnitTestCase.forceGC();
ServiceTestBase.forceGC();
server.start();
@ -261,7 +261,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
}
clientMessage.acknowledge();
}
@ -340,7 +340,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
}
clientMessage.acknowledge();
}

View File

@ -16,6 +16,22 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
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.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
@ -26,22 +42,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.junit.Assert;
import org.junit.Test;
/**
* -- https://issues.jboss.org/browse/HORNETQ-746
* Stress test using netty with NIO and many JMS clients concurrently, to try
@ -92,7 +92,11 @@ public class JmsNettyNioStressTest extends ServiceTestBase
// minimize threads to maximize possibility for deadlock
params.put(TransportConstants.NIO_REMOTING_THREADS_PROPNAME, 1);
params.put(TransportConstants.BATCH_DELAY, 50);
Configuration config = createDefaultConfig(params, ServiceTestBase.NETTY_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.NETTY_ACCEPTOR_FACTORY, params);
Configuration config = createBasicConfig(-1)
.setJMXManagementEnabled(false)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(transportConfig);
ActiveMQServer server = createServer(true, config);
server.getConfiguration().setThreadPoolMaxSize(2);
server.start();

View File

@ -25,7 +25,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.Assert;
@ -350,7 +350,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}
@ -375,7 +375,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}
@ -394,7 +394,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}

View File

@ -49,7 +49,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -489,7 +489,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.close();
@ -513,7 +513,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -530,7 +530,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -579,7 +579,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
session.rollback();
@ -594,7 +594,7 @@ public class LargeMessageTest extends LargeMessageTestBase
msg.acknowledge();
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
Assert.assertEquals(2, msg.getDeliveryCount());
msg.acknowledge();
@ -662,7 +662,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -680,7 +680,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -704,7 +704,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.commit();
@ -778,7 +778,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -795,7 +795,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -824,7 +824,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.commit();
@ -891,7 +891,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.close();
@ -915,7 +915,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -1195,7 +1195,7 @@ public class LargeMessageTest extends LargeMessageTestBase
assertNotNull(msg);
for (long i = 0; i < messageSize; i++)
{
Assert.assertEquals("position " + i, UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals("position " + i, ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
}
@ -2447,7 +2447,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile);
}
@ -2480,7 +2480,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{
for (int byteRead = 0; byteRead < SIZE; byteRead++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
}
}
@ -2551,7 +2551,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile);
}
@ -2583,7 +2583,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{
for (int byteRead = 0; byteRead < SIZE; byteRead++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
}
}
@ -2910,7 +2910,7 @@ public class LargeMessageTest extends LargeMessageTestBase
session.createQueue(ADDRESS, ADDRESS, null, true);
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
ClientProducer producer = session.createProducer(ADDRESS);
@ -2989,7 +2989,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage msg = session.createMessage(true);
msg.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
msg.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
msg.putIntProperty(new SimpleString("key"), i);
producer.send(msg);
@ -3047,7 +3047,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{
fileMessage.addBytes(new byte[]{UnitTestCase.getSamplebyte(i)});
fileMessage.addBytes(new byte[]{ServiceTestBase.getSamplebyte(i)});
}
// The server would be doing this
@ -3077,7 +3077,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
msg.acknowledge();

View File

@ -19,7 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.junit.Test;
import org.apache.activemq.artemis.core.asyncio.impl.AsynchronousFileImpl;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
* This tests is placed in duplication here to validate that the libaio module is properly loaded on this
@ -27,7 +27,7 @@ import org.apache.activemq.artemis.tests.util.UnitTestCase;
*
* This test should be placed on each one of the tests modules to make sure the library is loaded correctly.
*/
public class LibaioDependencyCheckTest extends UnitTestCase
public class LibaioDependencyCheckTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -25,7 +25,6 @@ import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
@ -150,7 +149,7 @@ public class MessageDurabilityTest extends ServiceTestBase
session.start();
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -178,7 +177,7 @@ public class MessageDurabilityTest extends ServiceTestBase
restart();
session.start();
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{
public void run() throws ActiveMQException
{

View File

@ -15,34 +15,31 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class MessageGroupingConnectionFactoryTest extends UnitTestCase
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class MessageGroupingConnectionFactoryTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -121,7 +118,7 @@ public class MessageGroupingConnectionFactoryTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)

View File

@ -15,40 +15,37 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
public class MessageGroupingTest extends UnitTestCase
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class MessageGroupingTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -282,7 +279,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingTXCommit() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(false, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
@ -343,7 +340,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingTXRollback() throws Exception
{
log.info("*** starting test");
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(false, false, false);
@ -419,7 +416,7 @@ public class MessageGroupingTest extends UnitTestCase
private void dotestMultipleGroupingXACommit() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(true, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
@ -479,7 +476,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingXARollback() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(true, false, false);
@ -611,7 +608,7 @@ public class MessageGroupingTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -623,7 +620,7 @@ public class MessageGroupingTest extends UnitTestCase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
clientSessionFactory = createSessionFactory(locator);
clientSession = addClientSession(clientSessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false);

View File

@ -18,12 +18,12 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
@ -32,12 +32,11 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class MessagePriorityTest extends UnitTestCase
public class MessagePriorityTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -164,7 +164,7 @@ public class MultipleThreadFilterOneTest extends ServiceTestBase
for (int i = 0; i < numberOfMessages; i++)
{
ClientMessage msg = consumer.receive(5000);
ClientMessage msg = consumer.receive(15000);
Assert.assertNotNull(msg);
Assert.assertEquals(nr, msg.getIntProperty("prodNR").intValue());
msg.acknowledge();

View File

@ -16,23 +16,12 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -42,9 +31,18 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Test;
public class NIOvsOIOTest extends UnitTestCase
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public class NIOvsOIOTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -85,7 +83,7 @@ public class NIOvsOIOTest extends UnitTestCase
List<ClientSessionFactory> factories = new ArrayList<ClientSessionFactory>();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
for (int i = 0; i < numReceivers; i++)
{

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -42,7 +42,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
*
* A NewDeadLetterAddressTest
*/
public class NewDeadLetterAddressTest extends UnitTestCase
public class NewDeadLetterAddressTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -75,7 +75,7 @@ public class NewDeadLetterAddressTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -86,7 +86,7 @@ public class NewDeadLetterAddressTest extends UnitTestCase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, false);
}

View File

@ -800,7 +800,8 @@ public class PagingOrderTest extends ServiceTestBase
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, -1, -1, AddressFullMessagePolicy.BLOCK, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server);
InVMNamingContext context = new InVMNamingContext();
@ -857,7 +858,8 @@ public class PagingOrderTest extends ServiceTestBase
jmsServer.stop();
server = createServer(true, config, -1, -1, AddressFullMessagePolicy.BLOCK, new HashMap<String, AddressSettings>());
server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
jmsServer = new JMSServerManagerImpl(server);
context = new InVMNamingContext();

View File

@ -16,23 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
@ -46,9 +29,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.DivertConfiguration;
@ -76,10 +56,29 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public class PagingTest extends ServiceTestBase
{
private ServerLocator locator;
@ -1236,12 +1235,8 @@ public class PagingTest extends ServiceTestBase
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false);
server = createServer(true,
config,
PagingTest.PAGE_SIZE,
PagingTest.PAGE_MAX,
AddressFullMessagePolicy.BLOCK,
new HashMap<String, AddressSettings>());
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
server.start();
@ -2342,8 +2337,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2541,8 +2536,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2694,8 +2689,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2713,7 +2708,7 @@ public class PagingTest extends ServiceTestBase
buffer.readBytes(other);
UnitTestCase.assertEqualsByteArrays(body, other);
ServiceTestBase.assertEqualsByteArrays(body, other);
}
/**
@ -3360,7 +3355,7 @@ public class PagingTest extends ServiceTestBase
for (int j = 0; j < numberOfBytes; j++)
{
body[j] = UnitTestCase.getSamplebyte(j);
body[j] = ServiceTestBase.getSamplebyte(j);
}
long scheduledTime = System.currentTimeMillis() + 5000;
@ -3429,8 +3424,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;

View File

@ -15,16 +15,9 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
@ -34,6 +27,10 @@ import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ProducerCloseTest extends ServiceTestBase
{
@ -54,7 +51,7 @@ public class ProducerCloseTest extends ServiceTestBase
Assert.assertTrue(producer.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{

View File

@ -16,13 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -32,7 +25,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientProducerCreditManagerImpl;
import org.apache.activemq.artemis.core.client.impl.ClientProducerCredits;
import org.apache.activemq.artemis.core.client.impl.ClientProducerInternal;
@ -48,6 +40,13 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class ProducerFlowControlTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -274,7 +273,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
message.getBodyBuffer().readBytes(bytesRead);
UnitTestCase.assertEqualsByteArrays(bytes, bytesRead);
ServiceTestBase.assertEqualsByteArrays(bytes, bytesRead);
message.acknowledge();

View File

@ -52,7 +52,7 @@ public class ReceiveImmediateTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false);
Configuration config = createDefaultConfig();
server = createServer(false, config);
server.start();
locator = createInVMNonHALocator();

View File

@ -27,7 +27,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
@ -214,7 +213,7 @@ public class RequestorTest extends ServiceTestBase
}
};
UnitTestCase.expectActiveMQException("ClientRequestor's session must not be closed",
ServiceTestBase.expectActiveMQException("ClientRequestor's session must not be closed",
ActiveMQExceptionType.OBJECT_CLOSED,
activeMQAction);
}
@ -258,7 +257,7 @@ public class RequestorTest extends ServiceTestBase
}
};
UnitTestCase.expectActiveMQException("can not send a request on a closed ClientRequestor",
ServiceTestBase.expectActiveMQException("can not send a request on a closed ClientRequestor",
ActiveMQExceptionType.OBJECT_CLOSED, activeMQAction);
}

View File

@ -24,11 +24,10 @@ import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
@ -118,7 +117,7 @@ public class SelfExpandingBufferTest extends ServiceTestBase
msg2.getBodyBuffer().readBytes(receivedBytes);
UnitTestCase.assertEqualsByteArrays(bytes, receivedBytes);
ServiceTestBase.assertEqualsByteArrays(bytes, receivedBytes);
msg2 = cons.receive(3000);
@ -126,7 +125,7 @@ public class SelfExpandingBufferTest extends ServiceTestBase
msg2.getBodyBuffer().readBytes(receivedBytes);
UnitTestCase.assertEqualsByteArrays(bytes, receivedBytes);
ServiceTestBase.assertEqualsByteArrays(bytes, receivedBytes);
}
finally
{

View File

@ -16,19 +16,18 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.lang.ref.WeakReference;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.lang.ref.WeakReference;
public class SessionCloseOnGCTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -70,7 +69,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
@ -78,7 +77,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -103,7 +102,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
@ -111,7 +110,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -134,13 +133,13 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -160,13 +159,13 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -181,7 +180,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(fref);
ServiceTestBase.checkWeakReferences(fref);
}
@Test
@ -197,7 +196,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
session = null;
UnitTestCase.checkWeakReferences(wses);
ServiceTestBase.checkWeakReferences(wses);
Assert.assertEquals(0, sf.numSessions());
Assert.assertEquals(1, sf.numConnections());
@ -223,7 +222,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
session2 = null;
session3 = null;
UnitTestCase.checkWeakReferences(ref1, ref2, ref3);
ServiceTestBase.checkWeakReferences(ref1, ref2, ref3);
int count = 0;
final int TOTAL_SLEEP_TIME = 400;

View File

@ -15,34 +15,31 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
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.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class SessionCloseTest extends UnitTestCase
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
public class SessionCloseTest extends ServiceTestBase
{
// Constants -----------------------------------------------------
@ -69,7 +66,7 @@ public class SessionCloseTest extends UnitTestCase
Assert.assertTrue(session.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -77,7 +74,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -85,7 +82,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -95,7 +92,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -103,7 +100,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -111,7 +108,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -119,7 +116,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -127,7 +124,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -135,7 +132,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -143,7 +140,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -164,7 +161,7 @@ public class SessionCloseTest extends UnitTestCase
Assert.assertTrue(session.isXA());
Assert.assertTrue(session.isClosed());
UnitTestCase.expectXAException(XAException.XA_RETRY, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XA_RETRY, new ActiveMQAction()
{
public void run() throws XAException
{
@ -172,7 +169,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -180,7 +177,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -188,7 +185,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -196,7 +193,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -204,7 +201,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -212,7 +209,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -260,7 +257,7 @@ public class SessionCloseTest extends UnitTestCase
server.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
}

View File

@ -37,7 +37,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.SingleServerTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientProducerImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.protocol.core.Packet;
@ -574,7 +574,7 @@ public class TemporaryQueueTest extends SingleServerTestBase
}
};
UnitTestCase.expectActiveMQException("temp queue must not exist after the server detected the client crash",
ServiceTestBase.expectActiveMQException("temp queue must not exist after the server detected the client crash",
ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, activeMQAction);
session.close();

View File

@ -15,15 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -31,13 +24,17 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class WildCardRoutingTest extends UnitTestCase
public class WildCardRoutingTest extends ServiceTestBase
{
private ActiveMQServer server;
private ServerLocator locator;
@ -784,7 +781,7 @@ public class WildCardRoutingTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setWildcardRoutingEnabled(true)
@ -797,7 +794,7 @@ public class WildCardRoutingTest extends UnitTestCase
server.start();
server.getManagementService().enableNotifications(false);
// then we create a client as normal
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
locator = createInVMNonHALocator();
sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, true);
}

View File

@ -17,13 +17,11 @@
package org.apache.activemq.artemis.tests.integration.cluster;
import org.apache.activemq.artemis.api.core.ActiveMQClusterSecurityException;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.ClusterControl;
import org.apache.activemq.artemis.core.server.cluster.ClusterController;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.junit.After;
import org.junit.Before;
@ -70,7 +68,7 @@ public class ClusterControllerTest extends ClusterTestBase
@Test
public void controlWithDifferentConnector() throws Exception
{
try (ServerLocatorImpl locator = (ServerLocatorImpl) ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)))
try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator())
{
locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance());
ClusterController controller = new ClusterController(getServer(0), getServer(0).getScheduledPool());
@ -82,7 +80,7 @@ public class ClusterControllerTest extends ClusterTestBase
@Test
public void controlWithDifferentPassword() throws Exception
{
try (ServerLocatorImpl locator = (ServerLocatorImpl) ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)))
try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator())
{
locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance());
ClusterController controller = new ClusterController(getServer(1), getServer(1).getScheduledPool());

View File

@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
import org.apache.activemq.artemis.utils.UUID;
@ -37,7 +37,7 @@ public class RealNodeManagerTest extends NodeManagerTest
UUID id1 = nodeManager.getUUID();
nodeManager.stop();
nodeManager.start();
UnitTestCase.assertEqualsByteArrays(id1.asBytes(), nodeManager.getUUID().asBytes());
ServiceTestBase.assertEqualsByteArrays(id1.asBytes(), nodeManager.getUUID().asBytes());
nodeManager.stop();
}

View File

@ -16,33 +16,27 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.bridge;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Interceptor;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.journal.impl.NIOSequentialFileFactory;
import org.apache.activemq.artemis.core.persistence.impl.journal.DescribeJournal;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds;
import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache;
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
import org.apache.activemq.artemis.core.protocol.core.Packet;
@ -56,6 +50,7 @@ import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.LinkedListIterator;
@ -66,6 +61,18 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@RunWith(value = Parameterized.class)
public class BridgeTest extends ServiceTestBase
{
@ -226,7 +233,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
message.putIntProperty(propKey, i);
@ -403,7 +410,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
message.putIntProperty(propKey, i);
@ -588,7 +595,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
producer0.send(message);
@ -606,7 +613,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
producer0.send(message);
@ -1869,4 +1876,59 @@ public class BridgeTest extends ServiceTestBase
}
/**
* It will inspect the journal directly and determine if there are queues on this journal,
*
* @param serverToInvestigate
* @return a Map containing the reference counts per queue
* @throws Exception
*/
protected Map<Long, AtomicInteger> loadQueues(ActiveMQServer serverToInvestigate) throws Exception
{
SequentialFileFactory messagesFF = new NIOSequentialFileFactory(serverToInvestigate.getConfiguration()
.getJournalDirectory());
JournalImpl messagesJournal = new JournalImpl(serverToInvestigate.getConfiguration().getJournalFileSize(),
serverToInvestigate.getConfiguration().getJournalMinFiles(),
0,
0,
messagesFF,
"activemq-data",
"amq",
1);
List<RecordInfo> records = new LinkedList<RecordInfo>();
List<PreparedTransactionInfo> preparedTransactions = new LinkedList<PreparedTransactionInfo>();
messagesJournal.start();
messagesJournal.load(records, preparedTransactions, null);
// These are more immutable integers
Map<Long, AtomicInteger> messageRefCounts = new HashMap<Long, AtomicInteger>();
for (RecordInfo info : records)
{
Object o = DescribeJournal.newObjectEncoding(info);
if (info.getUserRecordType() == JournalRecordIds.ADD_REF)
{
DescribeJournal.ReferenceDescribe ref = (DescribeJournal.ReferenceDescribe) o;
AtomicInteger count = messageRefCounts.get(ref.refEncoding.queueID);
if (count == null)
{
count = new AtomicInteger(1);
messageRefCounts.put(ref.refEncoding.queueID, count);
}
else
{
count.incrementAndGet();
}
}
}
messagesJournal.stop();
return messageRefCounts;
}
}

View File

@ -20,7 +20,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.tests.util.InVMNodeManagerServer;
import org.junit.After;
public abstract class BridgeTestBase extends UnitTestCase
public abstract class BridgeTestBase extends ServiceTestBase
{
@Override

View File

@ -16,21 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
@ -39,14 +24,13 @@ import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
import org.apache.activemq.artemis.core.client.impl.Topology;
import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
@ -68,9 +52,9 @@ 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.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding;
import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl;
import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum;
@ -83,6 +67,21 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public abstract class ClusterTestBase extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -138,7 +137,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
forceGC();
UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
ServiceTestBase.checkFreePort(ClusterTestBase.PORTS);
consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
@ -187,7 +186,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
super.tearDown();
UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
ServiceTestBase.checkFreePort(ClusterTestBase.PORTS);
}
@ -663,7 +662,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
{
// Proxy the failure and print a dump into System.out, so it is captured by Jenkins reports
e.printStackTrace();
System.out.println(UnitTestCase.threadDump(" - fired by ClusterTestBase::addConsumer"));
System.out.println(ServiceTestBase.threadDump(" - fired by ClusterTestBase::addConsumer"));
throw e;
}
@ -1541,11 +1540,11 @@ public abstract class ClusterTestBase extends ServiceTestBase
if (netty)
{
serverTotc = new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY, params);
}
else
{
serverTotc = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
}
if (ha)
@ -1582,11 +1581,11 @@ public abstract class ClusterTestBase extends ServiceTestBase
if (netty)
{
serverTotc = new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY, params);
}
else
{
serverTotc = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
}
locators[node] = ActiveMQClient.createServerLocatorWithoutHA(serverTotc);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
@ -34,9 +34,9 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
{
protected final String groupAddress = UnitTestCase.getUDPDiscoveryAddress();
protected final String groupAddress = ServiceTestBase.getUDPDiscoveryAddress();
protected final int groupPort = UnitTestCase.getUDPDiscoveryPort();
protected final int groupPort = ServiceTestBase.getUDPDiscoveryPort();
protected boolean isNetty()
{

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -153,7 +153,7 @@ public class SymmetricClusterTest extends ClusterTestBase
}
catch (Throwable e)
{
System.out.println(UnitTestCase.threadDump("SymmetricClusterTest::testStopAllStartAll"));
System.out.println(ServiceTestBase.threadDump("SymmetricClusterTest::testStopAllStartAll"));
throw e;
}

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
@ -121,7 +121,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
}
catch (Throwable e)
{
System.out.println(UnitTestCase.threadDump("SymmetricClusterWithBackupTest::testStopAllStartAll"));
System.out.println(ServiceTestBase.threadDump("SymmetricClusterWithBackupTest::testStopAllStartAll"));
throw e;
}
}

View File

@ -18,15 +18,15 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
public class SymmetricClusterWithDiscoveryTest extends SymmetricClusterTest
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
protected final String groupAddress = UnitTestCase.getUDPDiscoveryAddress();
protected final String groupAddress = ServiceTestBase.getUDPDiscoveryAddress();
protected final int groupPort = UnitTestCase.getUDPDiscoveryPort();
protected final int groupPort = ServiceTestBase.getUDPDiscoveryPort();
protected boolean isNetty()
{

View File

@ -330,7 +330,11 @@ public class AutomaticColocatedQuorumVoteTest extends ServiceTestBase
transportConfigurationList.add(otherLiveNode.getName());
haPolicy.getExcludedConnectors().add(otherLiveNode.getName());
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), transportConfigurationList));
String[] input = new String[transportConfigurationList.size()];
transportConfigurationList.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), input));
haPolicy.setBackupPortOffset(100);
haPolicy.setBackupRequestRetries(-1);
haPolicy.setBackupRequestRetryInterval(500);

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
import java.io.File;
@ -130,7 +130,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final ClientMessage message = session.createMessage(true);
final int largeMessageSize = 1000 * MIN_LARGE_MESSAGE;
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(largeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(largeMessageSize));
final AtomicBoolean caughtException = new AtomicBoolean(false);
final CountDownLatch latch = new CountDownLatch(1);
@ -162,7 +162,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
Executors.defaultThreadFactory().newThread(r).start();
waitForLatch(latch);
startBackupFinishSyncing();
UnitTestCase.waitForLatch(latch2);
ServiceTestBase.waitForLatch(latch2);
crash(session);
assertFalse("no exceptions while sending message", caughtException.get());
@ -174,7 +174,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
for (int j = 0; j < largeMessageSize; j++)
{
Assert.assertTrue("large msg , expecting " + largeMessageSize + " bytes, got " + j, buffer.readable());
Assert.assertEquals("equal at " + j, UnitTestCase.getSamplebyte(j), buffer.readByte());
Assert.assertEquals("equal at " + j, ServiceTestBase.getSamplebyte(j), buffer.readByte());
}
receiveMessages(consumer, 0, 20, true);
assertNull("there should be no more messages!", consumer.receiveImmediate());

View File

@ -16,26 +16,15 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.core.client.TopologyMember;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
@ -50,10 +39,20 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public abstract class FailoverTestBase extends ServiceTestBase
{
// Constants -----------------------------------------------------
@ -143,7 +142,7 @@ public abstract class FailoverTestBase extends ServiceTestBase
{
try
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(LARGE_MESSAGE_SIZE));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(LARGE_MESSAGE_SIZE));
}
catch (Exception e)
{
@ -164,7 +163,7 @@ public abstract class FailoverTestBase extends ServiceTestBase
for (int j = 0; j < LARGE_MESSAGE_SIZE; j++)
{
Assert.assertTrue("msg " + i + ", expecting " + LARGE_MESSAGE_SIZE + " bytes, got " + j, buffer.readable());
Assert.assertEquals("equal at " + j, UnitTestCase.getSamplebyte(j), buffer.readByte());
Assert.assertEquals("equal at " + j, ServiceTestBase.getSamplebyte(j), buffer.readByte());
}
}

View File

@ -32,6 +32,7 @@ import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -56,7 +57,7 @@ public class LiveToLiveFailoverTest extends FailoverTest
TransportConfiguration liveConnector0 = getConnectorTransportConfiguration(true, 0);
TransportConfiguration liveConnector1 = getConnectorTransportConfiguration(true, 1);
backupConfig = super.createDefaultConfig(1)
backupConfig = super.createDefaultConfig(1, new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 1))
.setHAPolicyConfiguration(new ColocatedPolicyConfiguration()
@ -72,7 +73,7 @@ public class LiveToLiveFailoverTest extends FailoverTest
backupServer = createColocatedTestableServer(backupConfig, nodeManager1, nodeManager0, 1);
liveConfig = super.createDefaultConfig(0)
liveConfig = super.createDefaultConfig(0, new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 0))
.setHAPolicyConfiguration(new ColocatedPolicyConfiguration()

View File

@ -33,9 +33,7 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer
import org.junit.After;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -177,12 +175,12 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
config1.addConnectorConfiguration(backupConnector.getName(), backupConnector);
List<String> clusterNodes = new ArrayList<String>();
for (int node : otherClusterNodes)
String[] clusterNodes = new String[otherClusterNodes.length];
for (int i = 0; i < otherClusterNodes.length; i++)
{
TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(otherClusterNodes[i], isNetty()));
config1.addConnectorConfiguration(connector.getName(), connector);
clusterNodes.add(connector.getName());
clusterNodes[i] = connector.getName();
}
config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), clusterNodes));
@ -204,12 +202,12 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai
.setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode)
.addConnectorConfiguration(liveConnector.getName(), liveConnector);
List<String> pairs = new ArrayList<String>();
for (int node : otherLiveNodes)
String[] pairs = new String[otherLiveNodes.length];
for (int i = 0; i < otherLiveNodes.length; i++)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(otherLiveNodes[i], isNetty()));
config0.addConnectorConfiguration(otherLiveConnector.getName(), otherLiveConnector);
pairs.add(otherLiveConnector.getName());
pairs[i] = otherLiveConnector.getName();
}
config0.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), pairs));

View File

@ -129,7 +129,9 @@ public abstract class MultipleServerFailoverTestBase extends ServiceTestBase
}
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(livetc.getName(), connectors));
String[] input = new String[connectors.size()];
connectors.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(livetc.getName(), input));
liveConfigs.add(configuration);
ActiveMQServer server = createServer(true, configuration);
TestableServer activeMQServer = new SameProcessActiveMQServer(server);
@ -190,7 +192,9 @@ public abstract class MultipleServerFailoverTestBase extends ServiceTestBase
connectors.add(staticTc.getName());
}
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), connectors));
String[] input = new String[connectors.size()];
connectors.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), input));
backupConfigs.add(configuration);
ActiveMQServer server = createServer(true, configuration);
TestableServer testableServer = new SameProcessActiveMQServer(server);

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.cluster.failover;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.cluster.qourum.BooleanVote;
import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect;
import org.apache.activemq.artemis.tests.integration.server.FakeStorageManager;
@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.Collection;
@RunWith(Parameterized.class)
public class QuorumVoteServerConnectTest extends UnitTestCase
public class QuorumVoteServerConnectTest extends ServiceTestBase
{
private final int size;

View File

@ -33,9 +33,7 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer
import org.junit.After;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -146,13 +144,12 @@ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailov
.setPagingDirectory(getPageDir() + "_" + liveNode)
.setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode);
List<String> staticConnectors = new ArrayList<String>();
for (int node : nodes)
String[] staticConnectors = new String[nodes.length];
for (int i = 0; i < nodes.length; i++)
{
TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(nodes[i], isNetty()));
config1.addConnectorConfiguration(liveConnector.getName(), liveConnector);
staticConnectors.add(liveConnector.getName());
staticConnectors[i] = liveConnector.getName();
}
config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), staticConnectors));

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -1277,7 +1277,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt
@After
public void tearDown() throws Exception
{
UnitTestCase.stopComponent(liveServer);
ServiceTestBase.stopComponent(liveServer);
liveServer = null;
@ -1317,7 +1317,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt
@Override
protected void stop() throws Exception
{
UnitTestCase.stopComponent(liveServer);
ServiceTestBase.stopComponent(liveServer);
System.gc();

View File

@ -15,17 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.junit.Before;
import org.junit.After;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
@ -35,7 +26,14 @@ import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImp
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnector;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
public abstract class MultiThreadReattachSupportTestBase extends ServiceTestBase
{
@ -122,7 +120,7 @@ public abstract class MultiThreadReattachSupportTestBase extends ServiceTestBase
// Case a failure happened here, it should print the Thread dump
// Sending it to System.out, as it would show on the Tests report
System.out.println(UnitTestCase.threadDump(" - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (" + t.getLocalizedMessage() +
System.out.println(ServiceTestBase.threadDump(" - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (" + t.getLocalizedMessage() +
")"));
}
}

View File

@ -16,6 +16,32 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
@ -24,34 +50,7 @@ import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class RandomReattachTest extends UnitTestCase
public class RandomReattachTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -16,23 +16,22 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.topology;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.Topology;
import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IsolatedTopologyTest extends ServiceTestBase
{
@ -109,7 +108,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
TransportConfiguration acceptor1VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc1");
@ -117,7 +116,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "2");
TransportConfiguration acceptor2VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc2");
@ -166,7 +165,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "3");
TransportConfiguration acceptor1VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc1");
@ -174,7 +173,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "4");
TransportConfiguration acceptor2VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc2");

View File

@ -16,11 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.topology;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException;
@ -32,21 +27,25 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.core.client.TopologyMember;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import static java.util.concurrent.TimeUnit.SECONDS;
public abstract class TopologyClusterTestBase extends ClusterTestBase
@ -396,7 +395,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase
s.getConfiguration().setSecurityEnabled(true);
}
}
Assert.assertEquals(UnitTestCase.CLUSTER_PASSWORD, config.getClusterPassword());
Assert.assertEquals(ServiceTestBase.CLUSTER_PASSWORD, config.getClusterPassword());
config.setClusterPassword(config.getClusterPassword() + "-1-2-3-");
startServers(0, 1, 2, 4, 3);
int n = 0;
@ -412,7 +411,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase
final String address = "foo1235";
ServerLocator locator = createNonHALocator(isNetty());
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(config.getClusterUser(), UnitTestCase.CLUSTER_PASSWORD, false, true, true, false, 1);
ClientSession session = sf.createSession(config.getClusterUser(), ServiceTestBase.CLUSTER_PASSWORD, false, true, true, false, 1);
session.createQueue(address, address, true);
ClientProducer producer = session.createProducer(address);
sendMessages(session, producer, 100);

View File

@ -28,7 +28,7 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.cluster.DiscoveryEntry;
import org.apache.activemq.artemis.core.cluster.DiscoveryGroup;
import org.apache.activemq.artemis.core.cluster.DiscoveryListener;
@ -39,7 +39,7 @@ import org.apache.activemq.artemis.core.server.management.NotificationService;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert;
public class DiscoveryBaseTest extends UnitTestCase
public class DiscoveryBaseTest extends ServiceTestBase
{
protected static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -16,27 +16,24 @@
*/
package org.apache.activemq.artemis.tests.integration.divert;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.DivertConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class PersistentDivertTest extends ServiceTestBase
{
@ -144,7 +141,7 @@ public class PersistentDivertTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(minLargeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(minLargeMessageSize));
}
message.putIntProperty(propKey, i);
@ -235,7 +232,7 @@ public class PersistentDivertTest extends ServiceTestBase
{
for (int j = 0; j < minLargeMessageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), message.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), message.getBodyBuffer().readByte());
}
}
@ -332,7 +329,7 @@ public class PersistentDivertTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(minLargeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(minLargeMessageSize));
}
producer.send(message);

View File

@ -32,7 +32,7 @@ public class ValidateAIOTest extends ServiceTestBase
@Test
public void testValidateAIO() throws Exception
{
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
// This will force AsyncIO
.setJournalType(JournalType.ASYNCIO);
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, true);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.http;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.Test;
@ -40,7 +40,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
public class CoreClientOverHttpTest extends UnitTestCase
public class CoreClientOverHttpTest extends ServiceTestBase
{
private static final SimpleString QUEUE = new SimpleString("CoreClientOverHttpTestQueue");
private Configuration conf;

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.jms;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.junit.Before;
@ -50,7 +50,7 @@ import org.apache.activemq.artemis.tests.util.RandomUtil;
*
* A ActiveMQConnectionFactoryTest
*/
public class ActiveMQConnectionFactoryTest extends UnitTestCase
public class ActiveMQConnectionFactoryTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -45,13 +45,13 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
*
* A FloodServerTest
*/
public class FloodServerTest extends UnitTestCase
public class FloodServerTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -40,7 +40,7 @@ import org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFa
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
@ -56,7 +56,7 @@ import org.junit.Test;
*
* A ActiveMQConnectionFactoryTest
*/
public class SimpleJNDIClientTest extends UnitTestCase
public class SimpleJNDIClientTest extends ServiceTestBase
{
private final String groupAddress = getUDPDiscoveryAddress();

View File

@ -34,7 +34,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSConstants;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -71,7 +71,7 @@ public class ReSendMessageTest extends JMSTestBase
{
BytesMessage bm = sess.createBytesMessage();
bm.setObjectProperty(ActiveMQJMSConstants.JMS_ACTIVEMQ_INPUT_STREAM,
UnitTestCase.createFakeLargeStream(2 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE));
ServiceTestBase.createFakeLargeStream(2 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE));
msgs.add(bm);
MapMessage mm = sess.createMapMessage();
@ -168,7 +168,7 @@ public class ReSendMessageTest extends JMSTestBase
for (int i = 0; i < copiedBytes.getBodyLength(); i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), copiedBytes.readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), copiedBytes.readByte());
}
}
else if (copiedMessage instanceof MapMessage)

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.jms.cluster;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -54,7 +54,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQSession;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.RandomUtil;
public class JMSReconnectTest extends UnitTestCase
public class JMSReconnectTest extends ServiceTestBase
{
private ActiveMQServer liveService;

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.jms.connection;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -93,7 +93,7 @@ public class CloseConnectionOnGCTest extends JMSTestBase
conn = null;
UnitTestCase.checkWeakReferences(wr);
ServiceTestBase.checkWeakReferences(wr);
latch.await(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(0, server.getRemotingService().getConnections().size());
@ -130,7 +130,7 @@ public class CloseConnectionOnGCTest extends JMSTestBase
conn2 = null;
conn3 = null;
UnitTestCase.checkWeakReferences(wr1, wr2, wr3);
ServiceTestBase.checkWeakReferences(wr1, wr2, wr3);
latch.await(5000, TimeUnit.MILLISECONDS);
@ -174,7 +174,7 @@ public class CloseConnectionOnGCTest extends JMSTestBase
conn2 = null;
conn3 = null;
UnitTestCase.checkWeakReferences(wr1, wr2, wr3);
ServiceTestBase.checkWeakReferences(wr1, wr2, wr3);
latch.await(5000, TimeUnit.MILLISECONDS);

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.jms.connection;
import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.junit.Before;
import org.junit.After;
@ -50,7 +50,7 @@ import org.apache.activemq.artemis.tests.integration.jms.server.management.NullI
*
* A ExceptionListenerTest
*/
public class ExceptionListenerTest extends UnitTestCase
public class ExceptionListenerTest extends ServiceTestBase
{
private ActiveMQServer server;

View File

@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.After;
import org.junit.Assert;
@ -86,7 +86,7 @@ public class JMSLargeMessageTest extends JMSTestBase
BytesMessage m = session.createBytesMessage();
m.setObjectProperty("JMS_AMQ_InputStream", UnitTestCase.createFakeLargeStream(1024 * 1024));
m.setObjectProperty("JMS_AMQ_InputStream", ServiceTestBase.createFakeLargeStream(1024 * 1024));
prod.send(m);
@ -112,7 +112,7 @@ public class JMSLargeMessageTest extends JMSTestBase
Assert.assertEquals(1024, numberOfBytes);
for (int j = 0; j < 1024; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i + j), data[j]);
Assert.assertEquals(ServiceTestBase.getSamplebyte(i + j), data[j]);
}
}
@ -130,7 +130,7 @@ public class JMSLargeMessageTest extends JMSTestBase
BytesMessage m = session.createBytesMessage();
m.setObjectProperty("JMS_AMQ_InputStream", UnitTestCase.createFakeLargeStream(10));
m.setObjectProperty("JMS_AMQ_InputStream", ServiceTestBase.createFakeLargeStream(10));
prod.send(m);
@ -154,7 +154,7 @@ public class JMSLargeMessageTest extends JMSTestBase
Assert.assertEquals(10, numberOfBytes);
for (int j = 0; j < numberOfBytes; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), data[j]);
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), data[j]);
}
Assert.assertNotNull(rm);
@ -171,7 +171,7 @@ public class JMSLargeMessageTest extends JMSTestBase
try
{
msg.setObjectProperty("JMS_AMQ_InputStream", UnitTestCase.createFakeLargeStream(10));
msg.setObjectProperty("JMS_AMQ_InputStream", ServiceTestBase.createFakeLargeStream(10));
Assert.fail("Exception was expected");
}
catch (JMSException e)
@ -232,7 +232,7 @@ public class JMSLargeMessageTest extends JMSTestBase
BytesMessage m = session.createBytesMessage();
m.setObjectProperty("JMS_AMQ_InputStream", UnitTestCase.createFakeLargeStream(msgSize));
m.setObjectProperty("JMS_AMQ_InputStream", ServiceTestBase.createFakeLargeStream(msgSize));
prod.send(m);
@ -262,7 +262,7 @@ public class JMSLargeMessageTest extends JMSTestBase
public void write(final int b) throws IOException
{
numberOfBytes.incrementAndGet();
if (UnitTestCase.getSamplebyte(position++) != b)
if (ServiceTestBase.getSamplebyte(position++) != b)
{
System.out.println("Wrong byte at position " + position);
numberOfErrors.incrementAndGet();
@ -273,7 +273,7 @@ public class JMSLargeMessageTest extends JMSTestBase
try
{
rm.setObjectProperty("JMS_AMQ_InputStream", UnitTestCase.createFakeLargeStream(100));
rm.setObjectProperty("JMS_AMQ_InputStream", ServiceTestBase.createFakeLargeStream(100));
Assert.fail("Exception expected!");
}
catch (MessageNotWriteableException expected)

View File

@ -29,7 +29,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
@ -44,7 +44,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class JMSServerStartStopTest extends UnitTestCase
public class JMSServerStartStopTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -56,7 +56,7 @@ public class JMSConfigurationTest extends ServiceTestBase
{
Context context = new InVMNamingContext();
Configuration coreConfiguration = createDefaultConfig(false);
Configuration coreConfiguration = createDefaultConfig();
ActiveMQServer coreServer = new ActiveMQServerImpl(coreConfiguration);
JMSConfiguration jmsConfiguration = new JMSConfigurationImpl();

View File

@ -23,7 +23,7 @@ import javax.management.Notification;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.integration.management.ManagementTestBase;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.junit.Assert;
import org.junit.Before;
@ -155,11 +155,11 @@ public class ConnectionFactoryControlTest extends ManagementTestBase
*/
protected void startServer() throws Exception
{
Configuration conf = createDefaultConfig(false)
.addConnectorConfiguration("invm", new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY))
Configuration conf = createDefaultConfig()
.addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY))
.setSecurityEnabled(false)
.setJMXManagementEnabled(true)
.addAcceptorConfiguration(new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY));
.addAcceptorConfiguration(new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY));
server = ActiveMQServers.newActiveMQServer(conf, mbeanServer, true);
server.start();

View File

@ -1388,7 +1388,8 @@ public class JMSQueueControlTest extends ManagementTestBase
Configuration conf = createBasicConfig()
.addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
server = createServer(this.getName().contains("WithRealData"), conf, mbeanServer);
server = createServer(this.getName().contains("WithRealData"), conf);
server.setMBeanServer(mbeanServer);
serverManager = new JMSServerManagerImpl(server);
context = new InVMNamingContext();

View File

@ -32,7 +32,7 @@ import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.integration.management.ManagementTestBase;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
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;
@ -61,13 +61,13 @@ public class JMSServerControlRestartTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String binding = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, binding);
ServiceTestBase.checkNoBinding(context, binding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = ManagementControlHelper.createJMSServerControl(mbeanServer);
control.createQueue(queueName, binding);
Object o = UnitTestCase.checkBinding(context, binding);
Object o = ServiceTestBase.checkBinding(context, binding);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -75,13 +75,13 @@ public class JMSServerControlRestartTest extends ManagementTestBase
serverManager.stop();
UnitTestCase.checkNoBinding(context, binding);
ServiceTestBase.checkNoBinding(context, binding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
serverManager = createJMSServer();
serverManager.start();
o = UnitTestCase.checkBinding(context, binding);
o = ServiceTestBase.checkBinding(context, binding);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -94,7 +94,7 @@ public class JMSServerControlRestartTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String binding = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, binding);
ServiceTestBase.checkNoBinding(context, binding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
TransportConfiguration config = new TransportConfiguration(InVMConnectorFactory.class.getName());
@ -109,7 +109,7 @@ public class JMSServerControlRestartTest extends ManagementTestBase
Assert.assertTrue(JMSManagementHelper.hasOperationSucceeded(reply));
connection.close();
Object o = UnitTestCase.checkBinding(context, binding);
Object o = ServiceTestBase.checkBinding(context, binding);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -117,13 +117,13 @@ public class JMSServerControlRestartTest extends ManagementTestBase
serverManager.stop();
UnitTestCase.checkNoBinding(context, binding);
ServiceTestBase.checkNoBinding(context, binding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
serverManager = createJMSServer();
serverManager.start();
o = UnitTestCase.checkBinding(context, binding);
o = ServiceTestBase.checkBinding(context, binding);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());

View File

@ -51,7 +51,7 @@ import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.integration.management.ManagementTestBase;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
@ -134,22 +134,22 @@ public class JMSServerControlTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String bindingsCSV = JMSServerControlTest.toCSV(bindings);
UnitTestCase.checkNoBinding(context, bindingsCSV);
ServiceTestBase.checkNoBinding(context, bindingsCSV);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, bindingsCSV);
Object o = UnitTestCase.checkBinding(context, bindings[0]);
Object o = ServiceTestBase.checkBinding(context, bindings[0]);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
o = UnitTestCase.checkBinding(context, bindings[1]);
o = ServiceTestBase.checkBinding(context, bindings[1]);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
o = UnitTestCase.checkBinding(context, bindings[2]);
o = ServiceTestBase.checkBinding(context, bindings[2]);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -172,22 +172,22 @@ public class JMSServerControlTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String bindingsCSV = JMSServerControlTest.toCSV(bindings);
UnitTestCase.checkNoBinding(context, bindingsCSV);
ServiceTestBase.checkNoBinding(context, bindingsCSV);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, bindingsCSV);
Object o = UnitTestCase.checkBinding(context, "first,first");
Object o = ServiceTestBase.checkBinding(context, "first,first");
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
o = UnitTestCase.checkBinding(context, "second,second");
o = ServiceTestBase.checkBinding(context, "second,second");
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
o = UnitTestCase.checkBinding(context, "third,third");
o = ServiceTestBase.checkBinding(context, "third,third");
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -210,7 +210,7 @@ public class JMSServerControlTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String bindingsCSV = JMSServerControlTest.toCSV(bindings);
UnitTestCase.checkNoBinding(context, bindingsCSV);
ServiceTestBase.checkNoBinding(context, bindingsCSV);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
@ -218,7 +218,7 @@ public class JMSServerControlTest extends ManagementTestBase
String selector = "foo='bar'";
control.createQueue(queueName, bindingsCSV, selector);
Object o = UnitTestCase.checkBinding(context, bindings[0]);
Object o = ServiceTestBase.checkBinding(context, bindings[0]);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
// assertEquals(((ActiveMQDestination)queue).get);
@ -228,7 +228,7 @@ public class JMSServerControlTest extends ManagementTestBase
.getFilter()
.getFilterString()
.toString());
o = UnitTestCase.checkBinding(context, bindings[1]);
o = ServiceTestBase.checkBinding(context, bindings[1]);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -237,7 +237,7 @@ public class JMSServerControlTest extends ManagementTestBase
.getFilter()
.getFilterString()
.toString());
o = UnitTestCase.checkBinding(context, bindings[2]);
o = ServiceTestBase.checkBinding(context, bindings[2]);
Assert.assertTrue(o instanceof Queue);
queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -261,13 +261,13 @@ public class JMSServerControlTest extends ManagementTestBase
String queueName = RandomUtil.randomString();
String binding = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, binding);
ServiceTestBase.checkNoBinding(context, binding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, binding, null, false);
Object o = UnitTestCase.checkBinding(context, binding);
Object o = ServiceTestBase.checkBinding(context, binding);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueName, queue.getQueueName());
@ -287,18 +287,18 @@ public class JMSServerControlTest extends ManagementTestBase
String queueJNDIBinding = RandomUtil.randomString();
String queueName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
UnitTestCase.checkBinding(context, queueJNDIBinding);
ServiceTestBase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
control.destroyQueue(queueName);
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
Assert.assertNull(fakeJMSStorageManager.destinationMap.get(queueName));
@ -310,17 +310,17 @@ public class JMSServerControlTest extends ManagementTestBase
String queueJNDIBinding = RandomUtil.randomString();
String queueName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
UnitTestCase.checkBinding(context, queueJNDIBinding);
ServiceTestBase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
ActiveMQConnectionFactory cf =
new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
new ActiveMQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
try
{
@ -330,7 +330,7 @@ public class JMSServerControlTest extends ManagementTestBase
control.destroyQueue(queueName, true);
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
Assert.assertNull(fakeJMSStorageManager.destinationMap.get(queueName));
@ -367,16 +367,16 @@ public class JMSServerControlTest extends ManagementTestBase
String queueJNDIBinding = RandomUtil.randomString();
String queueName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
UnitTestCase.checkBinding(context, queueJNDIBinding);
ServiceTestBase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
connection.start();
try
@ -397,7 +397,7 @@ public class JMSServerControlTest extends ManagementTestBase
Assert.assertTrue(e.getMessage().startsWith("AMQ119025"));
}
UnitTestCase.checkBinding(context, queueJNDIBinding);
ServiceTestBase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(queueName));
@ -422,16 +422,16 @@ public class JMSServerControlTest extends ManagementTestBase
String topicJNDIBinding = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
control.createTopic(topicName, topicJNDIBinding);
UnitTestCase.checkBinding(context, topicJNDIBinding);
ServiceTestBase.checkBinding(context, topicJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
connection.start();
try
@ -452,7 +452,7 @@ public class JMSServerControlTest extends ManagementTestBase
Assert.assertTrue(e.getMessage().startsWith("AMQ119025"));
}
UnitTestCase.checkBinding(context, topicJNDIBinding);
ServiceTestBase.checkBinding(context, topicJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
Assert.assertFalse(cons.isClosed());
@ -474,17 +474,17 @@ public class JMSServerControlTest extends ManagementTestBase
String topicJNDIBinding = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
control.createTopic(topicName, topicJNDIBinding);
UnitTestCase.checkBinding(context, topicJNDIBinding);
ServiceTestBase.checkBinding(context, topicJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
ActiveMQConnectionFactory cf =
new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
new ActiveMQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
try
{
@ -494,7 +494,7 @@ public class JMSServerControlTest extends ManagementTestBase
control.destroyTopic(topicName, true);
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
long time = System.currentTimeMillis();
@ -529,17 +529,17 @@ public class JMSServerControlTest extends ManagementTestBase
String queueJNDIBinding = RandomUtil.randomString();
String queueName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
UnitTestCase.checkBinding(context, queueJNDIBinding);
ServiceTestBase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
ActiveMQConnectionFactory cf =
new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY));
new ActiveMQConnectionFactory(false, new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY));
cf.setReconnectAttempts(-1);
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
try
@ -550,7 +550,7 @@ public class JMSServerControlTest extends ManagementTestBase
control.destroyQueue(queueName, true);
UnitTestCase.checkNoBinding(context, queueJNDIBinding);
ServiceTestBase.checkNoBinding(context, queueJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
Assert.assertNull(fakeJMSStorageManager.destinationMap.get(queueName));
@ -610,24 +610,24 @@ public class JMSServerControlTest extends ManagementTestBase
bindings[1] = RandomUtil.randomString();
bindings[2] = RandomUtil.randomString();
String topicJNDIBinding = JMSServerControlTest.toCSV(bindings);
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
String topicName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
control.createTopic(topicName, topicJNDIBinding);
Object o = UnitTestCase.checkBinding(context, bindings[0]);
Object o = ServiceTestBase.checkBinding(context, bindings[0]);
Assert.assertTrue(o instanceof Topic);
Topic topic = (Topic) o;
Assert.assertEquals(topicName, topic.getTopicName());
o = UnitTestCase.checkBinding(context, bindings[1]);
o = ServiceTestBase.checkBinding(context, bindings[1]);
Assert.assertTrue(o instanceof Topic);
topic = (Topic) o;
Assert.assertEquals(topicName, topic.getTopicName());
o = UnitTestCase.checkBinding(context, bindings[2]);
o = ServiceTestBase.checkBinding(context, bindings[2]);
Assert.assertTrue(o instanceof Topic);
topic = (Topic) o;
Assert.assertEquals(topicName, topic.getTopicName());
@ -646,7 +646,7 @@ public class JMSServerControlTest extends ManagementTestBase
String topicJNDIBinding = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
@ -673,7 +673,7 @@ public class JMSServerControlTest extends ManagementTestBase
control.destroyTopic(topicName);
Assert.assertNull(server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + topicAddress));
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
Assert.assertNull(fakeJMSStorageManager.destinationMap.get(topicName));
@ -685,7 +685,7 @@ public class JMSServerControlTest extends ManagementTestBase
String topicJNDIBinding = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
@ -695,7 +695,7 @@ public class JMSServerControlTest extends ManagementTestBase
Topic topic = (Topic) context.lookup(topicJNDIBinding);
Assert.assertNotNull(topic);
ActiveMQConnectionFactory cf =
new ActiveMQConnectionFactory(false, new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
new ActiveMQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
Connection connection = cf.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// create a consumer will create a Core queue bound to the topic address
@ -722,7 +722,7 @@ public class JMSServerControlTest extends ManagementTestBase
control.destroyTopic(topicName);
Assert.assertNull(server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + topicAddress));
UnitTestCase.checkNoBinding(context, topicJNDIBinding);
ServiceTestBase.checkNoBinding(context, topicJNDIBinding);
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
Assert.assertNull(fakeJMSStorageManager.destinationMap.get(topicName));
@ -753,7 +753,7 @@ public class JMSServerControlTest extends ManagementTestBase
{
server.getConfiguration()
.getConnectorConfigurations()
.put("tst", new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
.put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
doCreateConnectionFactory(new ConnectionFactoryCreator()
{
@ -930,7 +930,7 @@ public class JMSServerControlTest extends ManagementTestBase
server.getConfiguration()
.getConnectorConfigurations()
.put("tst", new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
.put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
control.createConnectionFactory(cfName, false, false, 3, "tst", cfJNDIBinding);
@ -971,7 +971,7 @@ public class JMSServerControlTest extends ManagementTestBase
server.getConfiguration()
.getConnectorConfigurations()
.put("tst", new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
.put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
control.createConnectionFactory(cfName, false, false, 3, "tst", cfJNDIBinding);
@ -1066,10 +1066,10 @@ public class JMSServerControlTest extends ManagementTestBase
{
Configuration conf = createBasicConfig()
.setPersistenceEnabled(true)
.addAcceptorConfiguration(new TransportConfiguration(UnitTestCase.NETTY_ACCEPTOR_FACTORY))
.addAcceptorConfiguration(new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY))
.addConnectorConfiguration("netty", new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY))
.addConnectorConfiguration("invm", new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
.addAcceptorConfiguration(new TransportConfiguration(ServiceTestBase.NETTY_ACCEPTOR_FACTORY))
.addAcceptorConfiguration(new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY))
.addConnectorConfiguration("netty", new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY))
.addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
server = addServer(ActiveMQServers.newActiveMQServer(conf, mbeanServer, true));
@ -1130,7 +1130,7 @@ public class JMSServerControlTest extends ManagementTestBase
for (Object cfJNDIBinding : cfJNDIBindings)
{
UnitTestCase.checkNoBinding(context, cfJNDIBinding.toString());
ServiceTestBase.checkNoBinding(context, cfJNDIBinding.toString());
}
checkNoResource(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(cfName));
@ -1139,7 +1139,7 @@ public class JMSServerControlTest extends ManagementTestBase
for (Object cfJNDIBinding : cfJNDIBindings)
{
Object o = UnitTestCase.checkBinding(context, cfJNDIBinding.toString());
Object o = ServiceTestBase.checkBinding(context, cfJNDIBinding.toString());
Assert.assertTrue(o instanceof ConnectionFactory);
ConnectionFactory cf = (ConnectionFactory) o;
Connection connection = cf.createConnection();

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.journal;
import java.io.File;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.AIOSequentialFileFactory;
import org.junit.BeforeClass;
@ -36,7 +36,7 @@ public class AIOImportExportTest extends NIOImportExportTest
{
File file = new File(getTestDir());
UnitTestCase.deleteDirectory(file);
ServiceTestBase.deleteDirectory(file);
file.mkdir();

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.journal;
import java.io.File;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.AIOSequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
@ -37,7 +37,7 @@ public class AIOJournalCompactTest extends NIOJournalCompactTest
{
File file = new File(getTestDir());
UnitTestCase.deleteDirectory(file);
ServiceTestBase.deleteDirectory(file);
file.mkdir();

View File

@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.core.journal.IOCompletion;
import org.apache.activemq.artemis.core.journal.Journal;
@ -37,7 +37,7 @@ import org.junit.Ignore;
import org.junit.Test;
@Ignore
public class JournalPerfTuneTest extends UnitTestCase
public class JournalPerfTuneTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.journal;
import java.io.File;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.NIOSequentialFileFactory;
@ -30,7 +30,7 @@ public class NIOBufferedJournalCompactTest extends NIOJournalCompactTest
{
File file = new File(getTestDir());
UnitTestCase.deleteDirectory(file);
ServiceTestBase.deleteDirectory(file);
file.mkdir();

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.journal;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.JournalImplTestBase;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Test;
@ -39,7 +39,7 @@ public class NIOImportExportTest extends JournalImplTestBase
{
File file = new File(getTestDir());
UnitTestCase.deleteDirectory(file);
ServiceTestBase.deleteDirectory(file);
file.mkdir();

Some files were not shown because too many files have changed in this diff Show More