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/05/07 13:18:09 UTC

[4/5] camel git commit: CAMEL-9250: Configure AllowUseOriginalMessage to be disabled by default if not in use. Polished so showing endpoint is a bit nicer in toString such as the start/stop logs from Camel.

CAMEL-9250: Configure AllowUseOriginalMessage to be disabled by default if not in use. Polished so showing endpoint is a bit nicer in toString such as the start/stop logs from Camel.


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

Branch: refs/heads/master
Commit: 756464a0f5db2c6fa892b2b36783314c47a5eaca
Parents: df9427f
Author: Claus Ibsen <da...@apache.org>
Authored: Sat May 7 14:54:59 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat May 7 14:54:59 2016 +0200

----------------------------------------------------------------------
 .../component/direct/DirectEndpointRouteInlinedTest.java |  2 +-
 .../seda/SedaConcurrentConsumersNPEIssueTest.java        |  4 ++--
 .../java/org/apache/camel/impl/DefaultEndpointTest.java  |  2 +-
 .../apache/camel/impl/MultipleConsumersSupportTest.java  |  2 +-
 .../org/apache/camel/impl/OriginalMessageProcessor.java  | 11 +++++++----
 .../apache/camel/processor/TraceableUnitOfWorkTest.java  |  2 +-
 .../camel/component/cxf/CxfConsumerStartTwiceTest.java   |  4 ++--
 .../component/cxf/CxfMultipleConsumersSupportTest.java   |  4 ++--
 .../DisruptorConcurrentConsumersNPEIssueTest.java        |  4 ++--
 .../component/ibatis/IBatisUnknownStatementTypeTest.java |  2 +-
 .../component/jms/JmsTestConnectionOnStartupTest.java    |  4 ++--
 .../apache/camel/component/jt400/Jt400EndpointTest.java  |  2 +-
 .../camel/component/jt400/Jt400PgmEndpointTest.java      |  2 +-
 .../mybatis/MyBatisUnknownStatementTypeTest.java         |  2 +-
 14 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/component/direct/DirectEndpointRouteInlinedTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/direct/DirectEndpointRouteInlinedTest.java b/camel-core/src/test/java/org/apache/camel/component/direct/DirectEndpointRouteInlinedTest.java
index f4d40e1..8588099 100644
--- a/camel-core/src/test/java/org/apache/camel/component/direct/DirectEndpointRouteInlinedTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/direct/DirectEndpointRouteInlinedTest.java
@@ -56,7 +56,7 @@ public class DirectEndpointRouteInlinedTest extends ContextTestSupport {
             });
             fail("Should have thrown exception");
         } catch (FailedToStartRouteException e) {
-            assertEquals("Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: Endpoint[direct://start]", e.getMessage());
+            assertEquals("Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: direct://start", e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersNPEIssueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersNPEIssueTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersNPEIssueTest.java
index 63bc5de..22dd45a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersNPEIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersNPEIssueTest.java
@@ -39,7 +39,7 @@ public class SedaConcurrentConsumersNPEIssueTest extends ContextTestSupport {
             fail("Should have thrown exception");
         } catch (FailedToStartRouteException e) {
             assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:"
-                    + " Endpoint[seda://foo?concurrentConsumers=5]", e.getMessage());
+                    + " seda://foo?concurrentConsumers=5", e.getMessage());
         }
     }
 
@@ -59,7 +59,7 @@ public class SedaConcurrentConsumersNPEIssueTest extends ContextTestSupport {
             fail("Should have thrown exception");
         } catch (FailedToStartRouteException e) {
             assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:"
-                    + " Endpoint[seda://foo?concurrentConsumers=5]", e.getMessage());
+                    + " seda://foo?concurrentConsumers=5", e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/impl/DefaultEndpointTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultEndpointTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultEndpointTest.java
index 9a2f657..a569a53 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultEndpointTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultEndpointTest.java
@@ -46,7 +46,7 @@ public class DefaultEndpointTest extends ContextTestSupport {
         final String epstr = "myep:///test";
         MyEndpoint ep = new MyEndpoint();
         ep.setEndpointUri(epstr);
-        assertTrue(ep.toString().indexOf(epstr) > 0);
+        assertTrue(ep.toString().contains(epstr));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/impl/MultipleConsumersSupportTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/MultipleConsumersSupportTest.java b/camel-core/src/test/java/org/apache/camel/impl/MultipleConsumersSupportTest.java
index 9d300c3..810de5c 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/MultipleConsumersSupportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/MultipleConsumersSupportTest.java
@@ -53,7 +53,7 @@ public class MultipleConsumersSupportTest extends ContextTestSupport {
             context.start();
             fail("Should have thrown exception");
         } catch (FailedToStartRouteException e) {
-            assertTrue(e.getMessage().endsWith("Multiple consumers for the same endpoint is not allowed: Endpoint[my:endpoint]"));
+            assertTrue(e.getMessage().endsWith("Multiple consumers for the same endpoint is not allowed: my:endpoint"));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/impl/OriginalMessageProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/OriginalMessageProcessor.java b/camel-core/src/test/java/org/apache/camel/impl/OriginalMessageProcessor.java
index ef0bd6f..d7563fa 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/OriginalMessageProcessor.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/OriginalMessageProcessor.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,10 @@ public class OriginalMessageProcessor implements Processor {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        Message original = exchange.getUnitOfWork().getOriginalInMessage();
+        Message original = null;
+        if (exchange.getContext().isAllowUseOriginalMessage()) {
+            original = exchange.getUnitOfWork().getOriginalInMessage();
+        }
         if (original == null) {
             exchange.getIn().setHeader("HasOriginal", "false");
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java b/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
index 0cc1e3c..d2601a7 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
@@ -34,7 +34,7 @@ public class TraceableUnitOfWorkTest extends ContextTestSupport {
 
     public void testSendingSomeMessages() throws Exception {
         Object out = template.requestBody("direct:start", "Hello London");
-        assertEquals("Failed at: sendTo(Endpoint[bean://bar])", out);
+        assertEquals("Failed at: sendTo(bean://bar)", out);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerStartTwiceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerStartTwiceTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerStartTwiceTest.java
index 8ae4b59..d50f40a 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerStartTwiceTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerStartTwiceTest.java
@@ -55,8 +55,8 @@ public class CxfConsumerStartTwiceTest extends Assert {
             fail("Expect to catch an exception here");
         } catch (Exception ex) {
             assertTrue(ex.getMessage().endsWith(
-                "Multiple consumers for the same endpoint is not allowed: Endpoint[cxf://http://localhost:" + PORT
-                + "/" + getClass().getSimpleName() + "/test?serviceClass=org.apache.camel.component.cxf.HelloService]"));
+                "Multiple consumers for the same endpoint is not allowed: cxf://http://localhost:" + PORT
+                + "/" + getClass().getSimpleName() + "/test?serviceClass=org.apache.camel.component.cxf.HelloService"));
         }
                 
         context.stop();

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMultipleConsumersSupportTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMultipleConsumersSupportTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMultipleConsumersSupportTest.java
index ef1423d..4709887 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMultipleConsumersSupportTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMultipleConsumersSupportTest.java
@@ -54,8 +54,8 @@ public class CxfMultipleConsumersSupportTest extends CamelTestSupport {
             fail("Should have thrown an exception");
         } catch (FailedToStartRouteException e) {
             assertTrue(e.getMessage().endsWith(
-                "Multiple consumers for the same endpoint is not allowed: Endpoint[cxf://http://localhost:" + port1 
-                + "/CxfMultipleConsumersSupportTest/test?serviceClass=org.apache.camel.component.cxf.HelloService]"));
+                "Multiple consumers for the same endpoint is not allowed: cxf://http://localhost:" + port1 
+                + "/CxfMultipleConsumersSupportTest/test?serviceClass=org.apache.camel.component.cxf.HelloService"));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorConcurrentConsumersNPEIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorConcurrentConsumersNPEIssueTest.java b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorConcurrentConsumersNPEIssueTest.java
index 52a7232..b4488f3 100644
--- a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorConcurrentConsumersNPEIssueTest.java
+++ b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorConcurrentConsumersNPEIssueTest.java
@@ -41,7 +41,7 @@ public class DisruptorConcurrentConsumersNPEIssueTest extends CamelTestSupport {
         } catch (FailedToStartRouteException e) {
             assertEquals(
                     "Failed to start route first because of Multiple consumers for the same endpoint is not allowed:"
-                            + " Endpoint[disruptor://foo?concurrentConsumers=5]", e.getMessage());
+                            + " disruptor://foo?concurrentConsumers=5", e.getMessage());
         }
     }
 
@@ -63,7 +63,7 @@ public class DisruptorConcurrentConsumersNPEIssueTest extends CamelTestSupport {
         } catch (FailedToStartRouteException e) {
             assertEquals(
                     "Failed to start route first because of Multiple consumers for the same endpoint is not allowed:"
-                            + " Endpoint[disruptor://foo?concurrentConsumers=5]", e.getMessage());
+                            + " disruptor://foo?concurrentConsumers=5", e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
index f7dc044..c87bdf8 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
@@ -41,7 +41,7 @@ public class IBatisUnknownStatementTypeTest extends CamelTestSupport {
             fail("Should have thrown exception");
         } catch (FailedToCreateRouteException e) {
             assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
-            assertEquals("statementType must be specified on: Endpoint[ibatis://selectAllAccounts]", e.getCause().getCause().getMessage());
+            assertEquals("statementType must be specified on: ibatis://selectAllAccounts", e.getCause().getCause().getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
index 045aed1..6d1b7a1 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
@@ -46,7 +46,7 @@ public class JmsTestConnectionOnStartupTest extends CamelTestSupport {
             context.start();
             fail("Should have thrown an exception");
         } catch (FailedToCreateConsumerException e) {
-            assertEquals("Failed to create Consumer for endpoint: Endpoint[activemq://queue:foo?testConnectionOnStartup=true]. "
+            assertEquals("Failed to create Consumer for endpoint: activemq://queue:foo?testConnectionOnStartup=true. "
                 + "Reason: Cannot get JMS Connection on startup for destination foo", e.getMessage());
         }
     }
@@ -64,7 +64,7 @@ public class JmsTestConnectionOnStartupTest extends CamelTestSupport {
             context.start();
             fail("Should have thrown an exception");
         } catch (FailedToCreateProducerException e) {
-            assertTrue(e.getMessage().startsWith("Failed to create Producer for endpoint: Endpoint[activemq://queue:foo?testConnectionOnStartup=true]."));
+            assertTrue(e.getMessage().startsWith("Failed to create Producer for endpoint: activemq://queue:foo?testConnectionOnStartup=true."));
             assertTrue(e.getMessage().contains("java.net.ConnectException"));
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400EndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400EndpointTest.java b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400EndpointTest.java
index e71cd1f..8d1693a 100644
--- a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400EndpointTest.java
+++ b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400EndpointTest.java
@@ -47,6 +47,6 @@ public class Jt400EndpointTest extends Jt400TestSupport {
 
     @Test
     public void testToString() {
-        assertEquals("Endpoint[jt400://user:xxxxxx@host/qsys.lib/library.lib/queue.dtaq?ccsid=500&connectionPool=%23mockPool&format=binary&guiAvailable=true]", endpoint.toString());
+        assertEquals("jt400://user:xxxxxx@host/qsys.lib/library.lib/queue.dtaq?ccsid=500&connectionPool=%23mockPool&format=binary&guiAvailable=true", endpoint.toString());
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400PgmEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400PgmEndpointTest.java b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400PgmEndpointTest.java
index 70470db..7249951 100644
--- a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400PgmEndpointTest.java
+++ b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400PgmEndpointTest.java
@@ -60,7 +60,7 @@ public class Jt400PgmEndpointTest extends Jt400TestSupport {
     
     @Test
     public void testToString() {
-        assertEquals("Endpoint[jt400://USER:xxxxxx@host/qsys.lib/library.lib/prog.pgm?connectionPool=%23mockPool&fieldsLength=10%2C512%2C255&format=binary&guiAvailable=true&outputFieldsIdx=1%2C2]",
+        assertEquals("jt400://USER:xxxxxx@host/qsys.lib/library.lib/prog.pgm?connectionPool=%23mockPool&fieldsLength=10%2C512%2C255&format=binary&guiAvailable=true&outputFieldsIdx=1%2C2",
                      endpoint.toString());
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/756464a0/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
index 8af60c3..9c2ebe8 100644
--- a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
+++ b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
@@ -40,7 +40,7 @@ public class MyBatisUnknownStatementTypeTest extends CamelTestSupport {
             fail("Should have thrown exception");
         } catch (Exception e) {
             assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
-            assertEquals("statementType must be specified on: Endpoint[mybatis://selectAllAccounts]", e.getCause().getCause().getMessage());
+            assertEquals("statementType must be specified on: mybatis://selectAllAccounts", e.getCause().getCause().getMessage());
         }
     }