Author: borges
Date: 2011-10-25 08:31:25 -0400 (Tue, 25 Oct 2011)
New Revision: 11586
Modified:
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
Fix configuration of replicated backups (Quorum test set-up), clean up code
Modified: trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-10-25
12:31:02 UTC (rev 11585)
+++ trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-10-25
12:31:25 UTC (rev 11586)
@@ -189,13 +189,15 @@
{
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setSecurityEnabled(false);
- configuration.setBindingsDirectory(getBindingsDir(serverID, false));
configuration.setJournalMinFiles(2);
- configuration.setJournalDirectory(getJournalDir(serverID, false));
configuration.setJournalFileSize(100 * 1024);
configuration.setJournalType(getDefaultJournalType());
+
+ configuration.setJournalDirectory(getJournalDir(serverID, false));
+ configuration.setBindingsDirectory(getBindingsDir(serverID, false));
configuration.setPagingDirectory(getPageDir(serverID, false));
configuration.setLargeMessagesDirectory(getLargeMessagesDir(serverID, false));
+
configuration.setJournalCompactMinFiles(0);
configuration.setJournalCompactPercentage(0);
configuration.setClusterPassword(CLUSTER_PASSWORD);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-10-25
12:31:02 UTC (rev 11585)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-10-25
12:31:25 UTC (rev 11586)
@@ -1508,36 +1508,16 @@
throw new IllegalArgumentException("Already a server at node " +
node);
}
- Configuration configuration = createBasicConfig();
+ Configuration configuration = createBasicConfig(node);
- configuration.setSecurityEnabled(false);
- configuration.setJournalMinFiles(2);
configuration.setJournalMaxIO_AIO(1000);
- configuration.setJournalFileSize(100 * 1024);
- configuration.setJournalType(getDefaultJournalType());
configuration.setSharedStore(sharedStorage);
configuration.setThreadPoolMaxSize(10);
- if (sharedStorage)
- {
- // Shared storage will share the node between the backup and live node
- configuration.setBindingsDirectory(getBindingsDir(node, false));
- configuration.setJournalDirectory(getJournalDir(node, false));
- configuration.setPagingDirectory(getPageDir(node, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, false));
- }
- else
- {
- configuration.setBindingsDirectory(getBindingsDir(node, true));
- configuration.setJournalDirectory(getJournalDir(node, true));
- configuration.setPagingDirectory(getPageDir(node, true));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, true));
- }
configuration.setClustered(true);
- configuration.setJournalCompactMinFiles(0);
configuration.getAcceptorConfigurations().clear();
- configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty,
true, generateParams(node,
-
netty)));
+ configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty,
true,
+
generateParams(node, netty)));
HornetQServer server;
@@ -1550,7 +1530,6 @@
else
{
server = HornetQServers.newHornetQServer(configuration);
- server.setIdentity("Server " + node);
}
}
else
@@ -1562,7 +1541,6 @@
else
{
server = HornetQServers.newHornetQServer(configuration, false);
- server.setIdentity("Server " + node);
}
}
@@ -1570,32 +1548,6 @@
servers[node] = server;
}
- protected void setupLiveServer(final int node,
- final boolean fileStorage,
- final boolean sharedStorage,
- final boolean netty,
- NodeManager nodeManager)
- {
- if (servers[node] != null)
- {
- throw new IllegalArgumentException("Already a server at node " +
node);
- }
-
- Configuration configuration = createBasicConfig();
-
- configureSomeCommonValues(node, node, sharedStorage, configuration);
- configuration.setJournalCompactMinFiles(0);
-
- configuration.getAcceptorConfigurations().clear();
-
configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty, true,
generateParams(node, netty)));
-
- HornetQServer server;
-
- server = createInVMFailoverServer(fileStorage, configuration,
nodeManager,node);
-
- servers[node] = server;
- }
-
protected void setupBackupServer(final int node,
final int liveNode,
final boolean fileStorage,
@@ -1607,145 +1559,40 @@
throw new IllegalArgumentException("Already a server at node " +
node);
}
- Configuration configuration = createBasicConfig();
+ Configuration configuration = createBasicConfig(sharedStorage ? liveNode : node);
- configuration.setSecurityEnabled(false);
- configuration.setJournalMinFiles(2);
- configuration.setJournalMaxIO_AIO(1000);
- configuration.setJournalFileSize(100 * 1024);
- configuration.setJournalType(getDefaultJournalType());
configuration.setSharedStore(sharedStorage);
- if (sharedStorage)
- {
- // Shared storage will share the node between the backup and live node
- configuration.setBindingsDirectory(getBindingsDir(liveNode, false));
- configuration.setJournalDirectory(getJournalDir(liveNode, false));
- configuration.setPagingDirectory(getPageDir(liveNode, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(liveNode, false));
- }
- else
- {
- configuration.setBindingsDirectory(getBindingsDir(node, true));
- configuration.setJournalDirectory(getJournalDir(node, true));
- configuration.setPagingDirectory(getPageDir(node, true));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, true));
- }
configuration.setClustered(true);
- configuration.setJournalCompactMinFiles(0);
configuration.setBackup(true);
configuration.getAcceptorConfigurations().clear();
+
TransportConfiguration acceptorConfig = createTransportConfiguration(netty, true,
generateParams(node, netty));
configuration.getAcceptorConfigurations().add(acceptorConfig);
+
// add backup connector
TransportConfiguration liveConfig = createTransportConfiguration(netty, false,
generateParams(liveNode, netty));
configuration.getConnectorConfigurations().put(liveConfig.getName(), liveConfig);
TransportConfiguration backupConfig = createTransportConfiguration(netty, false,
generateParams(node, netty));
configuration.getConnectorConfigurations().put(backupConfig.getName(),
backupConfig);
+ configuration.setLiveConnectorName(liveConfig.getName());
+
HornetQServer server;
- if (fileStorage)
+ if (sharedStorage)
{
- if (sharedStorage)
- {
- server = createInVMFailoverServer(true, configuration,
nodeManagers[liveNode], liveNode);
- }
- else
- {
- server = HornetQServers.newHornetQServer(configuration);
- server.setIdentity("Server " + liveNode);
- }
+ server = createInVMFailoverServer(true, configuration, nodeManagers[liveNode],
liveNode);
}
else
{
- if (sharedStorage)
- {
- server = createInVMFailoverServer(true, configuration,
nodeManagers[liveNode], liveNode);
- }
- else
- {
- server = HornetQServers.newHornetQServer(configuration, false);
- server.setIdentity("Server " + liveNode);
- }
+ boolean enablePersistency = fileStorage ? true :
configuration.isPersistenceEnabled();
+ server = HornetQServers.newHornetQServer(configuration, enablePersistency);
}
server.setIdentity(this.getClass().getSimpleName() + "/Backup(" + node +
" of live " + liveNode + ")");
servers[node] = server;
}
- private void configureSomeCommonValues(final int node,
- final int liveNode,
- final boolean sharedStorage,
- Configuration configuration)
- {
- configuration.setSecurityEnabled(false);
- configuration.setJournalMinFiles(2);
- configuration.setJournalMaxIO_AIO(1000);
- configuration.setJournalFileSize(100 * 1024);
- configuration.setJournalType(getDefaultJournalType());
-
- configureCommonValues(node, liveNode, sharedStorage, configuration);
- }
-
- private void configureCommonValues(final int node,
- final int liveNode,
- final boolean sharedStorage,
- Configuration configuration)
- {
- configuration.setSharedStore(sharedStorage);
- configuration.setClustered(true);
- if (sharedStorage)
- {
- // Shared storage will share the node between the backup and live node
- configuration.setBindingsDirectory(getBindingsDir(liveNode, false));
- configuration.setJournalDirectory(getJournalDir(liveNode, false));
- configuration.setPagingDirectory(getPageDir(liveNode, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(liveNode, false));
- }
- else
- {
- configuration.setBindingsDirectory(getBindingsDir(node, true));
- configuration.setJournalDirectory(getJournalDir(node, true));
- configuration.setPagingDirectory(getPageDir(node, true));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, true));
- }
- }
-
- protected void setupBackupServer(final int node,
- final int liveNode,
- final boolean fileStorage,
- final boolean sharedStorage,
- final boolean netty,
- NodeManager nodeManager)
- {
- if (servers[node] != null)
- {
- throw new IllegalArgumentException("Already a server at node " +
node);
- }
-
- Configuration configuration = createBasicConfig();
-
- configureSomeCommonValues(node, liveNode, sharedStorage, configuration);
- configuration.setJournalCompactMinFiles(0);
- configuration.setBackup(true);
-
- // add acceptor
- configuration.getAcceptorConfigurations().clear();
- TransportConfiguration acceptorConfig = createTransportConfiguration(netty, true,
generateParams(node, netty));
- configuration.getAcceptorConfigurations().add(acceptorConfig);
-
-
- // add backup connector
- TransportConfiguration liveConfig = createTransportConfiguration(netty, false,
generateParams(liveNode, netty));
- configuration.getConnectorConfigurations().put(liveConfig.getName(), liveConfig);
- TransportConfiguration backupConfig = createTransportConfiguration(netty, false,
generateParams(node, netty));
- configuration.getConnectorConfigurations().put(backupConfig.getName(),
backupConfig);
-
- configuration.setLiveConnectorName(liveConfig.getName());
-
- servers[node] = createInVMFailoverServer(fileStorage, configuration, nodeManager,
node);
- }
-
protected void setupLiveServerWithDiscovery(final int node,
final String groupAddress,
final int port,
@@ -1758,17 +1605,9 @@
throw new IllegalArgumentException("Already a server at node " +
node);
}
- Configuration configuration = createBasicConfig();
+ Configuration configuration = createBasicConfig(node);
- configuration.setSecurityEnabled(false);
- configuration.setBindingsDirectory(getBindingsDir(node, false));
- configuration.setJournalMinFiles(2);
- configuration.setJournalDirectory(getJournalDir(node, false));
- configuration.setJournalFileSize(100 * 1024);
- configuration.setJournalType(getDefaultJournalType());
configuration.setJournalMaxIO_AIO(1000);
- configuration.setPagingDirectory(getPageDir(node, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, false));
configuration.setClustered(true);
configuration.setBackup(false);
@@ -1844,25 +1683,9 @@
throw new IllegalArgumentException("Already a server at node " +
node);
}
- Configuration configuration = createBasicConfig();
+ Configuration configuration = createBasicConfig(sharedStorage ? liveNode : node);
- configuration.setSecurityEnabled(false);
configuration.setSharedStore(sharedStorage);
- if (sharedStorage)
- {
- // Shared storage will share the node between the backup and live node
- configuration.setBindingsDirectory(getBindingsDir(liveNode, false));
- configuration.setJournalDirectory(getJournalDir(liveNode, false));
- configuration.setPagingDirectory(getPageDir(liveNode, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(liveNode, false));
- }
- else
- {
- configuration.setBindingsDirectory(getBindingsDir(node, true));
- configuration.setJournalDirectory(getJournalDir(node, true));
- configuration.setPagingDirectory(getPageDir(node, true));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, true));
- }
configuration.setClustered(true);
configuration.setBackup(true);
@@ -1898,28 +1721,14 @@
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
HornetQServer server;
- if (fileStorage)
+ if (sharedStorage)
{
- if (sharedStorage)
- {
- server = createInVMFailoverServer(true, configuration,
nodeManagers[liveNode], liveNode);
- }
- else
- {
- server = HornetQServers.newHornetQServer(configuration);
- server.setIdentity("Server " + liveNode);
- }
+ server = createInVMFailoverServer(fileStorage, configuration,
nodeManagers[liveNode], liveNode);
}
else
{
- if (sharedStorage)
- {
- server = createInVMFailoverServer(false, configuration,
nodeManagers[liveNode], liveNode);
- }
- else
- {
- server = HornetQServers.newHornetQServer(configuration, false);
- }
+ boolean enablePersistency = fileStorage ? configuration.isPersistenceEnabled() :
false;
+ server = HornetQServers.newHornetQServer(configuration, enablePersistency);
}
servers[node] = server;
}