You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/03/02 08:17:08 UTC
[1/9] camel git commit: CAMEL-8312: XML External Entity (XXE)
injection in XPath. Thanks to Stephan Siano for the patch.
Repository: camel
Updated Branches:
refs/heads/master 504cf03de -> af3af21de
CAMEL-8312: XML External Entity (XXE) injection in XPath. Thanks to Stephan Siano for the patch.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1df55964
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1df55964
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1df55964
Branch: refs/heads/master
Commit: 1df559649a96a1ca0368373387e542f46e4820da
Parents: 504cf03
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 11:51:49 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:15:44 2015 +0100
----------------------------------------------------------------------
.../apache/camel/builder/xml/XPathBuilder.java | 21 ----------
.../camel/builder/xml/XPathFeatureTest.java | 42 +++++++++++++++-----
.../camel/component/xslt/SaxonXsltDTDTest.java | 11 +++--
.../camel/language/xpath/XPathLanguageTest.xml | 2 +-
4 files changed, 40 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1df55964/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index d618705..741fec8 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -18,7 +18,6 @@ package org.apache.camel.builder.xml;
import java.io.File;
import java.io.InputStream;
-import java.io.StringReader;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -51,7 +50,6 @@ import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.Predicate;
import org.apache.camel.RuntimeExpressionException;
import org.apache.camel.WrappedFile;
-import org.apache.camel.component.bean.BeanInvocation;
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.spi.Language;
import org.apache.camel.spi.NamespaceAware;
@@ -1113,25 +1111,6 @@ public class XPathBuilder extends ServiceSupport implements Expression, Predicat
}
}
- // okay we can try to remedy the failed conversion by some special types
- if (answer == null) {
- // let's try coercing some common types into something JAXP work with the best for special types
- if (body instanceof WrappedFile) {
- // special for files so we can work with them out of the box
- InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, exchange, body);
- answer = new InputSource(is);
- } else if (body instanceof BeanInvocation) {
- // if its a null bean invocation then handle that specially
- BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, exchange, body);
- if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
- // its a null argument from the bean invocation so use null as answer
- answer = null;
- }
- } else if (body instanceof String) {
- answer = new InputSource(new StringReader((String) body));
- }
- }
-
if (type == null && answer == null) {
// fallback to get the body as is
answer = body;
http://git-wip-us.apache.org/repos/asf/camel/blob/1df55964/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
index 0d90530..dfad770 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
@@ -19,11 +19,13 @@ package org.apache.camel.builder.xml;
import java.io.FileNotFoundException;
-import javax.xml.xpath.XPathExpressionException;
-
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.TypeConversionException;
import org.apache.camel.converter.jaxp.XmlConverter;
+import org.xml.sax.SAXParseException;
import static org.apache.camel.builder.xml.XPathBuilder.xpath;
@@ -32,18 +34,19 @@ public class XPathFeatureTest extends ContextTestSupport {
public static final String XML_DATA = " <!DOCTYPE foo [ "
+ " <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM \"file:///bin/test.sh\" >]> <test> &xxe; </test>";
-
-
+ public static final String XML_DATA_INVALID = " <!DOCTYPE foo [ "
+ + " <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM \"file:///bin/test.sh\" >]> <test> &xxe; </test><notwellformed>";
+
@Override
public boolean isUseRouteBuilder() {
return false;
}
-
+
public void testXPathResult() throws Exception {
String result = (String)xpath("/").stringResult().evaluate(createExchange(XML_DATA));
assertEquals("Get a wrong result", " ", result);
}
-
+
public void testXPath() throws Exception {
// Set this feature will enable the external general entities
@@ -52,16 +55,35 @@ public class XPathFeatureTest extends ContextTestSupport {
try {
xpath("/").stringResult().evaluate(createExchange(XML_DATA));
fail("Expect an Exception here");
- } catch (Exception ex) {
- assertTrue("Get a wrong exception cause.", ex instanceof InvalidXPathExpression);
- assertTrue("Get a wrong exception cause.", ex.getCause() instanceof XPathExpressionException);
+ } catch (TypeConversionException ex) {
+ assertTrue("Get a wrong exception cause.", ex.getCause() instanceof RuntimeCamelException);
assertTrue("Get a wrong exception cause.", ex.getCause().getCause() instanceof FileNotFoundException);
} finally {
System.clearProperty(DOM_BUILER_FACTORY_FEATRUE + ":"
+ "http://xml.org/sax/features/external-general-entities");
}
}
-
+
+ public void testXPathNoTypeConverter() throws Exception {
+ try {
+ // define a class without type converter as document type
+ xpath("/").documentType(Exchange.class).stringResult().evaluate(createExchange(XML_DATA));
+ fail("Expect an Exception here");
+ } catch (RuntimeCamelException ex) {
+ assertTrue("Get a wrong exception cause.", ex.getCause() instanceof NoTypeConversionAvailableException);
+ }
+ }
+
+ public void testXPathResultOnInvalidData() throws Exception {
+ try {
+ xpath("/").stringResult().evaluate(createExchange(XML_DATA_INVALID));
+ fail("Expect an Exception here");
+ } catch (TypeConversionException ex) {
+ assertTrue("Get a wrong exception cause.", ex.getCause() instanceof RuntimeCamelException);
+ assertTrue("Get a wrong exception cause.", ex.getCause().getCause() instanceof SAXParseException);
+ }
+ }
+
protected Exchange createExchange(Object xml) {
Exchange exchange = createExchangeWithBody(context, xml);
return exchange;
http://git-wip-us.apache.org/repos/asf/camel/blob/1df55964/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
index b826608..adef1d8 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXsltDTDTest.java
@@ -61,19 +61,22 @@ public class SaxonXsltDTDTest extends CamelTestSupport {
Exchange exchange = list.get(0);
String xml = exchange.getIn().getBody(String.class);
assertTrue("Get a wrong transformed message", xml.indexOf("<transformed subject=\"\">") > 0);
-
-
+
+ endpoint.reset();
+ endpoint.expectedMessageCount(1);
try {
template.sendBody("direct:start2", message);
- fail("Expect an exception here");
+ list = endpoint.getReceivedExchanges();
+ exchange = list.get(0);
+ xml = exchange.getIn().getBody(String.class);
+ assertTrue("Get a wrong transformed message", xml.indexOf("<transformed subject=\"\">") > 0);
} catch (Exception ex) {
// expect an exception here
assertTrue("Get a wrong exception", ex instanceof CamelExecutionException);
// the file could not be found
assertTrue("Get a wrong exception cause", ex.getCause() instanceof TransformerException);
}
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1df55964/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
index e1f4485..4012e570 100644
--- a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
@@ -42,7 +42,7 @@
<route>
<from uri="direct:testSaxonWithFactory"/>
<setBody>
- <xpath factoryRef="saxonFactory" documentType="org.xml.sax.InputSource" resultType="java.lang.String" logNamespaces="true">tokenize(a, '\|')</xpath>
+ <xpath factoryRef="saxonFactory" resultType="java.lang.String" logNamespaces="true">tokenize(a, '\|')</xpath>
</setBody>
<log message="Test Saxon with factory: ${body}"/>
<to uri="mock:testSaxonWithFactoryResult"/>
[2/9] camel git commit: XML External Entity (XXE) injection in
XmlConverter. Thanks to Stephan Siano for the patch.
Posted by da...@apache.org.
XML External Entity (XXE) injection in XmlConverter. Thanks to Stephan Siano for the patch.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7d19340b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7d19340b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7d19340b
Branch: refs/heads/master
Commit: 7d19340bcdb42f7aae584d9c5003ac4f7ddaee36
Parents: 1df5596
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 11:52:57 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:15:45 2015 +0100
----------------------------------------------------------------------
.../apache/camel/converter/jaxp/XmlConverter.java | 6 ++++++
.../apache/camel/component/xslt/XsltDTDTest.java | 16 +++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7d19340b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
index bad0e86..3079e7c 100644
--- a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
@@ -596,6 +596,12 @@ public class XmlConverter {
} catch (Exception e) {
LOG.warn("SAXParser doesn't support the feature {} with value {}, due to {}.", new Object[]{javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, "true", e});
}
+ try {
+ sfactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ } catch (SAXException e) {
+ LOG.warn("SAXParser doesn't support the feature {} with value {}, due to {}."
+ , new Object[]{"http://xml.org/sax/features/external-general-entities", false, e});
+ }
}
sfactory.setNamespaceAware(true);
SAXParser parser = sfactory.newSAXParser();
http://git-wip-us.apache.org/repos/asf/camel/blob/7d19340b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
index db5d63c..c0d2723 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
@@ -57,19 +57,25 @@ public class XsltDTDTest extends ContextTestSupport {
Exchange exchange = list.get(0);
String xml = exchange.getIn().getBody(String.class);
assertTrue("Get a wrong transformed message", xml.indexOf("<transformed subject=\"\">") > 0);
-
-
-
+
try {
+ endpoint.reset();
+ endpoint.expectedMessageCount(1);
+
template.sendBody("direct:start2", message);
- fail("Expect an exception here");
+
+ assertMockEndpointsSatisfied();
+
+ list = endpoint.getReceivedExchanges();
+ exchange = list.get(0);
+ xml = exchange.getIn().getBody(String.class);
+ assertTrue("Get a wrong transformed message", xml.indexOf("<transformed subject=\"\">") > 0);
} catch (Exception ex) {
// expect an exception here
assertTrue("Get a wrong exception", ex instanceof CamelExecutionException);
// the file could not be found
assertTrue("Get a wrong exception cause", ex.getCause() instanceof TransformerException);
}
-
}
[4/9] camel git commit: Fixed resource loading in chunk component.
Posted by da...@apache.org.
Fixed resource loading in chunk component.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3101074c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3101074c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3101074c
Branch: refs/heads/master
Commit: 3101074c98d18502e17632af8cbfb6edcaed764d
Parents: 101554b
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 15:08:57 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:03 2015 +0100
----------------------------------------------------------------------
.../camel/component/chunk/ChunkEndpoint.java | 28 +++++++++++++-------
1 file changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3101074c/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkEndpoint.java b/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkEndpoint.java
index 1623e21..dbb791f 100644
--- a/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkEndpoint.java
+++ b/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkEndpoint.java
@@ -25,7 +25,6 @@ import java.util.Map;
import com.x5.template.Chunk;
import com.x5.template.Theme;
-
import org.apache.camel.Component;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -92,11 +91,8 @@ public class ChunkEndpoint extends ResourceEndpoint {
@Override
protected void onExchange(Exchange exchange) throws Exception {
- boolean fromTemplate = false;
+ boolean fromTemplate;
String newResourceUri = exchange.getIn().getHeader(CHUNK_RESOURCE_URI, String.class);
- if (theme == null) {
- theme = getOrCreateTheme();
- }
if (newResourceUri == null) {
String newTemplate = exchange.getIn().getHeader(CHUNK_TEMPLATE, String.class);
Chunk newChunk;
@@ -172,12 +168,10 @@ public class ChunkEndpoint extends ResourceEndpoint {
if (themeFolder == null && themeSubfolder == null) {
theme = new Theme();
} else if (themeFolder != null && themeSubfolder == null) {
- ClassLoader apcl = getCamelContext().getApplicationContextClassLoader();
- URL url = apcl.getResource(themeFolder);
+ URL url = getCamelContext().getClassResolver().loadResourceAsURL(themeFolder);
theme = new Theme(url.getPath(), "");
} else {
- ClassLoader apcl = getCamelContext().getApplicationContextClassLoader();
- URL url = apcl.getResource(themeFolder);
+ URL url = getCamelContext().getClassResolver().loadResourceAsURL(themeFolder);
theme = new Theme(url.getPath(), themeSubfolder);
}
if (encoding != null) {
@@ -242,4 +236,20 @@ public class ChunkEndpoint extends ResourceEndpoint {
public void setExtension(String extension) {
this.extension = extension;
}
+
+ @Override
+ protected void doStart() throws Exception {
+ super.doStart();
+
+ if (theme == null) {
+ theme = getOrCreateTheme();
+ }
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ super.doStop();
+
+ // noop
+ }
}
[9/9] camel git commit: CAMEL-8417: Fixed RAW on endpoints to support
multiple querty parameters of the same key.
Posted by da...@apache.org.
CAMEL-8417: Fixed RAW on endpoints to support multiple querty parameters of the same key.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8c273a74
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8c273a74
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8c273a74
Branch: refs/heads/master
Commit: 8c273a7456f095b32321535bd1813a592d2c263c
Parents: 3101074
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 15:21:36 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:04 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/camel/util/URISupport.java | 27 ++++++++++--
.../issues/EndpointWithRawUriParameterTest.java | 44 ++++++++++++++++++++
2 files changed, 67 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8c273a74/camel-core/src/main/java/org/apache/camel/util/URISupport.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/URISupport.java b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
index 48f59ef..5962247 100644
--- a/camel-core/src/main/java/org/apache/camel/util/URISupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
@@ -22,6 +22,7 @@ import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -317,13 +318,31 @@ public final class URISupport {
* @see #RAW_TOKEN_START
* @see #RAW_TOKEN_END
*/
+ @SuppressWarnings("unchecked")
public static void resolveRawParameterValues(Map<String, Object> parameters) {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
if (entry.getValue() != null) {
- String value = entry.getValue().toString();
- if (value.startsWith(RAW_TOKEN_START) && value.endsWith(RAW_TOKEN_END)) {
- value = value.substring(4, value.length() - 1);
- entry.setValue(value);
+ // if the value is a list then we need to iterate
+ Object value = entry.getValue();
+ if (value instanceof List) {
+ List list = (List) value;
+ for (int i = 0; i < list.size(); i++) {
+ Object obj = list.get(i);
+ if (obj != null) {
+ String str = obj.toString();
+ if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) {
+ str = str.substring(4, str.length() - 1);
+ // update the string in the list
+ list.set(i, str);
+ }
+ }
+ }
+ } else {
+ String str = entry.getValue().toString();
+ if (str.startsWith(RAW_TOKEN_START) && str.endsWith(RAW_TOKEN_END)) {
+ str = str.substring(4, str.length() - 1);
+ entry.setValue(str);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8c273a74/camel-core/src/test/java/org/apache/camel/issues/EndpointWithRawUriParameterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/issues/EndpointWithRawUriParameterTest.java b/camel-core/src/test/java/org/apache/camel/issues/EndpointWithRawUriParameterTest.java
index b4bfcf5..19e5a63 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/EndpointWithRawUriParameterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/EndpointWithRawUriParameterTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.issues;
+import java.util.List;
import java.util.Map;
import org.apache.camel.Component;
@@ -46,6 +47,7 @@ public class EndpointWithRawUriParameterTest extends ContextTestSupport {
private String username;
private String password;
+ private List<String> lines;
public MyEndpoint(String endpointUri, Component component) {
super(endpointUri, component);
@@ -58,6 +60,7 @@ public class EndpointWithRawUriParameterTest extends ContextTestSupport {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("username", getUsername());
exchange.getIn().setHeader("password", getPassword());
+ exchange.getIn().setHeader("lines", getLines());
}
};
}
@@ -87,6 +90,14 @@ public class EndpointWithRawUriParameterTest extends ContextTestSupport {
public void setPassword(String password) {
this.password = password;
}
+
+ public List<String> getLines() {
+ return lines;
+ }
+
+ public void setLines(List<String> lines) {
+ this.lines = lines;
+ }
}
public void testRawUriParameter() throws Exception {
@@ -97,7 +108,32 @@ public class EndpointWithRawUriParameterTest extends ContextTestSupport {
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
+ }
+ public void testUriParameterLines() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ template.sendBody("direct:lines", "Hello World");
+
+ assertMockEndpointsSatisfied();
+
+ List<String> lines = (List<String>) getMockEndpoint("mock:result").getReceivedExchanges().get(0).getIn().getHeader("lines");
+ assertEquals(2, lines.size());
+ assertEquals("abc", lines.get(0));
+ assertEquals("def", lines.get(1));
+ }
+
+ public void testRawUriParameterLines() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ template.sendBody("direct:rawlines", "Hello World");
+
+ assertMockEndpointsSatisfied();
+
+ List<String> lines = (List<String>) getMockEndpoint("mock:result").getReceivedExchanges().get(0).getIn().getHeader("lines");
+ assertEquals(2, lines.size());
+ assertEquals("++abc++", lines.get(0));
+ assertEquals("++def++", lines.get(1));
}
@Override
@@ -110,6 +146,14 @@ public class EndpointWithRawUriParameterTest extends ContextTestSupport {
from("direct:start")
.to("mycomponent:foo?username=scott&password=RAW(++%%w?rd))")
.to("mock:result");
+
+ from("direct:lines")
+ .to("mycomponent:foo?lines=abc&lines=def")
+ .to("mock:result");
+
+ from("direct:rawlines")
+ .to("mycomponent:foo?lines=RAW(++abc++)&lines=RAW(++def++)")
+ .to("mock:result");
}
};
}
[8/9] camel git commit: Fixed ftp component after little mistake
committed recently
Posted by da...@apache.org.
Fixed ftp component after little mistake committed recently
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/19567165
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/19567165
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/19567165
Branch: refs/heads/master
Commit: 19567165c2ba534844ced26fd3d16b4c1ade4f4f
Parents: f3a9064
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 15:42:52 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:04 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/camel/component/file/remote/FtpComponent.java | 2 --
.../camel/component/file/remote/RemoteFileConfiguration.java | 3 +++
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/19567165/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
index 7222031..9aeee72 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
@@ -49,8 +49,6 @@ public class FtpComponent extends RemoteFileComponent<FTPFile> {
FtpEndpoint<FTPFile> answer = new FtpEndpoint<FTPFile>(uri, this, config);
extractAndSetFtpClientConfigParameters(parameters, answer);
extractAndSetFtpClientParameters(parameters, answer);
- config.setDirectory(remaining);
- config.setDirectoryName(remaining);
return answer;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/19567165/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
index a8590e9..502bd92 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
@@ -90,6 +90,9 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration {
@Override
public void configure(URI uri) {
super.configure(uri);
+ // after configure the directory has been resolved, so we can use it for directoryName
+ // (directoryName is the name we use in the other file components, to use consistent name)
+ setDirectoryName(getDirectory());
setProtocol(uri.getScheme());
setDefaultPort();
[3/9] camel git commit: Fixed test
Posted by da...@apache.org.
Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fe86d227
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fe86d227
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fe86d227
Branch: refs/heads/master
Commit: fe86d227157d90b6d978c78b0bf131808d2d19b9
Parents: 7d19340
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 13:55:49 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:17:28 2015 +0100
----------------------------------------------------------------------
...HttpComponentConfigurationAndDocumentationTest.java | 13 -------------
.../JettyRouteWithUnknownSocketPropertiesTest.java | 3 ++-
.../JettyRouteWithUnknownSslSocketPropertiesTest.java | 3 ++-
3 files changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/fe86d227/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
index e18e911..785c9be 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
@@ -16,12 +16,9 @@
*/
package org.apache.camel.component.jetty;
-import org.apache.camel.CamelContext;
import org.apache.camel.ComponentConfiguration;
import org.apache.camel.EndpointConfiguration;
-import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
import org.junit.Test;
public class JettyHttpComponentConfigurationAndDocumentationTest extends CamelTestSupport {
@@ -43,16 +40,6 @@ public class JettyHttpComponentConfigurationAndDocumentationTest extends CamelTe
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
- assertTrue(json.contains("\"httpClientMaxThreads\": { \"kind\": \"parameter\", \"type\": \"integer\""));
- assertTrue(json.contains("\"sessionSupport\": { \"kind\": \"parameter\", \"type\": \"boolean\", \"javaType\": \"boolean\""));
- }
-
- @Test
- @Ignore // TODO Need to investigate why this fails while html is present
- public void testComponentDocumentation() throws Exception {
- CamelContext context = new DefaultCamelContext();
- String html = context.getComponentDocumentation("jetty");
- assertNotNull("Should have found some auto-generated HTML", html);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/fe86d227/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
index 1c16248..298ffef 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
@@ -56,7 +56,8 @@ public class JettyRouteWithUnknownSocketPropertiesTest extends BaseJettyTest {
context.start();
fail("Should have thrown exception");
} catch (Exception e) {
- assertTrue(e.getMessage().endsWith("Unknown parameters=[{doesNotExist=2000}]"));
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertTrue(iae.getMessage().endsWith("Unknown parameters=[{doesNotExist=2000}]"));
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/fe86d227/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
index 091bf15..cd00ae1 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
@@ -56,7 +56,8 @@ public class JettyRouteWithUnknownSslSocketPropertiesTest extends BaseJettyTest
context.start();
fail("Should have thrown exception");
} catch (Exception e) {
- assertTrue("Actual message: " + e.getMessage(), e.getMessage().endsWith("Unknown parameters=[{doesNotExist=2000}]"));
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertTrue("Actual message: " + iae.getMessage(), iae.getMessage().endsWith("Unknown parameters=[{doesNotExist=2000}]"));
}
}
[6/9] camel git commit: Use junit 4.11 as not all test libraries work
with it.
Posted by da...@apache.org.
Use junit 4.11 as not all test libraries work with it.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3a90643
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3a90643
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3a90643
Branch: refs/heads/master
Commit: f3a90643dbe88345b97aa881a25e2cf0427ccbc8
Parents: 8c273a7
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 15:22:44 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:04 2015 +0100
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f3a90643/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index fa0f4ff..81a6353 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -291,7 +291,7 @@
<juel-bundle-version>2.1.3_1</juel-bundle-version>
<juel-version>2.1.3</juel-version>
<junit-bundle-version>4.11_2</junit-bundle-version>
- <junit-version>4.12</junit-version>
+ <junit-version>4.11</junit-version>
<jython-version>2.5.3</jython-version>
<jzlib-version>1.1.3</jzlib-version>
<kafka-version>0.8.1.1</kafka-version>
[7/9] camel git commit: Fixed test
Posted by da...@apache.org.
Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/af3af21d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/af3af21d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/af3af21d
Branch: refs/heads/master
Commit: af3af21de2731100b6446d993e6618977cb00aef
Parents: 1956716
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 16:10:05 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:04 2015 +0100
----------------------------------------------------------------------
...tpsComponentConfigurationAndDocumentationTest.java | 14 --------------
1 file changed, 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/af3af21d/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsComponentConfigurationAndDocumentationTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsComponentConfigurationAndDocumentationTest.java
index 1d79610..972ccad 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsComponentConfigurationAndDocumentationTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsComponentConfigurationAndDocumentationTest.java
@@ -16,10 +16,8 @@
*/
package org.apache.camel.component.file.remote;
-import org.apache.camel.CamelContext;
import org.apache.camel.ComponentConfiguration;
import org.apache.camel.EndpointConfiguration;
-import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -41,18 +39,6 @@ public class FtpsComponentConfigurationAndDocumentationTest extends CamelTestSup
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
-
- assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"type\": \"string\""));
- assertTrue(json.contains("\"port\": { \"kind\": \"path\", \"type\": \"integer\""));
- assertTrue(json.contains("\"maximumReconnectAttempts\": { \"kind\": \"parameter\", \"type\": \"integer\""));
- assertTrue(json.contains("\"dataTimeout\": { \"kind\": \"parameter\", \"type\": \"integer\""));
- }
-
- @Test
- public void testComponentDocumentation() throws Exception {
- CamelContext context = new DefaultCamelContext();
- String html = context.getComponentDocumentation("ftps");
- assertNotNull("Should have found some auto-generated", html);
}
}
[5/9] camel git commit: Fixed test
Posted by da...@apache.org.
Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/101554b1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/101554b1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/101554b1
Branch: refs/heads/master
Commit: 101554b1e28bc6e0b60f766a4fd9ad57f9a208ef
Parents: fe86d22
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 1 14:49:04 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 2 08:18:03 2015 +0100
----------------------------------------------------------------------
...rvletComponentConfigurationAndDocumentationTest.java | 12 ------------
1 file changed, 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/101554b1/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletComponentConfigurationAndDocumentationTest.java b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletComponentConfigurationAndDocumentationTest.java
index 22c25f2..4843c9f 100644
--- a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletComponentConfigurationAndDocumentationTest.java
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletComponentConfigurationAndDocumentationTest.java
@@ -16,10 +16,8 @@
*/
package org.apache.camel.component.servlet;
-import org.apache.camel.CamelContext;
import org.apache.camel.ComponentConfiguration;
import org.apache.camel.EndpointConfiguration;
-import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -42,16 +40,6 @@ public class ServletComponentConfigurationAndDocumentationTest extends CamelTest
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
-
- assertTrue(json.contains("\"servletName\": { \"kind\": \"property\", \"type\": \"string\""));
- assertTrue(json.contains("\"matchOnUriPrefix\": { \"kind\": \"parameter\", \"type\": \"boolean\""));
- }
-
- @Test
- public void testComponentDocumentation() throws Exception {
- CamelContext context = new DefaultCamelContext();
- String html = context.getComponentDocumentation("servlet");
- assertNotNull("Should have found some auto-generated HTML", html);
}
}