Ensure tests use proper directory

This commit is contained in:
jbertram 2015-05-19 11:11:47 -05:00
parent 892675f02e
commit d24f2eb10f
6 changed files with 70 additions and 77 deletions

View File

@ -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();

View File

@ -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"));

View File

@ -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();

View File

@ -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<String> pairs = new ArrayList<String>();

View File

@ -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<String> staticConnectors = new ArrayList<String>();
@ -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)));
}

View File

@ -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<String>());
ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor);