Author: clebert.suconic(a)jboss.com
Date: 2011-03-25 18:29:16 -0400 (Fri, 25 Mar 2011)
New Revision: 10369
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/ServerSession.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
Log:
Fixing tests
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/ServerSession.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/ServerSession.java 2011-03-25
21:15:31 UTC (rev 10368)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/ServerSession.java 2011-03-25
22:29:16 UTC (rev 10369)
@@ -115,6 +115,8 @@
void requestProducerCredits(SimpleString address, int credits) throws Exception;
void close(boolean failed) throws Exception;
+
+ void waitContextCompletion() throws Exception;
void setTransferring(boolean transferring);
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-03-25
21:15:31 UTC (rev 10368)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-03-25
22:29:16 UTC (rev 10369)
@@ -652,6 +652,7 @@
for (ServerSession session : sessions.values())
{
session.close(true);
+ session.waitContextCompletion();
}
remotingService.stop();
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2011-03-25
21:15:31 UTC (rev 10368)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2011-03-25
22:29:16 UTC (rev 10369)
@@ -950,6 +950,30 @@
{
setStarted(false);
}
+
+ public void waitContextCompletion()
+ {
+ OperationContext formerCtx = storageManager.getContext();
+
+ try
+ {
+ try
+ {
+ if (!storageManager.waitOnOperations(10000))
+ {
+ log.warn("Couldn't finish context execution in 10 seconds",
new Exception ("warning"));
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn(e.getMessage(), e);
+ }
+ }
+ finally
+ {
+ storageManager.setContext(formerCtx);
+ }
+ }
public void close(final boolean failed)
{
@@ -969,6 +993,7 @@
{
try
{
+ System.out.println("Finishing close");
doClose(failed);
}
catch (Exception e)
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-03-25
21:15:31 UTC (rev 10368)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-03-25
22:29:16 UTC (rev 10369)
@@ -682,8 +682,7 @@
server0.getConfiguration().setQueueConfigurations(queueConfigs0);
server0.start();
-
-
+
locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
@@ -710,30 +709,30 @@
producer0.send(message);
}
+ server1.start();
- server1.start();
-
// Inserting the duplicateIDs so the bridge will fail in a few
{
long ids[] = new long[100];
-
+
Queue queue = server0.locateQueue(new SimpleString(queueName0));
LinkedListIterator<MessageReference> iterator = queue.iterator();
-
- for (int i = 0 ; i < 100; i++)
+
+ for (int i = 0; i < 100; i++)
{
iterator.hasNext();
ids[i] = iterator.next().getMessage().getMessageID();
}
-
+
iterator.close();
- DuplicateIDCache duplicateTargetCache =
server1.getPostOffice().getDuplicateIDCache(PostOfficeImpl.BRIDGE_CACHE_STR.concat(forwardAddress));
-
+ DuplicateIDCache duplicateTargetCache = server1.getPostOffice()
+
.getDuplicateIDCache(PostOfficeImpl.BRIDGE_CACHE_STR.concat(forwardAddress));
+
TransactionImpl tx = new TransactionImpl(server1.getStorageManager());
for (long id : ids)
{
- byte [] duplicateArray =
BridgeImpl.getDuplicateBytes(server0.getNodeManager().getUUID(), id);
+ byte[] duplicateArray =
BridgeImpl.getDuplicateBytes(server0.getNodeManager().getUUID(), id);
duplicateTargetCache.addToCache(duplicateArray, tx);
}
tx.commit();
@@ -946,9 +945,23 @@
locator.close();
}
- server0.stop();
+ try
+ {
+ server0.stop();
+ }
+ catch(Exception ignored)
+ {
+
+ }
- server1.stop();
+ try
+ {
+ server1.stop();
+ }
+ catch(Exception ignored)
+ {
+
+ }
}
}
@@ -1255,7 +1268,7 @@
protected void tearDown() throws Exception
{
clearData();
- super.setUp();
+ super.tearDown();
}
}
Show replies by date