Author: borges
Date: 2011-10-07 08:28:01 -0400 (Fri, 07 Oct 2011)
New Revision: 11496
Added:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java
Removed:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java
Modified:
branches/HORNETQ-720_Replication/
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
branches/HORNETQ-720_Replication/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
Log:
merge from trunk
Property changes on: branches/HORNETQ-720_Replication
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:10878-11474
+ /trunk:10878-11495
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-10-07
12:25:45 UTC (rev 11495)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-10-07
12:28:01 UTC (rev 11496)
@@ -60,7 +60,7 @@
/**
* a regex comparator
*/
- private final MatchComparator<String> matchComparator = new
MatchComparator<String>();
+ private final MatchComparator matchComparator = new MatchComparator();
/**
* a cache
@@ -263,7 +263,7 @@
/**
* compares to matches to see which one is more specific
*/
- private static class MatchComparator<T extends String> implements
Comparator<T>
+ private static class MatchComparator implements Comparator<String>
{
public int compare(final String o1, final String o2)
{
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-10-07
12:25:45 UTC (rev 11495)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-10-07
12:28:01 UTC (rev 11496)
@@ -78,12 +78,12 @@
import org.hornetq.utils.UUIDGenerator;
/**
- *
- * Helper base class for our unit tests
- *
+ * Helper base class for our unit tests.
+ * <p>
+ * See {@code org.hornetq.tests.util.ServiceTestBase} for a test case with server
set-up.
+ * @see Service
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:csuconic@redhat.com">Clebert</a>
- *
*/
public abstract class UnitTestCase extends TestCase
{
@@ -968,8 +968,9 @@
if (AsynchronousFileImpl.getTotalMaxIO() != 0)
{
+ int totalMaxAIO = AsynchronousFileImpl.getTotalMaxIO();
AsynchronousFileImpl.resetMaxAIO();
- Assert.fail("test did not close all its files " +
AsynchronousFileImpl.getTotalMaxIO());
+ Assert.fail("test did not close all its files " + totalMaxAIO);
}
// We shutdown the global pools to give a better isolation between tests
Deleted:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java 2011-10-07
12:25:45 UTC (rev 11495)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java 2011-10-07
12:28:01 UTC (rev 11496)
@@ -1,110 +0,0 @@
-package org.hornetq.core.message.impl;
-
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.ClientConsumer;
-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.ServerLocator;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.tests.util.ServiceTestBase;
-
-public class MessagePropertyTest extends ServiceTestBase
-{
- private HornetQServer server;
- private ServerLocator locator;
- private ClientSessionFactory sf;
- private final int numMessages = 20;
-
- private static final String ADDRESS = "aAddress123";
- private static final SimpleString SIMPLE_STRING_KEY = new
SimpleString("StringToSimpleString");
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- server = createServer(true);
- server.start();
- locator = createInVMNonHALocator();
- sf = locator.createSessionFactory();
- }
-
- @Override
- public void tearDown() throws Exception
- {
- try
- {
- sf.close();
- locator.close();
- server.stop();
- }
- finally
- {
- super.tearDown();
- }
- }
-
- private void sendMessages() throws Exception
- {
- ClientSession session = sf.createSession(true, true);
- session.createQueue(ADDRESS, ADDRESS, null, true);
- ClientProducer producer = session.createProducer(ADDRESS);
-
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session.createMessage(true);
- setBody(i, message);
- message.putIntProperty("int", i);
- message.putShortProperty("short", (short)i);
- message.putByteProperty("byte", (byte)i);
- message.putFloatProperty("float", floatValue(i));
- message.putStringProperty(SIMPLE_STRING_KEY, new
SimpleString(Integer.toString(i)));
- message.putBytesProperty("byte[]", byteArray(i));
- producer.send(message);
- }
- session.commit();
- }
-
- private float floatValue(int i)
- {
- return (float)(i * 1.3);
- }
-
- private byte[] byteArray(int i)
- {
- return new byte[] { (byte)i, (byte)(i / 2) };
- }
-
- public void testProperties() throws Exception
- {
- sendMessages();
- receiveMessages();
- }
-
-
- private void receiveMessages() throws Exception
- {
- ClientSession session = sf.createSession(true, true);
- session.start();
- ClientConsumer consumer = session.createConsumer(ADDRESS);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer.receive(100);
- assertNotNull("Expecting a message " + i, message);
- assertMessageBody(i, message);
- assertEquals(i, message.getIntProperty("int").intValue());
- assertEquals((short)i,
message.getShortProperty("short").shortValue());
- assertEquals((byte)i, message.getByteProperty("byte").byteValue());
- assertEquals(floatValue(i),
message.getFloatProperty("float").floatValue(), 0.001);
- assertEquals(new SimpleString(Integer.toString(i)),
- message.getSimpleStringProperty(SIMPLE_STRING_KEY.toString()));
- assertEqualsByteArrays(byteArray(i),
message.getBytesProperty("byte[]"));
- message.acknowledge();
- }
- assertNull("no more messages", consumer.receive(50));
- consumer.close();
- session.commit();
- }
-
-}
Copied:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java
(from rev 11495,
trunk/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java)
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java
(rev 0)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/core/message/impl/MessagePropertyTest.java 2011-10-07
12:28:01 UTC (rev 11496)
@@ -0,0 +1,110 @@
+package org.hornetq.core.message.impl;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.client.ClientConsumer;
+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.ServerLocator;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.ServiceTestBase;
+
+public class MessagePropertyTest extends ServiceTestBase
+{
+ private HornetQServer server;
+ private ServerLocator locator;
+ private ClientSessionFactory sf;
+ private final int numMessages = 20;
+
+ private static final String ADDRESS = "aAddress123";
+ private static final SimpleString SIMPLE_STRING_KEY = new
SimpleString("StringToSimpleString");
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ server = createServer(true);
+ server.start();
+ locator = createInVMNonHALocator();
+ sf = locator.createSessionFactory();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ try
+ {
+ sf.close();
+ locator.close();
+ server.stop();
+ }
+ finally
+ {
+ super.tearDown();
+ }
+ }
+
+ private void sendMessages() throws Exception
+ {
+ ClientSession session = sf.createSession(true, true);
+ session.createQueue(ADDRESS, ADDRESS, null, true);
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createMessage(true);
+ setBody(i, message);
+ message.putIntProperty("int", i);
+ message.putShortProperty("short", (short)i);
+ message.putByteProperty("byte", (byte)i);
+ message.putFloatProperty("float", floatValue(i));
+ message.putStringProperty(SIMPLE_STRING_KEY, new
SimpleString(Integer.toString(i)));
+ message.putBytesProperty("byte[]", byteArray(i));
+ producer.send(message);
+ }
+ session.commit();
+ }
+
+ private float floatValue(int i)
+ {
+ return (float)(i * 1.3);
+ }
+
+ private byte[] byteArray(int i)
+ {
+ return new byte[] { (byte)i, (byte)(i / 2) };
+ }
+
+ public void testProperties() throws Exception
+ {
+ sendMessages();
+ receiveMessages();
+ }
+
+
+ private void receiveMessages() throws Exception
+ {
+ ClientSession session = sf.createSession(true, true);
+ session.start();
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(100);
+ assertNotNull("Expecting a message " + i, message);
+ assertMessageBody(i, message);
+ assertEquals(i, message.getIntProperty("int").intValue());
+ assertEquals((short)i,
message.getShortProperty("short").shortValue());
+ assertEquals((byte)i, message.getByteProperty("byte").byteValue());
+ assertEquals(floatValue(i),
message.getFloatProperty("float").floatValue(), 0.001);
+ assertEquals(new SimpleString(Integer.toString(i)),
+ message.getSimpleStringProperty(SIMPLE_STRING_KEY.toString()));
+ assertEqualsByteArrays(byteArray(i),
message.getBytesProperty("byte[]"));
+ message.acknowledge();
+ }
+ assertNull("no more messages", consumer.receive(50));
+ consumer.close();
+ session.commit();
+ }
+
+}
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-10-07
12:25:45 UTC (rev 11495)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-10-07
12:28:01 UTC (rev 11496)
@@ -145,7 +145,7 @@
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 =