You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/10/23 07:28:11 UTC
[camel] branch master updated: Camel-Jetty: Fixed CS
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new cb6f376 Camel-Jetty: Fixed CS
cb6f376 is described below
commit cb6f376351bc66a6ed082c99658935cdce591c96
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 23 09:27:32 2019 +0200
Camel-Jetty: Fixed CS
---
.../component/jetty9/AttachmentHttpBinding.java | 15 ++-
.../camel/component/jetty9/CamelHttpClient9.java | 6 +-
.../component/jetty9/JettyContentExchange9.java | 15 ++-
.../component/jetty9/JettyHttpComponent9.java | 26 ++--
.../camel/component/jetty9/JettyHttpEndpoint9.java | 14 +--
.../jetty/ConvertPayloadToInputStreamTest.java | 6 +-
.../camel/component/jetty/EnableCORSTest.java | 4 -
.../component/jetty/ExcludeCipherSuitesTest.java | 4 +-
.../component/jetty/ExplicitHttpsRouteTest.java | 14 +--
...ExplicitHttpsSslContextParametersRouteTest.java | 22 ++--
.../jetty/ExplicitJettyAsyncRouteTest.java | 6 +-
.../component/jetty/ExplicitJettyRouteTest.java | 3 +-
.../component/jetty/HttpAcceptHeaderTest.java | 5 +-
.../component/jetty/HttpBridgeAsyncRouteTest.java | 4 +-
.../component/jetty/HttpBridgeEncodedPathTest.java | 13 +-
.../jetty/HttpBridgeMultipartRouteTest.java | 3 +-
.../camel/component/jetty/HttpBridgeRouteTest.java | 15 ++-
.../component/jetty/HttpCharacterEncodingTest.java | 8 +-
.../jetty/HttpClientRouteEnableChunkedTest.java | 20 +--
.../camel/component/jetty/HttpClientRouteTest.java | 42 +++----
.../camel/component/jetty/HttpConverterTest.java | 77 ++++++------
.../component/jetty/HttpDeleteWithBodyTest.java | 16 ++-
.../jetty/HttpEmptyQueryParameterTest.java | 4 +-
.../camel/component/jetty/HttpEndpointURLTest.java | 2 +-
.../jetty/HttpFilterNoCamelHeadersTest.java | 10 +-
.../camel/component/jetty/HttpHeaderTest.java | 26 ++--
.../component/jetty/HttpMethodRestrictTest.java | 6 +-
.../HttpOperationsFailedExceptionUriTest.java | 11 +-
.../component/jetty/HttpPollingConsumerTest.java | 3 +-
.../jetty/HttpProducerConcurrentTest.java | 4 +-
.../jetty/HttpProducerConnectionCloseTest.java | 2 +-
.../jetty/HttpProducerJMXBeansIssueTest.java | 1 +
.../jetty/HttpProducerOkStatusCodeRangeTest.java | 4 +-
.../jetty/HttpProducerQueryParamTest.java | 2 +-
.../component/jetty/HttpProducerSOTimeoutTest.java | 5 +-
.../jetty/HttpProducerSendEmptyHeaderTest.java | 8 +-
.../jetty/HttpProducerUnsafeCharsTest.java | 3 +-
.../jetty/HttpProxyRouteContentTypeTest.java | 2 +-
.../camel/component/jetty/HttpProxyRouteTest.java | 50 ++++----
.../jetty/HttpRedirectNoLocationTest.java | 13 +-
.../camel/component/jetty/HttpRedirectTest.java | 12 +-
.../component/jetty/HttpRequestResponseTest.java | 10 +-
...ttpReturnDataNotInputStreamConvertableTest.java | 13 +-
.../camel/component/jetty/HttpRouteTest.java | 45 +++----
.../camel/component/jetty/HttpSendFileTest.java | 15 +--
.../jetty/HttpStreamCacheFileIssueTest.java | 30 +++--
.../jetty/HttpStreamCacheFileResponseTest.java | 9 +-
.../jetty/HttpStreamCacheFileStopIssueTest.java | 30 +++--
.../component/jetty/HttpStreamCacheFileTest.java | 26 ++--
.../camel/component/jetty/HttpToFileTest.java | 17 +--
.../component/jetty/HttpTwoServerPortsTest.java | 2 +-
.../camel/component/jetty/HttpsAsyncRouteTest.java | 23 ++--
.../camel/component/jetty/HttpsRouteAliasTest.java | 14 +--
.../jetty/HttpsRouteSetupWithSystemPropsTest.java | 13 +-
...psRouteSslContextParametersInComponentTest.java | 8 +-
.../camel/component/jetty/HttpsRouteTest.java | 30 ++---
.../camel/component/jetty/InterfacesTest.java | 56 ++++-----
.../jetty/JettyCallHttpThenExceptionTest.java | 21 ++--
.../component/jetty/JettyCamelHttpUrlCBRTest.java | 6 +-
.../jetty/JettyContentBasedRouteTest.java | 6 +-
.../component/jetty/JettyContentTypeTest.java | 4 +-
.../jetty/JettyContinuationDisabledTest.java | 14 +--
.../camel/component/jetty/JettyEnableJmxTest.java | 59 ++++-----
.../JettyEndpointContinuationDisabledTest.java | 14 +--
.../jetty/JettyEndpointSetHttpTraceTest.java | 8 +-
.../camel/component/jetty/JettyHandle404Test.java | 52 ++++----
.../jetty/JettyHttpBridgeEncodedPathTest.java | 7 +-
.../component/jetty/JettyHttpContentTypeTest.java | 20 ++-
.../jetty/JettyHttpEndpointDisconnectTest.java | 3 +-
.../JettyHttpGetWithParamAsExchangeHeaderTest.java | 9 +-
.../component/jetty/JettyHttpGetWithParamTest.java | 8 +-
.../component/jetty/JettyHttpHeadersTest.java | 5 +-
.../jetty/JettyHttpMapHttpMessageHeadersTest.java | 8 +-
.../camel/component/jetty/JettyImageFileTest.java | 6 +-
.../jetty/JettyLongestContextPathMatchTest.java | 2 +-
.../component/jetty/JettyMuteExceptionTest.java | 5 +-
.../jetty/JettyOnExceptionHandledTest.java | 17 ++-
.../jetty/JettyResponseBodyWhenErrorTest.java | 2 +-
.../jetty/JettyResponseBufferSizeTest.java | 3 +-
.../camel/component/jetty/JettyRouteTest.java | 12 +-
.../jetty/JettyRouteWithSocketPropertiesTest.java | 5 +-
.../JettyRouteWithUnknownSocketPropertiesTest.java | 2 +-
...ttyRouteWithUnknownSslSocketPropertiesTest.java | 2 +-
.../jetty/JettySimplifiedHandle404Test.java | 25 ++--
.../component/jetty/JettySimulateInOnlyTest.java | 38 +++---
.../camel/component/jetty/JettySteveIssueTest.java | 4 +-
.../component/jetty/JettySuspendResumeTest.java | 7 +-
.../camel/component/jetty/JettySuspendTest.java | 5 +-
.../jetty/JettySuspendWhileInProgressTest.java | 11 +-
.../jetty/JettySwitchingStatusCode204Test.java | 85 ++++++-------
.../component/jetty/JettyWithXPathChoiceTest.java | 7 +-
.../component/jetty/MultiPartFormOkHttpTest.java | 13 +-
.../camel/component/jetty/MultiPartFormTest.java | 11 +-
.../component/jetty/MultiThreadedHttpGetTest.java | 7 +-
.../camel/component/jetty/MyErrorHandler.java | 7 +-
.../jetty/SimpleJettyChunkedFalseTest.java | 3 +-
.../camel/component/jetty/SimpleJettyTest.java | 3 +-
.../component/jetty/SpringHttpsRouteTest.java | 10 +-
.../jetty/TwoCamelContextWithJettyRouteTest.java | 12 +-
.../component/jetty/async/JettyAsyncCBRTest.java | 10 +-
.../async/JettyAsyncContinuationDisabledTest.java | 4 +-
.../async/JettyAsyncContinuationTimeoutOkTest.java | 4 +-
.../async/JettyAsyncContinuationTimeoutTest.java | 4 +-
.../JettyAsyncDefaultContinuationTimeoutTest.java | 4 +-
.../jetty/async/JettyAsyncFilterTest.java | 9 +-
.../component/jetty/async/JettyAsyncTest.java | 4 +-
.../jetty/async/JettyAsyncThrottleTest.java | 25 ++--
.../jetty/async/JettyAsyncTransformTest.java | 11 +-
.../jetty/async/JettyAsyncTryCatchFinallyTest.java | 17 +--
.../component/jetty/async/MyAsyncComponent.java | 2 +-
.../component/jetty/async/MyAsyncProducer.java | 2 +-
.../jetty/file/JettyFileConsumerTest.java | 25 ++--
.../component/jetty/javabody/HttpJavaBodyTest.java | 135 ++++++++++-----------
.../camel/component/jetty/manual/JettyManual.java | 19 ++-
.../component/jetty/proxy/HttpClientProxyTest.java | 6 +-
.../HttpClientProxyTransferExceptionTest.java | 6 +-
.../jetty/proxy/JettyChuckedFalseTest.java | 17 +--
.../component/jetty/rest/RestApiJettyTest.java | 22 ++--
.../jetty/rest/RestApiOverrideHostJettyTest.java | 22 ++--
.../jetty/rest/RestBridgeEndpointTest.java | 4 +-
.../jetty/rest/RestHttpsClientAuthRouteTest.java | 16 +--
.../component/jetty/rest/RestJettyAcceptTest.java | 28 ++---
.../rest/RestJettyBindingModeAutoWithJsonTest.java | 4 +-
.../rest/RestJettyBindingModeAutoWithXmlTest.java | 4 +-
.../jetty/rest/RestJettyBindingModeJsonTest.java | 4 +-
.../RestJettyBindingModeJsonWithContractTest.java | 10 +-
.../RestJettyBindingModeOffWithContractTest.java | 27 ++---
.../jetty/rest/RestJettyBindingModeXmlTest.java | 4 +-
.../jetty/rest/RestJettyContentTypeTest.java | 26 ++--
.../jetty/rest/RestJettyCustomContentTypeTest.java | 9 +-
.../component/jetty/rest/RestJettyGetCorsTest.java | 18 ++-
.../component/jetty/rest/RestJettyGetTest.java | 18 ++-
.../jetty/rest/RestJettyMethodNotAllowedTest.java | 14 +--
.../component/jetty/rest/RestJettyOptionsTest.java | 10 +-
.../jetty/rest/RestJettyPojoInOutTest.java | 9 +-
.../jetty/rest/RestJettyPostJsonJaxbPojoTest.java | 4 +-
.../RestJettyPostJsonPojoDisableFeatureTest.java | 8 +-
.../jetty/rest/RestJettyPostJsonPojoListTest.java | 8 +-
.../jetty/rest/RestJettyPostJsonPojoTest.java | 4 +-
.../RestJettyPostNotMapHttpMessageHeadersTest.java | 16 +--
.../jetty/rest/RestJettyPostXmlJaxbPojoTest.java | 4 +-
.../rest/RestJettyRemoveAddRestAndRouteTest.java | 19 ++-
.../jetty/rest/RestJettyRequiredBodyTest.java | 24 ++--
.../rest/RestJettyRequiredHttpHeaderTest.java | 26 ++--
.../rest/RestJettyRequiredQueryParameterTest.java | 25 ++--
.../component/jetty/rest/RestJettyVerbTest.java | 7 +-
.../jetty/rest/RestNoBridgeEndpointTest.java | 8 +-
.../rest/producer/HttpRestProducerGetTest.java | 23 ++--
.../rest/producer/HttpRestProducerPutTest.java | 7 +-
.../rest/producer/JettyRestProducerApiDocTest.java | 11 +-
.../rest/producer/JettyRestProducerGetTest.java | 19 ++-
.../JettyRestProducerGetUriParameterTest.java | 19 ++-
.../JettyRestProducerInvalidApiDocTest.java | 6 +-
.../producer/JettyRestProducerPojoInOutTest.java | 28 ++---
.../rest/producer/JettyRestProducerPutTest.java | 7 +-
...JettyRestProducerThrowExceptionOnErrorTest.java | 28 ++---
.../JettyRestProducerVerbUpperCaseTest.java | 25 ++--
157 files changed, 936 insertions(+), 1338 deletions(-)
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
index ecdf7af..36bacdf 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
@@ -78,9 +78,10 @@ final class AttachmentHttpBinding extends DefaultHttpBinding {
@Override
protected void populateRequestParameters(HttpServletRequest request, HttpMessage message) throws Exception {
- //we populate the http request parameters without checking the request method
+ // we populate the http request parameters without checking the request
+ // method
Map<String, Object> headers = message.getHeaders();
- //remove Content-Encoding from request
+ // remove Content-Encoding from request
if (request instanceof org.eclipse.jetty.server.Request) {
org.eclipse.jetty.server.Request jettyRequest = (org.eclipse.jetty.server.Request)request;
jettyRequest.getHttpFields().remove(Exchange.CONTENT_ENCODING);
@@ -97,8 +98,7 @@ final class AttachmentHttpBinding extends DefaultHttpBinding {
if (dh.getContentType() == null || dh.getContentType().startsWith("text/plain")) {
value = request.getParameter(name);
}
- if (getHeaderFilterStrategy() != null
- && !getHeaderFilterStrategy().applyFilterToExternalHeaders(name, value, message.getExchange())) {
+ if (getHeaderFilterStrategy() != null && !getHeaderFilterStrategy().applyFilterToExternalHeaders(name, value, message.getExchange())) {
HttpHelper.appendHeader(headers, name, value);
}
continue;
@@ -110,15 +110,14 @@ final class AttachmentHttpBinding extends DefaultHttpBinding {
if (values != null) {
for (String value : values) {
- if (getHeaderFilterStrategy() != null
- && !getHeaderFilterStrategy().applyFilterToExternalHeaders(name, value, message.getExchange())) {
+ if (getHeaderFilterStrategy() != null && !getHeaderFilterStrategy().applyFilterToExternalHeaders(name, value, message.getExchange())) {
HttpHelper.appendHeader(headers, name, value);
}
}
}
}
}
-
+
final class PartDataSource implements DataSource {
private final Part part;
@@ -146,4 +145,4 @@ final class AttachmentHttpBinding extends DefaultHttpBinding {
return part.getContentType();
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/CamelHttpClient9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/CamelHttpClient9.java
index b9463c4..05f264b 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/CamelHttpClient9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/CamelHttpClient9.java
@@ -24,7 +24,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
@Deprecated
public class CamelHttpClient9 extends CamelHttpClient {
-
+
public CamelHttpClient9(SslContextFactory sslContextFactory) {
super(sslContextFactory);
}
@@ -42,7 +42,7 @@ public class CamelHttpClient9 extends CamelHttpClient {
protected void setThreadPoolOrExecutor(Executor pool) {
setExecutor(pool);
}
-
+
@Override
public void setProxy(String host, int port) {
getProxyConfiguration().getProxies().add(new org.eclipse.jetty.client.HttpProxy(host, port));
@@ -57,5 +57,5 @@ public class CamelHttpClient9 extends CamelHttpClient {
public int getProxyPort() {
return getProxyConfiguration().getProxies().get(0).getAddress().getPort();
}
-
+
}
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
index a1c6541..b2c0530 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
@@ -52,7 +52,6 @@ import org.eclipse.jetty.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
* Jetty specific exchange which keeps track of the request and response.
*/
@@ -74,8 +73,7 @@ public class JettyContentExchange9 implements JettyContentExchange {
private boolean supportRedirect;
@Override
- public void init(Exchange exchange, JettyHttpBinding jettyBinding,
- final HttpClient client, AsyncCallback callback) {
+ public void init(Exchange exchange, JettyHttpBinding jettyBinding, final HttpClient client, AsyncCallback callback) {
this.exchange = exchange;
this.jettyBinding = jettyBinding;
this.client = client;
@@ -151,7 +149,7 @@ public class JettyContentExchange9 implements JettyContentExchange {
private void tryClose(Object obj) {
if (obj instanceof Closeable) {
try {
- ((Closeable) obj).close();
+ ((Closeable)obj).close();
} catch (IOException e) {
// Ignore
}
@@ -262,9 +260,9 @@ public class JettyContentExchange9 implements JettyContentExchange {
try {
Object content = osb.build();
if (content instanceof byte[]) {
- onResponseComplete(result, (byte[]) content);
+ onResponseComplete(result, (byte[])content);
} else {
- StreamCache cos = (StreamCache) content;
+ StreamCache cos = (StreamCache)content;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
cos.writeTo(baos);
onResponseComplete(result, baos.toByteArray());
@@ -301,11 +299,12 @@ public class JettyContentExchange9 implements JettyContentExchange {
return fields.getFieldNamesCollection();
} catch (NoSuchMethodError e) {
try {
- // In newer versions of Jetty the return type has been changed to Set.
+ // In newer versions of Jetty the return type has been changed
+ // to Set.
// This causes problems at byte-code level. Try recovering.
Method reflGetFieldNamesCollection = HttpFields.class.getMethod("getFieldNamesCollection");
Object result = reflGetFieldNamesCollection.invoke(fields);
- return (Collection<String>) result;
+ return (Collection<String>)result;
} catch (Exception reflectionException) {
// Suppress, throwing the original exception
throw e;
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
index 2a17813..b45f0d4 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
@@ -54,11 +54,9 @@ public class JettyHttpComponent9 extends JettyHttpComponent {
protected JettyHttpEndpoint createEndpoint(URI endpointUri, URI httpUri) throws URISyntaxException {
return new JettyHttpEndpoint9(this, endpointUri.toString(), httpUri);
}
-
+
@Override
- protected AbstractConnector createConnectorJettyInternal(Server server,
- JettyHttpEndpoint endpoint,
- SslContextFactory sslcf) {
+ protected AbstractConnector createConnectorJettyInternal(Server server, JettyHttpEndpoint endpoint, SslContextFactory sslcf) {
try {
String host = endpoint.getHttpUri().getHost();
int port = endpoint.getPort();
@@ -68,7 +66,7 @@ public class JettyHttpComponent9 extends JettyHttpComponent {
if (requestBufferSize != null) {
// Does not work
- //httpConfig.setRequestBufferSize(requestBufferSize);
+ // httpConfig.setRequestBufferSize(requestBufferSize);
}
if (requestHeaderSize != null) {
httpConfig.setRequestHeaderSize(requestHeaderSize);
@@ -81,8 +79,8 @@ public class JettyHttpComponent9 extends JettyHttpComponent {
}
if (useXForwardedForHeader) {
httpConfig.addCustomizer(new ForwardedRequestCustomizer());
- }
- HttpConnectionFactory httpFactory = new org.eclipse.jetty.server.HttpConnectionFactory(httpConfig);
+ }
+ HttpConnectionFactory httpFactory = new org.eclipse.jetty.server.HttpConnectionFactory(httpConfig);
ArrayList<ConnectionFactory> connectionFactories = new ArrayList<>();
ServerConnector result = new org.eclipse.jetty.server.ServerConnector(server);
@@ -90,7 +88,8 @@ public class JettyHttpComponent9 extends JettyHttpComponent {
httpConfig.addCustomizer(new org.eclipse.jetty.server.SecureRequestCustomizer());
SslConnectionFactory scf = new org.eclipse.jetty.server.SslConnectionFactory(sslcf, "HTTP/1.1");
connectionFactories.add(scf);
- // The protocol name can be "SSL" or "SSL-HTTP/1.1" depending on the version of Jetty
+ // The protocol name can be "SSL" or "SSL-HTTP/1.1" depending on
+ // the version of Jetty
result.setDefaultProtocol(scf.getProtocol());
}
connectionFactories.add(httpFactory);
@@ -107,15 +106,14 @@ public class JettyHttpComponent9 extends JettyHttpComponent {
Map<String, Object> properties = new HashMap<>(getSslSocketConnectorProperties());
PropertyBindingSupport.bindProperties(getCamelContext(), sslcf, properties);
if (properties.size() > 0) {
- throw new IllegalArgumentException("There are " + properties.size()
- + " parameters that couldn't be set on the SocketConnector."
- + " Check the uri if the parameters are spelt correctly and that they are properties of the SelectChannelConnector."
- + " Unknown parameters=[" + properties + "]");
+ throw new IllegalArgumentException("There are " + properties.size() + " parameters that couldn't be set on the SocketConnector."
+ + " Check the uri if the parameters are spelt correctly and that they are properties of the SelectChannelConnector."
+ + " Unknown parameters=[" + properties + "]");
}
}
- LOG.info("Connector on port: {} is using includeCipherSuites: {} excludeCipherSuites: {} includeProtocols: {} excludeProtocols: {}",
- port, sslcf.getIncludeCipherSuites(), sslcf.getExcludeCipherSuites(), sslcf.getIncludeProtocols(), sslcf.getExcludeProtocols());
+ LOG.info("Connector on port: {} is using includeCipherSuites: {} excludeCipherSuites: {} includeProtocols: {} excludeProtocols: {}", port,
+ sslcf.getIncludeCipherSuites(), sslcf.getExcludeCipherSuites(), sslcf.getIncludeProtocols(), sslcf.getExcludeProtocols());
}
return result;
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9.java
index bd65238..311b322 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9.java
@@ -28,12 +28,12 @@ import org.apache.camel.http.common.HttpConsumer;
import org.apache.camel.spi.UriEndpoint;
/**
- * The jetty component provides HTTP-based endpoints for consuming and producing HTTP requests.
+ * The jetty component provides HTTP-based endpoints for consuming and producing
+ * HTTP requests.
*/
-@UriEndpoint(firstVersion = "1.2.0", scheme = "jetty", extendsScheme = "http", title = "Jetty",
- syntax = "jetty:httpUri", label = "http", consumerOnly = true, lenientProperties = true,
- excludeProperties = "authMethod,authMethodPriority,authUsername,authPassword,authDomain,authHost"
- + "proxyAuthScheme,proxyAuthMethod,proxyAuthUsername,proxyAuthPassword,proxyAuthHost,proxyAuthPort,proxyAuthDomain")
+@UriEndpoint(firstVersion = "1.2.0", scheme = "jetty", extendsScheme = "http", title = "Jetty", syntax = "jetty:httpUri", label = "http", consumerOnly = true, lenientProperties = true,
+excludeProperties = "authMethod,authMethodPriority,authUsername,authPassword,authDomain,authHost"
++ "proxyAuthScheme,proxyAuthMethod,proxyAuthUsername,proxyAuthPassword,proxyAuthHost,proxyAuthPort,proxyAuthDomain")
public class JettyHttpEndpoint9 extends JettyHttpEndpoint implements AsyncEndpoint {
private HttpBinding binding;
@@ -66,9 +66,9 @@ public class JettyHttpEndpoint9 extends JettyHttpEndpoint implements AsyncEndpoi
super.setHttpBinding(binding);
this.binding = binding;
}
-
+
@Override
public JettyContentExchange createContentExchange() {
return new JettyContentExchange9();
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java
index a7687fe..570fb68 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java
@@ -52,10 +52,8 @@ public class ConvertPayloadToInputStreamTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
- from("jetty:http://localhost:{{port}}/test").
- convertBodyTo(InputStream.class).
- to("mock:result");
+ from("jetty:http://localhost:{{port}}/test").convertBodyTo(InputStream.class).to("mock:result");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/EnableCORSTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/EnableCORSTest.java
index d51271b..71464ed 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/EnableCORSTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/EnableCORSTest.java
@@ -40,7 +40,6 @@ public class EnableCORSTest extends BaseJettyTest {
assertNull("Access-Control-Allow-Credentials HEADER should not be set", responseHeader);
}
-
@Test
public void testCORSenabled() throws Exception {
HttpClient httpclient = new HttpClient();
@@ -48,7 +47,6 @@ public class EnableCORSTest extends BaseJettyTest {
httpMethod.addRequestHeader("Origin", "http://localhost:9000");
httpMethod.addRequestHeader("Referer", "http://localhost:9000");
-
int status = httpclient.executeMethod(httpMethod);
assertEquals("Get a wrong response status", 200, status);
@@ -56,10 +54,8 @@ public class EnableCORSTest extends BaseJettyTest {
Header responseHeader = httpMethod.getResponseHeader("Access-Control-Allow-Credentials");
assertTrue("CORS not enabled", Boolean.valueOf(responseHeader.getValue()));
-
}
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExcludeCipherSuitesTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExcludeCipherSuitesTest.java
index 1440362..ceb9b17 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExcludeCipherSuitesTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExcludeCipherSuitesTest.java
@@ -33,11 +33,11 @@ public class ExcludeCipherSuitesTest extends BaseJettyTest {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.p12").toString());
ksp.setPassword(pwd);
-
+
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
-
+
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java
index c243808..3cc907f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java
@@ -31,11 +31,11 @@ public class ExplicitHttpsRouteTest extends HttpsRouteTest {
private Connector createSslSocketConnector(int port) throws URISyntaxException {
/*
- SslSelectChannelConnector sslSocketConnector = new SslSelectChannelConnector();
- configureSslContextFactory(sslSocketConnector.getSslContextFactory());
- sslSocketConnector.setPort(port);
- return sslSocketConnector;
- */
+ * SslSelectChannelConnector sslSocketConnector = new
+ * SslSelectChannelConnector();
+ * configureSslContextFactory(sslSocketConnector.getSslContextFactory())
+ * ; sslSocketConnector.setPort(port); return sslSocketConnector;
+ */
return null;
}
@@ -61,9 +61,9 @@ public class ExplicitHttpsRouteTest extends HttpsRouteTest {
}
};
from("jetty:https://localhost:" + port1 + "/hello").process(proc);
-
+
from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
index d5d6eae..57d78e5 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
@@ -37,20 +37,22 @@ public class ExplicitHttpsSslContextParametersRouteTest extends HttpsRouteTest {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.p12").toString());
ksp.setPassword(pwd);
-
+
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
-
+
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
-
- // From Camel 2.5.0 Camel-Jetty is using SslSelectChannelConnector instead of SslSocketConnector
- //SslSelectChannelConnector sslSocketConnector = new SslSelectChannelConnector();
- //sslSocketConnector.getSslContextFactory().setSslContext(sslContextParameters.createSSLContext());
- //sslSocketConnector.setPort(port);
-
- //return sslSocketConnector;
+
+ // From Camel 2.5.0 Camel-Jetty is using SslSelectChannelConnector
+ // instead of SslSocketConnector
+ // SslSelectChannelConnector sslSocketConnector = new
+ // SslSelectChannelConnector();
+ // sslSocketConnector.getSslContextFactory().setSslContext(sslContextParameters.createSSLContext());
+ // sslSocketConnector.setPort(port);
+
+ // return sslSocketConnector;
return null;
}
// END SNIPPET: e2
@@ -77,7 +79,7 @@ public class ExplicitHttpsSslContextParametersRouteTest extends HttpsRouteTest {
}
};
from("jetty:https://localhost:" + port1 + "/hello").process(proc);
-
+
from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyAsyncRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyAsyncRouteTest.java
index 1c7fdc5..558627b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyAsyncRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyAsyncRouteTest.java
@@ -23,7 +23,6 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
-
/**
* Unit test for wiki demonstration.
*/
@@ -41,7 +40,7 @@ public class ExplicitJettyAsyncRouteTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- //async and continuation is not compatible!
+ // async and continuation is not compatible!
from("jetty:http://localhost:{{port}}/myapp/myservice?async=true&useContinuation=false").process(new MyBookService());
}
};
@@ -53,7 +52,8 @@ public class ExplicitJettyAsyncRouteTest extends BaseJettyTest {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
- // we have access to the HttpServletRequest here and we can grab it if we need it
+ // we have access to the HttpServletRequest here and we can grab it
+ // if we need it
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
assertNotNull(req);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
index 69db775..542b583 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
@@ -51,7 +51,8 @@ public class ExplicitJettyRouteTest extends BaseJettyTest {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
- // we have access to the HttpServletRequest here and we can grab it if we need it
+ // we have access to the HttpServletRequest here and we can grab it
+ // if we need it
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
assertNotNull(req);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAcceptHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAcceptHeaderTest.java
index f71b6b4..05545cf 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAcceptHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAcceptHeaderTest.java
@@ -29,13 +29,12 @@ public class HttpAcceptHeaderTest extends BaseJettyTest {
String out = template.requestBodyAndHeader("http://localhost:{{port}}/myaccept", null, "Accept", "application/myjson", String.class);
assertEquals("You called me as GET and accepted: application/myjson", out);
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myaccept")
- .transform().simple("You called me as ${header.CamelHttpMethod} and accepted: ${header.Accept}");
+ from("jetty:http://localhost:{{port}}/myaccept").transform().simple("You called me as ${header.CamelHttpMethod} and accepted: ${header.Accept}");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeAsyncRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeAsyncRouteTest.java
index fba02b0..921202e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeAsyncRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeAsyncRouteTest.java
@@ -40,10 +40,10 @@ public class HttpBridgeAsyncRouteTest extends HttpBridgeRouteTest {
};
from("jetty:http://localhost:" + port2 + "/test/hello?async=true&useContinuation=false")
.to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
-
+
from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true&async=true&useContinuation=false").process(serviceProc);
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeEncodedPathTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeEncodedPathTest.java
index e044239..cbe9b6d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeEncodedPathTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeEncodedPathTest.java
@@ -38,8 +38,8 @@ public class HttpBridgeEncodedPathTest extends BaseJettyTest {
@Test
public void testEncodedQuery() throws Exception {
- String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello?param1=%2B447777111222",
- new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "text/plain", String.class);
+ String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello?param1=%2B447777111222", new ByteArrayInputStream("This is a test".getBytes()),
+ "Content-Type", "text/plain", String.class);
assertEquals("Get a wrong response", "param1=+447777111222", response);
}
@@ -52,7 +52,8 @@ public class HttpBridgeEncodedPathTest extends BaseJettyTest {
mock.message(0).header(Exchange.HTTP_QUERY).isNull();
mock.message(0).header(Exchange.HTTP_RAW_QUERY).isNull();
- // cannot use template as it automatically decodes some chars in the path
+ // cannot use template as it automatically decodes some chars in the
+ // path
HttpClient httpClient = new HttpClient();
GetMethod httpGet = new GetMethod("http://localhost:" + port4 + "/test/" + path);
int status = httpClient.executeMethod(httpGet);
@@ -83,12 +84,10 @@ public class HttpBridgeEncodedPathTest extends BaseJettyTest {
exchange.getOut().setBody(exchange.getIn().getHeader(Exchange.HTTP_QUERY));
}
};
- from("jetty:http://localhost:" + port2 + "/test/hello")
- .to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
+ from("jetty:http://localhost:" + port2 + "/test/hello").to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
from("jetty:http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
- from("jetty:http://localhost:" + port4 + "/test?matchOnUriPrefix=true")
- .to("http://localhost:" + port3 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
+ from("jetty:http://localhost:" + port4 + "/test?matchOnUriPrefix=true").to("http://localhost:" + port3 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
from("jetty:http://localhost:" + port3 + "?matchOnUriPrefix=true").to("mock:encodedPath");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
index b9e0eb2..ac28666 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
@@ -91,8 +91,7 @@ public class HttpBridgeMultipartRouteTest extends BaseJettyTest {
HttpEndpoint epOut = getContext().getEndpoint("http://localhost:" + port1 + "?bridgeEndpoint=true&throwExceptionOnFailure=false", HttpEndpoint.class);
epOut.setHeaderFilterStrategy(new MultipartHeaderFilterStrategy());
- from("jetty:http://localhost:" + port2 + "/test/hello?enableMultipartFilter=false")
- .to(epOut);
+ from("jetty:http://localhost:" + port2 + "/test/hello?enableMultipartFilter=false").to(epOut);
from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java
index 0986f46..6de46cc 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java
@@ -31,13 +31,13 @@ public class HttpBridgeRouteTest extends BaseJettyTest {
@Test
public void testHttpClient() throws Exception {
- String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello",
- new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
+ String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello", new ByteArrayInputStream("This is a test".getBytes()), "Content-Type",
+ "application/xml", String.class);
assertEquals("Get a wrong response", "/", response);
-
+
response = template.requestBody("http://localhost:" + port1 + "/hello/world", "hello", String.class);
assertEquals("Get a wrong response", "/hello/world", response);
-
+
try {
template.requestBody("http://localhost:" + port2 + "/hello/world", "hello", String.class);
fail("Expect exception here!");
@@ -62,12 +62,11 @@ public class HttpBridgeRouteTest extends BaseJettyTest {
exchange.getOut().setBody(uri);
}
};
- from("jetty:http://localhost:" + port2 + "/test/hello")
- .to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
-
+ from("jetty:http://localhost:" + port2 + "/test/hello").to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
+
from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java
index c93d9fa..e4d80bc 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
public class HttpCharacterEncodingTest extends BaseJettyTest {
-
+
@Test
public void testSendToJetty() throws Exception {
Exchange exchange = template.send("http://localhost:{{port}}/myapp/myservice", new Processor() {
@@ -31,7 +31,7 @@ public class HttpCharacterEncodingTest extends BaseJettyTest {
exchange.getIn().setBody("Hello World Thai Elephant \u0E08");
exchange.getIn().setHeader("Content-Type", "text/html; charset=utf-8");
}
-
+
});
// convert the response to a String
String body = exchange.getOut().getBody(String.class);
@@ -52,10 +52,10 @@ public class HttpCharacterEncodingTest extends BaseJettyTest {
public void process(Exchange exchange) throws Exception {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
-
+
// for unit testing make sure we got right message
assertEquals("Hello World Thai Elephant \u0E08", body);
-
+
// send a html response
exchange.getOut().setHeader("Content-Type", "text/html; charset=utf-8");
exchange.getOut().setBody("Response message is Thai Elephant \u0E08");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java
index 42dc2a0..7c2846f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java
@@ -33,7 +33,7 @@ public class HttpClientRouteEnableChunkedTest extends BaseJettyTest {
public void testHttpRouteWithOption() throws Exception {
testHttpClient("direct:start2");
}
-
+
private void testHttpClient(String uri) throws Exception {
System.setProperty("HTTPClient.dontChunkRequests", "yes");
@@ -41,7 +41,7 @@ public class HttpClientRouteEnableChunkedTest extends BaseJettyTest {
mockEndpoint.expectedBodiesReceived("<b>Hello World</b>");
template.requestBodyAndHeader(uri, new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml");
-
+
mockEndpoint.assertIsSatisfied();
List<Exchange> list = mockEndpoint.getReceivedExchanges();
Exchange exchange = list.get(0);
@@ -51,11 +51,11 @@ public class HttpClientRouteEnableChunkedTest extends BaseJettyTest {
assertNotNull("in", in);
Map<String, Object> headers = in.getHeaders();
-
+
log.info("Headers: " + headers);
-
+
assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
-
+
// should get the Content-Length
assertEquals("Should get the transfer-encoding as chunked", "chunked", headers.get("Transfer-Encoding"));
// remove the system property
@@ -67,19 +67,19 @@ public class HttpClientRouteEnableChunkedTest extends BaseJettyTest {
return new RouteBuilder() {
public void configure() {
errorHandler(noErrorHandler());
-
+
from("direct:start2").to("http://localhost:{{port}}/hello").to("mock:a");
-
+
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
- ByteArrayInputStream bis = new ByteArrayInputStream("<b>Hello World</b>".getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream("<b>Hello World</b>".getBytes());
exchange.getOut().setBody(bis);
}
};
-
+
from("jetty:http://localhost:{{port}}/hello").process(proc);
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
index b9c1886..4bbe991 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
@@ -37,12 +37,12 @@ public class HttpClientRouteTest extends BaseJettyTest {
public void testHttpRouteWithMessageHeader() throws Exception {
testHttpClient("direct:start");
}
-
+
@Test
public void testHttpRouteWithOption() throws Exception {
testHttpClient("direct:start2");
}
-
+
private void testHttpClient(String uri) throws Exception {
System.setProperty("HTTPClient.dontChunkRequests", "yes");
@@ -50,7 +50,7 @@ public class HttpClientRouteTest extends BaseJettyTest {
mockEndpoint.expectedBodiesReceived("<b>Hello World</b>");
template.requestBodyAndHeader(uri, new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml");
-
+
mockEndpoint.assertIsSatisfied();
List<Exchange> list = mockEndpoint.getReceivedExchanges();
Exchange exchange = list.get(0);
@@ -60,30 +60,30 @@ public class HttpClientRouteTest extends BaseJettyTest {
assertNotNull("in", in);
Map<String, Object> headers = in.getHeaders();
-
+
log.info("Headers: " + headers);
-
+
assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
}
-
+
@Test
public void testHttpRouteWithQuery() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
mockEndpoint.expectedBodiesReceived("@ query");
-
+
template.sendBody("direct:start3", null);
- mockEndpoint.assertIsSatisfied();
+ mockEndpoint.assertIsSatisfied();
}
-
+
@Test
public void testHttpRouteWithQueryByHeader() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
- mockEndpoint.expectedBodiesReceived("test");
-
+ mockEndpoint.expectedBodiesReceived("test");
+
template.sendBody("direct:start4", "test");
- mockEndpoint.assertIsSatisfied();
+ mockEndpoint.assertIsSatisfied();
}
-
+
@Test
public void testHttpRouteWithHttpURI() throws Exception {
Exchange exchange = template.send("http://localhost:" + port2 + "/querystring", new Processor() {
@@ -110,28 +110,28 @@ public class HttpClientRouteTest extends BaseJettyTest {
assertIsInstanceOf(InputStream.class, exchange.getIn().getBody());
}
};
-
+
from("direct:start").to("http://localhost:" + port1 + "/hello").process(clientProc).convertBodyTo(String.class).to("mock:a");
from("direct:start2").to("http://localhost:" + port2 + "/hello").to("mock:a");
from("direct:start3").to("http://localhost:" + port2 + "/Query%20/test?myQuery=%40%20query").to("mock:a");
from("direct:start4").setHeader(Exchange.HTTP_QUERY, simple("id=${body}")).to("http://localhost:" + port2 + "/querystring").to("mock:a");
-
+
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
- ByteArrayInputStream bis = new ByteArrayInputStream("<b>Hello World</b>".getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream("<b>Hello World</b>".getBytes());
exchange.getOut().setBody(bis);
}
};
from("jetty:http://localhost:" + port1 + "/hello").process(proc).setHeader(Exchange.HTTP_CHUNKED).constant(false);
-
+
from("jetty:http://localhost:" + port2 + "/hello?chunked=false").process(proc);
-
+
from("jetty:http://localhost:" + port2 + "/Query%20/test").process(new Processor() {
public void process(Exchange exchange) throws Exception {
- exchange.getOut().setBody(exchange.getIn().getHeader("myQuery", String.class));
+ exchange.getOut().setBody(exchange.getIn().getHeader("myQuery", String.class));
}
});
-
+
from("jetty:http://localhost:" + port2 + "/querystring").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String result = exchange.getIn().getHeader("id", String.class);
@@ -143,6 +143,6 @@ public class HttpClientRouteTest extends BaseJettyTest {
});
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java
index ef80e34..1b8fde6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java
@@ -35,25 +35,25 @@ public class HttpConverterTest extends BaseJettyTest {
public boolean isUseRouteBuilder() {
return false;
}
-
+
@Test
public void testToServletRequestAndResponse() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jetty://http://localhost:{{port}}/test")
- // add this node to make sure the convert can work within DefaultMessageImpl
- .convertBodyTo(String.class)
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- HttpServletRequest request = exchange.getIn(HttpServletRequest.class);
- assertNotNull("We should get request object here", request);
- HttpServletResponse response = exchange.getIn(HttpServletResponse.class);
- assertNotNull("We should get response object here", response);
- String s = exchange.getIn().getBody(String.class);
- assertEquals("Hello World", s);
- }
- }).transform(constant("Bye World"));
+ // add this node to make sure the convert can work within
+ // DefaultMessageImpl
+ .convertBodyTo(String.class).process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ HttpServletRequest request = exchange.getIn(HttpServletRequest.class);
+ assertNotNull("We should get request object here", request);
+ HttpServletResponse response = exchange.getIn(HttpServletResponse.class);
+ assertNotNull("We should get response object here", response);
+ String s = exchange.getIn().getBody(String.class);
+ assertEquals("Hello World", s);
+ }
+ }).transform(constant("Bye World"));
}
});
context.start();
@@ -67,20 +67,20 @@ public class HttpConverterTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test").
- process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- HttpMessage msg = exchange.getIn(HttpMessage.class);
-
- ServletInputStream sis = HttpConverter.toServletInputStream(msg);
- assertNotNull(sis);
- // The ServletInputStream should be cached and you can't read message here
- assertTrue(sis.available() == 0);
- String s = msg.getBody(String.class);
-
- assertEquals("Hello World", s);
- }
- }).transform(constant("Bye World"));
+ from("jetty://http://localhost:{{port}}/test").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ HttpMessage msg = exchange.getIn(HttpMessage.class);
+
+ ServletInputStream sis = HttpConverter.toServletInputStream(msg);
+ assertNotNull(sis);
+ // The ServletInputStream should be cached and you can't
+ // read message here
+ assertTrue(sis.available() == 0);
+ String s = msg.getBody(String.class);
+
+ assertEquals("Hello World", s);
+ }
+ }).transform(constant("Bye World"));
}
});
context.start();
@@ -94,18 +94,17 @@ public class HttpConverterTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test").
- process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- HttpMessage msg = exchange.getIn(HttpMessage.class);
-
- InputStream sis = msg.getBody(InputStream.class);
- assertNotNull(sis);
- String s = exchange.getContext().getTypeConverter().convertTo(String.class, sis);
-
- assertEquals("Hello World", s);
- }
- }).transform(constant("Bye World"));
+ from("jetty://http://localhost:{{port}}/test").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ HttpMessage msg = exchange.getIn(HttpMessage.class);
+
+ InputStream sis = msg.getBody(InputStream.class);
+ assertNotNull(sis);
+ String s = exchange.getContext().getTypeConverter().convertTo(String.class, sis);
+
+ assertEquals("Hello World", s);
+ }
+ }).transform(constant("Bye World"));
}
});
context.start();
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpDeleteWithBodyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpDeleteWithBodyTest.java
index 7b94948..cecd70b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpDeleteWithBodyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpDeleteWithBodyTest.java
@@ -42,15 +42,13 @@ public class HttpDeleteWithBodyTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test")
- .process(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- String method = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
- assertEquals("DELETE", method);
- }
- })
- .transform(simple("Bye ${body}"));
+ from("jetty://http://localhost:{{port}}/test").process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ String method = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
+ assertEquals("DELETE", method);
+ }
+ }).transform(simple("Bye ${body}"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEmptyQueryParameterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEmptyQueryParameterTest.java
index 2840566..5e813d4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEmptyQueryParameterTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEmptyQueryParameterTest.java
@@ -41,9 +41,7 @@ public class HttpEmptyQueryParameterTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://0.0.0.0:{{port}}/foo")
- .to("mock:input")
- .transform().simple("Header: ${header.id}");
+ from("jetty:http://0.0.0.0:{{port}}/foo").to("mock:input").transform().simple("Header: ${header.id}");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEndpointURLTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEndpointURLTest.java
index 337ed12..d933489 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEndpointURLTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpEndpointURLTest.java
@@ -20,7 +20,7 @@ import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class HttpEndpointURLTest extends CamelTestSupport {
-
+
@Test
public void testHttpEndpointURLWithIPv6() {
JettyHttpEndpoint endpoint = (JettyHttpEndpoint)context.getEndpoint("jetty://http://[2a00:8a00:6000:40::1413]:30300/test?test=true");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterNoCamelHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterNoCamelHeadersTest.java
index 7d1f9fb..5375f7f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterNoCamelHeadersTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterNoCamelHeadersTest.java
@@ -56,15 +56,9 @@ public class HttpFilterNoCamelHeadersTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:start")
- .setHeader(Exchange.FILE_NAME, constant("test.txt"))
- .to("http://localhost:{{port}}/test/filter")
- .to("mock:result");
+ from("direct:start").setHeader(Exchange.FILE_NAME, constant("test.txt")).to("http://localhost:{{port}}/test/filter").to("mock:result");
- from("jetty:http://localhost:{{port}}/test/filter")
- .to("mock:input")
- .setHeader("CamelDummy", constant("dummy"))
- .transform(simple("Bye ${body}"));
+ from("jetty:http://localhost:{{port}}/test/filter").to("mock:input").setHeader("CamelDummy", constant("dummy")).transform(simple("Bye ${body}"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
index 4e1cfc2..60c5758 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
@@ -33,7 +33,7 @@ public class HttpHeaderTest extends BaseJettyTest {
String result = template.requestBody("direct:start", "hello", String.class);
assertEquals("Should send a right http header to the server.", "Find the key!", result);
}
-
+
@Test
public void testServerHeader() throws Exception {
Exchange ex = template.request("http://localhost:{{port}}/server/mytest", new Processor() {
@@ -42,30 +42,27 @@ public class HttpHeaderTest extends BaseJettyTest {
// Do nothing here
}
});
-
+
assertNotNull(ex.getOut().getHeader("Server"));
assertNull(ex.getOut().getHeader("Date"));
-
+
ex = template.request("http://localhost:{{port2}}/server/mytest", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// Do nothing here
}
});
-
+
assertNull(ex.getOut().getHeader("Server"));
assertNotNull(ex.getOut().getHeader("Date"));
}
-
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("direct:start").setHeader("SOAPAction", constant("http://xxx.com/interfaces/ticket"))
- .setHeader("Content-Type", constant("text/xml; charset=utf-8"))
- .setHeader(Exchange.HTTP_PROTOCOL_VERSION, constant("HTTP/1.0"))
- .to("http://localhost:{{port}}/myapp/mytest");
+ from("direct:start").setHeader("SOAPAction", constant("http://xxx.com/interfaces/ticket")).setHeader("Content-Type", constant("text/xml; charset=utf-8"))
+ .setHeader(Exchange.HTTP_PROTOCOL_VERSION, constant("HTTP/1.0")).to("http://localhost:{{port}}/myapp/mytest");
from("jetty:http://localhost:{{port}}/myapp/mytest").process(new Processor() {
public void process(Exchange exchange) throws Exception {
@@ -82,13 +79,12 @@ public class HttpHeaderTest extends BaseJettyTest {
exchange.getOut().setBody("Cannot find the key!");
}
});
-
+
from("jetty:http://localhost:{{port}}/server/mytest").transform(constant("Response!"));
-
- //The setting only effect on a new server endpoint
+
+ // The setting only effect on a new server endpoint
from("jetty:http://localhost:{{port2}}/server/mytest?sendServerVersion=false&sendDateHeader=true").transform(constant("Response!"));
-
-
+
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpMethodRestrictTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpMethodRestrictTest.java
index 8a90e93..e12cf01 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpMethodRestrictTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpMethodRestrictTest.java
@@ -31,7 +31,7 @@ public class HttpMethodRestrictTest extends BaseJettyTest {
private String getUrl() {
return "http://localhost:" + getPort() + "/methodRestrict";
}
-
+
@Test
public void testProperHttpMethod() throws Exception {
HttpClient httpClient = new HttpClient();
@@ -56,12 +56,12 @@ public class HttpMethodRestrictTest extends BaseJettyTest {
assertEquals("Get a wrong response status", 405, status);
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
-
+
from("jetty://http://localhost:{{port}}/methodRestrict?httpMethodRestrict=POST").process(new Processor() {
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java
index 7fef126..76292db 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java
@@ -42,12 +42,11 @@ public class HttpOperationsFailedExceptionUriTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/foo")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
- }
- });
+ from("jetty://http://localhost:{{port}}/foo").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
index 087cbca..b67ebae 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
@@ -51,8 +51,7 @@ public class HttpPollingConsumerTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test")
- .delay(2000).transform(constant("Bye World"));
+ from("jetty://http://localhost:{{port}}/test").delay(2000).transform(constant("Bye World"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
index 5ed9eaf..63a8fb6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
@@ -76,14 +76,12 @@ public class HttpProducerConcurrentTest extends BaseJettyTest {
executor.shutdownNow();
}
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
// expose a echo service
- from("jetty:http://localhost:{{port}}/echo")
- .transform(body().append(body())).to("mock:result");
+ from("jetty:http://localhost:{{port}}/echo").transform(body().append(body())).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConnectionCloseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConnectionCloseTest.java
index 299c660..5cd5a40 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConnectionCloseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConnectionCloseTest.java
@@ -55,4 +55,4 @@ public class HttpProducerConnectionCloseTest extends BaseJettyTest {
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
index 8fc4067..4375c6c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.apache.camel.component.jetty;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerOkStatusCodeRangeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerOkStatusCodeRangeTest.java
index 35d8ea0..ed955fd 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerOkStatusCodeRangeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerOkStatusCodeRangeTest.java
@@ -49,9 +49,7 @@ public class HttpProducerOkStatusCodeRangeTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test")
- .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(209))
- .transform(constant("Not allowed"));
+ from("jetty://http://localhost:{{port}}/test").setHeader(Exchange.HTTP_RESPONSE_CODE, constant(209)).transform(constant("Not allowed"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
index f1f828d..4525e8c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
@@ -72,4 +72,4 @@ public class HttpProducerQueryParamTest extends BaseJettyTest {
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
index 0422280..5efb645 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
@@ -38,7 +38,7 @@ public class HttpProducerSOTimeoutTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testSendWithSOTimeoutTimeout() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -62,8 +62,7 @@ public class HttpProducerSOTimeoutTest extends BaseJettyTest {
public void configure() throws Exception {
from("jetty://http://localhost:{{port}}/myservice")
// but we wait for 2 sec before reply is sent back
- .delay(2000)
- .transform().constant("Bye World").to("mock:result");
+ .delay(2000).transform().constant("Bye World").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSendEmptyHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSendEmptyHeaderTest.java
index 07abdd7..31b8cb6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSendEmptyHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSendEmptyHeaderTest.java
@@ -31,9 +31,9 @@ public class HttpProducerSendEmptyHeaderTest extends BaseJettyTest {
public void testHttpProducerSendEmptyHeader() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
-
+
// Jetty 8 treats an empty header as "" while Jetty 9 treats it as null
- String expectedValue = isJetty8() ? "" : null;
+ String expectedValue = isJetty8() ? "" : null;
mock.expectedHeaderReceived("foo", expectedValue);
template.sendBodyAndHeader("http://localhost:{{port}}/myapp/mytest", "Hello World", "foo", "");
@@ -47,9 +47,7 @@ public class HttpProducerSendEmptyHeaderTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/mytest")
- .convertBodyTo(String.class)
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myapp/mytest").convertBodyTo(String.class).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerUnsafeCharsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerUnsafeCharsTest.java
index dedddd8..cf30c81 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerUnsafeCharsTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerUnsafeCharsTest.java
@@ -28,8 +28,7 @@ public class HttpProducerUnsafeCharsTest extends BaseJettyTest {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
- template.sendBodyAndHeader("http://localhost:{{port}}/test?bridgeEndpoint=true", "Hello World",
- Exchange.HTTP_URI, "/<>{}");
+ template.sendBodyAndHeader("http://localhost:{{port}}/test?bridgeEndpoint=true", "Hello World", Exchange.HTTP_URI, "/<>{}");
assertMockEndpointsSatisfied();
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteContentTypeTest.java
index 42350a9..699e6c3 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteContentTypeTest.java
@@ -27,7 +27,7 @@ public class HttpProxyRouteContentTypeTest extends BaseJettyTest {
@Test
public void testHttpProxyWithContentType() throws Exception {
- String out = template.requestBodyAndHeader("http://localhost:{{port}}/hello", "test", "Content-Type", "application/xml", String.class);
+ String out = template.requestBodyAndHeader("http://localhost:{{port}}/hello", "test", "Content-Type", "application/xml", String.class);
assertEquals("Get a wrong response ", "application/xml", out);
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
index 7fe0174..c7d0a21 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
@@ -40,25 +40,26 @@ public class HttpProxyRouteTest extends BaseJettyTest {
log.info("Time taken: " + TimeUtils.printDuration(watch.taken()));
}
-
+
@Test
public void testHttpProxyWithDifferentPath() throws Exception {
String out = template.requestBody("http://localhost:{{port}}/proxy", null, String.class);
assertEquals("/otherEndpoint", out);
-
+
out = template.requestBody("http://localhost:{{port}}/proxy/path", null, String.class);
assertEquals("/otherEndpoint/path", out);
}
-
+
@Test
public void testHttpProxyHostHeader() throws Exception {
String out = template.requestBody("http://localhost:{{port}}/proxyServer", null, String.class);
assertEquals("Get a wrong host header", "localhost:" + getPort2(), out);
}
-
+
@Test
public void testHttpProxyFormHeader() throws Exception {
- String out = template.requestBodyAndHeader("http://localhost:{{port}}/form", "username=abc&pass=password", Exchange.CONTENT_TYPE, "application/x-www-form-urlencoded", String.class);
+ String out = template.requestBodyAndHeader("http://localhost:{{port}}/form", "username=abc&pass=password", Exchange.CONTENT_TYPE, "application/x-www-form-urlencoded",
+ String.class);
assertEquals("Get a wrong response message", "username=abc&pass=password", out);
}
@@ -66,35 +67,32 @@ public class HttpProxyRouteTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
- from("jetty://http://localhost:{{port}}")
- .to("http://localhost:{{port}}/bye?throwExceptionOnFailure=false&bridgeEndpoint=true");
-
+ from("jetty://http://localhost:{{port}}").to("http://localhost:{{port}}/bye?throwExceptionOnFailure=false&bridgeEndpoint=true");
+
from("jetty://http://localhost:{{port}}/proxy?matchOnUriPrefix=true")
.to("http://localhost:{{port}}/otherEndpoint?throwExceptionOnFailure=false&bridgeEndpoint=true");
from("jetty://http://localhost:{{port}}/bye").transform(header("foo").prepend("Bye "));
-
+
from("jetty://http://localhost:{{port}}/otherEndpoint?matchOnUriPrefix=true").transform(header(Exchange.HTTP_URI));
-
- from("jetty://http://localhost:{{port}}/proxyServer")
- .to("http://localhost:{{port2}}/host?bridgeEndpoint=true");
-
+
+ from("jetty://http://localhost:{{port}}/proxyServer").to("http://localhost:{{port2}}/host?bridgeEndpoint=true");
+
from("jetty://http://localhost:{{port2}}/host").transform(header("host"));
-
+
// check the from request
- from("jetty://http://localhost:{{port}}/form?bridgeEndpoint=true")
- .process(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- // just take out the message body and send it back
- Message in = exchange.getIn();
- String request = in.getBody(String.class);
- exchange.getOut().setBody(request);
- }
-
- });
+ from("jetty://http://localhost:{{port}}/form?bridgeEndpoint=true").process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ // just take out the message body and send it back
+ Message in = exchange.getIn();
+ String request = in.getBody(String.class);
+ exchange.getOut().setBody(request);
+ }
+
+ });
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java
index 1dc33c4..b16b948 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java
@@ -44,13 +44,12 @@ public class HttpRedirectNoLocationTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302);
- }
- });
+ from("jetty://http://localhost:{{port}}/test").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302);
+ }
+ });
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java
index 16aa96a..92b7b15 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java
@@ -32,8 +32,7 @@ public class HttpRedirectTest extends BaseJettyTest {
template.requestBody("http://localhost:{{port}}/test", "Hello World", String.class);
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
- HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class,
- e.getCause());
+ HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(301, cause.getStatusCode());
assertEquals(true, cause.isRedirectError());
assertEquals(true, cause.hasRedirectLocation());
@@ -52,8 +51,7 @@ public class HttpRedirectTest extends BaseJettyTest {
template.requestBody("direct:start", "Hello World", String.class);
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
- HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class,
- e.getCause());
+ HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(302, cause.getStatusCode());
}
errorEndpoint.assertIsSatisfied();
@@ -76,9 +74,9 @@ public class HttpRedirectTest extends BaseJettyTest {
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302);
}
});
-
- from("direct:start").onException(HttpOperationFailedException.class).to("mock:error").end()
- .to("http://localhost:{{port}}/remove?throwExceptionOnFailure=true").to("mock:result");
+
+ from("direct:start").onException(HttpOperationFailedException.class).to("mock:error").end().to("http://localhost:{{port}}/remove?throwExceptionOnFailure=true")
+ .to("mock:result");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java
index 1bfa452..08af179 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java
@@ -55,16 +55,18 @@ public class HttpRequestResponseTest extends BaseJettyTest {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
- // we have access to the HttpServletRequest here and we can grab it if we need it
+ // we have access to the HttpServletRequest here and we can grab it
+ // if we need it
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
assertNotNull(req);
- // we have access to the HttpServletResponse here and we can grab it if we need it
+ // we have access to the HttpServletResponse here and we can grab it
+ // if we need it
HttpServletResponse res = exchange.getIn().getBody(HttpServletResponse.class);
assertNotNull(res);
// and they should also be on HttpMessage
- HttpMessage msg = (HttpMessage) exchange.getIn();
+ HttpMessage msg = (HttpMessage)exchange.getIn();
assertNotNull(msg.getRequest());
assertNotNull(msg.getResponse());
@@ -79,4 +81,4 @@ public class HttpRequestResponseTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java
index 186ab9e..cc51ff6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java
@@ -34,12 +34,11 @@ public class HttpReturnDataNotInputStreamConvertableTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/test")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setBody(new MyResponseBean());
- }
- });
+ from("jetty://http://localhost:{{port}}/test").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getOut().setBody(new MyResponseBean());
+ }
+ });
}
};
}
@@ -50,4 +49,4 @@ public class HttpReturnDataNotInputStreamConvertableTest extends BaseJettyTest {
return "This is the response";
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
index 27bed93..63b190c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
@@ -42,8 +42,7 @@ import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.junit.Test;
public class HttpRouteTest extends BaseJettyTest {
- protected static final String POST_MESSAGE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
- + "<test>Hello World</test>";
+ protected static final String POST_MESSAGE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + "<test>Hello World</test>";
protected String expectedBody = "<hello>world!</hello>";
private int port1;
@@ -91,7 +90,7 @@ public class HttpRouteTest extends BaseJettyTest {
String out = template.requestBody("http://localhost:" + port1 + "/echo", "HelloWorld", String.class);
assertEquals("Get a wrong output ", "HelloWorld", out);
}
-
+
@Test
public void testEchoEndpointWithIgnoreResponseBody() throws Exception {
String out = template.requestBody("http://localhost:" + port1 + "/echo?ignoreResponseBody=true", "HelloWorld", String.class);
@@ -100,8 +99,7 @@ public class HttpRouteTest extends BaseJettyTest {
@Test
public void testPostParameter() throws Exception {
- NameValuePair[] data = {new NameValuePair("request", "PostParameter"),
- new NameValuePair("others", "bloggs")};
+ NameValuePair[] data = {new NameValuePair("request", "PostParameter"), new NameValuePair("others", "bloggs")};
HttpClient client = new HttpClient();
PostMethod post = new PostMethod("http://localhost:" + port1 + "/parameter");
post.setRequestBody(data);
@@ -146,26 +144,23 @@ public class HttpRouteTest extends BaseJettyTest {
String out = context.getTypeConverter().convertTo(String.class, response);
assertEquals("Get a wrong output ", "PutParameter", out);
}
-
+
@Test
public void testDisableStreamCache() throws Exception {
- String response =
- template.requestBodyAndHeader("http://localhost:" + port3 + "/noStreamCache",
- new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
-
+ String response = template.requestBodyAndHeader("http://localhost:" + port3 + "/noStreamCache", new ByteArrayInputStream("This is a test".getBytes()), "Content-Type",
+ "application/xml", String.class);
+
assertEquals("Get a wrong output ", "OK", response);
}
-
+
@Test
public void testRequestBufferSize() throws Exception {
InputStream in = this.getClass().getResourceAsStream("/META-INF/LICENSE.txt");
int fileSize = in.available();
- String response =
- template.requestBodyAndHeader("http://localhost:" + port4 + "/requestBufferSize",
- in, Exchange.CONTENT_TYPE, "application/txt", String.class);
- assertEquals("Got a wrong response.", fileSize, response.length());
+ String response = template.requestBodyAndHeader("http://localhost:" + port4 + "/requestBufferSize", in, Exchange.CONTENT_TYPE, "application/txt", String.class);
+ assertEquals("Got a wrong response.", fileSize, response.length());
}
-
+
@Test
public void testResponseCode() throws Exception {
HttpClient client = new HttpClient();
@@ -175,7 +170,6 @@ public class HttpRouteTest extends BaseJettyTest {
assertEquals("Get a wrong status code.", 400, get.getStatusCode());
}
-
protected void invokeHttpEndpoint() throws IOException {
template.requestBodyAndHeader("http://localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
}
@@ -189,7 +183,6 @@ public class HttpRouteTest extends BaseJettyTest {
port3 = getNextPort();
port4 = getNextPort();
-
// enable stream cache
context.setStreamCaching(true);
@@ -207,7 +200,7 @@ public class HttpRouteTest extends BaseJettyTest {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
-
+
from("jetty:http://localhost:" + port1 + "/responseCode").setHeader(Exchange.HTTP_RESPONSE_CODE, simple("400"));
Processor printProcessor = new Processor() {
@@ -226,8 +219,10 @@ public class HttpRouteTest extends BaseJettyTest {
Processor procParameters = new Processor() {
public void process(Exchange exchange) throws Exception {
- // As the request input stream is cached by DefaultHttpBinding,
- // HttpServletRequest can't get the parameters of post message
+ // As the request input stream is cached by
+ // DefaultHttpBinding,
+ // HttpServletRequest can't get the parameters of post
+ // message
String value = exchange.getIn().getHeader("request", String.class);
if (value != null) {
assertNotNull("The value of the parameter should not be null", value);
@@ -247,17 +242,17 @@ public class HttpRouteTest extends BaseJettyTest {
exchange.getOut().setBody("OK");
}
});
-
+
from("jetty:http://localhost:" + port3 + "/noStreamCache?disableStreamCache=true").noStreamCaching().process(new Processor() {
public void process(Exchange exchange) throws Exception {
- InputStream is = (InputStream)exchange.getIn().getBody();
+ InputStream is = (InputStream)exchange.getIn().getBody();
assertTrue("It should be a raw inputstream", is instanceof org.eclipse.jetty.server.HttpInput);
String request = exchange.getIn().getBody(String.class);
assertEquals("Got a wrong request", "This is a test", request);
exchange.getOut().setBody("OK");
}
});
-
+
from("jetty:http://localhost:" + port4 + "/requestBufferSize").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String string = exchange.getIn().getBody(String.class);
@@ -268,5 +263,3 @@ public class HttpRouteTest extends BaseJettyTest {
};
}
}
-
-
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
index 855e383..d280a16 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
@@ -51,15 +51,12 @@ public class HttpSendFileTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .to("mock:result")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- assertNotNull("Body should not be null", body);
- }
- })
- .transform(constant("OK")).setHeader("Content-Type", constant("text/plain"));
+ from("jetty:http://localhost:{{port}}/myapp/myservice").to("mock:result").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ assertNotNull("Body should not be null", body);
+ }
+ }).transform(constant("OK")).setHeader("Content-Type", constant("text/plain"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
index 9d6f019..48f502f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
@@ -56,29 +56,27 @@ public class HttpStreamCacheFileIssueTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- // enable stream caching and use a low threshold so its forced to write to file
+ // enable stream caching and use a low threshold so its forced
+ // to write to file
context.getStreamCachingStrategy().setSpoolThreshold(16);
context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir");
context.setStreamCaching(true);
// use a route so we got an unit of work
- from("direct:start")
- .to("http://localhost:{{port}}/myserver")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- // there should be a temp cache file
- File file = new File("target/cachedir");
- String[] files = file.list();
- assertTrue("There should be a temp cache file", files.length > 0);
- }
- })
- // TODO: CAMEL-3839: need to convert the body to a String as the tmp file will be deleted
+ from("direct:start").to("http://localhost:{{port}}/myserver").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // there should be a temp cache file
+ File file = new File("target/cachedir");
+ String[] files = file.list();
+ assertTrue("There should be a temp cache file", files.length > 0);
+ }
+ })
+ // TODO: CAMEL-3839: need to convert the body to a String as
+ // the tmp file will be deleted
// before the producer template can convert the result back
- .convertBodyTo(String.class)
- .to("mock:result");
+ .convertBodyTo(String.class).to("mock:result");
- from("jetty://http://localhost:{{port}}/myserver")
- .transform().constant(body);
+ from("jetty://http://localhost:{{port}}/myserver").transform().constant(body);
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileResponseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileResponseTest.java
index 96b30cb..7afafbb 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileResponseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileResponseTest.java
@@ -55,15 +55,16 @@ public class HttpStreamCacheFileResponseTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- // enable stream caching and use a low threshold so its forced to write to file
+ // enable stream caching and use a low threshold so its forced
+ // to write to file
context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir");
context.getStreamCachingStrategy().setSpoolThreshold(16);
context.setStreamCaching(true);
from("jetty://http://localhost:{{port}}/myserver")
- // wrap the response in 2 input streams so it will force caching to disk
- .transform().constant(new BufferedInputStream(new ByteArrayInputStream(body2.getBytes())))
- .to("log:reply");
+ // wrap the response in 2 input streams so it will force
+ // caching to disk
+ .transform().constant(new BufferedInputStream(new ByteArrayInputStream(body2.getBytes()))).to("log:reply");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileStopIssueTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileStopIssueTest.java
index 95e24fc..8614d73 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileStopIssueTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileStopIssueTest.java
@@ -56,31 +56,29 @@ public class HttpStreamCacheFileStopIssueTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- // enable stream caching and use a low threshold so its forced to write to file
+ // enable stream caching and use a low threshold so its forced
+ // to write to file
context.getStreamCachingStrategy().setSpoolThreshold(16);
context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir");
context.setStreamCaching(true);
// use a route so we got an unit of work
- from("direct:start")
- .to("http://localhost:{{port}}/myserver")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- // there should be a temp cache file
- File file = new File("target/cachedir");
- String[] files = file.list();
- assertTrue("There should be a temp cache file", files.length > 0);
- }
- })
- // TODO: CAMEL-3839: need to convert the body to a String as the tmp file will be deleted
+ from("direct:start").to("http://localhost:{{port}}/myserver").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // there should be a temp cache file
+ File file = new File("target/cachedir");
+ String[] files = file.list();
+ assertTrue("There should be a temp cache file", files.length > 0);
+ }
+ })
+ // TODO: CAMEL-3839: need to convert the body to a String as
+ // the tmp file will be deleted
// before the producer template can convert the result back
.convertBodyTo(String.class)
// mark the exchange to stop continue routing
- .stop()
- .to("mock:result");
+ .stop().to("mock:result");
- from("jetty://http://localhost:{{port}}/myserver")
- .transform().constant(body);
+ from("jetty://http://localhost:{{port}}/myserver").transform().constant(body);
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java
index 025684d..a7b83cf 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java
@@ -73,7 +73,8 @@ public class HttpStreamCacheFileTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- // enable stream caching and use a low threshold so its forced to write to file
+ // enable stream caching and use a low threshold so its forced
+ // to write to file
context.getStreamCachingStrategy().setSpoolThreshold(16);
context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir");
context.setStreamCaching(true);
@@ -81,18 +82,17 @@ public class HttpStreamCacheFileTest extends BaseJettyTest {
// use a route so we got an unit of work
from("direct:start").to("http://localhost:{{port}}/myserver");
- from("jetty://http://localhost:{{port}}/myserver")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- if (ObjectHelper.isEmpty(body)) {
- exchange.getOut().setBody(responseBody);
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
- } else {
- exchange.getOut().setBody("Bye World");
- }
- }
- });
+ from("jetty://http://localhost:{{port}}/myserver").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if (ObjectHelper.isEmpty(body)) {
+ exchange.getOut().setBody(responseBody);
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
+ } else {
+ exchange.getOut().setBody("Bye World");
+ }
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java
index 88293a3..a0d7ff4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java
@@ -26,7 +26,8 @@ import org.junit.Before;
import org.junit.Test;
/**
- * Unit testing demonstrating how to store incoming requests as files and serving a response back.
+ * Unit testing demonstrating how to store incoming requests as files and
+ * serving a response back.
*/
public class HttpToFileTest extends BaseJettyTest {
@@ -63,18 +64,12 @@ public class HttpToFileTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- // put the incoming data on the seda queue and return a fixed response that we got the file
- from("jetty:http://localhost:{{port}}/myworld")
- .convertBodyTo(String.class)
- .to("seda:in")
- .setBody(constant("We got the file"));
+ // put the incoming data on the seda queue and return a fixed
+ // response that we got the file
+ from("jetty:http://localhost:{{port}}/myworld").convertBodyTo(String.class).to("seda:in").setBody(constant("We got the file"));
// store the content from the queue as a file
- from("seda:in")
- .setHeader(Exchange.FILE_NAME, constant("hello.txt"))
- .convertBodyTo(String.class)
- .to("file://target/myworld/")
- .to("mock:result");
+ from("seda:in").setHeader(Exchange.FILE_NAME, constant("hello.txt")).convertBodyTo(String.class).to("file://target/myworld/").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
index d9c10e5..7ab9873 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
@@ -69,4 +69,4 @@ public class HttpTwoServerPortsTest extends BaseJettyTest {
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsAsyncRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsAsyncRouteTest.java
index 8ae7673..895c866 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsAsyncRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsAsyncRouteTest.java
@@ -37,7 +37,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
public class HttpsAsyncRouteTest extends HttpsRouteTest {
@Override
@@ -45,9 +44,10 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
public void setUp() throws Exception {
port1 = getNextPort();
port2 = getNextPort();
-
+
super.setUp();
- // ensure jsse clients can validate the self signed dummy localhost cert,
+ // ensure jsse clients can validate the self signed dummy localhost
+ // cert,
// use the server keystore as the trust store for these tests
URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.p12");
setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.toURI().getPath());
@@ -73,7 +73,7 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
for (Object key : originalValues.keySet()) {
Object value = originalValues.get(key);
if (NULL_VALUE_MARKER.equals(value)) {
- System.clearProperty((String) key);
+ System.clearProperty((String)key);
} else {
System.setProperty((String)key, (String)value);
}
@@ -110,7 +110,7 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
}
-
+
@Override
@Test
public void testEndpointWithoutHttps() throws Exception {
@@ -138,7 +138,7 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
ByteArrayOutputStream os = new ByteArrayOutputStream();
URL url = new URL("https://localhost:" + port1 + "/hello");
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+ HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
SSLContext ssl = SSLContext.getInstance("TLSv1.2");
ssl.init(null, null, null);
connection.setSSLSocketFactory(ssl.getSocketFactory());
@@ -151,7 +151,7 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
String data = new String(os.toByteArray());
assertEquals("<b>Hello World</b>", data);
}
-
+
@Override
@Test
public void testHelloEndpointWithoutHttps() throws Exception {
@@ -166,7 +166,7 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
} catch (SocketException expected) {
}
}
-
+
@Override
protected void invokeHttpEndpoint() throws IOException {
template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
@@ -177,12 +177,12 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
- JettyHttpComponent componentJetty = (JettyHttpComponent) context.getComponent("jetty");
+ JettyHttpComponent componentJetty = (JettyHttpComponent)context.getComponent("jetty");
componentJetty.setSslPassword(pwd);
componentJetty.setSslKeyPassword(pwd);
URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.p12");
componentJetty.setKeystore(keyStoreUrl.toURI().getPath());
-
+
from("jetty:https://localhost:" + port1 + "/test?async=true&useContinuation=false").to("mock:a");
Processor proc = new Processor() {
@@ -191,10 +191,9 @@ public class HttpsAsyncRouteTest extends HttpsRouteTest {
}
};
from("jetty:https://localhost:" + port1 + "/hello?async=true&useContinuation=false").process(proc);
-
+
from("jetty:https://localhost:" + port2 + "/test?async=true&useContinuation=false").to("mock:b");
}
};
}
}
-
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAliasTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAliasTest.java
index 4107064..23c19d6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAliasTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAliasTest.java
@@ -26,29 +26,29 @@ import org.apache.camel.support.jsse.KeyStoreParameters;
import org.apache.camel.support.jsse.SSLContextParameters;
public class HttpsRouteAliasTest extends HttpsRouteTest {
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
JettyHttpComponent jetty = context.getComponent("jetty", JettyHttpComponent.class);
-
+
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost-alias.p12").toString());
ksp.setPassword(pwd);
-
+
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
-
+
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
-
+
// Specify "server" cert alias
sslContextParameters.setCertAlias("server");
-
+
jetty.setSslContextParameters(sslContextParameters);
-
+
setSSLProps(jetty, "", "asdfasdfasdfdasfs", "sadfasdfasdfas");
from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java
index e3f57f3..8ae7af0 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java
@@ -24,15 +24,16 @@ import org.apache.camel.builder.RouteBuilder;
import org.junit.Before;
public class HttpsRouteSetupWithSystemPropsTest extends HttpsRouteTest {
-
+
@Override
@Before
public void setUp() throws Exception {
- // ensure jsse clients can validate the self signed dummy localhost cert,
+ // ensure jsse clients can validate the self signed dummy localhost
+ // cert,
// use the server keystore as the trust store for these tests
URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.p12");
setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.getPath());
-
+
// START SNIPPET: e1
// setup SSL using system properties
setSystemProp("org.eclipse.jetty.ssl.keystore", trustStoreUrl.getPath());
@@ -41,9 +42,9 @@ public class HttpsRouteSetupWithSystemPropsTest extends HttpsRouteTest {
setSystemProp("jdk.tls.client.protocols", "TLSv1.2");
// END SNIPPET: e1
- super.setUp();
+ super.setUp();
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -56,7 +57,7 @@ public class HttpsRouteSetupWithSystemPropsTest extends HttpsRouteTest {
}
};
from("jetty:https://localhost:" + port1 + "/hello").process(proc);
-
+
from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
index 66db024..92efc84 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
@@ -26,21 +26,21 @@ import org.apache.camel.support.jsse.KeyStoreParameters;
import org.apache.camel.support.jsse.SSLContextParameters;
public class HttpsRouteSslContextParametersInComponentTest extends HttpsRouteTest {
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
JettyHttpComponent jetty = getContext().getComponent("jetty", JettyHttpComponent.class);
-
+
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.p12").toString());
ksp.setPassword(pwd);
-
+
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
-
+
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
jetty.setSslContextParameters(sslContextParameters);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
index d3a40eb..ad82640 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
@@ -56,15 +56,16 @@ public class HttpsRouteTest extends BaseJettyTest {
public String getHttpProducerScheme() {
return "https://";
}
-
+
@Override
@Before
public void setUp() throws Exception {
port1 = getNextPort();
port2 = getNextPort();
-
+
super.setUp();
- // ensure jsse clients can validate the self signed dummy localhost cert,
+ // ensure jsse clients can validate the self signed dummy localhost
+ // cert,
// use the server keystore as the trust store for these tests
URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.p12");
setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.toURI().getPath());
@@ -85,7 +86,7 @@ public class HttpsRouteTest extends BaseJettyTest {
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setSecureSocketProtocol("TLSv1.2");
context.setSSLContextParameters(sslContextParameters);
- ((SSLContextParametersAware) context.getComponent("https")).setUseGlobalSslContextParameters(true);
+ ((SSLContextParametersAware)context.getComponent("https")).setUseGlobalSslContextParameters(true);
return context;
}
@@ -98,7 +99,7 @@ public class HttpsRouteTest extends BaseJettyTest {
for (Object key : originalValues.keySet()) {
Object value = originalValues.get(key);
if (NULL_VALUE_MARKER.equals(value)) {
- System.clearProperty((String) key);
+ System.clearProperty((String)key);
} else {
System.setProperty((String)key, (String)value);
}
@@ -134,7 +135,7 @@ public class HttpsRouteTest extends BaseJettyTest {
assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
}
-
+
@Test
public void testEndpointWithoutHttps() throws Exception {
// these tests does not run well on Windows
@@ -160,7 +161,7 @@ public class HttpsRouteTest extends BaseJettyTest {
ByteArrayOutputStream os = new ByteArrayOutputStream();
URL url = new URL("https://localhost:" + port1 + "/hello");
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+ HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
SSLContext ssl = SSLContext.getInstance("TLSv1.2");
ssl.init(null, null, null);
connection.setSSLSocketFactory(ssl.getSocketFactory());
@@ -173,7 +174,7 @@ public class HttpsRouteTest extends BaseJettyTest {
String data = new String(os.toByteArray());
assertEquals("<b>Hello World</b>", data);
}
-
+
@Test
public void testHelloEndpointWithoutHttps() throws Exception {
// these tests does not run well on Windows
@@ -187,12 +188,12 @@ public class HttpsRouteTest extends BaseJettyTest {
} catch (SocketException expected) {
}
}
-
+
protected void invokeHttpEndpoint() throws IOException {
template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port2 + "/test", expectedBody, "Content-Type", "application/xml");
}
-
+
protected void configureSslContextFactory(SslContextFactory sslContextFactory) {
sslContextFactory.setKeyManagerPassword(pwd);
sslContextFactory.setKeyStorePassword(pwd);
@@ -205,17 +206,17 @@ public class HttpsRouteTest extends BaseJettyTest {
sslContextFactory.setTrustStoreType("PKCS12");
sslContextFactory.setProtocol("TLSv1.2");
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
- JettyHttpComponent componentJetty = (JettyHttpComponent) context.getComponent("jetty");
+ JettyHttpComponent componentJetty = (JettyHttpComponent)context.getComponent("jetty");
componentJetty.setSslPassword(pwd);
componentJetty.setSslKeyPassword(pwd);
URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.p12");
componentJetty.setKeystore(keyStoreUrl.toURI().getPath());
-
+
from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
@@ -224,10 +225,9 @@ public class HttpsRouteTest extends BaseJettyTest {
}
};
from("jetty:https://localhost:" + port1 + "/hello").process(proc);
-
+
from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
}
-
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
index dd07863..2808570 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
@@ -37,11 +37,11 @@ public class InterfacesTest extends BaseJettyTest {
public InterfacesTest() throws IOException {
// Retrieve an address of some remote network interface
- Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
-
+ Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
+
while (remoteInterfaceAddress == null && interfaces.hasMoreElements()) {
NetworkInterface interfaze = interfaces.nextElement();
- Enumeration<InetAddress> addresses = interfaze.getInetAddresses();
+ Enumeration<InetAddress> addresses = interfaze.getInetAddresses();
if (addresses.hasMoreElements()) {
InetAddress nextAddress = addresses.nextElement();
try {
@@ -59,16 +59,16 @@ public class InterfacesTest extends BaseJettyTest {
}
}
}
-
+
@Test
public void testLocalInterfaceHandled() throws IOException, InterruptedException {
int expectedMessages = (remoteInterfaceAddress != null) ? 3 : 2;
getMockEndpoint("mock:endpoint").expectedMessageCount(expectedMessages);
-
+
URL localUrl = new URL("http://localhost:" + port1 + "/testRoute");
String localResponse = context.getTypeConverter().convertTo(String.class, localUrl.openStream());
assertEquals("local", localResponse);
-
+
if (!isMacOS) {
localUrl = new URL("http://127.0.0.1:" + port2 + "/testRoute");
} else {
@@ -76,38 +76,38 @@ public class InterfacesTest extends BaseJettyTest {
}
localResponse = context.getTypeConverter().convertTo(String.class, localUrl.openStream());
assertEquals("local-differentPort", localResponse);
-
- if (remoteInterfaceAddress != null) {
+
+ if (remoteInterfaceAddress != null) {
URL url = new URL("http://" + remoteInterfaceAddress + ":" + port3 + "/testRoute");
String remoteResponse = context.getTypeConverter().convertTo(String.class, url.openStream());
assertEquals("remote", remoteResponse);
}
-
+
assertMockEndpointsSatisfied();
- }
-
+ }
+
@Test
public void testAllInterfaces() throws Exception {
int expectedMessages = (remoteInterfaceAddress != null) ? 2 : 1;
getMockEndpoint("mock:endpoint").expectedMessageCount(expectedMessages);
-
+
URL localUrl = new URL("http://localhost:" + port4 + "/allInterfaces");
String localResponse = context.getTypeConverter().convertTo(String.class, localUrl.openStream());
assertEquals("allInterfaces", localResponse);
-
+
if (remoteInterfaceAddress != null) {
URL url = new URL("http://" + remoteInterfaceAddress + ":" + port4 + "/allInterfaces");
String remoteResponse = context.getTypeConverter().convertTo(String.class, url.openStream());
assertEquals("allInterfaces", remoteResponse);
}
-
+
assertMockEndpointsSatisfied();
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
-
+
@Override
public void configure() throws Exception {
port1 = getNextPort();
@@ -115,24 +115,16 @@ public class InterfacesTest extends BaseJettyTest {
port3 = getNextPort();
port4 = getNextPort();
- from("jetty:http://localhost:" + port1 + "/testRoute")
- .setBody().constant("local")
- .to("mock:endpoint");
-
- from("jetty:http://localhost:" + port2 + "/testRoute")
- .setBody().constant("local-differentPort")
- .to("mock:endpoint");
-
+ from("jetty:http://localhost:" + port1 + "/testRoute").setBody().constant("local").to("mock:endpoint");
+
+ from("jetty:http://localhost:" + port2 + "/testRoute").setBody().constant("local-differentPort").to("mock:endpoint");
+
if (remoteInterfaceAddress != null) {
- from("jetty:http://" + remoteInterfaceAddress + ":" + port3 + "/testRoute")
- .setBody().constant("remote")
- .to("mock:endpoint");
+ from("jetty:http://" + remoteInterfaceAddress + ":" + port3 + "/testRoute").setBody().constant("remote").to("mock:endpoint");
}
-
- from("jetty:http://0.0.0.0:" + port4 + "/allInterfaces")
- .setBody().constant("allInterfaces")
- .to("mock:endpoint");
-
+
+ from("jetty:http://0.0.0.0:" + port4 + "/allInterfaces").setBody().constant("allInterfaces").to("mock:endpoint");
+
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
index a4e03bf..7c69767 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
@@ -47,23 +47,16 @@ public class JettyCallHttpThenExceptionTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:{{port}}/myserver")
- .to("log:A")
- // remove http headers before and after invoking http service
- .removeHeaders("CamelHttp*")
- .to("http://localhost:{{port}}/other")
- .removeHeaders("CamelHttp*")
- .to("mock:bar")
+ from("jetty://http://localhost:{{port}}/myserver").to("log:A")
+ // remove http headers before and after invoking http
+ // service
+ .removeHeaders("CamelHttp*").to("http://localhost:{{port}}/other").removeHeaders("CamelHttp*").to("mock:bar")
// now just force an exception immediately
.throwException(new IllegalArgumentException("I cannot do this"));
- from("jetty://http://localhost:{{port}}/other")
- .convertBodyTo(String.class)
- .to("log:C")
- .to("mock:foo")
- .transform().simple("Bye ${body}");
+ from("jetty://http://localhost:{{port}}/other").convertBodyTo(String.class).to("log:C").to("mock:foo").transform().simple("Bye ${body}");
}
};
}
-
-}
\ No newline at end of file
+
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
index ce77089..89fd7b7 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
@@ -43,11 +43,7 @@ public class JettyCamelHttpUrlCBRTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://0.0.0.0:{{port}}/foo")
- .filter().simple("${header.CamelHttpUrl} contains 'foo'")
- .to("mock:foo")
- .end()
- .transform().constant("Bye World");
+ from("jetty:http://0.0.0.0:{{port}}/foo").filter().simple("${header.CamelHttpUrl} contains 'foo'").to("mock:foo").end().transform().constant("Bye World");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
index e3abf2b..c1df0d9 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
@@ -54,11 +54,7 @@ public class JettyContentBasedRouteTest extends BaseJettyTest {
return new RouteBuilder() {
public void configure() throws Exception {
// START SNIPPET: e1
- from("jetty:" + serverUri)
- .choice()
- .when().simple("${header.one}").to("mock:one")
- .otherwise()
- .to("mock:other");
+ from("jetty:" + serverUri).choice().when().simple("${header.one}").to("mock:one").otherwise().to("mock:other");
// END SNIPPET: e1
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
index 6fe5b23..5e65050 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
@@ -55,7 +55,7 @@ public class JettyContentTypeTest extends BaseJettyTest {
sendMessageWithContentType(null, false);
sendMessageWithContentType("UTF-8", false);
}
-
+
@Test
public void testContentTypeWithGZipEncoding() throws Exception {
sendMessageWithContentType(null, true);
@@ -108,4 +108,4 @@ public class JettyContentTypeTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
index 985ec67..95e61da 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
@@ -42,14 +42,12 @@ public class JettyContinuationDisabledTest extends BaseJettyTest {
JettyHttpComponent jetty = context.getComponent("jetty", JettyHttpComponent.class);
jetty.setUseContinuation(false);
- from("jetty:http://localhost:{{port}}/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- Thread.sleep(1000);
- exchange.getOut().setBody("Bye World");
- }
- })
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ Thread.sleep(1000);
+ exchange.getOut().setBody("Bye World");
+ }
+ }).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
index 92dbf1b..73bace0 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.apache.camel.component.jetty;
+
import java.lang.management.ManagementFactory;
import java.util.List;
import java.util.Set;
@@ -31,7 +32,7 @@ import org.junit.Before;
import org.junit.Test;
public class JettyEnableJmxTest extends BaseJettyTest {
-
+
private String serverUri0;
private String serverUri1;
private String serverUri2;
@@ -54,8 +55,8 @@ public class JettyEnableJmxTest extends BaseJettyTest {
releaseMBeanServers();
super.setUp();
mbsc = getMBeanConnection();
- }
-
+ }
+
@Test
public void testEnableJmxProperty() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -69,40 +70,40 @@ public class JettyEnableJmxTest extends BaseJettyTest {
template.requestBody(serverUri3 + "&x=foo", null, Object.class);
assertMockEndpointsSatisfied();
-
+
Set<ObjectName> s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
}
-
+
@Test
public void testShutdown() throws Exception {
Set<ObjectName> s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
-
+
context.stop();
-
+
s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 0 Jetty Server: " + s, 0, s.size());
}
-
+
@Test
public void testEndpointDisconnect() throws Exception {
Set<ObjectName> s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
-
+
context.getRouteController().stopRoute("route0");
-
+
s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 1 Jetty Server: " + s, 1, s.size());
-
+
context.getRouteController().stopRoute("route2");
context.getRouteController().stopRoute("route3");
-
+
s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 1 Jetty Server: " + s, 1, s.size());
-
+
context.getRouteController().stopRoute("route1");
-
+
s = mbsc.queryNames(new ObjectName("org.eclipse.jetty.server:type=server,*"), null);
assertEquals("Could not find 0 Jetty Server: " + s, 0, s.size());
}
@@ -121,29 +122,17 @@ public class JettyEnableJmxTest extends BaseJettyTest {
serverUri2 = "http://localhost:" + getNextPort() + "/myservice?enableJmx=false";
serverUri3 = "http://localhost:" + getNextPort() + "/myservice?enableJmx=false";
- from("jetty:" + serverUri0)
- .routeId("route0")
- .setBody().simple("<html><body>${in.header.x}</body></html>")
- .to("mock:result");
-
- from("jetty:" + serverUri1)
- .routeId("route1")
- .setBody().simple("<html><body>${in.header.x}</body></html>")
- .to("mock:result");
-
- from("jetty:" + serverUri2)
- .routeId("route2")
- .setBody().simple("<html><body>${in.header.x}</body></html>")
- .to("mock:result");
-
- from("jetty:" + serverUri3)
- .routeId("route3")
- .setBody().simple("<html><body>${in.header.x}</body></html>")
- .to("mock:result");
+ from("jetty:" + serverUri0).routeId("route0").setBody().simple("<html><body>${in.header.x}</body></html>").to("mock:result");
+
+ from("jetty:" + serverUri1).routeId("route1").setBody().simple("<html><body>${in.header.x}</body></html>").to("mock:result");
+
+ from("jetty:" + serverUri2).routeId("route2").setBody().simple("<html><body>${in.header.x}</body></html>").to("mock:result");
+
+ from("jetty:" + serverUri3).routeId("route3").setBody().simple("<html><body>${in.header.x}</body></html>").to("mock:result");
}
};
}
-
+
protected void releaseMBeanServers() {
List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
@@ -151,7 +140,7 @@ public class JettyEnableJmxTest extends BaseJettyTest {
MBeanServerFactory.releaseMBeanServer(server);
}
}
-
+
protected MBeanServerConnection getMBeanConnection() throws Exception {
if (mbsc == null) {
mbsc = ManagementFactory.getPlatformMBeanServer();
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
index 31baf2e..af1f744 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
@@ -38,14 +38,12 @@ public class JettyEndpointContinuationDisabledTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myservice?useContinuation=false")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- Thread.sleep(1000);
- exchange.getOut().setBody("Bye World");
- }
- })
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice?useContinuation=false").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ Thread.sleep(1000);
+ exchange.getOut().setBody("Bye World");
+ }
+ }).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
index 56eae4d..8280157 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
@@ -27,7 +27,7 @@ public class JettyEndpointSetHttpTraceTest extends BaseJettyTest {
private int portTraceOff = getNextPort();
@Test
- public void testTraceDisabled() throws Exception {
+ public void testTraceDisabled() throws Exception {
HttpClient httpclient = new HttpClient();
TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOff + "/myservice");
httpclient.executeMethod(trace);
@@ -36,9 +36,9 @@ public class JettyEndpointSetHttpTraceTest extends BaseJettyTest {
assertTrue(trace.getStatusCode() == 405);
trace.releaseConnection();
}
-
+
@Test
- public void testTraceEnabled() throws Exception {
+ public void testTraceEnabled() throws Exception {
HttpClient httpclient = new HttpClient();
TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOn + "/myservice");
httpclient.executeMethod(trace);
@@ -47,7 +47,7 @@ public class JettyEndpointSetHttpTraceTest extends BaseJettyTest {
assertTrue(trace.getStatusCode() == 200);
trace.releaseConnection();
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
index 506b663..0ce7f81 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
@@ -25,7 +25,8 @@ import org.apache.camel.http.common.HttpOperationFailedException;
import org.junit.Test;
/**
- * Based on end user on forum how to get the 404 error code in his enrich aggregator
+ * Based on end user on forum how to get the 404 error code in his enrich
+ * aggregator
*/
public class JettyHandle404Test extends BaseJettyTest {
@@ -43,7 +44,7 @@ public class JettyHandle404Test extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testCustomerErrorHandler() throws Exception {
String response = template.requestBody("http://localhost:{{port}}/myserver1?throwExceptionOnFailure=false", null, String.class);
@@ -60,7 +61,7 @@ public class JettyHandle404Test extends BaseJettyTest {
// setup the jetty component with the customx error handler
JettyHttpComponent jettyComponent = (JettyHttpComponent)context.getComponent("jetty");
jettyComponent.setErrorHandler(new MyErrorHandler());
-
+
// disable error handling
errorHandler(noErrorHandler());
@@ -73,32 +74,29 @@ public class JettyHandle404Test extends BaseJettyTest {
}
}).to("mock:result");
- // use this sub route as indirection to handle the HttpOperationFailedException
- // and set the data back as data on the exchange to not cause the exception to be thrown
- from("direct:tohttp")
- .doTry()
- .to(getProducerUrl())
- .doCatch(HttpOperationFailedException.class)
- .process(new Processor() {
- public void process(Exchange exchange) {
- // copy the caused exception values to the exchange as we want the response in the regular exchange
- // instead as an exception that will get thrown and thus the route breaks
- HttpOperationFailedException cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, HttpOperationFailedException.class);
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, cause.getStatusCode());
- exchange.getOut().setBody(cause.getResponseBody());
- }
- })
- .end();
-
+ // use this sub route as indirection to handle the
+ // HttpOperationFailedException
+ // and set the data back as data on the exchange to not cause
+ // the exception to be thrown
+ from("direct:tohttp").doTry().to(getProducerUrl()).doCatch(HttpOperationFailedException.class).process(new Processor() {
+ public void process(Exchange exchange) {
+ // copy the caused exception values to the exchange as
+ // we want the response in the regular exchange
+ // instead as an exception that will get thrown and thus
+ // the route breaks
+ HttpOperationFailedException cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, HttpOperationFailedException.class);
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, cause.getStatusCode());
+ exchange.getOut().setBody(cause.getResponseBody());
+ }
+ }).end();
// this is our jetty server where we simulate the 404
- from("jetty://http://localhost:{{port}}/myserver")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setBody("Page not found");
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
- }
- });
+ from("jetty://http://localhost:{{port}}/myserver").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getOut().setBody("Page not found");
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
index b8e08d1..494d3f6 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
@@ -54,12 +54,11 @@ public class JettyHttpBridgeEncodedPathTest extends BaseJettyTest {
}
};
from("jetty://http://localhost:" + port2 + "/jettyTestRouteA?matchOnUriPrefix=true")
- .log("Using JettyTestRouteA route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
- .to("http://localhost:" + port1 + "/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
+ .log("Using JettyTestRouteA route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
+ .to("http://localhost:" + port1 + "/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
from("jetty://http://localhost:" + port1 + "/jettyTestRouteB?matchOnUriPrefix=true")
- .log("Using JettyTestRouteB route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
- .process(serviceProc);
+ .log("Using JettyTestRouteB route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]").process(serviceProc);
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
index 8b599a5..bb83ca5 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
@@ -29,16 +29,13 @@ public class JettyHttpContentTypeTest extends BaseJettyTest {
@Test
public void testContentType() throws Exception {
getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
- getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
- "text/plain; charset=\"" + CHARSET + "\"");
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain; charset=\"" + CHARSET + "\"");
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, CHARSET);
- getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL,
- "http://127.0.0.1:" + getPort() + "/foo");
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://127.0.0.1:" + getPort() + "/foo");
getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, CHARSET);
byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
- String out = template.requestBodyAndHeader("http://127.0.0.1:{{port}}/foo", data,
- "content-type", "text/plain; charset=\"" + CHARSET + "\"", String.class);
+ String out = template.requestBodyAndHeader("http://127.0.0.1:{{port}}/foo", data, "content-type", "text/plain; charset=\"" + CHARSET + "\"", String.class);
assertEquals("Bye World", out);
assertMockEndpointsSatisfied();
@@ -47,15 +44,14 @@ public class JettyHttpContentTypeTest extends BaseJettyTest {
@Test
public void testContentTypeWithAction() throws Exception {
getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
- getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
- "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"");
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"");
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, CHARSET);
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://127.0.0.1:" + getPort() + "/foo");
getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, CHARSET);
byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
- String out = template.requestBodyAndHeader("http://127.0.0.1:{{port}}/foo", data,
- "content-type", "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"", String.class);
+ String out = template.requestBodyAndHeader("http://127.0.0.1:{{port}}/foo", data, "content-type",
+ "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"", String.class);
assertEquals("Bye World", out);
assertMockEndpointsSatisfied();
@@ -66,9 +62,7 @@ public class JettyHttpContentTypeTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://127.0.0.1:{{port}}/foo")
- .to("mock:input")
- .transform().constant("Bye World");
+ from("jetty:http://127.0.0.1:{{port}}/foo").to("mock:input").transform().constant("Bye World");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
index 5307641..73a4fc3 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
@@ -20,7 +20,8 @@ import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
/**
- * Unit test to verify that the Jetty HTTP connector is correctly disconnected on shutdown
+ * Unit test to verify that the Jetty HTTP connector is correctly disconnected
+ * on shutdown
*/
public class JettyHttpEndpointDisconnectTest extends BaseJettyTest {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
index b4d9bd4..38d5240 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
@@ -23,10 +23,11 @@ import org.junit.Ignore;
import org.junit.Test;
/**
- * Unit test to verify that we can have URI options for external system (endpoint is lenient)
+ * Unit test to verify that we can have URI options for external system
+ * (endpoint is lenient)
*/
public class JettyHttpGetWithParamAsExchangeHeaderTest extends BaseJettyTest {
-
+
private String serverUri = "http://localhost:" + getPort() + "/myservice";
@Test
@@ -41,7 +42,7 @@ public class JettyHttpGetWithParamAsExchangeHeaderTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testHttpGetWithUTF8EncodedParamsViaURI() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -53,7 +54,7 @@ public class JettyHttpGetWithParamAsExchangeHeaderTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
@Ignore
public void testHttpGetWithISO8859EncodedParamsViaURI() throws Exception {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
index 70eae83..e284595 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
@@ -24,7 +24,8 @@ import org.apache.camel.http.common.HttpMessage;
import org.junit.Test;
/**
- * Unit test to verify that we can have URI options for external system (endpoint is lenient)
+ * Unit test to verify that we can have URI options for external system
+ * (endpoint is lenient)
*/
public class JettyHttpGetWithParamTest extends BaseJettyTest {
@@ -66,14 +67,13 @@ public class JettyHttpGetWithParamTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
from("jetty:" + serverUri).process(processor).to("mock:result");
- from("direct:start")
- .setHeader(Exchange.HTTP_METHOD, constant("GET"))
- .setHeader(Exchange.HTTP_URI, simple(serverUri + "?${in.headers.parameters}"))
+ from("direct:start").setHeader(Exchange.HTTP_METHOD, constant("GET")).setHeader(Exchange.HTTP_URI, simple(serverUri + "?${in.headers.parameters}"))
.to("http://example");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpHeadersTest.java
index 27304f1..efbda27 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpHeadersTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpHeadersTest.java
@@ -43,12 +43,9 @@ public class JettyHttpHeadersTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://0.0.0.0:{{port}}/foo")
- .to("mock:input")
- .transform().constant("Bye World");
+ from("jetty:http://0.0.0.0:{{port}}/foo").to("mock:input").transform().constant("Bye World");
}
};
}
-
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpMapHttpMessageHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpMapHttpMessageHeadersTest.java
index 301b5c9..0c1d16c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpMapHttpMessageHeadersTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpMapHttpMessageHeadersTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
public class JettyHttpMapHttpMessageHeadersTest extends BaseJettyTest {
-
+
private String serverUriFiltered = "http://localhost:" + getPort() + "/myservice";
private String serverUriNotFiltered = "http://localhost:" + getPort() + "/myservice1";
@@ -38,7 +38,7 @@ public class JettyHttpMapHttpMessageHeadersTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testHttpGetWithParamsViaURINotFiltered() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result1");
@@ -64,7 +64,7 @@ public class JettyHttpMapHttpMessageHeadersTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testHttpGetWithParamsViaHeaderNotFiltered() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result1");
@@ -90,7 +90,7 @@ public class JettyHttpMapHttpMessageHeadersTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testHttpPostFiltered() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java
index 1581790..1854b25 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java
@@ -29,10 +29,10 @@ import org.junit.Test;
* Unit test for exposing a http server that returns images
*/
public class JettyImageFileTest extends BaseJettyTest {
-
+
private void sendImageContent(boolean usingGZip) throws Exception {
Endpoint endpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice");
- Exchange exchange = endpoint.createExchange();
+ Exchange exchange = endpoint.createExchange();
if (usingGZip) {
exchange.getIn().setHeader(Exchange.CONTENT_ENCODING, "gzip");
}
@@ -69,4 +69,4 @@ public class JettyImageFileTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyLongestContextPathMatchTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyLongestContextPathMatchTest.java
index ba4efcc..395c26f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyLongestContextPathMatchTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyLongestContextPathMatchTest.java
@@ -87,7 +87,7 @@ public class JettyLongestContextPathMatchTest extends BaseJettyTest {
template.sendBody("http://localhost:{{port}}/myapp/aaa/ddd/eee/fff/foo", null);
assertMockEndpointsSatisfied();
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMuteExceptionTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMuteExceptionTest.java
index 899243f..a7bebc9 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMuteExceptionTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMuteExceptionTest.java
@@ -44,12 +44,9 @@ public class JettyMuteExceptionTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/foo?muteException=true")
- .to("mock:destination")
- .throwException(new IllegalArgumentException("Camel cannot do this"));
+ from("jetty:http://localhost:{{port}}/foo?muteException=true").to("mock:destination").throwException(new IllegalArgumentException("Camel cannot do this"));
}
};
}
-
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java
index c15dca7..4a67d42 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java
@@ -38,15 +38,14 @@ public class JettyOnExceptionHandledTest extends BaseJettyTest {
public void configure() throws Exception {
// START SNIPPET: e1
from("jetty://http://localhost:{{port}}/myserver")
- // use onException to catch all exceptions and return a custom reply message
- .onException(Exception.class)
- .handled(true)
- // create a custom failure response
- .transform(constant("Dude something went wrong"))
- // we must remember to set error code 500 as handled(true)
- // otherwise would let Camel thing its a OK response (200)
- .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(500))
- .end()
+ // use onException to catch all exceptions and return a
+ // custom reply message
+ .onException(Exception.class).handled(true)
+ // create a custom failure response
+ .transform(constant("Dude something went wrong"))
+ // we must remember to set error code 500 as handled(true)
+ // otherwise would let Camel thing its a OK response (200)
+ .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(500)).end()
// now just force an exception immediately
.throwException(new IllegalArgumentException("I cannot do this"));
// END SNIPPET: e1
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
index 99ca483..84444eb 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
@@ -62,4 +62,4 @@ public class JettyResponseBodyWhenErrorTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBufferSizeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBufferSizeTest.java
index bac0e32..1e491ba 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBufferSizeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBufferSizeTest.java
@@ -31,8 +31,7 @@ public class JettyResponseBufferSizeTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp?responseBufferSize=65536")
- .transform(body().prepend("Hello "));
+ from("jetty:http://localhost:{{port}}/myapp?responseBufferSize=65536").transform(body().prepend("Hello "));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
index db2d5ab..c946049 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
@@ -35,7 +35,7 @@ public class JettyRouteTest extends BaseJettyTest {
String body = context.getTypeConverter().convertTo(String.class, response);
assertEquals("<html><body>Book 123 is Camel in Action</body></html>", body);
}
-
+
@Test
public void testHttpProxyHostHeader() throws Exception {
String out = template.requestBody("http://localhost:{{port}}/proxyServer", null, String.class);
@@ -49,10 +49,9 @@ public class JettyRouteTest extends BaseJettyTest {
// START SNIPPET: e1
from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
// END SNIPPET: e1
-
- from("jetty://http://localhost:{{port}}/proxyServer")
- .to("http://localhost:{{port2}}/host?bridgeEndpoint=true");
-
+
+ from("jetty://http://localhost:{{port}}/proxyServer").to("http://localhost:{{port2}}/host?bridgeEndpoint=true");
+
from("jetty://http://localhost:{{port2}}/host").transform(header("host"));
}
};
@@ -65,7 +64,8 @@ public class JettyRouteTest extends BaseJettyTest {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
- // we have access to the HttpServletRequest here and we can grab it if we need it
+ // we have access to the HttpServletRequest here and we can grab it
+ // if we need it
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
assertNotNull(req);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java
index 893560c3..7581483 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java
@@ -65,7 +65,8 @@ public class JettyRouteWithSocketPropertiesTest extends BaseJettyTest {
// just get the body as a string
String body = exchange.getIn().getBody(String.class);
- // we have access to the HttpServletRequest here and we can grab it if we need it
+ // we have access to the HttpServletRequest here and we can grab it
+ // if we need it
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
assertNotNull(req);
@@ -77,4 +78,4 @@ public class JettyRouteWithSocketPropertiesTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
index 2abe420..c57e190 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
@@ -61,4 +61,4 @@ public class JettyRouteWithUnknownSocketPropertiesTest extends BaseJettyTest {
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
index bcf6eba..1536d7e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
@@ -61,4 +61,4 @@ public class JettyRouteWithUnknownSslSocketPropertiesTest extends BaseJettyTest
}
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
index 8d2d383..0a761f2 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
@@ -24,7 +24,8 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
/**
- * Based on end user on forum how to get the 404 error code in his enrich aggregator
+ * Based on end user on forum how to get the 404 error code in his enrich
+ * aggregator
*/
public class JettySimplifiedHandle404Test extends BaseJettyTest {
@@ -48,10 +49,13 @@ public class JettySimplifiedHandle404Test extends BaseJettyTest {
errorHandler(noErrorHandler());
// START SNIPPET: e1
- // We set throwExceptionOnFailure to false to let Camel return any response from the remove HTTP server without thrown
+ // We set throwExceptionOnFailure to false to let Camel return
+ // any response from the remove HTTP server without thrown
// HttpOperationFailedException in case of failures.
- // This allows us to handle all responses in the aggregation strategy where we can check the HTTP response code
- // and decide what to do. As this is based on an unit test we assert the code is 404
+ // This allows us to handle all responses in the aggregation
+ // strategy where we can check the HTTP response code
+ // and decide what to do. As this is based on an unit test we
+ // assert the code is 404
from("direct:start").enrich("http://localhost:{{port}}/myserver?throwExceptionOnFailure=false&user=Camel", new AggregationStrategy() {
public Exchange aggregate(Exchange original, Exchange resource) {
// get the response code
@@ -62,13 +66,12 @@ public class JettySimplifiedHandle404Test extends BaseJettyTest {
}).to("mock:result");
// this is our jetty server where we simulate the 404
- from("jetty://http://localhost:{{port}}/myserver")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setBody("Page not found");
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
- }
- });
+ from("jetty://http://localhost:{{port}}/myserver").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getOut().setBody("Page not found");
+ exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+ }
+ });
// END SNIPPET: e1
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
index 3da9eb2..8c6279b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
@@ -39,20 +39,18 @@ public class JettySimulateInOnlyTest extends BaseJettyTest {
public void configure() throws Exception {
// START SNIPPET: e1
from("jetty://http://localhost:{{port}}/myserver")
- // turn the route to in only as we do not want jetty to wait for the response
+ // turn the route to in only as we do not want jetty to wait
+ // for the response
// we can do this using the wiretap EIP pattern
.wireTap("direct:continue")
// and then construct a canned empty response
.transform(constant("OK"));
- from("direct:continue")
- .delay(1500)
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- route += "B";
- }
- }).
- to("mock:result");
+ from("direct:continue").delay(1500).process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ route += "B";
+ }
+ }).to("mock:result");
// END SNIPPET: e1
}
});
@@ -79,22 +77,20 @@ public class JettySimulateInOnlyTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
from("jetty://http://localhost:{{port}}/myserver")
- // turn the route to in only as we do not want jetty to wait for the response
- // we can do this by changing the MEP and sending to a seda endpoint to spin off
+ // turn the route to in only as we do not want jetty to wait
+ // for the response
+ // we can do this by changing the MEP and sending to a seda
+ // endpoint to spin off
// a new thread continue doing the routing
- .setExchangePattern(ExchangePattern.InOnly)
- .to("seda:continue")
+ .setExchangePattern(ExchangePattern.InOnly).to("seda:continue")
// and then construct a canned empty response
.transform(constant("OK"));
- from("seda:continue")
- .delay(1000)
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- route += "B";
- }
- }).
- to("mock:result");
+ from("seda:continue").delay(1000).process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ route += "B";
+ }
+ }).to("mock:result");
}
});
context.start();
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySteveIssueTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySteveIssueTest.java
index d72a714..e519e97 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySteveIssueTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySteveIssueTest.java
@@ -42,9 +42,7 @@ public class JettySteveIssueTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:" + serverUri)
- .setBody().simple("<html><body>${in.header.x}</body></html>")
- .to("mock:result");
+ from("jetty:" + serverUri).setBody().simple("<html><body>${in.header.x}</body></html>").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendResumeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendResumeTest.java
index a0a8595..5a07a96 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendResumeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendResumeTest.java
@@ -28,12 +28,12 @@ public class JettySuspendResumeTest extends BaseJettyTest {
@Test
public void testJettySuspendResume() throws Exception {
context.getShutdownStrategy().setTimeout(50);
-
+
String reply = template.requestBody(serverUri, "World", String.class);
assertEquals("Bye World", reply);
// now suspend jetty
- HttpConsumer consumer = (HttpConsumer) context.getRoute("route1").getConsumer();
+ HttpConsumer consumer = (HttpConsumer)context.getRoute("route1").getConsumer();
assertNotNull(consumer);
// suspend
@@ -60,8 +60,7 @@ public class JettySuspendResumeTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://" + serverUri).id("route1")
- .transform(body().prepend("Bye "));
+ from("jetty://" + serverUri).id("route1").transform(body().prepend("Bye "));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendTest.java
index cfc4019..7e3bec4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendTest.java
@@ -33,7 +33,7 @@ public class JettySuspendTest extends BaseJettyTest {
assertEquals("Bye World", reply);
// now suspend jetty
- HttpConsumer consumer = (HttpConsumer) context.getRoute("route1").getConsumer();
+ HttpConsumer consumer = (HttpConsumer)context.getRoute("route1").getConsumer();
assertNotNull(consumer);
// suspend
@@ -53,8 +53,7 @@ public class JettySuspendTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://" + serverUri).id("route1")
- .transform(body().prepend("Bye "));
+ from("jetty://" + serverUri).id("route1").transform(body().prepend("Bye "));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendWhileInProgressTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendWhileInProgressTest.java
index 66d45c4..17882da 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendWhileInProgressTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendWhileInProgressTest.java
@@ -33,10 +33,12 @@ public class JettySuspendWhileInProgressTest extends BaseJettyTest {
public void testJettySuspendWhileInProgress() throws Exception {
context.getShutdownStrategy().setTimeout(50);
- // send a request/reply and have future handle so we can shutdown while in progress
+ // send a request/reply and have future handle so we can shutdown while
+ // in progress
Future<String> reply = template.asyncRequestBodyAndHeader(serverUri, null, "name", "Camel", String.class);
- // shutdown camel while in progress, wait 2 sec so the first req has been received in Camel route
+ // shutdown camel while in progress, wait 2 sec so the first req has
+ // been received in Camel route
Executors.newSingleThreadExecutor().execute(new Runnable() {
public void run() {
try {
@@ -72,10 +74,7 @@ public class JettySuspendWhileInProgressTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty://" + serverUri)
- .log("Got data will wait 10 sec with reply")
- .delay(10000)
- .transform(simple("Bye ${header.name}"));
+ from("jetty://" + serverUri).log("Got data will wait 10 sec with reply").delay(10000).transform(simple("Bye ${header.name}"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySwitchingStatusCode204Test.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySwitchingStatusCode204Test.java
index a3543c3..48457ab 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySwitchingStatusCode204Test.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySwitchingStatusCode204Test.java
@@ -27,35 +27,35 @@ import org.apache.http.util.EntityUtils;
import org.junit.Test;
public class JettySwitchingStatusCode204Test extends BaseJettyTest {
-
- @Test
- public void testSwitchNoBodyTo204ViaHttp() throws Exception {
- HttpUriRequest request = new HttpGet("http://localhost:" + getPort() + "/bar");
- HttpClient httpClient = HttpClientBuilder.create().build();
- HttpResponse httpResponse = httpClient.execute(request);
-
- assertEquals(204, httpResponse.getStatusLine().getStatusCode());
- assertNull(httpResponse.getEntity());
- }
-
- @Test
- public void testSwitchingNoBodyTo204HttpViaCamel() throws Exception {
- Exchange inExchange = this.createExchangeWithBody("Hello World");
- Exchange outExchange = template.send("http://localhost:{{port}}/bar", inExchange);
-
- assertEquals(204, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
- assertEquals(null, outExchange.getMessage().getBody(String.class));
- }
-
- @Test
- public void testSwitchingNoBodyTo204ViaCamelRoute() throws Exception {
- Exchange inExchange = this.createExchangeWithBody("Hello World");
- Exchange outExchange = template.send("direct:bar", inExchange);
-
- assertEquals(204, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
- assertEquals(null, outExchange.getMessage().getBody(String.class));
- }
-
+
+ @Test
+ public void testSwitchNoBodyTo204ViaHttp() throws Exception {
+ HttpUriRequest request = new HttpGet("http://localhost:" + getPort() + "/bar");
+ HttpClient httpClient = HttpClientBuilder.create().build();
+ HttpResponse httpResponse = httpClient.execute(request);
+
+ assertEquals(204, httpResponse.getStatusLine().getStatusCode());
+ assertNull(httpResponse.getEntity());
+ }
+
+ @Test
+ public void testSwitchingNoBodyTo204HttpViaCamel() throws Exception {
+ Exchange inExchange = this.createExchangeWithBody("Hello World");
+ Exchange outExchange = template.send("http://localhost:{{port}}/bar", inExchange);
+
+ assertEquals(204, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals(null, outExchange.getMessage().getBody(String.class));
+ }
+
+ @Test
+ public void testSwitchingNoBodyTo204ViaCamelRoute() throws Exception {
+ Exchange inExchange = this.createExchangeWithBody("Hello World");
+ Exchange outExchange = template.send("direct:bar", inExchange);
+
+ assertEquals(204, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals(null, outExchange.getMessage().getBody(String.class));
+ }
+
@Test
public void testNoSwitchingNoCodeViaHttp() throws Exception {
HttpUriRequest request = new HttpGet("http://localhost:" + getPort() + "/foo");
@@ -84,7 +84,7 @@ public class JettySwitchingStatusCode204Test extends BaseJettyTest {
assertEquals(200, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
assertEquals("No Content", outExchange.getMessage().getBody(String.class));
}
-
+
@Test
public void testNoSwitchingNoBodyViaHttp() throws Exception {
HttpUriRequest request = new HttpGet("http://localhost:" + getPort() + "/foobar");
@@ -95,7 +95,7 @@ public class JettySwitchingStatusCode204Test extends BaseJettyTest {
assertNotNull(httpResponse.getEntity());
assertEquals("", EntityUtils.toString(httpResponse.getEntity()));
}
-
+
@Test
public void testNoSwitchingNoBodyHttpViaCamel() throws Exception {
Exchange inExchange = this.createExchangeWithBody("Hello World");
@@ -104,7 +104,7 @@ public class JettySwitchingStatusCode204Test extends BaseJettyTest {
assertEquals(200, outExchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE));
assertEquals("", outExchange.getMessage().getBody(String.class));
}
-
+
@Test
public void testNoSwitchingNoBodyViaCamelRoute() throws Exception {
Exchange inExchange = this.createExchangeWithBody("Hello World");
@@ -119,26 +119,19 @@ public class JettySwitchingStatusCode204Test extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/bar")
- .setBody().constant("");
+ from("jetty:http://localhost:{{port}}/bar").setBody().constant("");
- from("direct:bar")
- .to("http://localhost:{{port}}/bar");
+ from("direct:bar").to("http://localhost:{{port}}/bar");
- from("jetty:http://localhost:{{port}}/foo")
- .setBody().constant("No Content");
+ from("jetty:http://localhost:{{port}}/foo").setBody().constant("No Content");
- from("direct:foo")
- .to("http://localhost:{{port}}/foo");
+ from("direct:foo").to("http://localhost:{{port}}/foo");
- from("jetty:http://localhost:{{port}}/foobar")
- .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
- .setBody().constant("");
+ from("jetty:http://localhost:{{port}}/foobar").setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200)).setBody().constant("");
- from("direct:foobar")
- .to("http://localhost:{{port}}/foobar");
+ from("direct:foobar").to("http://localhost:{{port}}/foobar");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
index a49834e..9bf697d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
@@ -69,12 +69,7 @@ public class JettyWithXPathChoiceTest extends BaseJettyTest {
public void configure() {
from("jetty:http://localhost:{{port}}/myworld")
// use stream caching
- .streamCaching()
- .choice()
- .when().xpath("/one").to("mock:x")
- .when().xpath("/two").to("mock:y")
- .otherwise().to("mock:z")
- .end();
+ .streamCaching().choice().when().xpath("/one").to("mock:x").when().xpath("/two").to("mock:y").otherwise().to("mock:z").end();
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormOkHttpTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormOkHttpTest.java
index 7e67d9d..d52f3ad 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormOkHttpTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormOkHttpTest.java
@@ -33,14 +33,11 @@ public class MultiPartFormOkHttpTest extends BaseJettyTest {
private Request createMultipartRequest() throws Exception {
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
- RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"test\"\r\n\r\nsome data here\r\n-----011000010111000001101001--");
- Request request = new Request.Builder()
- .url("http://localhost:" + getPort() + "/test")
- .post(body)
- .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
- .addHeader("cache-control", "no-cache")
- .addHeader("postman-token", "a9fd95b6-04b9-ea7a-687e-ff828ea00774")
- .build();
+ RequestBody body = RequestBody
+ .create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"test\"\r\n\r\nsome data here\r\n-----011000010111000001101001--");
+ Request request = new Request.Builder().url("http://localhost:" + getPort() + "/test").post(body)
+ .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001").addHeader("cache-control", "no-cache")
+ .addHeader("postman-token", "a9fd95b6-04b9-ea7a-687e-ff828ea00774").build();
return request;
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
index 10c7bed..f030335 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
@@ -35,10 +35,7 @@ import org.junit.Test;
public class MultiPartFormTest extends BaseJettyTest {
private HttpEntity createMultipartRequestEntity() throws Exception {
File file = new File("src/test/resources/log4j2.properties");
- return MultipartEntityBuilder.create()
- .addTextBody("comment", "A binary file of some kind")
- .addBinaryBody(file.getName(), file)
- .build();
+ return MultipartEntityBuilder.create().addTextBody("comment", "A binary file of some kind").addBinaryBody(file.getName(), file).build();
}
@@ -93,13 +90,13 @@ public class MultiPartFormTest extends BaseJettyTest {
// "text/plain", data.getContentType());
assertEquals("Got the wrong name", "log4j2.properties", data.getName());
- assertTrue("We should get the data from the DataHandle", data.getDataSource()
- .getInputStream().available() > 0);
+ assertTrue("We should get the data from the DataHandle", data.getDataSource().getInputStream().available() > 0);
// The other form date can be get from the message
// header
- // For binary attachment, header should also be populated by DataHandler but not payload
+ // For binary attachment, header should also be
+ // populated by DataHandler but not payload
Object header = in.getHeader("log4j2.properties");
assertEquals(DataHandler.class, header.getClass());
assertEquals(data, header);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
index 60fb59c..0f6ad66 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
@@ -52,7 +52,6 @@ public class MultiThreadedHttpGetTest extends BaseJettyTest {
httpConnectionManager.setDefaultMaxPerRoute(5);
context.getComponent("http", HttpComponent.class).setClientConnectionManager(httpConnectionManager);
-
String endpointName = "seda:withoutConversion?concurrentConsumers=5";
sendMessagesTo(endpointName, 5);
}
@@ -99,11 +98,9 @@ public class MultiThreadedHttpGetTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
- from("seda:withConversion?concurrentConsumers=5").to("http://localhost:{{port}}/search")
- .convertBodyTo(String.class).to("mock:results");
+ from("seda:withConversion?concurrentConsumers=5").to("http://localhost:{{port}}/search").convertBodyTo(String.class).to("mock:results");
- from("seda:withoutConversion?concurrentConsumers=5").to("http://localhost:{{port}}/search")
- .to("mock:results");
+ from("seda:withoutConversion?concurrentConsumers=5").to("http://localhost:{{port}}/search").to("mock:results");
from("jetty:http://localhost:{{port}}/search").process(new Processor() {
public void process(Exchange exchange) throws Exception {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MyErrorHandler.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MyErrorHandler.java
index 7909097..eb945e0 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MyErrorHandler.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MyErrorHandler.java
@@ -24,12 +24,11 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.server.handler.ErrorHandler;
public class MyErrorHandler extends ErrorHandler {
-
+
@Override
- protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
- throws IOException {
+ protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException {
String uri = request.getRequestURI();
-
+
writeErrorPageMessage(request, writer, code, message, uri);
if (showStacks) {
writeErrorPageStacks(request, writer);
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyChunkedFalseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyChunkedFalseTest.java
index 3a44828..6de301c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyChunkedFalseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyChunkedFalseTest.java
@@ -31,8 +31,7 @@ public class SimpleJettyChunkedFalseTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp?chunked=false")
- .transform(body().prepend("Hello "));
+ from("jetty:http://localhost:{{port}}/myapp?chunked=false").transform(body().prepend("Hello "));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyTest.java
index 65c27d5..cfa0b22 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SimpleJettyTest.java
@@ -31,8 +31,7 @@ public class SimpleJettyTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp")
- .transform(body().prepend("Hello "));
+ from("jetty:http://localhost:{{port}}/myapp").transform(body().prepend("Hello "));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SpringHttpsRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SpringHttpsRouteTest.java
index 25c0c82..3cde815 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SpringHttpsRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/SpringHttpsRouteTest.java
@@ -55,10 +55,9 @@ public class SpringHttpsRouteTest {
protected Properties originalValues = new Properties();
protected transient Logger log = LoggerFactory.getLogger(TestSupport.class);
-
@EndpointInject("mock:a")
MockEndpoint mockEndpoint;
-
+
@Produce
private ProducerTemplate template;
@@ -66,7 +65,8 @@ public class SpringHttpsRouteTest {
@Before
public void setUp() throws Exception {
- // ensure jsse clients can validate the self signed dummy localhost cert,
+ // ensure jsse clients can validate the self signed dummy localhost
+ // cert,
// use the server keystore as the trust store for these tests
URL trustStoreUrl = Thread.currentThread().getContextClassLoader().getResource("jsse/localhost.p12");
setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.getPath());
@@ -86,9 +86,9 @@ public class SpringHttpsRouteTest {
for (Object key : originalValues.keySet()) {
Object value = originalValues.get(key);
if (NULL_VALUE_MARKER.equals(value)) {
- System.clearProperty((String) key);
+ System.clearProperty((String)key);
} else {
- System.setProperty((String) key, (String) value);
+ System.setProperty((String)key, (String)value);
}
}
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java
index 94ae876..6420f09 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java
@@ -45,18 +45,18 @@ public class TwoCamelContextWithJettyRouteTest extends BaseJettyTest {
}
});
contextB.start();
-
+
String reply = template.requestBody("direct:a", "World", String.class);
assertEquals("Bye World", reply);
reply = template.requestBody("direct:b", "Camel", String.class);
assertEquals("Hi Camel", reply);
-
+
contextB.stop();
-
+
reply = template.requestBody("direct:a", "Earth", String.class);
assertEquals("Bye Earth", reply);
-
+
try {
reply = template.requestBody("direct:b", "Moon", String.class);
// expert the exception here
@@ -64,7 +64,7 @@ public class TwoCamelContextWithJettyRouteTest extends BaseJettyTest {
} catch (Exception ex) {
assertTrue("Should get the ConnectException", ex.getCause() instanceof NoHttpResponseException);
}
-
+
}
@Override
@@ -88,5 +88,5 @@ public class TwoCamelContextWithJettyRouteTest extends BaseJettyTest {
}
};
}
-
+
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
index 87fe1aa..5664797 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
@@ -39,14 +39,8 @@ public class JettyAsyncCBRTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .convertBodyTo(String.class)
- .choice()
- .when(body().contains("Camel"))
- .to("async:bye:world")
- .end()
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").convertBodyTo(String.class).choice().when(body().contains("Camel")).to("async:bye:world").end().to("mock:result");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationDisabledTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationDisabledTest.java
index 3a75a84..6a59444 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationDisabledTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationDisabledTest.java
@@ -39,9 +39,7 @@ public class JettyAsyncContinuationDisabledTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice?useContinuation=false")
- .to("async:bye:world")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice?useContinuation=false").to("async:bye:world").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutOkTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutOkTest.java
index d925dac..b53f2dd 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutOkTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutOkTest.java
@@ -39,9 +39,7 @@ public class JettyAsyncContinuationTimeoutOkTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice?continuationTimeout=3000")
- .to("async:bye:world")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice?continuationTimeout=3000").to("async:bye:world").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutTest.java
index 587c573..9a177c0 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutTest.java
@@ -55,9 +55,7 @@ public class JettyAsyncContinuationTimeoutTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice?continuationTimeout=3000")
- .to("async:bye:world?delay=6000")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice?continuationTimeout=3000").to("async:bye:world?delay=6000").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncDefaultContinuationTimeoutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncDefaultContinuationTimeoutTest.java
index f022433..c83e954 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncDefaultContinuationTimeoutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncDefaultContinuationTimeoutTest.java
@@ -59,9 +59,7 @@ public class JettyAsyncDefaultContinuationTimeoutTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .to("async:bye:world?delay=45s")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").to("async:bye:world?delay=45s").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
index 1e29674..7809bd9 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
@@ -39,13 +39,8 @@ public class JettyAsyncFilterTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .convertBodyTo(String.class)
- .filter(body().contains("Camel"))
- .to("async:bye:world")
- .end()
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").convertBodyTo(String.class).filter(body().contains("Camel")).to("async:bye:world").end().to("mock:result");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
index 85b4deb..b09d78a 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
@@ -39,9 +39,7 @@ public class JettyAsyncTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .to("async:bye:world")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").to("async:bye:world").to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncThrottleTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncThrottleTest.java
index 6df6910..37dd846 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncThrottleTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncThrottleTest.java
@@ -22,7 +22,8 @@ import org.apache.camel.component.jetty.BaseJettyTest;
import org.junit.Test;
/**
- * CAMEL-4795, there should be no exceptions in the logs (before the fix there was a NPE)
+ * CAMEL-4795, there should be no exceptions in the logs (before the fix there
+ * was a NPE)
*/
public class JettyAsyncThrottleTest extends BaseJettyTest {
@@ -38,7 +39,7 @@ public class JettyAsyncThrottleTest extends BaseJettyTest {
assertMockEndpointsSatisfied();
int size = getMockEndpoint("mock:result").getReceivedExchanges().size();
-
+
for (int i = 0; i < size; i++) {
Exchange exchange = getMockEndpoint("mock:result").getReceivedExchanges().get(i);
log.info("Reply " + exchange);
@@ -53,23 +54,13 @@ public class JettyAsyncThrottleTest extends BaseJettyTest {
int port2 = getNextPort();
int port3 = getNextPort();
- from("jetty:http://localhost:{{port}}/myservice")
- .removeHeaders("*")
- .throttle(2).asyncDelayed()
- .loadBalance().failover()
- .to("http://localhost:" + port2 + "/foo")
- .to("http://localhost:" + port3 + "/bar")
- .end()
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").removeHeaders("*").throttle(2).asyncDelayed().loadBalance().failover().to("http://localhost:" + port2 + "/foo")
+ .to("http://localhost:" + port3 + "/bar").end().to("mock:result");
- from("jetty:http://localhost:" + port2 + "/foo")
- .transform().constant("foo")
- .to("mock:foo");
+ from("jetty:http://localhost:" + port2 + "/foo").transform().constant("foo").to("mock:foo");
- from("jetty:http://localhost:" + port3 + "/bar")
- .transform().constant("bar")
- .to("mock:bar");
+ from("jetty:http://localhost:" + port3 + "/bar").transform().constant("bar").to("mock:bar");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
index 31741e1..5ed94e3 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
@@ -39,14 +39,9 @@ public class JettyAsyncTransformTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .to("log:foo")
- .convertBodyTo(String.class)
- .transform(constant("Hello World"))
- .to("async:hi:world")
- .transform(constant("Bye World"))
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").to("log:foo").convertBodyTo(String.class).transform(constant("Hello World")).to("async:hi:world")
+ .transform(constant("Bye World")).to("mock:result");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTryCatchFinallyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTryCatchFinallyTest.java
index e05dd76..8c5edd9 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTryCatchFinallyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTryCatchFinallyTest.java
@@ -42,20 +42,9 @@ public class JettyAsyncTryCatchFinallyTest extends BaseJettyTest {
public void configure() throws Exception {
context.addComponent("async", new MyAsyncComponent());
- from("jetty:http://localhost:{{port}}/myservice")
- .convertBodyTo(String.class)
- .doTry()
- .to("mock:try")
- .throwException(new IllegalArgumentException("Damn"))
- .doCatch(IllegalArgumentException.class)
- .to("mock:catch")
- .to("async:bye:camel")
- .doFinally()
- .to("mock:finally")
- .to("async:bye:world")
- .end()
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myservice").convertBodyTo(String.class).doTry().to("mock:try").throwException(new IllegalArgumentException("Damn"))
+ .doCatch(IllegalArgumentException.class).to("mock:catch").to("async:bye:camel").doFinally().to("mock:finally").to("async:bye:world").end().to("mock:result");
}
};
}
-}
\ No newline at end of file
+}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncComponent.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncComponent.java
index 73b3646..f9887b2 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncComponent.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncComponent.java
@@ -32,7 +32,7 @@ public class MyAsyncComponent extends DefaultComponent {
}
private String prepareReply(String value) {
- // to make URIs valid we make the conventions of using ':' for ' ' and
+ // to make URIs valid we make the conventions of using ':' for ' ' and
// capitalize words
String[] words = value.split(":");
String result = "";
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncProducer.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncProducer.java
index e98fb51..2cca9c7 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncProducer.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/MyAsyncProducer.java
@@ -37,7 +37,7 @@ public class MyAsyncProducer extends DefaultAsyncProducer {
@Override
public MyAsyncEndpoint getEndpoint() {
- return (MyAsyncEndpoint) super.getEndpoint();
+ return (MyAsyncEndpoint)super.getEndpoint();
}
@Override
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/file/JettyFileConsumerTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/file/JettyFileConsumerTest.java
index 94a806e..7854b54 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/file/JettyFileConsumerTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/file/JettyFileConsumerTest.java
@@ -51,14 +51,14 @@ public class JettyFileConsumerTest extends BaseJettyTest {
File src = new File("src/test/resources/log4j2.properties");
testingSendingFile(src);
}
-
+
@Test
@Ignore
public void testSending18k() throws Exception {
File src = new File("src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java");
testingSendingFile(src);
}
-
+
@Test
public void testSendBinaryFile() throws Exception {
deleteDirectory("target/test");
@@ -69,7 +69,7 @@ public class JettyFileConsumerTest extends BaseJettyTest {
assertTrue("The uploaded file should exists", des.exists());
assertEquals("This two file should have same size", jpg.length(), des.length());
}
-
+
@Test
public void testSendBinaryFileUsingCamelRoute() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(1);
@@ -89,20 +89,13 @@ public class JettyFileConsumerTest extends BaseJettyTest {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .to("file://target/test?fileName=temp.xml")
- .setBody(constant("OK"));
-
- from("jetty:http://localhost:{{port}}/myapp/myservice2")
- .to("log:foo?showAll=true")
- .to("file://target/test?fileName=java.jpg")
- .setBody(constant("OK"));
-
- from("file://target/binary?noop=true")
- .to("http://localhost:{{port}}/myapp/myservice2")
- .to("mock:result");
+ from("jetty:http://localhost:{{port}}/myapp/myservice").to("file://target/test?fileName=temp.xml").setBody(constant("OK"));
+
+ from("jetty:http://localhost:{{port}}/myapp/myservice2").to("log:foo?showAll=true").to("file://target/test?fileName=java.jpg").setBody(constant("OK"));
+
+ from("file://target/binary?noop=true").to("http://localhost:{{port}}/myapp/myservice2").to("mock:result");
}
};
- }
+ }
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
index 343f725..4f3d0ef 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
@@ -45,28 +45,27 @@ public class HttpJavaBodyTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
- assertNotNull(cool);
-
- assertEquals(123, cool.getId());
- assertEquals("Camel", cool.getName());
-
- // we send back plain test
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/plain");
- exchange.getOut().setBody("OK");
- }
- });
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
+ assertNotNull(cool);
+
+ assertEquals(123, cool.getId());
+ assertEquals("Camel", cool.getName());
+
+ // we send back plain test
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/plain");
+ exchange.getOut().setBody("OK");
+ }
+ });
}
});
context.start();
MyCoolBean cool = new MyCoolBean(123, "Camel");
- String reply = template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool,
- Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, String.class);
+ String reply = template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool, Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT,
+ String.class);
assertEquals("OK", reply);
}
@@ -82,28 +81,27 @@ public class HttpJavaBodyTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
- assertNotNull(cool);
-
- assertEquals(123, cool.getId());
- assertEquals("Camel", cool.getName());
-
- MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
- exchange.getOut().setBody(reply);
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
- }
- });
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
+ assertNotNull(cool);
+
+ assertEquals(123, cool.getId());
+ assertEquals("Camel", cool.getName());
+
+ MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+ exchange.getOut().setBody(reply);
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+ }
+ });
}
});
context.start();
MyCoolBean cool = new MyCoolBean(123, "Camel");
- MyCoolBean reply = template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool,
- Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, MyCoolBean.class);
+ MyCoolBean reply = template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool, Exchange.CONTENT_TYPE,
+ HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, MyCoolBean.class);
assertEquals(456, reply.getId());
assertEquals("Camel rocks", reply.getName());
@@ -120,18 +118,17 @@ public class HttpJavaBodyTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- assertNotNull(body);
- assertEquals("Hello World", body);
-
- MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
- exchange.getOut().setBody(reply);
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
- }
- });
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ assertNotNull(body);
+ assertEquals("Hello World", body);
+
+ MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+ exchange.getOut().setBody(reply);
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+ }
+ });
}
});
context.start();
@@ -155,18 +152,17 @@ public class HttpJavaBodyTest extends BaseJettyTest {
public void configure() throws Exception {
onException(Exception.class).to("mock:error");
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- assertNotNull(body);
- assertEquals("Hello World", body);
-
- MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
- exchange.getOut().setBody(reply);
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
- }
- });
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ assertNotNull(body);
+ assertEquals("Hello World", body);
+
+ MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+ exchange.getOut().setBody(reply);
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+ }
+ });
}
});
context.start();
@@ -190,18 +186,17 @@ public class HttpJavaBodyTest extends BaseJettyTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- assertNotNull(body);
- assertEquals("Hello World", body);
-
- MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
- exchange.getOut().setBody(reply);
- exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
- }
- });
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ assertNotNull(body);
+ assertEquals("Hello World", body);
+
+ MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+ exchange.getOut().setBody(reply);
+ exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+ }
+ });
}
});
context.start();
@@ -209,8 +204,8 @@ public class HttpJavaBodyTest extends BaseJettyTest {
MyCoolBean cool = new MyCoolBean(123, "Camel");
try {
- template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool,
- Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, MyCoolBean.class);
+ template.requestBodyAndHeader("http://localhost:{{port}}/myapp/myservice", cool, Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT,
+ MyCoolBean.class);
fail("Should fail");
} catch (CamelExecutionException e) {
HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/manual/JettyManual.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/manual/JettyManual.java
index ad122fd..106c989 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/manual/JettyManual.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/manual/JettyManual.java
@@ -26,8 +26,8 @@ import org.junit.Ignore;
import org.junit.Test;
/**
- * Used for manual unit test, eg to curl to upload a file with:
- * curl -F data=@src/test/data/plain.txt http://localhost:9080/myapp/myservice
+ * Used for manual unit test, eg to curl to upload a file with: curl -F
+ * data=@src/test/data/plain.txt http://localhost:9080/myapp/myservice
*/
public class JettyManual extends CamelTestSupport {
@@ -44,15 +44,12 @@ public class JettyManual extends CamelTestSupport {
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:" + AvailablePortFinder.getNextAvailable() + "/ myapp / myservice")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String body = exchange.getIn().getBody(String.class);
- assertNotNull("Body should not be null", body);
- }
- })
- .transform(constant("OK")).setHeader("Content-Type", constant("text/plain"))
- .to("mock:result");
+ from("jetty:http://localhost:" + AvailablePortFinder.getNextAvailable() + "/ myapp / myservice").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ assertNotNull("Body should not be null", body);
+ }
+ }).transform(constant("OK")).setHeader("Content-Type", constant("text/plain")).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTest.java
index d92ca61..ca54a97 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTest.java
@@ -73,11 +73,9 @@ public class HttpClientProxyTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:cool")
- .to("http://localhost:{{port}}/myapp/myservice");
+ from("direct:cool").to("http://localhost:{{port}}/myapp/myservice");
- from("jetty:http://localhost:{{port}}/myapp/myservice")
- .bean(MyCoolServiceBean.class);
+ from("jetty:http://localhost:{{port}}/myapp/myservice").bean(MyCoolServiceBean.class);
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTransferExceptionTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTransferExceptionTest.java
index 947a451..5be3327 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTransferExceptionTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/HttpClientProxyTransferExceptionTest.java
@@ -66,11 +66,9 @@ public class HttpClientProxyTransferExceptionTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:cool")
- .to("http://localhost:{{port}}/myapp/myservice?transferException=true");
+ from("direct:cool").to("http://localhost:{{port}}/myapp/myservice?transferException=true");
- from("jetty:http://localhost:{{port}}/myapp/myservice?transferException=true")
- .bean(MyCoolServiceBean.class);
+ from("jetty:http://localhost:{{port}}/myapp/myservice?transferException=true").bean(MyCoolServiceBean.class);
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/JettyChuckedFalseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/JettyChuckedFalseTest.java
index 4b02e22..808765a 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/JettyChuckedFalseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/JettyChuckedFalseTest.java
@@ -26,32 +26,33 @@ import org.apache.camel.util.IOHelper;
import org.junit.Test;
public class JettyChuckedFalseTest extends BaseJettyTest {
-
+
@Test
public void runningTest() throws Exception {
Exchange exchange = template.request("http://localhost:{{port}}/test", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
- // we do nothing here, so http producer will send a GET method request
+ // we do nothing here, so http producer will send a GET method
+ // request
}
-
+
});
- Message out = exchange.getOut();
+ Message out = exchange.getOut();
// make sure we have the content-length header
String len = out.getHeader(Exchange.CONTENT_LENGTH, String.class);
assertEquals("We should have the content-length header here.", "20", len);
String response = out.getBody(String.class);
assertEquals("Get a wrong response", "This is hello world.", response);
}
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
-
- from("jetty:http://localhost:{{port}}/test?matchOnUriPrefix=true&chunked=false")
- .to("http://localhost:{{port2}}/other?bridgeEndpoint=true");
-
+
+ from("jetty:http://localhost:{{port}}/test?matchOnUriPrefix=true&chunked=false").to("http://localhost:{{port2}}/other?bridgeEndpoint=true");
+
from("jetty:http://localhost:{{port2}}/other").process(new Processor() {
@Override
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiJettyTest.java
index 3dd0348..5518a62 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiJettyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiJettyTest.java
@@ -48,20 +48,14 @@ public class RestApiJettyTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc")
- .apiProperty("cors", "true").apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3");
-
- rest("/hello").consumes("application/json").produces("application/json")
- .get("/hi/{name}").description("Saying hi")
- .param().name("name").type(RestParamType.path).dataType("string").description("Who is it").endParam()
- .to("log:hi")
- .get("/bye/{name}").description("Saying bye")
- .param().name("name").type(RestParamType.path).dataType("string").description("Who is it").endParam()
- .responseMessage().code(200).message("A reply message").endResponseMessage()
- .to("log:bye")
- .post("/bye").description("To update the greeting message").consumes("application/xml").produces("application/xml")
- .param().name("greeting").type(RestParamType.body).dataType("string").description("Message to use as greeting").endParam()
- .to("log:bye");
+ restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc").apiProperty("cors", "true")
+ .apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3");
+
+ rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}").description("Saying hi").param().name("name").type(RestParamType.path)
+ .dataType("string").description("Who is it").endParam().to("log:hi").get("/bye/{name}").description("Saying bye").param().name("name").type(RestParamType.path)
+ .dataType("string").description("Who is it").endParam().responseMessage().code(200).message("A reply message").endResponseMessage().to("log:bye").post("/bye")
+ .description("To update the greeting message").consumes("application/xml").produces("application/xml").param().name("greeting").type(RestParamType.body)
+ .dataType("string").description("Message to use as greeting").endParam().to("log:bye");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
index bc450f0..b087826 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
@@ -48,20 +48,14 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc").apiHost("mycoolserver/myapi")
- .apiProperty("cors", "true").apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3");
-
- rest("/hello").consumes("application/json").produces("application/json")
- .get("/hi/{name}").description("Saying hi")
- .param().name("name").type(RestParamType.path).dataType("string").description("Who is it").endParam()
- .to("log:hi")
- .get("/bye/{name}").description("Saying bye")
- .param().name("name").type(RestParamType.path).dataType("string").description("Who is it").endParam()
- .responseMessage().code(200).message("A reply message").endResponseMessage()
- .to("log:bye")
- .post("/bye").description("To update the greeting message").consumes("application/xml").produces("application/xml")
- .param().name("greeting").type(RestParamType.body).dataType("string").description("Message to use as greeting").endParam()
- .to("log:bye");
+ restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc").apiHost("mycoolserver/myapi").apiProperty("cors", "true")
+ .apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3");
+
+ rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}").description("Saying hi").param().name("name").type(RestParamType.path)
+ .dataType("string").description("Who is it").endParam().to("log:hi").get("/bye/{name}").description("Saying bye").param().name("name").type(RestParamType.path)
+ .dataType("string").description("Who is it").endParam().responseMessage().code(200).message("A reply message").endResponseMessage().to("log:bye").post("/bye")
+ .description("To update the greeting message").consumes("application/xml").produces("application/xml").param().name("greeting").type(RestParamType.body)
+ .dataType("string").description("Message to use as greeting").endParam().to("log:bye");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestBridgeEndpointTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestBridgeEndpointTest.java
index 5c45773..b078701 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestBridgeEndpointTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestBridgeEndpointTest.java
@@ -42,9 +42,7 @@ public class RestBridgeEndpointTest extends BaseJettyTest {
rest("/api/").get("/{id}/").to("http://localhost:" + getPort2() + "?bridgeEndpoint=true");
- from("jetty:http://localhost:" + getPort2() + "?matchOnUriPrefix=true")
- .to("mock:result")
- .transform().simple("Bye ${header.id}");
+ from("jetty:http://localhost:" + getPort2() + "?matchOnUriPrefix=true").to("mock:result").transform().simple("Bye ${header.id}");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestHttpsClientAuthRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestHttpsClientAuthRouteTest.java
index 3f30f47..7c5038e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestHttpsClientAuthRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestHttpsClientAuthRouteTest.java
@@ -38,7 +38,6 @@ public class RestHttpsClientAuthRouteTest extends CamelTestSupport {
@Produce("direct:start")
protected ProducerTemplate sender;
-
@Test
public void testGETClientRoute() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -95,17 +94,12 @@ public class RestHttpsClientAuthRouteTest extends CamelTestSupport {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- RestConfigurationDefinition restConfig =
- restConfiguration("jetty").scheme("https").host("localhost").port(port);
+ RestConfigurationDefinition restConfig = restConfiguration("jetty").scheme("https").host("localhost").port(port);
decorateRestConfiguration(restConfig);
- rest("/TestParams")
- .get().to("direct:get1")
- .post().to("direct:post1");
+ rest("/TestParams").get().to("direct:get1").post().to("direct:post1");
- rest("/TestResource")
- .get("/{id}").to("direct:get1")
- .post("/{id}").to("direct:post1");
+ rest("/TestResource").get("/{id}").to("direct:get1").post("/{id}").to("direct:post1");
from("direct:get1").process(new Processor() {
public void process(Exchange exchange) throws Exception {
@@ -123,9 +117,7 @@ public class RestHttpsClientAuthRouteTest extends CamelTestSupport {
}
});
- from("direct:start")
- .toF(getClientURI(), port)
- .to("mock:result");
+ from("direct:start").toF(getClientURI(), port).to("mock:result");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
index e277c36..44c71b1 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
@@ -24,13 +24,10 @@ import org.apache.camel.http.common.HttpOperationFailedException;
import org.junit.Test;
public class RestJettyAcceptTest extends BaseJettyTest {
-
+
@Test
public void testJettyProducerNoAccept() throws Exception {
- String out = fluentTemplate
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
+ String out = fluentTemplate.withHeader(Exchange.HTTP_METHOD, "post").withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update")
.request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
@@ -38,12 +35,8 @@ public class RestJettyAcceptTest extends BaseJettyTest {
@Test
public void testJettyProducerAcceptValid() throws Exception {
- String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
}
@@ -51,12 +44,8 @@ public class RestJettyAcceptTest extends BaseJettyTest {
@Test
public void testJettyProducerAcceptInvalid() throws Exception {
try {
- fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/xml")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/xml").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
@@ -77,10 +66,7 @@ public class RestJettyAcceptTest extends BaseJettyTest {
.clientRequestValidation(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("{id}/update").consumes("application/json").produces("application/json")
- .route()
- .setBody(constant("{ \"status\": \"ok\" }"));
+ rest("/users/").post("{id}/update").consumes("application/json").produces("application/json").route().setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
index 8063517..6b2649e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
@@ -49,9 +49,7 @@ public class RestJettyBindingModeAutoWithJsonTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").consumes("application/json").type(UserPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").consumes("application/json").type(UserPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithXmlTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithXmlTest.java
index 4b8b981..257a383 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithXmlTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithXmlTest.java
@@ -49,9 +49,7 @@ public class RestJettyBindingModeAutoWithXmlTest extends BaseJettyTest {
restConfiguration().component("jetty").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");
+ rest("/users/").post("new").consumes("application/xml").type(UserJaxbPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonTest.java
index ce1a7fa..cd7816b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonTest.java
@@ -66,9 +66,7 @@ public class RestJettyBindingModeJsonTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserJaxbPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserJaxbPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonWithContractTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonWithContractTest.java
index b8f97d6..6346d5b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonWithContractTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeJsonWithContractTest.java
@@ -42,7 +42,7 @@ public class RestJettyBindingModeJsonWithContractTest extends BaseJettyTest {
BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream)answer));
String line;
String answerString = "";
- while ((line = reader.readLine()) != null) {
+ while ((line = reader.readLine()) != null) {
answerString += line;
}
assertTrue("Unexpected response: " + answerString, answerString.contains("\"active\":true"));
@@ -68,11 +68,9 @@ public class RestJettyBindingModeJsonWithContractTest extends BaseJettyTest {
rest("/users/")
// REST binding converts from JSON to UserPojo
- .post("new").type(UserPojo.class)
- .route()
- // then contract advice converts from UserPojo to UserPojoEx
- .inputType(UserPojoEx.class)
- .to("mock:input");
+ .post("new").type(UserPojo.class).route()
+ // then contract advice converts from UserPojo to UserPojoEx
+ .inputType(UserPojoEx.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeOffWithContractTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeOffWithContractTest.java
index ea1dd70..31fe69d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeOffWithContractTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeOffWithContractTest.java
@@ -43,7 +43,7 @@ public class RestJettyBindingModeOffWithContractTest extends BaseJettyTest {
BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream)answer));
String line;
String answerString = "";
- while ((line = reader.readLine()) != null) {
+ while ((line = reader.readLine()) != null) {
answerString += line;
}
assertTrue("Unexpected response: " + answerString, answerString.contains("\"active\":true"));
@@ -70,25 +70,16 @@ public class RestJettyBindingModeOffWithContractTest extends BaseJettyTest {
jsondf.setLibrary(JsonLibrary.Jackson);
jsondf.setAllowUnmarshallType(true);
jsondf.setUnmarshalType(UserPojoEx.class);
- transformer()
- .fromType("json")
- .toType(UserPojoEx.class)
- .withDataFormat(jsondf);
- transformer()
- .fromType(UserPojoEx.class)
- .toType("json")
- .withDataFormat(jsondf);
+ transformer().fromType("json").toType(UserPojoEx.class).withDataFormat(jsondf);
+ transformer().fromType(UserPojoEx.class).toType("json").withDataFormat(jsondf);
rest("/users/")
// REST binding does nothing
- .post("new")
- .route()
- // contract advice converts betweeen JSON and UserPojoEx directly
- .inputType(UserPojoEx.class)
- .outputType("json")
- .process(ex -> {
- ex.getIn().getBody(UserPojoEx.class).setActive(true);
- })
- .to("mock:input");
+ .post("new").route()
+ // contract advice converts betweeen JSON and UserPojoEx
+ // directly
+ .inputType(UserPojoEx.class).outputType("json").process(ex -> {
+ ex.getIn().getBody(UserPojoEx.class).setActive(true);
+ }).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeXmlTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeXmlTest.java
index 3cee3e6..8d6d55e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeXmlTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeXmlTest.java
@@ -66,9 +66,7 @@ public class RestJettyBindingModeXmlTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.xml);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserJaxbPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserJaxbPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
index 830d195..5bf558e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
@@ -24,13 +24,10 @@ import org.apache.camel.http.common.HttpOperationFailedException;
import org.junit.Test;
public class RestJettyContentTypeTest extends BaseJettyTest {
-
+
@Test
public void testJettyProducerNoContentType() throws Exception {
- String out = fluentTemplate
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
+ String out = fluentTemplate.withHeader(Exchange.HTTP_METHOD, "post").withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update")
.request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
@@ -38,11 +35,8 @@ public class RestJettyContentTypeTest extends BaseJettyTest {
@Test
public void testJettyProducerContentTypeValid() throws Exception {
- String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader(Exchange.HTTP_METHOD, "post").withBody("{ \"name\": \"Donald Duck\" }")
+ .to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
}
@@ -50,11 +44,8 @@ public class RestJettyContentTypeTest extends BaseJettyTest {
@Test
public void testJettyProducerContentTypeInvalid() throws Exception {
try {
- fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/xml")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("<name>Donald Duck</name>")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/xml").withHeader(Exchange.HTTP_METHOD, "post").withBody("<name>Donald Duck</name>")
+ .to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
@@ -75,10 +66,7 @@ public class RestJettyContentTypeTest extends BaseJettyTest {
.clientRequestValidation(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("{id}/update").consumes("application/json").produces("application/json")
- .route()
- .setBody(constant("{ \"status\": \"ok\" }"));
+ rest("/users/").post("{id}/update").consumes("application/json").produces("application/json").route().setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyCustomContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyCustomContentTypeTest.java
index d4eea9f..7981459 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyCustomContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyCustomContentTypeTest.java
@@ -36,7 +36,7 @@ public class RestJettyCustomContentTypeTest extends BaseJettyTest {
assertEquals("application/foobar", out.getOut().getHeader(Exchange.CONTENT_TYPE));
assertEquals("Some foobar stuff goes here", out.getOut().getBody(String.class));
}
-
+
@Test
public void testJSon() throws Exception {
Exchange out = template.request("http://localhost:" + getPort() + "/users/lives", new Processor() {
@@ -57,14 +57,11 @@ public class RestJettyCustomContentTypeTest extends BaseJettyTest {
// enable json binding
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json);
- rest("/users/").consumes("application/json").produces("application/json")
- .get("blob").to("direct:blob")
- .get("lives").to("direct:lives");
+ rest("/users/").consumes("application/json").produces("application/json").get("blob").to("direct:blob").get("lives").to("direct:lives");
from("direct:blob")
// but send back non json data
- .setHeader(Exchange.CONTENT_TYPE, constant("application/foobar"))
- .transform().constant("Some foobar stuff goes here");
+ .setHeader(Exchange.CONTENT_TYPE, constant("application/foobar")).transform().constant("Some foobar stuff goes here");
CountryPojo country = new CountryPojo();
country.setIso("EN");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetCorsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetCorsTest.java
index 23c9463..7b3476a 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetCorsTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetCorsTest.java
@@ -24,7 +24,7 @@ import org.apache.camel.spi.RestConfiguration;
import org.junit.Test;
public class RestJettyGetCorsTest extends BaseJettyTest {
-
+
@Test
public void testCors() throws Exception {
// send OPTIONS first which should not be routed
@@ -64,16 +64,12 @@ public class RestJettyGetCorsTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).enableCORS(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
index ad8354d..5ff53cb 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
@@ -23,7 +23,7 @@ import org.apache.camel.component.jetty.BaseJettyTest;
import org.junit.Test;
public class RestJettyGetTest extends BaseJettyTest {
-
+
@Test
public void testJettyProducerGet() throws Exception {
String out = template.requestBody("http://localhost:" + getPort() + "/users/123/basic", null, String.class);
@@ -39,16 +39,12 @@ public class RestJettyGetTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort());
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyMethodNotAllowedTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyMethodNotAllowedTest.java
index e7bbed9..cf05d22 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyMethodNotAllowedTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyMethodNotAllowedTest.java
@@ -34,7 +34,7 @@ public class RestJettyMethodNotAllowedTest extends BaseJettyTest {
assertEquals(405, hofe.getStatusCode());
}
}
-
+
@Test
public void testMethodAllowed() {
try {
@@ -53,14 +53,10 @@ public class RestJettyMethodNotAllowedTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort());
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(exchange -> {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(exchange -> {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyOptionsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyOptionsTest.java
index 6321bd2..ce8a55a 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyOptionsTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyOptionsTest.java
@@ -66,15 +66,7 @@ public class RestJettyOptionsTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort());
// use the rest DSL to define the rest services
- rest("/users/")
- .get("v1/customers")
- .to("mock:customers")
- .put("v1/id/{id}")
- .to("mock:id")
- .get("v2/options")
- .to("mock:options")
- .post("v2/options")
- .to("mock:options");
+ rest("/users/").get("v1/customers").to("mock:customers").put("v1/id/{id}").to("mock:id").get("v2/options").to("mock:options").post("v2/options").to("mock:options");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
index f3d4c01..0b8de0d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
@@ -31,7 +31,7 @@ public class RestJettyPojoInOutTest extends BaseJettyTest {
assertNotNull(out);
assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
}
-
+
@Test
public void testJettyGetRequest() throws Exception {
String out = template.requestBody("http://localhost:" + getPort() + "/users/lives", null, String.class);
@@ -52,11 +52,8 @@ public class RestJettyPojoInOutTest extends BaseJettyTest {
// use the rest DSL to define the rest services
rest("/users/")
// just return the default country here
- .get("lives").to("direct:start")
- .post("lives").type(UserPojo.class).outType(CountryPojo.class)
- .route()
- .bean(new UserService(), "livesWhere");
-
+ .get("lives").to("direct:start").post("lives").type(UserPojo.class).outType(CountryPojo.class).route().bean(new UserService(), "livesWhere");
+
CountryPojo country = new CountryPojo();
country.setIso("EN");
country.setCountry("England");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonJaxbPojoTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonJaxbPojoTest.java
index 84ae5a6..1789102 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonJaxbPojoTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonJaxbPojoTest.java
@@ -51,9 +51,7 @@ public class RestJettyPostJsonJaxbPojoTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserJaxbPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserJaxbPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoDisableFeatureTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoDisableFeatureTest.java
index 97d2115..fc5f0c4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoDisableFeatureTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoDisableFeatureTest.java
@@ -48,13 +48,11 @@ public class RestJettyPostJsonPojoDisableFeatureTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
// configure json to not fail on unknown properties
- restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json)
- .dataFormatProperty("json.in.disableFeatures", "FAIL_ON_UNKNOWN_PROPERTIES");
+ restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json).dataFormatProperty("json.in.disableFeatures",
+ "FAIL_ON_UNKNOWN_PROPERTIES");
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoListTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoListTest.java
index 6972292..fa4ee36 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoListTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoListTest.java
@@ -40,10 +40,10 @@ public class RestJettyPostJsonPojoListTest extends BaseJettyTest {
assertNotNull(list);
assertEquals(2, list.size());
- UserPojo user = (UserPojo) list.get(0);
+ UserPojo user = (UserPojo)list.get(0);
assertEquals(123, user.getId());
assertEquals("Donald Duck", user.getName());
- user = (UserPojo) list.get(1);
+ user = (UserPojo)list.get(1);
assertEquals(456, user.getId());
assertEquals("John Doe", user.getName());
}
@@ -58,9 +58,7 @@ public class RestJettyPostJsonPojoListTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserPojo[].class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserPojo[].class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoTest.java
index 591ffea..db50d42 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostJsonPojoTest.java
@@ -51,9 +51,7 @@ public class RestJettyPostJsonPojoTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
index 2eb6cfd..060b1a1 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
@@ -42,18 +42,14 @@ public class RestJettyPostNotMapHttpMessageHeadersTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
// configure to use jetty on localhost with the given port
- //ensure we don't extract key=value pairs from form bodies
- //(application/x-www-form-urlencoded)
- restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json)
- .endpointProperty("mapHttpMessageBody", "false")
+ // ensure we don't extract key=value pairs from form bodies
+ // (application/x-www-form-urlencoded)
+ restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json).endpointProperty("mapHttpMessageBody", "false")
.endpointProperty("mapHttpMessageHeaders", "false");
-
+
// use the rest DSL to define the rest services
- rest("/rest")
- .post("/test").produces("application/json")
- .to("direct:test");
- from("direct:test").log("*** ${body}").removeHeaders("Content-Type*")
- .setBody().simple("OK");
+ rest("/rest").post("/test").produces("application/json").to("direct:test");
+ from("direct:test").log("*** ${body}").removeHeaders("Content-Type*").setBody().simple("OK");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostXmlJaxbPojoTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostXmlJaxbPojoTest.java
index 808c3de..74bc4d4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostXmlJaxbPojoTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostXmlJaxbPojoTest.java
@@ -69,9 +69,7 @@ public class RestJettyPostXmlJaxbPojoTest extends BaseJettyTest {
restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("new").type(UserJaxbPojo.class)
- .to("mock:input");
+ rest("/users/").post("new").type(UserJaxbPojo.class).to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRemoveAddRestAndRouteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRemoveAddRestAndRouteTest.java
index b6f9e43..5207f82 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRemoveAddRestAndRouteTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRemoveAddRestAndRouteTest.java
@@ -51,15 +51,15 @@ public class RestJettyRemoveAddRestAndRouteTest extends BaseJettyTest {
new RouteBuilder(context) {
@Override
public void configure() throws Exception {
- rest("/")
- .get("/issues/{isin}/{sedol}").route().id("issues")
- .process(e -> e.getOut().setBody("Here's your issue " + e.getIn().getHeader("isin") + ":" + e.getIn().getHeader("sedol")))
- .endRest();
+ rest("/").get("/issues/{isin}/{sedol}").route().id("issues")
+ .process(e -> e.getOut().setBody("Here's your issue " + e.getIn().getHeader("isin") + ":" + e.getIn().getHeader("sedol"))).endRest();
}
}.addRoutesToCamelContext(context);
// exception here since we have 2 rest configurations
- // org.apache.camel.model.rest.RestDefinition.asRouteDefinition(CamelContext camelContext) line 607 will have 2 rest contexts
- // and duplicate route definitions for the same route which will cause exception
+ // org.apache.camel.model.rest.RestDefinition.asRouteDefinition(CamelContext
+ // camelContext) line 607 will have 2 rest contexts
+ // and duplicate route definitions for the same route which will cause
+ // exception
InputStream stream = new URL("http://localhost:" + getPort() + "/issues/35/65").openStream();
assertEquals("Here's your issue 35:65", IOUtils.toString(stream));
@@ -72,11 +72,8 @@ public class RestJettyRemoveAddRestAndRouteTest extends BaseJettyTest {
public void configure() throws Exception {
restConfiguration("jetty").host("localhost").port(getPort());
- rest("/")
- .get("/issues/{isin}").route().id("issues")
- .process(e -> e.getOut().setBody("Here's your issue " + e.getIn().getHeader("isin"))).endRest()
- .get("/listings").route().id("listings")
- .process(e -> e.getOut().setBody("some listings"));
+ rest("/").get("/issues/{isin}").route().id("issues").process(e -> e.getOut().setBody("Here's your issue " + e.getIn().getHeader("isin"))).endRest().get("/listings")
+ .route().id("listings").process(e -> e.getOut().setBody("some listings"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
index 7229f48..4b79e88 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
@@ -25,15 +25,11 @@ import org.apache.camel.model.rest.RestParamType;
import org.junit.Test;
public class RestJettyRequiredBodyTest extends BaseJettyTest {
-
+
@Test
public void testJettyValid() throws Exception {
- String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
}
@@ -41,11 +37,8 @@ public class RestJettyRequiredBodyTest extends BaseJettyTest {
@Test
public void testJettyInvalid() throws Exception {
try {
- fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
@@ -66,11 +59,8 @@ public class RestJettyRequiredBodyTest extends BaseJettyTest {
.clientRequestValidation(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("{id}/update").consumes("application/json").produces("application/json")
- .param().name("body").required(true).type(RestParamType.body).endParam()
- .route()
- .setBody(constant("{ \"status\": \"ok\" }"));
+ rest("/users/").post("{id}/update").consumes("application/json").produces("application/json").param().name("body").required(true).type(RestParamType.body)
+ .endParam().route().setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
index 7ff8aee..165d240 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
@@ -25,16 +25,11 @@ import org.apache.camel.model.rest.RestParamType;
import org.junit.Test;
public class RestJettyRequiredHttpHeaderTest extends BaseJettyTest {
-
+
@Test
public void testJettyValid() throws Exception {
- String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withHeader("country", "uk")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withHeader("country", "uk").withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
}
@@ -42,12 +37,8 @@ public class RestJettyRequiredHttpHeaderTest extends BaseJettyTest {
@Test
public void testJettyInvalid() throws Exception {
try {
- fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
@@ -68,11 +59,8 @@ public class RestJettyRequiredHttpHeaderTest extends BaseJettyTest {
.clientRequestValidation(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("{id}/update").consumes("application/json").produces("application/json")
- .param().name("country").required(true).type(RestParamType.header).endParam()
- .route()
- .setBody(constant("{ \"status\": \"ok\" }"));
+ rest("/users/").post("{id}/update").consumes("application/json").produces("application/json").param().name("country").required(true).type(RestParamType.header)
+ .endParam().route().setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
index d3905b5..0c3eabf 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
@@ -25,15 +25,11 @@ import org.apache.camel.model.rest.RestParamType;
import org.junit.Test;
public class RestJettyRequiredQueryParameterTest extends BaseJettyTest {
-
+
@Test
public void testJettyValid() throws Exception {
- String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update?country=uk")
- .request(String.class);
+ String out = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update?country=uk").request(String.class);
assertEquals("{ \"status\": \"ok\" }", out);
}
@@ -41,12 +37,8 @@ public class RestJettyRequiredQueryParameterTest extends BaseJettyTest {
@Test
public void testJettyInvalid() throws Exception {
try {
- fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withHeader("Accept", "application/json")
- .withHeader(Exchange.HTTP_METHOD, "post")
- .withBody("{ \"name\": \"Donald Duck\" }")
- .to("http://localhost:" + getPort() + "/users/123/update")
- .request(String.class);
+ fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json").withHeader("Accept", "application/json").withHeader(Exchange.HTTP_METHOD, "post")
+ .withBody("{ \"name\": \"Donald Duck\" }").to("http://localhost:" + getPort() + "/users/123/update").request(String.class);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
@@ -67,11 +59,8 @@ public class RestJettyRequiredQueryParameterTest extends BaseJettyTest {
.clientRequestValidation(true);
// use the rest DSL to define the rest services
- rest("/users/")
- .post("{id}/update").consumes("application/json").produces("application/json")
- .param().name("country").required(true).type(RestParamType.query).endParam()
- .route()
- .setBody(constant("{ \"status\": \"ok\" }"));
+ rest("/users/").post("{id}/update").consumes("application/json").produces("application/json").param().name("country").required(true).type(RestParamType.query)
+ .endParam().route().setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
index d5f1d85..0256864 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
@@ -77,11 +77,8 @@ public class RestJettyVerbTest extends BaseJettyTest {
public void configure() throws Exception {
restConfiguration().component("jetty").host("localhost").port(getPort());
- rest()
- .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
- .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
- .post("/users").to("mock:create")
- .put("/users/{id}").to("mock:update")
+ rest().get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest().get("/users/{id}")
+ .route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest().post("/users").to("mock:create").put("/users/{id}").to("mock:update")
.delete("/users/{id}").to("mock:delete");
}
};
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestNoBridgeEndpointTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestNoBridgeEndpointTest.java
index c0df9ff..757937e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestNoBridgeEndpointTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestNoBridgeEndpointTest.java
@@ -42,13 +42,9 @@ public class RestNoBridgeEndpointTest extends BaseJettyTest {
rest("/api/").get("/{id}/").to("direct:foo");
- from("direct:foo")
- .removeHeaders("CamelHttp*")
- .to("http://localhost:" + getPort2());
+ from("direct:foo").removeHeaders("CamelHttp*").to("http://localhost:" + getPort2());
- from("jetty:http://localhost:" + getPort2() + "?matchOnUriPrefix=true")
- .to("mock:result")
- .transform().simple("Bye ${header.id}");
+ from("jetty:http://localhost:" + getPort2() + "?matchOnUriPrefix=true").to("mock:result").transform().simple("Bye ${header.id}");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerGetTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerGetTest.java
index 4fea6a6..f0b54e4 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerGetTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerGetTest.java
@@ -36,23 +36,18 @@ public class HttpRestProducerGetTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
restConfiguration().component("jetty").host("localhost").port(getPort())
- // use camel-http as rest client
- .producerComponent("http");
+ // use camel-http as rest client
+ .producerComponent("http");
- from("direct:start")
- .to("rest:get:users/{id}/basic");
+ from("direct:start").to("rest:get:users/{id}/basic");
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerPutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerPutTest.java
index 3cae070..3cce685 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerPutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/HttpRestProducerPutTest.java
@@ -39,13 +39,10 @@ public class HttpRestProducerPutTest extends BaseJettyTest {
// configure to use localhost with the given port
restConfiguration().producerComponent("http").component("jetty").host("localhost").port(getPort());
- from("direct:start")
- .to("rest:put:users/{id}");
+ from("direct:start").to("rest:put:users/{id}");
// use the rest DSL to define the rest services
- rest("/users/")
- .put("{id}")
- .to("mock:input");
+ rest("/users/").put("{id}").to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerApiDocTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerApiDocTest.java
index 2d1d548..eb7f743 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerApiDocTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerApiDocTest.java
@@ -34,17 +34,12 @@ public class JettyRestProducerApiDocTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
// configure to use localhost with the given port
- restConfiguration().component("jetty").producerComponent("http")
- .host("localhost").port(getPort()).producerApiDoc("hello-api.json");
+ restConfiguration().component("jetty").producerComponent("http").host("localhost").port(getPort()).producerApiDoc("hello-api.json");
- from("direct:start")
- .to("rest:get:api:hello/hi/{name}");
+ from("direct:start").to("rest:get:api:hello/hi/{name}");
// use the rest DSL to define the rest services
- rest("/api/")
- .get("hello/hi/{name}")
- .route()
- .transform().simple("Hello ${header.name}");
+ rest("/api/").get("hello/hi/{name}").route().transform().simple("Hello ${header.name}");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetTest.java
index 9c8623b..12930af 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetTest.java
@@ -38,20 +38,15 @@ public class JettyRestProducerGetTest extends BaseJettyTest {
// configure to use localhost with the given port
restConfiguration().component("jetty").producerComponent("http").host("localhost").port(getPort());
- from("direct:start")
- .to("rest:get:users/{id}/basic");
+ from("direct:start").to("rest:get:users/{id}/basic");
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetUriParameterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetUriParameterTest.java
index e661bba..c0d7b58 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetUriParameterTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerGetUriParameterTest.java
@@ -38,20 +38,15 @@ public class JettyRestProducerGetUriParameterTest extends BaseJettyTest {
// configure to use localhost with the given port
restConfiguration().component("jetty").producerComponent("http").host("localhost").port(getPort());
- from("direct:start")
- .to("rest:get:users/basic?id={id}");
+ from("direct:start").to("rest:get:users/basic?id={id}");
// use the rest DSL to define the rest services
- rest("/users/")
- .get("basic/?id={id}")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("basic/?id={id}").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerInvalidApiDocTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerInvalidApiDocTest.java
index fdb4fd1..25dc999 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerInvalidApiDocTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerInvalidApiDocTest.java
@@ -35,8 +35,7 @@ public class JettyRestProducerInvalidApiDocTest extends CamelTestSupport {
// configure to use localhost with the given port
restConfiguration().component("jetty").host("localhost");
- from("direct:start")
- .to("rest:get:api/hello/unknown/{name}?apiDoc=hello-api.json");
+ from("direct:start").to("rest:get:api/hello/unknown/{name}?apiDoc=hello-api.json");
}
});
@@ -57,8 +56,7 @@ public class JettyRestProducerInvalidApiDocTest extends CamelTestSupport {
// configure to use localhost with the given port
restConfiguration().component("jetty").host("localhost").producerApiDoc("hello-api.json");
- from("direct:start")
- .to("rest:get:api/bye/?unknown={name}");
+ from("direct:start").to("rest:get:api/bye/?unknown={name}");
}
});
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPojoInOutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPojoInOutTest.java
index a72f25a..d4c8eb5 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPojoInOutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPojoInOutTest.java
@@ -29,9 +29,7 @@ public class JettyRestProducerPojoInOutTest extends BaseJettyTest {
@Test
public void testJettyEmptyBody() throws Exception {
- String out = fluentTemplate.to("rest:get:users/lives")
- .withHeader(Exchange.CONTENT_TYPE, "application/json")
- .request(String.class);
+ String out = fluentTemplate.to("rest:get:users/lives").withHeader(Exchange.CONTENT_TYPE, "application/json").request(String.class);
assertNotNull(out);
assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
@@ -41,9 +39,7 @@ public class JettyRestProducerPojoInOutTest extends BaseJettyTest {
public void testJettyJSonBody() throws Exception {
String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
- String out = fluentTemplate.to("rest:post:users/lives")
- .withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withBody(body).request(String.class);
+ String out = fluentTemplate.to("rest:post:users/lives").withHeader(Exchange.CONTENT_TYPE, "application/json").withBody(body).request(String.class);
assertNotNull(out);
assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
@@ -55,9 +51,7 @@ public class JettyRestProducerPojoInOutTest extends BaseJettyTest {
user.setId(123);
user.setName("Donald Duck");
- String out = fluentTemplate.to("rest:post:users/lives")
- .withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withBody(user).request(String.class);
+ String out = fluentTemplate.to("rest:post:users/lives").withHeader(Exchange.CONTENT_TYPE, "application/json").withBody(user).request(String.class);
assertNotNull(out);
assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
@@ -69,10 +63,10 @@ public class JettyRestProducerPojoInOutTest extends BaseJettyTest {
user.setId(123);
user.setName("Donald Duck");
- // must provide outType parameter to tell Camel to bind the output from the REST service from json to POJO
+ // must provide outType parameter to tell Camel to bind the output from
+ // the REST service from json to POJO
CountryPojo pojo = fluentTemplate.to("rest:post:users/lives?outType=org.apache.camel.component.jetty.rest.CountryPojo")
- .withHeader(Exchange.CONTENT_TYPE, "application/json")
- .withBody(user).request(CountryPojo.class);
+ .withHeader(Exchange.CONTENT_TYPE, "application/json").withBody(user).request(CountryPojo.class);
assertNotNull(pojo);
assertEquals("EN", pojo.getIso());
@@ -86,16 +80,12 @@ public class JettyRestProducerPojoInOutTest extends BaseJettyTest {
public void configure() throws Exception {
// configure to use jetty on localhost with the given port
// and enable auto binding mode
- restConfiguration().component("jetty").producerComponent("http")
- .host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+ restConfiguration().component("jetty").producerComponent("http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
// use the rest DSL to define the rest services
rest("/users/")
- // just return the default country here
- .get("lives").to("direct:start")
- .post("lives").type(UserPojo.class).outType(CountryPojo.class)
- .route()
- .bean(new UserService(), "livesWhere");
+ // just return the default country here
+ .get("lives").to("direct:start").post("lives").type(UserPojo.class).outType(CountryPojo.class).route().bean(new UserService(), "livesWhere");
CountryPojo country = new CountryPojo();
country.setIso("EN");
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPutTest.java
index 2b69de9..4ecd33d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPutTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerPutTest.java
@@ -39,13 +39,10 @@ public class JettyRestProducerPutTest extends BaseJettyTest {
// configure to use localhost with the given port
restConfiguration().component("jetty").producerComponent("http").host("localhost").port(getPort());
- from("direct:start")
- .to("rest:put:users/{id}");
+ from("direct:start").to("rest:put:users/{id}");
// use the rest DSL to define the rest services
- rest("/users/")
- .put("{id}")
- .to("mock:input");
+ rest("/users/").put("{id}").to("mock:input");
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerThrowExceptionOnErrorTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerThrowExceptionOnErrorTest.java
index 4c48508..0f24c64 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerThrowExceptionOnErrorTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerThrowExceptionOnErrorTest.java
@@ -44,26 +44,20 @@ public class JettyRestProducerThrowExceptionOnErrorTest extends BaseJettyTest {
@Override
public void configure() throws Exception {
// configure to use localhost with the given port
- restConfiguration().component("jetty").host("localhost").port(getPort())
- .endpointProperty("throwExceptionOnFailure", "false");
+ restConfiguration().component("jetty").host("localhost").port(getPort()).endpointProperty("throwExceptionOnFailure", "false");
- from("direct:start")
- .to("rest:get:users/{id}/basic");
+ from("direct:start").to("rest:get:users/{id}/basic");
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- if ("666".equals(id)) {
- throw new IllegalArgumentException("Bad id number");
- }
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ if ("666".equals(id)) {
+ throw new IllegalArgumentException("Bad id number");
+ }
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerVerbUpperCaseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerVerbUpperCaseTest.java
index e903972..a11e708 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerVerbUpperCaseTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/producer/JettyRestProducerVerbUpperCaseTest.java
@@ -38,23 +38,18 @@ public class JettyRestProducerVerbUpperCaseTest extends BaseJettyTest {
// configure to use localhost with the given port
restConfiguration().component("jetty").host("localhost").port(getPort());
- from("direct:start")
- .to("rest:get:users/{id}/basic");
+ from("direct:start").to("rest:get:users/{id}/basic");
// use the rest DSL to define the rest services
- rest("/users/")
- .get("{id}/basic")
- .route()
- .to("mock:input")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String method = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
- assertEquals("GET", method);
-
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
+ rest("/users/").get("{id}/basic").route().to("mock:input").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String method = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
+ assertEquals("GET", method);
+
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
}
};
}