Author: clebert.suconic(a)jboss.com
Date: 2009-11-24 20:40:17 -0500 (Tue, 24 Nov 2009)
New Revision: 8399
Modified:
trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java
trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/server/impl/DivertImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java
Log:
Fixing divert test
Modified: trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2009-11-25 00:56:16 UTC
(rev 8398)
+++ trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2009-11-25 01:40:17 UTC
(rev 8399)
@@ -175,7 +175,17 @@
return false;
}
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "FilterImpl [sfilterString=" + sfilterString + "]";
+ }
+
// Private --------------------------------------------------------------------------
private Object getHeaderFieldValue(final ServerMessage msg, final SimpleString
fieldName)
Modified:
trunk/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
===================================================================
---
trunk/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2009-11-25
00:56:16 UTC (rev 8398)
+++
trunk/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2009-11-25
01:40:17 UTC (rev 8399)
@@ -204,7 +204,8 @@
else
{
// The actions need to be done in order...
- // so it must achieve both conditions before we can proceed to more tasks
+ // And they are added in order...
+ // As soon as we're done, we break the loop
break;
}
}
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java 2009-11-25 00:56:16
UTC (rev 8398)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java 2009-11-25 01:40:17
UTC (rev 8399)
@@ -125,5 +125,14 @@
return BindingType.DIVERT;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "DivertBinding [divert=" + divert + "]";
+ }
+
}
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java 2009-11-25
00:56:16 UTC (rev 8398)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java 2009-11-25
01:40:17 UTC (rev 8399)
@@ -140,5 +140,16 @@
{
return BindingType.LOCAL_QUEUE;
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "LocalQueueBinding [address=" + address + ", name=" +
name + ", filter=" + filter + "]";
+ }
+
+
}
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-25
00:56:16 UTC (rev 8398)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-25
01:40:17 UTC (rev 8399)
@@ -550,6 +550,11 @@
throw new IllegalStateException("Message cannot be routed more than
once");
}
+ if (message.getMessageID() == 0l)
+ {
+ generateID(message);
+ }
+
RoutingContext context = new RoutingContextImpl(tx);
SimpleString address = message.getDestination();
@@ -839,6 +844,15 @@
// Private -----------------------------------------------------------------
+ private void generateID(final ServerMessage message)
+ {
+ // Setting the ID for the routed message
+ long id = storageManager.generateUniqueID();
+
+ message.setMessageID(id);
+ }
+
+
private void setPagingStore(final ServerMessage message) throws Exception
{
PagingStore store = pagingManager.getPageStore(message.getDestination());
Modified: trunk/src/main/org/hornetq/core/server/impl/DivertImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/DivertImpl.java 2009-11-25 00:56:16 UTC
(rev 8398)
+++ trunk/src/main/org/hornetq/core/server/impl/DivertImpl.java 2009-11-25 01:40:17 UTC
(rev 8399)
@@ -84,6 +84,9 @@
// TODO we can optimise this so it doesn't copy if it's not routed anywhere
else
ServerMessage copy = message.copy();
+
+ // Setting the messageID to 0. The postOffice should set a new one
+ copy.setMessageID(0);
copy.setDestination(forwardAddress);
@@ -116,4 +119,26 @@
{
return filter;
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "DivertImpl [routingName=" + routingName +
+ ", uniqueName=" +
+ uniqueName +
+ ", forwardAddress=" +
+ forwardAddress +
+ ", exclusive=" +
+ exclusive +
+ ", filter=" +
+ filter +
+ ", transformer=" +
+ transformer +
+ "]";
+ }
+
+
}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-11-25 00:56:16
UTC (rev 8398)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-11-25 01:40:17
UTC (rev 8399)
@@ -650,8 +650,6 @@
Channel channel = connection.getChannel(channelID, sendWindowSize);
Executor sessionExecutor = executorFactory.getExecutor();
-
- storageManager.newContext(sessionExecutor);
final ServerSessionImpl session = new ServerSessionImpl(name,
username,
Modified: trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2009-11-25
00:56:16 UTC (rev 8398)
+++
trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2009-11-25
01:40:17 UTC (rev 8399)
@@ -44,7 +44,7 @@
public class PersistentDivertTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(DivertTest.class);
-
+
public void testPersistentDivert() throws Exception
{
Configuration conf = createDefaultConfig();
@@ -79,7 +79,11 @@
ClientSessionFactory sf = new ClientSessionFactoryImpl(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
- ClientSession session = sf.createSession(false, true, true);
+ sf.setBlockOnAcknowledge(true);
+ sf.setBlockOnNonPersistentSend(true);
+ sf.setBlockOnPersistentSend(true);
+
+ ClientSession session = sf.createSession(true, true, 0);
final SimpleString queueName1 = new SimpleString("queue1");
@@ -173,7 +177,6 @@
}
assertNull(consumer4.receiveImmediate());
-
session.close();
sf.close();
@@ -214,10 +217,12 @@
messagingService.start();
ClientSessionFactory sf = new ClientSessionFactoryImpl(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
-
+
+ sf.setBlockOnAcknowledge(true);
+ sf.setBlockOnNonPersistentSend(true);
sf.setBlockOnPersistentSend(true);
- ClientSession session = sf.createSession(false, true, true);
+ ClientSession session = sf.createSession(true, true, 0);
final SimpleString queueName1 = new SimpleString("queue1");