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 2014/08/22 08:12:14 UTC
[01/10] git commit: CAMEL-7730 plus added junit test for this bug
Repository: camel
Updated Branches:
refs/heads/camel-2.13.x c2ddc7ba6 -> 430d1a254
refs/heads/master 8142b4380 -> 84812de96
CAMEL-7730 plus added junit test for this bug
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7e699997
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7e699997
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7e699997
Branch: refs/heads/master
Commit: 7e699997bdad65ee89129055db7f97b7dd922942
Parents: 8945cf1
Author: Roman Jakubco <rj...@redhat.com>
Authored: Thu Aug 21 16:38:57 2014 +0200
Committer: Roman Jakubco <rj...@redhat.com>
Committed: Thu Aug 21 16:38:57 2014 +0200
----------------------------------------------------------------------
.../infinispan/InfinispanOperation.java | 10 +++-
.../infinispan/InfinispanProducer.java | 2 +-
.../infinispan/InfinispanProducerTest.java | 58 ++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7e699997/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
index ae8e18d..04ffe55 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
@@ -24,9 +24,11 @@ import org.slf4j.LoggerFactory;
public class InfinispanOperation {
private static final transient Logger LOGGER = LoggerFactory.getLogger(InfinispanOperation.class);
private final BasicCache<Object, Object> cache;
+ private final InfinispanConfiguration configuration;
- public InfinispanOperation(BasicCache<Object, Object> cache) {
+ public InfinispanOperation(BasicCache<Object, Object> cache, InfinispanConfiguration configuration) {
this.cache = cache;
+ this.configuration = configuration;
}
public void process(Exchange exchange) {
@@ -37,7 +39,11 @@ public class InfinispanOperation {
private Operation getOperation(Exchange exchange) {
String operation = exchange.getIn().getHeader(InfinispanConstants.OPERATION, String.class);
if (operation == null) {
- operation = InfinispanConstants.PUT;
+ if(configuration.getCommand() != null){
+ operation = InfinispanConstants.OPERATION + configuration.getCommand();
+ } else{
+ operation = InfinispanConstants.PUT;
+ }
}
LOGGER.trace("Operation: [{}]", operation);
return Operation.valueOf(operation.substring(InfinispanConstants.OPERATION.length()).toUpperCase());
http://git-wip-us.apache.org/repos/asf/camel/blob/7e699997/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
index 9e3037c..4063553 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
@@ -39,7 +39,7 @@ public class InfinispanProducer extends DefaultProducer {
@Override
public void process(Exchange exchange) throws Exception {
- new InfinispanOperation(getCache(exchange)).process(exchange);
+ new InfinispanOperation(getCache(exchange), configuration).process(exchange);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/7e699997/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
index e31fd92..7a7d003 100644
--- a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.infinispan;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
+import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -26,6 +27,9 @@ import static org.hamcrest.core.Is.is;
public class InfinispanProducerTest extends InfinispanTestSupport {
+ private static final String COMMAND_VALUE = "commandValue";
+ private static final String COMMAND_KEY = "commandKey1";
+
@Test
public void keyAndValueArePublishedWithDefaultOperation() throws Exception {
template.send("direct:start", new Processor() {
@@ -119,6 +123,51 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
assertThat(currentCache().isEmpty(), is(true));
}
+ @Test
+ public void testUriCommandOption() throws Exception {
+ template.send("direct:put", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ exchange.getIn().setHeader(InfinispanConstants.VALUE, COMMAND_VALUE);
+ }
+ });
+ String result = (String) currentCache().get(COMMAND_KEY);
+ assertEquals(COMMAND_VALUE, result);
+
+ Exchange exchange;
+ exchange = template.send("direct:get", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ }
+ });
+ String resultGet = exchange.getIn().getHeader(InfinispanConstants.RESULT, String.class);
+ assertEquals(COMMAND_VALUE, resultGet);
+
+ exchange = template.send("direct:remove", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ }
+ });
+ String resultRemove = exchange.getIn().getHeader(InfinispanConstants.RESULT, String.class);
+ assertEquals(COMMAND_VALUE, resultRemove);
+ assertNull(currentCache().get(COMMAND_KEY));
+ assertTrue(currentCache().isEmpty());
+
+ currentCache().put(COMMAND_KEY, COMMAND_VALUE);
+ currentCache().put("keyTest","valueTest");
+
+ template.send("direct:clear", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+
+ }
+ });
+ assertTrue(currentCache().isEmpty());
+ }
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -126,6 +175,15 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
public void configure() {
from("direct:start")
.to("infinispan://localhost?cacheContainer=#cacheContainer");
+
+ from("direct:put")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=PUT");
+ from("direct:get")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=GET");
+ from("direct:remove")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=REMOVE");
+ from("direct:clear")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=CLEAR");
}
};
}
[09/10] git commit: CAMEL-7730 plus added junit test for this bug
Posted by da...@apache.org.
CAMEL-7730 plus added junit test for this bug
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f8d382ec
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f8d382ec
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f8d382ec
Branch: refs/heads/camel-2.13.x
Commit: f8d382ec95c8cab558364bb8ec48cfa39cb8c9ac
Parents: c2ddc7b
Author: Roman Jakubco <rj...@redhat.com>
Authored: Thu Aug 21 16:38:57 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 08:11:41 2014 +0200
----------------------------------------------------------------------
.../infinispan/InfinispanOperation.java | 10 +++-
.../infinispan/InfinispanProducer.java | 2 +-
.../infinispan/InfinispanProducerTest.java | 58 ++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f8d382ec/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
index ae8e18d..04ffe55 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
@@ -24,9 +24,11 @@ import org.slf4j.LoggerFactory;
public class InfinispanOperation {
private static final transient Logger LOGGER = LoggerFactory.getLogger(InfinispanOperation.class);
private final BasicCache<Object, Object> cache;
+ private final InfinispanConfiguration configuration;
- public InfinispanOperation(BasicCache<Object, Object> cache) {
+ public InfinispanOperation(BasicCache<Object, Object> cache, InfinispanConfiguration configuration) {
this.cache = cache;
+ this.configuration = configuration;
}
public void process(Exchange exchange) {
@@ -37,7 +39,11 @@ public class InfinispanOperation {
private Operation getOperation(Exchange exchange) {
String operation = exchange.getIn().getHeader(InfinispanConstants.OPERATION, String.class);
if (operation == null) {
- operation = InfinispanConstants.PUT;
+ if(configuration.getCommand() != null){
+ operation = InfinispanConstants.OPERATION + configuration.getCommand();
+ } else{
+ operation = InfinispanConstants.PUT;
+ }
}
LOGGER.trace("Operation: [{}]", operation);
return Operation.valueOf(operation.substring(InfinispanConstants.OPERATION.length()).toUpperCase());
http://git-wip-us.apache.org/repos/asf/camel/blob/f8d382ec/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
index 9e3037c..4063553 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java
@@ -39,7 +39,7 @@ public class InfinispanProducer extends DefaultProducer {
@Override
public void process(Exchange exchange) throws Exception {
- new InfinispanOperation(getCache(exchange)).process(exchange);
+ new InfinispanOperation(getCache(exchange), configuration).process(exchange);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/f8d382ec/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
index e31fd92..7a7d003 100644
--- a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.infinispan;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
+import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -26,6 +27,9 @@ import static org.hamcrest.core.Is.is;
public class InfinispanProducerTest extends InfinispanTestSupport {
+ private static final String COMMAND_VALUE = "commandValue";
+ private static final String COMMAND_KEY = "commandKey1";
+
@Test
public void keyAndValueArePublishedWithDefaultOperation() throws Exception {
template.send("direct:start", new Processor() {
@@ -119,6 +123,51 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
assertThat(currentCache().isEmpty(), is(true));
}
+ @Test
+ public void testUriCommandOption() throws Exception {
+ template.send("direct:put", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ exchange.getIn().setHeader(InfinispanConstants.VALUE, COMMAND_VALUE);
+ }
+ });
+ String result = (String) currentCache().get(COMMAND_KEY);
+ assertEquals(COMMAND_VALUE, result);
+
+ Exchange exchange;
+ exchange = template.send("direct:get", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ }
+ });
+ String resultGet = exchange.getIn().getHeader(InfinispanConstants.RESULT, String.class);
+ assertEquals(COMMAND_VALUE, resultGet);
+
+ exchange = template.send("direct:remove", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(InfinispanConstants.KEY, COMMAND_KEY);
+ }
+ });
+ String resultRemove = exchange.getIn().getHeader(InfinispanConstants.RESULT, String.class);
+ assertEquals(COMMAND_VALUE, resultRemove);
+ assertNull(currentCache().get(COMMAND_KEY));
+ assertTrue(currentCache().isEmpty());
+
+ currentCache().put(COMMAND_KEY, COMMAND_VALUE);
+ currentCache().put("keyTest","valueTest");
+
+ template.send("direct:clear", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+
+ }
+ });
+ assertTrue(currentCache().isEmpty());
+ }
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -126,6 +175,15 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
public void configure() {
from("direct:start")
.to("infinispan://localhost?cacheContainer=#cacheContainer");
+
+ from("direct:put")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=PUT");
+ from("direct:get")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=GET");
+ from("direct:remove")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=REMOVE");
+ from("direct:clear")
+ .to("infinispan://localhost?cacheContainer=#cacheContainer&command=CLEAR");
}
};
}
[02/10] git commit: CAMEL-7731: fix typo
Posted by da...@apache.org.
CAMEL-7731: fix typo
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d7ba9267
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d7ba9267
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d7ba9267
Branch: refs/heads/master
Commit: d7ba926794b4df826c0fc8c57e4ce5afb72bb0e2
Parents: b8e9430
Author: david <da...@davidkarlsen.com>
Authored: Thu Aug 21 18:48:03 2014 +0200
Committer: david <da...@davidkarlsen.com>
Committed: Thu Aug 21 18:48:03 2014 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d7ba9267/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java
index 0416573..393bcb4 100644
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultBeanRowMapper.java
@@ -39,7 +39,7 @@ public class DefaultBeanRowMapper implements BeanRowMapper {
continue;
}
if (toUpper) {
- char upper = Character.toLowerCase(ch);
+ char upper = Character.toUpperCase(ch);
sb.append(upper);
// reset flag
toUpper = false;
[10/10] git commit: CAMEL-7730: Fixed CS
Posted by da...@apache.org.
CAMEL-7730: Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/430d1a25
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/430d1a25
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/430d1a25
Branch: refs/heads/camel-2.13.x
Commit: 430d1a254eca9bdaf3b2508d443d09d817ce4029
Parents: f8d382e
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 08:11:06 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 08:11:48 2014 +0200
----------------------------------------------------------------------
.../apache/camel/component/infinispan/InfinispanOperation.java | 4 ++--
.../camel/component/infinispan/InfinispanProducerTest.java | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/430d1a25/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
index 04ffe55..9299fd6 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
@@ -39,9 +39,9 @@ public class InfinispanOperation {
private Operation getOperation(Exchange exchange) {
String operation = exchange.getIn().getHeader(InfinispanConstants.OPERATION, String.class);
if (operation == null) {
- if(configuration.getCommand() != null){
+ if (configuration.getCommand() != null) {
operation = InfinispanConstants.OPERATION + configuration.getCommand();
- } else{
+ } else {
operation = InfinispanConstants.PUT;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/430d1a25/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
index 7a7d003..a5f6b25 100644
--- a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.infinispan;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -157,7 +156,7 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
assertTrue(currentCache().isEmpty());
currentCache().put(COMMAND_KEY, COMMAND_VALUE);
- currentCache().put("keyTest","valueTest");
+ currentCache().put("keyTest", "valueTest");
template.send("direct:clear", new Processor() {
@Override
[06/10] git commit: Merge branch 'improvement-camel-7724' of
https://github.com/oscerd/camel
Posted by da...@apache.org.
Merge branch 'improvement-camel-7724' of https://github.com/oscerd/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a02bd177
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a02bd177
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a02bd177
Branch: refs/heads/master
Commit: a02bd177da38268199b48a8be62f8df932c53f4e
Parents: f68f2b4 6c66ed4
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 07:38:33 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 07:38:33 2014 +0200
----------------------------------------------------------------------
.../camel/dataformat/bindy/FormatFactory.java | 3 +
.../dataformat/bindy/format/BooleanFormat.java | 31 +++++
.../BindySimpleCsvBooleanFalseMarshallTest.java | 84 ++++++++++++
.../BindySimpleCsvBooleanTrueMarshallTest.java | 84 ++++++++++++
.../BindySimpleCsvBooleanUnmarshallTest.java | 130 +++++++++++++++++++
.../bindy/model/simple/bool/BooleanExample.java | 51 ++++++++
...impleCsvBooleanFalseMarshallTest-context.xml | 32 +++++
...SimpleCsvBooleanTrueMarshallTest-context.xml | 32 +++++
...dySimpleCsvBooleanUnmarshallTest-context.xml | 32 +++++
9 files changed, 479 insertions(+)
----------------------------------------------------------------------
[07/10] git commit: CAMEL-7724: Fixed CS
Posted by da...@apache.org.
CAMEL-7724: Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2025456
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2025456
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2025456
Branch: refs/heads/master
Commit: c20254566b65485ddb0e9d11d4bc2b67e4bd9e95
Parents: a02bd17
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 08:07:38 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 08:07:38 2014 +0200
----------------------------------------------------------------------
.../dataformat/bindy/format/BooleanFormat.java | 2 +-
.../BindySimpleCsvBooleanUnmarshallTest.java | 10 +++---
.../bindy/model/simple/bool/BooleanExample.java | 33 ++++++++++----------
3 files changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c2025456/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
index d94596e..ac0955f 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
@@ -25,7 +25,7 @@ public class BooleanFormat implements Format<Boolean> {
}
public Boolean parse(String string) throws Exception {
- return new Boolean(string);
+ return Boolean.valueOf(string);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c2025456/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
index 44ad4a1..57eea3b 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
@@ -16,11 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.List;
import java.util.Map;
@@ -37,6 +32,11 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
@ContextConfiguration
public class BindySimpleCsvBooleanUnmarshallTest extends AbstractJUnit4SpringContextTests {
http://git-wip-us.apache.org/repos/asf/camel/blob/c2025456/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
index 7378a01..07801ea 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
@@ -21,31 +21,32 @@ import org.apache.camel.dataformat.bindy.annotation.DataField;
@CsvRecord(separator = ",")
public class BooleanExample {
+
@DataField(pos = 1)
public String name;
@DataField(pos = 2, defaultValue = "true")
public Boolean exist;
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public Boolean getExist() {
- return exist;
- }
+ public Boolean getExist() {
+ return exist;
+ }
- public void setExist(Boolean exist) {
- this.exist = exist;
- }
+ public void setExist(Boolean exist) {
+ this.exist = exist;
+ }
- @Override
- public String toString() {
- return "BoolExample [name=" + name + ", exist=" + exist + "]";
- }
+ @Override
+ public String toString() {
+ return "BoolExample [name=" + name + ", exist=" + exist + "]";
+ }
}
[05/10] git commit: Merge branch 'CAMEL-7731' of
https://github.com/davidkarlsen/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7731' of https://github.com/davidkarlsen/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f68f2b4f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f68f2b4f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f68f2b4f
Branch: refs/heads/master
Commit: f68f2b4f27894c21dbf4d0262d371ba6efb1f5f6
Parents: 64bf349 d7ba926
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 07:37:44 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 07:37:44 2014 +0200
----------------------------------------------------------------------
----------------------------------------------------------------------
[03/10] git commit: Improvement Camel-7724 camel-bindy - Add support
for boolean data type formatter
Posted by da...@apache.org.
Improvement Camel-7724 camel-bindy - Add support for boolean data type formatter
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6c66ed40
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6c66ed40
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6c66ed40
Branch: refs/heads/master
Commit: 6c66ed409dcfb50bfcbc1a696a1852ad6d044e96
Parents: b0c572f
Author: ancosen <an...@gmail.com>
Authored: Thu Aug 21 23:37:15 2014 +0200
Committer: ancosen <an...@gmail.com>
Committed: Thu Aug 21 23:37:15 2014 +0200
----------------------------------------------------------------------
.../camel/dataformat/bindy/FormatFactory.java | 3 +
.../dataformat/bindy/format/BooleanFormat.java | 31 +++++
.../BindySimpleCsvBooleanFalseMarshallTest.java | 84 ++++++++++++
.../BindySimpleCsvBooleanTrueMarshallTest.java | 84 ++++++++++++
.../BindySimpleCsvBooleanUnmarshallTest.java | 130 +++++++++++++++++++
.../bindy/model/simple/bool/BooleanExample.java | 51 ++++++++
...impleCsvBooleanFalseMarshallTest-context.xml | 32 +++++
...SimpleCsvBooleanTrueMarshallTest-context.xml | 32 +++++
...dySimpleCsvBooleanUnmarshallTest-context.xml | 32 +++++
9 files changed, 479 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
index 9f11926..d5dc68b 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
@@ -26,6 +26,7 @@ import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
import org.apache.camel.dataformat.bindy.format.BigDecimalFormat;
import org.apache.camel.dataformat.bindy.format.BigIntegerFormat;
+import org.apache.camel.dataformat.bindy.format.BooleanFormat;
import org.apache.camel.dataformat.bindy.format.ByteFormat;
import org.apache.camel.dataformat.bindy.format.BytePatternFormat;
import org.apache.camel.dataformat.bindy.format.CharacterFormat;
@@ -102,6 +103,8 @@ public final class FormatFactory {
return new DatePatternFormat(pattern, timezone, getLocale(locale));
} else if (clazz == char.class || clazz == Character.class) {
return new CharacterFormat();
+ } else if (clazz == boolean.class || clazz == Boolean.class) {
+ return new BooleanFormat();
} else if (clazz.isEnum()) {
return new EnumFormat(clazz);
} else {
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
new file mode 100755
index 0000000..d94596e
--- /dev/null
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.format;
+
+import org.apache.camel.dataformat.bindy.Format;
+
+public class BooleanFormat implements Format<Boolean> {
+
+ public String format(Boolean object) throws Exception {
+ return object.toString();
+ }
+
+ public Boolean parse(String string) throws Exception {
+ return new Boolean(string);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
new file mode 100644
index 0000000..18d649c
--- /dev/null
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample;
+import org.junit.Test;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindySimpleCsvBooleanFalseMarshallTest extends AbstractJUnit4SpringContextTests {
+
+ private List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
+ private String result = "andrew,false\r\n";
+
+ @Produce(uri = "direct:start")
+ private ProducerTemplate template;
+
+ @EndpointInject(uri = "mock:result")
+ private MockEndpoint resultEndpoint;
+
+ @Test
+ public void testMarshallMessage() throws Exception {
+ resultEndpoint.expectedBodiesReceived(result);
+
+ template.sendBody(generateModel());
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+
+ public List<Map<String, Object>> generateModel() {
+ Map<String, Object> modelObjects = new HashMap<String, Object>();
+
+ List<BooleanExample> list = new ArrayList<BooleanExample>();
+
+ BooleanExample example = new BooleanExample();
+
+ example.setName("andrew");
+ example.setExist(Boolean.FALSE);
+
+ modelObjects.put(example.getClass().getName(), example);
+
+ models.add(modelObjects);
+
+ return models;
+ }
+
+ public static class ContextConfig extends RouteBuilder {
+
+ public void configure() {
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+ camelDataFormat.setLocale("en");
+
+ from("direct:start").marshal(camelDataFormat).to("mock:result");
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
new file mode 100644
index 0000000..a707253
--- /dev/null
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample;
+import org.junit.Test;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindySimpleCsvBooleanTrueMarshallTest extends AbstractJUnit4SpringContextTests {
+
+ private List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
+ private String result = "andrew,true\r\n";
+
+ @Produce(uri = "direct:start")
+ private ProducerTemplate template;
+
+ @EndpointInject(uri = "mock:result")
+ private MockEndpoint resultEndpoint;
+
+ @Test
+ public void testMarshallMessage() throws Exception {
+ resultEndpoint.expectedBodiesReceived(result);
+
+ template.sendBody(generateModel());
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+
+ public List<Map<String, Object>> generateModel() {
+ Map<String, Object> modelObjects = new HashMap<String, Object>();
+
+ List<BooleanExample> list = new ArrayList<BooleanExample>();
+
+ BooleanExample example = new BooleanExample();
+
+ example.setName("andrew");
+ example.setExist(Boolean.TRUE);
+
+ modelObjects.put(example.getClass().getName(), example);
+
+ models.add(modelObjects);
+
+ return models;
+ }
+
+ public static class ContextConfig extends RouteBuilder {
+
+ public void configure() {
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+ camelDataFormat.setLocale("en");
+
+ from("direct:start").marshal(camelDataFormat).to("mock:result");
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
new file mode 100755
index 0000000..44ad4a1
--- /dev/null
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
@@ -0,0 +1,130 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample;
+import org.apache.camel.processor.interceptor.Tracer;
+import org.junit.Test;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindySimpleCsvBooleanUnmarshallTest extends AbstractJUnit4SpringContextTests {
+
+ private static final String URI_MOCK_RESULT = "mock:result";
+ private static final String URI_MOCK_ERROR = "mock:error";
+ private static final String URI_DIRECT_START = "direct:start";
+
+ @Produce(uri = URI_DIRECT_START)
+ private ProducerTemplate template;
+
+ @EndpointInject(uri = URI_MOCK_RESULT)
+ private MockEndpoint result;
+
+ @EndpointInject(uri = URI_MOCK_ERROR)
+ private MockEndpoint error;
+
+ private String expected;
+
+ @SuppressWarnings("unchecked")
+ @Test
+ @DirtiesContext
+ public void testUnMarshallMessageWithBoolean() throws Exception {
+
+ // We suppress the firstName field of the first record
+ expected = "andrew,true\r\n" + "andrew,false\r\n";
+
+ template.sendBody(expected);
+
+ List<Map<String, BooleanExample>> examples = (List<Map<String, BooleanExample>>) result.getExchanges().get(0).getIn().getBody();
+
+ result.expectedMessageCount(1);
+ result.assertIsSatisfied();
+
+ assertFalse(examples.get(0).get(BooleanExample.class.getName()).getName().isEmpty());
+ assertEquals(examples.get(0).get(BooleanExample.class.getName()).getName(), "andrew");
+ assertTrue(examples.get(0).get(BooleanExample.class.getName()).getExist());
+ assertFalse(examples.get(1).get(BooleanExample.class.getName()).getName().isEmpty());
+ assertEquals(examples.get(1).get(BooleanExample.class.getName()).getName(), "andrew");
+ assertFalse(examples.get(1).get(BooleanExample.class.getName()).getExist());
+ assertNotNull(examples);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ @DirtiesContext
+ public void testUnMarshallMessageWithBooleanMissingFields() throws Exception {
+
+ // We suppress the firstName field of the first record
+ expected = "andrew,true\r\n" + "joseph,false\r\n" + "nicholas,\r\n";
+
+ template.sendBody(expected);
+
+ List<Map<String, BooleanExample>> examples = (List<Map<String, BooleanExample>>) result.getExchanges().get(0).getIn().getBody();
+
+ result.expectedMessageCount(1);
+ result.assertIsSatisfied();
+
+ assertFalse(examples.get(0).get(BooleanExample.class.getName()).getName().isEmpty());
+ assertEquals(examples.get(0).get(BooleanExample.class.getName()).getName(), "andrew");
+ assertTrue(examples.get(0).get(BooleanExample.class.getName()).getExist());
+ assertFalse(examples.get(1).get(BooleanExample.class.getName()).getName().isEmpty());
+ assertEquals(examples.get(1).get(BooleanExample.class.getName()).getName(), "joseph");
+ assertFalse(examples.get(1).get(BooleanExample.class.getName()).getExist());
+ assertFalse(examples.get(2).get(BooleanExample.class.getName()).getName().isEmpty());
+ assertEquals(examples.get(2).get(BooleanExample.class.getName()).getName(), "nicholas");
+ assertTrue(examples.get(2).get(BooleanExample.class.getName()).getExist());
+ assertNotNull(examples);
+ }
+
+ public static class ContextConfig extends RouteBuilder {
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+
+ public void configure() {
+ // from("file://src/test/data?move=./target/done").unmarshal(camelDataFormat).to("mock:result");
+
+ Tracer tracer = new Tracer();
+ tracer.setLogLevel(LoggingLevel.ERROR);
+ tracer.setLogName("org.apache.camel.bindy");
+
+ getContext().addInterceptStrategy(tracer);
+
+ // default should errors go to mock:error
+ errorHandler(deadLetterChannel(URI_MOCK_ERROR).redeliveryDelay(0));
+
+ onException(Exception.class).maximumRedeliveries(0).handled(true);
+
+ from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
new file mode 100644
index 0000000..7378a01
--- /dev/null
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/bool/BooleanExample.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.model.simple.bool;
+
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+
+@CsvRecord(separator = ",")
+public class BooleanExample {
+ @DataField(pos = 1)
+ public String name;
+
+ @DataField(pos = 2, defaultValue = "true")
+ public Boolean exist;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Boolean getExist() {
+ return exist;
+ }
+
+ public void setExist(Boolean exist) {
+ this.exist = exist;
+ }
+
+ @Override
+ public String toString() {
+ return "BoolExample [name=" + name + ", exist=" + exist + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest-context.xml b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest-context.xml
new file mode 100644
index 0000000..6692f2a
--- /dev/null
+++ b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest-context.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ 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
+
+ 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <routeBuilder ref="myBuilder" />
+ </camelContext>
+
+ <bean id="myBuilder" class="org.apache.camel.dataformat.bindy.csv.BindySimpleCsvBooleanFalseMarshallTest$ContextConfig"/>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest-context.xml b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest-context.xml
new file mode 100644
index 0000000..d9ece2a
--- /dev/null
+++ b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest-context.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ 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
+
+ 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <routeBuilder ref="myBuilder" />
+ </camelContext>
+
+ <bean id="myBuilder" class="org.apache.camel.dataformat.bindy.csv.BindySimpleCsvBooleanTrueMarshallTest$ContextConfig"/>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/6c66ed40/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest-context.xml b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest-context.xml
new file mode 100644
index 0000000..d6f3412
--- /dev/null
+++ b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest-context.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ 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
+
+ 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <routeBuilder ref="myBuilder" />
+ </camelContext>
+
+ <bean id="myBuilder" class="org.apache.camel.dataformat.bindy.csv.BindySimpleCsvBooleanUnmarshallTest$ContextConfig"/>
+
+</beans>
\ No newline at end of file
[08/10] git commit: CAMEL-7730: Fixed CS
Posted by da...@apache.org.
CAMEL-7730: Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/84812de9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/84812de9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/84812de9
Branch: refs/heads/master
Commit: 84812de9615a32fb8e683de1643bc9840f689e5d
Parents: c202545
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 08:11:06 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 08:11:06 2014 +0200
----------------------------------------------------------------------
.../apache/camel/component/infinispan/InfinispanOperation.java | 4 ++--
.../camel/component/infinispan/InfinispanProducerTest.java | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/84812de9/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
index 04ffe55..9299fd6 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanOperation.java
@@ -39,9 +39,9 @@ public class InfinispanOperation {
private Operation getOperation(Exchange exchange) {
String operation = exchange.getIn().getHeader(InfinispanConstants.OPERATION, String.class);
if (operation == null) {
- if(configuration.getCommand() != null){
+ if (configuration.getCommand() != null) {
operation = InfinispanConstants.OPERATION + configuration.getCommand();
- } else{
+ } else {
operation = InfinispanConstants.PUT;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/84812de9/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
index 7a7d003..a5f6b25 100644
--- a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
+++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.infinispan;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -157,7 +156,7 @@ public class InfinispanProducerTest extends InfinispanTestSupport {
assertTrue(currentCache().isEmpty());
currentCache().put(COMMAND_KEY, COMMAND_VALUE);
- currentCache().put("keyTest","valueTest");
+ currentCache().put("keyTest", "valueTest");
template.send("direct:clear", new Processor() {
@Override
[04/10] git commit: Merge branch 'CAMEL-7730' of
https://github.com/romanjakubco/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7730' of https://github.com/romanjakubco/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/64bf349b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/64bf349b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/64bf349b
Branch: refs/heads/master
Commit: 64bf349b7f235cb3e5d824b9b8ec91f7086b3b7c
Parents: 8142b43 7e69999
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 07:37:22 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 07:37:22 2014 +0200
----------------------------------------------------------------------
.../infinispan/InfinispanOperation.java | 10 +++-
.../infinispan/InfinispanProducer.java | 2 +-
.../infinispan/InfinispanProducerTest.java | 58 ++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------