This closes #4 Test refactoring work

This commit is contained in:
Clebert Suconic 2015-05-28 11:18:29 -04:00
commit 9972624ba2
429 changed files with 4409 additions and 7405 deletions

View File

@ -40,7 +40,6 @@ public abstract class SilentTestCase extends Assert
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{ {
origSysOut = System.out; origSysOut = System.out;
origSysErr = System.err; origSysErr = System.err;
sysOut = new PrintStream(new ByteArrayOutputStream()); sysOut = new PrintStream(new ByteArrayOutputStream());
@ -54,6 +53,5 @@ public abstract class SilentTestCase extends Assert
{ {
System.setOut(origSysOut); System.setOut(origSysOut);
System.setErr(origSysErr); System.setErr(origSysErr);
} }
} }

View File

@ -15,19 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.util; package org.apache.activemq.artemis.util;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import java.util.Iterator;
import org.junit.Assert;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.ConcurrentSet; import org.apache.activemq.artemis.utils.ConcurrentSet;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.Iterator;
public class ConcurrentHashSetTest extends Assert public class ConcurrentHashSetTest extends Assert
{ {
@ -132,20 +128,10 @@ public class ConcurrentHashSetTest extends Assert
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{ {
set = new ConcurrentHashSet<String>(); set = new ConcurrentHashSet<String>();
element = RandomUtil.randomString(); element = RandomUtil.randomString();
} }
@After
public void tearDown() throws Exception
{
set = null;
element = null;
}
// Package protected --------------------------------------------- // Package protected ---------------------------------------------
// Protected ----------------------------------------------------- // Protected -----------------------------------------------------

View File

@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.util; package org.apache.activemq.artemis.util;
import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException; import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.utils.TypedProperties; import org.apache.activemq.artemis.utils.TypedProperties;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -46,21 +46,10 @@ public class TypedPropertiesConversionTest
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{ {
key = RandomUtil.randomSimpleString(); key = RandomUtil.randomSimpleString();
props = new TypedProperties(); props = new TypedProperties();
} }
@After
public void tearDown() throws Exception
{
key = null;
props = null;
}
@Test @Test
public void testBooleanProperty() throws Exception public void testBooleanProperty() throws Exception
{ {

View File

@ -24,8 +24,6 @@ import javax.jms.Queue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
//import io.hawtjms.jms.JmsConnectionFactory;
//import io.hawtjms.jms.JmsQueue;
import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl; import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl; import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
import org.proton.plug.test.minimalserver.DumbServer; import org.proton.plug.test.minimalserver.DumbServer;

View File

@ -84,7 +84,6 @@ public class ProtonTest extends AbstractJMSTest
AbstractJMSTest.forceGC(); AbstractJMSTest.forceGC();
server.start("127.0.0.1", Constants.PORT, true); server.start("127.0.0.1", Constants.PORT, true);
connection = createConnection(); connection = createConnection();
} }
@After @After

View File

@ -270,6 +270,8 @@ public interface Configuration
Configuration addConnectorConfiguration(final String key, final TransportConfiguration info); Configuration addConnectorConfiguration(final String key, final TransportConfiguration info);
Configuration clearConnectorConfigurations();
/** /**
* Returns the broadcast groups configured for this server. * Returns the broadcast groups configured for this server.
*/ */
@ -324,6 +326,8 @@ public interface Configuration
*/ */
Configuration setDivertConfigurations(final List<DivertConfiguration> configs); Configuration setDivertConfigurations(final List<DivertConfiguration> configs);
Configuration addDivertConfiguration(final DivertConfiguration config);
/** /**
* Returns the cluster connections configured for this server. * Returns the cluster connections configured for this server.
* <p/> * <p/>
@ -797,6 +801,8 @@ public interface Configuration
Configuration addAddressesSetting(String key, AddressSettings addressesSetting); Configuration addAddressesSetting(String key, AddressSettings addressesSetting);
Configuration clearAddressesSettings();
/** /**
* @param roles a list of roles per matching * @param roles a list of roles per matching
*/ */

View File

@ -377,6 +377,12 @@ public class ConfigurationImpl implements Configuration, Serializable
return this; return this;
} }
public ConfigurationImpl clearConnectorConfigurations()
{
connectorConfigs.clear();
return this;
}
public GroupingHandlerConfiguration getGroupingHandlerConfiguration() public GroupingHandlerConfiguration getGroupingHandlerConfiguration()
{ {
return groupingHandlerConfiguration; return groupingHandlerConfiguration;
@ -1026,6 +1032,13 @@ public class ConfigurationImpl implements Configuration, Serializable
return this; return this;
} }
@Override
public ConfigurationImpl clearAddressesSettings()
{
this.addressesSettings.clear();
return this;
}
@Override @Override
public Map<String, ResourceLimitSettings> getResourceLimitSettings() public Map<String, ResourceLimitSettings> getResourceLimitSettings()
{ {

View File

@ -146,9 +146,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return autoCreateJmsQueues != null ? autoCreateJmsQueues : AddressSettings.DEFAULT_AUTO_CREATE_QUEUES; return autoCreateJmsQueues != null ? autoCreateJmsQueues : AddressSettings.DEFAULT_AUTO_CREATE_QUEUES;
} }
public void setAutoCreateJmsQueues(final boolean autoCreateJmsQueues) public AddressSettings setAutoCreateJmsQueues(final boolean autoCreateJmsQueues)
{ {
this.autoCreateJmsQueues = autoCreateJmsQueues; this.autoCreateJmsQueues = autoCreateJmsQueues;
return this;
} }
public boolean isAutoDeleteJmsQueues() public boolean isAutoDeleteJmsQueues()
@ -156,9 +157,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return autoDeleteJmsQueues != null ? autoDeleteJmsQueues : AddressSettings.DEFAULT_AUTO_DELETE_QUEUES; return autoDeleteJmsQueues != null ? autoDeleteJmsQueues : AddressSettings.DEFAULT_AUTO_DELETE_QUEUES;
} }
public void setAutoDeleteJmsQueues(final boolean autoDeleteJmsQueues) public AddressSettings setAutoDeleteJmsQueues(final boolean autoDeleteJmsQueues)
{ {
this.autoDeleteJmsQueues = autoDeleteJmsQueues; this.autoDeleteJmsQueues = autoDeleteJmsQueues;
return this;
} }
public boolean isLastValueQueue() public boolean isLastValueQueue()
@ -166,9 +168,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return lastValueQueue != null ? lastValueQueue : AddressSettings.DEFAULT_LAST_VALUE_QUEUE; return lastValueQueue != null ? lastValueQueue : AddressSettings.DEFAULT_LAST_VALUE_QUEUE;
} }
public void setLastValueQueue(final boolean lastValueQueue) public AddressSettings setLastValueQueue(final boolean lastValueQueue)
{ {
this.lastValueQueue = lastValueQueue; this.lastValueQueue = lastValueQueue;
return this;
} }
public AddressFullMessagePolicy getAddressFullMessagePolicy() public AddressFullMessagePolicy getAddressFullMessagePolicy()
@ -177,9 +180,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
: AddressSettings.DEFAULT_ADDRESS_FULL_MESSAGE_POLICY; : AddressSettings.DEFAULT_ADDRESS_FULL_MESSAGE_POLICY;
} }
public void setAddressFullMessagePolicy(final AddressFullMessagePolicy addressFullMessagePolicy) public AddressSettings setAddressFullMessagePolicy(final AddressFullMessagePolicy addressFullMessagePolicy)
{ {
this.addressFullMessagePolicy = addressFullMessagePolicy; this.addressFullMessagePolicy = addressFullMessagePolicy;
return this;
} }
public long getPageSizeBytes() public long getPageSizeBytes()
@ -187,9 +191,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return pageSizeBytes != null ? pageSizeBytes : AddressSettings.DEFAULT_PAGE_SIZE; return pageSizeBytes != null ? pageSizeBytes : AddressSettings.DEFAULT_PAGE_SIZE;
} }
public void setPageSizeBytes(final long pageSize) public AddressSettings setPageSizeBytes(final long pageSize)
{ {
pageSizeBytes = pageSize; pageSizeBytes = pageSize;
return this;
} }
public int getPageCacheMaxSize() public int getPageCacheMaxSize()
@ -197,9 +202,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return pageMaxCache != null ? pageMaxCache : AddressSettings.DEFAULT_PAGE_MAX_CACHE; return pageMaxCache != null ? pageMaxCache : AddressSettings.DEFAULT_PAGE_MAX_CACHE;
} }
public void setPageCacheMaxSize(final int pageMaxCache) public AddressSettings setPageCacheMaxSize(final int pageMaxCache)
{ {
this.pageMaxCache = pageMaxCache; this.pageMaxCache = pageMaxCache;
return this;
} }
public long getMaxSizeBytes() public long getMaxSizeBytes()
@ -207,9 +213,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return maxSizeBytes != null ? maxSizeBytes : AddressSettings.DEFAULT_MAX_SIZE_BYTES; return maxSizeBytes != null ? maxSizeBytes : AddressSettings.DEFAULT_MAX_SIZE_BYTES;
} }
public void setMaxSizeBytes(final long maxSizeBytes) public AddressSettings setMaxSizeBytes(final long maxSizeBytes)
{ {
this.maxSizeBytes = maxSizeBytes; this.maxSizeBytes = maxSizeBytes;
return this;
} }
public int getMaxDeliveryAttempts() public int getMaxDeliveryAttempts()
@ -217,9 +224,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return maxDeliveryAttempts != null ? maxDeliveryAttempts : AddressSettings.DEFAULT_MAX_DELIVERY_ATTEMPTS; return maxDeliveryAttempts != null ? maxDeliveryAttempts : AddressSettings.DEFAULT_MAX_DELIVERY_ATTEMPTS;
} }
public void setMaxDeliveryAttempts(final int maxDeliveryAttempts) public AddressSettings setMaxDeliveryAttempts(final int maxDeliveryAttempts)
{ {
this.maxDeliveryAttempts = maxDeliveryAttempts; this.maxDeliveryAttempts = maxDeliveryAttempts;
return this;
} }
public int getMessageCounterHistoryDayLimit() public int getMessageCounterHistoryDayLimit()
@ -228,9 +236,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
: AddressSettings.DEFAULT_MESSAGE_COUNTER_HISTORY_DAY_LIMIT; : AddressSettings.DEFAULT_MESSAGE_COUNTER_HISTORY_DAY_LIMIT;
} }
public void setMessageCounterHistoryDayLimit(final int messageCounterHistoryDayLimit) public AddressSettings setMessageCounterHistoryDayLimit(final int messageCounterHistoryDayLimit)
{ {
this.messageCounterHistoryDayLimit = messageCounterHistoryDayLimit; this.messageCounterHistoryDayLimit = messageCounterHistoryDayLimit;
return this;
} }
public long getRedeliveryDelay() public long getRedeliveryDelay()
@ -238,9 +247,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return redeliveryDelay != null ? redeliveryDelay : AddressSettings.DEFAULT_REDELIVER_DELAY; return redeliveryDelay != null ? redeliveryDelay : AddressSettings.DEFAULT_REDELIVER_DELAY;
} }
public void setRedeliveryDelay(final long redeliveryDelay) public AddressSettings setRedeliveryDelay(final long redeliveryDelay)
{ {
this.redeliveryDelay = redeliveryDelay; this.redeliveryDelay = redeliveryDelay;
return this;
} }
public double getRedeliveryMultiplier() public double getRedeliveryMultiplier()
@ -248,9 +258,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return redeliveryMultiplier != null ? redeliveryMultiplier : AddressSettings.DEFAULT_REDELIVER_MULTIPLIER; return redeliveryMultiplier != null ? redeliveryMultiplier : AddressSettings.DEFAULT_REDELIVER_MULTIPLIER;
} }
public void setRedeliveryMultiplier(final double redeliveryMultiplier) public AddressSettings setRedeliveryMultiplier(final double redeliveryMultiplier)
{ {
this.redeliveryMultiplier = redeliveryMultiplier; this.redeliveryMultiplier = redeliveryMultiplier;
return this;
} }
public long getMaxRedeliveryDelay() public long getMaxRedeliveryDelay()
@ -260,9 +271,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return maxRedeliveryDelay != null ? maxRedeliveryDelay : (getRedeliveryDelay() * 10); return maxRedeliveryDelay != null ? maxRedeliveryDelay : (getRedeliveryDelay() * 10);
} }
public void setMaxRedeliveryDelay(final long maxRedeliveryDelay) public AddressSettings setMaxRedeliveryDelay(final long maxRedeliveryDelay)
{ {
this.maxRedeliveryDelay = maxRedeliveryDelay; this.maxRedeliveryDelay = maxRedeliveryDelay;
return this;
} }
public SimpleString getDeadLetterAddress() public SimpleString getDeadLetterAddress()
@ -270,9 +282,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return deadLetterAddress; return deadLetterAddress;
} }
public void setDeadLetterAddress(final SimpleString deadLetterAddress) public AddressSettings setDeadLetterAddress(final SimpleString deadLetterAddress)
{ {
this.deadLetterAddress = deadLetterAddress; this.deadLetterAddress = deadLetterAddress;
return this;
} }
public SimpleString getExpiryAddress() public SimpleString getExpiryAddress()
@ -280,9 +293,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return expiryAddress; return expiryAddress;
} }
public void setExpiryAddress(final SimpleString expiryAddress) public AddressSettings setExpiryAddress(final SimpleString expiryAddress)
{ {
this.expiryAddress = expiryAddress; this.expiryAddress = expiryAddress;
return this;
} }
public Long getExpiryDelay() public Long getExpiryDelay()
@ -290,9 +304,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return expiryDelay; return expiryDelay;
} }
public void setExpiryDelay(final Long expiryDelay) public AddressSettings setExpiryDelay(final Long expiryDelay)
{ {
this.expiryDelay = expiryDelay; this.expiryDelay = expiryDelay;
return this;
} }
public boolean isSendToDLAOnNoRoute() public boolean isSendToDLAOnNoRoute()
@ -300,9 +315,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return sendToDLAOnNoRoute != null ? sendToDLAOnNoRoute : AddressSettings.DEFAULT_SEND_TO_DLA_ON_NO_ROUTE; return sendToDLAOnNoRoute != null ? sendToDLAOnNoRoute : AddressSettings.DEFAULT_SEND_TO_DLA_ON_NO_ROUTE;
} }
public void setSendToDLAOnNoRoute(final boolean value) public AddressSettings setSendToDLAOnNoRoute(final boolean value)
{ {
sendToDLAOnNoRoute = value; sendToDLAOnNoRoute = value;
return this;
} }
public long getRedistributionDelay() public long getRedistributionDelay()
@ -310,9 +326,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return redistributionDelay != null ? redistributionDelay : AddressSettings.DEFAULT_REDISTRIBUTION_DELAY; return redistributionDelay != null ? redistributionDelay : AddressSettings.DEFAULT_REDISTRIBUTION_DELAY;
} }
public void setRedistributionDelay(final long redistributionDelay) public AddressSettings setRedistributionDelay(final long redistributionDelay)
{ {
this.redistributionDelay = redistributionDelay; this.redistributionDelay = redistributionDelay;
return this;
} }
public long getSlowConsumerThreshold() public long getSlowConsumerThreshold()
@ -320,9 +337,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return slowConsumerThreshold != null ? slowConsumerThreshold : AddressSettings.DEFAULT_SLOW_CONSUMER_THRESHOLD; return slowConsumerThreshold != null ? slowConsumerThreshold : AddressSettings.DEFAULT_SLOW_CONSUMER_THRESHOLD;
} }
public void setSlowConsumerThreshold(final long slowConsumerThreshold) public AddressSettings setSlowConsumerThreshold(final long slowConsumerThreshold)
{ {
this.slowConsumerThreshold = slowConsumerThreshold; this.slowConsumerThreshold = slowConsumerThreshold;
return this;
} }
public long getSlowConsumerCheckPeriod() public long getSlowConsumerCheckPeriod()
@ -330,9 +348,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
return slowConsumerCheckPeriod != null ? slowConsumerCheckPeriod : AddressSettings.DEFAULT_SLOW_CONSUMER_CHECK_PERIOD; return slowConsumerCheckPeriod != null ? slowConsumerCheckPeriod : AddressSettings.DEFAULT_SLOW_CONSUMER_CHECK_PERIOD;
} }
public void setSlowConsumerCheckPeriod(final long slowConsumerCheckPeriod) public AddressSettings setSlowConsumerCheckPeriod(final long slowConsumerCheckPeriod)
{ {
this.slowConsumerCheckPeriod = slowConsumerCheckPeriod; this.slowConsumerCheckPeriod = slowConsumerCheckPeriod;
return this;
} }
public SlowConsumerPolicy getSlowConsumerPolicy() public SlowConsumerPolicy getSlowConsumerPolicy()
@ -341,9 +360,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
: AddressSettings.DEFAULT_SLOW_CONSUMER_POLICY; : AddressSettings.DEFAULT_SLOW_CONSUMER_POLICY;
} }
public void setSlowConsumerPolicy(final SlowConsumerPolicy slowConsumerPolicy) public AddressSettings setSlowConsumerPolicy(final SlowConsumerPolicy slowConsumerPolicy)
{ {
this.slowConsumerPolicy = slowConsumerPolicy; this.slowConsumerPolicy = slowConsumerPolicy;
return this;
} }
/** /**

View File

@ -23,7 +23,7 @@ import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants; import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -33,7 +33,7 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
public class ConfigurationImplTest extends ServiceTestBase public class ConfigurationImplTest extends ActiveMQTestBase
{ {
protected Configuration conf; protected Configuration conf;

View File

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

View File

@ -34,12 +34,12 @@ import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivatio
import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation; import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation; import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation; import org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Test; import org.junit.Test;
import java.util.List; import java.util.List;
public class HAPolicyConfigurationTest extends ServiceTestBase public class HAPolicyConfigurationTest extends ActiveMQTestBase
{ {
@Test @Test
public void liveOnlyTest() throws Exception public void liveOnlyTest() throws Exception

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser; import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -30,7 +30,7 @@ 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: * 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 * -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:<path_to_source>/tests/config/logging.properties
*/ */
public class WrongRoleFileConfigurationParserTest extends ServiceTestBase public class WrongRoleFileConfigurationParserTest extends ActiveMQTestBase
{ {
@BeforeClass @BeforeClass
public static void prepareLogger() public static void prepareLogger()

View File

@ -15,16 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.core.list; package org.apache.activemq.artemis.core.list;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.utils.LinkedListIterator; import org.apache.activemq.artemis.utils.LinkedListIterator;
import org.apache.activemq.artemis.utils.PriorityLinkedListImpl; import org.apache.activemq.artemis.utils.PriorityLinkedListImpl;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public final class PriorityLinkedListTest extends Assert public final class PriorityLinkedListTest extends Assert
{ {
@ -122,13 +118,6 @@ public final class PriorityLinkedListTest extends Assert
z = new Wibble("z"); z = new Wibble("z");
} }
@After
public void tearDown() throws Exception
{
list = null;
}
@Test @Test
public void testEmpty() throws Exception public void testEmpty() throws Exception
{ {

View File

@ -24,11 +24,11 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessagePropertyTest extends ServiceTestBase public class MessagePropertyTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
private ServerLocator locator; private ServerLocator locator;

View File

@ -48,7 +48,7 @@ import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.ResourceManager; import org.apache.activemq.artemis.core.transaction.ResourceManager;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.ReusableLatch;
import org.junit.Assert; import org.junit.Assert;
@ -65,7 +65,7 @@ import java.util.concurrent.TimeUnit;
* There is a small window where you could receive notifications wrongly * There is a small window where you could receive notifications wrongly
* this test will make sure the component would play well with that notification * this test will make sure the component would play well with that notification
*/ */
public class ClusteredResetMockTest extends ServiceTestBase public class ClusteredResetMockTest extends ActiveMQTestBase
{ {
public static final SimpleString ANYCLUSTER = SimpleString.toSimpleString("anycluster"); 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.api.core.SimpleString;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class AddressSettingsTest extends ServiceTestBase public class AddressSettingsTest extends ActiveMQTestBase
{ {
@Test @Test
public void testDefaults() public void testDefaults()

View File

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

View File

@ -133,7 +133,7 @@ import java.util.concurrent.atomic.AtomicInteger;
/** /**
* Base class with basic utilities on starting up a basic server * Base class with basic utilities on starting up a basic server
*/ */
public abstract class ServiceTestBase extends Assert public abstract class ActiveMQTestBase extends Assert
{ {
public static final String TARGET_TMP = "./target/tmp"; public static final String TARGET_TMP = "./target/tmp";
public static final String INVM_ACCEPTOR_FACTORY = InVMAcceptorFactory.class.getCanonicalName(); public static final String INVM_ACCEPTOR_FACTORY = InVMAcceptorFactory.class.getCanonicalName();
@ -151,7 +151,7 @@ public abstract class ServiceTestBase extends Assert
private static final int DEFAULT_UDP_PORT; private static final int DEFAULT_UDP_PORT;
private static final ActiveMQServerLogger log = ActiveMQServerLogger.LOGGER; private static final ActiveMQServerLogger log = ActiveMQServerLogger.LOGGER;
protected static final long WAIT_TIMEOUT = 20000; protected static final long WAIT_TIMEOUT = 30000;
// There is a verification about thread leakages. We only fail a single thread when this happens // There is a verification about thread leakages. We only fail a single thread when this happens
private static Set<Thread> alreadyFailedThread = new HashSet<Thread>(); private static Set<Thread> alreadyFailedThread = new HashSet<Thread>();
@ -203,7 +203,7 @@ public abstract class ServiceTestBase extends Assert
DEFAULT_UDP_PORT = 6000 + random.nextInt(1000); DEFAULT_UDP_PORT = 6000 + random.nextInt(1000);
} }
public ServiceTestBase() public ActiveMQTestBase()
{ {
File parent = new File(TARGET_TMP); File parent = new File(TARGET_TMP);
parent.mkdirs(); parent.mkdirs();
@ -388,6 +388,12 @@ public abstract class ServiceTestBase extends Assert
} }
} }
/**
*
* @param str
* @param sub
* @return
*/
public static int countOccurrencesOf(String str, String sub) public static int countOccurrencesOf(String str, String sub)
{ {
if (str == null || sub == null || str.length() == 0 || sub.length() == 0) if (str == null || sub == null || str.length() == 0 || sub.length() == 0)
@ -420,17 +426,31 @@ public abstract class ServiceTestBase extends Assert
return (OS_TYPE.indexOf("win") >= 0); return (OS_TYPE.indexOf("win") >= 0);
} }
protected Configuration createDefaultConfig() throws Exception protected Configuration createDefaultInVMConfig() throws Exception
{ {
return createDefaultConfig(false); return createDefaultConfig(0, false);
}
protected Configuration createDefaultInVMConfig(final int serverID) throws Exception
{
return createDefaultConfig(serverID, false);
}
protected Configuration createDefaultNettyConfig() throws Exception
{
return createDefaultConfig(0, true);
} }
protected Configuration createDefaultConfig(final boolean netty) throws Exception protected Configuration createDefaultConfig(final boolean netty) throws Exception
{ {
ConfigurationImpl configuration = createBasicConfig(-1) return createDefaultConfig(0, netty);
}
protected Configuration createDefaultConfig(final int serverID, final boolean netty) throws Exception
{
ConfigurationImpl configuration = createBasicConfig(serverID)
.setJMXManagementEnabled(false) .setJMXManagementEnabled(false)
.clearAcceptorConfigurations() .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, generateInVMParams(serverID)));
.addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
if (netty) if (netty)
{ {
@ -440,11 +460,11 @@ public abstract class ServiceTestBase extends Assert
return configuration; return configuration;
} }
protected Configuration createDefaultConfig(final int index, private Configuration createDefaultConfig(final int index,
final Map<String, Object> params, final Map<String, Object> params,
final String... acceptors) final String... acceptors)
{ {
Configuration configuration = createBasicConfig(index).clearAcceptorConfigurations(); Configuration configuration = createBasicConfig(index);
for (String acceptor : acceptors) for (String acceptor : acceptors)
{ {
@ -455,6 +475,43 @@ public abstract class ServiceTestBase extends Assert
return configuration; return configuration;
} }
protected ConfigurationImpl createBasicConfig() throws Exception
{
return createBasicConfig(-1);
}
/**
* @param serverID
* @return
* @throws Exception
*/
protected ConfigurationImpl createBasicConfig(final int serverID)
{
ConfigurationImpl configuration = new ConfigurationImpl()
.setSecurityEnabled(false)
.setJournalMinFiles(2)
.setJournalFileSize(100 * 1024)
.setJournalType(getDefaultJournalType())
.setJournalDirectory(getJournalDir(serverID, false))
.setBindingsDirectory(getBindingsDir(serverID, false))
.setPagingDirectory(getPageDir(serverID, false))
.setLargeMessagesDirectory(getLargeMessagesDir(serverID, false))
.setJournalCompactMinFiles(0)
.setJournalCompactPercentage(0)
.setClusterPassword(CLUSTER_PASSWORD);
return configuration;
}
protected Map<String, Object> generateInVMParams(final int node)
{
Map<String, Object> params = new HashMap<String, Object>();
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, node);
return params;
}
protected static final ClusterConnectionConfiguration basicClusterConnectionConfig(String connectorName, String... connectors) protected static final ClusterConnectionConfiguration basicClusterConnectionConfig(String connectorName, String... connectors)
{ {
ArrayList<String> connectors0 = new ArrayList<>(); ArrayList<String> connectors0 = new ArrayList<>();
@ -483,47 +540,6 @@ public abstract class ServiceTestBase extends Assert
return new OrderedExecutorFactory(executor); return new OrderedExecutorFactory(executor);
} }
protected ConfigurationImpl createBasicConfig() throws Exception
{
return createBasicConfig(0);
}
/**
* @param serverID
* @return
* @throws Exception
*/
protected ConfigurationImpl createBasicConfig(final int serverID)
{
ConfigurationImpl configuration = new ConfigurationImpl()
.setSecurityEnabled(false)
.setJournalMinFiles(2)
.setJournalFileSize(100 * 1024)
.setJournalType(getDefaultJournalType())
.setJournalDirectory(getJournalDir(serverID, false))
.setBindingsDirectory(getBindingsDir(serverID, false))
.setPagingDirectory(getPageDir(serverID, false))
.setLargeMessagesDirectory(getLargeMessagesDir(serverID, false))
.setJournalCompactMinFiles(0)
.setJournalCompactPercentage(0)
.setClusterPassword(CLUSTER_PASSWORD);
return configuration;
}
public static final ConfigurationImpl createBasicConfigNoDataFolder()
{
ConfigurationImpl configuration = new ConfigurationImpl()
.setSecurityEnabled(false)
.setJournalType(getDefaultJournalType())
.setPersistenceEnabled(false)
.setJournalCompactMinFiles(0)
.setJournalCompactPercentage(0)
.setClusterPassword(CLUSTER_PASSWORD);
return configuration;
}
protected static String getUDPDiscoveryAddress() protected static String getUDPDiscoveryAddress()
{ {
return System.getProperty("TEST-UDP-ADDRESS", "230.1.2.3"); return System.getProperty("TEST-UDP-ADDRESS", "230.1.2.3");
@ -689,7 +705,10 @@ public abstract class ServiceTestBase extends Assert
ActiveMQServerLogger log0 = ActiveMQServerLogger.LOGGER; ActiveMQServerLogger log0 = ActiveMQServerLogger.LOGGER;
log0.info(message, e); log0.info(message, e);
System.out.println(message); System.out.println(message);
e.printStackTrace(System.out); if (e != null)
{
e.printStackTrace(System.out);
}
} }
/** /**
@ -697,9 +716,7 @@ public abstract class ServiceTestBase extends Assert
*/ */
public void logAndSystemOut(String message) public void logAndSystemOut(String message)
{ {
ActiveMQServerLogger log0 = ActiveMQServerLogger.LOGGER; logAndSystemOut(message, null);
log0.info(message);
System.out.println(this.getClass().getName() + "::" + message);
} }
public static String dumpBytes(final byte[] bytes) public static String dumpBytes(final byte[] bytes)
@ -723,7 +740,7 @@ public abstract class ServiceTestBase extends Assert
return buff.toString(); return buff.toString();
} }
public static String dumbBytesHex(final byte[] buffer, final int bytesPerLine) public static String dumpBytesHex(final byte[] buffer, final int bytesPerLine)
{ {
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
@ -1400,7 +1417,7 @@ public abstract class ServiceTestBase extends Assert
} }
protected void waitForServer(ActiveMQServer server) throws InterruptedException protected void waitForServerToStart(ActiveMQServer server) throws InterruptedException
{ {
if (server == null) if (server == null)
return; return;
@ -1546,8 +1563,8 @@ public abstract class ServiceTestBase extends Assert
final long maxAddressSize, final long maxAddressSize,
final Map<String, AddressSettings> settings) final Map<String, AddressSettings> settings)
{ {
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration, realFiles)); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration, realFiles));
if (settings != null) if (settings != null)
{ {
for (Map.Entry<String, AddressSettings> setting : settings.entrySet()) for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
@ -1556,10 +1573,10 @@ public abstract class ServiceTestBase extends Assert
} }
} }
AddressSettings defaultSetting = new AddressSettings(); AddressSettings defaultSetting = new AddressSettings()
defaultSetting.setPageSizeBytes(pageSize); .setPageSizeBytes(pageSize)
defaultSetting.setMaxSizeBytes(maxAddressSize); .setMaxSizeBytes(maxAddressSize)
defaultSetting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
server.getAddressSettingsRepository().addMatch("#", defaultSetting); server.getAddressSettingsRepository().addMatch("#", defaultSetting);
@ -1611,10 +1628,10 @@ public abstract class ServiceTestBase extends Assert
ActiveMQServer server; ActiveMQServer server;
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl(); ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
configuration.setPersistenceEnabled(realFiles); configuration.setPersistenceEnabled(realFiles);
server = new InVMNodeManagerServer(configuration, server = addServer(new InVMNodeManagerServer(configuration,
ManagementFactory.getPlatformMBeanServer(), ManagementFactory.getPlatformMBeanServer(),
securityManager, securityManager,
nodeManager); nodeManager));
try try
{ {
@ -1959,7 +1976,7 @@ public abstract class ServiceTestBase extends Assert
if (messageJournal) if (messageJournal)
{ {
ff = new NIOSequentialFileFactory(getJournalDir(), null); ff = new NIOSequentialFileFactory(config.getJournalDirectory(), null);
journal = new JournalImpl(config.getJournalFileSize(), journal = new JournalImpl(config.getJournalFileSize(),
config.getJournalMinFiles(), config.getJournalMinFiles(),
0, 0,
@ -1971,7 +1988,7 @@ public abstract class ServiceTestBase extends Assert
} }
else else
{ {
ff = new NIOSequentialFileFactory(getBindingsDir(), null); ff = new NIOSequentialFileFactory(config.getBindingsDirectory(), null);
journal = new JournalImpl(1024 * 1024, journal = new JournalImpl(1024 * 1024,
2, 2,
config.getJournalCompactMinFiles(), config.getJournalCompactMinFiles(),
@ -2154,9 +2171,9 @@ public abstract class ServiceTestBase extends Assert
* Deleting a file on LargeDir is an asynchronous process. We need to keep looking for a while if * Deleting a file on LargeDir is an asynchronous process. We need to keep looking for a while if
* the file hasn't been deleted yet. * the file hasn't been deleted yet.
*/ */
protected void validateNoFilesOnLargeDir(final int expect) throws Exception protected void validateNoFilesOnLargeDir(final String directory, final int expect) throws Exception
{ {
File largeMessagesFileDir = new File(getLargeMessagesDir()); File largeMessagesFileDir = new File(directory);
// Deleting the file is async... we keep looking for a period of the time until the file is really gone // Deleting the file is async... we keep looking for a period of the time until the file is really gone
long timeout = System.currentTimeMillis() + 5000; long timeout = System.currentTimeMillis() + 5000;
@ -2183,7 +2200,7 @@ public abstract class ServiceTestBase extends Assert
*/ */
protected void validateNoFilesOnLargeDir() throws Exception protected void validateNoFilesOnLargeDir() throws Exception
{ {
validateNoFilesOnLargeDir(0); validateNoFilesOnLargeDir(getLargeMessagesDir(), 0);
} }
public void printBindings(ActiveMQServer server, String address) throws Exception public void printBindings(ActiveMQServer server, String address) throws Exception

View File

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

View File

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

View File

@ -16,12 +16,9 @@
*/ */
package org.apache.activemq.artemis.tests.util; package org.apache.activemq.artemis.tests.util;
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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; 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.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.ActiveMQServer;
import org.junit.Before; import org.junit.Before;
@ -29,9 +26,8 @@ import org.junit.Before;
* Any test based on a single server can extend this class. * Any test based on a single server can extend this class.
* This is useful for quick writing tests with starting a server, locator, factory... etc * This is useful for quick writing tests with starting a server, locator, factory... etc
*/ */
public abstract class SingleServerTestBase extends ServiceTestBase public abstract class SingleServerTestBase extends ActiveMQTestBase
{ {
protected ActiveMQServer server; protected ActiveMQServer server;
protected ClientSession session; protected ClientSession session;
@ -47,9 +43,7 @@ public abstract class SingleServerTestBase extends ServiceTestBase
{ {
super.setUp(); super.setUp();
Configuration configuration = createDefaultConfig() server = createServer(false, createDefaultInVMConfig());
.setSecurityEnabled(false);
server = createServer(false, configuration);
server.start(); server.start();
locator = createLocator(); locator = createLocator();
@ -59,9 +53,6 @@ public abstract class SingleServerTestBase extends ServiceTestBase
protected ServerLocator createLocator() protected ServerLocator createLocator()
{ {
ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); return createInVMNonHALocator();
addServerLocator(retlocator);
return retlocator;
} }
} }

View File

@ -22,6 +22,48 @@ The broker is comprised of POJOs so it's simple to configure and run a broker in
Even complex test-cases involving multiple clustered brokers are relatively easy to write. Almost every test in the 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. 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) The test-suite uses JUnit to manage test execution and life-cycle. Most tests extend [org.apache.activemq.artemis.tests.util.ActiveMQTestBase](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java)
which contains JUnit setup and tear-down methods as well as a wealth of utility functions to configure, start, manage, 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. and stop brokers as well as perform other common tasks.
Check out [`org.apache.activemq.artemis.tests.integration.SimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java).
It's a very simple test-case that extends `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` and uses its methods
to configure a server, run a test, and then `super.tearDown()` cleans it up once the test completes. The test-case
includes comments to explain everything. As the name implies, this is a simple test-case that demonstrates the most basic
functionality of the test-suite. A simple test like this takes less than a second to run on modern hardware.
Although `org.apache.activemq.artemis.tests.integration.SimpleTest` is simple it could be simpler still by extending
[`org.apache.activemq.artemis.tests.util.SingleServerTestBase`](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java).
This class does all the setup of a simple server automatically and provides the test-case with a `ServerLocator`,
`ClientSessionFactory`, and `ClientSession` instance. [`org.apache.activemq.artemis.tests.integration.SingleServerSimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java)
is an example based on `org.apache.activemq.artemis.tests.integration.SimpleTest` but extends `org.apache.activemq.artemis.tests.util.SingleServerTestBase`
which eliminates all the setup and class variables which are provided by `SingleServerTestBase` itself.
## Keys for writing good tests
### Avoid leaks
An important task for any test-case is to clean up all the resources it creates when it runs. This includes the server
instance itself and any resources created to connect to it (e.g. instances of `ServerLocator`, `ClientSessionFactory`,
`ClientSession`, etc.). This task is typically completed in the test's `tearDown()` method. However, `ActiveMQTestBase`
(and other classes which extend it) simplifies this process. As [`org.apache.activemq.artemis.tests.integration.SimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java)
demonstrates, there are several methods you can use when creating your test which will ensure proper clean up _automatically_
when the test is torn down. These include:
- All the overloaded `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.createServer(..)` methods. If you choose
_not_ to use one of these methods to create your `ActiveMQServer` instance then use the `addServer(ActiveMQServer)`
method to add the instance to the test-suite's internal resource ledger.
- Methods from `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` to create a `ServerLocator` like
`createInVMNonHALocator` and `createNettyNonHALocator`. If you choose _not_ to use one of these methods then use
`addServerLocator(ServerLocator)` to add the locator to the test-suite's internal resource ledger.
- `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.createSessionFactory(ServerLocator)` for creating your session
factory. If you choose _not_ to use this method then use `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.addSessionFactory`
to add the factory to the test-suite's internal resource ledger.
### Create configurations
There are numerous methods in `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` to create a configuration. These
methods are named like create&#42;Config(..). Each one creates a slightly different configuration but there is a lot of
overlap between them.

View File

@ -16,10 +16,6 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownException; import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownException;
import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException; import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException;
import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException; import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException;
@ -45,12 +41,15 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class BMFailoverTest extends FailoverTestBase public class BMFailoverTest extends FailoverTestBase
{ {
@ -68,13 +67,6 @@ public class BMFailoverTest extends FailoverTestBase
locator = getServerLocator(); locator = getServerLocator();
} }
@After
@Override
public void tearDown() throws Exception
{
super.tearDown();
}
private static boolean stopped = false; private static boolean stopped = false;
public static void stopAndThrow() throws ActiveMQUnBlockedException public static void stopAndThrow() throws ActiveMQUnBlockedException
{ {
@ -209,8 +201,8 @@ public class BMFailoverTest extends FailoverTestBase
public void testFailoverOnCommit2() throws Exception public void testFailoverOnCommit2() throws Exception
{ {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator()
locator.setFailoverOnInitialConnection(true); .setFailoverOnInitialConnection(true);
SimpleString inQueue = new SimpleString("inQueue"); SimpleString inQueue = new SimpleString("inQueue");
SimpleString outQueue = new SimpleString("outQueue"); SimpleString outQueue = new SimpleString("outQueue");
createSessionFactory(); createSessionFactory();
@ -312,8 +304,8 @@ public class BMFailoverTest extends FailoverTestBase
public void testFailoverOnCommit() throws Exception public void testFailoverOnCommit() throws Exception
{ {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator()
locator.setFailoverOnInitialConnection(true); .setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -353,8 +345,8 @@ public class BMFailoverTest extends FailoverTestBase
public void testFailoverOnReceiveCommit() throws Exception public void testFailoverOnReceiveCommit() throws Exception
{ {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator()
locator.setFailoverOnInitialConnection(true); .setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -433,9 +425,9 @@ public class BMFailoverTest extends FailoverTestBase
private void createSessionFactory() throws Exception private void createSessionFactory() throws Exception
{ {
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
locator.setReconnectAttempts(-1); .setReconnectAttempts(-1);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
} }

View File

@ -28,14 +28,14 @@ import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl; import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class BridgeServerLocatorConfigurationTest extends ServiceTestBase public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase
{ {
private static final long BRIDGE_TTL = 1234L; private static final long BRIDGE_TTL = 1234L;
@ -130,10 +130,10 @@ public class BridgeServerLocatorConfigurationTest extends ServiceTestBase
server1.getConfiguration().setQueueConfigurations(queueConfigs1); server1.getConfiguration().setQueueConfigurations(queueConfigs1);
server1.start(); server1.start();
waitForServer(server1); waitForServerToStart(server1);
serverWithBridge.start(); serverWithBridge.start();
waitForServer(serverWithBridge); waitForServerToStart(serverWithBridge);
long bridgeTTL = getBridgeTTL(serverWithBridge, BRIDGE_NAME); long bridgeTTL = getBridgeTTL(serverWithBridge, BRIDGE_NAME);

View File

@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper; import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@ -40,7 +40,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class ClosingConnectionTest extends ServiceTestBase public class ClosingConnectionTest extends ActiveMQTestBase
{ {
public static final SimpleString ADDRESS = new SimpleString("SimpleAddress"); public static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
@ -68,7 +68,7 @@ public class ClosingConnectionTest extends ServiceTestBase
server.getConfiguration().setJournalType(JournalType.NIO); server.getConfiguration().setJournalType(JournalType.NIO);
server.getConfiguration().setJMXManagementEnabled(true); server.getConfiguration().setJMXManagementEnabled(true);
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
locator = createFactory(isNetty()); locator = createFactory(isNetty());
readyToKill = false; readyToKill = false;
} }
@ -135,9 +135,9 @@ public class ClosingConnectionTest extends ServiceTestBase
) )
public void testKillConnection() throws Exception public void testKillConnection() throws Exception
{ {
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession("guest", null, false, true, true, false, 0); ClientSession session = sf.createSession("guest", null, false, true, true, false, 0);
@ -182,9 +182,9 @@ public class ClosingConnectionTest extends ServiceTestBase
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty())); ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()));
server.setMBeanServer(mBeanServer); server.setMBeanServer(mBeanServer);
AddressSettings defaultSetting = new AddressSettings(); AddressSettings defaultSetting = new AddressSettings()
defaultSetting.setPageSizeBytes(10 * 1024); .setPageSizeBytes(10 * 1024)
defaultSetting.setMaxSizeBytes(20 * 1024); .setMaxSizeBytes(20 * 1024);
server.getAddressSettingsRepository().addMatch("#", defaultSetting); server.getAddressSettingsRepository().addMatch("#", defaultSetting);

View File

@ -16,14 +16,11 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType; import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration; import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
import org.apache.activemq.artemis.core.server.group.impl.Response; import org.apache.activemq.artemis.core.server.group.impl.Response;
@ -32,11 +29,12 @@ import org.apache.activemq.artemis.tests.integration.cluster.distribution.Cluste
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class ClusteredGroupingTest extends ClusterTestBase public class ClusteredGroupingTest extends ClusterTestBase
{ {
@ -445,24 +443,6 @@ public class ClusteredGroupingTest extends ClusterTestBase
latch.countDown(); latch.countDown();
} }
@Override
@Before
public void setUp() throws Exception
{
super.setUp();
}
@Override
@After
public void tearDown() throws Exception
{
closeAllConsumers();
closeAllSessionFactories();
closeAllServerLocatorsFactories();
super.tearDown();
}
public boolean isNetty() public boolean isNetty()
{ {
return true; return true;

View File

@ -16,6 +16,17 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -25,18 +36,6 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/** /**
* GroupingTest * GroupingTest
*/ */
@ -55,13 +54,6 @@ public class GroupingTest extends JMSTestBase
queue = createQueue("TestQueue"); queue = createQueue("TestQueue");
} }
@After
@Override
public void tearDown() throws Exception
{
super.tearDown();
}
protected ConnectionFactory getCF() throws Exception protected ConnectionFactory getCF() throws Exception
{ {
return cf; return cf;

View File

@ -20,7 +20,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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@ -28,7 +28,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class LatencyTest extends ServiceTestBase public class LatencyTest extends ActiveMQTestBase
{ {
/* /*
* simple test to make sure connect still works with some network latency built into netty * simple test to make sure connect still works with some network latency built into netty
@ -58,7 +58,7 @@ public class LatencyTest extends ServiceTestBase
) )
public void testLatency() throws Exception public void testLatency() throws Exception
{ {
ActiveMQServer server = createServer(createDefaultConfig(true)); ActiveMQServer server = createServer(createDefaultNettyConfig());
server.start(); server.start();
ServerLocator locator = createNettyNonHALocator(); ServerLocator locator = createNettyNonHALocator();
ClientSessionFactory factory = createSessionFactory(locator); ClientSessionFactory factory = createSessionFactory(locator);

View File

@ -26,7 +26,7 @@ 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.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@ -36,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class OrphanedConsumerTest extends ServiceTestBase public class OrphanedConsumerTest extends ActiveMQTestBase
{ {
private static boolean conditionActive = true; private static boolean conditionActive = true;
@ -200,16 +200,16 @@ public class OrphanedConsumerTest extends ServiceTestBase
server.start(); server.start();
staticServer = server; staticServer = server;
locator.setBlockOnNonDurableSend(false);
locator.setBlockOnDurableSend(false);
locator.setBlockOnAcknowledge(true);
locator.setConnectionTTL(1000);
locator.setClientFailureCheckPeriod(100);
locator.setReconnectAttempts(0);
// We are not interested on consumer-window-size on this test // We are not interested on consumer-window-size on this test
// We want that every message is delivered // We want that every message is delivered
// as we asserting for number of consumers available and round-robin on delivery // as we asserting for number of consumers available and round-robin on delivery
locator.setConsumerWindowSize(-1); locator.setConsumerWindowSize(-1)
.setBlockOnNonDurableSend(false)
.setBlockOnDurableSend(false)
.setBlockOnAcknowledge(true)
.setConnectionTTL(1000)
.setClientFailureCheckPeriod(100)
.setReconnectAttempts(0);
ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)createSessionFactory(locator); ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)createSessionFactory(locator);
@ -258,13 +258,12 @@ public class OrphanedConsumerTest extends ServiceTestBase
setConditionActive(false); setConditionActive(false);
locator = internalCreateNonHALocator(true); locator = internalCreateNonHALocator(true)
.setBlockOnNonDurableSend(false)
locator.setBlockOnNonDurableSend(false); .setBlockOnDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnAcknowledge(true)
locator.setBlockOnAcknowledge(true); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setConsumerWindowSize(-1);
locator.setConsumerWindowSize(-1);
sf = (ClientSessionFactoryImpl)locator.createSessionFactory(); sf = (ClientSessionFactoryImpl)locator.createSessionFactory();
session = sf.createSession(true, true, 0); session = sf.createSession(true, true, 0);

View File

@ -16,12 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -34,7 +29,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@ -43,8 +38,12 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class PagingLeakTest extends ServiceTestBase public class PagingLeakTest extends ActiveMQTestBase
{ {
private static final AtomicInteger pagePosInstances = new AtomicInteger(0); private static final AtomicInteger pagePosInstances = new AtomicInteger(0);
@ -120,26 +119,19 @@ public class PagingLeakTest extends ServiceTestBase
final ArrayList<Exception> errors = new ArrayList<Exception>(); final ArrayList<Exception> errors = new ArrayList<Exception>();
// A backup that will be waiting to be activated // A backup that will be waiting to be activated
Configuration conf = createDefaultConfig(true) Configuration config = createDefaultNettyConfig();
.setSecurityEnabled(false)
.addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
final ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, true);
addServer(server);
final ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, true));
server.start(); server.start();
AddressSettings settings = new AddressSettings()
AddressSettings settings = new AddressSettings(); .setPageSizeBytes(20 * 1024)
settings.setPageSizeBytes(20 * 1024); .setMaxSizeBytes(200 * 1024)
settings.setMaxSizeBytes(200 * 1024); .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
settings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
server.getAddressSettingsRepository().addMatch("#", settings); server.getAddressSettingsRepository().addMatch("#", settings);
final SimpleString address = new SimpleString("pgdAddress"); final SimpleString address = new SimpleString("pgdAddress");
class Consumer extends Thread class Consumer extends Thread
@ -154,7 +146,6 @@ public class PagingLeakTest extends ServiceTestBase
Consumer(int sleepTime, String suffix, int maxConsumed) throws Exception Consumer(int sleepTime, String suffix, int maxConsumed) throws Exception
{ {
server.createQueue(address, address.concat(suffix), null, true, false); server.createQueue(address, address.concat(suffix), null, true, false);
this.sleepTime = sleepTime; this.sleepTime = sleepTime;

View File

@ -20,7 +20,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils; import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class ReplicationBackupTest extends ServiceTestBase public class ReplicationBackupTest extends ActiveMQTestBase
{ {
private static final CountDownLatch ruleFired = new CountDownLatch(1); private static final CountDownLatch ruleFired = new CountDownLatch(1);
private ActiveMQServer backupServer; private ActiveMQServer backupServer;
@ -63,15 +63,13 @@ public class ReplicationBackupTest extends ServiceTestBase
TransportConfiguration backupConnector = TransportConfigurationUtils.getNettyConnector(false, 0); TransportConfiguration backupConnector = TransportConfigurationUtils.getNettyConnector(false, 0);
TransportConfiguration backupAcceptor = TransportConfigurationUtils.getNettyAcceptor(false, 0); TransportConfiguration backupAcceptor = TransportConfigurationUtils.getNettyAcceptor(false, 0);
final String suffix = "_backup"; Configuration backupConfig = createDefaultInVMConfig()
.setBindingsDirectory(getBindingsDir(0, true))
.setJournalDirectory(getJournalDir(0, true))
.setPagingDirectory(getPageDir(0, true))
.setLargeMessagesDirectory(getLargeMessagesDir(0, true));
Configuration backupConfig = createDefaultConfig() Configuration liveConfig = createDefaultInVMConfig();
.setBindingsDirectory(getBindingsDir() + suffix)
.setJournalDirectory(getJournalDir() + suffix)
.setPagingDirectory(getPageDir() + suffix)
.setLargeMessagesDirectory(getLargeMessagesDir() + suffix);
Configuration liveConfig = createDefaultConfig();
ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor); ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor);
@ -99,7 +97,7 @@ public class ReplicationBackupTest extends ServiceTestBase
backupServer = createServer(backupConfig); backupServer = createServer(backupConfig);
backupServer.start(); backupServer.start();
ServiceTestBase.waitForRemoteBackup(null, 3, true, backupServer); ActiveMQTestBase.waitForRemoteBackup(null, 3, true, backupServer);
} }
public static void breakIt() public static void breakIt()

View File

@ -25,7 +25,6 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase; import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -84,17 +83,6 @@ public class ScaleDownFailoverTest extends ClusterTestBase
return false; return false;
} }
@Override
@After
public void tearDown() throws Exception
{
closeAllConsumers();
closeAllSessionFactories();
closeAllServerLocatorsFactories();
stopServers(0, 1, 2);
super.tearDown();
}
@Test @Test
@BMRule @BMRule

View File

@ -22,7 +22,6 @@ import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase; import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -62,18 +61,6 @@ public class ScaleDownFailureTest extends ClusterTestBase
return false; return false;
} }
@Override
@After
public void tearDown() throws Exception
{
closeAllConsumers();
closeAllSessionFactories();
closeAllServerLocatorsFactories();
((LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(null);
stopServers(0, 1);
super.tearDown();
}
@Test @Test
@BMRule @BMRule
( (

View File

@ -16,10 +16,6 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration; 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.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
@ -28,19 +24,21 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext; import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* This test validates a deadlock identified by https://bugzilla.redhat.com/show_bug.cgi?id=959616 * This test validates a deadlock identified by https://bugzilla.redhat.com/show_bug.cgi?id=959616
*/ */
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class StartStopDeadlockTest extends ServiceTestBase public class StartStopDeadlockTest extends ActiveMQTestBase
{ {
/* /*
* simple test to make sure connect still works with some network latency built into netty * simple test to make sure connect still works with some network latency built into netty
@ -80,23 +78,17 @@ public class StartStopDeadlockTest extends ServiceTestBase
{ {
// A live server that will always be crashed // A live server that will always be crashed
Configuration confLive = createDefaultConfig(true) Configuration confLive = createDefaultNettyConfig()
.setSecurityEnabled(false) .setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration());
.setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()) final ActiveMQServer serverLive = addServer(ActiveMQServers.newActiveMQServer(confLive));
.addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
final ActiveMQServer serverLive = ActiveMQServers.newActiveMQServer(confLive);
serverLive.start(); serverLive.start();
addServer(serverLive);
// A backup that will be waiting to be activated // A backup that will be waiting to be activated
Configuration conf = createDefaultConfig(true) Configuration config = createDefaultNettyConfig()
.setSecurityEnabled(false) .setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration());
.setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration())
.addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
final ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, true); final ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, true));
addServer(server);
final JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); final JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server);
final InVMNamingContext context = new InVMNamingContext(); final InVMNamingContext context = new InVMNamingContext();
@ -158,11 +150,4 @@ public class StartStopDeadlockTest extends ServiceTestBase
assertEquals(0, errors.get()); assertEquals(0, errors.get());
} }
@Override
@After
public void tearDown() throws Exception
{
super.tearDown();
}
} }

View File

@ -16,10 +16,6 @@
*/ */
package org.apache.activemq.artemis.tests.extras.byteman; package org.apache.activemq.artemis.tests.extras.byteman;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.api.core.TransportConfiguration; 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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
@ -27,22 +23,24 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType; import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory; import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.management.Notification; import org.apache.activemq.artemis.core.server.management.Notification;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
public class StompInternalStateTest extends ServiceTestBase public class StompInternalStateTest extends ActiveMQTestBase
{ {
private static final String STOMP_QUEUE_NAME = "jms.queue.StompTestQueue"; private static final String STOMP_QUEUE_NAME = "jms.queue.StompTestQueue";
@ -92,17 +90,15 @@ public class StompInternalStateTest extends ServiceTestBase
@Override @Override
protected Configuration createDefaultConfig(final boolean netty) throws Exception protected Configuration createDefaultConfig(final boolean netty) throws Exception
{ {
Configuration config = super.createDefaultConfig(netty) Map<String, Object> params = new HashMap<>();
.setSecurityEnabled(false)
.setPersistenceEnabled(false);
Map<String, Object> params = new HashMap<String, Object>();
params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME);
params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT);
params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1"); params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1");
TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params);
config.getAcceptorConfigurations().add(stompTransport);
config.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); Configuration config = super.createDefaultConfig(netty)
.setPersistenceEnabled(false)
.addAcceptorConfiguration(stompTransport);
return config; return config;
} }
@ -132,15 +128,7 @@ public class StompInternalStateTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
server = createServer(createDefaultConfig(true)); server = createServer(createDefaultNettyConfig());
server.start(); server.start();
} }
@Override
@After
public void tearDown() throws Exception
{
server.stop();
super.tearDown();
}
} }

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

View File

@ -53,7 +53,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.server.JMSServerManager; import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.unit.util.InVMContext; import org.apache.activemq.artemis.tests.unit.util.InVMContext;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -62,7 +62,7 @@ import org.junit.Before;
* This class serves as a base class for jms bridge tests in * This class serves as a base class for jms bridge tests in
* clustered scenarios. * clustered scenarios.
*/ */
public abstract class ClusteredBridgeTestBase extends ServiceTestBase public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase
{ {
private static int index = 0; private static int index = 0;
@ -170,7 +170,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
liveNode.setRegistry(new JndiBindingRegistry(liveContext)); liveNode.setRegistry(new JndiBindingRegistry(liveContext));
//backup //backup
Configuration conf = createBasicConfig() Configuration config = createBasicConfig()
.setJournalDirectory(getJournalDir(id, true)) .setJournalDirectory(getJournalDir(id, true))
.setBindingsDirectory(getBindingsDir(id, true)) .setBindingsDirectory(getBindingsDir(id, true))
.addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params)) .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params))
@ -179,7 +179,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
.setHAPolicyConfiguration(new ReplicaPolicyConfiguration()) .setHAPolicyConfiguration(new ReplicaPolicyConfiguration())
.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName())); .addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
ActiveMQServer backup = addServer(ActiveMQServers.newActiveMQServer(conf, true)); ActiveMQServer backup = addServer(ActiveMQServers.newActiveMQServer(config, true));
Context context = new InVMContext(); Context context = new InVMContext();
@ -190,12 +190,12 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
public void start() throws Exception public void start() throws Exception
{ {
liveNode.start(); liveNode.start();
waitForServer(liveNode.getActiveMQServer()); waitForServerToStart(liveNode.getActiveMQServer());
backupNode.start(); backupNode.start();
waitForRemoteBackupSynchronization(backupNode.getActiveMQServer()); waitForRemoteBackupSynchronization(backupNode.getActiveMQServer());
locator = ActiveMQClient.createServerLocatorWithHA(liveConnector); locator = ActiveMQClient.createServerLocatorWithHA(liveConnector)
locator.setReconnectAttempts(-1); .setReconnectAttempts(-1);
sessionFactory = locator.createSessionFactory(); sessionFactory = locator.createSessionFactory();
} }

View File

@ -27,11 +27,8 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.hornetq.api.core.client.HornetQClient; import org.hornetq.api.core.client.HornetQClient;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -41,7 +38,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class HornetQProtocolTest extends ServiceTestBase public class HornetQProtocolTest extends ActiveMQTestBase
{ {
protected ActiveMQServer server; protected ActiveMQServer server;
@ -49,42 +46,18 @@ public class HornetQProtocolTest extends ServiceTestBase
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{
startBroker();
}
@After
public void tearDown() throws Exception
{
stopBroker();
}
public void startBroker() throws Exception
{
super.setUp();
server = createServer(true, true);
addHornetQConnector();
server.start();
waitForServer(server);
}
public void stopBroker() throws Exception
{
if (server.isStarted())
{
server.stop();
server = null;
}
}
protected void addHornetQConnector() throws Exception
{ {
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, "" + 5445); params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, "" + 5445);
params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PROTOCOLS_PROP_NAME, "HORNETQ"); params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PROTOCOLS_PROP_NAME, "HORNETQ");
TransportConfiguration transportConfig = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); TransportConfiguration transportConfig = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params);
super.setUp();
server = createServer(true, true);
server.getConfiguration().getAcceptorConfigurations().add(transportConfig); server.getConfiguration().getAcceptorConfigurations().add(transportConfig);
LOG.info("Added connector {} to broker", "HornetQ"); LOG.info("Added connector {} to broker", "HornetQ");
server.start();
waitForServerToStart(server);
} }
@Test @Test

View File

@ -42,12 +42,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class InterceptorTest extends ServiceTestBase public class InterceptorTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;

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

View File

@ -18,8 +18,6 @@ package org.apache.activemq.artemis.tests.integration.aerogear;
import org.apache.activemq.artemis.api.core.Message; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -33,7 +31,7 @@ import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory; import org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConstants; import org.apache.activemq.artemis.integration.aerogear.AeroGearConstants;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.json.JSONArray; import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONException; import org.apache.activemq.artemis.utils.json.JSONException;
import org.apache.activemq.artemis.utils.json.JSONObject; import org.apache.activemq.artemis.utils.json.JSONObject;
@ -53,7 +51,7 @@ import java.util.HashMap;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class AeroGearBasicServerTest extends ServiceTestBase public class AeroGearBasicServerTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -88,7 +86,8 @@ public class AeroGearBasicServerTest extends ServiceTestBase
params.put(AeroGearConstants.DEVICE_TYPE_NAME, "android,ipad"); params.put(AeroGearConstants.DEVICE_TYPE_NAME, "android,ipad");
params.put(AeroGearConstants.SOUND_NAME, "sound1"); params.put(AeroGearConstants.SOUND_NAME, "sound1");
params.put(AeroGearConstants.VARIANTS_NAME, "variant1,variant2"); params.put(AeroGearConstants.VARIANTS_NAME, "variant1,variant2");
Configuration configuration = createDefaultConfig()
Configuration configuration = createDefaultInVMConfig()
.addConnectorServiceConfiguration( .addConnectorServiceConfiguration(
new ConnectorServiceConfiguration() new ConnectorServiceConfiguration()
.setFactoryClassName(AeroGearConnectorServiceFactory.class.getName()) .setFactoryClassName(AeroGearConnectorServiceFactory.class.getName())
@ -97,7 +96,8 @@ public class AeroGearBasicServerTest extends ServiceTestBase
.addQueueConfiguration(new CoreQueueConfiguration() .addQueueConfiguration(new CoreQueueConfiguration()
.setAddress("testQueue") .setAddress("testQueue")
.setName("testQueue")); .setName("testQueue"));
server = createServer(configuration);
server = addServer(createServer(configuration));
server.start(); server.start();
} }
@ -110,14 +110,6 @@ public class AeroGearBasicServerTest extends ServiceTestBase
{ {
jetty.stop(); jetty.stop();
} }
if (locator != null)
{
locator.close();
}
if (server != null)
{
server.stop();
}
super.tearDown(); super.tearDown();
} }
@ -127,8 +119,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
AeroGearHandler aeroGearHandler = new AeroGearHandler(latch); AeroGearHandler aeroGearHandler = new AeroGearHandler(latch);
jetty.addHandler(aeroGearHandler); jetty.addHandler(aeroGearHandler);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY); locator = createInVMNonHALocator();
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
ClientProducer producer = session.createProducer("testQueue"); ClientProducer producer = session.createProducer("testQueue");
@ -276,8 +267,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
} }
}); });
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY); locator = createInVMNonHALocator();
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
ClientProducer producer = session.createProducer("testQueue"); ClientProducer producer = session.createProducer("testQueue");
@ -330,8 +320,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
} }
}); });
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY); locator = createInVMNonHALocator();
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
ClientProducer producer = session.createProducer("testQueue"); ClientProducer producer = session.createProducer("testQueue");
@ -368,8 +357,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
} }
}); });
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY); locator = createInVMNonHALocator();
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
ClientProducer producer = session.createProducer("testQueue"); ClientProducer producer = session.createProducer("testQueue");

View File

@ -23,13 +23,13 @@ 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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class AckBatchSizeTest extends ServiceTestBase public class AckBatchSizeTest extends ActiveMQTestBase
{ {
public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressA = new SimpleString("addressA");
@ -64,10 +64,10 @@ public class AckBatchSizeTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator();
int numMessages = 100; int numMessages = 100;
locator.setAckBatchSize(numMessages * getMessageEncodeSize(addressA)); ServerLocator locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setAckBatchSize(numMessages * getMessageEncodeSize(addressA))
.setBlockOnAcknowledge(true);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
@ -106,9 +106,9 @@ public class AckBatchSizeTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setAckBatchSize(0); .setAckBatchSize(0)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
int numMessages = 100; int numMessages = 100;

View File

@ -34,7 +34,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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal; import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQConsumerContext; import org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQConsumerContext;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
@ -44,7 +44,7 @@ import org.apache.activemq.artemis.utils.UUID;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class AcknowledgeTest extends ServiceTestBase public class AcknowledgeTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -61,9 +61,9 @@ public class AcknowledgeTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setAckBatchSize(0); .setAckBatchSize(0)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, true, true);
@ -136,9 +136,9 @@ public class AcknowledgeTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setAckBatchSize(0); .setAckBatchSize(0);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, true);
@ -193,11 +193,9 @@ public class AcknowledgeTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setAckBatchSize(0)
locator.setAckBatchSize(0); .setBlockOnAcknowledge(true);
locator.setBlockOnAcknowledge(true);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
@ -277,9 +275,9 @@ public class AcknowledgeTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setAckBatchSize(0); .setAckBatchSize(0);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, true);

View File

@ -19,7 +19,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Interceptor;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSession;
@ -29,12 +28,11 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.Packet;
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -44,7 +42,7 @@ import org.junit.Test;
* From https://jira.jboss.org/jira/browse/HORNETQ-144 * From https://jira.jboss.org/jira/browse/HORNETQ-144
* *
*/ */
public class ActiveMQCrashTest extends ServiceTestBase public class ActiveMQCrashTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -56,10 +54,8 @@ public class ActiveMQCrashTest extends ServiceTestBase
@Test @Test
public void testHang() throws Exception public void testHang() throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setPersistenceEnabled(false) .setPersistenceEnabled(false);
.setSecurityEnabled(false)
.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
server = addServer(ActiveMQServers.newActiveMQServer(configuration)); server = addServer(ActiveMQServers.newActiveMQServer(configuration));
@ -67,9 +63,6 @@ public class ActiveMQCrashTest extends ServiceTestBase
server.getRemotingService().addIncomingInterceptor(new AckInterceptor(server)); server.getRemotingService().addIncomingInterceptor(new AckInterceptor(server));
// Force an ack at once - this means the send call will block // Force an ack at once - this means the send call will block
locator.setConfirmationWindowSize(1); locator.setConfirmationWindowSize(1);

View File

@ -26,11 +26,11 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class AddressSettingsTest extends ServiceTestBase public class AddressSettingsTest extends ActiveMQTestBase
{ {
private final SimpleString addressA = new SimpleString("addressA"); private final SimpleString addressA = new SimpleString("addressA");
@ -66,12 +66,12 @@ public class AddressSettingsTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setDeadLetterAddress(dlaA); .setDeadLetterAddress(dlaA)
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings2 = new AddressSettings(); AddressSettings addressSettings2 = new AddressSettings()
addressSettings2.setDeadLetterAddress(dlaB); .setDeadLetterAddress(dlaB)
addressSettings2.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings); repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch(addressB.toString(), addressSettings2); repos.addMatch(addressB.toString(), addressSettings2);
@ -123,12 +123,12 @@ public class AddressSettingsTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setDeadLetterAddress(dlaA); .setDeadLetterAddress(dlaA)
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings2 = new AddressSettings(); AddressSettings addressSettings2 = new AddressSettings()
addressSettings2.setDeadLetterAddress(dlaB); .setDeadLetterAddress(dlaB)
addressSettings2.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings); repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch("#", addressSettings2); repos.addMatch("#", addressSettings2);
@ -179,12 +179,12 @@ public class AddressSettingsTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setDeadLetterAddress(dlaA); .setDeadLetterAddress(dlaA)
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings2 = new AddressSettings(); AddressSettings addressSettings2 = new AddressSettings()
addressSettings2.setDeadLetterAddress(dlaB); .setDeadLetterAddress(dlaB)
addressSettings2.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings); repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch("*", addressSettings2); repos.addMatch("*", addressSettings2);
@ -235,15 +235,15 @@ public class AddressSettingsTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setDeadLetterAddress(dlaA); .setDeadLetterAddress(dlaA)
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings2 = new AddressSettings(); AddressSettings addressSettings2 = new AddressSettings()
addressSettings2.setDeadLetterAddress(dlaB); .setDeadLetterAddress(dlaB)
addressSettings2.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings3 = new AddressSettings(); AddressSettings addressSettings3 = new AddressSettings()
addressSettings3.setDeadLetterAddress(dlaC); .setDeadLetterAddress(dlaC)
addressSettings3.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(addressA2.toString(), addressSettings); repos.addMatch(addressA2.toString(), addressSettings);
repos.addMatch("add.*", addressSettings2); repos.addMatch("add.*", addressSettings2);
@ -311,13 +311,13 @@ public class AddressSettingsTest extends ServiceTestBase
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings2 = new AddressSettings(); AddressSettings addressSettings2 = new AddressSettings()
addressSettings2.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
AddressSettings addressSettings3 = new AddressSettings(); AddressSettings addressSettings3 = new AddressSettings()
addressSettings3.setDeadLetterAddress(dlaC); .setDeadLetterAddress(dlaC)
addressSettings3.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(addressA2.toString(), addressSettings); repos.addMatch(addressA2.toString(), addressSettings);
repos.addMatch("add.*", addressSettings2); repos.addMatch("add.*", addressSettings2);

View File

@ -31,7 +31,7 @@ public class AutoCloseCoreTest extends SingleServerTestBase
ServerLocator locatorx; ServerLocator locatorx;
ClientSession sessionx; ClientSession sessionx;
ClientSessionFactory factoryx; ClientSessionFactory factoryx;
try (ServerLocator locator = createLocator(); try (ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory factory = locator.createSessionFactory(); ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = factory.createSession(false, false)) ClientSession session = factory.createSession(false, false))
{ {

View File

@ -29,11 +29,12 @@ import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class AutogroupIdTest extends ServiceTestBase public class AutogroupIdTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -47,8 +48,27 @@ public class AutogroupIdTest extends ServiceTestBase
private final SimpleString groupTestQ = new SimpleString("testGroupQueue"); private final SimpleString groupTestQ = new SimpleString("testGroupQueue");
private ActiveMQServer server;
private ServerLocator locator;
/* auto group id tests*/ /* auto group id tests*/
@Override
@Before
public void setUp() throws Exception
{
super.setUp();
server = createServer(false);
server.start();
waitForServerToStart(server);
locator = createInVMNonHALocator();
}
/* /*
* tests when the autogroupid is set only 1 consumer (out of 2) gets all the messages from a single producer * tests when the autogroupid is set only 1 consumer (out of 2) gets all the messages from a single producer
* */ * */
@ -56,11 +76,6 @@ public class AutogroupIdTest extends ServiceTestBase
@Test @Test
public void testGroupIdAutomaticallySet() throws Exception public void testGroupIdAutomaticallySet() throws Exception
{ {
ActiveMQServer server = createServer(false);
server.start();
ServerLocator locator = createInVMNonHALocator();
locator.setAutoGroup(true); locator.setAutoGroup(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
@ -106,12 +121,6 @@ public class AutogroupIdTest extends ServiceTestBase
@Test @Test
public void testGroupIdAutomaticallySetMultipleProducers() throws Exception public void testGroupIdAutomaticallySetMultipleProducers() throws Exception
{ {
ActiveMQServer server = createServer(false);
server.start();
ServerLocator locator = createInVMNonHALocator();
locator.setAutoGroup(true); locator.setAutoGroup(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);
@ -161,12 +170,6 @@ public class AutogroupIdTest extends ServiceTestBase
@Test @Test
public void testGroupIdAutomaticallyNotSet() throws Exception public void testGroupIdAutomaticallyNotSet() throws Exception
{ {
ActiveMQServer server = createServer(false);
server.start();
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true); ClientSession session = sf.createSession(false, true, true);

View File

@ -23,11 +23,11 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class BlockingSendTest extends ServiceTestBase public class BlockingSendTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -55,8 +55,8 @@ public class BlockingSendTest extends ServiceTestBase
server.start(); server.start();
System.out.println("sync = " + server.getConfiguration().isJournalSyncNonTransactional()); System.out.println("sync = " + server.getConfiguration().isJournalSyncNonTransactional());
locator = createFactory(false); locator = createInVMNonHALocator()
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
factory = createSessionFactory(locator); factory = createSessionFactory(locator);
session = factory.createSession(); session = factory.createSession();

View File

@ -28,13 +28,13 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class CommitRollbackTest extends ServiceTestBase public class CommitRollbackTest extends ActiveMQTestBase
{ {
public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressA = new SimpleString("addressA");
@ -169,9 +169,9 @@ public class CommitRollbackTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setAckBatchSize(0); .setAckBatchSize(0);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, false); final ClientSession session = cf.createSession(false, true, false);
@ -224,9 +224,9 @@ public class CommitRollbackTest extends ServiceTestBase
{ {
ActiveMQServer server = createServer(false); ActiveMQServer server = createServer(false);
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setAckBatchSize(0); .setAckBatchSize(0);
ClientSessionFactory cf = createSessionFactory(locator); ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true); ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, false); final ClientSession session = cf.createSession(false, true, false);

View File

@ -26,7 +26,7 @@ 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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
@ -40,7 +40,7 @@ import org.junit.Test;
* the NPE happened during depaging what let the server to recover itself on the next depage. * the NPE happened during depaging what let the server to recover itself on the next depage.
* To verify a fix on this test against the previous version of QueueImpl look for NPEs on System.err * To verify a fix on this test against the previous version of QueueImpl look for NPEs on System.err
*/ */
public class ConcurrentCreateDeleteProduceTest extends ServiceTestBase public class ConcurrentCreateDeleteProduceTest extends ActiveMQTestBase
{ {
volatile boolean running = true; volatile boolean running = true;
@ -62,19 +62,18 @@ public class ConcurrentCreateDeleteProduceTest extends ServiceTestBase
{ {
super.setUp(); super.setUp();
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false) .setJournalSyncNonTransactional(false)
.setJournalSyncTransactional(false); .setJournalSyncTransactional(false);
server = server = createServer(true, config,
createServer(true, config, PAGE_SIZE,
PAGE_SIZE, PAGE_MAX,
PAGE_MAX, new HashMap<String, AddressSettings>());
new HashMap<String, AddressSettings>());
server.start(); server.start();
locator = createNonHALocator(false); locator = createNonHALocator(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
} }
@Test @Test

View File

@ -19,7 +19,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -29,12 +28,11 @@ import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl; import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
import org.apache.activemq.artemis.core.config.Configuration; 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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -42,7 +40,7 @@ import org.junit.Test;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class ConsumerCloseTest extends ServiceTestBase public class ConsumerCloseTest extends ActiveMQTestBase
{ {
private ClientSessionFactory sf; private ClientSessionFactory sf;
@ -165,8 +163,7 @@ public class ConsumerCloseTest extends ServiceTestBase
{ {
AddressSettings settings = new AddressSettings(); AddressSettings settings = new AddressSettings().setRedeliveryDelay(50000);
settings.setRedeliveryDelay(50000);
server.getAddressSettingsRepository().addMatch("#", settings); server.getAddressSettingsRepository().addMatch("#", settings);
ClientConsumer consumer = session.createConsumer(queue); ClientConsumer consumer = session.createConsumer(queue);
@ -223,8 +220,7 @@ public class ConsumerCloseTest extends ServiceTestBase
{ {
AddressSettings settings = new AddressSettings(); AddressSettings settings = new AddressSettings().setRedeliveryDelay(1000);
settings.setRedeliveryDelay(1000);
server.getAddressSettingsRepository().addMatch("#", settings); server.getAddressSettingsRepository().addMatch("#", settings);
ClientProducer producer = session.createProducer(address); ClientProducer producer = session.createProducer(address);
@ -302,9 +298,7 @@ public class ConsumerCloseTest extends ServiceTestBase
{ {
super.setUp(); super.setUp();
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig();
.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()))
.setSecurityEnabled(false);
server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server = addServer(ActiveMQServers.newActiveMQServer(config, false));
server.start(); server.start();

View File

@ -25,11 +25,11 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.QueueImpl; import org.apache.activemq.artemis.core.server.impl.QueueImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ConsumerFilterTest extends ServiceTestBase public class ConsumerFilterTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -29,9 +29,9 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
public class ConsumerRoundRobinTest extends ServiceTestBase public class ConsumerRoundRobinTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -27,11 +27,11 @@ 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.protocol.core.impl.RemotingConnectionImpl;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ConsumerStuckTest extends ServiceTestBase public class ConsumerStuckTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -57,10 +57,10 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTest() throws Exception public void testClientStuckTest() throws Exception
{ {
ServerLocator locator = createNettyNonHALocator(); ServerLocator locator = createNettyNonHALocator()
locator.setConnectionTTL(1000); .setConnectionTTL(1000)
locator.setClientFailureCheckPeriod(100); .setClientFailureCheckPeriod(100)
locator.setConsumerWindowSize(10 * 1024 * 1024); .setConsumerWindowSize(10 * 1024 * 1024);
ClientSessionFactory sf = locator.createSessionFactory(); ClientSessionFactory sf = locator.createSessionFactory();
((ClientSessionFactoryImpl) sf).stopPingingAfterOne(); ((ClientSessionFactoryImpl) sf).stopPingingAfterOne();
@ -168,10 +168,10 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTestWithDirectDelivery() throws Exception public void testClientStuckTestWithDirectDelivery() throws Exception
{ {
ServerLocator locator = createNettyNonHALocator(); ServerLocator locator = createNettyNonHALocator()
locator.setConnectionTTL(1000); .setConnectionTTL(1000)
locator.setClientFailureCheckPeriod(100); .setClientFailureCheckPeriod(100)
locator.setConsumerWindowSize(10 * 1024 * 1024); .setConsumerWindowSize(10 * 1024 * 1024);
ClientSessionFactory sf = locator.createSessionFactory(); ClientSessionFactory sf = locator.createSessionFactory();
((ClientSessionFactoryImpl) sf).stopPingingAfterOne(); ((ClientSessionFactoryImpl) sf).stopPingingAfterOne();

View File

@ -39,7 +39,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
@ -48,7 +48,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
@RunWith(value = Parameterized.class) @RunWith(value = Parameterized.class)
public class ConsumerTest extends ServiceTestBase public class ConsumerTest extends ActiveMQTestBase
{ {
@Parameterized.Parameters(name = "isNetty={0}") @Parameterized.Parameters(name = "isNetty={0}")
public static Collection getParameters() public static Collection getParameters()
@ -95,8 +95,8 @@ public class ConsumerTest extends ServiceTestBase
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
ServerLocator locatorSendx = createFactory(isNetty()); ServerLocator locatorSendx = createFactory(isNetty())
locatorSendx.setReconnectAttempts(-1); .setReconnectAttempts(-1);
ClientSessionFactory factoryx = locatorSendx.createSessionFactory(); ClientSessionFactory factoryx = locatorSendx.createSessionFactory();
factoryx.close(); factoryx.close();
locatorSendx.close(); locatorSendx.close();
@ -287,9 +287,9 @@ public class ConsumerTest extends ServiceTestBase
return true; return true;
} }
}); });
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setConfirmationWindowSize(100); .setConfirmationWindowSize(100)
locator.setAckBatchSize(-1); .setAckBatchSize(-1);
ClientSessionFactory sfReceive = createSessionFactory(locator); ClientSessionFactory sfReceive = createSessionFactory(locator);
ClientSession sessionRec = sfReceive.createSession(false, true, true); ClientSession sessionRec = sfReceive.createSession(false, true, true);
ClientConsumer consumer = sessionRec.createConsumer(QUEUE); ClientConsumer consumer = sessionRec.createConsumer(QUEUE);
@ -456,8 +456,8 @@ public class ConsumerTest extends ServiceTestBase
{ {
try try
{ {
ServerLocator locatorSendx = createFactory(isNetty()); ServerLocator locatorSendx = createFactory(isNetty())
locatorSendx.setReconnectAttempts(-1); .setReconnectAttempts(-1);
ClientSessionFactory factoryx = locatorSendx.createSessionFactory(); ClientSessionFactory factoryx = locatorSendx.createSessionFactory();
ClientSession sessionSend = factoryx.createSession(true, true); ClientSession sessionSend = factoryx.createSession(true, true);
@ -624,9 +624,8 @@ public class ConsumerTest extends ServiceTestBase
@Test @Test
public void testConsumerCreditsOnRollbackLargeMessages() throws Exception public void testConsumerCreditsOnRollbackLargeMessages() throws Exception
{ {
locator.setConsumerWindowSize(10000)
locator.setConsumerWindowSize(10000); .setMinLargeMessageSize(1000);
locator.setMinLargeMessageSize(1000);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -33,7 +33,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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal; import org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal;
import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.Binding;
import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.postoffice.Bindings;
@ -46,7 +46,7 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ConsumerWindowSizeTest extends ServiceTestBase public class ConsumerWindowSizeTest extends ActiveMQTestBase
{ {
private final SimpleString addressA = new SimpleString("addressA"); private final SimpleString addressA = new SimpleString("addressA");
@ -923,9 +923,8 @@ public class ConsumerWindowSizeTest extends ServiceTestBase
server.start(); server.start();
locator.setConsumerWindowSize(0); locator.setConsumerWindowSize(0)
.setMinLargeMessageSize(100);
locator.setMinLargeMessageSize(100);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -1027,8 +1026,7 @@ public class ConsumerWindowSizeTest extends ServiceTestBase
ActiveMQServer server = createServer(false, isNetty()); ActiveMQServer server = createServer(false, isNetty());
AddressSettings settings = new AddressSettings(); AddressSettings settings = new AddressSettings().setMaxDeliveryAttempts(-1);
settings.setMaxDeliveryAttempts(-1);
server.getAddressSettingsRepository().addMatch("#", settings); server.getAddressSettingsRepository().addMatch("#", settings);
ClientSession session = null; ClientSession session = null;

View File

@ -17,27 +17,22 @@
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession; 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.ClientSessionFactory;
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.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Test;
public class CoreClientTest extends ServiceTestBase public class CoreClientTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -54,29 +49,23 @@ public class CoreClientTest extends ServiceTestBase
@Test @Test
public void testCoreClientNetty() throws Exception public void testCoreClientNetty() throws Exception
{ {
testCoreClient(NETTY_ACCEPTOR_FACTORY, NETTY_CONNECTOR_FACTORY); testCoreClient(true);
} }
@Test @Test
public void testCoreClientInVM() throws Exception public void testCoreClientInVM() throws Exception
{ {
testCoreClient(INVM_ACCEPTOR_FACTORY, INVM_CONNECTOR_FACTORY); testCoreClient(false);
} }
private void testCoreClient(final String acceptorFactoryClassName, final String connectorFactoryClassName) throws Exception private void testCoreClient(final boolean netty) throws Exception
{ {
final SimpleString QUEUE = new SimpleString("CoreClientTestQueue"); final SimpleString QUEUE = new SimpleString("CoreClientTestQueue");
Configuration conf = createDefaultConfig() ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultConfig(netty), false));
.setSecurityEnabled(false)
.addAcceptorConfiguration(new TransportConfiguration(acceptorFactoryClassName));
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(conf, false));
server.start(); server.start();
ServerLocator locator = ServerLocator locator = createNonHALocator(netty);
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
connectorFactoryClassName)));
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -16,24 +16,22 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class CreateQueueIdempotentTest extends ServiceTestBase import java.util.concurrent.atomic.AtomicInteger;
public class CreateQueueIdempotentTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -43,12 +41,7 @@ public class CreateQueueIdempotentTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), true));
Configuration conf = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
server = addServer(ActiveMQServers.newActiveMQServer(conf, true));
server.start(); server.start();
} }

View File

@ -19,8 +19,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -28,14 +26,13 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; 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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -45,7 +42,7 @@ import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class DeadLetterAddressTest extends ServiceTestBase public class DeadLetterAddressTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -60,9 +57,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString adName = new SimpleString("ad1"); SimpleString adName = new SimpleString("ad1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false); clientSession.createQueue(dla, dlq, null, false);
@ -94,9 +91,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
{ {
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
//SimpleString dlq = new SimpleString("DLQ1"); //SimpleString dlq = new SimpleString("DLQ1");
//clientSession.createQueue(dla, dlq, null, false); //clientSession.createQueue(dla, dlq, null, false);
@ -123,9 +120,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
{ {
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(2); .setMaxDeliveryAttempts(2)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false); clientSession.createQueue(dla, dlq, null, false);
@ -161,9 +158,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
{ {
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(2); .setMaxDeliveryAttempts(2)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false); clientSession.createQueue(dla, dlq, null, false);
@ -217,9 +214,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
{ {
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(1); .setMaxDeliveryAttempts(1)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
SimpleString dlq2 = new SimpleString("DLQ2"); SimpleString dlq2 = new SimpleString("DLQ2");
@ -257,8 +254,7 @@ public class DeadLetterAddressTest extends ServiceTestBase
public void testBasicSendToNoQueue() throws Exception public void testBasicSendToNoQueue() throws Exception
{ {
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1);
addressSettings.setMaxDeliveryAttempts(1);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);
ClientProducer producer = clientSession.createProducer(qName); ClientProducer producer = clientSession.createProducer(qName);
@ -283,9 +279,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
final int NUM_MESSAGES = 5; final int NUM_MESSAGES = 5;
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(MAX_DELIVERIES); .setMaxDeliveryAttempts(MAX_DELIVERIES)
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false); clientSession.createQueue(dla, dlq, null, false);
@ -371,9 +367,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
SimpleString queue = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString();
SimpleString deadLetterAddress = RandomUtil.randomSimpleString(); SimpleString deadLetterAddress = RandomUtil.randomSimpleString();
SimpleString deadLetterQueue = RandomUtil.randomSimpleString(); SimpleString deadLetterQueue = RandomUtil.randomSimpleString();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(deliveryAttempt); .setMaxDeliveryAttempts(deliveryAttempt)
addressSettings.setDeadLetterAddress(deadLetterAddress); .setDeadLetterAddress(deadLetterAddress);
server.getAddressSettingsRepository().setDefault(addressSettings); server.getAddressSettingsRepository().setDefault(addressSettings);
clientSession.createQueue(address, queue, false); clientSession.createQueue(address, queue, false);
@ -414,9 +410,9 @@ public class DeadLetterAddressTest extends ServiceTestBase
SimpleString queue = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString();
SimpleString deadLetterAddress = RandomUtil.randomSimpleString(); SimpleString deadLetterAddress = RandomUtil.randomSimpleString();
SimpleString deadLetterQueue = RandomUtil.randomSimpleString(); SimpleString deadLetterQueue = RandomUtil.randomSimpleString();
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxDeliveryAttempts(deliveryAttempt); .setMaxDeliveryAttempts(deliveryAttempt)
addressSettings.setDeadLetterAddress(deadLetterAddress); .setDeadLetterAddress(deadLetterAddress);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
clientSession.createQueue(address, queue, false); clientSession.createQueue(address, queue, false);
@ -459,13 +455,13 @@ public class DeadLetterAddressTest extends ServiceTestBase
SimpleString specificDeadLetterAddress = RandomUtil.randomSimpleString(); SimpleString specificDeadLetterAddress = RandomUtil.randomSimpleString();
SimpleString specificDeadLetterQueue = RandomUtil.randomSimpleString(); SimpleString specificDeadLetterQueue = RandomUtil.randomSimpleString();
AddressSettings defaultAddressSettings = new AddressSettings(); AddressSettings defaultAddressSettings = new AddressSettings()
defaultAddressSettings.setMaxDeliveryAttempts(defaultDeliveryAttempt); .setMaxDeliveryAttempts(defaultDeliveryAttempt)
defaultAddressSettings.setDeadLetterAddress(defaultDeadLetterAddress); .setDeadLetterAddress(defaultDeadLetterAddress);
server.getAddressSettingsRepository().addMatch("*", defaultAddressSettings); server.getAddressSettingsRepository().addMatch("*", defaultAddressSettings);
AddressSettings specificAddressSettings = new AddressSettings(); AddressSettings specificAddressSettings = new AddressSettings()
specificAddressSettings.setMaxDeliveryAttempts(specificeDeliveryAttempt); .setMaxDeliveryAttempts(specificeDeliveryAttempt)
specificAddressSettings.setDeadLetterAddress(specificDeadLetterAddress); .setDeadLetterAddress(specificDeadLetterAddress);
server.getAddressSettingsRepository().addMatch(address.toString(), specificAddressSettings); server.getAddressSettingsRepository().addMatch(address.toString(), specificAddressSettings);
clientSession.createQueue(address, queue, false); clientSession.createQueue(address, queue, false);
@ -509,18 +505,10 @@ public class DeadLetterAddressTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY); server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), false));
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(transportConfig);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start(); server.start();
// then we create a client as normal // then we create a client as normal
locator = locator = createInVMNonHALocator();
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = addClientSession(sessionFactory.createSession(false, true, false)); clientSession = addClientSession(sessionFactory.createSession(false, true, false));
} }

View File

@ -29,13 +29,13 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class DeliveryOrderTest extends ServiceTestBase public class DeliveryOrderTest extends ActiveMQTestBase
{ {
public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressA = new SimpleString("addressA");

View File

@ -31,9 +31,9 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
public class DurableQueueTest extends ServiceTestBase public class DurableQueueTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------

View File

@ -27,11 +27,11 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ExpireTestOnRestartTest extends ServiceTestBase public class ExpireTestOnRestartTest extends ActiveMQTestBase
{ {
ActiveMQServer server; ActiveMQServer server;
@ -43,11 +43,11 @@ public class ExpireTestOnRestartTest extends ServiceTestBase
{ {
super.setUp(); super.setUp();
server = createServer(true); server = createServer(true);
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings()
setting.setExpiryAddress(SimpleString.toSimpleString("exp")); .setExpiryAddress(SimpleString.toSimpleString("exp"))
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
setting.setPageSizeBytes(100 * 1024); .setPageSizeBytes(100 * 1024)
setting.setMaxSizeBytes(200 * 1024); .setMaxSizeBytes(200 * 1024);
server.getConfiguration().setJournalSyncNonTransactional(false); server.getConfiguration().setJournalSyncNonTransactional(false);
server.getConfiguration().setMessageExpiryScanPeriod(-1); server.getConfiguration().setMessageExpiryScanPeriod(-1);
server.getConfiguration().setJournalSyncTransactional(false); server.getConfiguration().setJournalSyncTransactional(false);

View File

@ -18,27 +18,24 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession; 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; 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.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ExpiryAddressTest extends ServiceTestBase public class ExpiryAddressTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -54,8 +51,7 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString adSend = new SimpleString("a1"); SimpleString adSend = new SimpleString("a1");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString eq = new SimpleString("EA1"); SimpleString eq = new SimpleString("EA1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea);
addressSettings.setExpiryAddress(ea);
server.getAddressSettingsRepository().addMatch("#", addressSettings); server.getAddressSettingsRepository().addMatch("#", addressSettings);
clientSession.createQueue(ea, eq, null, false); clientSession.createQueue(ea, eq, null, false);
clientSession.createQueue(adSend, qName, null, false); clientSession.createQueue(adSend, qName, null, false);
@ -89,8 +85,7 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString expiryAddress1 = new SimpleString("expiryAddress1"); SimpleString expiryAddress1 = new SimpleString("expiryAddress1");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString expiryQueue1 = new SimpleString("expiryQueue1"); SimpleString expiryQueue1 = new SimpleString("expiryQueue1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress1);
addressSettings.setExpiryAddress(expiryAddress1);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
clientSession.createQueue(expiryAddress1, expiryQueue1, null, false); clientSession.createQueue(expiryAddress1, expiryQueue1, null, false);
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);
@ -98,8 +93,7 @@ public class ExpiryAddressTest extends ServiceTestBase
// override "original" address settings // override "original" address settings
SimpleString expiryAddress2 = new SimpleString("expiryAddress2"); SimpleString expiryAddress2 = new SimpleString("expiryAddress2");
SimpleString expiryQueue2 = new SimpleString("expiryQueue2"); SimpleString expiryQueue2 = new SimpleString("expiryQueue2");
addressSettings = new AddressSettings(); addressSettings = new AddressSettings().setExpiryAddress(expiryAddress2);
addressSettings.setExpiryAddress(expiryAddress2);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
clientSession.createQueue(expiryAddress2, expiryQueue2, null, false); clientSession.createQueue(expiryAddress2, expiryQueue2, null, false);
@ -142,8 +136,7 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString eq = new SimpleString("EQ1"); SimpleString eq = new SimpleString("EQ1");
SimpleString eq2 = new SimpleString("EQ2"); SimpleString eq2 = new SimpleString("EQ2");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea);
addressSettings.setExpiryAddress(ea);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
clientSession.createQueue(ea, eq, null, false); clientSession.createQueue(ea, eq, null, false);
clientSession.createQueue(ea, eq2, null, false); clientSession.createQueue(ea, eq2, null, false);
@ -225,15 +218,12 @@ public class ExpiryAddressTest extends ServiceTestBase
final int NUM_MESSAGES = 5; final int NUM_MESSAGES = 5;
SimpleString ea = new SimpleString("DLA"); SimpleString ea = new SimpleString("DLA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea);
addressSettings.setExpiryAddress(ea);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
SimpleString eq = new SimpleString("EA1"); SimpleString eq = new SimpleString("EA1");
clientSession.createQueue(ea, eq, null, false); clientSession.createQueue(ea, eq, null, false);
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);
ServerLocator locator1 = ServerLocator locator1 = createInVMNonHALocator();
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator1); ClientSessionFactory sessionFactory = createSessionFactory(locator1);
@ -282,8 +272,7 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString ea = new SimpleString("EA"); SimpleString ea = new SimpleString("EA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString eq = new SimpleString("EA1"); SimpleString eq = new SimpleString("EA1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea);
addressSettings.setExpiryAddress(ea);
server.getAddressSettingsRepository().setDefault(addressSettings); server.getAddressSettingsRepository().setDefault(addressSettings);
clientSession.createQueue(ea, eq, null, false); clientSession.createQueue(ea, eq, null, false);
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);
@ -312,8 +301,7 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString ea = new SimpleString("EA"); SimpleString ea = new SimpleString("EA");
SimpleString qName = new SimpleString("q1"); SimpleString qName = new SimpleString("q1");
SimpleString eq = new SimpleString("EA1"); SimpleString eq = new SimpleString("EA1");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea);
addressSettings.setExpiryAddress(ea);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
clientSession.createQueue(ea, eq, null, false); clientSession.createQueue(ea, eq, null, false);
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);
@ -346,11 +334,9 @@ public class ExpiryAddressTest extends ServiceTestBase
SimpleString specificExpiryAddress = RandomUtil.randomSimpleString(); SimpleString specificExpiryAddress = RandomUtil.randomSimpleString();
SimpleString specificExpiryQueue = RandomUtil.randomSimpleString(); SimpleString specificExpiryQueue = RandomUtil.randomSimpleString();
AddressSettings defaultAddressSettings = new AddressSettings(); AddressSettings defaultAddressSettings = new AddressSettings().setExpiryAddress(defaultExpiryAddress);
defaultAddressSettings.setExpiryAddress(defaultExpiryAddress);
server.getAddressSettingsRepository().addMatch("prefix.*", defaultAddressSettings); server.getAddressSettingsRepository().addMatch("prefix.*", defaultAddressSettings);
AddressSettings specificAddressSettings = new AddressSettings(); AddressSettings specificAddressSettings = new AddressSettings().setExpiryAddress(specificExpiryAddress);
specificAddressSettings.setExpiryAddress(specificExpiryAddress);
server.getAddressSettingsRepository().addMatch("prefix.address", specificAddressSettings); server.getAddressSettingsRepository().addMatch("prefix.address", specificAddressSettings);
clientSession.createQueue(address, queue, false); clientSession.createQueue(address, queue, false);
@ -385,21 +371,14 @@ public class ExpiryAddressTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY); server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), false));
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(transportConfig);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start(); server.start();
// then we create a client as normal // then we create a client as normal
locator = createInVMNonHALocator(); locator = createInVMNonHALocator()
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSessionFactory sessionFactory = createSessionFactory(locator);
// There are assertions over sizes that needs to be done after the ACK // There are assertions over sizes that needs to be done after the ACK
// was received on server // was received on server
clientSession = addClientSession(sessionFactory.createSession(null, null, false, true, true, false, 0)); clientSession = addClientSession(sessionFactory.createSession(null, null, false, true, true, false, 0));
} }
} }

View File

@ -27,7 +27,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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
@ -37,7 +37,7 @@ import org.junit.Test;
/** /**
* This test will send large messages in page-mode, DLQ then, expiry then, and they should be received fine * This test will send large messages in page-mode, DLQ then, expiry then, and they should be received fine
*/ */
public class ExpiryLargeMessageTest extends ServiceTestBase public class ExpiryLargeMessageTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -69,20 +69,14 @@ public class ExpiryLargeMessageTest extends ServiceTestBase
server.getConfiguration().setMessageExpiryScanPeriod(600000); server.getConfiguration().setMessageExpiryScanPeriod(600000);
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings()
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
setting.setMaxDeliveryAttempts(5); .setMaxDeliveryAttempts(5)
setting.setMaxSizeBytes(50 * 1024); .setMaxSizeBytes(50 * 1024)
setting.setPageSizeBytes(10 * 1024); .setPageSizeBytes(10 * 1024)
setting.setExpiryAddress(EXPIRY); .setExpiryAddress(EXPIRY)
setting.setDeadLetterAddress(DLQ); .setDeadLetterAddress(DLQ);
server.getAddressSettingsRepository().addMatch(MY_QUEUE.toString(), setting); server.getAddressSettingsRepository().addMatch(MY_QUEUE.toString(), setting);
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
setting.setMaxDeliveryAttempts(5);
setting.setMaxSizeBytes(50 * 1024);
setting.setPageSizeBytes(10 * 1024);
setting.setDeadLetterAddress(DLQ);
server.getAddressSettingsRepository().addMatch(EXPIRY.toString(), setting); server.getAddressSettingsRepository().addMatch(EXPIRY.toString(), setting);
server.start(); server.start();
@ -281,20 +275,14 @@ public class ExpiryLargeMessageTest extends ServiceTestBase
server.getConfiguration().setMessageExpiryScanPeriod(600000); server.getConfiguration().setMessageExpiryScanPeriod(600000);
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings()
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
setting.setMaxDeliveryAttempts(5); .setMaxDeliveryAttempts(5)
setting.setMaxSizeBytes(-1); .setMaxSizeBytes(-1)
setting.setPageSizeBytes(10 * 1024); .setPageSizeBytes(10 * 1024)
setting.setExpiryAddress(EXPIRY); .setExpiryAddress(EXPIRY)
setting.setDeadLetterAddress(DLQ); .setDeadLetterAddress(DLQ);
server.getAddressSettingsRepository().addMatch(MY_QUEUE.toString(), setting); server.getAddressSettingsRepository().addMatch(MY_QUEUE.toString(), setting);
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
setting.setMaxDeliveryAttempts(5);
setting.setMaxSizeBytes(-1);
setting.setPageSizeBytes(10 * 1024);
setting.setDeadLetterAddress(DLQ);
server.getAddressSettingsRepository().addMatch(EXPIRY.toString(), setting); server.getAddressSettingsRepository().addMatch(EXPIRY.toString(), setting);
server.start(); server.start();

View File

@ -15,15 +15,23 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
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.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQSession;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.jms.server.management.NullInitialContext; import org.apache.activemq.artemis.tests.integration.jms.server.management.NullInitialContext;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.After;
import org.junit.Test; import org.junit.Test;
import javax.jms.Connection; import javax.jms.Connection;
@ -31,18 +39,7 @@ import javax.jms.ExceptionListener;
import javax.jms.JMSException; import javax.jms.JMSException;
import javax.jms.Session; import javax.jms.Session;
import org.apache.activemq.artemis.api.core.TransportConfiguration; public class FailureDeadlockTest extends ActiveMQTestBase
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQSession;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
public class FailureDeadlockTest extends ServiceTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -59,38 +56,13 @@ public class FailureDeadlockTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
server = createServer(false, createDefaultInVMConfig());
Configuration conf = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
server = createServer(false, conf);
jmsServer = new JMSServerManagerImpl(server); jmsServer = new JMSServerManagerImpl(server);
jmsServer.setRegistry(new JndiBindingRegistry(new NullInitialContext())); jmsServer.setRegistry(new JndiBindingRegistry(new NullInitialContext()));
jmsServer.start(); jmsServer.start();
cf1 = cf1 = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, cf2 = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
new TransportConfiguration(INVM_CONNECTOR_FACTORY));
cf2 =
ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
new TransportConfiguration(INVM_CONNECTOR_FACTORY));
}
@Override
@After
public void tearDown() throws Exception
{
cf1.close();
cf2.close();
if (jmsServer != null && jmsServer.isStarted())
{
jmsServer.stop();
}
super.tearDown();
} }
// https://jira.jboss.org/jira/browse/JBMESSAGING-1702 // https://jira.jboss.org/jira/browse/JBMESSAGING-1702

View File

@ -15,14 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;
import java.util.LinkedList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Interceptor;
@ -63,20 +55,28 @@ import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.ReusableLatch;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;
import java.util.LinkedList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/** /**
* This test will simulate a consumer hanging on the delivery packet due to unbehaved clients * This test will simulate a consumer hanging on the delivery packet due to unbehaved clients
* and it will make sure we can still perform certain operations on the queue such as produce * and it will make sure we can still perform certain operations on the queue such as produce
* and verify the counters * and verify the counters
*/ */
public class HangConsumerTest extends ServiceTestBase public class HangConsumerTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -93,28 +93,18 @@ public class HangConsumerTest extends ServiceTestBase
{ {
super.setUp(); super.setUp();
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setMessageExpiryScanPeriod(10); .setMessageExpiryScanPeriod(10);
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl(); ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
config.setPersistenceEnabled(true); server = addServer(new MyActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager));
server = new MyActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager);
server.start(); server.start();
locator = createInVMNonHALocator(); locator = createInVMNonHALocator();
} }
@After
public void tearDown() throws Exception
{
server.stop();
locator.close();
super.tearDown();
}
@Test @Test
public void testHangOnDelivery() throws Exception public void testHangOnDelivery() throws Exception
{ {
@ -378,7 +368,7 @@ public class HangConsumerTest extends ServiceTestBase
// a duplicate binding would impede the server from starting // a duplicate binding would impede the server from starting
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
server.stop(); server.stop();
@ -415,7 +405,7 @@ public class HangConsumerTest extends ServiceTestBase
// a duplicate binding would impede the server from starting // a duplicate binding would impede the server from starting
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
server.stop(); server.stop();
@ -490,7 +480,7 @@ public class HangConsumerTest extends ServiceTestBase
server.stop(); server.stop();
SequentialFileFactory messagesFF = new NIOSequentialFileFactory(getBindingsDir(), null); SequentialFileFactory messagesFF = new NIOSequentialFileFactory(server.getConfiguration().getBindingsDirectory(), null);
JournalImpl messagesJournal = new JournalImpl(1024 * 1024, JournalImpl messagesJournal = new JournalImpl(1024 * 1024,
2, 2,

View File

@ -29,8 +29,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl; import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper; import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -40,7 +39,7 @@ import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource; import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
public class HeuristicXATest extends ServiceTestBase public class HeuristicXATest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
final SimpleString ADDRESS = new SimpleString("ADDRESS"); final SimpleString ADDRESS = new SimpleString("ADDRESS");
@ -62,7 +61,7 @@ public class HeuristicXATest extends ServiceTestBase
@Test @Test
public void testInvalidCall() throws Exception public void testInvalidCall() throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setJMXManagementEnabled(true); .setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration); ActiveMQServer server = createServer(false, configuration);
@ -88,7 +87,7 @@ public class HeuristicXATest extends ServiceTestBase
private void internalTest(final boolean isCommit) throws Exception private void internalTest(final boolean isCommit) throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setJMXManagementEnabled(true); .setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration); ActiveMQServer server = createServer(false, configuration);
@ -184,7 +183,7 @@ public class HeuristicXATest extends ServiceTestBase
private void doHeuristicCompletionWithRestart(final boolean isCommit) throws Exception private void doHeuristicCompletionWithRestart(final boolean isCommit) throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setJMXManagementEnabled(true); .setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration); ActiveMQServer server = createServer(true, configuration);
@ -285,7 +284,7 @@ public class HeuristicXATest extends ServiceTestBase
private void doRecoverHeuristicCompletedTxWithRestart(final boolean heuristicCommit) throws Exception private void doRecoverHeuristicCompletedTxWithRestart(final boolean heuristicCommit) throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setJMXManagementEnabled(true); .setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration); ActiveMQServer server = createServer(true, configuration);
@ -356,7 +355,7 @@ public class HeuristicXATest extends ServiceTestBase
server.stop(); server.stop();
server.start(); server.start();
// we need to recreate the locator and session factory // we need to recreate the locator and session sf
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
jmxServer = ManagementControlHelper.createActiveMQServerControl(mbeanServer); jmxServer = ManagementControlHelper.createActiveMQServerControl(mbeanServer);
if (heuristicCommit) if (heuristicCommit)
@ -395,7 +394,7 @@ public class HeuristicXATest extends ServiceTestBase
private void doForgetHeuristicCompletedTxAndRestart(final boolean heuristicCommit) throws Exception private void doForgetHeuristicCompletedTxAndRestart(final boolean heuristicCommit) throws Exception
{ {
Configuration configuration = createDefaultConfig() Configuration configuration = createDefaultInVMConfig()
.setJMXManagementEnabled(true); .setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration); ActiveMQServer server = createServer(true, configuration);
@ -480,15 +479,6 @@ public class HeuristicXATest extends ServiceTestBase
// Protected ----------------------------------------------------- // Protected -----------------------------------------------------
@Override
@After
public void tearDown() throws Exception
{
locator.close();
MBeanServerFactory.releaseMBeanServer(mbeanServer);
super.tearDown();
}
@Override @Override
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception

View File

@ -15,13 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; 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.ClientMessage;
@ -31,10 +24,14 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.utils.DataConstants; import org.apache.activemq.artemis.utils.DataConstants;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class InVMNonPersistentMessageBufferTest extends ServiceTestBase public class InVMNonPersistentMessageBufferTest extends ActiveMQTestBase
{ {
public static final String address = "testaddress"; public static final String address = "testaddress";
@ -262,22 +259,6 @@ public class InVMNonPersistentMessageBufferTest extends ServiceTestBase
session.start(); session.start();
} }
@Override
@After
public void tearDown() throws Exception
{
if (session != null)
{
consumer.close();
session.deleteQueue(InVMNonPersistentMessageBufferTest.queueName);
session.close();
}
super.tearDown();
}
private ClientMessage sendAndReceive(final ClientMessage message) throws Exception private ClientMessage sendAndReceive(final ClientMessage message) throws Exception
{ {
producer.send(message); producer.send(message);

View File

@ -41,7 +41,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.version.impl.VersionImpl; import org.apache.activemq.artemis.core.version.impl.VersionImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.VersionLoader; import org.apache.activemq.artemis.utils.VersionLoader;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -49,7 +49,7 @@ import org.junit.Test;
import static org.apache.activemq.artemis.tests.util.RandomUtil.randomString; import static org.apache.activemq.artemis.tests.util.RandomUtil.randomString;
public class IncompatibleVersionTest extends ServiceTestBase public class IncompatibleVersionTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -251,10 +251,10 @@ public class IncompatibleVersionTest extends ServiceTestBase
{ {
public void perform(String startedString) throws Exception public void perform(String startedString) throws Exception
{ {
Configuration conf = new ConfigurationImpl() Configuration config = new ConfigurationImpl()
.setSecurityEnabled(false) .setSecurityEnabled(false)
.addAcceptorConfiguration(new TransportConfiguration("org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory")); .addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY));
ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, false); ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, false);
server.start(); server.start();
log.info("### server: " + startedString); log.info("### server: " + startedString);

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.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase; import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.StorageManager;
@ -102,8 +102,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(false); locator.setBlockOnNonDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -128,7 +128,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.stop(false); server.stop(false);
ServiceTestBase.forceGC(); ActiveMQTestBase.forceGC();
server.start(); server.start();
@ -146,9 +146,9 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(false); locator.setBlockOnNonDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false)
locator.addIncomingInterceptor(new LargeMessageTestInterceptorIgnoreLastPacket()); .addIncomingInterceptor(new LargeMessageTestInterceptorIgnoreLastPacket());
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -226,8 +226,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -261,7 +261,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage); Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++) for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
} }
clientMessage.acknowledge(); clientMessage.acknowledge();
} }
@ -293,8 +293,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -314,7 +314,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
} }
session.commit(); session.commit();
validateNoFilesOnLargeDir(10); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), 10);
for (int h = 0; h < 5; h++) for (int h = 0; h < 5; h++)
{ {
@ -340,7 +340,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage); Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++) for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
} }
clientMessage.acknowledge(); clientMessage.acknowledge();
} }
@ -367,8 +367,6 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
@Test @Test
public void testSendPreparedXA() throws Exception public void testSendPreparedXA() throws Exception
{ {
ClientSession session = null; ClientSession session = null;
LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt(); LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt();
@ -382,8 +380,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -469,7 +467,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
} }
server.stop(); server.stop();
validateNoFilesOnLargeDir(10); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), 10);
server.start(); server.start();
@ -615,8 +613,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.getAddressSettingsRepository(), server.getAddressSettingsRepository(),
server.getExecutorFactory())); server.getExecutorFactory()));
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -678,8 +676,8 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
QueueFactory original = server.getQueueFactory(); QueueFactory original = server.getQueueFactory();
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -16,6 +16,14 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Before;
import org.junit.Test;
import javax.jms.BytesMessage; import javax.jms.BytesMessage;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.Message; import javax.jms.Message;
@ -24,15 +32,6 @@ import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.Topic; import javax.jms.Topic;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/** /**
* This will perform cleanup tests on paging while using JMS topics * This will perform cleanup tests on paging while using JMS topics
*/ */
@ -77,21 +76,12 @@ public class JMSPagingFileDeleteTest extends JMSTestBase
topic1 = createTopic("topic1"); topic1 = createTopic("topic1");
// Paging Setting // Paging Setting
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings()
setting.setPageSizeBytes(JMSPagingFileDeleteTest.PAGE_SIZE); .setPageSizeBytes(JMSPagingFileDeleteTest.PAGE_SIZE)
setting.setMaxSizeBytes(JMSPagingFileDeleteTest.PAGE_MAX); .setMaxSizeBytes(JMSPagingFileDeleteTest.PAGE_MAX);
server.getAddressSettingsRepository().addMatch("#", setting); server.getAddressSettingsRepository().addMatch("#", setting);
} }
@Override
@After
public void tearDown() throws Exception
{
log.info("#tearDown");
topic1 = null;
super.tearDown();
}
/** /**
* Test replicating issue JBPAPP-9603 * Test replicating issue JBPAPP-9603
* *

View File

@ -28,7 +28,7 @@ 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.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -62,7 +62,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* counting strategy is used to verify that the count has reached the expected * counting strategy is used to verify that the count has reached the expected
* value. * value.
*/ */
public class JmsNettyNioStressTest extends ServiceTestBase public class JmsNettyNioStressTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -92,8 +92,8 @@ public class JmsNettyNioStressTest extends ServiceTestBase
// minimize threads to maximize possibility for deadlock // minimize threads to maximize possibility for deadlock
params.put(TransportConstants.NIO_REMOTING_THREADS_PROPNAME, 1); params.put(TransportConstants.NIO_REMOTING_THREADS_PROPNAME, 1);
params.put(TransportConstants.BATCH_DELAY, 50); params.put(TransportConstants.BATCH_DELAY, 50);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.NETTY_ACCEPTOR_FACTORY, params); TransportConfiguration transportConfig = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY, params);
Configuration config = createBasicConfig(-1) Configuration config = createBasicConfig()
.setJMXManagementEnabled(false) .setJMXManagementEnabled(false)
.clearAcceptorConfigurations() .clearAcceptorConfigurations()
.addAcceptorConfiguration(transportConfig); .addAcceptorConfiguration(transportConfig);

View File

@ -34,11 +34,11 @@ import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl; import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.journal.impl.NIOSequentialFileFactory; import org.apache.activemq.artemis.core.journal.impl.NIOSequentialFileFactory;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class JournalCrashTest extends ServiceTestBase public class JournalCrashTest extends ActiveMQTestBase
{ {
private static final int FIRST_RUN = 4; private static final int FIRST_RUN = 4;
@ -58,7 +58,7 @@ public class JournalCrashTest extends ServiceTestBase
protected void startServer() throws Exception protected void startServer() throws Exception
{ {
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalFileSize(ActiveMQDefaultConfiguration.getDefaultJournalFileSize()) .setJournalFileSize(ActiveMQDefaultConfiguration.getDefaultJournalFileSize())
.setJournalCompactMinFiles(ActiveMQDefaultConfiguration.getDefaultJournalCompactMinFiles()) .setJournalCompactMinFiles(ActiveMQDefaultConfiguration.getDefaultJournalCompactMinFiles())
.setJournalCompactPercentage(ActiveMQDefaultConfiguration.getDefaultJournalCompactPercentage()) .setJournalCompactPercentage(ActiveMQDefaultConfiguration.getDefaultJournalCompactPercentage())

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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient; 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.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.Assert; import org.junit.Assert;
@ -52,10 +52,9 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
@Override @Override
protected ServerLocator createFactory(final boolean isNetty) throws Exception protected ServerLocator createFactory(final boolean isNetty) throws Exception
{ {
ServerLocator locator1 = super.createFactory(isNetty); return super.createFactory(isNetty)
locator1.setMinLargeMessageSize(10240); .setMinLargeMessageSize(10240)
locator1.setCompressLargeMessage(true); .setCompressLargeMessage(true);
return locator1;
} }
@Test @Test
@ -194,7 +193,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
session.start(); session.start();
//no file should be in the dir as we send it as regular //no file should be in the dir as we send it as regular
validateNoFilesOnLargeDir(num); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), num);
ClientConsumer consumer = session.createConsumer(ADDRESS); ClientConsumer consumer = session.createConsumer(ADDRESS);
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
@ -259,7 +258,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
session.start(); session.start();
//half the messages are sent as large //half the messages are sent as large
validateNoFilesOnLargeDir(num / 2); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), num / 2);
ClientConsumer consumer = session.createConsumer(ADDRESS); ClientConsumer consumer = session.createConsumer(ADDRESS);
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
@ -316,10 +315,9 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
.setDeadLetterAddress(ADDRESS_DLA)
addressSettings.setDeadLetterAddress(ADDRESS_DLA); .setMaxDeliveryAttempts(1);
addressSettings.setMaxDeliveryAttempts(1);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
@ -350,7 +348,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1 Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte()); .getBodyBuffer().readByte());
} }
@ -375,7 +373,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1 Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte()); .getBodyBuffer().readByte());
} }
@ -384,7 +382,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
session.commit(); session.commit();
//large message becomes a regular at server. //large message becomes a regular at server.
validateNoFilesOnLargeDir(0); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), 0);
consumer = session.createConsumer(ADDRESS.concat("-2")); consumer = session.createConsumer(ADDRESS.concat("-2"));
@ -394,7 +392,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1 Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte()); .getBodyBuffer().readByte());
} }

View File

@ -59,9 +59,8 @@ public class LargeMessageCompressTest extends LargeMessageTest
@Override @Override
protected ServerLocator createFactory(final boolean isNetty) throws Exception protected ServerLocator createFactory(final boolean isNetty) throws Exception
{ {
ServerLocator locator1 = super.createFactory(isNetty); return super.createFactory(isNetty)
locator1.setCompressLargeMessage(true); .setCompressLargeMessage(true);
return locator1;
} }
@Test @Test

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.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -299,7 +299,7 @@ public class LargeMessageTest extends LargeMessageTestBase
final int PAGE_SIZE = 10 * 1024; final int PAGE_SIZE = 10 * 1024;
final int MESSAGE_SIZE = 1024; // 1k final int MESSAGE_SIZE = 1024; // 1k
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, ActiveMQServer server = createServer(true,
@ -312,11 +312,10 @@ public class LargeMessageTest extends LargeMessageTestBase
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP); server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
locator = createInVMNonHALocator(); locator = createInVMNonHALocator()
.setBlockOnNonDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnAcknowledge(true);
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -456,10 +455,9 @@ public class LargeMessageTest extends LargeMessageTestBase
SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
.setDeadLetterAddress(ADDRESS_DLA)
addressSettings.setDeadLetterAddress(ADDRESS_DLA); .setMaxDeliveryAttempts(1);
addressSettings.setMaxDeliveryAttempts(1);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
@ -490,7 +488,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
session.close(); session.close();
@ -514,14 +512,14 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
msg1.acknowledge(); msg1.acknowledge();
session.commit(); session.commit();
validateNoFilesOnLargeDir(isCompressedTest ? 0 : 1); validateNoFilesOnLargeDir(server.getConfiguration().getLargeMessagesDirectory(), isCompressedTest ? 0 : 1);
consumer = session.createConsumer(ADDRESS.concat("-2")); consumer = session.createConsumer(ADDRESS.concat("-2"));
@ -531,7 +529,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
msg1.acknowledge(); msg1.acknowledge();
@ -580,7 +578,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
} }
session.rollback(); session.rollback();
@ -595,7 +593,7 @@ public class LargeMessageTest extends LargeMessageTestBase
msg.acknowledge(); msg.acknowledge();
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
} }
Assert.assertEquals(2, msg.getDeliveryCount()); Assert.assertEquals(2, msg.getDeliveryCount());
msg.acknowledge(); msg.acknowledge();
@ -623,11 +621,10 @@ public class LargeMessageTest extends LargeMessageTestBase
SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla");
SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry"); SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
.setDeadLetterAddress(ADDRESS_DLA)
addressSettings.setDeadLetterAddress(ADDRESS_DLA); .setExpiryAddress(ADDRESS_EXPIRY)
addressSettings.setExpiryAddress(ADDRESS_EXPIRY); .setMaxDeliveryAttempts(1);
addressSettings.setMaxDeliveryAttempts(1);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
@ -663,7 +660,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++) for (int j = 0; j < messageSize; j++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
} }
session.rollback(); session.rollback();
@ -681,7 +678,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++) for (int j = 0; j < messageSize; j++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
} }
session.rollback(); session.rollback();
@ -705,7 +702,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
session.commit(); session.commit();
@ -740,11 +737,10 @@ public class LargeMessageTest extends LargeMessageTestBase
SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla");
SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry"); SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
.setDeadLetterAddress(ADDRESS_DLA)
addressSettings.setDeadLetterAddress(ADDRESS_DLA); .setExpiryAddress(ADDRESS_EXPIRY)
addressSettings.setExpiryAddress(ADDRESS_EXPIRY); .setMaxDeliveryAttempts(1);
addressSettings.setMaxDeliveryAttempts(1);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
@ -779,7 +775,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++) for (int j = 0; j < messageSize; j++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
} }
session.rollback(); session.rollback();
@ -796,7 +792,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++) for (int j = 0; j < messageSize; j++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
} }
session.rollback(); session.rollback();
@ -825,7 +821,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
session.commit(); session.commit();
@ -852,11 +848,9 @@ public class LargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
AddressSettings addressSettings = new AddressSettings();
SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry"); SimpleString ADDRESS_EXPIRY = ADDRESS.concat("-expiry");
addressSettings.setExpiryAddress(ADDRESS_EXPIRY); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ADDRESS_EXPIRY);
server.getAddressSettingsRepository().addMatch("*", addressSettings); server.getAddressSettingsRepository().addMatch("*", addressSettings);
@ -892,7 +886,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
session.close(); session.close();
@ -916,7 +910,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++) for (int i = 0; i < messageSize; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
} }
msg1.acknowledge(); msg1.acknowledge();
@ -1128,9 +1122,8 @@ public class LargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setMinLargeMessageSize(200); locator.setMinLargeMessageSize(200)
.setCacheLargeMessagesClient(true);
locator.setCacheLargeMessagesClient(true);
ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
@ -1196,7 +1189,7 @@ public class LargeMessageTest extends LargeMessageTestBase
assertNotNull(msg); assertNotNull(msg);
for (long i = 0; i < messageSize; i++) for (long i = 0; i < messageSize; i++)
{ {
Assert.assertEquals("position " + i, ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte()); Assert.assertEquals("position " + i, ActiveMQTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
} }
} }
@ -2434,8 +2427,8 @@ public class LargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setMinLargeMessageSize(1024); locator.setMinLargeMessageSize(1024)
locator.setConsumerWindowSize(1024 * 1024); .setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
@ -2448,7 +2441,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++) for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{ {
ClientMessage clientFile = session.createMessage(true); ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE)); clientFile.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile); producer.send(clientFile);
} }
@ -2481,7 +2474,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{ {
for (int byteRead = 0; byteRead < SIZE; byteRead++) for (int byteRead = 0; byteRead < SIZE; byteRead++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
} }
} }
@ -2538,8 +2531,8 @@ public class LargeMessageTest extends LargeMessageTestBase
server.start(); server.start();
locator.setMinLargeMessageSize(1024); locator.setMinLargeMessageSize(1024)
locator.setConsumerWindowSize(1024 * 1024); .setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
@ -2552,7 +2545,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++) for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{ {
ClientMessage clientFile = session.createMessage(true); ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE)); clientFile.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile); producer.send(clientFile);
} }
@ -2584,7 +2577,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{ {
for (int byteRead = 0; byteRead < SIZE; byteRead++) for (int byteRead = 0; byteRead < SIZE; byteRead++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
} }
} }
@ -2649,9 +2642,9 @@ public class LargeMessageTest extends LargeMessageTestBase
final int numberOfBytesBigMessage = 400000; final int numberOfBytesBigMessage = 400000;
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
@ -2788,10 +2781,10 @@ public class LargeMessageTest extends LargeMessageTestBase
final int numberOfBytesBigMessage = 400000; final int numberOfBytesBigMessage = 400000;
locator.setBlockOnNonDurableSend(true); locator.setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setCompressLargeMessage(true); .setCompressLargeMessage(true);
ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
@ -2911,7 +2904,7 @@ public class LargeMessageTest extends LargeMessageTestBase
session.createQueue(ADDRESS, ADDRESS, null, true); session.createQueue(ADDRESS, ADDRESS, null, true);
ClientMessage clientFile = session.createMessage(true); ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE)); clientFile.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE));
ClientProducer producer = session.createProducer(ADDRESS); ClientProducer producer = session.createProducer(ADDRESS);
@ -2990,7 +2983,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++) for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{ {
ClientMessage msg = session.createMessage(true); ClientMessage msg = session.createMessage(true);
msg.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE)); msg.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE));
msg.putIntProperty(new SimpleString("key"), i); msg.putIntProperty(new SimpleString("key"), i);
producer.send(msg); producer.send(msg);
@ -3048,7 +3041,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++) for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{ {
fileMessage.addBytes(new byte[]{ServiceTestBase.getSamplebyte(i)}); fileMessage.addBytes(new byte[]{ActiveMQTestBase.getSamplebyte(i)});
} }
// The server would be doing this // The server would be doing this
@ -3078,7 +3071,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++) for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{ {
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte()); Assert.assertEquals(ActiveMQTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
} }
msg.acknowledge(); msg.acknowledge();
@ -3121,9 +3114,9 @@ public class LargeMessageTest extends LargeMessageTestBase
if (sendBlocking) if (sendBlocking)
{ {
sf.getServerLocator().setBlockOnNonDurableSend(true); sf.getServerLocator().setBlockOnNonDurableSend(true)
sf.getServerLocator().setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
sf.getServerLocator().setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
} }
ClientSession session = sf.createSession(null, null, false, true, true, false, 0); ClientSession session = sf.createSession(null, null, false, true, true, false, 0);

View File

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

View File

@ -16,11 +16,6 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; 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.ClientMessage;
@ -29,15 +24,19 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessageConcurrencyTest extends ServiceTestBase import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class MessageConcurrencyTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -62,19 +61,6 @@ public class MessageConcurrencyTest extends ServiceTestBase
locator = createInVMNonHALocator(); locator = createInVMNonHALocator();
} }
@Override
@After
public void tearDown() throws Exception
{
locator.close();
server.stop();
server = null;
super.tearDown();
}
// Test that a created message can be sent via multiple producers on different sessions concurrently // Test that a created message can be sent via multiple producers on different sessions concurrently
@Test @Test
public void testMessageConcurrency() throws Exception public void testMessageConcurrency() throws Exception

View File

@ -28,22 +28,21 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessageConsumerRollbackTest extends ServiceTestBase public class MessageConsumerRollbackTest extends ActiveMQTestBase
{ {
ActiveMQServer server; ActiveMQServer server;
ServerLocator locator; ServerLocator locator;
ClientSessionFactory factory; ClientSessionFactory sf;
private static final String inQueue = "inqueue"; private static final String inQueue = "inqueue";
@ -56,17 +55,16 @@ public class MessageConsumerRollbackTest extends ServiceTestBase
server = createServer(true, true); server = createServer(true, true);
AddressSettings settings = new AddressSettings(); AddressSettings settings = new AddressSettings().setRedeliveryDelay(100);
settings.setRedeliveryDelay(100);
server.getConfiguration().getAddressesSettings().put("#", settings); server.getConfiguration().getAddressesSettings().put("#", settings);
server.start(); server.start();
locator = createNettyNonHALocator(); locator = createNettyNonHALocator();
factory = createSessionFactory(locator); sf = createSessionFactory(locator);
ClientSession session = factory.createTransactedSession(); ClientSession session = sf.createTransactedSession();
session.createQueue(inQueue, inQueue, true); session.createQueue(inQueue, inQueue, true);
@ -75,23 +73,6 @@ public class MessageConsumerRollbackTest extends ServiceTestBase
session.close(); session.close();
} }
@After
public void tearDown() throws Exception
{
try
{
factory.close();
locator.close();
}
catch (Exception ignored)
{
}
server.stop();
super.tearDown();
}
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
// Attributes ---------------------------------------------------- // Attributes ----------------------------------------------------
@ -109,7 +90,7 @@ public class MessageConsumerRollbackTest extends ServiceTestBase
int numberOfMessages = 3000; int numberOfMessages = 3000;
int numberOfConsumers = 10; int numberOfConsumers = 10;
ClientSession session = factory.createTransactedSession(); ClientSession session = sf.createTransactedSession();
sendMessages(numberOfMessages, session); sendMessages(numberOfMessages, session);

View File

@ -29,9 +29,9 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
public class MessageCounterTest extends ServiceTestBase public class MessageCounterTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -54,9 +54,8 @@ public class MessageCounterTest extends ServiceTestBase
@Test @Test
public void testMessageCounter() throws Exception public void testMessageCounter() throws Exception
{ {
locator.setBlockOnNonDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnDurableSend(true);
locator.setBlockOnDurableSend(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(null, null, false, false, false, false, 0); ClientSession session = sf.createSession(null, null, false, false, false, false, 0);

View File

@ -27,12 +27,12 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessageDurabilityTest extends ServiceTestBase public class MessageDurabilityTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -149,7 +149,7 @@ public class MessageDurabilityTest extends ServiceTestBase
session.start(); session.start();
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction() ActiveMQTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{ {
public void run() throws ActiveMQException public void run() throws ActiveMQException
{ {
@ -177,7 +177,7 @@ public class MessageDurabilityTest extends ServiceTestBase
restart(); restart();
session.start(); session.start();
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction() ActiveMQTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{ {
public void run() throws ActiveMQException public void run() throws ActiveMQException
{ {

View File

@ -33,9 +33,9 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
public class MessageExpirationTest extends ServiceTestBase public class MessageExpirationTest extends ActiveMQTestBase
{ {
private static final int EXPIRATION = 1000; private static final int EXPIRATION = 1000;
@ -87,8 +87,7 @@ public class MessageExpirationTest extends ServiceTestBase
ClientProducer producer = session.createProducer(address); ClientProducer producer = session.createProducer(address);
ClientMessage message = session.createMessage(false); ClientMessage message = session.createMessage(false);
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings().setExpiryDelay((long) MessageExpirationTest.EXPIRATION);
addressSettings.setExpiryDelay((long) MessageExpirationTest.EXPIRATION);
server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings);
producer.send(message); producer.send(message);

View File

@ -18,8 +18,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -27,10 +25,9 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; 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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -39,7 +36,7 @@ import java.util.ArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class MessageGroupingConnectionFactoryTest extends ServiceTestBase public class MessageGroupingConnectionFactoryTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -118,22 +115,10 @@ public class MessageGroupingConnectionFactoryTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY); server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), false));
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(transportConfig);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start(); server.start();
ServerLocator locator = createInVMNonHALocator()
// then we create a client as normal .setGroupID("grp1");
ServerLocator locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
locator.setGroupID("grp1");
ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = addClientSession(sessionFactory.createSession(false, true, true)); clientSession = addClientSession(sessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);

View File

@ -19,8 +19,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -33,7 +31,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl; import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
@ -45,7 +43,7 @@ import java.util.ArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class MessageGroupingTest extends ServiceTestBase public class MessageGroupingTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -608,19 +606,10 @@ public class MessageGroupingTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY); Configuration configuration = createDefaultInVMConfig();
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(transportConfig);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false)); server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start(); server.start();
locator = createInVMNonHALocator();
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
INVM_CONNECTOR_FACTORY)));
clientSessionFactory = createSessionFactory(locator); clientSessionFactory = createSessionFactory(locator);
clientSession = addClientSession(clientSessionFactory.createSession(false, true, true)); clientSession = addClientSession(clientSessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false); clientSession.createQueue(qName, qName, null, false);

View File

@ -34,9 +34,9 @@ import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
public class MessageHandlerTest extends ServiceTestBase public class MessageHandlerTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -17,8 +17,6 @@
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString; 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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
@ -26,17 +24,16 @@ 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration; 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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessagePriorityTest extends ServiceTestBase public class MessagePriorityTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -334,17 +331,12 @@ public class MessagePriorityTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
Configuration config = createDefaultInVMConfig();
Configuration config = createDefaultConfig()
.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()))
.setSecurityEnabled(false);
server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server = addServer(ActiveMQServers.newActiveMQServer(config, false));
server.start(); server.start();
locator = locator = createInVMNonHALocator()
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration( .setBlockOnNonDurableSend(true)
ServiceTestBase.INVM_CONNECTOR_FACTORY))); .setBlockOnDurableSend(true);
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
session = addClientSession(sf.createSession(false, true, true)); session = addClientSession(sf.createSession(false, true, true));
} }

View File

@ -29,12 +29,12 @@ 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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MessageRateTest extends ServiceTestBase public class MessageRateTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -38,7 +38,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
* Multiple Threads producing Messages, with Multiple Consumers with different queues, each queue with a different filter * Multiple Threads producing Messages, with Multiple Consumers with different queues, each queue with a different filter
* This is similar to MultipleThreadFilterTwoTest but it uses multiple queues * This is similar to MultipleThreadFilterTwoTest but it uses multiple queues
*/ */
public class MultipleThreadFilterOneTest extends ServiceTestBase public class MultipleThreadFilterOneTest extends ActiveMQTestBase
{ {
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------

View File

@ -32,7 +32,7 @@ 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.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Test; import org.junit.Test;
@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
public class NIOvsOIOTest extends ServiceTestBase public class NIOvsOIOTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -153,24 +153,19 @@ public class NIOvsOIOTest extends ServiceTestBase
private void testPerf(boolean nio) throws Exception private void testPerf(boolean nio) throws Exception
{ {
String acceptorFactoryClassName = "org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory"; Configuration config = createDefaultInVMConfig();
Configuration conf = createDefaultConfig()
.setSecurityEnabled(false);
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put(TransportConstants.USE_NIO_PROP_NAME, nio); params.put(TransportConstants.USE_NIO_PROP_NAME, nio);
conf.getAcceptorConfigurations().add(new TransportConfiguration(acceptorFactoryClassName, params)); config.getAcceptorConfigurations().add(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params));
ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, false); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, false));
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK)
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); .setMaxSizeBytes(10 * 1024 * 1024);
addressSettings.setMaxSizeBytes(10 * 1024 * 1024);
final String dest = "test-destination"; final String dest = "test-destination";
@ -184,8 +179,6 @@ public class NIOvsOIOTest extends ServiceTestBase
{ {
doTest(dest); doTest(dest);
} }
server.stop();
} }
private class Sender extends Thread private class Sender extends Thread

View File

@ -21,16 +21,14 @@ 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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator; 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.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; 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.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class NettyConnectorTest extends ServiceTestBase public class NettyConnectorTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -40,8 +38,7 @@ public class NettyConnectorTest extends ServiceTestBase
{ {
super.setUp(); super.setUp();
Configuration config = this.createDefaultConfig(true); server = createServer(false, createDefaultNettyConfig());
server = this.createServer(false, config);
server.start(); server.start();
} }
@ -65,12 +62,4 @@ public class NettyConnectorTest extends ServiceTestBase
factory.close(); factory.close();
locator.close(); locator.close();
} }
@Override
@After
public void tearDown() throws Exception
{
super.tearDown();
server.stop();
}
} }

View File

@ -15,34 +15,27 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
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.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.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; 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.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession; 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.ClientSessionFactory;
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.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/** /**
* *
* A NewDeadLetterAddressTest * A NewDeadLetterAddressTest
*/ */
public class NewDeadLetterAddressTest extends ServiceTestBase public class NewDeadLetterAddressTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -54,9 +47,9 @@ public class NewDeadLetterAddressTest extends ServiceTestBase
{ {
SimpleString dla = new SimpleString("DLA"); SimpleString dla = new SimpleString("DLA");
SimpleString address = new SimpleString("empty_address"); SimpleString address = new SimpleString("empty_address");
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setDeadLetterAddress(dla); .setDeadLetterAddress(dla)
addressSettings.setSendToDLAOnNoRoute(true); .setSendToDLAOnNoRoute(true);
server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings);
SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false); clientSession.createQueue(dla, dlq, null, false);
@ -75,39 +68,10 @@ public class NewDeadLetterAddressTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY); server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), false));
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
.addAcceptorConfiguration(transportConfig);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start(); server.start();
// then we create a client as normal locator = createInVMNonHALocator();
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, false); clientSession = sessionFactory.createSession(false, true, false);
} }
@Override
@After
public void tearDown() throws Exception
{
if (clientSession != null)
{
try
{
clientSession.close();
}
catch (ActiveMQException e1)
{
//
}
}
clientSession = null;
super.tearDown();
}
} }

View File

@ -25,7 +25,7 @@ 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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.Assert; import org.junit.Assert;
@ -35,7 +35,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class OrderTest extends ServiceTestBase public class OrderTest extends ActiveMQTestBase
{ {
private boolean persistent; private boolean persistent;
@ -79,9 +79,9 @@ public class OrderTest extends ServiceTestBase
server = createServer(persistent, true); server = createServer(persistent, true);
server.start(); server.start();
locator.setBlockOnNonDurableSend(false); locator.setBlockOnNonDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -154,9 +154,9 @@ public class OrderTest extends ServiceTestBase
server.start(); server.start();
locator.setBlockOnNonDurableSend(false); locator.setBlockOnNonDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false)
locator.setBlockOnAcknowledge(false); .setBlockOnAcknowledge(false);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(true, true, 0); ClientSession session = sf.createSession(true, true, 0);
@ -214,15 +214,14 @@ public class OrderTest extends ServiceTestBase
server = createServer(persistent, true); server = createServer(persistent, true);
server.getAddressSettingsRepository().clear(); server.getAddressSettingsRepository().clear();
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings().setRedeliveryDelay(500);
setting.setRedeliveryDelay(500);
server.getAddressSettingsRepository().addMatch("#", setting); server.getAddressSettingsRepository().addMatch("#", setting);
server.start(); server.start();
locator.setBlockOnNonDurableSend(false); locator.setBlockOnNonDurableSend(false)
locator.setBlockOnDurableSend(false); .setBlockOnDurableSend(false)
locator.setBlockOnAcknowledge(false); .setBlockOnAcknowledge(false);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(true, true, 0); ClientSession session = sf.createSession(true, true, 0);

View File

@ -16,17 +16,6 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -38,7 +27,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType; import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.Binding;
@ -52,15 +40,26 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.junit.After; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Test; import org.junit.Test;
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* A PagingOrderTest. PagingTest has a lot of tests already. I decided to create a newer one more * A PagingOrderTest. PagingTest has a lot of tests already. I decided to create a newer one more
* specialized on Ordering and counters * specialized on Ordering and counters
*/ */
public class PagingOrderTest extends ServiceTestBase public class PagingOrderTest extends ActiveMQTestBase
{ {
private static final int PAGE_MAX = 100 * 1024; private static final int PAGE_MAX = 100 * 1024;
@ -75,27 +74,12 @@ public class PagingOrderTest extends ServiceTestBase
private Connection conn; private Connection conn;
@Override
@After
public void tearDown() throws Exception
{
try
{
if (conn != null)
conn.close();
}
finally
{
super.tearDown();
}
}
@Test @Test
public void testOrder1() throws Throwable public void testOrder1() throws Throwable
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -105,16 +89,15 @@ public class PagingOrderTest extends ServiceTestBase
final int messageSize = 1024; final int messageSize = 1024;
final int numberOfMessages = 500; final int numberOfMessages = 500;
ServerLocator locator = createInVMNonHALocator();
locator.setClientFailureCheckPeriod(1000); ServerLocator locator = createInVMNonHALocator()
locator.setConnectionTTL(2000); .setClientFailureCheckPeriod(1000)
locator.setReconnectAttempts(0); .setConnectionTTL(2000)
.setReconnectAttempts(0)
locator.setBlockOnNonDurableSend(true); .setBlockOnNonDurableSend(true)
locator.setBlockOnDurableSend(true); .setBlockOnDurableSend(true)
locator.setBlockOnAcknowledge(true); .setBlockOnAcknowledge(true)
locator.setConsumerWindowSize(1024 * 1024); .setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -175,13 +158,9 @@ public class PagingOrderTest extends ServiceTestBase
session.close(); session.close();
session = null;
sf.close(); sf.close();
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
locator = createInVMNonHALocator();
session = sf.createSession(true, true, 0); session = sf.createSession(true, true, 0);
session.start(); session.start();
@ -204,7 +183,7 @@ public class PagingOrderTest extends ServiceTestBase
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -215,16 +194,14 @@ public class PagingOrderTest extends ServiceTestBase
final int numberOfMessages = 500; final int numberOfMessages = 500;
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(true)
.setBlockOnDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnAcknowledge(true)
locator.setBlockOnDurableSend(true); .setConsumerWindowSize(1024 * 1024);
locator.setBlockOnAcknowledge(true);
locator.setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -357,7 +334,7 @@ public class PagingOrderTest extends ServiceTestBase
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -368,16 +345,14 @@ public class PagingOrderTest extends ServiceTestBase
final int numberOfMessages = 500; final int numberOfMessages = 500;
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(true)
.setBlockOnDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnAcknowledge(true)
locator.setBlockOnDurableSend(true); .setConsumerWindowSize(1024 * 1024);
locator.setBlockOnAcknowledge(true);
locator.setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -471,7 +446,7 @@ public class PagingOrderTest extends ServiceTestBase
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -482,16 +457,14 @@ public class PagingOrderTest extends ServiceTestBase
final int numberOfMessages = 3000; final int numberOfMessages = 3000;
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(true)
.setBlockOnDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnAcknowledge(true)
locator.setBlockOnDurableSend(true); .setConsumerWindowSize(1024 * 1024);
locator.setBlockOnAcknowledge(true);
locator.setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -571,7 +544,7 @@ public class PagingOrderTest extends ServiceTestBase
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -582,16 +555,14 @@ public class PagingOrderTest extends ServiceTestBase
final int numberOfMessages = 200; final int numberOfMessages = 200;
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(true)
.setBlockOnDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnAcknowledge(true)
locator.setBlockOnDurableSend(true); .setConsumerWindowSize(0);
locator.setBlockOnAcknowledge(true);
locator.setConsumerWindowSize(0);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
@ -682,16 +653,14 @@ public class PagingOrderTest extends ServiceTestBase
server.start(); server.start();
locator = createInVMNonHALocator(); locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(true)
.setBlockOnDurableSend(true)
locator.setBlockOnNonDurableSend(true); .setBlockOnAcknowledge(true)
locator.setBlockOnDurableSend(true); .setConsumerWindowSize(0);
locator.setBlockOnAcknowledge(true);
locator.setConsumerWindowSize(0);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -718,7 +687,7 @@ public class PagingOrderTest extends ServiceTestBase
public void testPagingOverCreatedDestinationTopics() throws Exception public void testPagingOverCreatedDestinationTopics() throws Exception
{ {
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, -1, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, -1, new HashMap<String, AddressSettings>());
@ -797,7 +766,7 @@ public class PagingOrderTest extends ServiceTestBase
public void testPagingOverCreatedDestinationQueues() throws Exception public void testPagingOverCreatedDestinationQueues() throws Exception
{ {
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>());

View File

@ -26,7 +26,7 @@ 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.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@ -37,7 +37,7 @@ import org.junit.Test;
* <p/> * <p/>
* PagingTest has a lot of tests already. I decided to create a newer one more specialized on Ordering and counters * PagingTest has a lot of tests already. I decided to create a newer one more specialized on Ordering and counters
*/ */
public class PagingSyncTest extends ServiceTestBase public class PagingSyncTest extends ActiveMQTestBase
{ {
private static final int PAGE_MAX = 100 * 1024; private static final int PAGE_MAX = 100 * 1024;
@ -55,7 +55,7 @@ public class PagingSyncTest extends ServiceTestBase
{ {
boolean persistentMessages = true; boolean persistentMessages = true;
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig()
.setJournalSyncNonTransactional(false); .setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>()); ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
@ -66,16 +66,14 @@ public class PagingSyncTest extends ServiceTestBase
final int numberOfMessages = 500; final int numberOfMessages = 500;
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
.setClientFailureCheckPeriod(1000)
locator.setClientFailureCheckPeriod(1000); .setConnectionTTL(2000)
locator.setConnectionTTL(2000); .setReconnectAttempts(0)
locator.setReconnectAttempts(0); .setBlockOnNonDurableSend(false)
.setBlockOnDurableSend(false)
locator.setBlockOnNonDurableSend(false); .setBlockOnAcknowledge(false)
locator.setBlockOnDurableSend(false); .setConsumerWindowSize(1024 * 1024);
locator.setBlockOnAcknowledge(false);
locator.setConsumerWindowSize(1024 * 1024);
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -18,21 +18,19 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
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.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession; 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.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration; 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.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ProducerCloseTest extends ServiceTestBase public class ProducerCloseTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -51,7 +49,7 @@ public class ProducerCloseTest extends ServiceTestBase
Assert.assertTrue(producer.isClosed()); Assert.assertTrue(producer.isClosed());
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction() ActiveMQTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{ {
public void run() throws ActiveMQException public void run() throws ActiveMQException
{ {
@ -69,9 +67,7 @@ public class ProducerCloseTest extends ServiceTestBase
public void setUp() throws Exception public void setUp() throws Exception
{ {
super.setUp(); super.setUp();
Configuration config = createDefaultConfig() Configuration config = createDefaultInVMConfig();
.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()))
.setSecurityEnabled(false);
server = createServer(false, config); server = createServer(false, config);
server.start(); server.start();
locator = createInVMNonHALocator(); locator = createInVMNonHALocator();

View File

@ -35,7 +35,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -47,7 +47,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
public class ProducerFlowControlTest extends ServiceTestBase public class ProducerFlowControlTest extends ActiveMQTestBase
{ {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -224,19 +224,19 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(realFiles, isNetty()); server = createServer(realFiles, isNetty());
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxSizeBytes(maxSize); .setMaxSizeBytes(maxSize)
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); .setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(address.toString(), addressSettings); repos.addMatch(address.toString(), addressSettings);
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
locator.setProducerWindowSize(producerWindowSize); locator.setProducerWindowSize(producerWindowSize)
locator.setConsumerWindowSize(consumerWindowSize); .setConsumerWindowSize(consumerWindowSize)
locator.setAckBatchSize(ackBatchSize); .setAckBatchSize(ackBatchSize);
if (minLargeMessageSize != -1) if (minLargeMessageSize != -1)
{ {
@ -273,7 +273,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
message.getBodyBuffer().readBytes(bytesRead); message.getBodyBuffer().readBytes(bytesRead);
ServiceTestBase.assertEqualsByteArrays(bytes, bytesRead); ActiveMQTestBase.assertEqualsByteArrays(bytes, bytesRead);
message.acknowledge(); message.acknowledge();
@ -367,19 +367,19 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxSizeBytes(1024); .setMaxSizeBytes(1024)
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); .setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(address.toString(), addressSettings); repos.addMatch(address.toString(), addressSettings);
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
locator.setProducerWindowSize(1024); locator.setProducerWindowSize(1024)
locator.setConsumerWindowSize(1024); .setConsumerWindowSize(1024)
locator.setAckBatchSize(1024); .setAckBatchSize(1024);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true); session = sf.createSession(false, true, true, true);
@ -442,19 +442,19 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettings = new AddressSettings()
addressSettings.setMaxSizeBytes(1024); .setMaxSizeBytes(1024)
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); .setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository(); HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
repos.addMatch(address.toString(), addressSettings); repos.addMatch(address.toString(), addressSettings);
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
locator.setProducerWindowSize(1024); locator.setProducerWindowSize(1024)
locator.setConsumerWindowSize(1024); .setConsumerWindowSize(1024)
locator.setAckBatchSize(1024); .setAckBatchSize(1024);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -483,7 +483,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -548,7 +548,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -583,7 +583,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true); session = sf.createSession(false, true, true, true);
@ -619,7 +619,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -654,7 +654,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true); session = sf.createSession(false, true, true, true);
@ -690,7 +690,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -755,7 +755,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true); session = sf.createSession(false, true, true, true);
@ -780,7 +780,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -830,7 +830,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
server = createServer(false, isNetty()); server = createServer(false, isNetty());
server.start(); server.start();
waitForServer(server); waitForServerToStart(server);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);

View File

@ -34,12 +34,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class ProducerTest extends ServiceTestBase public class ProducerTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;
@ -71,8 +71,8 @@ public class ProducerTest extends ServiceTestBase
return true; return true;
} }
}); });
ServerLocator locator = createInVMNonHALocator(); ServerLocator locator = createInVMNonHALocator()
locator.setConfirmationWindowSize(100); .setConfirmationWindowSize(100);
ClientSessionFactory cf = locator.createSessionFactory(); ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, true, true);
ClientProducer producer = session.createProducer(QUEUE); ClientProducer producer = session.createProducer(QUEUE);
@ -90,9 +90,9 @@ public class ProducerTest extends ServiceTestBase
public void testProducerMultiThread() throws Exception public void testProducerMultiThread() throws Exception
{ {
final ServerLocator locator = createInVMNonHALocator(); final ServerLocator locator = createInVMNonHALocator();
AddressSettings setting = new AddressSettings(); AddressSettings setting = new AddressSettings()
setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); .setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK)
setting.setMaxSizeBytes(10 * 1024); .setMaxSizeBytes(10 * 1024);
server.stop(); server.stop();
server.getConfiguration().getAddressesSettings().clear(); server.getConfiguration().getAddressesSettings().clear();
server.getConfiguration().getAddressesSettings().put(QUEUE.toString(), setting); server.getConfiguration().getAddressesSettings().put(QUEUE.toString(), setting);

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -32,7 +32,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
public class QueueBrowserTest extends ServiceTestBase public class QueueBrowserTest extends ActiveMQTestBase
{ {
private ActiveMQServer server; private ActiveMQServer server;

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