camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r936801 - in /camel/trunk/components/camel-hawtdb/src: main/java/org/apache/camel/component/hawtdb/ test/java/org/apache/camel/component/hawtdb/
Date Thu, 22 Apr 2010 12:02:45 GMT
Author: davsclaus
Date: Thu Apr 22 12:02:44 2010
New Revision: 936801

URL: http://svn.apache.org/viewvc?rev=936801&view=rev
Log:
Refined tests due sync and flush is default now. Also refined default segmenet and page sizes
to be less big.

Modified:
    camel/trunk/components/camel-hawtdb/src/main/java/org/apache/camel/component/hawtdb/HawtDBAggregationRepository.java
    camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentDifferentGroupsTest.java
    camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentSameGroupTest.java
    camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadAndRecoverTest.java
    camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadConcurrentTest.java

Modified: camel/trunk/components/camel-hawtdb/src/main/java/org/apache/camel/component/hawtdb/HawtDBAggregationRepository.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/main/java/org/apache/camel/component/hawtdb/HawtDBAggregationRepository.java?rev=936801&r1=936800&r2=936801&view=diff
==============================================================================
--- camel/trunk/components/camel-hawtdb/src/main/java/org/apache/camel/component/hawtdb/HawtDBAggregationRepository.java
(original)
+++ camel/trunk/components/camel-hawtdb/src/main/java/org/apache/camel/component/hawtdb/HawtDBAggregationRepository.java
Thu Apr 22 12:02:44 2010
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
@@ -47,8 +46,9 @@ public class HawtDBAggregationRepository
     private HawtDBFile hawtDBFile;
     private String persistentFileName;
     private String repositoryName;
-    private Integer bufferSize;
+    private int bufferSize = 8 * 1024 * 1024;
     private boolean sync = true;
+    private short pageSize = 512;
     private boolean returnOldExchange;
     private HawtDBCamelMarshaller marshaller = new HawtDBCamelMarshaller();
     private long recoveryInterval = 5000;
@@ -442,6 +442,14 @@ public class HawtDBAggregationRepository
         this.deadLetterUri = deadLetterUri;
     }
 
+    public short getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(short pageSize) {
+        this.pageSize = pageSize;
+    }
+
     @Override
     protected void doStart() throws Exception {
         // either we have a HawtDB configured or we use a provided fileName
@@ -452,6 +460,9 @@ public class HawtDBAggregationRepository
             if (getBufferSize() != null) {
                 hawtDBFile.setMappingSegementSize(getBufferSize());
             }
+            if (getPageSize() > 0) {
+                hawtDBFile.setPageSize(getPageSize());
+            }
         }
 
         ObjectHelper.notNull(hawtDBFile, "Either set a persistentFileName or a hawtDBFile");

Modified: camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentDifferentGroupsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentDifferentGroupsTest.java?rev=936801&r1=936800&r2=936801&view=diff
==============================================================================
--- camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentDifferentGroupsTest.java
(original)
+++ camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentDifferentGroupsTest.java
Thu Apr 22 12:02:44 2010
@@ -79,6 +79,8 @@ public class HawtDBAggregateConcurrentDi
                 public Object call() throws Exception {
                     String id = index % 2 == 0 ? "A" : "B";
                     template.sendBodyAndHeader("direct:start", index, "id", id);
+                    // simulate a little delay
+                    Thread.sleep(3);
                     return null;
                 }
             });

Modified: camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentSameGroupTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentSameGroupTest.java?rev=936801&r1=936800&r2=936801&view=diff
==============================================================================
--- camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentSameGroupTest.java
(original)
+++ camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateConcurrentSameGroupTest.java
Thu Apr 22 12:02:44 2010
@@ -78,6 +78,8 @@ public class HawtDBAggregateConcurrentSa
             executor.submit(new Callable<Object>() {
                 public Object call() throws Exception {
                     template.sendBodyAndHeader("direct:start", index, "id", 123);
+                    // simulate a little delay
+                    Thread.sleep(3);
                     return null;
                 }
             });

Modified: camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadAndRecoverTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadAndRecoverTest.java?rev=936801&r1=936800&r2=936801&view=diff
==============================================================================
--- camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadAndRecoverTest.java
(original)
+++ camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadAndRecoverTest.java
Thu Apr 22 12:02:44 2010
@@ -34,7 +34,7 @@ import org.junit.Test;
 public class HawtDBAggregateLoadAndRecoverTest extends CamelTestSupport {
 
     private static final Log LOG = LogFactory.getLog(HawtDBAggregateLoadAndRecoverTest.class);
-    private static final int SIZE = 1000;
+    private static final int SIZE = 200;
     private static AtomicInteger counter = new AtomicInteger();
 
     @Before
@@ -62,6 +62,8 @@ public class HawtDBAggregateLoadAndRecov
                 LOG.debug("Sending " + value + " with id " + id);
             }
             template.sendBodyAndHeaders("seda:start?size=" + SIZE, value, headers);
+            // simulate a little delay
+            Thread.sleep(3);
         }
 
         LOG.info("Sending all " + SIZE + " message done. Now waiting for aggregation to complete.");
@@ -74,7 +76,8 @@ public class HawtDBAggregateLoadAndRecov
                 recovered++;
             }
         }
-        assertEquals("There should be 5 recovered", 5, recovered);
+        int expected = SIZE / 10 / 10;
+        assertEquals("There should be " + expected + " recovered", expected, recovered);
     }
 
     @Override
@@ -91,11 +94,11 @@ public class HawtDBAggregateLoadAndRecov
                         .aggregationRepository(repo)
                         .completionSize(10)
                         .to("log:output?showHeaders=true")
-                        // have every 20th exchange fail which should then be recovered
+                        // have every 10th exchange fail which should then be recovered
                         .process(new Processor() {
                             public void process(Exchange exchange) throws Exception {
                                 int num = counter.incrementAndGet();
-                                if (num % 20 == 0) {
+                                if (num % 10 == 0) {
                                     throw new IllegalStateException("Failed for num " + num);
                                 }
                             }

Modified: camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadConcurrentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadConcurrentTest.java?rev=936801&r1=936800&r2=936801&view=diff
==============================================================================
--- camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadConcurrentTest.java
(original)
+++ camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateLoadConcurrentTest.java
Thu Apr 22 12:02:44 2010
@@ -63,6 +63,8 @@ public class HawtDBAggregateLoadConcurre
                         LOG.debug("Sending " + value + " with id " + id);
                     }
                     template.sendBodyAndHeader("direct:start", value, "id", "" + id);
+                    // simulate a little delay
+                    Thread.sleep(3);
                     return null;
                 }
             });



Mime
View raw message