[hornetq-commits] JBoss hornetq SVN: r10992 - in branches/HORNETQ-720_Replication/tests: unit-tests/src/test/java/org/hornetq/tests/util and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Jul 18 12:31:27 EDT 2011
Author: borges
Date: 2011-07-18 12:31:27 -0400 (Mon, 18 Jul 2011)
New Revision: 10992
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
Log:
Remove constants from ServiceTestBase as they just repeat values from UnitTestCase
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -250,17 +250,8 @@
final int numMessages = 10;
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session.createMessage(true);
+ sendMessages(session, producer, numMessages);
- setBody(i, message);
-
- message.putIntProperty("counter", i);
-
- producer.send(message);
- }
-
session.commit();
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
@@ -334,18 +325,8 @@
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
+ sendMessages(session, producer, NUM_MESSAGES);
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- ClientMessage message = session.createMessage(true);
-
- setBody(i, message);
-
- message.putIntProperty("counter", i);
-
- producer.send(message);
- }
-
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
session.start();
@@ -1885,25 +1866,6 @@
return TransportConfigurationUtils.getInVMConnector(live);
}
- /**
- * @param i
- * @param message
- */
- protected void assertMessageBody(final int i, final ClientMessage message)
- {
- Assert.assertEquals("message" + i, message.getBodyBuffer().readString());
- }
-
- /**
- * @param i
- * @param message
- * @throws Exception
- */
- protected void setBody(final int i, final ClientMessage message) throws Exception
- {
- message.getBodyBuffer().writeString("message" + i);
- }
-
protected void beforeRestart(TestableServer liveServer)
{
}
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -18,7 +18,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ServerLocatorInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.tests.util.UnitTestCase;
@@ -37,11 +36,11 @@
private static final Logger log = Logger.getLogger(LargeMessageFailoverTest.class);
-
+
private static final int MIN_LARGE_MESSAGE = 1024;
-
+
private static final int LARGE_MESSAGE_SIZE = MIN_LARGE_MESSAGE * 3;
-
+
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
@@ -53,7 +52,7 @@
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
-
+
/**
* @param name
*/
@@ -63,7 +62,7 @@
}
/**
- *
+ *
*/
public LargeMessageFailoverTest()
{
@@ -96,8 +95,9 @@
Assert.assertEquals("equal at " + j, buffer.readByte(), UnitTestCase.getSamplebyte(j));
}
}
-
+
+ @Override
protected ServerLocatorInternal getServerLocator() throws Exception
{
ServerLocator locator = super.getServerLocator();
Modified: branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -26,6 +26,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
@@ -62,14 +63,6 @@
// Attributes ----------------------------------------------------
- protected static final String INVM_ACCEPTOR_FACTORY = InVMAcceptorFactory.class.getCanonicalName();
-
- public static final String INVM_CONNECTOR_FACTORY = InVMConnectorFactory.class.getCanonicalName();
-
- protected static final String NETTY_ACCEPTOR_FACTORY = NettyAcceptorFactory.class.getCanonicalName();
-
- protected static final String NETTY_CONNECTOR_FACTORY = NettyConnectorFactory.class.getCanonicalName();
-
private final List<ServerLocator> locators = new ArrayList<ServerLocator>();
@Override
@@ -489,6 +482,44 @@
}
/**
+ * @param i
+ * @param message
+ * @throws Exception
+ */
+ protected void setBody(final int i, final ClientMessage message) throws Exception
+ {
+ message.getBodyBuffer().writeString("message" + i);
+ }
+
+ /**
+ * @param i
+ * @param message
+ */
+ protected void assertMessageBody(final int i, final ClientMessage message)
+ {
+ Assert.assertEquals("message" + i, message.getBodyBuffer().readString());
+ }
+
+ /**
+ * Send messages with pre-specified body.
+ * @param session
+ * @param producer
+ * @param numMessages
+ * @throws Exception
+ */
+ public void sendMessages(ClientSession session, ClientProducer producer, int numMessages) throws Exception
+ {
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createMessage(true);
+ setBody(i, message);
+ message.putIntProperty("counter", i);
+ producer.send(message);
+ }
+ }
+
+
+ /**
* Deleting a file on LargeDire is an asynchronous process. We need to keep looking for a while
* if the file hasn't been deleted yet.
*/
More information about the hornetq-commits
mailing list