JBoss hornetq SVN: r9658 - in branches/Branch_2_1: src/main/org/hornetq/core/transaction and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-08 18:11:16 -0400 (Wed, 08 Sep 2010)
New Revision: 9658
Modified:
branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java
branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
Log:
HORNETQ-502 fixing a test
Modified: branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2010-09-08 19:40:33 UTC (rev 9657)
+++ branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2010-09-08 22:11:16 UTC (rev 9658)
@@ -612,6 +612,7 @@
else
{
Transaction tx = context.getTransaction();
+
boolean depage = tx.getProperty(TransactionPropertyIndexes.IS_DEPAGE) != null;
// if the TX paged at least one message on a give address, all the other addresses should also go towards paging cache now
@@ -1243,7 +1244,15 @@
{
subTX = tx.copy();
}
+
route(message, subTX, false);
+
+ if (subTX.isContainsPersistent())
+ {
+ // The route wouldn't be able to update the persistent flag on the main TX
+ // If we don't do this we would eventually miss a commit record
+ tx.setContainsPersistent();
+ }
}
}
Modified: branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java 2010-09-08 19:40:33 UTC (rev 9657)
+++ branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java 2010-09-08 22:11:16 UTC (rev 9658)
@@ -72,6 +72,8 @@
Object getProperty(int index);
void setContainsPersistent();
+
+ boolean isContainsPersistent();
void setTimeout(int timeout);
Modified: branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2010-09-08 19:40:33 UTC (rev 9657)
+++ branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2010-09-08 22:11:16 UTC (rev 9658)
@@ -131,6 +131,11 @@
{
containsPersistent = true;
}
+
+ public boolean isContainsPersistent()
+ {
+ return containsPersistent;
+ }
public void setTimeout(final int timeout)
{
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-09-08 19:40:33 UTC (rev 9657)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-09-08 22:11:16 UTC (rev 9658)
@@ -339,6 +339,15 @@
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#isContainsPersistent()
+ */
+ public boolean isContainsPersistent()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
class FakeMessage implements ServerMessage
14 years, 3 months
JBoss hornetq SVN: r9657 - in branches/Branch_2_1: src/main/org/hornetq/core/transaction and 3 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-08 15:40:33 -0400 (Wed, 08 Sep 2010)
New Revision: 9657
Modified:
branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java
branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/PagingTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
Log:
HORNETQ-502 Fixing out of order during paging and transactions
Modified: branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2010-09-08 19:17:54 UTC (rev 9656)
+++ branches/Branch_2_1/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2010-09-08 19:40:33 UTC (rev 9657)
@@ -613,10 +613,18 @@
{
Transaction tx = context.getTransaction();
boolean depage = tx.getProperty(TransactionPropertyIndexes.IS_DEPAGE) != null;
-
- if (!depage && message.storeIsPaging())
+
+ // if the TX paged at least one message on a give address, all the other addresses should also go towards paging cache now
+ boolean alreadyPaging = false;
+
+ if (tx.isPaging())
{
-
+ alreadyPaging = getPageOperation(tx).isPaging(message.getAddress());
+ }
+
+ if (!depage && message.storeIsPaging() || alreadyPaging)
+ {
+ tx.setPaging(true);
getPageOperation(tx).addMessageToPage(message);
if (startedTx)
{
@@ -1104,12 +1112,20 @@
{
private final List<ServerMessage> messagesToPage = new ArrayList<ServerMessage>();
+ private final HashSet<SimpleString> addressesPaging = new HashSet<SimpleString>();
+
private Transaction subTX = null;
void addMessageToPage(final ServerMessage message)
{
messagesToPage.add(message);
+ addressesPaging.add(message.getAddress());
}
+
+ boolean isPaging(final SimpleString address)
+ {
+ return addressesPaging.contains(address);
+ }
public void afterCommit(final Transaction tx)
{
Modified: branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java 2010-09-08 19:17:54 UTC (rev 9656)
+++ branches/Branch_2_1/src/main/org/hornetq/core/transaction/Transaction.java 2010-09-08 19:40:33 UTC (rev 9657)
@@ -60,6 +60,12 @@
void removeOperation(TransactionOperation sync);
boolean hasTimedOut(long currentTime, int defaultTimeout);
+
+ /** We don't want to look on operations at every send, so we keep the paging attribute and will only look at
+ * the PagingOperation case this attribute is true*/
+ boolean isPaging();
+
+ void setPaging(boolean paging);
void putProperty(int index, Object property);
Modified: branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2010-09-08 19:17:54 UTC (rev 9656)
+++ branches/Branch_2_1/src/main/org/hornetq/core/transaction/impl/TransactionImpl.java 2010-09-08 19:40:33 UTC (rev 9657)
@@ -47,6 +47,8 @@
private final Xid xid;
private final long id;
+
+ private boolean paging = false;
private volatile State state = State.ACTIVE;
@@ -352,7 +354,17 @@
{
this.state = state;
}
+
+ public boolean isPaging()
+ {
+ return paging;
+ }
+ public void setPaging(boolean paging)
+ {
+ this.paging = paging;
+ }
+
public Xid getXid()
{
return xid;
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-09-08 19:17:54 UTC (rev 9656)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-09-08 19:40:33 UTC (rev 9657)
@@ -685,6 +685,133 @@
}
+ public void testDepageDuringTransaction3() throws Exception
+ {
+ clearData();
+
+ Configuration config = createDefaultConfig();
+
+ HornetQServer server = createServer(true,
+ config,
+ PagingTest.PAGE_SIZE,
+ PagingTest.PAGE_MAX,
+ new HashMap<String, AddressSettings>());
+
+ server.start();
+
+ final int messageSize = 1024; // 1k
+
+ try
+ {
+ ClientSessionFactory sf = createInVMFactory();
+
+ sf.setBlockOnNonDurableSend(true);
+ sf.setBlockOnDurableSend(true);
+ sf.setBlockOnAcknowledge(true);
+
+ byte[] body = new byte[messageSize];
+
+ ClientSession sessionTransacted = sf.createSession(null, null, false, false, false, false, 0);
+ ClientProducer producerTransacted = sessionTransacted.createProducer(PagingTest.ADDRESS);
+
+ ClientSession sessionNonTX = sf.createSession(true, true, 0);
+ sessionNonTX.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
+
+ ClientProducer producerNonTransacted = sessionNonTX.createProducer(PagingTest.ADDRESS);
+
+ sessionNonTX.start();
+
+ for (int i = 0; i < 50; i++)
+ {
+ System.out.println("Sending " + i);
+ ClientMessage message = sessionNonTX.createMessage(true);
+ message.getBodyBuffer().writeBytes(body);
+ message.putIntProperty(new SimpleString("id"), i);
+
+ producerTransacted.send(message);
+
+ if (i % 2 == 0)
+ {
+ System.out.println("Sending 20 msgs to make it page");
+ for (int j = 0 ; j < 20; j++)
+ {
+ ClientMessage msgSend = sessionNonTX.createMessage(true);
+ msgSend.getBodyBuffer().writeBytes(new byte[10 * 1024]);
+ producerNonTransacted.send(msgSend);
+ }
+ assertTrue(server.getPostOffice().getPagingManager().getPageStore(PagingTest.ADDRESS).isPaging());
+ }
+ else
+ {
+ System.out.println("Consuming 20 msgs to make it page");
+ ClientConsumer consumer = sessionNonTX.createConsumer(PagingTest.ADDRESS);
+ for (int j = 0 ; j < 20; j++)
+ {
+ ClientMessage msgReceived = consumer.receive(10000);
+ assertNotNull(msgReceived);
+ msgReceived.acknowledge();
+ }
+ consumer.close();
+ }
+ }
+
+ ClientConsumer consumerNonTX = sessionNonTX.createConsumer(PagingTest.ADDRESS);
+ while (true)
+ {
+ ClientMessage msgReceived = consumerNonTX.receive(1000);
+ if (msgReceived == null)
+ {
+ break;
+ }
+ msgReceived.acknowledge();
+ }
+ consumerNonTX.close();
+
+
+ ClientConsumer consumer = sessionNonTX.createConsumer(PagingTest.ADDRESS);
+
+ Assert.assertNull(consumer.receiveImmediate());
+
+ sessionTransacted.commit();
+
+ sessionTransacted.close();
+
+ for (int i = 0; i < 50; i++)
+ {
+ ClientMessage message = consumer.receive(PagingTest.RECEIVE_TIMEOUT);
+
+ Assert.assertNotNull(message);
+
+ Integer messageID = (Integer)message.getObjectProperty(new SimpleString("id"));
+
+ // System.out.println(messageID);
+ Assert.assertNotNull(messageID);
+ Assert.assertEquals("message received out of order", i, messageID.intValue());
+
+ System.out.println("MessageID = " + messageID);
+
+ message.acknowledge();
+ }
+
+ Assert.assertNull(consumer.receiveImmediate());
+
+ consumer.close();
+
+ sessionNonTX.close();
+ }
+ finally
+ {
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+
+ }
+
public void testPageOnSchedulingNoRestart() throws Exception
{
internalTestPageOnScheduling(false);
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-09-08 19:17:54 UTC (rev 9656)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-09-08 19:40:33 UTC (rev 9657)
@@ -321,6 +321,24 @@
{
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#isPaging()
+ */
+ public boolean isPaging()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.transaction.Transaction#setPaging(boolean)
+ */
+ public void setPaging(boolean paging)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
class FakeMessage implements ServerMessage
14 years, 3 months
JBoss hornetq SVN: r9656 - branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-08 15:17:54 -0400 (Wed, 08 Sep 2010)
New Revision: 9656
Modified:
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
Log:
tweak
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-09-08 16:21:01 UTC (rev 9655)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-09-08 19:17:54 UTC (rev 9656)
@@ -187,7 +187,7 @@
final AtomicInteger errors = new AtomicInteger(0);
- final int TOTAL_MESSAGES = 10000;
+ final int TOTAL_MESSAGES = 1000;
// Consumer will be ready after we have commits
final CountDownLatch ready = new CountDownLatch(1);
@@ -241,8 +241,6 @@
Assert.assertNotNull(msg);
- System.out.println("i = " + i);
-
assertEquals(i, msg.getIntProperty("count").intValue());
msg.acknowledge();
14 years, 3 months
JBoss hornetq SVN: r9655 - branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-08 12:21:01 -0400 (Wed, 08 Sep 2010)
New Revision: 9655
Modified:
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
Log:
Adding new test on paging and ordering
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-09-08 11:30:24 UTC (rev 9654)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-09-08 16:21:01 UTC (rev 9655)
@@ -13,6 +13,10 @@
package org.hornetq.tests.integration.paging;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
@@ -58,7 +62,7 @@
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(10 * 1024);
- defaultSetting.setMaxSizeBytes(100 * 1024);
+ defaultSetting.setMaxSizeBytes(20 * 1024);
server.getAddressSettingsRepository().addMatch("#", defaultSetting);
@@ -155,6 +159,115 @@
}
}
+ public void testOrderOverTX() throws Exception
+ {
+ HornetQServer server = newHornetQServer();
+
+ server.start();
+
+ try
+ {
+ ClientSessionFactory sf;
+
+ if (isNetty())
+ {
+ sf = createNettyFactory();
+ }
+ else
+ {
+ sf = createInVMFactory();
+ }
+
+ ClientSession sessionConsumer = sf.createSession(true, true, 0);
+
+ sessionConsumer.createQueue(PagingSendTest.ADDRESS, PagingSendTest.ADDRESS, null, true);
+
+ final ClientSession sessionProducer = sf.createSession(false, false);
+ final ClientProducer producer = sessionProducer.createProducer(PagingSendTest.ADDRESS);
+
+ final AtomicInteger errors = new AtomicInteger(0);
+
+ final int TOTAL_MESSAGES = 10000;
+
+ // Consumer will be ready after we have commits
+ final CountDownLatch ready = new CountDownLatch(1);
+
+ Thread tProducer = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ int commit = 0;
+ for (int i = 0; i < TOTAL_MESSAGES; i++)
+ {
+ ClientMessage msg = sessionProducer.createMessage(true);
+ msg.getBodyBuffer().writeBytes(new byte[1024]);
+ msg.putIntProperty("count", i);
+ producer.send(msg);
+
+ if (i % 100 == 0 && i > 0)
+ {
+ sessionProducer.commit();
+ if (commit++ > 2)
+ {
+ ready.countDown();
+ }
+ }
+ }
+
+ sessionProducer.commit();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ errors.incrementAndGet();
+ }
+ }
+ };
+
+ ClientConsumer consumer = sessionConsumer.createConsumer(PagingSendTest.ADDRESS);
+
+ sessionConsumer.start();
+
+ tProducer.start();
+
+ assertTrue(ready.await(10, TimeUnit.SECONDS));
+
+ for (int i = 0; i < TOTAL_MESSAGES; i++)
+ {
+ ClientMessage msg = consumer.receive(10000);
+
+ Assert.assertNotNull(msg);
+
+ System.out.println("i = " + i);
+
+ assertEquals(i, msg.getIntProperty("count").intValue());
+
+ msg.acknowledge();
+ }
+
+ tProducer.join();
+
+ sessionConsumer.close();
+
+ sessionProducer.close();
+
+ assertEquals(0, errors.get());
+ }
+ finally
+ {
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
14 years, 3 months
JBoss hornetq SVN: r9654 - in branches/2_2_0_HA_Improvements: src/main/org/hornetq/core/server/cluster/impl and 2 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-09-08 07:30:24 -0400 (Wed, 08 Sep 2010)
New Revision: 9654
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupFailoverTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
Log:
fixed topology and changed startup order in cluster manager
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-09-07 22:46:19 UTC (rev 9653)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-09-08 11:30:24 UTC (rev 9654)
@@ -69,7 +69,7 @@
currentMember.getConnector().a = member.getConnector().a;
replaced = true;
}
- if(hasChanged(currentMember.getConnector().b, member.getConnector().b))
+ if(hasChanged(currentMember.getConnector().b, member.getConnector().b) && member.getConnector().b != null)
{
if(currentMember.getConnector().b == null)
{
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-07 22:46:19 UTC (rev 9653)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-08 11:30:24 UTC (rev 9654)
@@ -133,6 +133,8 @@
this.serverLocator.setClusterConnection(true);
this.serverLocator.setClusterTransportConfiguration(connector);
this.serverLocator.setBackup(server.getConfiguration().isBackup());
+ this.serverLocator.setReconnectAttempts(-1);
+ this.serverLocator.setRetryInterval(retryInterval);
// a cluster connection will connect to other nodes only if they are directly connected
// through a static list of connectors
@@ -334,6 +336,7 @@
// discard notifications about ourselves
if (nodeID.equals(nodeUUID.toString()))
{
+ server.getClusterManager().notifyNodeUp(nodeID, connectorPair, last, distance);
return;
}
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-09-07 22:46:19 UTC (rev 9653)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-09-08 11:30:24 UTC (rev 9654)
@@ -401,6 +401,42 @@
backupSessionFactory = null;
}
+ for (BroadcastGroup broadcastGroup : broadcastGroups.values())
+ {
+ try
+ {
+ broadcastGroup.start();
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to start broadcast group " + broadcastGroup.getName(), e);
+ }
+ }
+
+ for (ClusterConnection clusterConnection : clusterConnections.values())
+ {
+ try
+ {
+ clusterConnection.start();
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to start cluster connection " + clusterConnection.getName(), e);
+ }
+ }
+
+ for (Bridge bridge : bridges.values())
+ {
+ try
+ {
+ bridge.start();
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to start bridge " + bridge.getName(), e);
+ }
+ }
+
if (clusterConnections.size() > 0)
{
announceNode();
@@ -509,7 +545,10 @@
managementService.registerBroadcastGroup(group, config);
- group.start();
+ if (!backup)
+ {
+ group.start();
+ }
}
private void logWarnNoConnector(final String connectorName, final String bgName)
@@ -658,7 +697,10 @@
managementService.registerBridge(bridge, config);
- bridge.start();
+ if (!backup)
+ {
+ bridge.start();
+ }
}
private synchronized void deployClusterConnection(final ClusterConnectionConfiguration config) throws Exception
@@ -739,7 +781,10 @@
clusterConnections.put(config.getName(), clusterConnection);
- clusterConnection.start();
+ if (!backup)
+ {
+ clusterConnection.start();
+ }
}
private Transformer instantiateTransformer(final String transformerClassName)
@@ -762,4 +807,10 @@
}
return transformer;
}
+ //for testing
+ public void clear()
+ {
+ bridges.clear();
+ clusterConnections.clear();
+ }
}
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupFailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupFailoverTest.java 2010-09-07 22:46:19 UTC (rev 9653)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupFailoverTest.java 2010-09-08 11:30:24 UTC (rev 9654)
@@ -51,33 +51,23 @@
super.setUp();
clearData();
FakeLockFile.clearLocks();
- servers.ensureCapacity(5);
- createConfigs();
+ }
+ public void testMultipleFailovers() throws Exception
+ {
+ createLiveConfig(0);
+ createBackupConfig(0, 1,false, 0, 2, 3, 4, 5);
+ createBackupConfig(0, 2,false, 0, 1, 3, 4, 5);
+ createBackupConfig(0, 3,false, 0, 1, 2, 4, 5);
+ createBackupConfig(0, 4, false, 0, 1, 2, 3, 4);
+ createBackupConfig(0, 5, false, 0, 1, 2, 3, 4);
servers.get(1).start();
servers.get(2).start();
servers.get(3).start();
servers.get(4).start();
servers.get(5).start();
servers.get(0).start();
- }
- /**
- * @throws Exception
- */
- protected void createConfigs() throws Exception
- {
-
- createLiveConfig(0);
- createBackupConfig(1, 0, 2, 3, 4, 5);
- createBackupConfig(2, 0, 1, 3, 4, 5);
- createBackupConfig(3, 0, 1, 2, 4, 5);
- createBackupConfig(4, 0, 1, 2, 3, 4);
- createBackupConfig(5, 0, 1, 2, 3, 4);
- }
-
- public void test() throws Exception
- {
ServerLocator locator = getServerLocator(0);
locator.setBlockOnNonDurableSend(true);
@@ -111,12 +101,51 @@
fail(backupNode, session);
session.close();
backupNode = waitForBackup(5);
- session = sendAndConsume(sf, false);
+ session = sendAndConsume(sf, false);
session.close();
servers.get(backupNode).stop();
System.out.println("MultipleBackupFailoverTest.test");
}
+ public void testMultipleFailovers2liveservers() throws Exception
+ {
+ createLiveConfig(0, 3);
+ createBackupConfig(0, 1, true, 0, 3);
+ createBackupConfig(0, 2,true, 0, 3);
+ createLiveConfig(3, 0);
+ createBackupConfig(3, 4, true,0, 3);
+ createBackupConfig(3, 5, true,0, 3);
+ servers.get(1).start();
+ servers.get(2).start();
+ servers.get(0).start();
+ servers.get(4).start();
+ servers.get(5).start();
+ servers.get(3).start();
+ ServerLocator locator = getServerLocator(0);
+
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ locator.setReconnectAttempts(-1);
+ ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 4);
+ ClientSession session = sendAndConsume(sf, true);
+
+ fail(0, session);
+
+ ServerLocator locator2 = getServerLocator(3);
+ locator2.setBlockOnNonDurableSend(true);
+ locator2.setBlockOnDurableSend(true);
+ locator2.setBlockOnAcknowledge(true);
+ locator2.setReconnectAttempts(-1);
+ ClientSessionFactoryInternal sf2 = createSessionFactoryAndWaitForTopology(locator2, 4);
+ ClientSession session2 = sendAndConsume(sf2, true);
+ fail(3, session2);
+ servers.get(2).stop();
+ servers.get(4).stop();
+ servers.get(1).stop();
+ servers.get(3).stop();
+ }
+
protected void fail(int node, final ClientSession... sessions) throws Exception
{
servers.get(node).crash(sessions);
@@ -126,12 +155,12 @@
{
long time = System.currentTimeMillis();
long toWait = seconds * 1000;
- while(true)
+ while (true)
{
for (int i = 0, serversSize = servers.size(); i < serversSize; i++)
{
TestableServer backupServer = servers.get(i);
- if(backupServer.isInitialised())
+ if (backupServer.isInitialised())
{
return i;
}
@@ -144,7 +173,7 @@
{
//ignore
}
- if(System.currentTimeMillis() > (time + toWait))
+ if (System.currentTimeMillis() > (time + toWait))
{
fail("backup server never started");
}
@@ -152,7 +181,7 @@
}
- private void createBackupConfig(int nodeid, int... nodes)
+ private void createBackupConfig(int liveNode, int nodeid, boolean createClusterConnections, int... nodes)
{
Configuration config1 = super.createDefaultConfig();
config1.getAcceptorConfigurations().clear();
@@ -172,15 +201,22 @@
TransportConfiguration backupConnector = getConnectorTransportConfiguration(nodeid);
List<String> pairs = null;
ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1,
- pairs);
+ createClusterConnections? staticConnectors:pairs);
config1.getClusterConfigurations().add(ccc1);
BackupConnectorConfiguration connectorConfiguration = new BackupConnectorConfiguration(staticConnectors, backupConnector.getName());
config1.setBackupConnectorConfiguration(connectorConfiguration);
config1.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
+
+
+ config1.setBindingsDirectory(config1.getBindingsDirectory() + "_" + liveNode);
+ config1.setJournalDirectory(config1.getJournalDirectory() + "_" + liveNode);
+ config1.setPagingDirectory(config1.getPagingDirectory() + "_" + liveNode);
+ config1.setLargeMessagesDirectory(config1.getLargeMessagesDirectory() + "_" + liveNode);
+
servers.add(new SameProcessHornetQServer(createFakeLockServer(true, config1)));
}
- public void createLiveConfig(int liveNode)
+ public void createLiveConfig(int liveNode, int ... otherLiveNodes)
{
TransportConfiguration liveConnector = getConnectorTransportConfiguration(liveNode);
Configuration config0 = super.createDefaultConfig();
@@ -189,13 +225,27 @@
config0.setSecurityEnabled(false);
config0.setSharedStore(true);
config0.setClustered(true);
- List<String> pairs = null;
+ List<String> pairs = new ArrayList<String>();
+ for (int node : otherLiveNodes)
+ {
+ TransportConfiguration otherLiveConnector = getConnectorTransportConfiguration(node);
+ config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
+ pairs.add(otherLiveConnector.getName());
+
+ }
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs);
+ pairs);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
+
+ config0.setBindingsDirectory(config0.getBindingsDirectory() + "_" + liveNode);
+ config0.setJournalDirectory(config0.getJournalDirectory() + "_" + liveNode);
+ config0.setPagingDirectory(config0.getPagingDirectory() + "_" + liveNode);
+ config0.setLargeMessagesDirectory(config0.getLargeMessagesDirectory() + "_" + liveNode);
+
servers.add(new SameProcessHornetQServer(createFakeLockServer(true, config0)));
}
+
private TransportConfiguration getConnectorTransportConfiguration(int node)
{
HashMap<String, Object> map = new HashMap<String, Object>();
@@ -220,7 +270,8 @@
sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- assertTrue(countDownLatch.await(5, TimeUnit.SECONDS));
+ boolean ok = countDownLatch.await(5, TimeUnit.SECONDS);
+ assertTrue(ok);
return sf;
}
@@ -230,7 +281,7 @@
for (int i = 0, configsLength = configs.length; i < configsLength; i++)
{
HashMap<String, Object> map = new HashMap<String, Object>();
- map.put(TransportConstants.SERVER_ID_PROP_NAME, i);
+ map.put(TransportConstants.SERVER_ID_PROP_NAME, nodes[i]);
configs[i] = new TransportConfiguration(INVM_CONNECTOR_FACTORY, map);
}
@@ -253,10 +304,10 @@
for (int i = 0; i < numMessages; i++)
{
ClientMessage message = session.createMessage(HornetQTextMessage.TYPE,
- false,
- 0,
- System.currentTimeMillis(),
- (byte)1);
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte) 1);
message.putIntProperty(new SimpleString("count"), i);
message.getBodyBuffer().writeString("aardvarks");
producer.send(message);
@@ -283,6 +334,7 @@
return session;
}
+
class LatchClusterTopologyListener implements ClusterTopologyListener
{
final CountDownLatch latch;
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-09-07 22:46:19 UTC (rev 9653)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-09-08 11:30:24 UTC (rev 9654)
@@ -14,6 +14,7 @@
package org.hornetq.tests.integration.cluster.util;
import java.io.File;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -25,7 +26,11 @@
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
+import org.hornetq.core.client.impl.DelegatingSession;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.cluster.Bridge;
+import org.hornetq.core.server.cluster.ClusterManager;
+import org.hornetq.core.server.cluster.impl.ClusterManagerImpl;
import org.hornetq.core.server.cluster.impl.FakeLockFile;
import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
@@ -75,6 +80,7 @@
public void beforeReconnect(HornetQException exception)
{
+ System.out.println("MyListener.beforeReconnect");
}
}
for (ClientSession session : sessions)
@@ -87,11 +93,13 @@
remotingConnection.destroy();
server.getRemotingService().removeConnection(remotingConnection.getID());
}
+
+ ClusterManagerImpl clusterManager = (ClusterManagerImpl) server.getClusterManager();
+ clusterManager.clear();
server.stop();
-
// recreate the live.lock file (since it was deleted by the
// clean stop
- File lockFile = new File(ServiceTestBase.getJournalDir(), "live.lock");
+ File lockFile = new File(server.getConfiguration().getJournalDirectory(), "live.lock");
Assert.assertFalse(lockFile.exists());
lockFile.createNewFile();
14 years, 3 months
JBoss hornetq SVN: r9653 - branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-07 18:46:19 -0400 (Tue, 07 Sep 2010)
New Revision: 9653
Modified:
branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
Log:
fixing stress tests
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java 2010-09-07 19:21:34 UTC (rev 9652)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java 2010-09-07 22:46:19 UTC (rev 9653)
@@ -280,6 +280,8 @@
journal.forceMoveNextFile();
+ journal.checkReclaimStatus();
+
Thread.sleep(5000);
assertEquals(0, journal.getDataFilesCount());
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2010-09-07 19:21:34 UTC (rev 9652)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2010-09-07 22:46:19 UTC (rev 9653)
@@ -116,7 +116,11 @@
if (i % 2 == 0 && i > 0)
{
System.out.println("DataFiles = " + journal.getDataFilesCount());
+
journal.forceMoveNextFile();
+ journal.debugWait();
+ journal.checkReclaimStatus();
+
if (journal.getDataFilesCount() != 0)
{
System.out.println("DebugJournal:" + journal.debug());
14 years, 3 months
JBoss hornetq SVN: r9652 - branches/Branch_2_1.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-07 15:21:34 -0400 (Tue, 07 Sep 2010)
New Revision: 9652
Modified:
branches/Branch_2_1/.classpath
Log:
changing position of the new soak test
Modified: branches/Branch_2_1/.classpath
===================================================================
--- branches/Branch_2_1/.classpath 2010-09-07 19:15:37 UTC (rev 9651)
+++ branches/Branch_2_1/.classpath 2010-09-07 19:21:34 UTC (rev 9652)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
- <classpathentry kind="src" path="examples/soak/tx-restarts/src"/>
<classpathentry kind="src" path="src/config/common"/>
<classpathentry kind="src" path="build/src"/>
<classpathentry kind="src" path="tests/jms-tests/config"/>
@@ -95,6 +94,7 @@
<classpathentry kind="src" path="examples/javaee/servlet-transport/src"/>
<classpathentry kind="src" path="examples/javaee/xarecovery/src"/>
<classpathentry kind="src" path="examples/soak/normal/src"/>
+ <classpathentry kind="src" path="examples/soak/tx-restarts/src"/>
<classpathentry kind="lib" path="thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="lib" path="thirdparty/apache-logging/lib/commons-logging.jar"/>
<classpathentry kind="lib" path="thirdparty/apache-xerces/lib/xercesImpl.jar"/>
14 years, 3 months
JBoss hornetq SVN: r9651 - in branches/Branch_2_1: tests/src/org/hornetq/tests/integration/client and 6 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-09-07 15:15:37 -0400 (Tue, 07 Sep 2010)
New Revision: 9651
Modified:
branches/Branch_2_1/.classpath
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
Parameterizing UDP parameters for better hudson integration
Modified: branches/Branch_2_1/.classpath
===================================================================
--- branches/Branch_2_1/.classpath 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/.classpath 2010-09-07 19:15:37 UTC (rev 9651)
@@ -8,7 +8,7 @@
<classpathentry kind="src" path="tests/config"/>
<classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="trunk/native/bin"/>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="trunk-2_1/native/bin"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="tests/jms-tests/src"/>
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -53,9 +53,9 @@
{
private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
- private final String groupAddress = "230.1.2.3";
+ private final String groupAddress = getUDPDiscoveryAddress();
- private final int groupPort = 8765;
+ private final int groupPort = getUDPDiscoveryPort();
private HornetQServer liveService;
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -80,8 +80,8 @@
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
- final String groupAddress = "230.1.2.3";
- final int port = 7746;
+ final String groupAddress = getUDPDiscoveryAddress();
+ final int port = getUDPDiscoveryPort();
List<Pair<String, String>> connectorPairs = new ArrayList<Pair<String, String>>();
connectorPairs.add(new Pair<String, String>(server1tc.getName(), null));
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -28,9 +28,9 @@
{
private static final Logger log = Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
- protected static final String groupAddress = "230.1.2.3";
+ protected static final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = 6745;
+ protected static final int groupPort = getUDPDiscoveryPort();
protected boolean isNetty()
{
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -35,9 +35,9 @@
{
private static final Logger log = Logger.getLogger(DiscoveryClusterWithBackupFailoverTest.class);
- protected static final String groupAddress = "230.1.2.3";
+ protected static final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = 6745;
+ protected static final int groupPort = getUDPDiscoveryPort();
@Override
protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -53,16 +53,16 @@
{
private static final Logger log = Logger.getLogger(DiscoveryTest.class);
- private static final String address1 = "230.1.2.3";
+ private static final String address1 = getUDPDiscoveryAddress();
- private static final String address2 = "230.1.2.4";
+ private static final String address2 = getUDPDiscoveryAddress(1);
- private static final String address3 = "230.1.2.5";
+ private static final String address3 = getUDPDiscoveryAddress(2);
public void testSimpleBroadcast() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
final String nodeID = RandomUtil.randomString();
@@ -122,7 +122,7 @@
public void testSimpleBroadcastSpecificNIC() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
final String nodeID = RandomUtil.randomString();
@@ -222,7 +222,7 @@
public void testSimpleBroadcastWithStopStartDiscoveryGroup() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
final String nodeID = RandomUtil.randomString();
@@ -304,7 +304,7 @@
public void testIgnoreTrafficFromOwnNode() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
String nodeID = RandomUtil.randomString();
@@ -357,7 +357,7 @@
// public void testSimpleBroadcastDifferentAddress() throws Exception
// {
// final InetAddress groupAddress = InetAddress.getByName(address1);
- // final int groupPort = 6745;
+ // final int groupPort = getUDPDiscoveryPort();
// final int timeout = 500;
//
// BroadcastGroup bg = new BroadcastGroupImpl(randomString(), randomString(), null, -1, groupAddress, groupPort);
@@ -394,8 +394,8 @@
public void testSimpleBroadcastDifferentPort() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName("230.1.2.3");
- final int groupPort = 6745;
+ final InetAddress groupAddress = InetAddress.getByName(getUDPDiscoveryAddress());
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
@@ -417,7 +417,7 @@
bg.addConnectorPair(connectorPair);
- final int port2 = 6746;
+ final int port2 = getUDPDiscoveryPort(1);
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
@@ -442,7 +442,7 @@
public void testSimpleBroadcastDifferentAddressAndPort() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
@@ -465,7 +465,7 @@
bg.addConnectorPair(connectorPair);
final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
- final int port2 = 6746;
+ final int port2 = getUDPDiscoveryPort(1);
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
@@ -490,13 +490,13 @@
public void testMultipleGroups() throws Exception
{
final InetAddress groupAddress1 = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort1 = 6745;
+ final int groupPort1 = getUDPDiscoveryPort();
final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
- final int groupPort2 = 6746;
+ final int groupPort2 = getUDPDiscoveryPort(1);
final InetAddress groupAddress3 = InetAddress.getByName(DiscoveryTest.address3);
- final int groupPort3 = 6747;
+ final int groupPort3 = getUDPDiscoveryPort(2);
final int timeout = 500;
@@ -624,7 +624,7 @@
public void testBroadcastNullBackup() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
String nodeID = RandomUtil.randomString();
@@ -677,7 +677,7 @@
public void testDiscoveryListenersCalled() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
String nodeID = RandomUtil.randomString();
@@ -745,7 +745,7 @@
public void testConnectorsUpdatedMultipleBroadcasters() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
String node1 = RandomUtil.randomString();
@@ -1014,7 +1014,7 @@
public void testMultipleDiscoveryGroups() throws Exception
{
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
String nodeID = RandomUtil.randomString();
@@ -1105,7 +1105,7 @@
notifService.addNotificationListener(notifListener);
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
@@ -1144,7 +1144,7 @@
notifService.addNotificationListener(notifListener);
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort = 6745;
+ final int groupPort = getUDPDiscoveryPort();
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -51,9 +51,9 @@
{
private static final Logger log = Logger.getLogger(HornetQConnectionFactoryTest.class);
- private final String groupAddress = "230.1.2.3";
+ private final String groupAddress = getUDPDiscoveryAddress();
- private final int groupPort = 8765;
+ private final int groupPort = getUDPDiscoveryPort();
private HornetQServer liveService;
Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-09-07 19:15:37 UTC (rev 9651)
@@ -96,8 +96,36 @@
private final String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/hornetq-unit-test";
// Static --------------------------------------------------------
+
+
+ protected static String getUDPDiscoveryAddress()
+ {
+ return System.getProperty("TEST-UDP-ADDRESS", "230.10.20.1");
+ }
+
+ protected static String getUDPDiscoveryAddress(int variant)
+ {
+ String value = getUDPDiscoveryAddress();
+
+ int posPoint = value.lastIndexOf('.');
+
+ int last = Integer.valueOf( value.substring(posPoint + 1) );
+
+ return value.substring(0, posPoint + 1) + (last + variant);
+ }
+
+ public static int getUDPDiscoveryPort()
+ {
+ return Integer.parseInt(System.getProperty("TEST-UDP-PORT", "6750"));
+ }
+ public static int getUDPDiscoveryPort(final int variant)
+ {
+ return getUDPDiscoveryPort() + 1;
+ }
+
+
protected static JournalType getDefaultJournalType()
{
if (AsynchronousFileImpl.isLoaded())
14 years, 3 months
JBoss hornetq SVN: r9650 - branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-07 09:09:45 -0400 (Tue, 07 Sep 2010)
New Revision: 9650
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
Log:
fix the test by closing the locator at the end of the run
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-09-07 09:31:01 UTC (rev 9649)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-09-07 13:09:45 UTC (rev 9650)
@@ -226,6 +226,8 @@
Assert.assertEquals(0, sf.numSessions());
+ locator.close();
+
Assert.assertEquals(0, sf.numConnections());
if (i != numIts - 1)
14 years, 3 months
JBoss hornetq SVN: r9649 - branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-07 05:31:01 -0400 (Tue, 07 Sep 2010)
New Revision: 9649
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
Log:
fix test setup
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java 2010-09-06 15:51:38 UTC (rev 9648)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java 2010-09-07 09:31:01 UTC (rev 9649)
@@ -1244,9 +1244,9 @@
protected ClientSessionFactoryInternal createSessionFactory() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ locator.setReconnectAttempts(-1);
+ locator.setConfirmationWindowSize(1024 * 1024);
final ClientSessionFactory sf = locator.createSessionFactory();
- sf.getServerLocator().setReconnectAttempts(-1);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
return (ClientSessionFactoryInternal) sf;
}
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java 2010-09-06 15:51:38 UTC (rev 9648)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java 2010-09-07 09:31:01 UTC (rev 9649)
@@ -50,11 +50,10 @@
protected ClientSessionFactoryInternal createSessionFactory() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory")) ;
- final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setReconnectAttempts(-1);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
- sf.getServerLocator().setAckBatchSize(0);
- return sf;
+ locator.setReconnectAttempts(-1);
+ locator.setConfirmationWindowSize(1024 * 1024);
+ locator.setAckBatchSize(0);
+ return (ClientSessionFactoryInternal) locator.createSessionFactory();
}
}
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-09-06 15:51:38 UTC (rev 9648)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-09-07 09:31:01 UTC (rev 9649)
@@ -82,11 +82,11 @@
server.start();
ServerLocator locator = createFactory(isNetty);
+ locator.setReconnectAttempts(-1);
+ locator.setConfirmationWindowSize(100 * 1024 * 1024);
+ locator.setBlockOnNonDurableSend(false);
+ locator.setBlockOnAcknowledge(false);
ClientSessionFactory sf = locator.createSessionFactory();
- sf.getServerLocator().setReconnectAttempts(-1);
- sf.getServerLocator().setConfirmationWindowSize(100 * 1024 * 1024);
- sf.getServerLocator().setBlockOnNonDurableSend(false);
- sf.getServerLocator().setBlockOnAcknowledge(false);
final ClientSession session = sf.createSession(false, true, true);
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-09-06 15:51:38 UTC (rev 9648)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-09-07 09:31:01 UTC (rev 9649)
@@ -73,13 +73,12 @@
final int reconnectAttempts = 1;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -151,13 +150,12 @@
final int reconnectAttempts = -1;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -242,13 +240,12 @@
final long asyncFailDelay = 2000;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
ClientSession session2 = sf.createSession(false, true, true);
@@ -357,13 +354,12 @@
final int reconnectAttempts = 3;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -448,13 +444,12 @@
final int reconnectAttempts = -1;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
session = sf.createSession();
final RemotingConnection connFailure = ((ClientSessionInternal)session).getConnection();
@@ -559,13 +554,12 @@
final int reconnectAttempts = -1;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
InVMConnector.failOnCreateConnection = true;
int numberOfThreads = 100;
@@ -658,13 +652,12 @@
final int reconnectAttempts = -1;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
// Sleep 3 times retryInterval, so it should at least have 3 retries
@@ -731,13 +724,12 @@
final int reconnectAttempts = 10;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -799,13 +791,13 @@
final int reconnectAttempts = -1;
+
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -892,13 +884,13 @@
final int reconnectAttempts = -1;
+
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
@@ -970,14 +962,13 @@
final long maxRetryInterval = 1000;
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setMaxRetryInterval(maxRetryInterval);
+ locator.setConfirmationWindowSize(1024 * 1024);
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
- sf.getServerLocator().setRetryInterval(retryInterval);
- sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
- sf.getServerLocator().setReconnectAttempts(reconnectAttempts);
- sf.getServerLocator().setMaxRetryInterval(maxRetryInterval);
- sf.getServerLocator().setConfirmationWindowSize(1024 * 1024);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false);
14 years, 3 months