Author: borges
Date: 2011-11-18 05:46:13 -0500 (Fri, 18 Nov 2011)
New Revision: 11705
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
Log:
Use a single createServer(configuration) method
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -251,7 +251,7 @@
ClusterConnectionConfiguration cccLive = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
staticConnectors, false);
backupConfig.getClusterConfigurations().add(cccLive);
- backupServer = createBackupServer();
+ backupServer = createServer(backupConfig);
liveConfig = super.createDefaultConfig();
liveConfig.getAcceptorConfigurations().clear();
@@ -267,7 +267,7 @@
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
- liveServer = createLiveServer();
+ liveServer = createServer(liveConfig);
}
@Override
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -162,7 +162,7 @@
staticConnectors, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupConfig.setAllowAutoFailBack(false);
- backupServer = createBackupServer();
+ backupServer = createServer(backupConfig);
liveConfig = super.createDefaultConfig();
liveConfig.getAcceptorConfigurations().clear();
@@ -178,7 +178,7 @@
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
liveConfig.setAllowAutoFailBack(false);
- liveServer = createLiveServer();
+ liveServer = createServer(liveConfig);
}
@Override
@@ -246,6 +246,7 @@
* @param message
* @throws Exception
*/
+ @Override
protected void setBody(final int i, final ClientMessage message) throws Exception
{
message.getBodyBuffer().writeString("message" + i);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -128,16 +128,12 @@
}
}
- protected TestableServer createLiveServer()
+ protected TestableServer createServer(Configuration config)
{
- return new SameProcessHornetQServer(createInVMFailoverServer(true, liveConfig,
nodeManager, 1));
+ return new SameProcessHornetQServer(
+ createInVMFailoverServer(true, config,
nodeManager, config.isBackup() ? 2 : 1));
}
- protected TestableServer createBackupServer()
- {
- return new SameProcessHornetQServer(createInVMFailoverServer(true, backupConfig,
nodeManager, 2));
- }
-
/**
* Large message version of {@link #setBody(int, ClientMessage)}.
* @param i
@@ -189,7 +185,7 @@
backupConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
ReplicatedBackupUtils.createClusterConnectionConf(backupConfig,
backupConnector.getName(),
liveConnector.getName());
- backupServer = createBackupServer();
+ backupServer = createServer(backupConfig);
liveConfig = super.createDefaultConfig();
liveConfig.getAcceptorConfigurations().clear();
@@ -199,11 +195,13 @@
liveConfig.setClustered(true);
ReplicatedBackupUtils.createClusterConnectionConf(liveConfig,
liveConnector.getName());
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
- liveServer = createLiveServer();
+ liveServer = createServer(liveConfig);
}
- protected void createReplicatedConfigs() throws Exception
+ protected void createReplicatedConfigs()
{
+ nodeManager = new InVMNodeManager();
+
final TransportConfiguration liveConnector =
getConnectorTransportConfiguration(true);
final TransportConfiguration backupConnector =
getConnectorTransportConfiguration(false);
final TransportConfiguration backupAcceptor =
getAcceptorTransportConfiguration(false);
@@ -215,18 +213,18 @@
ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector,
backupAcceptor, liveConfig,
liveConnector);
- backupConfig.setBindingsDirectory(backupConfig.getBindingsDirectory() +
"_backup");
- backupConfig.setJournalDirectory(backupConfig.getJournalDirectory() +
"_backup");
- backupConfig.setPagingDirectory(backupConfig.getPagingDirectory() +
"_backup");
- backupConfig.setLargeMessagesDirectory(backupConfig.getLargeMessagesDirectory() +
"_backup");
+ final String sufix = "_backup";
+ backupConfig.setBindingsDirectory(backupConfig.getBindingsDirectory() + sufix);
+ backupConfig.setJournalDirectory(backupConfig.getJournalDirectory() + sufix);
+ backupConfig.setPagingDirectory(backupConfig.getPagingDirectory() + sufix);
+ backupConfig.setLargeMessagesDirectory(backupConfig.getLargeMessagesDirectory() +
sufix);
backupConfig.setSecurityEnabled(false);
- backupServer = createBackupServer();
+ backupServer = createServer(backupConfig);
liveConfig.getAcceptorConfigurations().clear();
liveConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
-
- liveServer = createLiveServer();
+ liveServer = createServer(liveConfig);
}
@Override
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -13,6 +13,7 @@
package org.hornetq.tests.integration.cluster.failover;
+import org.hornetq.core.config.Configuration;
import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
import org.hornetq.tests.integration.cluster.util.TestableServer;
@@ -24,40 +25,15 @@
public class NettyReplicatedFailoverTest extends NettyFailoverTest
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
@Override
- protected TestableServer createLiveServer()
+ protected TestableServer createServer(Configuration config)
{
- return new SameProcessHornetQServer(createServer(true, liveConfig));
+ return new SameProcessHornetQServer(createServer(true, config));
}
@Override
- protected TestableServer createBackupServer()
- {
- return new SameProcessHornetQServer(createServer(true, backupConfig));
- }
-
- @Override
protected void createConfigs() throws Exception
{
createReplicatedConfigs();
}
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -220,17 +220,11 @@
}
@Override
- protected TestableServer createBackupServer()
+ protected TestableServer createServer(Configuration config)
{
- return new SameProcessHornetQServer(createServer(true, backupConfig));
+ return new SameProcessHornetQServer(createServer(true, config));
}
- @Override
- protected TestableServer createLiveServer()
- {
- return new SameProcessHornetQServer(createServer(true, liveConfig));
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -82,23 +82,22 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ e.printStackTrace();
}
}
}
@Override
- protected TestableServer createLiveServer()
+ protected TestableServer createServer(Configuration config)
{
+ if (config.isBackup())
+ {
+ return new SameProcessHornetQServer(HornetQServers.newHornetQServer(config));
+ }
return new
RemoteProcessHornetQServer(SharedLiveServerConfiguration.class.getName());
}
-
+
@Override
- protected TestableServer createBackupServer()
- {
- return new
SameProcessHornetQServer(HornetQServers.newHornetQServer(backupConfig));
- }
-
protected TransportConfiguration getConnectorTransportConfiguration(final boolean
live) {
Map<String, Object> params = null;
if (live)
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -13,8 +13,6 @@
package org.hornetq.tests.integration.cluster.failover;
-import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
-import org.hornetq.tests.integration.cluster.util.TestableServer;
/**
* A ReplicatedAsynchronousFailoverTest
@@ -23,20 +21,7 @@
*/
public class ReplicatedAsynchronousFailoverTest extends AsynchronousFailoverTest
{
-
@Override
- protected TestableServer createLiveServer()
- {
- return new SameProcessHornetQServer(createInVMFailoverServer(true, liveConfig,
nodeManager, 1));
- }
-
- @Override
- protected TestableServer createBackupServer()
- {
- return new SameProcessHornetQServer(createInVMFailoverServer(true, backupConfig,
nodeManager, 2));
- }
-
- @Override
protected void createConfigs() throws Exception
{
createReplicatedConfigs();
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-11-18
10:45:54 UTC (rev 11704)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-11-18
10:46:13 UTC (rev 11705)
@@ -22,7 +22,6 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.config.ClusterConnectionConfiguration;
-import org.hornetq.core.config.Configuration;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.impl.InVMNodeManager;
import org.hornetq.spi.core.security.HornetQSecurityManager;
@@ -67,6 +66,7 @@
ackBatchSize);
}
+ @Override
protected ClientSession createSession(ClientSessionFactory sf,
boolean autoCommitSends,
boolean autoCommitAcks,
@@ -76,16 +76,19 @@
.isPreAcknowledge(), ackBatchSize);
}
+ @Override
protected ClientSession createSession(ClientSessionFactory sf, boolean
autoCommitSends, boolean autoCommitAcks) throws Exception
{
return createSession(sf, autoCommitSends, autoCommitAcks,
sf.getServerLocator().getAckBatchSize());
}
+ @Override
protected ClientSession createSession(ClientSessionFactory sf) throws Exception
{
return createSession(sf, true, true, sf.getServerLocator().getAckBatchSize());
}
+ @Override
protected ClientSession createSession(ClientSessionFactory sf,
boolean xa,
boolean autoCommitSends,
@@ -97,6 +100,7 @@
/**
* @throws Exception
*/
+ @Override
protected void createConfigs() throws Exception
{
nodeManager = new InVMNodeManager();
@@ -125,7 +129,7 @@
staticConnectors,
false);
backupConfig.getClusterConfigurations().add(cccLive);
- backupServer = createBackupServer();
+ backupServer = createServer(backupConfig);
HornetQSecurityManager securityManager = installSecurity(backupServer);
@@ -150,11 +154,12 @@
false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
- liveServer = createLiveServer();
+ liveServer = createServer(liveConfig);
installSecurity(liveServer);
}
+ @Override
protected void beforeRestart(TestableServer server)
{
installSecurity(server);