From d24f2eb10f367c18014ff6dac1c389a2c7ea3254 Mon Sep 17 00:00:00 2001 From: jbertram Date: Tue, 19 May 2015 11:11:47 -0500 Subject: [PATCH] Ensure tests use proper directory --- .../extras/byteman/ReplicationBackupTest.java | 13 +++--- .../AutomaticColocatedQuorumVoteTest.java | 29 +++++++------- .../cluster/failover/FailoverTestBase.java | 9 ++--- ...tipleLivesMultipleBackupsFailoverTest.java | 29 +++++++------- ...SingleLiveMultipleBackupsFailoverTest.java | 27 ++++++------- .../replication/ReplicationTest.java | 40 +++++++++---------- 6 files changed, 70 insertions(+), 77 deletions(-) diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java index ea0e6f89dd..aa8165ce5f 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.tests.extras.byteman; -import java.util.concurrent.CountDownLatch; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; @@ -31,6 +28,8 @@ import org.jboss.byteman.contrib.bmunit.BMUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.concurrent.CountDownLatch; + @RunWith(BMUnitRunner.class) public class ReplicationBackupTest extends ServiceTestBase { @@ -67,10 +66,10 @@ public class ReplicationBackupTest extends ServiceTestBase final String suffix = "_backup"; Configuration backupConfig = createDefaultConfig() - .setBindingsDirectory("./target/" + ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + suffix) - .setJournalDirectory("./target/" + ActiveMQDefaultConfiguration.getDefaultJournalDir() + suffix) - .setPagingDirectory("./target/" + ActiveMQDefaultConfiguration.getDefaultPagingDir() + suffix) - .setLargeMessagesDirectory("./target/" + ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + suffix); + .setBindingsDirectory(getBindingsDir() + suffix) + .setJournalDirectory(getJournalDir() + suffix) + .setPagingDirectory(getPageDir() + suffix) + .setLargeMessagesDirectory(getLargeMessagesDir() + suffix); Configuration liveConfig = createDefaultConfig(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java index ee2edbb387..07f749ae51 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java @@ -16,20 +16,10 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; -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.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; -import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.core.client.impl.Topology; import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl; import org.apache.activemq.artemis.core.config.Configuration; @@ -42,11 +32,20 @@ import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfigu import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; +import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + @RunWith(value = Parameterized.class) public class AutomaticColocatedQuorumVoteTest extends ServiceTestBase { @@ -314,10 +313,10 @@ public class AutomaticColocatedQuorumVoteTest extends ServiceTestBase .clearAcceptorConfigurations() .addAcceptorConfiguration(liveAcceptor) .addConnectorConfiguration(liveConnector.getName(), liveConnector) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + identity) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + identity) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + identity) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + identity) + .setJournalDirectory(getJournalDir() + identity) + .setBindingsDirectory(getBindingsDir() + identity) + .setLargeMessagesDirectory(getLargeMessagesDir() + identity) + .setPagingDirectory(getPageDir() + identity) .addQueueConfiguration(new CoreQueueConfiguration() .setAddress("jms.queue.testQueue") .setName("jms.queue.testQueue")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java index 0b1aa0016d..a93a6f2dab 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java @@ -207,11 +207,10 @@ public abstract class FailoverTestBase extends ServiceTestBase ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, null); - final String suffix = "_backup"; - backupConfig.setBindingsDirectory(backupConfig.getBindingsDirectory() + suffix) - .setJournalDirectory(backupConfig.getJournalDirectory() + suffix) - .setPagingDirectory(backupConfig.getPagingDirectory() + suffix) - .setLargeMessagesDirectory(backupConfig.getLargeMessagesDirectory() + suffix) + backupConfig.setBindingsDirectory(getBindingsDir(0, true)) + .setJournalDirectory(getJournalDir(0, true)) + .setPagingDirectory(getPageDir(0, true)) + .setLargeMessagesDirectory(getLargeMessagesDir(0, true)) .setSecurityEnabled(false); setupHAPolicyConfiguration(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java index d60da9cca9..5e1b64130e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java @@ -16,16 +16,9 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; 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.ServerLocator; -import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal; import org.apache.activemq.artemis.core.config.Configuration; @@ -36,9 +29,15 @@ import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfigur import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; +import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.junit.After; import org.junit.Test; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** */ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase @@ -164,10 +163,10 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai .addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(nodeid, isNetty()))) .setSecurityEnabled(false) .setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration()) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + "_" + liveNode) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + "_" + liveNode) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + "_" + liveNode) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + "_" + liveNode); + .setBindingsDirectory(getBindingsDir() + "_" + liveNode) + .setJournalDirectory(getJournalDir() + "_" + liveNode) + .setPagingDirectory(getPageDir() + "_" + liveNode) + .setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode); for (int node : otherBackupNodes) { @@ -199,10 +198,10 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai .addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(liveNode, isNetty()))) .setSecurityEnabled(false) .setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + "_" + liveNode) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + "_" + liveNode) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + "_" + liveNode) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + "_" + liveNode) + .setBindingsDirectory(getBindingsDir() + "_" + liveNode) + .setJournalDirectory(getJournalDir() + "_" + liveNode) + .setPagingDirectory(getPageDir() + "_" + liveNode) + .setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode) .addConnectorConfiguration(liveConnector.getName(), liveConnector); List pairs = new ArrayList(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java index 2de81b626d..f0a34af8da 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java @@ -16,12 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; @@ -39,6 +33,11 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer import org.junit.After; import org.junit.Test; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** */ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase @@ -142,10 +141,10 @@ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailov .setSecurityEnabled(false) .setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicatedPolicyConfiguration()) .addConnectorConfiguration(backupConnector.getName(), backupConnector) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + "_" + liveNode) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + "_" + liveNode) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + "_" + liveNode) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + "_" + liveNode); + .setBindingsDirectory(getBindingsDir() + "_" + liveNode) + .setJournalDirectory(getJournalDir() + "_" + liveNode) + .setPagingDirectory(getPageDir() + "_" + liveNode) + .setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode); List staticConnectors = new ArrayList(); @@ -171,10 +170,10 @@ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailov .setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()) .addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())) .addConnectorConfiguration(liveConnector.getName(), liveConnector) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + "_" + liveNode) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + "_" + liveNode) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + "_" + liveNode) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + "_" + liveNode); + .setBindingsDirectory(getBindingsDir() + "_" + liveNode) + .setJournalDirectory(getJournalDir() + "_" + liveNode) + .setPagingDirectory(getPageDir() + "_" + liveNode) + .setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode); servers.put(liveNode, new SameProcessActiveMQServer(createInVMFailoverServer(true, config0, nodeManager, liveNode))); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java index 68cdc0e389..ddb0aead37 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java @@ -16,21 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.replication; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.ActiveMQException; @@ -85,14 +70,28 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; import org.apache.activemq.artemis.tests.util.ServiceTestBase; import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils; -import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; +import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + public final class ReplicationTest extends ServiceTestBase { @@ -140,15 +139,14 @@ public final class ReplicationTest extends ServiceTestBase backupAcceptor = TransportConfigurationUtils.getInVMAcceptor(false); } - final String suffix = "_backup"; Configuration liveConfig = createDefaultConfig(); Configuration backupConfig = createDefaultConfig() .setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()) - .setBindingsDirectory(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory() + suffix) - .setJournalDirectory(ActiveMQDefaultConfiguration.getDefaultJournalDir() + suffix) - .setPagingDirectory(ActiveMQDefaultConfiguration.getDefaultPagingDir() + suffix) - .setLargeMessagesDirectory(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir() + suffix) + .setBindingsDirectory(getBindingsDir(0, true)) + .setJournalDirectory(getJournalDir(0, true)) + .setPagingDirectory(getPageDir(0, true)) + .setLargeMessagesDirectory(getLargeMessagesDir(0, true)) .setIncomingInterceptorClassNames(incomingInterceptors.length > 0 ? Arrays.asList(incomingInterceptors) : new ArrayList()); ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor);