servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r693061 - /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java
Date Mon, 08 Sep 2008 11:48:26 GMT
Author: ffang
Date: Mon Sep  8 04:48:24 2008
New Revision: 693061

URL: http://svn.apache.org/viewvc?rev=693061&view=rev
Log:
[SM-1558]fix BaseAbstractAggregatorTest failure

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java?rev=693061&r1=693060&r2=693061&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/support/BaseAbstractAggregatorTest.java
Mon Sep  8 04:48:24 2008
@@ -29,7 +29,10 @@
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.locks.impl.SimpleLockManager;
 import org.apache.servicemix.soap.interceptors.jbi.JbiConstants;
+import org.apache.servicemix.store.Store;
+import org.apache.servicemix.store.StoreFactory;
 import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.store.memory.MemoryStoreFactory;
 import org.apache.servicemix.tck.mock.MockExchangeFactory;
 import org.apache.servicemix.tck.mock.MockMessageExchange;
 import org.apache.servicemix.tck.mock.MockNormalizedMessage;
@@ -50,6 +53,7 @@
         aggregator.getTimerManager().start();
         aggregator.setLockManager(new SimpleLockManager());
         aggregator.setStore(new MemoryStore(new IdGenerator()));
+        aggregator.start();
         factory = new MockExchangeFactory();
     }
     
@@ -92,6 +96,8 @@
     private class MockAggregator extends AbstractAggregator {
 
         private int scheduleCount;
+        private Store mockClosedAggregates;
+        private StoreFactory mockClosedAggregatesStoreFactory;
 
         @Override
         protected boolean addMessage(Object aggregate, NormalizedMessage message, MessageExchange
exchange)
@@ -130,7 +136,23 @@
         protected void send(MessageExchange me) throws MessagingException {
             // graciously do nothing
         }
+
+        @Override
+        public void start() throws Exception {
+            if (mockClosedAggregatesStoreFactory == null) {
+                mockClosedAggregatesStoreFactory = new MemoryStoreFactory();
+            }
+            mockClosedAggregates = mockClosedAggregatesStoreFactory.open("mock-closed-aggregates");
+        }
         
+        protected boolean isAggregationClosed(String correlationId) throws Exception {
+            // TODO: implement this using a persistent / cached behavior
+            Object data = mockClosedAggregates.load(correlationId);
+            if (data != null) {
+                mockClosedAggregates.store(correlationId, data);
+            }
+            return data != null;
+        }
     }
 
 }



Mime
View raw message