You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/02/07 08:27:09 UTC

[camel] branch camel-2.23.x updated: CAMEL-13166 - ArrayBlockingQueueFactory ignores capacity argument, thanks to Jan Bednar for the patch

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.23.x by this push:
     new 4726fe8  CAMEL-13166 - ArrayBlockingQueueFactory ignores capacity argument, thanks to Jan Bednar for the patch
4726fe8 is described below

commit 4726fe85160f9e1fd3abb424e3689ff30df1a3db
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Feb 7 08:57:11 2019 +0100

    CAMEL-13166 - ArrayBlockingQueueFactory ignores capacity argument, thanks to Jan Bednar for the patch
---
 .../apache/camel/component/seda/ArrayBlockingQueueFactory.java    | 2 +-
 .../org/apache/camel/component/seda/SedaQueueFactoryTest.java     | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/ArrayBlockingQueueFactory.java b/camel-core/src/main/java/org/apache/camel/component/seda/ArrayBlockingQueueFactory.java
index 0b67117..8285f54 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/ArrayBlockingQueueFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/ArrayBlockingQueueFactory.java
@@ -69,6 +69,6 @@ public class ArrayBlockingQueueFactory<E> implements BlockingQueueFactory<E> {
     @Override
     public ArrayBlockingQueue<E> create(int capacity) {
         return fair == null
-            ? new ArrayBlockingQueue<>(defaultCapacity) : new ArrayBlockingQueue<>(defaultCapacity, fair);
+            ? new ArrayBlockingQueue<>(capacity) : new ArrayBlockingQueue<>(capacity, fair);
     }
 }
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaQueueFactoryTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaQueueFactoryTest.java
index 2347cdc..e14b2cd 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SedaQueueFactoryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaQueueFactoryTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
+import org.apache.camel.util.SedaConstants;
 import org.junit.Test;
 
 /**
@@ -46,17 +47,18 @@ public class SedaQueueFactoryTest extends ContextTestSupport {
         SedaEndpoint endpoint = resolveMandatoryEndpoint("seda:arrayQueue?queueFactory=#arrayQueueFactory", SedaEndpoint.class);
 
         BlockingQueue<Exchange> queue = endpoint.getQueue();
-        assertIsInstanceOf(ArrayBlockingQueue.class, queue);
+        ArrayBlockingQueue<Exchange> blockingQueue = assertIsInstanceOf(ArrayBlockingQueue.class, queue);
+        assertEquals("remainingCapacity - default", SedaConstants.QUEUE_SIZE, blockingQueue.remainingCapacity());
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testArrayBlockingQueueFactoryAndSize() throws Exception {
-        SedaEndpoint endpoint = resolveMandatoryEndpoint("seda:arrayQueue50?queueFactory=#arrayQueueFactory&size=50", SedaEndpoint.class);
+        SedaEndpoint endpoint = resolveMandatoryEndpoint("seda:arrayQueue100?queueFactory=#arrayQueueFactory&size=100", SedaEndpoint.class);
 
         BlockingQueue<Exchange> queue = endpoint.getQueue();
         ArrayBlockingQueue<Exchange> blockingQueue = assertIsInstanceOf(ArrayBlockingQueue.class, queue);
-        assertEquals("remainingCapacity", 50, blockingQueue.remainingCapacity());
+        assertEquals("remainingCapacity - custom", 100, blockingQueue.remainingCapacity());
     }