[1/6] git commit: Add GPathResult converter tests
Repository: camel Updated Branches: refs/heads/master ce8aac572 - f4b7333c3 Add GPathResult converter tests Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bc7a50cf Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bc7a50cf Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bc7a50cf Branch: refs/heads/master Commit: bc7a50cf9c80bce0b2e58201bb657789330c0b4e Parents: 75b2c0a Author: Dominik Adam Przybysz alien11...@gmail.com Authored: Sun Aug 17 20:55:33 2014 +0200 Committer: Dominik Adam Przybysz alien11...@gmail.com Committed: Sun Aug 17 21:07:44 2014 +0200 -- .../groovy/converter/GPathResultConverter.java | 8 .../services/org/apache/camel/TypeConverter | 3 +- .../converter/GPathResultConverterTest.groovy | 48 3 files changed, 58 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/bc7a50cf/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java -- diff --git a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java new file mode 100644 index 000..12802e3 --- /dev/null +++ b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java @@ -0,0 +1,8 @@ +package org.apache.camel.groovy.converter; + +import org.apache.camel.Converter; + +@Converter +public class GPathResultConverter { + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bc7a50cf/components/camel-groovy/src/main/resources/META-INF/services/org/apache/camel/TypeConverter -- diff --git a/components/camel-groovy/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-groovy/src/main/resources/META-INF/services/org/apache/camel/TypeConverter index 62a0595..8a0e315 100644 --- a/components/camel-groovy/src/main/resources/META-INF/services/org/apache/camel/TypeConverter +++ b/components/camel-groovy/src/main/resources/META-INF/services/org/apache/camel/TypeConverter @@ -14,4 +14,5 @@ # See the License for the specific language governing permissions and # limitations under the License. # -org.apache.camel.groovy.converter.TypeConverter \ No newline at end of file +org.apache.camel.groovy.converter.TypeConverter +org.apache.camel.groovy.converter.GPathResultConverter \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/bc7a50cf/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy -- diff --git a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy new file mode 100644 index 000..22daa5e --- /dev/null +++ b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy @@ -0,0 +1,48 @@ +package org.apache.camel.groovy.converter + +import groovy.util.slurpersupport.GPathResult +import org.apache.camel.CamelContext +import org.apache.camel.Exchange +import org.apache.camel.StringSource +import org.apache.camel.impl.DefaultCamelContext +import org.apache.camel.impl.DefaultExchange +import org.junit.Test +import org.w3c.dom.Node + +import static org.junit.Assert.assertEquals + +public class GPathResultConverterTest { +String xml = testelem1This is test/elem1/test +CamelContext context = new DefaultCamelContext() + +@Test +void should convert string to GPathResult() { +Exchange exchange = new DefaultExchange(context) +exchange.in.setBody(xml, String) +GPathResult result = exchange.in.getBody(GPathResult) +checkGPathResult(result) +} + +@Test +void should convert string source to GPathResult() { +StringSource input = new StringSource(xml) +Exchange exchange = new DefaultExchange(context) +exchange.in.setBody(input, StringSource) +GPathResult result = exchange.in.getBody(GPathResult) +checkGPathResult(result) +} + +@Test +void should convert node to GPathResult() { +Node node = new XmlParser().parseText(xml) +Exchange exchange = new DefaultExchange(context) +exchange.in.setBody(node, Node) +GPathResult result = exchange.in.getBody(GPathResult) +checkGPathResult(result) +} + +private void checkGPathResult(GPathResult gPathResult) { +
[4/6] git commit: Organize imports in GPathResultConverter
Organize imports in GPathResultConverter Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7bb8b76a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7bb8b76a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7bb8b76a Branch: refs/heads/master Commit: 7bb8b76aaa63236965aeacb4a6f98f57ba90b754 Parents: e657822 Author: Dominik Adam Przybysz alien11...@gmail.com Authored: Sun Aug 17 22:40:37 2014 +0200 Committer: Dominik Adam Przybysz alien11...@gmail.com Committed: Sun Aug 17 22:40:37 2014 +0200 -- .../apache/camel/groovy/converter/GPathResultConverter.java | 7 --- .../camel/groovy/converter/GPathResultConverterTest.groovy| 7 --- 2 files changed, 4 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7bb8b76a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java -- diff --git a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java index f3c9118..561fc16 100644 --- a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java +++ b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java @@ -2,7 +2,6 @@ package org.apache.camel.groovy.converter; import groovy.util.XmlSlurper; import groovy.util.slurpersupport.GPathResult; -import groovy.xml.StreamingMarkupBuilder; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.StringSource; @@ -11,14 +10,8 @@ import org.w3c.dom.Node; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import java.io.IOException; -import java.io.StringWriter; @Converter public class GPathResultConverter { http://git-wip-us.apache.org/repos/asf/camel/blob/7bb8b76a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy -- diff --git a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy index c17feb8..517cfc0 100644 --- a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy +++ b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy @@ -8,9 +8,10 @@ import org.apache.camel.impl.DefaultCamelContext import org.apache.camel.impl.DefaultExchange import org.junit.Test import org.w3c.dom.Node -import javax.xml.parsers.DocumentBuilderFactory import org.xml.sax.InputSource +import javax.xml.parsers.DocumentBuilderFactory + import static org.junit.Assert.assertEquals import static org.junit.Assert.assertNotNull @@ -38,7 +39,7 @@ public class GPathResultConverterTest { @Test void should convert node to GPathResult() { Node node = DocumentBuilderFactory.newInstance().newDocumentBuilder() - .parse(new InputSource(new StringReader(xml))) +.parse(new InputSource(new StringReader(xml))) Exchange exchange = new DefaultExchange(context) exchange.in.setBody(node, Node) GPathResult result = exchange.in.getBody(GPathResult) @@ -46,7 +47,7 @@ public class GPathResultConverterTest { } private void checkGPathResult(GPathResult gPathResult) { - assertNotNull(gPathResult) +assertNotNull(gPathResult) assertEquals(gPathResult.name(), test) assertEquals(gPathResult.elem1.text(), This is test) }
[2/6] git commit: Implement GPathConverter methods
Implement GPathConverter methods Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c9e26a52 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c9e26a52 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c9e26a52 Branch: refs/heads/master Commit: c9e26a5a1e01b324ade199e731d7a96d9811 Parents: bc7a50c Author: Dominik Adam Przybysz alien11...@gmail.com Authored: Sun Aug 17 22:33:59 2014 +0200 Committer: Dominik Adam Przybysz alien11...@gmail.com Committed: Sun Aug 17 22:33:59 2014 +0200 -- .../groovy/converter/GPathResultConverter.java | 33 .../converter/GPathResultConverterTest.groovy | 9 -- 2 files changed, 40 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c9e26a52/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java -- diff --git a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java index 12802e3..e5008a8 100644 --- a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java +++ b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java @@ -1,8 +1,41 @@ package org.apache.camel.groovy.converter; +import groovy.util.XmlSlurper; +import groovy.util.slurpersupport.GPathResult; +import groovy.xml.StreamingMarkupBuilder; import org.apache.camel.Converter; +import org.apache.camel.StringSource; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.IOException; +import java.io.StringWriter; @Converter public class GPathResultConverter { +@Converter +public static GPathResult fromString(String input) throws ParserConfigurationException, SAXException, IOException { +return new XmlSlurper().parseText(input); +} + +@Converter +public static GPathResult fromStringSource(StringSource input) throws IOException, SAXException, ParserConfigurationException { +return fromString(input.getText()); +} + +@Converter +public static GPathResult fromNode(Node input) throws IOException, SAXException, ParserConfigurationException, TransformerException { +StringWriter writer = new StringWriter(); +Transformer t = TransformerFactory.newInstance().newTransformer(); +t.transform(new DOMSource(input), new StreamResult(writer)); +return fromString(writer.toString()); +} } http://git-wip-us.apache.org/repos/asf/camel/blob/c9e26a52/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy -- diff --git a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy index 22daa5e..c17feb8 100644 --- a/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy +++ b/components/camel-groovy/src/test/groovy/org/apache/camel/groovy/converter/GPathResultConverterTest.groovy @@ -8,8 +8,11 @@ import org.apache.camel.impl.DefaultCamelContext import org.apache.camel.impl.DefaultExchange import org.junit.Test import org.w3c.dom.Node +import javax.xml.parsers.DocumentBuilderFactory +import org.xml.sax.InputSource import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull public class GPathResultConverterTest { String xml = testelem1This is test/elem1/test @@ -34,7 +37,8 @@ public class GPathResultConverterTest { @Test void should convert node to GPathResult() { -Node node = new XmlParser().parseText(xml) +Node node = DocumentBuilderFactory.newInstance().newDocumentBuilder() + .parse(new InputSource(new StringReader(xml))) Exchange exchange = new DefaultExchange(context) exchange.in.setBody(node, Node) GPathResult result = exchange.in.getBody(GPathResult) @@ -42,7 +46,8 @@ public class GPathResultConverterTest { } private void checkGPathResult(GPathResult gPathResult) { +
[6/6] git commit: Fixed CS
Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f4b7333c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f4b7333c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f4b7333c Branch: refs/heads/master Commit: f4b7333c34c1d389bd0386c24aab34ea6fc85b31 Parents: 5511262 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:42:14 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:42:14 2014 +0200 -- .../groovy/converter/GPathResultConverter.java | 29 1 file changed, 23 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f4b7333c/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java -- diff --git a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java index 561fc16..6c7384e 100644 --- a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java +++ b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java @@ -1,17 +1,34 @@ +/** + * 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.groovy.converter; +import java.io.IOException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; + +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + import groovy.util.XmlSlurper; import groovy.util.slurpersupport.GPathResult; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.StringSource; import org.apache.camel.converter.jaxp.XmlConverter; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import java.io.IOException; @Converter public class GPathResultConverter {
[5/6] git commit: Merge branch 'addGPathResultConverter' of https://github.com/alien11689/camel
Merge branch 'addGPathResultConverter' of https://github.com/alien11689/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/55112629 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55112629 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55112629 Branch: refs/heads/master Commit: 55112629231b8bcaa0b0b288d3f13d7c9e530751 Parents: ce8aac5 7bb8b76 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:38:16 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:38:16 2014 +0200 -- .../groovy/converter/GPathResultConverter.java | 35 + .../services/org/apache/camel/TypeConverter | 3 +- .../converter/GPathResultConverterTest.groovy | 54 3 files changed, 91 insertions(+), 1 deletion(-) --
[3/6] git commit: Rewrite converting Node to GPathResult
Rewrite converting Node to GPathResult Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e657822b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e657822b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e657822b Branch: refs/heads/master Commit: e657822b7d905af1951765211dae7d205f18acaf Parents: c9e26a5 Author: Dominik Adam Przybysz alien11...@gmail.com Authored: Sun Aug 17 22:38:56 2014 +0200 Committer: Dominik Adam Przybysz alien11...@gmail.com Committed: Sun Aug 17 22:38:56 2014 +0200 -- .../camel/groovy/converter/GPathResultConverter.java | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e657822b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java -- diff --git a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java index e5008a8..f3c9118 100644 --- a/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java +++ b/components/camel-groovy/src/main/java/org/apache/camel/groovy/converter/GPathResultConverter.java @@ -4,7 +4,9 @@ import groovy.util.XmlSlurper; import groovy.util.slurpersupport.GPathResult; import groovy.xml.StreamingMarkupBuilder; import org.apache.camel.Converter; +import org.apache.camel.Exchange; import org.apache.camel.StringSource; +import org.apache.camel.converter.jaxp.XmlConverter; import org.w3c.dom.Node; import org.xml.sax.SAXException; @@ -21,21 +23,20 @@ import java.io.StringWriter; @Converter public class GPathResultConverter { +private final XmlConverter xmlConverter = new XmlConverter(); + @Converter -public static GPathResult fromString(String input) throws ParserConfigurationException, SAXException, IOException { +public GPathResult fromString(String input) throws ParserConfigurationException, SAXException, IOException { return new XmlSlurper().parseText(input); } @Converter -public static GPathResult fromStringSource(StringSource input) throws IOException, SAXException, ParserConfigurationException { +public GPathResult fromStringSource(StringSource input) throws IOException, SAXException, ParserConfigurationException { return fromString(input.getText()); } @Converter -public static GPathResult fromNode(Node input) throws IOException, SAXException, ParserConfigurationException, TransformerException { -StringWriter writer = new StringWriter(); -Transformer t = TransformerFactory.newInstance().newTransformer(); -t.transform(new DOMSource(input), new StreamResult(writer)); -return fromString(writer.toString()); +public GPathResult fromNode(Node input, Exchange exchange) throws IOException, SAXException, ParserConfigurationException, TransformerException { +return fromString(xmlConverter.toString(input, exchange)); } }
[1/3] git commit: Specifying criteria for count operation
Repository: camel Updated Branches: refs/heads/master f4b7333c3 - fd818acb5 Specifying criteria for count operation Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/921c0722 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/921c0722 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/921c0722 Branch: refs/heads/master Commit: 921c0722e3852d4c68710c496ba0e04ccb2b6169 Parents: e8fb927 Author: Denis Smirnov denis.m.smir...@gmail.com Authored: Tue Jul 29 21:34:01 2014 +0400 Committer: Denis Smirnov denis.m.smir...@gmail.com Committed: Tue Jul 29 21:34:01 2014 +0400 -- .../org/apache/camel/component/mongodb/MongoDbProducer.java | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/921c0722/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java -- diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java index 45267a8..72c27a9 100644 --- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java +++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java @@ -338,7 +338,13 @@ public class MongoDbProducer extends DefaultProducer { protected void doCount(Exchange exchange) throws Exception { DBCollection dbCol = calculateCollection(exchange); -Long answer = Long.valueOf(dbCol.count()); +DBObject query = exchange.getIn().getBody(DBObject.class); +Long answer; +if (query == null){ +answer = Long.valueOf(dbCol.count()); +} else { +answer = Long.valueOf(dbCol.count(query)); +} Message resultMessage = prepareResponseMessage(exchange, MongoDbOperation.count); resultMessage.setBody(answer); }
[2/3] git commit: Merge branch 'master' of https://github.com/dextravaganz/camel
Merge branch 'master' of https://github.com/dextravaganz/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2ab9363b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2ab9363b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2ab9363b Branch: refs/heads/master Commit: 2ab9363b071883fba7e8fea8984f2bf43fbce6ba Parents: f4b7333 921c072 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:46:41 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:46:41 2014 +0200 -- .../org/apache/camel/component/mongodb/MongoDbProducer.java | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) --
[CONF] Apache Camel MongoDB
Claus Ibsen edited the page: MongoDB ... div class confluenceTableSmall Name Default Value Description Producer Tailable Cursor Consumer database none Required. The name of the database to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and theCamelMongoDbDatabase header is set. collection none Required. The name of the collection (within the specified database) to which this endpoint will be bound.All operations will be executed against this database unless dynamicity is enabled and theCamelMongoDbDatabase header is set.
[3/3] git commit: Fixed CS
Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fd818acb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fd818acb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fd818acb Branch: refs/heads/master Commit: fd818acb53c83f3709c6d268bf523832b319a3c4 Parents: 2ab9363 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:52:38 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:52:38 2014 +0200 -- .../org/apache/camel/component/mongodb/MongoDbProducer.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fd818acb/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java -- diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java index 72c27a9..a3fb73a 100644 --- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java +++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java @@ -340,10 +340,10 @@ public class MongoDbProducer extends DefaultProducer { DBCollection dbCol = calculateCollection(exchange); DBObject query = exchange.getIn().getBody(DBObject.class); Long answer; -if (query == null){ -answer = Long.valueOf(dbCol.count()); +if (query == null) { +answer = dbCol.count(); } else { -answer = Long.valueOf(dbCol.count(query)); +answer = dbCol.count(query); } Message resultMessage = prepareResponseMessage(exchange, MongoDbOperation.count); resultMessage.setBody(answer);
[2/2] git commit: Merge branch 'CAMEL-7726' of https://github.com/kevinearls/camel
Merge branch 'CAMEL-7726' of https://github.com/kevinearls/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c3d69ce4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c3d69ce4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c3d69ce4 Branch: refs/heads/master Commit: c3d69ce40f04b38b4e6fc397a58af5a3189092f7 Parents: fd818ac 3adf0b7 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:54:29 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:54:29 2014 +0200 -- --
[1/2] git commit: Fix for CAMEL-7726 added property for camel-test-spring artifactId to Fix the test failures of spring4 profile
Repository: camel Updated Branches: refs/heads/master fd818acb5 - c3d69ce40 Fix for CAMEL-7726 added property for camel-test-spring artifactId to Fix the test failures of spring4 profile Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3adf0b70 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3adf0b70 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3adf0b70 Branch: refs/heads/master Commit: 3adf0b700a9808472816b332f92e167efeed806f Parents: b8e9430 Author: Kevin Earls ke...@kevinearls.com Authored: Thu Aug 21 14:21:15 2014 +0200 Committer: Kevin Earls ke...@kevinearls.com Committed: Thu Aug 21 14:21:15 2014 +0200 -- components/camel-metrics/pom.xml | 2 +- components/camel-spring-javaconfig/pom.xml | 2 +- components/camel-testng/pom.xml| 2 +- parent/pom.xml | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3adf0b70/components/camel-metrics/pom.xml -- diff --git a/components/camel-metrics/pom.xml b/components/camel-metrics/pom.xml index 52ce3b1..ba3b157 100644 --- a/components/camel-metrics/pom.xml +++ b/components/camel-metrics/pom.xml @@ -79,7 +79,7 @@ /dependency dependency groupIdorg.apache.camel/groupId - artifactIdcamel-test-spring3/artifactId + artifactId${camel-test-spring-artifactId}/artifactId scopetest/scope /dependency dependency http://git-wip-us.apache.org/repos/asf/camel/blob/3adf0b70/components/camel-spring-javaconfig/pom.xml -- diff --git a/components/camel-spring-javaconfig/pom.xml b/components/camel-spring-javaconfig/pom.xml index 61aa8b0..d14fe3f 100644 --- a/components/camel-spring-javaconfig/pom.xml +++ b/components/camel-spring-javaconfig/pom.xml @@ -66,7 +66,7 @@ /dependency dependency groupIdorg.apache.camel/groupId - artifactIdcamel-test-spring3/artifactId + artifactId${camel-test-spring-artifactId}/artifactId scopetest/scope /dependency dependency http://git-wip-us.apache.org/repos/asf/camel/blob/3adf0b70/components/camel-testng/pom.xml -- diff --git a/components/camel-testng/pom.xml b/components/camel-testng/pom.xml index a27eb17..9b10a70 100644 --- a/components/camel-testng/pom.xml +++ b/components/camel-testng/pom.xml @@ -45,7 +45,7 @@ /dependency dependency groupIdorg.apache.camel/groupId -artifactIdcamel-test-spring3/artifactId +artifactId${camel-test-spring-artifactId}/artifactId /dependency dependency groupIdorg.testng/groupId http://git-wip-us.apache.org/repos/asf/camel/blob/3adf0b70/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 385de18..98c6a01 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -73,6 +73,7 @@ boxjavalibv2.version3.0.9/boxjavalibv2.version build-helper-maven-plugin-version1.8/build-helper-maven-plugin-version c3p0-version0.9.1.2/c3p0-version + camel-test-spring-artifactIdcamel-test-spring3/camel-test-spring-artifactId castor-bundle-version1.3.2_2/castor-bundle-version cglib-bundle-version2.1_3_7/cglib-bundle-version cglib-version2.2/cglib-version @@ -2874,6 +2875,7 @@ idspring4/id properties spring-version${spring4-version}/spring-version + camel-test-spring-artifactIdcamel-test-spring/camel-test-spring-artifactId /properties /profile
[2/2] git commit: Merge branch 'camel-jmx' of https://github.com/cristianonicolai/camel
Merge branch 'camel-jmx' of https://github.com/cristianonicolai/camel Conflicts: components/camel-sjms/src/test/java/org/apache/camel/component/sjms/jms/SessionPoolTest.java components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fd02839e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fd02839e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fd02839e Branch: refs/heads/master Commit: fd02839e54fe97b15468f1982244361db24863de Parents: c3d69ce 1f3b626 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 08:58:06 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 08:58:06 2014 +0200 -- .../org/apache/camel/component/sjms/support/JmsTestSupport.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fd02839e/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java -- diff --cc components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java index 7919e28,b4cdf3c..a04fb07 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java @@@ -59,8 -59,7 +59,9 @@@ public class JmsTestSupport extends Cam broker = new BrokerService(); final int port = AvailablePortFinder.getNextAvailable(3); brokerUri = tcp://localhost: + port; +//Disable the JMX by default +broker.setUseJmx(false); + broker.getManagementContext().setConnectorPort(AvailablePortFinder.getNextAvailable(port + 1)); configureBroker(broker); startBroker(); }
[1/2] git commit: Improved JMX handling on ActiveMQ broker for tests
Repository: camel Updated Branches: refs/heads/master c3d69ce40 - fd02839e5 Improved JMX handling on ActiveMQ broker for tests Disabled jmx for tests that don't need to use it and also add AvailablePortFinder to dinamically assing JMX connector port when needed. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1f3b6269 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1f3b6269 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1f3b6269 Branch: refs/heads/master Commit: 1f3b62698e83852de7d9f50c90cb310b32803e71 Parents: 11b3282 Author: Cristiano Nicolai cristiano.nico...@gmail.com Authored: Thu Aug 21 02:06:18 2014 +1000 Committer: Cristiano Nicolai cristiano.nico...@gmail.com Committed: Thu Aug 21 02:06:18 2014 +1000 -- .../apache/camel/component/sjms/SimpleJmsComponentTest.java| 2 +- .../camel/component/sjms/consumer/AsyncConsumerFalseTest.java | 2 +- .../camel/component/sjms/consumer/AsyncConsumerInOutTest.java | 2 +- .../sjms/consumer/InOnlyTopicDurableConsumerTest.java | 2 +- .../component/sjms/jms/ConnectionFactoryResourceTest.java | 2 +- .../org/apache/camel/component/sjms/jms/SessionPoolTest.java | 2 +- .../apache/camel/component/sjms/support/JmsTestSupport.java| 6 +++--- .../sjms/tx/BatchTransactedConcurrentMultipleConsumerTest.java | 2 +- .../BatchTransactedConcurrentMultipleRouteConsumersTest.java | 2 +- .../component/sjms/tx/BatchTransactedQueueConsumerTest.java| 2 +- .../component/sjms/tx/BatchTransactedQueueProducerTest.java| 2 +- .../sjms/tx/BatchTransactedTopicConsumerMultipleRouteTest.java | 2 +- .../component/sjms/tx/BatchTransactedTopicConsumerTest.java| 2 +- .../component/sjms/tx/BatchTransactedTopicProducerTest.java| 2 +- .../component/sjms/tx/TransactedConcurrentConsumersTest.java | 2 +- .../sjms/tx/TransactedConsumersMultipleRouteTest.java | 2 +- .../camel/component/sjms/tx/TransactedQueueConsumerTest.java | 2 +- .../camel/component/sjms/tx/TransactedQueueProducerTest.java | 2 +- .../camel/component/sjms/tx/TransactedTopicConsumerTest.java | 2 +- .../camel/component/sjms/tx/TransactedTopicProducerTest.java | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1f3b6269/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SimpleJmsComponentTest.java -- diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SimpleJmsComponentTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SimpleJmsComponentTest.java index 5ae1dab..bb519ec 100644 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SimpleJmsComponentTest.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SimpleJmsComponentTest.java @@ -34,7 +34,7 @@ public class SimpleJmsComponentTest extends CamelTestSupport { protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() { -ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(vm://broker?broker.persistent=falsebroker.useJmx=true); +ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(vm://broker?broker.persistent=falsebroker.useJmx=false); SjmsComponent component = new SjmsComponent(); component.setConnectionFactory(connectionFactory); getContext().addComponent(sjms, component); http://git-wip-us.apache.org/repos/asf/camel/blob/1f3b6269/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/AsyncConsumerFalseTest.java -- diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/AsyncConsumerFalseTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/AsyncConsumerFalseTest.java index 594522e..ce0642f 100644 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/AsyncConsumerFalseTest.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/AsyncConsumerFalseTest.java @@ -46,7 +46,7 @@ public class AsyncConsumerFalseTest extends CamelTestSupport { camelContext.addComponent(async, new MyAsyncComponent()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory( -vm://broker?broker.persistent=false); +vm://broker?broker.persistent=falsebroker.useJmx=false); SjmsComponent component = new SjmsComponent();
[CONF] Apache Camel MINA2
Claus Ibsen edited the page: MINA2 ... Maven users will need to add the following dependency to their pom.xml for this component: Code Block xml dependency groupIdorg.apache.camel/groupId artifactIdcamel-mina2/artifactId versionx.x.x/version !-- use the same version as your Camel core version -- /dependency URI format Code Block mina2:tcp://hostname[:port][?options] mina2:udp://hostname[:port][?options] mina2:vm://hostname[:port][?options] ... div class confluenceTableSmall
[3/3] git commit: CAMEL-6934: fixed cs
CAMEL-6934: fixed cs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/33d0b0df Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/33d0b0df Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/33d0b0df Branch: refs/heads/master Commit: 33d0b0df3d3b8500cc53b649122177c77cfd2ec6 Parents: 434fcc9 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 09:57:28 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 10:13:07 2014 +0200 -- .../apache/camel/component/mina2/Mina2Configuration.java | 10 +++--- .../org/apache/camel/component/mina2/Mina2Producer.java | 10 +- 2 files changed, 8 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/33d0b0df/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java -- diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java index 2e0b2e3..a1da1f4 100644 --- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java +++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java @@ -265,16 +265,12 @@ public class Mina2Configuration implements Cloneable { this.orderedThreadPoolExecutor = orderedThreadPoolExecutor; } -public void setCachedAddress(boolean shouldCacheAddress){ +public void setCachedAddress(boolean shouldCacheAddress) { this.cachedAddress = shouldCacheAddress; } -public boolean getCachedAddress(){ -return this.cachedAddress; -} - -public boolean isCachedAddress(){ -return this.getCachedAddress(); +public boolean isCachedAddress() { +return cachedAddress; } // here we just shows the option setting of host, port, protocol http://git-wip-us.apache.org/repos/asf/camel/blob/33d0b0df/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java -- diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java index fc7c493..eaf9979 100644 --- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java +++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java @@ -251,7 +251,7 @@ public class Mina2Producer extends DefaultProducer implements ServicePoolAware { } private void openConnection() { -if(this.address == null || !this.configuration.isCachedAddress()){ +if (this.address == null || !this.configuration.isCachedAddress()) { setSocketAddress(this.configuration.getProtocol()); } if (LOG.isDebugEnabled()) { @@ -450,12 +450,12 @@ public class Mina2Producer extends DefaultProducer implements ServicePoolAware { } } -private void setSocketAddress(String protocol){ -if(protocol.equals(tcp)){ +private void setSocketAddress(String protocol) { +if (protocol.equals(tcp)) { this.address = new InetSocketAddress(configuration.getHost(), configuration.getPort()); -}else if(configuration.isDatagramProtocol()){ +} else if (configuration.isDatagramProtocol()) { this.address = new InetSocketAddress(configuration.getHost(), configuration.getPort()); -}else if(protocol.equals(vm)){ +} else if (protocol.equals(vm)) { this.address = new VmPipeAddress(configuration.getPort()); } }
[1/3] git commit: CAMEL-6934 enabling dns addresses to not get cached
Repository: camel Updated Branches: refs/heads/master fd02839e5 - 33d0b0df3 CAMEL-6934 enabling dns addresses to not get cached Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c3f4f03 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c3f4f03 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c3f4f03 Branch: refs/heads/master Commit: 3c3f4f03d3b04102c6fbab88e713136bd444a186 Parents: 46b5128 Author: Rob Shield rob.c.shi...@googlemail.com Authored: Sun Dec 1 13:30:44 2013 + Committer: Rob Shield rob.c.shi...@googlemail.com Committed: Sun Dec 1 13:30:44 2013 + -- .../camel/component/mina2/Mina2Configuration.java| 15 ++- .../apache/camel/component/mina2/Mina2Producer.java | 13 + 2 files changed, 27 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3c3f4f03/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java -- diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java index 245de3c..2e0b2e3 100644 --- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java +++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java @@ -53,6 +53,7 @@ public class Mina2Configuration implements Cloneable { private boolean autoStartTls = true; private int maximumPoolSize = 16; // 16 is the default mina setting private boolean orderedThreadPoolExecutor = true; +private boolean cachedAddress = true; /** * Returns a copy of this configuration @@ -263,7 +264,19 @@ public class Mina2Configuration implements Cloneable { public void setOrderedThreadPoolExecutor(boolean orderedThreadPoolExecutor) { this.orderedThreadPoolExecutor = orderedThreadPoolExecutor; } - + +public void setCachedAddress(boolean shouldCacheAddress){ +this.cachedAddress = shouldCacheAddress; +} + +public boolean getCachedAddress(){ +return this.cachedAddress; +} + +public boolean isCachedAddress(){ +return this.getCachedAddress(); +} + // here we just shows the option setting of host, port, protocol public String getUriString() { return mina2: + getProtocol() + : + getHost() + : + getPort(); http://git-wip-us.apache.org/repos/asf/camel/blob/3c3f4f03/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java -- diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java index ba41f18..fc7c493 100644 --- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java +++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java @@ -251,6 +251,9 @@ public class Mina2Producer extends DefaultProducer implements ServicePoolAware { } private void openConnection() { +if(this.address == null || !this.configuration.isCachedAddress()){ +setSocketAddress(this.configuration.getProtocol()); +} if (LOG.isDebugEnabled()) { LOG.debug(Creating connector to address: {} using connector: {} timeout: {} millis., new Object[]{address, connector, timeout}); } @@ -447,6 +450,16 @@ public class Mina2Producer extends DefaultProducer implements ServicePoolAware { } } +private void setSocketAddress(String protocol){ +if(protocol.equals(tcp)){ +this.address = new InetSocketAddress(configuration.getHost(), configuration.getPort()); +}else if(configuration.isDatagramProtocol()){ +this.address = new InetSocketAddress(configuration.getHost(), configuration.getPort()); +}else if(protocol.equals(vm)){ +this.address = new VmPipeAddress(configuration.getPort()); +} +} + /** * Handles response from session writes */
[2/3] git commit: Merge branch 'CAMEL-6934' of https://github.com/mach10/camel
Merge branch 'CAMEL-6934' of https://github.com/mach10/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/434fcc95 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/434fcc95 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/434fcc95 Branch: refs/heads/master Commit: 434fcc95c22e8c0dbfecd42bb11a2483c81cf8ce Parents: fd02839 3c3f4f0 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 09:50:01 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 09:50:01 2014 +0200 -- .../camel/component/mina2/Mina2Configuration.java| 15 ++- .../apache/camel/component/mina2/Mina2Producer.java | 13 + 2 files changed, 27 insertions(+), 1 deletion(-) --
git commit: Fixed spark-rest tests
Repository: camel Updated Branches: refs/heads/master 33d0b0df3 - ae7eafc67 Fixed spark-rest tests Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae7eafc6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae7eafc6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae7eafc6 Branch: refs/heads/master Commit: ae7eafc67a52da13ff79b61923d4ba6846acb658 Parents: 33d0b0d Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 10:29:37 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 10:29:37 2014 +0200 -- .../camel/component/sparkrest/BaseSparkTest.java | 5 + .../component/sparkrest/CamelSparkAcceptTest.java | 4 ++-- .../component/sparkrest/CamelSparkParamTest.java | 2 +- .../sparkrest/CamelSparkRequestBeanTest.java | 2 +- .../component/sparkrest/CamelSparkSplatTest.java | 2 +- .../camel/component/sparkrest/CamelSparkTest.java | 2 +- .../sparkrest/RestCamelSparkMapHeadersFalseTest.java | 2 +- .../sparkrest/RestCamelSparkPojoInOutTest.java| 4 ++-- .../camel/component/sparkrest/RestCamelSparkTest.java | 6 +++--- .../sparkrest/RestConfigurationCamelSparkTest.java| 14 -- 10 files changed, 17 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java -- diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java index b7a6c08..77d862e 100644 --- a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java +++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java @@ -21,7 +21,6 @@ import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.junit4.CamelTestSupport; public abstract class BaseSparkTest extends CamelTestSupport { -//static int count; protected int port; @@ -31,8 +30,7 @@ public abstract class BaseSparkTest extends CamelTestSupport { @Override public void setUp() throws Exception { -//count++; -port = AvailablePortFinder.getNextAvailable(4500); +port = AvailablePortFinder.getNextAvailable(25500); super.setUp(); } @@ -42,7 +40,6 @@ public abstract class BaseSparkTest extends CamelTestSupport { SparkComponent spark = context.getComponent(spark-rest, SparkComponent.class); spark.setPort(port); -spark.setIpAddress(127.0.0.1); return context; } http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java -- diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java index 27cd72a..c5b3727 100644 --- a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java +++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java @@ -28,14 +28,14 @@ public class CamelSparkAcceptTest extends BaseSparkTest { getMockEndpoint(mock:foo).expectedMessageCount(1); try { -template.requestBodyAndHeader(http://127.0.0.1:; + getPort() + /hello, null, Accept, text/plain, String.class); +template.requestBodyAndHeader(http://localhost:; + getPort() + /hello, null, Accept, text/plain, String.class); fail(Should fail); } catch (CamelExecutionException e) { HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); assertEquals(404, cause.getStatusCode()); } -String out2 = template.requestBodyAndHeader(http://127.0.0.1:; + getPort() + /hello, null, Accept, application/json, String.class); +String out2 = template.requestBodyAndHeader(http://localhost:; + getPort() + /hello, null, Accept, application/json, String.class); assertEquals({ \reply\: \Bye World\ }, out2); assertMockEndpointsSatisfied(); http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
git commit: Added camel-metrics to rest example.
Repository: camel Updated Branches: refs/heads/master ae7eafc67 - 96a2dcc00 Added camel-metrics to rest example. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96a2dcc0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96a2dcc0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96a2dcc0 Branch: refs/heads/master Commit: 96a2dcc006a9d4b099deb86951d0b56726342226 Parents: ae7eafc Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 14:18:57 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 14:18:57 2014 +0200 -- examples/camel-example-servlet-rest-tomcat/pom.xml | 4 .../org/apache/camel/example/rest/UserService.java | 13 + .../src/main/resources/camel-config-xml.xml| 3 +++ .../src/main/resources/camel-config.xml| 5 ++--- .../src/main/webapp/index.html | 2 ++ 5 files changed, 24 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/96a2dcc0/examples/camel-example-servlet-rest-tomcat/pom.xml -- diff --git a/examples/camel-example-servlet-rest-tomcat/pom.xml b/examples/camel-example-servlet-rest-tomcat/pom.xml index 3f68013..0438109 100755 --- a/examples/camel-example-servlet-rest-tomcat/pom.xml +++ b/examples/camel-example-servlet-rest-tomcat/pom.xml @@ -46,6 +46,10 @@ groupIdorg.apache.camel/groupId artifactIdcamel-servlet/artifactId /dependency +dependency + groupIdorg.apache.camel/groupId + artifactIdcamel-metrics/artifactId +/dependency !-- swagger api -- dependency http://git-wip-us.apache.org/repos/asf/camel/blob/96a2dcc0/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/UserService.java -- diff --git a/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/UserService.java b/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/UserService.java index 26abd73..a94942e 100644 --- a/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/UserService.java +++ b/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/UserService.java @@ -18,6 +18,7 @@ package org.apache.camel.example.rest; import java.util.Collection; import java.util.Map; +import java.util.Random; import java.util.TreeMap; /** @@ -28,9 +29,12 @@ public class UserService { // use a tree map so they become sorted private final MapString, User users = new TreeMapString, User(); +private Random ran = new Random(); + public UserService() { users.put(123, new User(123, John Doe)); users.put(456, new User(456, Donald Duck)); +users.put(789, new User(789, Slow Turtle)); } /** @@ -40,6 +44,15 @@ public class UserService { * @return the user, or ttnull/tt if no user exists */ public User getUser(String id) { +if (789.equals(id)) { +// simulate some cpu processing time when returning the slow turtle +int delay = 500 + ran.nextInt(1500); +try { +Thread.sleep(delay); +} catch (Exception e) { +// ignore +} +} return users.get(id); } http://git-wip-us.apache.org/repos/asf/camel/blob/96a2dcc0/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml -- diff --git a/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml b/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml index 5dc4bd3..4977bef 100755 --- a/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml +++ b/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml @@ -23,6 +23,9 @@ 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; + !-- use camel-metrics route policy to gather metrics for all routes -- + bean id=metricsRoutePolicyFactory class=org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory/ + !-- a bean for user services -- bean id=userService class=org.apache.camel.example.rest.UserService/ http://git-wip-us.apache.org/repos/asf/camel/blob/96a2dcc0/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config.xml
[7/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyChannelBufferStreamCache.java -- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyChannelBufferStreamCache.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyChannelBufferStreamCache.java new file mode 100644 index 000..74ec6e8 --- /dev/null +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyChannelBufferStreamCache.java @@ -0,0 +1,99 @@ +/** + * 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.component.netty4.http; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import io.netty.buffer.ByteBuf; +import org.apache.camel.StreamCache; +import org.apache.camel.util.IOHelper; + + +/** + * A {@link ChannelBuffer} which is exposed as an {@link InputStream} which makes it very + * easy to use by Camel and other Camel components. Also supported is {@link StreamCache} + * which allows the data to be re-read for example when doing content based routing with XPath. + */ +public final class NettyChannelBufferStreamCache extends InputStream implements StreamCache { + +private final ByteBuf buffer; + +public NettyChannelBufferStreamCache(ByteBuf buffer) { +this.buffer = buffer; +buffer.markReaderIndex(); +} + +@Override +public boolean markSupported() { +return true; +} + +@Override +public int read() throws IOException { +return buffer.readByte(); +} + +@Override +public int read(byte[] b) throws IOException { +return read(b, 0, b.length); +} + +@Override +public int read(byte[] b, int off, int len) throws IOException { +// are we at end, then return -1 +if (buffer.readerIndex() == buffer.capacity()) { +return -1; +} + +// ensure we don't read more than what we have in the buffer +int before = buffer.readerIndex(); +int max = buffer.capacity() - before; +len = Math.min(max, len); + +buffer.readBytes(b, off, len); +return buffer.readerIndex() - before; +} + +@Override +public void reset() { +buffer.resetReaderIndex(); +} + +@Override +public void writeTo(OutputStream os) throws IOException { +// must remember current index so we can reset back to it after the copy +int idx = buffer.readerIndex(); +try { +buffer.resetReaderIndex(); +IOHelper.copy(this, os); +} finally { +buffer.readerIndex(idx); +} +} + +@Override +public boolean inMemory() { +return true; +} + +@Override +public long length() { +return buffer.readableBytes(); +} +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpBinding.java -- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpBinding.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpBinding.java new file mode 100644 index 000..7b86ed7 --- /dev/null +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpBinding.java @@ -0,0 +1,119 @@ +/** + * 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 + *
[2/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java new file mode 100644 index 000..792150b --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java @@ -0,0 +1,59 @@ +/** + * 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.component.netty4.http.rest; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.netty4.http.BaseNettyTest; +import org.apache.camel.model.rest.RestBindingMode; +import org.junit.Test; + +public class RestNettyHttpBindingModeAutoWithXmlTest extends BaseNettyTest { + +@Test +public void testBindingMode() throws Exception { +MockEndpoint mock = getMockEndpoint(mock:input); +mock.expectedMessageCount(1); +mock.message(0).body().isInstanceOf(UserJaxbPojo.class); + +String body = user name=\Donald Duck\ id=\123\/user; +template.sendBody(netty4-http:http://localhost:; + getPort() + /users/new, body); + +assertMockEndpointsSatisfied(); + +UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class); +assertNotNull(user); +assertEquals(123, user.getId()); +assertEquals(Donald Duck, user.getName()); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { + restConfiguration().component(netty4-http).host(localhost).port(getPort()).bindingMode(RestBindingMode.auto); + +// use the rest DSL to define the rest services +rest(/users/) + .post(new).consumes(application/xml).type(UserJaxbPojo.class) +.to(mock:input); +} +}; +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java new file mode 100644 index 000..af38612 --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java @@ -0,0 +1,76 @@ +/** + * 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.component.netty4.http.rest; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.netty4.http.BaseNettyTest; +import
[1/9] git commit: Polish the code of NettyConveter
Repository: camel Updated Branches: refs/heads/master 96a2dcc00 - d3c59647e Polish the code of NettyConveter Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8c5529fe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8c5529fe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8c5529fe Branch: refs/heads/master Commit: 8c5529fee7d84e236be71ffbb8ff71439a05152d Parents: 96a2dcc Author: Willem Jiang willem.ji...@gmail.com Authored: Fri Sep 5 17:09:17 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Fri Sep 5 20:21:54 2014 +0800 -- .../java/org/apache/camel/component/netty4/NettyConverter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8c5529fe/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java -- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java index 9278a18..bc8065e 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java @@ -79,7 +79,7 @@ public final class NettyConverter { } @Converter -public static ByteBuf toByteBuffer(byte[] bytes, Exchange exchange) { +public static ByteBuf toByteBuffer(byte[] bytes) { ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(bytes.length); buf.writeBytes(bytes); return buf; @@ -94,7 +94,7 @@ public final class NettyConverter { } else { bytes = s.getBytes(); } -return toByteBuffer(bytes, exchange); +return toByteBuffer(bytes); } @Converter
[6/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java -- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java new file mode 100644 index 000..597b6d5 --- /dev/null +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/RestNettyHttpBinding.java @@ -0,0 +1,92 @@ +/** + * 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.component.netty4.http; + +import java.net.URI; +import java.util.Map; + +import io.netty.handler.codec.http.FullHttpRequest; +import org.apache.camel.Exchange; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.HeaderFilterStrategy; + + +/** + * A {@link org.apache.camel.component.netty.http.NettyHttpBinding} that supports the Rest DSL. + */ +public class RestNettyHttpBinding extends DefaultNettyHttpBinding { + +public RestNettyHttpBinding() { +} + +public RestNettyHttpBinding(HeaderFilterStrategy headerFilterStrategy) { +super(headerFilterStrategy); +} + +public RestNettyHttpBinding copy() { +try { +return (RestNettyHttpBinding)this.clone(); +} catch (CloneNotSupportedException e) { +throw new RuntimeCamelException(e); +} +} + +@Override +public void populateCamelHeaders(FullHttpRequest request, MapString, Object headers, Exchange exchange, NettyHttpConfiguration configuration) throws Exception { +super.populateCamelHeaders(request, headers, exchange, configuration); + +String path = request.getUri(); +if (path == null) { +return; +} + +// skip the scheme/host/port etc, as we only want the context-path +URI uri = new URI(path); +path = uri.getPath(); + +// in the endpoint the user may have defined rest {} placeholders +// so we need to map those placeholders with data from the incoming request context path + +String consumerPath = configuration.getPath(); + +if (useRestMatching(consumerPath)) { + +// split using single char / is optimized in the jdk +String[] paths = path.split(/); +String[] consumerPaths = consumerPath.split(/); + +for (int i = 0; i consumerPaths.length; i++) { +if (paths.length i) { +break; +} +String p1 = consumerPaths[i]; +if (p1.startsWith({) p1.endsWith(})) { +String key = p1.substring(1, p1.length() - 1); +String value = paths[i]; +if (value != null) { +NettyHttpHelper.appendHeader(headers, key, value); +} +} +} +} +} + +private boolean useRestMatching(String path) { +// only need to do rest matching if using { } placeholders +return path.indexOf('{') -1; +} +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/SecurityAuthenticator.java -- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/SecurityAuthenticator.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/SecurityAuthenticator.java new file mode 100644 index 000..8d99f11 --- /dev/null +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/SecurityAuthenticator.java @@ -0,0 +1,76 @@ +/** + * 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
[4/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyRemovalTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyRemovalTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyRemovalTest.java new file mode 100644 index 000..8642bea --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyRemovalTest.java @@ -0,0 +1,78 @@ +/** + * 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.component.netty4.http; + +import static java.util.Collections.singleton; + +import org.apache.camel.EndpointInject; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.JndiRegistry; +import org.junit.Test; + +import static org.apache.camel.Exchange.HTTP_QUERY; + +public class NettyHttpHeaderFilterStrategyRemovalTest extends BaseNettyTest { + +NettyHttpHeaderFilterStrategy headerFilterStrategy = new NettyHttpHeaderFilterStrategy(); + +@EndpointInject(uri = mock:test) +MockEndpoint mockEndpoint; + +@Test +public void shouldRemoveStrategyOption() throws Exception { +String options = headerFilterStrategy=#headerFilterStrategy; +mockEndpoint.expectedMessageCount(1); +mockEndpoint.message(0).header(HTTP_QUERY).isNull(); + +template.sendBody(netty4-http:http://localhost:; + getPort() + /? + options, message); + +assertMockEndpointsSatisfied(); +} + +@Test +public void shouldResolveStrategyFromParameter() throws Exception { +String headerToFilter = foo; +headerFilterStrategy.setOutFilter(singleton(headerToFilter)); +String options = headerFilterStrategy=#headerFilterStrategy; +mockEndpoint.expectedMessageCount(1); +mockEndpoint.message(0).header(headerToFilter).isNull(); + +template.sendBodyAndHeader(netty4-http:http://localhost:; + getPort() + /? + options, message, headerToFilter, headerValue); + +assertMockEndpointsSatisfied(); +} + +@Override +protected JndiRegistry createRegistry() throws Exception { +JndiRegistry registry = super.createRegistry(); +registry.bind(headerFilterStrategy, headerFilterStrategy); +return registry; +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +from(netty4-http:http://0.0.0.0:{{port}}/;) +.to(mockEndpoint); +} +}; +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java new file mode 100644 index 000..4fa8c69 --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java @@ -0,0 +1,106 @@ +/** + * 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,
[8/9] git commit: CAMEL-7782 Added camel-netty4-http component
CAMEL-7782 Added camel-netty4-http component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db88eeda Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db88eeda Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db88eeda Branch: refs/heads/master Commit: db88eeda8e7c40b00b9f9ff015ed0b54e6922ea9 Parents: 8c5529f Author: Willem Jiang willem.ji...@gmail.com Authored: Fri Sep 5 20:55:54 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Fri Sep 5 20:55:54 2014 +0800 -- .../apache/camel/impl/DefaultCamelContext.java | 2 + components/camel-netty4-http/pom.xml| 86 +++ .../netty4/http/ContextPathMatcher.java | 55 ++ .../netty4/http/DefaultContextPathMatcher.java | 88 +++ .../netty4/http/DefaultNettyHttpBinding.java| 550 +++ .../http/DefaultNettySharedHttpServer.java | 132 + .../netty4/http/HttpClientPipelineFactory.java | 165 ++ .../component/netty4/http/HttpPrincipal.java| 52 ++ .../netty4/http/HttpServerBootstrapFactory.java | 104 .../http/HttpServerConsumerChannelFactory.java | 63 +++ .../netty4/http/HttpServerPipelineFactory.java | 172 ++ .../http/HttpServerSharedPipelineFactory.java | 159 ++ .../netty4/http/JAASSecurityAuthenticator.java | 72 +++ .../http/NettyChannelBufferStreamCache.java | 99 .../component/netty4/http/NettyHttpBinding.java | 119 .../netty4/http/NettyHttpComponent.java | 303 ++ .../netty4/http/NettyHttpConfiguration.java | 166 ++ .../netty4/http/NettyHttpConstants.java | 31 ++ .../netty4/http/NettyHttpConsumer.java | 75 +++ .../netty4/http/NettyHttpConverter.java | 118 .../netty4/http/NettyHttpEndpoint.java | 198 +++ .../http/NettyHttpHeaderFilterStrategy.java | 53 ++ .../component/netty4/http/NettyHttpHelper.java | 243 .../component/netty4/http/NettyHttpMessage.java | 51 ++ .../http/NettyHttpOperationFailedException.java | 77 +++ .../netty4/http/NettyHttpProducer.java | 120 .../http/NettyHttpSecurityConfiguration.java| 115 .../netty4/http/NettySharedHttpServer.java | 74 +++ ...ySharedHttpServerBootstrapConfiguration.java | 50 ++ .../netty4/http/RestContextPathMatcher.java | 102 .../netty4/http/RestNettyHttpBinding.java | 92 .../netty4/http/SecurityAuthenticator.java | 76 +++ .../http/SecurityAuthenticatorSupport.java | 127 + .../netty4/http/SecurityConstraint.java | 31 ++ .../netty4/http/SecurityConstraintMapping.java | 133 + .../http/handlers/HttpClientChannelHandler.java | 46 ++ .../http/handlers/HttpServerChannelHandler.java | 316 +++ .../HttpServerMultiplexChannelHandler.java | 235 .../src/main/resources/META-INF/LICENSE.txt | 203 +++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../services/org/apache/camel/TypeConverter | 18 + .../org/apache/camel/component/netty4-http | 17 + .../component/netty4/http/BaseNettyTest.java| 95 .../netty4/http/ManagedNettyEndpointTest.java | 81 +++ .../component/netty4/http/MyLoginModule.java| 102 .../component/netty4/http/MyRolePrincipal.java | 33 ++ .../netty4/http/NettyHttp500ErrorTest.java | 66 +++ ...yHttp500ErrorThrowExceptionOnServerTest.java | 67 +++ ...ttpAccessHttpRequestAndResponseBeanTest.java | 74 +++ .../NettyHttpAccessHttpRequestBeanTest.java | 54 ++ .../http/NettyHttpAccessHttpRequestTest.java| 59 ++ .../NettyHttpBasicAuthConstraintMapperTest.java | 96 ...asicAuthCustomSecurityAuthenticatorTest.java | 105 .../netty4/http/NettyHttpBasicAuthTest.java | 104 ...ndingPreservePostFormUrlEncodedBodyTest.java | 68 +++ .../http/NettyHttpBridgeEncodedPathTest.java| 66 +++ ...NettyHttpBridgeRouteUsingHttpClientTest.java | 92 .../http/NettyHttpCharacterEncodingTest.java| 63 +++ .../netty4/http/NettyHttpClientChunkedTest.java | 46 ++ .../http/NettyHttpClientExpectContinueTest.java | 58 ++ ...ponentConfigurationAndDocumentationTest.java | 57 ++ .../netty4/http/NettyHttpContentTypeTest.java | 87 +++ ...ettyHttpConvertPayloadToInputStreamTest.java | 62 +++ ...dpointUriCustomHeaderFilterStrategyTest.java | 70 +++ .../NettyHttpEndpointUriEncodingIssueTest.java | 57 ++ ...ntUriEncodingIssueUrlDecodeDisabledTest.java | 49 ++ .../http/NettyHttpFilterCamelHeadersTest.java | 76 +++ .../NettyHttpGetWithInvalidMessageTest.java | 106 ...ttyHttpGetWithParamAsExchangeHeaderTest.java | 127 + .../netty4/http/NettyHttpGetWithParamTest.java | 78 +++ .../netty4/http/NettyHttpHandle404Test.java | 92 .../netty4/http/NettyHttpHeaderCaseTest.java| 73 +++
[5/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java new file mode 100644 index 000..b1d4dbc --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java @@ -0,0 +1,54 @@ +/** + * 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.component.netty4.http; + +import java.nio.charset.Charset; + +import io.netty.handler.codec.http.FullHttpRequest; +import org.apache.camel.builder.RouteBuilder; +import org.junit.Test; + +public class NettyHttpAccessHttpRequestBeanTest extends BaseNettyTest { + +@Test +public void testAccessHttpRequest() throws Exception { +getMockEndpoint(mock:input).expectedBodiesReceived(World); + +String out = template.requestBody(netty4-http:http://localhost:{{port}}/foo;, World, String.class); +assertEquals(Bye World, out); + +assertMockEndpointsSatisfied(); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +from(netty4-http:http://0.0.0.0:{{port}}/foo;) +.to(mock:input) + .transform().method(NettyHttpAccessHttpRequestBeanTest.class, myTransformer); +} +}; +} + +public static String myTransformer(FullHttpRequest request) { +String in = request.content().toString(Charset.forName(UTF-8)); +return Bye + in; +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java new file mode 100644 index 000..aa3ce53 --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java @@ -0,0 +1,59 @@ +/** + * 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.component.netty4.http; + +import io.netty.handler.codec.http.HttpRequest; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; + +import org.junit.Test; + +public class NettyHttpAccessHttpRequestTest extends BaseNettyTest { + +@Test +public void testAccessHttpRequest() throws Exception { +getMockEndpoint(mock:input).expectedBodiesReceived(Hello World); + +String out = template.requestBody(netty4-http:http://localhost:{{port}}/foo;, Hello World, String.class); +assertEquals(Bye World, out); + +assertMockEndpointsSatisfied(); +} + +@Override +
[3/9] CAMEL-7782 Added camel-netty4-http component
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthConstraintMapperTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthConstraintMapperTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthConstraintMapperTest.java new file mode 100644 index 000..2522682 --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthConstraintMapperTest.java @@ -0,0 +1,90 @@ +/** + * 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.component.netty4.http; + +import org.apache.camel.CamelExecutionException; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.JndiRegistry; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore(TODO fix it) +public class NettyHttpSimpleBasicAuthConstraintMapperTest extends BaseNettyTest { + +@Override +public void setUp() throws Exception { +System.setProperty(java.security.auth.login.config, src/test/resources/myjaas.config); +super.setUp(); +} + +@Override +public void tearDown() throws Exception { +System.clearProperty(java.security.auth.login.config); +super.tearDown(); +} + +@Override +protected JndiRegistry createRegistry() throws Exception { +JndiRegistry jndi = super.createRegistry(); + +SecurityConstraintMapping matcher = new SecurityConstraintMapping(); +matcher.addInclusion(/*); +matcher.addExclusion(/public/*); + +jndi.bind(myConstraint, matcher); + +return jndi; +} + +@Test +public void testBasicAuth() throws Exception { +getMockEndpoint(mock:input).expectedBodiesReceived(Hello Public, Hello World); + +// we dont need auth for the public page +String out = template.requestBody(netty4-http:http://localhost:{{port}}/foo/public/hello.txt;, Hello Public, String.class); +assertEquals(Bye World, out); + +try { +template.requestBody(netty4-http:http://localhost:{{port}}/foo;, Hello World, String.class); +fail(Should send back 401); +} catch (CamelExecutionException e) { +NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause()); +assertEquals(401, cause.getStatusCode()); +} + +// username:password is scott:secret +String auth = Basic c2NvdHQ6c2VjcmV0; +out = template.requestBodyAndHeader(netty4-http:http://localhost:{{port}}/foo;, Hello World, Authorization, auth, String.class); +assertEquals(Bye World, out); + +assertMockEndpointsSatisfied(); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { + from(netty4-http:http://0.0.0.0:{{port}}/foo?matchOnUriPrefix=true; ++ securityConfiguration.realm=karafsecurityConfiguration.securityConstraint=#myConstraint) +.to(mock:input) +.transform().constant(Bye World); +} +}; +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java new file mode 100644 index 000..bcdd107 --- /dev/null +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java @@ -0,0 +1,70 @@ +/** + *
[9/9] git commit: CAMEL-7782 Added camel-netty4-http feature
CAMEL-7782 Added camel-netty4-http feature Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d3c59647 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d3c59647 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d3c59647 Branch: refs/heads/master Commit: d3c59647e24d032bd630f1fb36a7ccbe045b Parents: db88eed Author: Willem Jiang willem.ji...@gmail.com Authored: Fri Sep 5 21:03:36 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Fri Sep 5 21:03:36 2014 +0800 -- apache-camel/pom.xml| 12 -- .../src/main/descriptors/common-bin.xml | 1 + .../features/src/main/resources/features.xml| 5 +++ .../camel/itest/karaf/CamelNetty4HttpTest.java | 40 4 files changed, 54 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d3c59647/apache-camel/pom.xml -- diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index e84be57..95a5601 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -174,7 +174,7 @@ dependency groupIdorg.apache.camel/groupId artifactIdcamel-dropbox/artifactId -/dependency +/dependency dependency groupIdorg.apache.camel/groupId artifactIdcamel-eclipse/artifactId @@ -310,7 +310,7 @@ dependency groupIdorg.apache.camel/groupId artifactIdcamel-jclouds/artifactId -/dependency +/dependency dependency groupIdorg.apache.camel/groupId artifactIdcamel-jcr/artifactId @@ -409,7 +409,7 @@ dependency groupIdorg.apache.camel.component.linkedin/groupId artifactIdcamel-linkedin/artifactId -/dependency +/dependency dependency groupIdorg.apache.camel/groupId artifactIdcamel-mail/artifactId @@ -468,6 +468,10 @@ /dependency dependency groupIdorg.apache.camel/groupId + artifactIdcamel-netty4-http/artifactId +/dependency + dependency + groupIdorg.apache.camel/groupId artifactIdcamel-ognl/artifactId /dependency dependency @@ -477,7 +481,7 @@ dependency groupIdorg.apache.camel.component.olingo2/groupId artifactIdcamel-olingo2/artifactId -/dependency +/dependency dependency groupIdorg.apache.camel/groupId artifactIdcamel-openshift/artifactId http://git-wip-us.apache.org/repos/asf/camel/blob/d3c59647/apache-camel/src/main/descriptors/common-bin.xml -- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 4e389cc..ea6b37a 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -128,6 +128,7 @@ includeorg.apache.camel:camel-netty/include includeorg.apache.camel:camel-netty4/include includeorg.apache.camel:camel-netty-http/include +includeorg.apache.camel:camel-netty4-http/include includeorg.apache.camel:camel-ognl/include includeorg.apache.camel.component.olingo2:camel-olingo2-api/include includeorg.apache.camel.component.olingo2:camel-olingo2/include http://git-wip-us.apache.org/repos/asf/camel/blob/d3c59647/platforms/karaf/features/src/main/resources/features.xml -- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 5a57309..1a9732d 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -910,6 +910,11 @@ bundle dependency='true'mvn:commons-pool/commons-pool/${commons-pool-version}/bundle bundlemvn:org.apache.camel/camel-netty4/${project.version}/bundle /feature + feature name='camel-netty4-http' version='${project.version}' resolver='(obr)' start-level='50' +feature version='${project.version}'camel-netty4/feature +bundle dependency='true'mvn:io.netty/netty-codec-http/${netty-version}/bundle +bundlemvn:org.apache.camel/camel-netty4-http/${project.version}/bundle + /feature feature name='camel-ognl' version='${project.version}' resolver='(obr)' start-level='50' feature version='${project.version}'camel-core/feature bundle dependency='true'mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ognl/${ognl-version}/bundle http://git-wip-us.apache.org/repos/asf/camel/blob/d3c59647/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelNetty4HttpTest.java
[CONF] Apache Camel HL7
Christian Ohr bearbeitete die Seite: HL7 ... HL7 MLLP codec for Mina Agnostic data format using either plain String objects or HAPI HL7 model objects. Type Converter from/to HAPI and String HL7 DataFormat using HAPI library Even more ease-of-use as it's integrated well with the the camel- mina ( Camel 2.11 : camel- mina2 ) component. Maven users will need to add the following dependency to their pom.xml for this component: ... To expose a HL7 listener service we reuse the existing mina/ mina2 component where we just use the HL7MLLPCodec as codec. ... div class confluenceTableSmall Name Default Value Description
git commit: CAMEL-7782 Close the channel when the authentication error is sent back to client
Repository: camel Updated Branches: refs/heads/master d3c59647e - 23ea202d3 CAMEL-7782 Close the channel when the authentication error is sent back to client Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23ea202d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23ea202d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23ea202d Branch: refs/heads/master Commit: 23ea202d3c1a4e87da8ee98cd398ed7ac298a0bc Parents: d3c5964 Author: Willem Jiang willem.ji...@gmail.com Authored: Fri Sep 5 22:45:04 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Fri Sep 5 22:45:04 2014 +0800 -- .../netty4/http/handlers/HttpServerChannelHandler.java | 2 ++ .../netty4/http/NettyHttpSimpleBasicAuthTest.java| 11 ++- 2 files changed, 12 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/23ea202d/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java -- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java index 38e0798..eb33c4c 100644 --- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpServerChannelHandler.java @@ -191,6 +191,8 @@ public class HttpServerChannelHandler extends ServerChannelHandler { response.headers().set(Exchange.CONTENT_TYPE, text/plain); response.headers().set(Exchange.CONTENT_LENGTH, 0); ctx.writeAndFlush(response); +// close the channel +ctx.channel().close(); return; } else { LOG.debug(Http Basic Auth authorized for username: {}, principal.getUsername()); http://git-wip-us.apache.org/repos/asf/camel/blob/23ea202d/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java -- diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java index bcdd107..cb74342 100644 --- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java +++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSimpleBasicAuthTest.java @@ -36,8 +36,17 @@ public class NettyHttpSimpleBasicAuthTest extends BaseNettyTest { @Test public void testBasicAuth() throws Exception { + +try { +template.requestBody(netty4-http:http://localhost:{{port}}/foo;, Hello World, String.class); +fail(Should send back 401); +} catch (CamelExecutionException e) { +NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause()); +assertEquals(401, cause.getStatusCode()); +} + getMockEndpoint(mock:input).expectedBodiesReceived(Hello World); - + // username:password is scott:secret String auth = Basic c2NvdHQ6c2VjcmV0; String out = template.requestBodyAndHeader(netty4-http:http://localhost:{{port}}/foo;, Hello World, Authorization, auth, String.class);
git commit: CAMEL-7776: Upgrade to latest flatpack which is an OSGi bundle now.
Repository: camel Updated Branches: refs/heads/master 23ea202d3 - 7688e0cc5 CAMEL-7776: Upgrade to latest flatpack which is an OSGi bundle now. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7688e0cc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7688e0cc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7688e0cc Branch: refs/heads/master Commit: 7688e0cc5687b9f5f9c1426ffbdb2211666dbd62 Parents: 23ea202 Author: Claus Ibsen davscl...@apache.org Authored: Fri Sep 5 16:49:49 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Fri Sep 5 16:50:07 2014 +0200 -- components/camel-flatpack/pom.xml | 29 ++-- parent/pom.xml | 2 +- .../features/src/main/resources/features.xml| 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7688e0cc/components/camel-flatpack/pom.xml -- diff --git a/components/camel-flatpack/pom.xml b/components/camel-flatpack/pom.xml index 025ffb6..5e54184 100644 --- a/components/camel-flatpack/pom.xml +++ b/components/camel-flatpack/pom.xml @@ -43,29 +43,28 @@ groupIdorg.apache.camel/groupId artifactIdcamel-core/artifactId /dependency -!-- Using the servicemix wrapped one as the centrl mvn repo doesn't have one -- dependency - groupIdorg.apache.servicemix.bundles/groupId - artifactIdorg.apache.servicemix.bundles.flatpack/artifactId - version${flatpack-bundle-version}/version + groupIdnet.sf.flatpack/groupId + artifactIdflatpack/artifactId + version${flatpack-version}/version /dependency - dependency - groupIdorg.jdom/groupId - artifactIdjdom/artifactId - version${jdom-version}/version - /dependency +dependency + groupIdorg.jdom/groupId + artifactIdjdom/artifactId + version${jdom-version}/version + /dependency dependency groupIdjexcelapi/groupId artifactIdjxl/artifactId version${jexcelapi-version}/version /dependency - !-- logging -- - dependency - groupIdorg.slf4j/groupId - artifactIdslf4j-log4j12/artifactId - scopetest/scope - /dependency + !-- logging -- + dependency + groupIdorg.slf4j/groupId + artifactIdslf4j-log4j12/artifactId + scopetest/scope + /dependency !-- testing -- dependency http://git-wip-us.apache.org/repos/asf/camel/blob/7688e0cc/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 3d65521..b24a4dc 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -140,7 +140,7 @@ felix-fileinstall-version3.2.6/felix-fileinstall-version felix-framework-version3.2.2/felix-framework-version findbugs-maven-plugin-version2.5.2/findbugs-maven-plugin-version -flatpack-bundle-version3.2.0_2/flatpack-bundle-version +flatpack-version3.4.2/flatpack-version fop-bundle-version1.1_1/fop-bundle-version fop-version1.1/fop-version ftpserver-version1.0.6/ftpserver-version http://git-wip-us.apache.org/repos/asf/camel/blob/7688e0cc/platforms/karaf/features/src/main/resources/features.xml -- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 1a9732d..b65dfba 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -336,7 +336,7 @@ feature version='${project.version}'camel-core/feature bundle dependency='true'mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jdom/${jdom-bundle-version}/bundle bundle dependency='true'mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jexcelapi/${jexcelapi-bundle-version}/bundle -bundle dependency='true'mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.flatpack/${flatpack-bundle-version}/bundle +bundle dependency='true'mvn:net.sf.flatpack/flatpack/${flatpack-version}/bundle bundlemvn:org.apache.camel/camel-flatpack/${project.version}/bundle /feature feature name='camel-fop' version='${project.version}' resolver='(obr)' start-level='50'
git commit: Upgraded RX
Repository: camel Updated Branches: refs/heads/master 7688e0cc5 - c39f2cedb Upgraded RX Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c39f2ced Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c39f2ced Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c39f2ced Branch: refs/heads/master Commit: c39f2cedba597cbad00988b6081ea203ce70138f Parents: 7688e0c Author: Claus Ibsen davscl...@apache.org Authored: Sat Sep 6 07:45:11 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Sat Sep 6 07:45:11 2014 +0200 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c39f2ced/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index b24a4dc..4345742 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -362,7 +362,7 @@ rhino-version1.7R2/rhino-version rome-bundle-version1.0_3/rome-bundle-version rome-version1.0/rome-version -rxjava-version0.20.3/rxjava-version +rxjava-version0.20.4/rxjava-version saaj-impl-version1.3.2_2/saaj-impl-version saxon-bundle-version9.5.1-5_1/saxon-bundle-version saxon-version9.5.1-5/saxon-version