You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/22 07:36:00 UTC

[1/6] camel git commit: Fixed test

Repository: camel
Updated Branches:
  refs/heads/master d403cc908 -> 2bd185e92


Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aaa3a0c9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aaa3a0c9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aaa3a0c9

Branch: refs/heads/master
Commit: aaa3a0c9e171bbeafad9688aaf468ae399bb6d16
Parents: d403cc9
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:23:22 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:23:22 2016 +0200

----------------------------------------------------------------------
 .../impl/EndpointRegistryKeepRouteEndpointsTest.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/aaa3a0c9/camel-core/src/test/java/org/apache/camel/impl/EndpointRegistryKeepRouteEndpointsTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/EndpointRegistryKeepRouteEndpointsTest.java b/camel-core/src/test/java/org/apache/camel/impl/EndpointRegistryKeepRouteEndpointsTest.java
index e75e7c1..db6e734 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/EndpointRegistryKeepRouteEndpointsTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/EndpointRegistryKeepRouteEndpointsTest.java
@@ -52,14 +52,21 @@ public class EndpointRegistryKeepRouteEndpointsTest extends ContextTestSupport {
         assertTrue(context.hasEndpoint("log://bar") != null);
         assertTrue(context.hasEndpoint("mock://result") != null);
 
-        // and the dynamic cache only keeps the last 20
-        assertFalse(context.hasEndpoint("mock://unknown0") != null);
-        assertFalse(context.hasEndpoint("mock://unknown1") != null);
+        // and the dynamic cache only keeps 20 dynamic endpoints
+        int count = 0;
+        for (int i = 0; i < 50; i++) {
+            String uri = "mock://unknown" + i;
+            if (context.hasEndpoint(uri)  != null) {
+                count++;
+                // and it should be dynamic
+                assertTrue(context.getEndpointRegistry().isDynamic(uri));
+            };
+        }
+        assertEquals("Should only be 20 dynamic endpoints in the cache", 20, count);
 
         // we should have 4 static, 20 dynamic and 24 in total
         assertEquals(4, context.getEndpointRegistry().staticSize());
         assertTrue(context.getEndpointRegistry().isStatic("direct://start"));
-        assertTrue(context.getEndpointRegistry().isDynamic("mock://unknown49"));
 
         assertEquals(20, context.getEndpointRegistry().dynamicSize());
         assertEquals(24, context.getEndpointRegistry().size());


[5/6] camel git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5e1423f7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5e1423f7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5e1423f7

Branch: refs/heads/master
Commit: 5e1423f749d6b030e153083e8667b43b11e43a7f
Parents: f453c66
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:32:41 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:32:41 2016 +0200

----------------------------------------------------------------------
 .../file/remote/FtpConsumerIdempotentMemoryRefTest.java        | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5e1423f7/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
index 7524f00..dec0179 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
@@ -65,7 +65,7 @@ public class FtpConsumerIdempotentMemoryRefTest extends FtpServerTestSupport {
         assertTrue(repo.contains("e.txt"));
 
         resetMocks();
-        notify = new NotifyBuilder(context).whenDone(4).create();
+        notify = new NotifyBuilder(context).whenDone(2).create();
 
         getMockEndpoint("mock:result").expectedMessageCount(2);
 
@@ -86,7 +86,9 @@ public class FtpConsumerIdempotentMemoryRefTest extends FtpServerTestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from(getFtpUrl()).to("mock:result");
+                from(getFtpUrl())
+                    .to("log:result")
+                    .to("mock:result");
             }
         };
     }


[3/6] camel git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/045dd44f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/045dd44f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/045dd44f

Branch: refs/heads/master
Commit: 045dd44f00c11bc3615e3fa856f37e3f92fdd192
Parents: 124dc65
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:28:42 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:28:42 2016 +0200

----------------------------------------------------------------------
 .../src/test/java/org/apache/camel/util/LRUCacheTest.java    | 8 --------
 1 file changed, 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/045dd44f/camel-core/src/test/java/org/apache/camel/util/LRUCacheTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/LRUCacheTest.java b/camel-core/src/test/java/org/apache/camel/util/LRUCacheTest.java
index 81ef485..e101508 100644
--- a/camel-core/src/test/java/org/apache/camel/util/LRUCacheTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/LRUCacheTest.java
@@ -89,19 +89,11 @@ public class LRUCacheTest extends TestCase {
         // the eviction is async so force cleanup
         cache.cleanUp();
 
-        // should evict the eldest, and stop the service
-        assertTrue(service1.getStopped());
-
-        assertNull(service12.getStopped());
-
         cache.put("L", service12);
 
         // the eviction is async so force cleanup
         cache.cleanUp();
 
-        // should evict the eldest, and stop the service
-        assertTrue(service2.getStopped());
-
         assertEquals(10, cache.size());
     }
 


[6/6] camel git commit: Fixed test after PR #953.

Posted by da...@apache.org.
Fixed test after PR #953.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2bd185e9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2bd185e9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2bd185e9

Branch: refs/heads/master
Commit: 2bd185e929a7242db3ad481bd05e8dcf998dca0f
Parents: 5e1423f
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:35:50 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:35:50 2016 +0200

----------------------------------------------------------------------
 .../aws/kinesis/KinesisEndpointTest.java         | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2bd185e9/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
index c6910bc..48c0058 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
@@ -76,20 +76,35 @@ public class KinesisEndpointTest {
         assertThat(endpoint.getMaxResultsPerRequest(), is(1));
     }
 
-    @Test(expected = ResolveEndpointFailedException.class)
+    @Test
     public void afterSequenceNumberRequiresSequenceNumber() throws Exception {
         KinesisEndpoint endpoint = (KinesisEndpoint) camelContext.getEndpoint("aws-kinesis://some_stream_name"
                 + "?amazonKinesisClient=#kinesisClient"
                 + "&iteratorType=AFTER_SEQUENCE_NUMBER"
+                + "&shardId=abc"
+                + "&sequenceNumber=123"
         );
 
+        assertThat(endpoint.getClient(), is(amazonKinesisClient));
+        assertThat(endpoint.getStreamName(), is("some_stream_name"));
+        assertThat(endpoint.getIteratorType(), is(ShardIteratorType.AFTER_SEQUENCE_NUMBER));
+        assertThat(endpoint.getShardId(), is("abc"));
+        assertThat(endpoint.getSequenceNumber(), is("123"));
     }
 
-    @Test(expected = ResolveEndpointFailedException.class)
+    @Test
     public void atSequenceNumberRequiresSequenceNumber() throws Exception {
         KinesisEndpoint endpoint = (KinesisEndpoint) camelContext.getEndpoint("aws-kinesis://some_stream_name"
                 + "?amazonKinesisClient=#kinesisClient"
                 + "&iteratorType=AT_SEQUENCE_NUMBER"
+                + "&shardId=abc"
+                + "&sequenceNumber=123"
         );
+
+        assertThat(endpoint.getClient(), is(amazonKinesisClient));
+        assertThat(endpoint.getStreamName(), is("some_stream_name"));
+        assertThat(endpoint.getIteratorType(), is(ShardIteratorType.AT_SEQUENCE_NUMBER));
+        assertThat(endpoint.getShardId(), is("abc"));
+        assertThat(endpoint.getSequenceNumber(), is("123"));
     }
 }
\ No newline at end of file


[4/6] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f453c66b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f453c66b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f453c66b

Branch: refs/heads/master
Commit: f453c66bdccd36dc017a23d99d1054a1bb9db037
Parents: 045dd44
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:28:52 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:28:52 2016 +0200

----------------------------------------------------------------------
 components/camel-aws/src/main/docs/aws-kinesis.adoc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f453c66b/components/camel-aws/src/main/docs/aws-kinesis.adoc
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/docs/aws-kinesis.adoc b/components/camel-aws/src/main/docs/aws-kinesis.adoc
index acb0557..8328a83 100644
--- a/components/camel-aws/src/main/docs/aws-kinesis.adoc
+++ b/components/camel-aws/src/main/docs/aws-kinesis.adoc
@@ -37,6 +37,7 @@ The AWS Kinesis component has no options.
 
 
 
+
 // endpoint options: START
 The AWS Kinesis component supports 25 endpoint options which are listed below:
 
@@ -46,11 +47,11 @@ The AWS Kinesis component supports 25 endpoint options which are listed below:
 | streamName | common |  | String | *Required* Name of the stream
 | amazonKinesisClient | common |  | AmazonKinesis | *Required* Amazon Kinesis client to use for all requests for this endpoint
 | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
-| iteratorType | consumer | trim_horizon | ShardIteratorType |One of trim_horizon, AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER or latest. See http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html[http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html] for descriptions of these four iterator types. If iteratorType is AT_SEQUENCE_NUMBER or AFTER_SEQUENCE_NUMBER you must specify the sequenceNumber.
-| shardId | consumer | 0 | String | Defines which shardId in the Kinesis stream to get records from.
-| sequenceNumber | consumer || String | The sequence number to start polling from. This property is only valid if iteratorType is AT_SEQUENCE_NUMBER or AFTER_SEQUENCE_NUMBER.
+| iteratorType | consumer |  | ShardIteratorType | Defines where in the Kinesis stream to start getting records
 | maxResultsPerRequest | consumer | 1 | int | Maximum number of records that will be fetched in each poll
 | sendEmptyMessageWhenIdle | consumer | false | boolean | If the polling consumer did not poll any files you can enable this option to send an empty message (no body) instead.
+| sequenceNumber | consumer |  | String | The sequence number to start polling from
+| shardId | consumer |  | String | Defines which shardId in the Kinesis stream to get records from
 | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
 | pollStrategy | consumer (advanced) |  | PollingConsumerPollStrategy | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.
 | exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
@@ -72,6 +73,7 @@ The AWS Kinesis component supports 25 endpoint options which are listed below:
 // endpoint options: END
 
 
+
 Required Kinesis component options
 
 You have to provide the amazonKinesisClient in the


[2/6] camel git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/124dc650
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/124dc650
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/124dc650

Branch: refs/heads/master
Commit: 124dc650ff31a83d66ad582e860e526661c999cb
Parents: aaa3a0c
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 22 07:26:20 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 22 07:26:20 2016 +0200

----------------------------------------------------------------------
 .../AggregateClosedCorrelationKeyTest.java        | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/124dc650/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
index a9efbd4..0b98986 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
@@ -83,14 +83,24 @@ public class AggregateClosedCorrelationKeyTest extends ContextTestSupport {
         template.sendBodyAndHeader("direct:start", "E", "id", 3);
         template.sendBodyAndHeader("direct:start", "F", "id", 3);
 
+        // 2 of them should now be closed
+        int closed = 0;
+
         // should NOT be closed because only 2 and 3 is remembered as they are the two last used
-        template.sendBodyAndHeader("direct:start", "G", "id", 1);
+        try {
+            template.sendBodyAndHeader("direct:start", "G", "id", 1);
+        } catch (CamelExecutionException e) {
+            closed++;
+            ClosedCorrelationKeyException cause = assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
+            assertEquals("1", cause.getCorrelationKey());
+            assertTrue(cause.getMessage().startsWith("The correlation key [1] has been closed."));
+        }
 
         // should be closed
         try {
             template.sendBodyAndHeader("direct:start", "H", "id", 2);
-            fail("Should throw an exception");
         } catch (CamelExecutionException e) {
+            closed++;
             ClosedCorrelationKeyException cause = assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
             assertEquals("2", cause.getCorrelationKey());
             assertTrue(cause.getMessage().startsWith("The correlation key [2] has been closed."));
@@ -99,14 +109,16 @@ public class AggregateClosedCorrelationKeyTest extends ContextTestSupport {
         // should be closed
         try {
             template.sendBodyAndHeader("direct:start", "I", "id", 3);
-            fail("Should throw an exception");
         } catch (CamelExecutionException e) {
+            closed++;
             ClosedCorrelationKeyException cause = assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
             assertEquals("3", cause.getCorrelationKey());
             assertTrue(cause.getMessage().startsWith("The correlation key [3] has been closed."));
         }
 
         assertMockEndpointsSatisfied();
+
+        assertEquals("There should be 2 closed", 2, closed);
     }
 
 }