camel git commit: [CAMEL-11782] Use correct blueprint syntax

2017-09-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 19828ff57 -> 079a3ba93


[CAMEL-11782] Use correct blueprint syntax


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

Branch: refs/heads/master
Commit: 079a3ba936b45ca489393a49271b67e88a2f9daa
Parents: 19828ff
Author: Christian Schneider 
Authored: Mon Sep 18 16:56:51 2017 +0200
Committer: Christian Schneider 
Committed: Mon Sep 18 16:57:16 2017 +0200

--
 .../apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml  | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/079a3ba9/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
--
diff --git 
a/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
 
b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
index be3a9aa..2510846 100644
--- 
a/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
+++ 
b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
@@ -76,11 +76,11 @@
   
 
-   
-   
-   
-   
-   
+
+
+
+
+
  
   
 



camel git commit: [CAMEL-11552] Add javadoc to FailureEvent

2017-07-19 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 14c450425 -> b710a0790


[CAMEL-11552] Add javadoc to FailureEvent


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

Branch: refs/heads/master
Commit: b710a07905fd3787087c0b06d4af4e4b52f1
Parents: 14c4504
Author: Christian Schneider 
Authored: Wed Jul 19 09:58:29 2017 +0200
Committer: Christian Schneider 
Committed: Wed Jul 19 09:59:01 2017 +0200

--
 .../java/org/apache/camel/management/event/FailureEvent.java   | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b710a079/camel-core/src/main/java/org/apache/camel/management/event/FailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/FailureEvent.java 
b/camel-core/src/main/java/org/apache/camel/management/event/FailureEvent.java
index 28c9e5e..70ff950 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/FailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/FailureEvent.java
@@ -16,6 +16,12 @@
  */
 package org.apache.camel.management.event;
 
+/**
+ * This interface is implemented by all events that contain an exception and 
is used to
+ * retrieve the exception in a universal way.
+ *  
+ * @version
+ */
 public interface FailureEvent {
 Throwable getCause();
 }



[2/3] camel git commit: [CAMEL-11551] Use common base class for context events

2017-07-18 Thread cschneider
[CAMEL-11551] Use common base class for context events


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

Branch: refs/heads/camel-2.17.x
Commit: 23804936ad1c86bd7cd0512b4372ec046725a8d4
Parents: 6301a62
Author: Christian Schneider 
Authored: Tue Jul 18 11:06:51 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:51:03 2017 +0200

--
 .../management/event/AbstractContextEvent.java  | 40 
 .../event/CamelContextResumeFailureEvent.java   | 12 +-
 .../event/CamelContextResumedEvent.java | 13 +--
 .../event/CamelContextResumingEvent.java| 13 +--
 .../event/CamelContextStartedEvent.java | 13 +--
 .../event/CamelContextStartingEvent.java| 13 +--
 .../event/CamelContextStartupFailureEvent.java  | 12 +-
 .../event/CamelContextStopFailureEvent.java | 12 +-
 .../event/CamelContextStoppedEvent.java | 13 +--
 .../event/CamelContextStoppingEvent.java| 13 +--
 .../event/CamelContextSuspendedEvent.java   | 13 +--
 .../event/CamelContextSuspendingEvent.java  | 13 +--
 12 files changed, 62 insertions(+), 118 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/23804936/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
new file mode 100644
index 000..cd3540e
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractContextEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private CamelContext context;
+
+public AbstractContextEvent(CamelContext source) {
+super(source);
+this.context = source;
+}
+
+public CamelContext getContext() {
+return context;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/23804936/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 5e9bea4..9f2d974 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -16,35 +16,27 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.CamelContext;
 
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends EventObject {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
-private CamelContext context;
 private Throwable cause;
 
 public CamelContextResumeFailureEvent(CamelContext context, Throwable 
cause) {
 super(context);
-this.context = context;
 this.cause = cause;
 }
 
-public CamelContext getContext() {
-return context;
-}
-
 public Throwable getCause() {
 return cause;
 }
 
 @Override
 public String toString() {
-return "Failed to resume Camel: " + context.getNa

[1/3] camel git commit: [CAMEL-11551] Use base class for route events

2017-07-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 6301a62be -> 51b340a5b


[CAMEL-11551] Use base class for route events


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

Branch: refs/heads/camel-2.17.x
Commit: 4d67d8226872849c82ecec3098eebf01e4a68675
Parents: 2380493
Author: Christian Schneider 
Authored: Tue Jul 18 11:37:34 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:51:03 2017 +0200

--
 .../management/event/AbstractRouteEvent.java| 41 
 .../camel/management/event/RouteAddedEvent.java | 12 +-
 .../management/event/RouteRemovedEvent.java | 12 +-
 .../management/event/RouteStartedEvent.java | 13 +--
 .../management/event/RouteStoppedEvent.java | 13 +--
 5 files changed, 49 insertions(+), 42 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4d67d822/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
new file mode 100644
index 000..8de3be8
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractRouteEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private Route route;
+
+public AbstractRouteEvent(Route source) {
+super(source);
+this.route = source;
+}
+
+public Route getRoute() {
+return route;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4d67d822/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
index 8e19394..52f67e9 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteAddedEvent extends EventObject {
+public class RouteAddedEvent extends AbstractRouteEvent {
 
 private static final long serialVersionUID = 9155960708789798708L;
-private final Route route;
 
 public RouteAddedEvent(Route source) {
 super(source);
-this.route = source;
-}
-
-public Route getRoute() {
-return route;
 }
 
 @Override
 public String toString() {
-return "Added route: " + route.getId();
+return "Added route: " + getRoute().getId();
 }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4d67d822/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
index d08a6b3..f4f5c66 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
@@ -16,2

[3/3] camel git commit: [CAMEL-11552] Provide FailureEvent interface as a general means of retrieving the cause

2017-07-18 Thread cschneider
[CAMEL-11552] Provide FailureEvent interface as a general means of retrieving 
the cause


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

Branch: refs/heads/camel-2.17.x
Commit: 51b340a5bafb5c55945d7c2976e0dbce57e69fa1
Parents: 4d67d82
Author: Christian Schneider 
Authored: Tue Jul 18 14:28:48 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:51:04 2017 +0200

--
 .../event/CamelContextResumeFailureEvent.java   |  3 ++-
 .../event/CamelContextStartupFailureEvent.java  |  3 ++-
 .../event/CamelContextStopFailureEvent.java |  3 ++-
 .../management/event/ExchangeFailedEvent.java   |  8 +++-
 .../camel/management/event/FailureEvent.java| 21 
 .../event/ServiceStartupFailureEvent.java   |  3 ++-
 .../event/ServiceStopFailureEvent.java  |  3 ++-
 7 files changed, 38 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/51b340a5/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 9f2d974..c2f4df2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends AbstractContextEvent {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextResumeFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/51b340a5/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
index c890a59..11f31a2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStartupFailureEvent extends AbstractContextEvent {
+public class CamelContextStartupFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894567L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStartupFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/51b340a5/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
index 5ad915b..9dc4365 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStopFailureEvent extends AbstractContextEvent {
+public class CamelContextStopFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -802046840118188292L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStopFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/51b340a5/camel-c

[1/3] camel git commit: [CAMEL-11552] Provide FailureEvent interface as a general means of retrieving the cause

2017-07-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x acee0a5ce -> 4c2840eaf


[CAMEL-11552] Provide FailureEvent interface as a general means of retrieving 
the cause


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

Branch: refs/heads/camel-2.18.x
Commit: 4c2840eafba73da7a8676ab47dc9929860c9a159
Parents: 9f2660e
Author: Christian Schneider 
Authored: Tue Jul 18 14:28:48 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:05:36 2017 +0200

--
 .../event/CamelContextResumeFailureEvent.java   |  3 ++-
 .../event/CamelContextStartupFailureEvent.java  |  3 ++-
 .../event/CamelContextStopFailureEvent.java |  3 ++-
 .../management/event/ExchangeFailedEvent.java   |  8 +++-
 .../camel/management/event/FailureEvent.java| 21 
 .../event/ServiceStartupFailureEvent.java   |  3 ++-
 .../event/ServiceStopFailureEvent.java  |  3 ++-
 7 files changed, 38 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4c2840ea/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 9f2d974..c2f4df2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends AbstractContextEvent {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextResumeFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4c2840ea/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
index c890a59..11f31a2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStartupFailureEvent extends AbstractContextEvent {
+public class CamelContextStartupFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894567L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStartupFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4c2840ea/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
index 5ad915b..9dc4365 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStopFailureEvent extends AbstractContextEvent {
+public class CamelContextStopFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -802046840118188292L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStopFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 r

[3/3] camel git commit: [CAMEL-11551] Use common base class for context events

2017-07-18 Thread cschneider
[CAMEL-11551] Use common base class for context events


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

Branch: refs/heads/camel-2.18.x
Commit: 9fe4b7be7addce7e483461aeb9b1289d0ef131b4
Parents: acee0a5
Author: Christian Schneider 
Authored: Tue Jul 18 11:06:51 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:05:36 2017 +0200

--
 .../management/event/AbstractContextEvent.java  | 40 
 .../event/CamelContextResumeFailureEvent.java   | 12 +-
 .../event/CamelContextResumedEvent.java | 13 +--
 .../event/CamelContextResumingEvent.java| 13 +--
 .../event/CamelContextStartedEvent.java | 13 +--
 .../event/CamelContextStartingEvent.java| 13 +--
 .../event/CamelContextStartupFailureEvent.java  | 12 +-
 .../event/CamelContextStopFailureEvent.java | 12 +-
 .../event/CamelContextStoppedEvent.java | 13 +--
 .../event/CamelContextStoppingEvent.java| 13 +--
 .../event/CamelContextSuspendedEvent.java   | 13 +--
 .../event/CamelContextSuspendingEvent.java  | 13 +--
 12 files changed, 62 insertions(+), 118 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/9fe4b7be/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
new file mode 100644
index 000..cd3540e
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractContextEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private CamelContext context;
+
+public AbstractContextEvent(CamelContext source) {
+super(source);
+this.context = source;
+}
+
+public CamelContext getContext() {
+return context;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/9fe4b7be/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 5e9bea4..9f2d974 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -16,35 +16,27 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.CamelContext;
 
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends EventObject {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
-private CamelContext context;
 private Throwable cause;
 
 public CamelContextResumeFailureEvent(CamelContext context, Throwable 
cause) {
 super(context);
-this.context = context;
 this.cause = cause;
 }
 
-public CamelContext getContext() {
-return context;
-}
-
 public Throwable getCause() {
 return cause;
 }
 
 @Override
 public String toString() {
-return "Failed to resume Camel: " + context.getNa

[2/3] camel git commit: [CAMEL-11551] Use base class for route events

2017-07-18 Thread cschneider
[CAMEL-11551] Use base class for route events


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

Branch: refs/heads/camel-2.18.x
Commit: 9f2660e333069614ca43b4393a1acc95c99a2508
Parents: 9fe4b7b
Author: Christian Schneider 
Authored: Tue Jul 18 11:37:34 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 16:05:36 2017 +0200

--
 .../management/event/AbstractRouteEvent.java| 41 
 .../camel/management/event/RouteAddedEvent.java | 12 +-
 .../management/event/RouteRemovedEvent.java | 12 +-
 .../management/event/RouteStartedEvent.java | 13 +--
 .../management/event/RouteStoppedEvent.java | 13 +--
 5 files changed, 49 insertions(+), 42 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/9f2660e3/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
new file mode 100644
index 000..8de3be8
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractRouteEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private Route route;
+
+public AbstractRouteEvent(Route source) {
+super(source);
+this.route = source;
+}
+
+public Route getRoute() {
+return route;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/9f2660e3/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
index 8e19394..52f67e9 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteAddedEvent extends EventObject {
+public class RouteAddedEvent extends AbstractRouteEvent {
 
 private static final long serialVersionUID = 9155960708789798708L;
-private final Route route;
 
 public RouteAddedEvent(Route source) {
 super(source);
-this.route = source;
-}
-
-public Route getRoute() {
-return route;
 }
 
 @Override
 public String toString() {
-return "Added route: " + route.getId();
+return "Added route: " + getRoute().getId();
 }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/9f2660e3/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
index d08a6b3..f4f5c66 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventO

camel git commit: [CAMEL-11552] Provide FailureEvent interface as a general means of retrieving the cause

2017-07-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 4759bba2b -> 1d23ebafe


[CAMEL-11552] Provide FailureEvent interface as a general means of retrieving 
the cause


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

Branch: refs/heads/master
Commit: 1d23ebafe30009141842d62ddf1407e627e511fa
Parents: 4759bba
Author: Christian Schneider 
Authored: Tue Jul 18 14:28:48 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 14:28:48 2017 +0200

--
 .../event/CamelContextResumeFailureEvent.java   |  3 ++-
 .../event/CamelContextStartupFailureEvent.java  |  3 ++-
 .../event/CamelContextStopFailureEvent.java |  3 ++-
 .../management/event/ExchangeFailedEvent.java   |  8 +++-
 .../camel/management/event/FailureEvent.java| 21 
 .../event/ServiceStartupFailureEvent.java   |  3 ++-
 .../event/ServiceStopFailureEvent.java  |  3 ++-
 7 files changed, 38 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/1d23ebaf/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 9f2d974..c2f4df2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends AbstractContextEvent {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextResumeFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1d23ebaf/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
index c890a59..11f31a2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStartupFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStartupFailureEvent extends AbstractContextEvent {
+public class CamelContextStartupFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -4271899927507894567L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStartupFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1d23ebaf/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
index 5ad915b..9dc4365 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextStopFailureEvent.java
@@ -21,7 +21,7 @@ import org.apache.camel.CamelContext;
 /**
  * @version 
  */
-public class CamelContextStopFailureEvent extends AbstractContextEvent {
+public class CamelContextStopFailureEvent extends AbstractContextEvent 
implements FailureEvent {
 private static final long serialVersionUID = -802046840118188292L;
 
 private Throwable cause;
@@ -31,6 +31,7 @@ public class CamelContextStopFailureEvent extends 
AbstractContextEvent {
 this.cause = cause;
 }
 
+@Override
 public Throwable getCause() {
 return cause;

camel git commit: [CAMEL-11551] Use base class for route events

2017-07-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master c15fa1e20 -> 4759bba2b


[CAMEL-11551] Use base class for route events


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

Branch: refs/heads/master
Commit: 4759bba2bf99897d7998986c3db41f43eb0cf149
Parents: c15fa1e
Author: Christian Schneider 
Authored: Tue Jul 18 11:37:34 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 11:37:34 2017 +0200

--
 .../management/event/AbstractRouteEvent.java| 41 
 .../camel/management/event/RouteAddedEvent.java | 12 +-
 .../management/event/RouteRemovedEvent.java | 12 +-
 .../management/event/RouteStartedEvent.java | 13 +--
 .../management/event/RouteStoppedEvent.java | 13 +--
 5 files changed, 49 insertions(+), 42 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
new file mode 100644
index 000..8de3be8
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractRouteEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private Route route;
+
+public AbstractRouteEvent(Route source) {
+super(source);
+this.route = source;
+}
+
+public Route getRoute() {
+return route;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
index 8e19394..52f67e9 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteAddedEvent extends EventObject {
+public class RouteAddedEvent extends AbstractRouteEvent {
 
 private static final long serialVersionUID = 9155960708789798708L;
-private final Route route;
 
 public RouteAddedEvent(Route source) {
 super(source);
-this.route = source;
-}
-
-public Route getRoute() {
-return route;
 }
 
 @Override
 public String toString() {
-return "Added route: " + route.getId();
+return "Added route: " + getRoute().getId();
 }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
index d08a6b3..f4f5c66 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
@@ -16,29 +16,21 @@

camel git commit: [CAMEL-11551] Use common base class for context events

2017-07-18 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 1c47be0ad -> c15fa1e20


[CAMEL-11551] Use common base class for context events


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

Branch: refs/heads/master
Commit: c15fa1e208ada67894e83f6971ba19b69bcdf710
Parents: 1c47be0
Author: Christian Schneider 
Authored: Tue Jul 18 11:06:51 2017 +0200
Committer: Christian Schneider 
Committed: Tue Jul 18 11:06:51 2017 +0200

--
 .../management/event/AbstractContextEvent.java  | 40 
 .../event/CamelContextResumeFailureEvent.java   | 12 +-
 .../event/CamelContextResumedEvent.java | 13 +--
 .../event/CamelContextResumingEvent.java| 13 +--
 .../event/CamelContextStartedEvent.java | 13 +--
 .../event/CamelContextStartingEvent.java| 13 +--
 .../event/CamelContextStartupFailureEvent.java  | 12 +-
 .../event/CamelContextStopFailureEvent.java | 12 +-
 .../event/CamelContextStoppedEvent.java | 13 +--
 .../event/CamelContextStoppingEvent.java| 13 +--
 .../event/CamelContextSuspendedEvent.java   | 13 +--
 .../event/CamelContextSuspendingEvent.java  | 13 +--
 12 files changed, 62 insertions(+), 118 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/c15fa1e2/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
new file mode 100644
index 000..cd3540e
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractContextEvent.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractContextEvent extends EventObject {
+private static final long serialVersionUID = 1L;
+private CamelContext context;
+
+public AbstractContextEvent(CamelContext source) {
+super(source);
+this.context = source;
+}
+
+public CamelContext getContext() {
+return context;
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c15fa1e2/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
index 5e9bea4..9f2d974 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/event/CamelContextResumeFailureEvent.java
@@ -16,35 +16,27 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.CamelContext;
 
 /**
  * @version 
  */
-public class CamelContextResumeFailureEvent extends EventObject {
+public class CamelContextResumeFailureEvent extends AbstractContextEvent {
 private static final long serialVersionUID = -4271899927507894566L;
 
-private CamelContext context;
 private Throwable cause;
 
 public CamelContextResumeFailureEvent(CamelContext context, Throwable 
cause) {
 super(context);
-this.context = context;
 this.cause = cause;
 }
 
-public CamelContext getContext() {
-return context;
-}
-
 public Throwable getCause() {
 return cause;
 }
 
 @Override
 public Str

camel git commit: CAMEL-11229 Infinite recursion if exception hap...

2017-05-08 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/CAMEL-11229 175c379d4 -> d76f75ea4


CAMEL-11229 Infinite recursion if exception hap...

...pens inside exception handler

A bit simpler unit test and reformatted source code.


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

Branch: refs/heads/CAMEL-11229
Commit: d76f75ea46b55b16af9e0ae05bfbb3df271545bd
Parents: 175c379
Author: Zoran Regvart 
Authored: Mon May 8 11:54:59 2017 +0200
Committer: Zoran Regvart 
Committed: Mon May 8 11:54:59 2017 +0200

--
 .../camel/processor/RedeliveryErrorHandler.java | 75 +++-
 .../onexception/OnExceptionRecursionTest.java   | 48 ++---
 2 files changed, 47 insertions(+), 76 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/d76f75ea/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
 
b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
index bc05bbc..eb29e6c 100644
--- 
a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
+++ 
b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -853,50 +853,55 @@ public abstract class RedeliveryErrorHandler extends 
ErrorHandlerSupport impleme
 
 Throwable origExceptionCaught = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
 if (origExceptionCaught != null) {
-log.error("Second Exception occured inside exception handler. 
Failing exchange", e);
+log.error("Second Exception occurred inside exception handler. 
Failing exchange", e);
 exchange.setProperty(Exchange.UNIT_OF_WORK_EXHAUSTED, true);
 } else {
 
 // store the original caused exception in a property, so we can 
restore it later
 exchange.setProperty(Exchange.EXCEPTION_CAUGHT, e);
 
-// find the error handler to use (if any)
-OnExceptionDefinition exceptionPolicy = getExceptionPolicy(exchange, 
e);
-if (exceptionPolicy != null) {
-data.currentRedeliveryPolicy = 
exceptionPolicy.createRedeliveryPolicy(exchange.getContext(), 
data.currentRedeliveryPolicy);
-data.handledPredicate = exceptionPolicy.getHandledPolicy();
-data.continuedPredicate = exceptionPolicy.getContinuedPolicy();
-data.retryWhilePredicate = exceptionPolicy.getRetryWhilePolicy();
-data.useOriginalInMessage = 
exceptionPolicy.getUseOriginalMessagePolicy() != null && 
exceptionPolicy.getUseOriginalMessagePolicy();
-
-// route specific failure handler?
-Processor processor = null;
-UnitOfWork uow = exchange.getUnitOfWork();
-if (uow != null && uow.getRouteContext() != null) {
-String routeId = uow.getRouteContext().getRoute().getId();
-processor = exceptionPolicy.getErrorHandler(routeId);
-} else if (!exceptionPolicy.getErrorHandlers().isEmpty()) {
-// note this should really not happen, but we have this code 
as a fail safe
-// to be backwards compatible with the old behavior
-log.warn("Cannot determine current route from Exchange with 
id: {}, will fallback and use first error handler.", exchange.getExchangeId());
-processor = 
exceptionPolicy.getErrorHandlers().iterator().next();
-}
-if (processor != null) {
-data.failureProcessor = processor;
-}
+// find the error handler to use (if any)
+OnExceptionDefinition exceptionPolicy = 
getExceptionPolicy(exchange, e);
+if (exceptionPolicy != null) {
+data.currentRedeliveryPolicy = 
exceptionPolicy.createRedeliveryPolicy(exchange.getContext(),
+data.currentRedeliveryPolicy);
+data.handledPredicate = exceptionPolicy.getHandledPolicy();
+data.continuedPredicate = exceptionPolicy.getContinuedPolicy();
+data.retryWhilePredicate = 
exceptionPolicy.getRetryWhilePolicy();
+data.useOriginalInMessage = 
exceptionPolicy.getUseOriginalMessagePolicy() != null
+&& exceptionPolicy.getUseOriginalMessagePolicy();
+
+// route specific failure handler?
+Processor processor = null;
+UnitOfWork uow = exchange.getUnitOfWork();
+if (uow != null && uow.getRouteContext() != null) {
+

camel git commit: [CAMEL-11229] Avoid recursion in onException

2017-05-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/CAMEL-11229 [created] 175c379d4


[CAMEL-11229] Avoid recursion in onException


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

Branch: refs/heads/CAMEL-11229
Commit: 175c379d4031b16dfdc6fcdd1c7ea2d5b8dc5a72
Parents: 215cf2b
Author: Christian Schneider 
Authored: Fri May 5 16:32:27 2017 +0200
Committer: Christian Schneider 
Committed: Fri May 5 16:32:27 2017 +0200

--
 .../camel/processor/RedeliveryErrorHandler.java | 11 ++-
 .../onexception/OnExceptionRecursionTest.java   | 85 
 2 files changed, 94 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/175c379d/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
 
b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
index 51e6529..bc05bbc 100644
--- 
a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
+++ 
b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -851,8 +851,14 @@ public abstract class RedeliveryErrorHandler extends 
ErrorHandlerSupport impleme
 protected void handleException(Exchange exchange, RedeliveryData data, 
boolean isDeadLetterChannel) {
 Exception e = exchange.getException();
 
-// store the original caused exception in a property, so we can 
restore it later
-exchange.setProperty(Exchange.EXCEPTION_CAUGHT, e);
+Throwable origExceptionCaught = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+if (origExceptionCaught != null) {
+log.error("Second Exception occured inside exception handler. 
Failing exchange", e);
+exchange.setProperty(Exchange.UNIT_OF_WORK_EXHAUSTED, true);
+} else {
+
+// store the original caused exception in a property, so we can 
restore it later
+exchange.setProperty(Exchange.EXCEPTION_CAUGHT, e);
 
 // find the error handler to use (if any)
 OnExceptionDefinition exceptionPolicy = getExceptionPolicy(exchange, 
e);
@@ -890,6 +896,7 @@ public abstract class RedeliveryErrorHandler extends 
ErrorHandlerSupport impleme
 data.onExceptionProcessor = processor;
 }
 }
+}
 
 // only log if not failure handled or not an exhausted unit of work
 if (!ExchangeHelper.isFailureHandled(exchange) && 
!ExchangeHelper.isUnitOfWorkExhausted(exchange)) {

http://git-wip-us.apache.org/repos/asf/camel/blob/175c379d/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRecursionTest.java
--
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRecursionTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRecursionTest.java
new file mode 100644
index 000..39c5c1b
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRecursionTest.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor.onexception;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Assert;
+
+
+
+/**
+ * Test that exceptions in an onException handler route do not go into 
recursion
+ */
+public class OnExceptionRecursionTest extends ContextTestSupport {
+private int counter;
+
+public void testRecursion() throws Exception {
+try {
+template.sendBody("

camel git commit: [CAMEL-11109] Removing test again as this must be tested on the activmq-camel component not the camel-jms component

2017-04-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 3cf0fa639 -> 037da91ea


[CAMEL-11109] Removing test again as this must be tested on the activmq-camel 
component not the camel-jms component


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

Branch: refs/heads/master
Commit: 037da91eaa3534c402dfbb38d1be29d31829ca6f
Parents: 3cf0fa6
Author: Christian Schneider 
Authored: Wed Apr 5 14:05:37 2017 +0200
Committer: Christian Schneider 
Committed: Wed Apr 5 14:08:49 2017 +0200

--
 .../jms/issues/JmsExclusiveConsumerTest.java| 45 
 1 file changed, 45 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/037da91e/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
--
diff --git 
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
 
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
deleted file mode 100644
index bbf1ace..000
--- 
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jms.issues;
-
-import org.apache.camel.FailedToCreateRouteException;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.junit.Test;
-
-/**
- * See https://issues.apache.org/jira/browse/CAMEL-11109
- */
-public class JmsExclusiveConsumerTest {
-
-/**
- * @throws Exception as long as the issue is present the route creation 
will fail
- */
-@Test(expected=FailedToCreateRouteException.class)
-public void testExclusiveConsumer() throws Exception {
-DefaultCamelContext context = new DefaultCamelContext();
-context.addComponent("activemq", JmsComponent.jmsComponent());
-context.addRoutes(new RouteBuilder() {
-public void configure() throws Exception {
-
from("activemq:queue:in?destination.consumer.exclusive=true").to("mock:result");
-}
-});
-context.start();
-}
-
-}



camel git commit: [CAMEL-11109] Adding test to show the issue

2017-04-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 9613eb46e -> f1fa214fd


[CAMEL-11109] Adding test to show the issue


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

Branch: refs/heads/master
Commit: f1fa214fdb188754482bf9f0c8514acbfa741312
Parents: 9613eb4
Author: Christian Schneider 
Authored: Wed Apr 5 12:28:28 2017 +0200
Committer: Christian Schneider 
Committed: Wed Apr 5 12:28:52 2017 +0200

--
 .../jms/issues/JmsExclusiveConsumerTest.java| 45 
 1 file changed, 45 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/f1fa214f/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
--
diff --git 
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
 
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
new file mode 100644
index 000..bbf1ace
--- /dev/null
+++ 
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsExclusiveConsumerTest.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jms.issues;
+
+import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jms.JmsComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.Test;
+
+/**
+ * See https://issues.apache.org/jira/browse/CAMEL-11109
+ */
+public class JmsExclusiveConsumerTest {
+
+/**
+ * @throws Exception as long as the issue is present the route creation 
will fail
+ */
+@Test(expected=FailedToCreateRouteException.class)
+public void testExclusiveConsumer() throws Exception {
+DefaultCamelContext context = new DefaultCamelContext();
+context.addComponent("activemq", JmsComponent.jmsComponent());
+context.addRoutes(new RouteBuilder() {
+public void configure() throws Exception {
+
from("activemq:queue:in?destination.consumer.exclusive=true").to("mock:result");
+}
+});
+context.start();
+}
+
+}



camel git commit: [CAMEL-10544] Upgrade to smack 4.1

2016-12-22 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/CAMEL-10544 [created] 67e05430a


[CAMEL-10544] Upgrade to smack 4.1


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

Branch: refs/heads/CAMEL-10544
Commit: 67e05430a60111cde7fac9a9b8f70b5c7745a9a5
Parents: b13b2fb
Author: Christian Schneider 
Authored: Thu Dec 22 10:16:58 2016 +0100
Committer: Christian Schneider 
Committed: Thu Dec 22 10:16:58 2016 +0100

--
 components/camel-xmpp/pom.xml   | 10 
 .../camel/component/xmpp/XmppBinding.java   | 22 -
 .../camel/component/xmpp/XmppConsumer.java  | 50 
 .../component/xmpp/XmppDirectProducer.java  | 18 +++
 .../camel/component/xmpp/XmppEndpoint.java  | 42 
 .../component/xmpp/XmppGroupChatProducer.java   |  8 ++--
 .../apache/camel/component/xmpp/XmppLogger.java |  8 ++--
 .../camel/component/xmpp/XmppMessage.java   | 10 ++--
 .../component/xmpp/XmppPrivateChatProducer.java | 16 +++
 .../component/xmpp/XmppPubSubProducer.java  |  6 +--
 parent/pom.xml  |  2 +-
 11 files changed, 110 insertions(+), 82 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/67e05430/components/camel-xmpp/pom.xml
--
diff --git a/components/camel-xmpp/pom.xml b/components/camel-xmpp/pom.xml
index ef497bd..89c9f13 100644
--- a/components/camel-xmpp/pom.xml
+++ b/components/camel-xmpp/pom.xml
@@ -47,11 +47,21 @@
 
 
   org.igniterealtime.smack
+  smack-java7
+  ${smack-version}
+
+
+  org.igniterealtime.smack
   smack-core
   ${smack-version}
 
 
   org.igniterealtime.smack
+  smack-im
+  ${smack-version}
+
+
+  org.igniterealtime.smack
   smack-extensions
   ${smack-version}
 

http://git-wip-us.apache.org/repos/asf/camel/blob/67e05430/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
index b33bdbb..503a916 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
@@ -24,10 +24,10 @@ import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
-import org.jivesoftware.smack.packet.DefaultPacketExtension;
+import org.jivesoftware.smack.packet.DefaultExtensionElement;
+import org.jivesoftware.smack.packet.ExtensionElement;
 import org.jivesoftware.smack.packet.Message;
-import org.jivesoftware.smack.packet.Packet;
-import org.jivesoftware.smack.packet.PacketExtension;
+import org.jivesoftware.smack.packet.Stanza;
 import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
 import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
 import org.jivesoftware.smackx.pubsub.packet.PubSub;
@@ -94,7 +94,7 @@ public class XmppBinding {
 /**
  * Populates the given XMPP packet from the inbound exchange
  */
-public void populateXmppPacket(Packet packet, Exchange exchange) {
+public void populateXmppPacket(Stanza packet, Exchange exchange) {
 Set> entries = 
exchange.getIn().getHeaders().entrySet();
 for (Map.Entry entry : entries) {
 String name = entry.getKey();
@@ -118,7 +118,7 @@ public class XmppBinding {
 /**
  * Extracts the body from the XMPP message
  */
-public Object extractBodyFromXmpp(Exchange exchange, Packet xmppPacket) {
+public Object extractBodyFromXmpp(Exchange exchange, Stanza xmppPacket) {
 return (xmppPacket instanceof Message) ? getMessageBody((Message) 
xmppPacket) : xmppPacket;
 }
 
@@ -131,15 +131,15 @@ public class XmppBinding {
 return messageBody;
 }
 
-public Map extractHeadersFromXmpp(Packet xmppPacket, 
Exchange exchange) {
+public Map extractHeadersFromXmpp(Stanza xmppPacket, 
Exchange exchange) {
 Map answer = new HashMap();
 
-PacketExtension jpe = 
xmppPacket.getExtension(JivePropertiesExtension.NAMESPACE);
+ExtensionElement jpe = 
xmppPacket.getExtension(JivePropertiesExtension.NAMESPACE);
 if (jpe != null && jpe instanceof JivePropertiesExtension) {
 extractHeadersFro

camel git commit: [CAMEL-10505] FILE component - resolved FileNotFountException in Generic File Rename Exclusive Read Lock Strategy in case of work file is locked by another application

2016-11-23 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 9ef8327e7 -> 7bc1957e3


[CAMEL-10505] FILE component - resolved FileNotFountException in Generic File 
Rename Exclusive Read Lock Strategy in case of work file is locked by another 
application


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

Branch: refs/heads/camel-2.16.x
Commit: 7bc1957e37daad6c7f81a5abf0f679a2480cb790
Parents: 9ef8327
Author: apoltavt...@gmail.com 
Authored: Tue Nov 22 15:39:11 2016 +0300
Committer: Christian Schneider 
Committed: Wed Nov 23 13:51:33 2016 +0100

--
 .../GenericFileRenameExclusiveReadLockStrategy.java| 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/7bc1957e/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
index 976c965..ef5fdb1 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java
@@ -16,11 +16,14 @@
  */
 package org.apache.camel.component.file.strategy;
 
+import java.io.FileNotFoundException;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.file.GenericFileEndpoint;
 import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
 import org.apache.camel.component.file.GenericFileOperations;
 import org.apache.camel.util.CamelLogger;
 import org.apache.camel.util.StopWatch;
@@ -70,7 +73,15 @@ public class GenericFileRenameExclusiveReadLockStrategy 
implements GenericFil
 }
 }
 
-exclusive = operations.renameFile(file.getAbsoluteFilePath(), 
newFile.getAbsoluteFilePath());
+try {
+exclusive = operations.renameFile(file.getAbsoluteFilePath(), 
newFile.getAbsoluteFilePath());
+} catch (GenericFileOperationFailedException ex) {
+if (ex.getCause() != null && ex.getCause() instanceof 
FileNotFoundException) {
+exclusive = false;
+} else {
+throw ex;
+}
+}
 if (exclusive) {
 LOG.trace("Acquired exclusive read lock to file: {}", file);
 // rename it back so we can read it



camel git commit: fix CAMEL-10433 in Camel 2.16.x

2016-11-02 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 2d99f74d8 -> 3e096a5dd


fix CAMEL-10433 in Camel 2.16.x

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

Branch: refs/heads/camel-2.16.x
Commit: 3e096a5dde6a2a6c352b8ae7c9787addf739c3ac
Parents: 2d99f74
Author: Xilai Dai 
Authored: Wed Nov 2 11:17:17 2016 +0800
Committer: GitHub 
Committed: Wed Nov 2 11:17:17 2016 +0800

--
 platforms/karaf/features/src/main/resources/features.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/3e096a5d/platforms/karaf/features/src/main/resources/features.xml
--
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index b8725a5..6d61535 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -856,7 +856,7 @@
   
   
 camel-jetty intend to work with jetty8, so this feature only 
works in the karaf container which support jetty8, e.g. karaf 2.x/3.x
-jetty
+jetty
 camel-core
 mvn:org.apache.camel/camel-http-common/${project.version}
 mvn:org.apache.camel/camel-jetty-common/${project.version}
@@ -864,7 +864,7 @@
   
   
 camel-jetty9 intend to work with jetty9, so this feature only 
works in the karaf container which support jetty9, e.g. karaf 4.x
-jetty
+jetty
 camel-core
 mvn:org.apache.camel/camel-http-common/${project.version}
 mvn:org.apache.camel/camel-jetty-common/${project.version}



camel git commit: fix CAMEL-10433 in Camel 2.17.x

2016-11-02 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x a8ac8e322 -> 20775ecf3


fix CAMEL-10433 in Camel 2.17.x

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

Branch: refs/heads/camel-2.17.x
Commit: 20775ecf3b5c211ab309009e78ee7f529ae38645
Parents: a8ac8e3
Author: Xilai Dai 
Authored: Wed Nov 2 11:13:10 2016 +0800
Committer: GitHub 
Committed: Wed Nov 2 11:13:10 2016 +0800

--
 platforms/karaf/features/src/main/resources/features.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/20775ecf/platforms/karaf/features/src/main/resources/features.xml
--
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index 0b05d6e..c55956a 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -852,7 +852,7 @@
   
   
 camel-jetty8 intend to work with jetty8, so this feature only 
works in the karaf container which support jetty8, e.g. karaf 2.x/3.x
-jetty
+jetty
 camel-core
 mvn:org.apache.camel/camel-http-common/${project.version}
 mvn:org.apache.camel/camel-jetty-common/${project.version}
@@ -860,7 +860,7 @@
   
   
 camel-jetty9 intend to work with jetty9, so this feature only 
works in the karaf container which support jetty9, e.g. karaf 4.x
-jetty
+jetty
 camel-core
 mvn:org.apache.camel/camel-http-common/${project.version}
 mvn:org.apache.camel/camel-jetty-common/${project.version}



camel git commit: CAMEL-9171 Also handle DefaultPacketExtension

2015-10-08 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 8d42d7bed -> 27a2ee7cd


CAMEL-9171 Also handle DefaultPacketExtension


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

Branch: refs/heads/camel-2.16.x
Commit: 27a2ee7cda40623e842ea748706bb309c046cf4b
Parents: 8d42d7b
Author: Christian Schneider 
Authored: Thu Oct 8 15:06:18 2015 +0200
Committer: Christian Schneider 
Committed: Thu Oct 8 15:07:46 2015 +0200

--
 .../camel/component/xmpp/XmppBinding.java   | 34 
 .../camel/component/xmpp/XmppEndpoint.java  | 20 ++--
 2 files changed, 38 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/27a2ee7c/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
index 1960540..ddb198b 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
@@ -24,9 +24,12 @@ import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
+import org.jivesoftware.smack.packet.DefaultPacketExtension;
 import org.jivesoftware.smack.packet.Message;
 import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.PacketExtension;
 import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
+import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
 import org.jivesoftware.smackx.pubsub.packet.PubSub;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -131,13 +134,13 @@ public class XmppBinding {
 public Map extractHeadersFromXmpp(Packet xmppPacket, 
Exchange exchange) {
 Map answer = new HashMap();
 
-for (String name : 
JivePropertiesManager.getPropertiesNames(xmppPacket)) {
-Object value = JivePropertiesManager.getProperty(xmppPacket, name);
-
-if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
-answer.put(name, value);
-}
+PacketExtension jpe = 
xmppPacket.getExtension(JivePropertiesExtension.NAMESPACE);
+if (jpe !=null && jpe instanceof JivePropertiesExtension) {
+extractHeadersFrom((JivePropertiesExtension)jpe, exchange, answer);
 }
+if (jpe !=null && jpe instanceof DefaultPacketExtension) {
+extractHeadersFrom((DefaultPacketExtension)jpe, exchange, answer);
+}
 
 if (xmppPacket instanceof Message) {
 Message xmppMessage = (Message) xmppPacket;
@@ -154,4 +157,23 @@ public class XmppBinding {
 
 return answer;
 }
+
+private void extractHeadersFrom(JivePropertiesExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getPropertyNames()) {
+Object value = jpe.getProperty(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
+private void extractHeadersFrom(DefaultPacketExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getNames()) {
+Object value = jpe.getValue(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/27a2ee7c/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index 11da25c..041c7c1 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -150,21 +150,12 @@ public class XmppEndpoint extends DefaultEndpoint 
implements HeaderFilterStrateg
 }
 
 public synchronized XMPPConnection createConnection() throws 
XMPPException, SmackException, IOException {
-
 if (connection != null && connection.isCon

camel git commit: CAMEL-9171 Also handle DefaultPacketExtension

2015-10-08 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 3ebec4335 -> 1d9dc6220


CAMEL-9171 Also handle DefaultPacketExtension


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

Branch: refs/heads/master
Commit: 1d9dc62202c9e70267c9d5d4daaa9af7fba91664
Parents: 3ebec43
Author: Christian Schneider 
Authored: Thu Oct 8 15:06:18 2015 +0200
Committer: Christian Schneider 
Committed: Thu Oct 8 15:06:18 2015 +0200

--
 .../camel/component/xmpp/XmppBinding.java   | 34 
 .../camel/component/xmpp/XmppEndpoint.java  | 20 ++--
 2 files changed, 38 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/1d9dc622/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
index 1960540..ddb198b 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
@@ -24,9 +24,12 @@ import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
+import org.jivesoftware.smack.packet.DefaultPacketExtension;
 import org.jivesoftware.smack.packet.Message;
 import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.PacketExtension;
 import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
+import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
 import org.jivesoftware.smackx.pubsub.packet.PubSub;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -131,13 +134,13 @@ public class XmppBinding {
 public Map extractHeadersFromXmpp(Packet xmppPacket, 
Exchange exchange) {
 Map answer = new HashMap();
 
-for (String name : 
JivePropertiesManager.getPropertiesNames(xmppPacket)) {
-Object value = JivePropertiesManager.getProperty(xmppPacket, name);
-
-if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
-answer.put(name, value);
-}
+PacketExtension jpe = 
xmppPacket.getExtension(JivePropertiesExtension.NAMESPACE);
+if (jpe !=null && jpe instanceof JivePropertiesExtension) {
+extractHeadersFrom((JivePropertiesExtension)jpe, exchange, answer);
 }
+if (jpe !=null && jpe instanceof DefaultPacketExtension) {
+extractHeadersFrom((DefaultPacketExtension)jpe, exchange, answer);
+}
 
 if (xmppPacket instanceof Message) {
 Message xmppMessage = (Message) xmppPacket;
@@ -154,4 +157,23 @@ public class XmppBinding {
 
 return answer;
 }
+
+private void extractHeadersFrom(JivePropertiesExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getPropertyNames()) {
+Object value = jpe.getProperty(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
+private void extractHeadersFrom(DefaultPacketExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getNames()) {
+Object value = jpe.getValue(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1d9dc622/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index 11da25c..041c7c1 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -150,21 +150,12 @@ public class XmppEndpoint extends DefaultEndpoint 
implements HeaderFilterStrateg
 }
 
 public synchronized XMPPConnection createConnection() throws 
XMPPException, SmackException, IOException {
-
 if (connection != null && connection.isConnected()) {

[2/2] camel git commit: CAMEL-9171 Also handle DefaultPacketExtension

2015-10-08 Thread cschneider
CAMEL-9171 Also handle DefaultPacketExtension


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

Branch: refs/heads/camel-2.15.x
Commit: 44a07f9568d688d0f0c624e315aa9502979b55f0
Parents: 6194038
Author: Christian Schneider 
Authored: Thu Oct 8 15:06:18 2015 +0200
Committer: Christian Schneider 
Committed: Thu Oct 8 15:12:08 2015 +0200

--
 .../camel/component/xmpp/XmppBinding.java   | 34 
 .../camel/component/xmpp/XmppEndpoint.java  | 20 ++--
 2 files changed, 38 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/44a07f95/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
index 1960540..ddb198b 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppBinding.java
@@ -24,9 +24,12 @@ import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
+import org.jivesoftware.smack.packet.DefaultPacketExtension;
 import org.jivesoftware.smack.packet.Message;
 import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.PacketExtension;
 import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
+import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
 import org.jivesoftware.smackx.pubsub.packet.PubSub;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -131,13 +134,13 @@ public class XmppBinding {
 public Map extractHeadersFromXmpp(Packet xmppPacket, 
Exchange exchange) {
 Map answer = new HashMap();
 
-for (String name : 
JivePropertiesManager.getPropertiesNames(xmppPacket)) {
-Object value = JivePropertiesManager.getProperty(xmppPacket, name);
-
-if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
-answer.put(name, value);
-}
+PacketExtension jpe = 
xmppPacket.getExtension(JivePropertiesExtension.NAMESPACE);
+if (jpe !=null && jpe instanceof JivePropertiesExtension) {
+extractHeadersFrom((JivePropertiesExtension)jpe, exchange, answer);
 }
+if (jpe !=null && jpe instanceof DefaultPacketExtension) {
+extractHeadersFrom((DefaultPacketExtension)jpe, exchange, answer);
+}
 
 if (xmppPacket instanceof Message) {
 Message xmppMessage = (Message) xmppPacket;
@@ -154,4 +157,23 @@ public class XmppBinding {
 
 return answer;
 }
+
+private void extractHeadersFrom(JivePropertiesExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getPropertyNames()) {
+Object value = jpe.getProperty(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
+private void extractHeadersFrom(DefaultPacketExtension jpe, Exchange 
exchange, Map answer) {
+for (String name : jpe.getNames()) {
+Object value = jpe.getValue(name);
+if (!headerFilterStrategy.applyFilterToExternalHeaders(name, 
value, exchange)) {
+answer.put(name, value);
+}
+}
+}
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/44a07f95/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
--
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index 9cbbf47..c7b330f 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -163,21 +163,12 @@ public class XmppEndpoint extends DefaultEndpoint 
implements HeaderFilterStrateg
 }
 
 public synchronized XMPPConnection createConnection() throws 
XMPPException, SmackException, IOException {
-
 if (connection != null && connection.isConnected()) {
 return connection;
 }
 
 if (connection == nul

[1/2] camel git commit: Removing optional import as then parent import can work

2015-10-08 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x cd7300692 -> 44a07f956


Removing optional import as then parent import can work


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

Branch: refs/heads/camel-2.15.x
Commit: 619403801a34e5d66d6dea60b55b573175a98825
Parents: cd73006
Author: Christian Schneider 
Authored: Thu Aug 13 10:57:30 2015 +0200
Committer: Christian Schneider 
Committed: Thu Oct 8 15:11:47 2015 +0200

--
 components/camel-cxf/pom.xml | 1 -
 1 file changed, 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/61940380/components/camel-cxf/pom.xml
--
diff --git a/components/camel-cxf/pom.xml b/components/camel-cxf/pom.xml
index 8b1c460..7bd60f9 100644
--- a/components/camel-cxf/pom.xml
+++ b/components/camel-cxf/pom.xml
@@ -58,7 +58,6 @@
   
org.apache.aries.blueprint.reflect;version="[1.0,2.0)";resolution:=optional,
   
org.apache.aries.blueprint.mutable;version="[1.0,2.0)";resolution:=optional,
   org.apache.camel.blueprint;resolution:=optional,
-  org.osgi.framework;resolution:=optional,
   *
 
 



camel git commit: [CAMEL-9048] Special handling for camel-core

2015-08-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 97bf45b28 -> 90121e537


[CAMEL-9048] Special handling for camel-core


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

Branch: refs/heads/master
Commit: 90121e5377106348b61a6ddab9d2b3050454ea5e
Parents: 97bf45b
Author: Christian Schneider 
Authored: Wed Aug 5 17:47:29 2015 +0200
Committer: Christian Schneider 
Committed: Wed Aug 5 17:53:25 2015 +0200

--
 .../src/main/java/org/apache/camel/impl/osgi/Activator.java  | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/90121e53/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 354232b..6457747 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -237,6 +237,10 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
  * Check if bundle can see the given class
  */
 protected boolean canSee(Bundle bundle, Class clazz) {
+if (bundle.getBundleId() == bundleId) {
+// Need extra handling of camel core as it does not import the api
+return true;
+}
 BundleCapability packageCap = 
packageCapabilities.get(clazz.getPackage().getName());
 BundleWiring wiring = bundle.adapt(BundleWiring.class);
 List imports = wiring.getRequiredWires(PACKAGE_NAMESPACE);



[2/2] camel git commit: [CAMEL-9048] Special handling for camel-core

2015-08-05 Thread cschneider
[CAMEL-9048] Special handling for camel-core


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

Branch: refs/heads/camel-2.15.x
Commit: cfb6cd629c6e38c6e93e810ec9a38e32685705b2
Parents: 529d590
Author: Christian Schneider 
Authored: Wed Aug 5 17:52:50 2015 +0200
Committer: Christian Schneider 
Committed: Wed Aug 5 17:52:50 2015 +0200

--
 .../src/main/java/org/apache/camel/impl/osgi/Activator.java | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/cfb6cd62/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 853dcf8..63380a4 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -92,6 +92,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 
 public void start(BundleContext context) throws Exception {
 LOG.info("Camel activator starting");
+bundleId = context.getBundle().getBundleId();
 tracker = new BundleTracker(context, Bundle.ACTIVE, this);
 cachePackageCapabilities(context);
 tracker.open();
@@ -210,6 +211,10 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
  * Check if bundle can see the given class
  */
 protected boolean canSee(Bundle bundle, Class clazz) {
+if (bundle.getBundleId() == bundleId) {
+// Need extra handling of camel core as it does not import the api
+return true;
+}
 BundleCapability packageCap = 
packageCapabilities.get(clazz.getPackage().getName());
 BundleWiring wiring = bundle.adapt(BundleWiring.class);
 List imports = wiring.getRequiredWires(PACKAGE_NAMESPACE);



[1/2] camel git commit: [CAMEL-9048] Import correct range for wiring package

2015-08-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x bd10c49bd -> cfb6cd629


[CAMEL-9048] Import correct range for wiring package


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

Branch: refs/heads/camel-2.15.x
Commit: 529d590a7713f5da2d49a25718415b4d38710aee
Parents: bd10c49
Author: Christian Schneider 
Authored: Wed Aug 5 17:45:41 2015 +0200
Committer: Christian Schneider 
Committed: Wed Aug 5 17:45:41 2015 +0200

--
 parent/pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/529d590a/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index f08493b..b2e8f9d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -523,6 +523,7 @@
 
[$(version;==;$(@)),$(version;+;$(@)))
 
   org.osgi.framework*;version="[1.5,2)",
+  org.osgi.framework.wiring;version="[1.0,2)",
   org.springframework.ws.*;version="[2,3)",
   org.springframework.xml.*;version="[2,3)",
   org.springframework.*;version="${spring-version-range}",



camel git commit: [CAMEL-9048] Clear map on stop

2015-08-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x b087f1640 -> 4f2eb25d7


[CAMEL-9048] Clear map on stop


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

Branch: refs/heads/camel-2.15.x
Commit: 4f2eb25d75c9f7ac6800acafca2c5108376989ba
Parents: b087f16
Author: Christian Schneider 
Authored: Wed Aug 5 10:04:26 2015 +0200
Committer: Christian Schneider 
Committed: Wed Aug 5 10:05:30 2015 +0200

--
 camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4f2eb25d/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index db1303a..853dcf8 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -101,6 +101,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 public void stop(BundleContext context) throws Exception {
 LOG.info("Camel activator stopping");
 tracker.close();
+packageCapabilities.clear();
 LOG.info("Camel activator stopped");
 }
 



camel git commit: [CAMEL-9048] Clear map on stop

2015-08-05 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 8a414c3d9 -> 31eea9003


[CAMEL-9048] Clear map on stop


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

Branch: refs/heads/master
Commit: 31eea9003e4f09bd85754f7a6c6ee0b7f0802ea0
Parents: 8a414c3
Author: Christian Schneider 
Authored: Wed Aug 5 10:04:26 2015 +0200
Committer: Christian Schneider 
Committed: Wed Aug 5 10:04:43 2015 +0200

--
 camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/31eea900/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index b7554cf..354232b 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -105,6 +105,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 public void stop(BundleContext context) throws Exception {
 LOG.info("Camel activator stopping");
 tracker.close();
+packageCapabilities.clear();
 LOG.info("Camel activator stopped");
 }
 



camel git commit: [CAMEL-9048] Do not load classes to probe for interface availability

2015-08-04 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 79c5ed6a7 -> 9166b94d6


[CAMEL-9048] Do not load classes to probe for interface availability

Conflicts:
camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java


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

Branch: refs/heads/camel-2.15.x
Commit: 9166b94d63d8129ac1cb4366000a9624af4ed1fe
Parents: 79c5ed6
Author: Christian Schneider 
Authored: Tue Aug 4 16:15:21 2015 +0200
Committer: Christian Schneider 
Committed: Tue Aug 4 22:29:24 2015 +0200

--
 .../org/apache/camel/impl/osgi/Activator.java   | 62 ++--
 1 file changed, 45 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/9166b94d/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index d73f6c6..df58189 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.impl.osgi;
 
+import static org.osgi.framework.wiring.BundleRevision.PACKAGE_NAMESPACE;
+
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -64,6 +66,9 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.wiring.BundleWiring;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,10 +85,14 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 
 private BundleTracker tracker;
 private Map> resolvers = new 
ConcurrentHashMap>();
+
+// Map from package name to the capability we export for this package
+private Map packageCapabilities = new 
HashMap<>();
 
 public void start(BundleContext context) throws Exception {
 LOG.info("Camel activator starting");
 tracker = new BundleTracker(context, Bundle.ACTIVE, this);
+cachePackageCapabilities(context);
 tracker.open();
 LOG.info("Camel activator started");
 }
@@ -93,6 +102,19 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 tracker.close();
 LOG.info("Camel activator stopped");
 }
+
+/**
+ * Caches the package capabilities that are needed for a set of interface 
classes
+ *  
+ */
+private void cachePackageCapabilities(BundleContext context) {
+BundleWiring ourWiring = context.getBundle().adapt(BundleWiring.class);
+List ourExports = 
ourWiring.getCapabilities(PACKAGE_NAMESPACE);
+for (BundleCapability ourExport : ourExports) {
+String ourPkgName = (String) 
ourExport.getAttributes().get(PACKAGE_NAMESPACE);
+packageCapabilities.put(ourPkgName, ourExport);
+}
+}
 
 public Object addingBundle(Bundle bundle, BundleEvent event) {
 LOG.debug("Bundle started: {}", bundle.getSymbolicName());
@@ -122,7 +144,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerComponents(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, Component.class)) {
+if (canSee(bundle, Component.class)) {
 Map components = new HashMap();
 for (Enumeration e = bundle.getEntryPaths(META_INF_COMPONENT); 
e != null && e.hasMoreElements();) {
 String path = (String) e.nextElement();
@@ -137,7 +159,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerLanguages(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, Language.class)) {
+if (canSee(bundle, Language.class)) {
 Map languages = new HashMap();
 for (Enumeration e = bundle.getEntryPaths(META_INF_LANGUAGE); e 
!= null && e.hasMoreElements();) {
 String path = (String) e.nextElement();
@@ -158,7 +180,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerDataFormats(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, DataFormat.class)) {
+if (canSee(bundle, DataFormat.class)) {
 Map dataformats = new 

camel git commit: [CAMEL-9048] Do not load classes to probe for interface availability

2015-08-04 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 1cb9bdeb7 -> 1a73fa61a


[CAMEL-9048] Do not load classes to probe for interface availability


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

Branch: refs/heads/master
Commit: 1a73fa61a6e0f1125e516798d0cabc1198328684
Parents: 1cb9bde
Author: Christian Schneider 
Authored: Tue Aug 4 16:15:21 2015 +0200
Committer: Christian Schneider 
Committed: Tue Aug 4 16:15:21 2015 +0200

--
 .../org/apache/camel/impl/osgi/Activator.java   | 61 ++--
 1 file changed, 44 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/1a73fa61/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 12135cb..97729b5 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.impl.osgi;
 
+import static org.osgi.framework.wiring.BundleRevision.PACKAGE_NAMESPACE;
+
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -64,6 +66,7 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleWire;
 import org.osgi.framework.wiring.BundleWiring;
 import org.slf4j.Logger;
@@ -85,9 +88,13 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 private BundleTracker tracker;
 private Map> resolvers = new 
ConcurrentHashMap>();
 private long bundleId;
+
+// Map from package name to the capability we export for this package
+private Map packageCapabilities = new 
HashMap<>();
 
 public void start(BundleContext context) throws Exception {
 LOG.info("Camel activator starting");
+cachePackageCapabilities(context);
 bundleId = context.getBundle().getBundleId();
 BundleContext systemBundleContext = 
context.getBundle(0).getBundleContext();
 tracker = new BundleTracker(systemBundleContext, Bundle.ACTIVE, this);
@@ -100,6 +107,20 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 tracker.close();
 LOG.info("Camel activator stopped");
 }
+
+/**
+ * Caches the package capabilities that are needed for a set of interface 
classes
+ *  
+ * @param classes interfaces we want to track
+ */
+private void cachePackageCapabilities(BundleContext context) {
+BundleWiring ourWiring = context.getBundle().adapt(BundleWiring.class);
+List ourExports = 
ourWiring.getCapabilities(PACKAGE_NAMESPACE);
+for (BundleCapability ourExport : ourExports) {
+String ourPkgName = (String) 
ourExport.getAttributes().get(PACKAGE_NAMESPACE);
+packageCapabilities.put(ourPkgName, ourExport);
+}
+}
 
 public Object addingBundle(Bundle bundle, BundleEvent event) {
 LOG.debug("Bundle started: {}", bundle.getSymbolicName());
@@ -152,7 +173,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerComponents(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, Component.class)) {
+if (canSee(bundle, Component.class)) {
 Map components = new HashMap();
 for (Enumeration e = bundle.getEntryPaths(META_INF_COMPONENT); 
e != null && e.hasMoreElements();) {
 String path = (String) e.nextElement();
@@ -167,7 +188,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerLanguages(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, Language.class)) {
+if (canSee(bundle, Language.class)) {
 Map languages = new HashMap();
 for (Enumeration e = bundle.getEntryPaths(META_INF_LANGUAGE); e 
!= null && e.hasMoreElements();) {
 String path = (String) e.nextElement();
@@ -188,7 +209,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 }
 
 protected void registerDataFormats(Bundle bundle, List 
resolvers) {
-if (checkCompat(bundle, DataFormat.class)) {
+if (canSee(bundle, DataFormat.class)) {
 Map

[1/2] camel git commit: XML External Entity (XXE) injection in XmlConverter. Thanks to Stephan Siano for the patch.

2015-05-08 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 30bffc8dc -> 601ddda44


XML External Entity (XXE) injection in XmlConverter. Thanks to Stephan Siano 
for the patch.

Conflicts:

camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java


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

Branch: refs/heads/camel-2.12.x
Commit: b0ee3e0ce155f5455a3ab744fe57d038075fedb4
Parents: 30bffc8
Author: Claus Ibsen 
Authored: Sun Mar 1 11:52:57 2015 +0100
Committer: Christian Schneider 
Committed: Fri May 8 16:32:51 2015 +0200

--
 .../apache/camel/converter/jaxp/XmlConverter.java   |  7 +++
 .../apache/camel/component/xslt/XsltDTDTest.java| 16 +++-
 2 files changed, 18 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b0ee3e0c/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java 
b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
index 0532011..5fd8920 100644
--- a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
@@ -579,6 +579,13 @@ public class XmlConverter {
 } catch (Exception e) {
 LOG.warn("SAXParser doesn't support the feature {} with value 
{}, due to {}.", new Object[]{javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, 
"true", e});
 }
+try {
+
sfactory.setFeature("http://xml.org/sax/features/external-general-entities";, 
false);
+} catch (SAXException e) {
+LOG.warn("SAXParser doesn't support the feature {} with value 
{}, due to {}."
+, new 
Object[]{"http://xml.org/sax/features/external-general-entities";, false, e});
+}
+sfactory.setNamespaceAware(true);
 SAXParser parser = sfactory.newSAXParser();
 xmlReader = parser.getXMLReader();
 } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/camel/blob/b0ee3e0c/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
--
diff --git 
a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java 
b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
index db5d63c..c0d2723 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltDTDTest.java
@@ -57,19 +57,25 @@ public class XsltDTDTest extends ContextTestSupport {
 Exchange exchange = list.get(0);
 String xml = exchange.getIn().getBody(String.class);
 assertTrue("Get a wrong transformed message", 
xml.indexOf("") > 0);
-
-
-
+
 try {
+endpoint.reset();
+endpoint.expectedMessageCount(1);
+
 template.sendBody("direct:start2", message);
-fail("Expect an exception here");
+
+assertMockEndpointsSatisfied();
+
+list = endpoint.getReceivedExchanges();
+exchange = list.get(0);
+xml = exchange.getIn().getBody(String.class);
+assertTrue("Get a wrong transformed message", 
xml.indexOf("") > 0);
 } catch (Exception ex) {
 // expect an exception here
 assertTrue("Get a wrong exception", ex instanceof 
CamelExecutionException);
 // the file could not be found
 assertTrue("Get a wrong exception cause", ex.getCause() instanceof 
TransformerException);
 }
-
 }
 
 



[2/2] camel git commit: CAMEL-8312: XML External Entity (XXE) injection in XPath. Thanks to Stephan Siano for the patch.

2015-05-08 Thread cschneider
CAMEL-8312: XML External Entity (XXE) injection in XPath. Thanks to Stephan 
Siano for the patch.

Conflicts:
camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java


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

Branch: refs/heads/camel-2.12.x
Commit: 601ddda449ae9a350597ac73f88f470a6f6549be
Parents: b0ee3e0
Author: Claus Ibsen 
Authored: Sun Mar 1 11:51:49 2015 +0100
Committer: Christian Schneider 
Committed: Fri May 8 17:08:22 2015 +0200

--
 .../apache/camel/builder/xml/XPathBuilder.java  | 20 --
 .../camel/builder/xml/XPathFeatureTest.java | 42 +++-
 .../camel/component/xslt/SaxonXsltDTDTest.java  | 11 +++--
 3 files changed, 39 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/601ddda4/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java 
b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index 403a1fb..8bb1a0d 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -52,7 +52,6 @@ import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Predicate;
 import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.WrappedFile;
-import org.apache.camel.component.bean.BeanInvocation;
 import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.NamespaceAware;
@@ -1117,25 +1116,6 @@ public class XPathBuilder extends ServiceSupport 
implements Expression, Predicat
 }
 }
 
-// okay we can try to remedy the failed conversion by some special 
types
-if (answer == null) {
-// let's try coercing some common types into something JAXP work 
with the best for special types
-if (body instanceof WrappedFile) {
-// special for files so we can work with them out of the box
-InputStream is = 
exchange.getContext().getTypeConverter().convertTo(InputStream.class, exchange, 
body);
-answer = new InputSource(is);
-} else if (body instanceof BeanInvocation) {
-// if its a null bean invocation then handle that specially
-BeanInvocation bi = 
exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, 
exchange, body);
-if (bi.getArgs() != null && bi.getArgs().length == 1 && 
bi.getArgs()[0] == null) {
-// its a null argument from the bean invocation so use 
null as answer
-answer = null;
-}
-} else if (body instanceof String) {
-answer = new InputSource(new StringReader((String) body));
-}
-}
-
 if (type == null && answer == null) {
 // fallback to get the body as is
 answer = body;

http://git-wip-us.apache.org/repos/asf/camel/blob/601ddda4/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
--
diff --git 
a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java 
b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
index 0d90530..dfad770 100644
--- 
a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFeatureTest.java
@@ -19,11 +19,13 @@ package org.apache.camel.builder.xml;
 
 import java.io.FileNotFoundException;
 
-import javax.xml.xpath.XPathExpressionException;
-
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.TypeConversionException;
 import org.apache.camel.converter.jaxp.XmlConverter;
+import org.xml.sax.SAXParseException;
 
 import static org.apache.camel.builder.xml.XPathBuilder.xpath;
 
@@ -32,18 +34,19 @@ public class XPathFeatureTest extends ContextTestSupport {
 
 public static final String XML_DATA = "  ]>  &xxe; ";
-  
-
+public static final String XML_DATA_INVALID = "  ]>  &xxe; ";
+
 @Override
 public boolean isUseRouteBuilder() {
 return false;
 }
-  
+
 public void testXPathResult() throws Exception

camel git commit: CAMEL-8647: Add provide-capability header for OSGI subsystems

2015-04-20 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master c6581f8bb -> 66e04492c


CAMEL-8647: Add provide-capability header for OSGI subsystems

Signed-off-by: Christian Schneider 


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

Branch: refs/heads/master
Commit: 66e04492c34cc4150abcd9908c8afd837c9eb51d
Parents: c6581f8
Author: Manuel Holzleitner 
Authored: Mon Apr 20 09:28:04 2015 +0200
Committer: Christian Schneider 
Committed: Mon Apr 20 09:43:00 2015 +0200

--
 camel-core/pom.xml | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/66e04492/camel-core/pom.xml
--
diff --git a/camel-core/pom.xml b/camel-core/pom.xml
index 855ec99..a568c66 100644
--- a/camel-core/pom.xml
+++ b/camel-core/pom.xml
@@ -98,6 +98,9 @@
   
org.apache.camel.pollconsumer.quartz2;${camel.osgi.import.strict.version},
   net.sf.saxon
 
+
+  osgi.extender; osgi.extender="org.apache.camel"; 
uses:="org.apache.camel.impl.osgi"; 
version:Version="$(version;==;${camel.osgi.version.clean})"
+
 
   org.apache.camel.impl.osgi.Activator
 



camel git commit: camel-8647 Fixing build

2015-04-19 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 14bdb705d -> 92a5b6055


camel-8647 Fixing build


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

Branch: refs/heads/master
Commit: 92a5b6055c74e96c45f8015dc1df2759c4872fe5
Parents: 14bdb70
Author: Christian Schneider 
Authored: Sun Apr 19 23:40:28 2015 +0200
Committer: Christian Schneider 
Committed: Sun Apr 19 23:40:28 2015 +0200

--
 .../src/main/java/org/apache/camel/impl/osgi/Activator.java | 5 -
 components/camel-spring/pom.xml | 1 -
 2 files changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/92a5b605/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 2eddc25..12135cb 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -89,7 +89,7 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 public void start(BundleContext context) throws Exception {
 LOG.info("Camel activator starting");
 bundleId = context.getBundle().getBundleId();
-BundleContext systemBundleContext = 
context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getBundleContext();
+BundleContext systemBundleContext = 
context.getBundle(0).getBundleContext();
 tracker = new BundleTracker(systemBundleContext, Bundle.ACTIVE, this);
 tracker.open();
 LOG.info("Camel activator started");
@@ -120,6 +120,9 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 
 private boolean extenderCapabilityWired(Bundle bundle) {
 BundleWiring wiring = bundle.adapt(BundleWiring.class);
+if (wiring == null) {
+return true;
+}
 List requiredWires = 
wiring.getRequiredWires(EXTENDER_NAMESPACE);
 for (BundleWire requiredWire : requiredWires) {
 if 
(CAMEL_EXTENDER.equals(requiredWire.getCapability().getAttributes().get(EXTENDER_NAMESPACE)))
 {

http://git-wip-us.apache.org/repos/asf/camel/blob/92a5b605/components/camel-spring/pom.xml
--
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index 00958e2..f91e9d4 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -38,7 +38,6 @@
 !org.apache.camel.language.spel,
 org.apache.camel.*;${camel.osgi.import.strict.version},
 org.springframework.osgi.*;version="[1.2,2)",
-org.osgi.framework;version="[1.3,2)",
 org.osgi.service.event;resolution:=optional,
 ${camel.osgi.import.defaults},
 *



camel git commit: CAMEL-8647: Make Camel OSGI Extender Subsystem-Aware - With thanks to Manuel Holzleitner

2015-04-17 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 96cfe14c9 -> a5a0cd7e7


CAMEL-8647: Make Camel OSGI Extender Subsystem-Aware - With thanks to Manuel 
Holzleitner


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

Branch: refs/heads/master
Commit: a5a0cd7e7dcc9b3c41ee96f5da0975f48c98ca7b
Parents: 96cfe14
Author: Christian Schneider 
Authored: Fri Apr 17 15:42:33 2015 +0200
Committer: Christian Schneider 
Committed: Fri Apr 17 16:52:16 2015 +0200

--
 .../org/apache/camel/impl/osgi/Activator.java   | 48 
 parent/pom.xml  |  3 +-
 2 files changed, 40 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/a5a0cd7e/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java 
b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index d73f6c6..2eddc25 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -64,6 +64,8 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.wiring.BundleWiring;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,15 +77,20 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 public static final String META_INF_DATAFORMAT = 
"META-INF/services/org/apache/camel/dataformat/";
 public static final String META_INF_TYPE_CONVERTER = 
"META-INF/services/org/apache/camel/TypeConverter";
 public static final String META_INF_FALLBACK_TYPE_CONVERTER = 
"META-INF/services/org/apache/camel/FallbackTypeConverter";
+public static final String EXTENDER_NAMESPACE = "osgi.extender";
+public static final String CAMEL_EXTENDER = "org.apache.camel";
 
 private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
 
 private BundleTracker tracker;
 private Map> resolvers = new 
ConcurrentHashMap>();
+private long bundleId;
 
 public void start(BundleContext context) throws Exception {
 LOG.info("Camel activator starting");
-tracker = new BundleTracker(context, Bundle.ACTIVE, this);
+bundleId = context.getBundle().getBundleId();
+BundleContext systemBundleContext = 
context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getBundleContext();
+tracker = new BundleTracker(systemBundleContext, Bundle.ACTIVE, this);
 tracker.open();
 LOG.info("Camel activator started");
 }
@@ -96,18 +103,38 @@ public class Activator implements BundleActivator, 
BundleTrackerCustomizer {
 
 public Object addingBundle(Bundle bundle, BundleEvent event) {
 LOG.debug("Bundle started: {}", bundle.getSymbolicName());
-List r = new ArrayList();
-registerComponents(bundle, r);
-registerLanguages(bundle, r);
-registerDataFormats(bundle, r);
-registerTypeConverterLoader(bundle, r);
-for (BaseService service : r) {
-service.register();
-}
-resolvers.put(bundle.getBundleId(), r);
+if (extenderCapabilityWired(bundle)) {
+List r = new ArrayList();
+registerComponents(bundle, r);
+registerLanguages(bundle, r);
+registerDataFormats(bundle, r);
+registerTypeConverterLoader(bundle, r);
+for (BaseService service : r) {
+service.register();
+}
+resolvers.put(bundle.getBundleId(), r);
+}
+
 return bundle;
 }
 
+private boolean extenderCapabilityWired(Bundle bundle) {
+BundleWiring wiring = bundle.adapt(BundleWiring.class);
+List requiredWires = 
wiring.getRequiredWires(EXTENDER_NAMESPACE);
+for (BundleWire requiredWire : requiredWires) {
+if 
(CAMEL_EXTENDER.equals(requiredWire.getCapability().getAttributes().get(EXTENDER_NAMESPACE)))
 {
+if (this.bundleId == 
requiredWire.getProviderWiring().getBundle().getBundleId()) {
+LOG.debug("Camel extender requirement of bundle {} 
correctly wired to this implementation", bundle.getBundleId());
+return true;
+} else {
+LOG.info("Not processing bundle {} as it requires a camel 
extender but is not wired to the this implem

camel git commit: CAMEL-8451 Upgrade jetty9 version

2015-03-06 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master e04efc9d6 -> 665c84739


CAMEL-8451 Upgrade jetty9 version


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

Branch: refs/heads/master
Commit: 665c84739b6797e4cd8162bd7316a53ad329b7a8
Parents: e04efc9
Author: Christian Schneider 
Authored: Fri Mar 6 16:25:49 2015 +0100
Committer: Christian Schneider 
Committed: Fri Mar 6 16:25:49 2015 +0100

--
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/665c8473/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index fefc5ef..4ab0d4e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -253,7 +253,7 @@
 6.1.26_4
 6.1.26
 8.1.16.v20140903
-9.2.7.v20150116
+9.2.9.v20150224
 ${jetty8-version}
 org.mortbay.jetty
 1.3.6



camel git commit: CAMEL-8239 Adding camel-jetty9 feature

2015-01-19 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 2aa1570b9 -> b6db69041


CAMEL-8239 Adding camel-jetty9 feature


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

Branch: refs/heads/master
Commit: b6db690414e30410afc5956e8885249bc9b2124e
Parents: 2aa1570
Author: Christian Schneider 
Authored: Mon Jan 19 17:09:46 2015 +0100
Committer: Christian Schneider 
Committed: Mon Jan 19 17:09:58 2015 +0100

--
 platforms/karaf/features/src/main/resources/features.xml | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b6db6904/platforms/karaf/features/src/main/resources/features.xml
--
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index 40762e0..63996ec 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -736,6 +736,13 @@
 mvn:org.apache.camel/camel-jetty-common/${project.version}
 mvn:org.apache.camel/camel-jetty8/${project.version}
   
+  
+jetty
+camel-core
+camel-http
+mvn:org.apache.camel/camel-jetty-common/${project.version}
+mvn:org.apache.camel/camel-jetty9/${project.version}
+  
   
 camel-core
 mvn:org.apache.camel/camel-jgroups/${project.version}



[08/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
new file mode 100644
index 000..b98a554
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpProducerQueryParamTest extends BaseJettyTest {
+
+private String url = "http://0.0.0.0:"; + getPort() + "/cheese";
+
+@Test
+public void testQueryParameters() throws Exception {
+Exchange exchange = template.request(url + "?quote=Camel%20rocks", 
null);
+assertNotNull(exchange);
+
+String body = exchange.getOut().getBody(String.class);
+Map headers = exchange.getOut().getHeaders();
+
+assertEquals("Bye World", body);
+assertEquals("Carlsberg", headers.get("beer"));
+}
+
+@Test
+public void testQueryParametersWithHeader() throws Exception {
+Exchange exchange = template.request(url, new Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setHeader(Exchange.HTTP_QUERY, "quote=Camel 
rocks");
+}
+});
+assertNotNull(exchange);
+
+String body = exchange.getOut().getBody(String.class);
+Map headers = exchange.getOut().getHeaders();
+
+assertEquals("Bye World", body);
+assertEquals("Carlsberg", headers.get("beer"));
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from("jetty:" + url).process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String quote = exchange.getIn().getHeader("quote", 
String.class);
+assertEquals("Camel rocks", quote);
+
+exchange.getOut().setBody("Bye World");
+exchange.getOut().setHeader("beer", "Carlsberg");
+}
+});
+}
+};
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
new file mode 100644
index 000..bf39a54
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language gov

[13/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
deleted file mode 100644
index 57d803b..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyHttpProducerContentTypeEncodingInQuoteTest extends 
BaseJettyTest {
-
-@Test
-public void testHttpProducerEncodingInQuoteTest() throws Exception {
-// these tests do not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-
-Exchange out = 
template.send("jetty:http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody("Hello World");
-exchange.getIn().setHeader("Content-Type", 
"text/plain;charset=\"UTF-8\"");
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-// camel-jetty may remove quotes from charset
-String res = out.getOut().getHeader("Content-Type").toString();
-res = res.replace("\"UTF-8\"", "UTF-8");
-assertEquals("text/plain;charset=UTF-8", res);
-}
-
-@Test
-public void testHttpProducerEncodingInQuoteAndActionParameterTest() throws 
Exception {
-// these tests do not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-
-Exchange out = 
template.send("jetty:http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody("Hello World");
-exchange.getIn().setHeader("Content-Type", 
"text/plain;charset=\"UTF-8\";action=\"http://somewhere.com/foo\"";);
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-// camel-jetty may remove quotes from charset
-String res = out.getOut().getHeader("Content-Type").toString();
-res = res.replace("\"UTF-8\"", "UTF-8");
-
assertEquals("text/plain;charset=UTF-8;action=\"http://somewhere.com/foo\"";, 
res);
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-public void configure() throws Exception {
-from("jetty:http://localhost:{{port}}/myapp/myservice";)
-.to("mock:result")
-.transform(constant("OK"));
-}
-};
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
--
diff -

[14/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
--
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
deleted file mode 100644
index 07614f7..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncFilterTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, "Hello Camel", 
String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-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");
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
--
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
deleted file mode 100644
index e082076..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-context.addComponent("async", 

[02/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
new file mode 100644
index 000..4838ec0
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+public class JettyRestRedirectTest extends BaseJettyTest {
+   
+@Test
+public void testRedirectInvocation() throws Exception {
+String response = template.requestBody("jetty:http://localhost:"; + 
getPort2() + "/metadata/profile/tag?httpClient.supportRedirect=true", 
"Camel", String.class);
+assertEquals("It should support the redirect out of box.", "Mock 
profile", response);
+}
+
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+
+return new RouteBuilder() {
+public void configure() {
+
restConfiguration().component("jetty").host("localhost").scheme("http").port(getPort2());
+rest("/metadata/profile")
+.get("/{id}").to("direct:profileLookup")
+.post("/tag").to("direct:tag");
+
+from("direct:profileLookup").transform().constant("Mock 
profile");
+from("direct:tag").log("${headers}").process(new Processor() {
+@Override
+public void process(Exchange ex) throws Exception {
+ex.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 
302);
+ex.getOut().setHeader("location", 
"/metadata/profile/1");
+}
+}).log("${headers}").transform().constant("Redirecting...");
+}
+};
+}
+
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
new file mode 100644
index 000..43ec8f3
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestJettyBindingModeAutoWithJson

[19/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
--
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
deleted file mode 100644
index 79cf75c..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.util.jsse.KeyManagersParameters;
-import org.apache.camel.util.jsse.KeyStoreParameters;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.eclipse.jetty.server.Connector;
-import org.junit.Ignore;
-
-@Ignore
-public class ExplicitHttpsSslContextParametersRouteTest extends HttpsRouteTest 
{
-
-// START SNIPPET: e2
-private Connector createSslSocketConnector(CamelContext context, int port) 
throws Exception {
-KeyStoreParameters ksp = new KeyStoreParameters();
-
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").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;
-return null;
-}
-// END SNIPPET: e2
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-public void configure() throws Exception {
-// START SNIPPET: e1
-// create SSL select channel connectors for port 9080 and 9090
-Map connectors = new HashMap();
-connectors.put(port1, createSslSocketConnector(getContext(), 
port1));
-connectors.put(port2, createSslSocketConnector(getContext(), 
port2));
-
-JettyHttpComponent jetty = getContext().getComponent("jetty", 
JettyHttpComponent.class);
-jetty.setSslSocketConnectors(connectors);
-// END SNIPPET: e1
-
-from("jetty:https://localhost:"; + port1 + 
"/test").to("mock:a");
-
-Processor proc = new Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getOut().setBody("Hello World");
-}
-};
-from("jetty:https://localhost:"; + port1 + 
"/hello").process(proc);
-
-from("jetty:https://localhost:"; + port2 + 
"/test").to("mock:b");
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
--
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
deleted file mode 100644
index 194c42f..000
--- 
a/componen

[11/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
--
diff --git 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
 
b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
deleted file mode 100644
index 210fecd..000
--- 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-http://www.springframework.org/schema/beans";
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-   xsi:schemaLocation="
-   http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-   http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-">
-
-
-
-org.apache.camel.test.AvailablePortFinder
-
-
-getNextAvailable
-
-
-
-9000
-
-
-
-
-
-http://camel.apache.org/schema/spring";>
-http://localhost:#{dynaPort}/hi"/>
-http://localhost:#{dynaPort}/hi"/>
-
-
-
-
-java.net.ConnectException
-
-
-
-
-
-
-
-
-Bye ${body}
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
--
diff --git 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
 
b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
deleted file mode 100644
index db38b86..000
--- 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-http://www.springframework.org/schema/beans";
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-   xsi:schemaLocation="
-   http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-   http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-">
-
-
-
-
-org.apache.camel.test.AvailablePortFinder
-
-
-getNextAvailable
-
-
-
-5000
-
-
-
-
-http://camel.apache.org/schema/spring";>
-http://localhost:#{dynaPort}/hi"/>
-http://localhost:#{dynaPort}/hi"/>
-
-
-
-
-
-
-
-
-Bye ${body}
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty8/pom.xml
--
diff --git a/components/camel-jetty8/pom.xml b/components/camel-jetty8/pom.xml
new file mode 100644
index 000..095a2ba
--- /dev/null
+++ b/components/camel-jetty8/pom.xml
@@ -0,0 +1,149 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+4.0.0
+
+
+org.apache.camel
+components
+2.15-SNAPSHOT
+
+
+camel-jetty8
+bundle
+Camel :: Jetty8
+Camel Jetty8 support
+
+
+
+javax.servlet.*;version="${servlet-version-range}"
+
+
org.apache.camel.component.*
+
org.apache.camel.spi.ComponentResolver;component=jetty
+
+
+
+
+
+org.apache.camel
+camel-core
+
+
+org.apache.camel
+camel-http
+
+
+org.apache.camel
+camel-jetty-common
+
+
+org.apache.geronimo.specs
+geronimo-servlet_3.0_spec
+
+
+org.eclipse.jetty
+jetty-server
+
+   
+   javax.servlet
+   servlet-api
+   
+   
+   org.eclipse.jetty.orbit
+   javax.servlet
+   
+
+
+
+org.eclipse.jetty
+jetty-servlet
+
+
+org.eclipse.jetty
+jetty-security
+
+
+org.eclipse.jetty
+jetty-servlets
+
+
+org.eclipse.jetty
+jetty-client
+
+
+or

[09/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
new file mode 100644
index 000..6fa6df0
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpMethods;
+import org.junit.Test;
+
+public class HttpBindingPreservePostFormUrlEncodedBodyTest extends 
BaseJettyTest {
+
+@Test
+public void testSendToJetty() throws Exception {
+Exchange exchange = 
template.request("http://localhost:{{port}}/myapp/myservice?query1=a&query2=b";, 
new Processor() {
+
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody("b1=x&b2=y");
+exchange.getIn().setHeader("content-type", 
"application/x-www-form-urlencoded");
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, 
HttpMethods.POST);
+}
+
+});
+// convert the response to a String
+String body = exchange.getOut().getBody(String.class);
+assertEquals("Request message is OK", body);
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+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);
+
+// for unit testing make sure we got right message
+assertEquals("The body message is wrong", "b1=x&b2=y", 
body);
+assertEquals("Get a wrong query parameter from the 
message header", "a", exchange.getIn().getHeader("query1"));
+assertEquals("Get a wrong query parameter from the 
message header", "b", exchange.getIn().getHeader("query2"));
+assertEquals("Get a wrong form parameter from the 
message header", "x", exchange.getIn().getHeader("b1"));
+assertEquals("Get a wrong form parameter from the 
message header", "y", exchange.getIn().getHeader("b2"));
+
+// send a response
+exchange.getOut().setBody("Request message is OK");
+}
+});
+}
+};
+}
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
new file mode 100644
index 000..22aa8ea
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance wi

[22/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/pom.xml
--
diff --git a/components/camel-jetty/pom.xml b/components/camel-jetty/pom.xml
deleted file mode 100644
index b2d3270..000
--- a/components/camel-jetty/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-4.0.0
-
-
-org.apache.camel
-components
-2.15-SNAPSHOT
-
-
-camel-jetty
-bundle
-Camel :: Jetty
-Camel Jetty support
-
-
-
-javax.servlet.*;version="${servlet-version-range}"
-
-
org.apache.camel.component.jetty*
-
org.apache.camel.spi.ComponentResolver;component=jetty
-
-
-
-
-
-org.apache.camel
-camel-core
-
-
-org.apache.camel
-camel-http
-
-
-org.apache.geronimo.specs
-geronimo-servlet_3.0_spec
-
-
-org.eclipse.jetty
-jetty-server
-
-   
-   javax.servlet
-   servlet-api
-   
-   
-   org.eclipse.jetty.orbit
-   javax.servlet
-   
-
-
-
-org.eclipse.jetty
-jetty-servlet
-
-
-org.eclipse.jetty
-jetty-security
-
-
-org.eclipse.jetty
-jetty-servlets
-
-
-org.eclipse.jetty
-jetty-client
-
-
-org.eclipse.jetty
-jetty-jmx
-
-
-
-
-org.apache.camel
-camel-test-spring
-test
-
-
-org.apache.camel
-camel-spring
-test
-
-
-org.springframework
-spring-test
-true
-test
-
-
-
-  org.apache.camel
-  camel-jackson
-  test
-
-
-  org.apache.camel
-  camel-jaxb
-  test
-
-
-
-junit
-junit
-test
-
-
-org.slf4j
-slf4j-log4j12
-test
-
-
-
-
-
-jetty9
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty9
-
-
-
-
-
-
-
-
-
-jetty8
-
-true
-
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-maven-surefire-plugin
-
-   1
-   false
-
1800
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
deleted file mode 100644
index 3ab15f2..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) unde

[17/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
--
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
deleted file mode 100644
index 89cfbd0..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class HttpSendFileTest extends BaseJettyTest {
-
-@Test
-public void testSendImage() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-mock.message(0).body().isInstanceOf(InputStream.class);
-mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
-
-Exchange out = 
template.send("http://localhost:{{port}}/myapp/myservice";, new Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
-exchange.getIn().setHeader("Content-Type", "image/jpeg");
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
-}
-
-@Override
-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"));
-}
-};
-}
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
--
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
deleted file mode 100644
index d86b37b..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-
-import org.apache.camel

[23/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
--
diff --git 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
new file mode 100644
index 000..c3bc309
--- /dev/null
+++ 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -0,0 +1,1203 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.servlet.Filter;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.http.CamelServlet;
+import org.apache.camel.component.http.HttpBinding;
+import org.apache.camel.component.http.HttpComponent;
+import org.apache.camel.component.http.HttpConsumer;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.UrlRewrite;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.spi.ManagementAgent;
+import org.apache.camel.spi.ManagementStrategy;
+import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.spi.RestConsumerFactory;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.HostUtils;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.URISupport;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.jmx.MBeanContainer;
+import org.eclipse.jetty.server.AbstractConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.handler.ErrorHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.HandlerWrapper;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlets.CrossOriginFilter;
+import org.eclipse.jetty.servlets.MultiPartFilter;
+import org.eclipse.jetty.util.component.Container;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.util.thread.ThreadPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An HttpComponent which starts an embedded Jetty for to handle consuming from
+ * the http endpoints.
+ *
+ * @version 
+ */
+public abstract class JettyHttpComponent extends HttpComponent implements 
RestConsumerFactory {
+public static final String TMP_DIR = "CamelJettyTempDir";
+
+protected static final HashMap CONNECTORS = new 
HashMap();
+   
+private static final Logger LOG = 
LoggerFactory.getLogger(JettyHttpComponent.class);
+private static final String JETTY_SSL_KEYSTORE = 
"org.eclipse.jetty.ssl.keystore";
+private static fi

[07/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
new file mode 100644
index 000..52510b1
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpTwoServerPortsTest extends BaseJettyTest {
+
+private int port1;
+private int port2;
+
+@Test
+public void testTwoServerPorts() throws Exception {
+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);
+
+reply = template.requestBody("direct:a", "Earth", String.class);
+assertEquals("Bye Earth", reply);
+
+reply = template.requestBody("direct:b", "Moon", String.class);
+assertEquals("Hi Moon", reply);
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+port1 = getPort();
+port2 = getNextPort();
+
+from("direct:a").to("http://localhost:"; + port1 + "/myapp");
+
+from("direct:b").to("http://localhost:"; + port2 + 
"/myotherapp");
+
+from("jetty://http://localhost:"; + port1 + 
"/myapp").process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String in = exchange.getIn().getBody(String.class);
+exchange.getOut().setBody("Bye " + in);
+}
+});
+
+from("jetty://http://localhost:"; + port2 + 
"/myotherapp").process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String in = exchange.getIn().getBody(String.class);
+exchange.getOut().setBody("Hi " + in);
+}
+});
+}
+};
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
new file mode 100644
index 000..d97c9f3
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */

[20/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
--
diff --git 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
 
b/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
deleted file mode 100644
index 10ad17c..000
--- 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty8;
-
-import java.io.IOException;
-
-import org.eclipse.jetty.client.HttpDestination;
-import org.eclipse.jetty.client.HttpExchange;
-import org.eclipse.jetty.client.RedirectListener;
-import org.eclipse.jetty.http.HttpStatus;
-import org.eclipse.jetty.io.Buffer;
-
-public class CamelRedirectListener extends RedirectListener {
-private final HttpExchange exchange;
-
-public CamelRedirectListener(HttpDestination destination, HttpExchange ex) 
{
-super(destination, ex);
-exchange = ex;
-}
-
-@Override
-public void onResponseStatus(Buffer version, int status, Buffer reason) 
throws IOException {
-// Update the exchange method to get to support the Post/Redirect/Get
-// http://en.wikipedia.org/wiki/Post/Redirect/Get
-if (exchange.getMethod().equals("POST") && (status == 
HttpStatus.SEE_OTHER_303 || status == HttpStatus.MOVED_TEMPORARILY_302)) {
-exchange.setMethod("GET");
-}
-
-// Since the default RedirectListener only cares about http
-// response codes 301 and 302, we override this method and
-// trick the super class into handling this case for us.
-if (status == HttpStatus.SEE_OTHER_303) {
-status = HttpStatus.MOVED_TEMPORARILY_302;
-}
-
-super.onResponseStatus(version, status, reason);
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
--
diff --git 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
 
b/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
deleted file mode 100644
index 857877c..000
--- 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty8;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.CamelExchangeException;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangeTimedOutException;
-import org.apache.camel.component.jetty.JettyContentExchange;
-import org.apache.camel.component.jetty.JettyHttpBinding;
-import org.apache.camel.util.IOHelper;
-import org.eclipse.jetty.client.C

[18/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
--
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
deleted file mode 100644
index c3deb50..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.servlet.ServletRequest;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-public class HttpHeaderTest extends BaseJettyTest {
-
-@Test
-public void testHttpHeaders() throws Exception {
-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() {
-@Override
-public void process(Exchange exchange) throws Exception {
-// 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("jetty:http://localhost:{{port}}/myapp/mytest";).process(new Processor() {
-public void process(Exchange exchange) throws Exception {
-Map headers = 
exchange.getIn().getHeaders();
-ServletRequest request = 
exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, ServletRequest.class);
-assertNotNull(request);
-assertEquals("Get a wong http protocol version", 
request.getProtocol(), "HTTP/1.0");
-for (Entry entry : headers.entrySet()) 
{
-if ("SOAPAction".equals(entry.getKey()) && 
"http://xxx.com/interfaces/ticket".equals(entry.getValue())) {
-exchange.getOut().setBody("Find the key!");
-return;
-}
-}
-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
-
from("jetty:http://localhost:{{port2}}/server/mytest?sendServerVersion=false&sendDateHeader=true";).transform(constant("Response!"));
-
-   
-}
-};
-}
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/Htt

[03/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
new file mode 100644
index 000..9fcf814
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.jettyproducer;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerPutContentTest extends BaseJettyTest {
+
+@Test
+public void testHttpProducerPutContentTest() throws Exception {
+// these tests do not run well on Windows
+if (isPlatform("windows")) {
+return;
+}
+
+// give Jetty time to startup properly
+Thread.sleep(1000);
+
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMinimumMessageCount(1);
+mock.message(0).body().isInstanceOf(InputStream.class);
+mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
+
+Exchange out = 
template.send("jetty://http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
+exchange.getIn().setHeader("Content-Type", "image/jpeg");
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, 
org.apache.camel.component.http.HttpMethods.PUT);
+}
+});
+
+assertMockEndpointsSatisfied();
+
+assertEquals("OK", out.getOut().getBody(String.class));
+assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
+}
+
+@Override
+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);
+assertTrue("CamelHttpMethod is not PUT", 
exchange.getIn().getHeader("CamelHttpMethod").equals("PUT"));
+assertTrue("Content-Type is not image/jpeg", 
exchange.getIn().getHeader("Content-Type").equals("image/jpeg"));
+}
+})
+.transform(constant("OK")).setHeader("Content-Type", 
constant("text/plain"));
+}
+};
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
new file mode 100644
index 000..b9a4db7
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to th

[10/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
--
diff --git 
a/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
new file mode 100644
index 000..3ee2072
--- /dev/null
+++ 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
@@ -0,0 +1,295 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty9;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangeTimedOutException;
+import org.apache.camel.component.jetty.JettyContentExchange;
+import org.apache.camel.component.jetty.JettyHttpBinding;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.client.api.Response;
+import org.eclipse.jetty.client.api.Result;
+import org.eclipse.jetty.client.util.BufferingResponseListener;
+import org.eclipse.jetty.client.util.BytesContentProvider;
+import org.eclipse.jetty.client.util.InputStreamContentProvider;
+import org.eclipse.jetty.client.util.StringContentProvider;
+import org.eclipse.jetty.http.HttpFields;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Jetty specific exchange which keeps track of the the request and response.
+ *
+ * @version 
+ */
+public class JettyContentExchange9 implements JettyContentExchange {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(JettyContentExchange9.class);
+
+private volatile Exchange exchange;
+private volatile AsyncCallback callback;
+private volatile JettyHttpBinding jettyBinding;
+private volatile HttpClient client;
+private final CountDownLatch done = new CountDownLatch(1);
+private Request request;
+private Response response;
+private byte[] responseContent;
+
+private String requestContentType;
+
+private boolean supportRedirect;
+
+public void init(Exchange exchange, JettyHttpBinding jettyBinding, 
+ final HttpClient client, AsyncCallback callback) {
+this.exchange = exchange;
+this.jettyBinding = jettyBinding;
+this.client = client;
+this.callback = callback;
+}
+
+protected void onRequestComplete() {
+LOG.trace("onRequestComplete");
+closeRequestContentSource();
+}
+
+protected void onResponseComplete(Result result, byte[] content, String 
contentType) {
+LOG.trace("onResponseComplete");
+done.countDown();
+this.response = result.getResponse();
+this.responseContent = content;
+if (callback == null) {
+// this is only for the async callback
+return;
+}
+try {
+jettyBinding.populateResponse(exchange, this);
+} catch (Exception e) {
+exchange.setException(e);
+} finally {
+callback.done(false);
+}
+}
+
+protected void onExpire() {
+LOG.trace("onExpire");
+
+// need to close the request input stream
+closeRequestContentSource();
+doTaskCompleted(new ExchangeTimedOutException(exchange, 
client.getConnectTimeout()));
+}
+
+protected void onException(Throwable ex) {
+LOG.trace("onException {}", ex);
+
+// need to close the request input stream
+closeRequestContentSource();
+doTaskCompleted(ex);
+}
+
+protected void onConnectionFailed(Throwable ex) {
+LOG.trace("onC

[12/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
deleted file mode 100644
index bb39070..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.jetty.HttpsRouteTest;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyProducerHttpsRouteTest extends HttpsRouteTest {
-
-public String getHttpProducerScheme() {
-return "jetty://https://";;
-}
-
-@Test
-public void testEndpointWithoutHttps() throws Exception {
-// these tests does not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:a", 
MockEndpoint.class);
-try {
-template.sendBodyAndHeader("jetty://http://localhost:"; + port1 + 
"/test", expectedBody, "Content-Type", "application/xml");
-fail("expect exception on access to https endpoint via http");
-} catch (RuntimeCamelException expected) {
-}
-assertTrue("mock endpoint was not called", 
mockEndpoint.getExchanges().isEmpty());
-}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
deleted file mode 100644
index b93fb26..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import java.io.Serializable;
-
-/**
- * @version 
- */
-public class MyCoolBean implements Serializable {
-
-private static final long serialVersionUID = 1L;
-private final int id;
-private final String name;
-
-public MyCoolBean(int id, String name) {
-this.id = id;
-this.name = name;
-}
-
-public int getId() {
-return id;
-}
-
-public String getName() {
-return name;
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyInputStream.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/je

[16/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
--
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
deleted file mode 100644
index 135241f..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyContinuationDisabledTest extends BaseJettyTest {
-
-@Test
-public void testJettyContinuationDisabled() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String out = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", out);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable continuation
-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");
-}
-};
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
--
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
deleted file mode 100644
index d5b0adb..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import java.util.Set;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyEnableJmxTest extends BaseJettyTest {
-
-private String serverUri0;
-private String serverUri1;
-private String serverUri2;
-private Stri

[24/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
CAMEL-8239 Split jetty8 and jetty9 support into separate modules


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

Branch: refs/heads/master
Commit: 8b2a8877ace847e734a636851f880a52983767e4
Parents: 76d8086
Author: Christian Schneider 
Authored: Thu Jan 15 10:52:43 2015 +0100
Committer: Christian Schneider 
Committed: Mon Jan 19 14:44:04 2015 +0100

--
 apache-camel/pom.xml|   10 +-
 components/camel-ahc/pom.xml|2 +-
 components/camel-cxf-transport/pom.xml  |2 +-
 components/camel-cxf/pom.xml|2 +-
 components/camel-jetty-common/pom.xml   |  130 ++
 .../jetty/CamelContinuationServlet.java |  212 +++
 .../component/jetty/CamelFilterWrapper.java |   71 ++
 .../camel/component/jetty/CamelHttpClient.java  |   78 ++
 .../component/jetty/CamelMultipartFilter.java   |   31 +
 .../jetty/DefaultJettyHttpBinding.java  |  194 +++
 .../component/jetty/JettyContentExchange.java   |   70 +
 .../camel/component/jetty/JettyConverter.java   |   53 +
 .../camel/component/jetty/JettyHttpBinding.java |   86 ++
 .../component/jetty/JettyHttpComponent.java | 1203 ++
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 +
 .../component/jetty/JettyRestHttpBinding.java   |   75 ++
 ...JettyRestServletResolveConsumerStrategy.java |  163 +++
 .../apache/camel/component/jetty/package.html   |   25 +
 components/camel-jetty/pom.xml  |  198 ---
 .../jetty/CamelContinuationServlet.java |  212 ---
 .../component/jetty/CamelFilterWrapper.java |   71 --
 .../camel/component/jetty/CamelHttpClient.java  |   78 --
 .../component/jetty/CamelMultipartFilter.java   |   31 -
 .../jetty/DefaultJettyHttpBinding.java  |  194 ---
 .../component/jetty/JettyContentExchange.java   |   70 -
 .../camel/component/jetty/JettyConverter.java   |   53 -
 .../camel/component/jetty/JettyHttpBinding.java |   86 --
 .../component/jetty/JettyHttpComponent.java | 1203 --
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 -
 .../component/jetty/JettyRestHttpBinding.java   |   75 --
 ...JettyRestServletResolveConsumerStrategy.java |  163 ---
 .../apache/camel/component/jetty/package.html   |   25 -
 .../component/jetty8/CamelHttpClient8.java  |   68 -
 .../component/jetty8/CamelRedirectListener.java |   52 -
 .../component/jetty8/JettyContentExchange8.java |  287 -
 .../component/jetty8/JettyHttpComponent8.java   |  132 --
 .../component/jetty8/JettyHttpEndpoint8.java|   36 -
 .../component/jetty9/AttachmentHttpBinding.java |   75 --
 .../component/jetty9/CamelHttpClient9.java  |   52 -
 .../component/jetty9/JettyContentExchange9.java |  295 -
 .../component/jetty9/JettyHttpComponent9.java   |  140 --
 .../component/jetty9/JettyHttpEndpoint9.java|   36 -
 .../src/main/resources/META-INF/LICENSE.txt |  203 ---
 .../src/main/resources/META-INF/NOTICE.txt  |   11 -
 .../services/org/apache/camel/TypeConverter |   18 -
 .../services/org/apache/camel/component/jetty   |   17 -
 components/camel-jetty/src/test/data/logo.jpeg  |  Bin 10249 -> 0 bytes
 components/camel-jetty/src/test/data/plain.txt  |   18 -
 .../camel/component/jetty/BaseJettyTest.java|  119 --
 .../jetty/ConvertPayloadToInputStreamTest.java  |   64 -
 .../component/jetty/CustomFiltersTest.java  |  109 --
 .../camel/component/jetty/EnableCORSTest.java   |   71 --
 .../component/jetty/ExplicitHttpsRouteTest.java |   69 -
 ...licitHttpsSslContextParametersRouteTest.java |   85 --
 .../component/jetty/ExplicitJettyRouteTest.java |   65 -
 .../camel/component/jetty/HandlerTest.java  |  106 --
 .../jetty/HttpAuthMethodPriorityTest.java   |  125 --
 .../HttpBasicAuthComponentConfiguredTest.java   |  109 --
 .../component/jetty/HttpBasicAuthTest.java  |  106 --
 ...ndingPreservePostFormUrlEncodedBodyTest.java |   66 -
 .../component/jetty/HttpBindingRefTest.java |   93 --
 .../jetty/HttpBridgeEncodedPathTest.java|   65 -
 .../jetty/HttpBridgeMultipartRouteTest.java |   99 --
 .../component/jetty/HttpBridgeRouteTest.java|   72 --
 .../jetty/HttpCharacterEncodingTest.java|   64 -
 .../jetty/HttpClientRouteEnableChunkedTest.java |   84 --
 .../component/jetty/HttpClientRouteTest.java|  147 ---
 .../component/jetty/HttpConverterTest.java  |  131 --
 .../component/jetty/HttpEndpointURLTest.java|   30 -
 .../jetty/HttpEndpointUriEncodingIssueTest.java |   68 -
 .../jetty/HttpFilterCamelHeadersTest.java   |   79 --
 .../compone

[04/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
new file mode 100644
index 000..b55d938
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.javabody;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpConstants;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpJavaBodyTest extends BaseJettyTest {
+
+@Override
+public boolean isUseRouteBuilder() {
+return false;
+}
+
+@Test
+public void testHttpSendJavaBodyAndReceiveString() throws Exception {
+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");
+}
+});
+}
+});
+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);
+
+assertEquals("OK", reply);
+}
+
+@Test
+public void testHttpSendJavaBodyAndReceiveJavaBody() throws Exception {
+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);
+}
+});
+}
+});
+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);
+
+assertEquals(456, reply.getId());
+assertEquals("Camel rocks", reply.getName());
+}
+
+@Test
+public void testHttpSendStringAndReceiveJavaBody() throws Exception {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from("jetty:http:/

[01/24] camel git commit: CAMEL-8239 Adjusting karaf features for the split module

2015-01-19 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/master 76d808632 -> 4e58755f6


CAMEL-8239 Adjusting karaf features for the split module


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

Branch: refs/heads/master
Commit: 4e58755f6ddfb52c24ce2d8d1dfe3c96529ee775
Parents: 8b2a887
Author: Christian Schneider 
Authored: Mon Jan 19 14:43:35 2015 +0100
Committer: Christian Schneider 
Committed: Mon Jan 19 14:44:04 2015 +0100

--
 components/camel-jetty-common/pom.xml| 2 +-
 components/camel-jetty8/pom.xml  | 2 +-
 components/camel-jetty9/pom.xml  | 2 +-
 platforms/karaf/features/src/main/resources/features.xml | 3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4e58755f/components/camel-jetty-common/pom.xml
--
diff --git a/components/camel-jetty-common/pom.xml 
b/components/camel-jetty-common/pom.xml
index a331bd3..962c0a7 100644
--- a/components/camel-jetty-common/pom.xml
+++ b/components/camel-jetty-common/pom.xml
@@ -33,7 +33,7 @@
 
 javax.servlet.*;version="${servlet-version-range}"
 
-
org.apache.camel.component.jetty.*
+
org.apache.camel.component.jetty
 
org.apache.camel.spi.ComponentResolver;component=jetty
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4e58755f/components/camel-jetty8/pom.xml
--
diff --git a/components/camel-jetty8/pom.xml b/components/camel-jetty8/pom.xml
index 095a2ba..676729c 100644
--- a/components/camel-jetty8/pom.xml
+++ b/components/camel-jetty8/pom.xml
@@ -33,7 +33,7 @@
 
 javax.servlet.*;version="${servlet-version-range}"
 
-
org.apache.camel.component.*
+
org.apache.camel.component.jetty8
 
org.apache.camel.spi.ComponentResolver;component=jetty
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4e58755f/components/camel-jetty9/pom.xml
--
diff --git a/components/camel-jetty9/pom.xml b/components/camel-jetty9/pom.xml
index e5b6313..87b8105 100644
--- a/components/camel-jetty9/pom.xml
+++ b/components/camel-jetty9/pom.xml
@@ -33,7 +33,7 @@
 
 javax.servlet.*;version="${servlet-version-range}"
 
-
org.apache.camel.component.jetty*
+
org.apache.camel.component.jetty9
 
org.apache.camel.spi.ComponentResolver;component=jetty
 ${jetty9-version}
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4e58755f/platforms/karaf/features/src/main/resources/features.xml
--
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index 52666bc..40762e0 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -733,7 +733,8 @@
 jetty
 camel-core
 camel-http
-mvn:org.apache.camel/camel-jetty/${project.version}
+mvn:org.apache.camel/camel-jetty-common/${project.version}
+mvn:org.apache.camel/camel-jetty8/${project.version}
   
   
 camel-core



[15/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
--
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
deleted file mode 100644
index 8d2eeed..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.aggregate.AggregationStrategy;
-import org.junit.Test;
-
-/**
- * Based on end user on forum how to get the 404 error code in his enrich 
aggregator
- *
- * @version 
- */
-public class JettySimplifiedHandle404Test extends BaseJettyTest {
-
-@Test
-public void testSimulate404() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedBodiesReceived("Page not found");
-mock.expectedHeaderReceived(Exchange.HTTP_RESPONSE_CODE, 404);
-
-template.sendBody("direct:start", "Hello World");
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable error handling
-errorHandler(noErrorHandler());
-
-// START SNIPPET: e1
-// 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
-
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
-Integer code = 
resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
-assertEquals(404, code.intValue());
-return resource;
-}
-}).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);
-}
-});
-// END SNIPPET: e1
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
--
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
deleted file mode 100644
index 1d5000d..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
-

[06/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
new file mode 100644
index 000..387cdeb
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpProducer;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.Test;
+
+/**
+ * Unit test for http client options.
+ */
+public class JettyHttpClientOptionsTest extends BaseJettyTest {
+
+@Test
+public void testCustomHttpBinding() throws Exception {
+// assert jetty was configured with our timeout
+HttpEndpoint jettyEndpoint = 
context.getEndpoint("http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=";,
 HttpEndpoint.class);
+assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
+HttpProducer producer = (HttpProducer)jettyEndpoint.createProducer();
+assertEquals("Get the wrong http client parameter", , 
producer.getHttpClient().getParams().getSoTimeout());
+
+// send and receive
+Object out = 
template.requestBody("http://localhost:{{port}}/myapp/myservice";, "Hello 
World");
+assertEquals("Bye World", 
context.getTypeConverter().convertTo(String.class, out));
+}
+
+@Test
+public void testProxySettingOfJettyHttpClient() throws Exception {
+// setup the Proxy setting through the URI
+HttpEndpoint jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy/setting?proxyHost=192.168.0.1&proxyPort=9090";,
 HttpEndpoint.class);
+assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
+JettyHttpProducer producer = 
(JettyHttpProducer)jettyEndpoint.createProducer();
+assertProxyAddress(producer.getClient(), "192.168.0.1", 9090);
+
+// setup the context properties
+context.getProperties().put("http.proxyHost", "192.168.0.2");
+context.getProperties().put("http.proxyPort", "8080");
+jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy2/setting";, 
HttpEndpoint.class);
+producer = (JettyHttpProducer)jettyEndpoint.createProducer();
+assertProxyAddress(producer.getClient(), "192.168.0.2", 8080);
+context.getProperties().clear();
+
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+
from("jetty:http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=";).transform().constant("Bye
 World");
+}
+};
+}
+
+private void assertProxyAddress(HttpClient client, String expectedHost, 
int expectedPort) {
+CamelHttpClient camelHttpClient = (CamelHttpClient)client;
+assertEquals("Got the wrong http proxy host parameter", expectedHost, 
camelHttpClient.getProxyHost());
+assertEquals("Got the wrong http proxy port paramerter", expectedPort, 
camelHttpClient.getProxyPort());
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConf

[21/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
deleted file mode 100644
index c3bc309..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ /dev/null
@@ -1,1203 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.servlet.Filter;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.http.CamelServlet;
-import org.apache.camel.component.http.HttpBinding;
-import org.apache.camel.component.http.HttpComponent;
-import org.apache.camel.component.http.HttpConsumer;
-import org.apache.camel.component.http.HttpEndpoint;
-import org.apache.camel.component.http.UrlRewrite;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.ManagementAgent;
-import org.apache.camel.spi.ManagementStrategy;
-import org.apache.camel.spi.RestConfiguration;
-import org.apache.camel.spi.RestConsumerFactory;
-import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.HostUtils;
-import org.apache.camel.util.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.apache.camel.util.UnsafeUriCharactersEncoder;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.http.HttpStatus;
-import org.eclipse.jetty.jmx.MBeanContainer;
-import org.eclipse.jetty.server.AbstractConnector;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.handler.ErrorHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.server.handler.HandlerWrapper;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.servlets.CrossOriginFilter;
-import org.eclipse.jetty.servlets.MultiPartFilter;
-import org.eclipse.jetty.util.component.Container;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.util.thread.ThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An HttpComponent which starts an embedded Jetty for to handle consuming from
- * the http endpoints.
- *
- * @version 
- */
-public abstract class JettyHttpComponent extends HttpComponent implements 
RestConsumerFactory {
-public static final String TMP_DIR = "CamelJettyTempDir";
-
-protected static final HashMap CONNECTORS = new 
HashMap();
-   
-private static final Logger LOG = 
LoggerFactory.getLogger(JettyHttpComponent.class);
-private static final String JETTY_SSL_KEYSTORE = 
"org.eclipse.jetty.ssl.keystore";
-private static final String JETTY_SSL_KEY

[05/24] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-19 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/8b2a8877/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
new file mode 100644
index 000..7c81101
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+
+import javax.activation.DataHandler;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+
+public class MultiPartFormTest extends BaseJettyTest {
+private RequestEntity createMultipartRequestEntity() throws Exception {
+File file = new File("src/main/resources/META-INF/NOTICE.txt");
+
+Part[] parts = {new StringPart("comment", "A binary file of some 
kind"),
+new FilePart(file.getName(), file)};
+
+return new MultipartRequestEntity(parts, new HttpMethodParams());
+
+}
+
+@Test
+public void testSendMultiPartForm() throws Exception {
+HttpClient httpclient = new HttpClient();
+
+PostMethod httppost = new PostMethod("http://localhost:"; + getPort() + 
"/test");
+
+httppost.setRequestEntity(createMultipartRequestEntity());
+
+int status = httpclient.executeMethod(httppost);
+
+assertEquals("Get a wrong response status", 200, status);
+String result = httppost.getResponseBodyAsString();
+
+assertEquals("Get a wrong result", "A binary file of some kind", 
result);
+
+}
+
+@Test
+public void testSendMultiPartFormFromCamelHttpComponnent() throws 
Exception {
+String result = template.requestBody("http://localhost:"; + getPort() + 
"/test", createMultipartRequestEntity(), String.class);
+assertEquals("Get a wrong result", "A binary file of some kind", 
result);
+}
+
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+public void configure() throws Exception {
+// START SNIPPET: e1
+// Set the jetty temp directory which store the file for multi
+// part form
+// camel-jetty will clean up the file after it handled the
+// request.
+// The option works rightly from Camel 2.4.0
+getContext().getProperties().put("CamelJettyTempDir", 
"target");
+
+from("jetty://http://localhost:{{port}}/test";).process(new 
Processor() {
+
+public void process(Exchange exchange) throws Exception {
+Message in = exchange.getIn();
+assertEquals("Get a wrong attachement size", 1, 
in.getAttachments().size());
+// The file name is attachment id
+DataHandler data = in.getAttachment("NOTICE.txt");
+
+assertNotNull("Should get the DataHandle NOTICE.txt", 
data);
+// This assert is wrong, but the correct content-type
+// (application/octet-stream)
+// will not be returned until Jetty makes it available 
-
+// currently the content-type
+// returned is 

[22/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
--
diff --git 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
new file mode 100644
index 000..c3bc309
--- /dev/null
+++ 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -0,0 +1,1203 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.servlet.Filter;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.http.CamelServlet;
+import org.apache.camel.component.http.HttpBinding;
+import org.apache.camel.component.http.HttpComponent;
+import org.apache.camel.component.http.HttpConsumer;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.UrlRewrite;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.spi.ManagementAgent;
+import org.apache.camel.spi.ManagementStrategy;
+import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.spi.RestConsumerFactory;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.HostUtils;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.URISupport;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.jmx.MBeanContainer;
+import org.eclipse.jetty.server.AbstractConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.handler.ErrorHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.HandlerWrapper;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlets.CrossOriginFilter;
+import org.eclipse.jetty.servlets.MultiPartFilter;
+import org.eclipse.jetty.util.component.Container;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.util.thread.ThreadPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An HttpComponent which starts an embedded Jetty for to handle consuming from
+ * the http endpoints.
+ *
+ * @version 
+ */
+public abstract class JettyHttpComponent extends HttpComponent implements 
RestConsumerFactory {
+public static final String TMP_DIR = "CamelJettyTempDir";
+
+protected static final HashMap CONNECTORS = new 
HashMap();
+   
+private static final Logger LOG = 
LoggerFactory.getLogger(JettyHttpComponent.class);
+private static final String JETTY_SSL_KEYSTORE = 
"org.eclipse.jetty.ssl.keystore";
+private static fi

[21/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/pom.xml
--
diff --git a/components/camel-jetty/pom.xml b/components/camel-jetty/pom.xml
deleted file mode 100644
index b2d3270..000
--- a/components/camel-jetty/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-4.0.0
-
-
-org.apache.camel
-components
-2.15-SNAPSHOT
-
-
-camel-jetty
-bundle
-Camel :: Jetty
-Camel Jetty support
-
-
-
-javax.servlet.*;version="${servlet-version-range}"
-
-
org.apache.camel.component.jetty*
-
org.apache.camel.spi.ComponentResolver;component=jetty
-
-
-
-
-
-org.apache.camel
-camel-core
-
-
-org.apache.camel
-camel-http
-
-
-org.apache.geronimo.specs
-geronimo-servlet_3.0_spec
-
-
-org.eclipse.jetty
-jetty-server
-
-   
-   javax.servlet
-   servlet-api
-   
-   
-   org.eclipse.jetty.orbit
-   javax.servlet
-   
-
-
-
-org.eclipse.jetty
-jetty-servlet
-
-
-org.eclipse.jetty
-jetty-security
-
-
-org.eclipse.jetty
-jetty-servlets
-
-
-org.eclipse.jetty
-jetty-client
-
-
-org.eclipse.jetty
-jetty-jmx
-
-
-
-
-org.apache.camel
-camel-test-spring
-test
-
-
-org.apache.camel
-camel-spring
-test
-
-
-org.springframework
-spring-test
-true
-test
-
-
-
-  org.apache.camel
-  camel-jackson
-  test
-
-
-  org.apache.camel
-  camel-jaxb
-  test
-
-
-
-junit
-junit
-test
-
-
-org.slf4j
-slf4j-log4j12
-test
-
-
-
-
-
-jetty9
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty9
-
-
-
-
-
-
-
-
-
-jetty8
-
-true
-
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-maven-surefire-plugin
-
-   1
-   false
-
1800
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
deleted file mode 100644
index 3ab15f2..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) unde

[08/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
new file mode 100644
index 000..6fa6df0
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpMethods;
+import org.junit.Test;
+
+public class HttpBindingPreservePostFormUrlEncodedBodyTest extends 
BaseJettyTest {
+
+@Test
+public void testSendToJetty() throws Exception {
+Exchange exchange = 
template.request("http://localhost:{{port}}/myapp/myservice?query1=a&query2=b";, 
new Processor() {
+
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody("b1=x&b2=y");
+exchange.getIn().setHeader("content-type", 
"application/x-www-form-urlencoded");
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, 
HttpMethods.POST);
+}
+
+});
+// convert the response to a String
+String body = exchange.getOut().getBody(String.class);
+assertEquals("Request message is OK", body);
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+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);
+
+// for unit testing make sure we got right message
+assertEquals("The body message is wrong", "b1=x&b2=y", 
body);
+assertEquals("Get a wrong query parameter from the 
message header", "a", exchange.getIn().getHeader("query1"));
+assertEquals("Get a wrong query parameter from the 
message header", "b", exchange.getIn().getHeader("query2"));
+assertEquals("Get a wrong form parameter from the 
message header", "x", exchange.getIn().getHeader("b1"));
+assertEquals("Get a wrong form parameter from the 
message header", "y", exchange.getIn().getHeader("b2"));
+
+// send a response
+exchange.getOut().setBody("Request message is OK");
+}
+});
+}
+};
+}
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
new file mode 100644
index 000..22aa8ea
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBindingRefTest.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance wi

[10/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
--
diff --git 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
 
b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
deleted file mode 100644
index 210fecd..000
--- 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-http://www.springframework.org/schema/beans";
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-   xsi:schemaLocation="
-   http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-   http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-">
-
-
-
-org.apache.camel.test.AvailablePortFinder
-
-
-getNextAvailable
-
-
-
-9000
-
-
-
-
-
-http://camel.apache.org/schema/spring";>
-http://localhost:#{dynaPort}/hi"/>
-http://localhost:#{dynaPort}/hi"/>
-
-
-
-
-java.net.ConnectException
-
-
-
-
-
-
-
-
-Bye ${body}
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
--
diff --git 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
 
b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
deleted file mode 100644
index db38b86..000
--- 
a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-http://www.springframework.org/schema/beans";
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-   xsi:schemaLocation="
-   http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-   http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-">
-
-
-
-
-org.apache.camel.test.AvailablePortFinder
-
-
-getNextAvailable
-
-
-
-5000
-
-
-
-
-http://camel.apache.org/schema/spring";>
-http://localhost:#{dynaPort}/hi"/>
-http://localhost:#{dynaPort}/hi"/>
-
-
-
-
-
-
-
-
-Bye ${body}
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty8/pom.xml
--
diff --git a/components/camel-jetty8/pom.xml b/components/camel-jetty8/pom.xml
new file mode 100644
index 000..095a2ba
--- /dev/null
+++ b/components/camel-jetty8/pom.xml
@@ -0,0 +1,149 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+4.0.0
+
+
+org.apache.camel
+components
+2.15-SNAPSHOT
+
+
+camel-jetty8
+bundle
+Camel :: Jetty8
+Camel Jetty8 support
+
+
+
+javax.servlet.*;version="${servlet-version-range}"
+
+
org.apache.camel.component.*
+
org.apache.camel.spi.ComponentResolver;component=jetty
+
+
+
+
+
+org.apache.camel
+camel-core
+
+
+org.apache.camel
+camel-http
+
+
+org.apache.camel
+camel-jetty-common
+
+
+org.apache.geronimo.specs
+geronimo-servlet_3.0_spec
+
+
+org.eclipse.jetty
+jetty-server
+
+   
+   javax.servlet
+   servlet-api
+   
+   
+   org.eclipse.jetty.orbit
+   javax.servlet
+   
+
+
+
+org.eclipse.jetty
+jetty-servlet
+
+
+org.eclipse.jetty
+jetty-security
+
+
+org.eclipse.jetty
+jetty-servlets
+
+
+org.eclipse.jetty
+jetty-client
+
+
+or

[07/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
new file mode 100644
index 000..b98a554
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerQueryParamTest.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpProducerQueryParamTest extends BaseJettyTest {
+
+private String url = "http://0.0.0.0:"; + getPort() + "/cheese";
+
+@Test
+public void testQueryParameters() throws Exception {
+Exchange exchange = template.request(url + "?quote=Camel%20rocks", 
null);
+assertNotNull(exchange);
+
+String body = exchange.getOut().getBody(String.class);
+Map headers = exchange.getOut().getHeaders();
+
+assertEquals("Bye World", body);
+assertEquals("Carlsberg", headers.get("beer"));
+}
+
+@Test
+public void testQueryParametersWithHeader() throws Exception {
+Exchange exchange = template.request(url, new Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setHeader(Exchange.HTTP_QUERY, "quote=Camel 
rocks");
+}
+});
+assertNotNull(exchange);
+
+String body = exchange.getOut().getBody(String.class);
+Map headers = exchange.getOut().getHeaders();
+
+assertEquals("Bye World", body);
+assertEquals("Carlsberg", headers.get("beer"));
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from("jetty:" + url).process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String quote = exchange.getIn().getHeader("quote", 
String.class);
+assertEquals("Camel rocks", quote);
+
+exchange.getOut().setBody("Bye World");
+exchange.getOut().setHeader("beer", "Carlsberg");
+}
+});
+}
+};
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
new file mode 100644
index 000..bf39a54
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language gov

[15/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
--
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
deleted file mode 100644
index 135241f..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyContinuationDisabledTest extends BaseJettyTest {
-
-@Test
-public void testJettyContinuationDisabled() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String out = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", out);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable continuation
-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");
-}
-};
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
--
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
deleted file mode 100644
index d5b0adb..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import java.util.Set;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyEnableJmxTest extends BaseJettyTest {
-
-private String serverUri0;
-private String serverUri1;
-private String serverUri2;
-private Stri

[05/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
new file mode 100644
index 000..387cdeb
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpProducer;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.Test;
+
+/**
+ * Unit test for http client options.
+ */
+public class JettyHttpClientOptionsTest extends BaseJettyTest {
+
+@Test
+public void testCustomHttpBinding() throws Exception {
+// assert jetty was configured with our timeout
+HttpEndpoint jettyEndpoint = 
context.getEndpoint("http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=";,
 HttpEndpoint.class);
+assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
+HttpProducer producer = (HttpProducer)jettyEndpoint.createProducer();
+assertEquals("Get the wrong http client parameter", , 
producer.getHttpClient().getParams().getSoTimeout());
+
+// send and receive
+Object out = 
template.requestBody("http://localhost:{{port}}/myapp/myservice";, "Hello 
World");
+assertEquals("Bye World", 
context.getTypeConverter().convertTo(String.class, out));
+}
+
+@Test
+public void testProxySettingOfJettyHttpClient() throws Exception {
+// setup the Proxy setting through the URI
+HttpEndpoint jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy/setting?proxyHost=192.168.0.1&proxyPort=9090";,
 HttpEndpoint.class);
+assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
+JettyHttpProducer producer = 
(JettyHttpProducer)jettyEndpoint.createProducer();
+assertProxyAddress(producer.getClient(), "192.168.0.1", 9090);
+
+// setup the context properties
+context.getProperties().put("http.proxyHost", "192.168.0.2");
+context.getProperties().put("http.proxyPort", "8080");
+jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy2/setting";, 
HttpEndpoint.class);
+producer = (JettyHttpProducer)jettyEndpoint.createProducer();
+assertProxyAddress(producer.getClient(), "192.168.0.2", 8080);
+context.getProperties().clear();
+
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+
from("jetty:http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=";).transform().constant("Bye
 World");
+}
+};
+}
+
+private void assertProxyAddress(HttpClient client, String expectedHost, 
int expectedPort) {
+CamelHttpClient camelHttpClient = (CamelHttpClient)client;
+assertEquals("Got the wrong http proxy host parameter", expectedHost, 
camelHttpClient.getProxyHost());
+assertEquals("Got the wrong http proxy port paramerter", expectedPort, 
camelHttpClient.getProxyPort());
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConf

[20/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
deleted file mode 100644
index c3bc309..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ /dev/null
@@ -1,1203 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.servlet.Filter;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.http.CamelServlet;
-import org.apache.camel.component.http.HttpBinding;
-import org.apache.camel.component.http.HttpComponent;
-import org.apache.camel.component.http.HttpConsumer;
-import org.apache.camel.component.http.HttpEndpoint;
-import org.apache.camel.component.http.UrlRewrite;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.ManagementAgent;
-import org.apache.camel.spi.ManagementStrategy;
-import org.apache.camel.spi.RestConfiguration;
-import org.apache.camel.spi.RestConsumerFactory;
-import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.HostUtils;
-import org.apache.camel.util.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.apache.camel.util.UnsafeUriCharactersEncoder;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.http.HttpStatus;
-import org.eclipse.jetty.jmx.MBeanContainer;
-import org.eclipse.jetty.server.AbstractConnector;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.handler.ErrorHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.server.handler.HandlerWrapper;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.servlets.CrossOriginFilter;
-import org.eclipse.jetty.servlets.MultiPartFilter;
-import org.eclipse.jetty.util.component.Container;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.util.thread.ThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An HttpComponent which starts an embedded Jetty for to handle consuming from
- * the http endpoints.
- *
- * @version 
- */
-public abstract class JettyHttpComponent extends HttpComponent implements 
RestConsumerFactory {
-public static final String TMP_DIR = "CamelJettyTempDir";
-
-protected static final HashMap CONNECTORS = new 
HashMap();
-   
-private static final Logger LOG = 
LoggerFactory.getLogger(JettyHttpComponent.class);
-private static final String JETTY_SSL_KEYSTORE = 
"org.eclipse.jetty.ssl.keystore";
-private static final String JETTY_SSL_KEY

[16/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
--
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
deleted file mode 100644
index 89cfbd0..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class HttpSendFileTest extends BaseJettyTest {
-
-@Test
-public void testSendImage() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-mock.message(0).body().isInstanceOf(InputStream.class);
-mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
-
-Exchange out = 
template.send("http://localhost:{{port}}/myapp/myservice";, new Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
-exchange.getIn().setHeader("Content-Type", "image/jpeg");
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
-}
-
-@Override
-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"));
-}
-};
-}
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
--
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
deleted file mode 100644
index d86b37b..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-
-import org.apache.camel

[03/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
new file mode 100644
index 000..b55d938
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/javabody/HttpJavaBodyTest.java
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.javabody;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpConstants;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpJavaBodyTest extends BaseJettyTest {
+
+@Override
+public boolean isUseRouteBuilder() {
+return false;
+}
+
+@Test
+public void testHttpSendJavaBodyAndReceiveString() throws Exception {
+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");
+}
+});
+}
+});
+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);
+
+assertEquals("OK", reply);
+}
+
+@Test
+public void testHttpSendJavaBodyAndReceiveJavaBody() throws Exception {
+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);
+}
+});
+}
+});
+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);
+
+assertEquals(456, reply.getId());
+assertEquals("Camel rocks", reply.getName());
+}
+
+@Test
+public void testHttpSendStringAndReceiveJavaBody() throws Exception {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from("jetty:http:/

[12/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
deleted file mode 100644
index 57d803b..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyHttpProducerContentTypeEncodingInQuoteTest extends 
BaseJettyTest {
-
-@Test
-public void testHttpProducerEncodingInQuoteTest() throws Exception {
-// these tests do not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-
-Exchange out = 
template.send("jetty:http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody("Hello World");
-exchange.getIn().setHeader("Content-Type", 
"text/plain;charset=\"UTF-8\"");
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-// camel-jetty may remove quotes from charset
-String res = out.getOut().getHeader("Content-Type").toString();
-res = res.replace("\"UTF-8\"", "UTF-8");
-assertEquals("text/plain;charset=UTF-8", res);
-}
-
-@Test
-public void testHttpProducerEncodingInQuoteAndActionParameterTest() throws 
Exception {
-// these tests do not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-
-Exchange out = 
template.send("jetty:http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody("Hello World");
-exchange.getIn().setHeader("Content-Type", 
"text/plain;charset=\"UTF-8\";action=\"http://somewhere.com/foo\"";);
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-// camel-jetty may remove quotes from charset
-String res = out.getOut().getHeader("Content-Type").toString();
-res = res.replace("\"UTF-8\"", "UTF-8");
-
assertEquals("text/plain;charset=UTF-8;action=\"http://somewhere.com/foo\"";, 
res);
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-public void configure() throws Exception {
-from("jetty:http://localhost:{{port}}/myapp/myservice";)
-.to("mock:result")
-.transform(constant("OK"));
-}
-};
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
--
diff -

[02/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
new file mode 100644
index 000..9fcf814
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.jettyproducer;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerPutContentTest extends BaseJettyTest {
+
+@Test
+public void testHttpProducerPutContentTest() throws Exception {
+// these tests do not run well on Windows
+if (isPlatform("windows")) {
+return;
+}
+
+// give Jetty time to startup properly
+Thread.sleep(1000);
+
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMinimumMessageCount(1);
+mock.message(0).body().isInstanceOf(InputStream.class);
+mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
+
+Exchange out = 
template.send("jetty://http://localhost:{{port}}/myapp/myservice";, new 
Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
+exchange.getIn().setHeader("Content-Type", "image/jpeg");
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, 
org.apache.camel.component.http.HttpMethods.PUT);
+}
+});
+
+assertMockEndpointsSatisfied();
+
+assertEquals("OK", out.getOut().getBody(String.class));
+assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
+}
+
+@Override
+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);
+assertTrue("CamelHttpMethod is not PUT", 
exchange.getIn().getHeader("CamelHttpMethod").equals("PUT"));
+assertTrue("Content-Type is not image/jpeg", 
exchange.getIn().getHeader("Content-Type").equals("image/jpeg"));
+}
+})
+.transform(constant("OK")).setHeader("Content-Type", 
constant("text/plain"));
+}
+};
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
new file mode 100644
index 000..b9a4db7
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to th

[09/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
--
diff --git 
a/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
new file mode 100644
index 000..3ee2072
--- /dev/null
+++ 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
@@ -0,0 +1,295 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty9;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangeTimedOutException;
+import org.apache.camel.component.jetty.JettyContentExchange;
+import org.apache.camel.component.jetty.JettyHttpBinding;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.client.api.Response;
+import org.eclipse.jetty.client.api.Result;
+import org.eclipse.jetty.client.util.BufferingResponseListener;
+import org.eclipse.jetty.client.util.BytesContentProvider;
+import org.eclipse.jetty.client.util.InputStreamContentProvider;
+import org.eclipse.jetty.client.util.StringContentProvider;
+import org.eclipse.jetty.http.HttpFields;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Jetty specific exchange which keeps track of the the request and response.
+ *
+ * @version 
+ */
+public class JettyContentExchange9 implements JettyContentExchange {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(JettyContentExchange9.class);
+
+private volatile Exchange exchange;
+private volatile AsyncCallback callback;
+private volatile JettyHttpBinding jettyBinding;
+private volatile HttpClient client;
+private final CountDownLatch done = new CountDownLatch(1);
+private Request request;
+private Response response;
+private byte[] responseContent;
+
+private String requestContentType;
+
+private boolean supportRedirect;
+
+public void init(Exchange exchange, JettyHttpBinding jettyBinding, 
+ final HttpClient client, AsyncCallback callback) {
+this.exchange = exchange;
+this.jettyBinding = jettyBinding;
+this.client = client;
+this.callback = callback;
+}
+
+protected void onRequestComplete() {
+LOG.trace("onRequestComplete");
+closeRequestContentSource();
+}
+
+protected void onResponseComplete(Result result, byte[] content, String 
contentType) {
+LOG.trace("onResponseComplete");
+done.countDown();
+this.response = result.getResponse();
+this.responseContent = content;
+if (callback == null) {
+// this is only for the async callback
+return;
+}
+try {
+jettyBinding.populateResponse(exchange, this);
+} catch (Exception e) {
+exchange.setException(e);
+} finally {
+callback.done(false);
+}
+}
+
+protected void onExpire() {
+LOG.trace("onExpire");
+
+// need to close the request input stream
+closeRequestContentSource();
+doTaskCompleted(new ExchangeTimedOutException(exchange, 
client.getConnectTimeout()));
+}
+
+protected void onException(Throwable ex) {
+LOG.trace("onException {}", ex);
+
+// need to close the request input stream
+closeRequestContentSource();
+doTaskCompleted(ex);
+}
+
+protected void onConnectionFailed(Throwable ex) {
+LOG.trace("onC

[13/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
--
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
deleted file mode 100644
index 07614f7..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncFilterTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, "Hello Camel", 
String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-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");
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
--
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
deleted file mode 100644
index e082076..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-context.addComponent("async", 

[23/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
CAMEL-8239 Split jetty8 and jetty9 support into separate modules


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

Branch: refs/heads/temp-jetty9-2
Commit: 0d96e56d223ec29946bbde06790c27f8e1f24716
Parents: 76c6a27
Author: Christian Schneider 
Authored: Thu Jan 15 10:52:43 2015 +0100
Committer: Christian Schneider 
Committed: Thu Jan 15 10:52:43 2015 +0100

--
 apache-camel/pom.xml|   10 +-
 components/camel-ahc/pom.xml|2 +-
 components/camel-cxf-transport/pom.xml  |2 +-
 components/camel-cxf/pom.xml|2 +-
 components/camel-jetty-common/pom.xml   |  130 ++
 .../jetty/CamelContinuationServlet.java |  212 +++
 .../component/jetty/CamelFilterWrapper.java |   71 ++
 .../camel/component/jetty/CamelHttpClient.java  |   78 ++
 .../component/jetty/CamelMultipartFilter.java   |   31 +
 .../jetty/DefaultJettyHttpBinding.java  |  194 +++
 .../component/jetty/JettyContentExchange.java   |   70 +
 .../camel/component/jetty/JettyConverter.java   |   53 +
 .../camel/component/jetty/JettyHttpBinding.java |   86 ++
 .../component/jetty/JettyHttpComponent.java | 1203 ++
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 +
 .../component/jetty/JettyRestHttpBinding.java   |   75 ++
 ...JettyRestServletResolveConsumerStrategy.java |  163 +++
 .../apache/camel/component/jetty/package.html   |   25 +
 components/camel-jetty/pom.xml  |  198 ---
 .../jetty/CamelContinuationServlet.java |  212 ---
 .../component/jetty/CamelFilterWrapper.java |   71 --
 .../camel/component/jetty/CamelHttpClient.java  |   78 --
 .../component/jetty/CamelMultipartFilter.java   |   31 -
 .../jetty/DefaultJettyHttpBinding.java  |  194 ---
 .../component/jetty/JettyContentExchange.java   |   70 -
 .../camel/component/jetty/JettyConverter.java   |   53 -
 .../camel/component/jetty/JettyHttpBinding.java |   86 --
 .../component/jetty/JettyHttpComponent.java | 1203 --
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 -
 .../component/jetty/JettyRestHttpBinding.java   |   75 --
 ...JettyRestServletResolveConsumerStrategy.java |  163 ---
 .../apache/camel/component/jetty/package.html   |   25 -
 .../component/jetty8/CamelHttpClient8.java  |   68 -
 .../component/jetty8/CamelRedirectListener.java |   52 -
 .../component/jetty8/JettyContentExchange8.java |  287 -
 .../component/jetty8/JettyHttpComponent8.java   |  132 --
 .../component/jetty8/JettyHttpEndpoint8.java|   36 -
 .../component/jetty9/AttachmentHttpBinding.java |   75 --
 .../component/jetty9/CamelHttpClient9.java  |   52 -
 .../component/jetty9/JettyContentExchange9.java |  295 -
 .../component/jetty9/JettyHttpComponent9.java   |  140 --
 .../component/jetty9/JettyHttpEndpoint9.java|   36 -
 .../src/main/resources/META-INF/LICENSE.txt |  203 ---
 .../src/main/resources/META-INF/NOTICE.txt  |   11 -
 .../services/org/apache/camel/TypeConverter |   18 -
 .../services/org/apache/camel/component/jetty   |   17 -
 components/camel-jetty/src/test/data/logo.jpeg  |  Bin 10249 -> 0 bytes
 components/camel-jetty/src/test/data/plain.txt  |   18 -
 .../camel/component/jetty/BaseJettyTest.java|  119 --
 .../jetty/ConvertPayloadToInputStreamTest.java  |   64 -
 .../component/jetty/CustomFiltersTest.java  |  109 --
 .../camel/component/jetty/EnableCORSTest.java   |   71 --
 .../component/jetty/ExplicitHttpsRouteTest.java |   69 -
 ...licitHttpsSslContextParametersRouteTest.java |   85 --
 .../component/jetty/ExplicitJettyRouteTest.java |   65 -
 .../camel/component/jetty/HandlerTest.java  |  106 --
 .../jetty/HttpAuthMethodPriorityTest.java   |  125 --
 .../HttpBasicAuthComponentConfiguredTest.java   |  109 --
 .../component/jetty/HttpBasicAuthTest.java  |  106 --
 ...ndingPreservePostFormUrlEncodedBodyTest.java |   66 -
 .../component/jetty/HttpBindingRefTest.java |   93 --
 .../jetty/HttpBridgeEncodedPathTest.java|   65 -
 .../jetty/HttpBridgeMultipartRouteTest.java |   99 --
 .../component/jetty/HttpBridgeRouteTest.java|   72 --
 .../jetty/HttpCharacterEncodingTest.java|   64 -
 .../jetty/HttpClientRouteEnableChunkedTest.java |   84 --
 .../component/jetty/HttpClientRouteTest.java|  147 ---
 .../component/jetty/HttpConverterTest.java  |  131 --
 .../component/jetty/HttpEndpointURLTest.java|   30 -
 .../jetty/HttpEndpointUriEncodingIssueTest.java |   68 -
 .../jetty/HttpFilterCamelHeadersTest.java   |   79 --
 .../

[14/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
--
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
deleted file mode 100644
index 8d2eeed..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.aggregate.AggregationStrategy;
-import org.junit.Test;
-
-/**
- * Based on end user on forum how to get the 404 error code in his enrich 
aggregator
- *
- * @version 
- */
-public class JettySimplifiedHandle404Test extends BaseJettyTest {
-
-@Test
-public void testSimulate404() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedBodiesReceived("Page not found");
-mock.expectedHeaderReceived(Exchange.HTTP_RESPONSE_CODE, 404);
-
-template.sendBody("direct:start", "Hello World");
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable error handling
-errorHandler(noErrorHandler());
-
-// START SNIPPET: e1
-// 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
-
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
-Integer code = 
resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
-assertEquals(404, code.intValue());
-return resource;
-}
-}).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);
-}
-});
-// END SNIPPET: e1
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
--
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
deleted file mode 100644
index 1d5000d..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
-

[11/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
deleted file mode 100644
index bb39070..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.jetty.HttpsRouteTest;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyProducerHttpsRouteTest extends HttpsRouteTest {
-
-public String getHttpProducerScheme() {
-return "jetty://https://";;
-}
-
-@Test
-public void testEndpointWithoutHttps() throws Exception {
-// these tests does not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:a", 
MockEndpoint.class);
-try {
-template.sendBodyAndHeader("jetty://http://localhost:"; + port1 + 
"/test", expectedBody, "Content-Type", "application/xml");
-fail("expect exception on access to https endpoint via http");
-} catch (RuntimeCamelException expected) {
-}
-assertTrue("mock endpoint was not called", 
mockEndpoint.getExchanges().isEmpty());
-}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
deleted file mode 100644
index b93fb26..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import java.io.Serializable;
-
-/**
- * @version 
- */
-public class MyCoolBean implements Serializable {
-
-private static final long serialVersionUID = 1L;
-private final int id;
-private final String name;
-
-public MyCoolBean(int id, String name) {
-this.id = id;
-this.name = name;
-}
-
-public int getId() {
-return id;
-}
-
-public String getName() {
-return name;
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyInputStream.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/je

[04/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
new file mode 100644
index 000..7c81101
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+
+import javax.activation.DataHandler;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+
+public class MultiPartFormTest extends BaseJettyTest {
+private RequestEntity createMultipartRequestEntity() throws Exception {
+File file = new File("src/main/resources/META-INF/NOTICE.txt");
+
+Part[] parts = {new StringPart("comment", "A binary file of some 
kind"),
+new FilePart(file.getName(), file)};
+
+return new MultipartRequestEntity(parts, new HttpMethodParams());
+
+}
+
+@Test
+public void testSendMultiPartForm() throws Exception {
+HttpClient httpclient = new HttpClient();
+
+PostMethod httppost = new PostMethod("http://localhost:"; + getPort() + 
"/test");
+
+httppost.setRequestEntity(createMultipartRequestEntity());
+
+int status = httpclient.executeMethod(httppost);
+
+assertEquals("Get a wrong response status", 200, status);
+String result = httppost.getResponseBodyAsString();
+
+assertEquals("Get a wrong result", "A binary file of some kind", 
result);
+
+}
+
+@Test
+public void testSendMultiPartFormFromCamelHttpComponnent() throws 
Exception {
+String result = template.requestBody("http://localhost:"; + getPort() + 
"/test", createMultipartRequestEntity(), String.class);
+assertEquals("Get a wrong result", "A binary file of some kind", 
result);
+}
+
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+public void configure() throws Exception {
+// START SNIPPET: e1
+// Set the jetty temp directory which store the file for multi
+// part form
+// camel-jetty will clean up the file after it handled the
+// request.
+// The option works rightly from Camel 2.4.0
+getContext().getProperties().put("CamelJettyTempDir", 
"target");
+
+from("jetty://http://localhost:{{port}}/test";).process(new 
Processor() {
+
+public void process(Exchange exchange) throws Exception {
+Message in = exchange.getIn();
+assertEquals("Get a wrong attachement size", 1, 
in.getAttachments().size());
+// The file name is attachment id
+DataHandler data = in.getAttachment("NOTICE.txt");
+
+assertNotNull("Should get the DataHandle NOTICE.txt", 
data);
+// This assert is wrong, but the correct content-type
+// (application/octet-stream)
+// will not be returned until Jetty makes it available 
-
+// currently the content-type
+// returned is 

[17/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
--
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
deleted file mode 100644
index c3deb50..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.servlet.ServletRequest;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-public class HttpHeaderTest extends BaseJettyTest {
-
-@Test
-public void testHttpHeaders() throws Exception {
-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() {
-@Override
-public void process(Exchange exchange) throws Exception {
-// 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("jetty:http://localhost:{{port}}/myapp/mytest";).process(new Processor() {
-public void process(Exchange exchange) throws Exception {
-Map headers = 
exchange.getIn().getHeaders();
-ServletRequest request = 
exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, ServletRequest.class);
-assertNotNull(request);
-assertEquals("Get a wong http protocol version", 
request.getProtocol(), "HTTP/1.0");
-for (Entry entry : headers.entrySet()) 
{
-if ("SOAPAction".equals(entry.getKey()) && 
"http://xxx.com/interfaces/ticket".equals(entry.getValue())) {
-exchange.getOut().setBody("Find the key!");
-return;
-}
-}
-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
-
from("jetty:http://localhost:{{port2}}/server/mytest?sendServerVersion=false&sendDateHeader=true";).transform(constant("Response!"));
-
-   
-}
-};
-}
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/Htt

[18/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
--
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
deleted file mode 100644
index 79cf75c..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.util.jsse.KeyManagersParameters;
-import org.apache.camel.util.jsse.KeyStoreParameters;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.eclipse.jetty.server.Connector;
-import org.junit.Ignore;
-
-@Ignore
-public class ExplicitHttpsSslContextParametersRouteTest extends HttpsRouteTest 
{
-
-// START SNIPPET: e2
-private Connector createSslSocketConnector(CamelContext context, int port) 
throws Exception {
-KeyStoreParameters ksp = new KeyStoreParameters();
-
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").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;
-return null;
-}
-// END SNIPPET: e2
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-public void configure() throws Exception {
-// START SNIPPET: e1
-// create SSL select channel connectors for port 9080 and 9090
-Map connectors = new HashMap();
-connectors.put(port1, createSslSocketConnector(getContext(), 
port1));
-connectors.put(port2, createSslSocketConnector(getContext(), 
port2));
-
-JettyHttpComponent jetty = getContext().getComponent("jetty", 
JettyHttpComponent.class);
-jetty.setSslSocketConnectors(connectors);
-// END SNIPPET: e1
-
-from("jetty:https://localhost:"; + port1 + 
"/test").to("mock:a");
-
-Processor proc = new Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getOut().setBody("Hello World");
-}
-};
-from("jetty:https://localhost:"; + port1 + 
"/hello").process(proc);
-
-from("jetty:https://localhost:"; + port2 + 
"/test").to("mock:b");
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
--
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
deleted file mode 100644
index 194c42f..000
--- 
a/componen

[01/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/temp-jetty9-2 [created] 0d96e56d2


http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
new file mode 100644
index 000..4838ec0
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/JettyRestRedirectTest.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+public class JettyRestRedirectTest extends BaseJettyTest {
+   
+@Test
+public void testRedirectInvocation() throws Exception {
+String response = template.requestBody("jetty:http://localhost:"; + 
getPort2() + "/metadata/profile/tag?httpClient.supportRedirect=true", 
"Camel", String.class);
+assertEquals("It should support the redirect out of box.", "Mock 
profile", response);
+}
+
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+
+return new RouteBuilder() {
+public void configure() {
+
restConfiguration().component("jetty").host("localhost").scheme("http").port(getPort2());
+rest("/metadata/profile")
+.get("/{id}").to("direct:profileLookup")
+.post("/tag").to("direct:tag");
+
+from("direct:profileLookup").transform().constant("Mock 
profile");
+from("direct:tag").log("${headers}").process(new Processor() {
+@Override
+public void process(Exchange ex) throws Exception {
+ex.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 
302);
+ex.getOut().setHeader("location", 
"/metadata/profile/1");
+}
+}).log("${headers}").transform().constant("Redirecting...");
+}
+};
+}
+
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
new file mode 100644
index 000..43ec8f3
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyBindingModeAutoWithJsonTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.rest.Rest

[19/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
--
diff --git 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
 
b/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
deleted file mode 100644
index 10ad17c..000
--- 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/CamelRedirectListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty8;
-
-import java.io.IOException;
-
-import org.eclipse.jetty.client.HttpDestination;
-import org.eclipse.jetty.client.HttpExchange;
-import org.eclipse.jetty.client.RedirectListener;
-import org.eclipse.jetty.http.HttpStatus;
-import org.eclipse.jetty.io.Buffer;
-
-public class CamelRedirectListener extends RedirectListener {
-private final HttpExchange exchange;
-
-public CamelRedirectListener(HttpDestination destination, HttpExchange ex) 
{
-super(destination, ex);
-exchange = ex;
-}
-
-@Override
-public void onResponseStatus(Buffer version, int status, Buffer reason) 
throws IOException {
-// Update the exchange method to get to support the Post/Redirect/Get
-// http://en.wikipedia.org/wiki/Post/Redirect/Get
-if (exchange.getMethod().equals("POST") && (status == 
HttpStatus.SEE_OTHER_303 || status == HttpStatus.MOVED_TEMPORARILY_302)) {
-exchange.setMethod("GET");
-}
-
-// Since the default RedirectListener only cares about http
-// response codes 301 and 302, we override this method and
-// trick the super class into handling this case for us.
-if (status == HttpStatus.SEE_OTHER_303) {
-status = HttpStatus.MOVED_TEMPORARILY_302;
-}
-
-super.onResponseStatus(version, status, reason);
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
--
diff --git 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
 
b/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
deleted file mode 100644
index 857877c..000
--- 
a/components/camel-jetty/src/main/jetty8/org/apache/camel/component/jetty8/JettyContentExchange8.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty8;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.CamelExchangeException;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangeTimedOutException;
-import org.apache.camel.component.jetty.JettyContentExchange;
-import org.apache.camel.component.jetty.JettyHttpBinding;
-import org.apache.camel.util.IOHelper;
-import org.eclipse.jetty.client.C

[06/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
new file mode 100644
index 000..52510b1
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpTwoServerPortsTest extends BaseJettyTest {
+
+private int port1;
+private int port2;
+
+@Test
+public void testTwoServerPorts() throws Exception {
+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);
+
+reply = template.requestBody("direct:a", "Earth", String.class);
+assertEquals("Bye Earth", reply);
+
+reply = template.requestBody("direct:b", "Moon", String.class);
+assertEquals("Hi Moon", reply);
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+port1 = getPort();
+port2 = getNextPort();
+
+from("direct:a").to("http://localhost:"; + port1 + "/myapp");
+
+from("direct:b").to("http://localhost:"; + port2 + 
"/myotherapp");
+
+from("jetty://http://localhost:"; + port1 + 
"/myapp").process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String in = exchange.getIn().getBody(String.class);
+exchange.getOut().setBody("Bye " + in);
+}
+});
+
+from("jetty://http://localhost:"; + port2 + 
"/myotherapp").process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+String in = exchange.getIn().getBody(String.class);
+exchange.getOut().setBody("Hi " + in);
+}
+});
+}
+};
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
new file mode 100644
index 000..d97c9f3
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpUrlRewriteTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */

Git Push Summary

2015-01-15 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/temp-jetty9-2 [deleted] a59becd7f


[03/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
new file mode 100644
index 000..bae3655
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpJettyProducerTwoEndpointTest extends BaseJettyTest {
+
+@Test
+public void testTwoEndpoints() throws Exception {
+// these tests does not run well on Windows
+if (isPlatform("windows")) {
+return;
+}
+
+// give Jetty time to startup properly
+Thread.sleep(1000);
+
+Exchange a = template.request("direct:a", null);
+assertNotNull(a);
+
+Exchange b = template.request("direct:b", null);
+assertNotNull(b);
+
+assertEquals("Bye cheese", a.getOut().getBody(String.class));
+assertEquals(246, a.getOut().getHeader("foo", 
Integer.class).intValue());
+
+assertEquals("Bye cake", b.getOut().getBody(String.class));
+assertEquals(912, b.getOut().getHeader("foo", 
Integer.class).intValue());
+
+assertEquals(5, context.getEndpoints().size());
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+
from("direct:a").to("jetty://http://localhost:{{port}}/myapp?foo=123&bar=cheese";);
+
+
from("direct:b").to("jetty://http://localhost:{{port}}/myapp?foo=456&bar=cake";);
+
+from("jetty://http://localhost:{{port}}/myapp";).process(new 
Processor() {
+public void process(Exchange exchange) throws Exception {
+int foo = exchange.getIn().getHeader("foo", 
Integer.class);
+String bar = exchange.getIn().getHeader("bar", 
String.class);
+
+exchange.getOut().setHeader("foo", foo * 2);
+exchange.getOut().setBody("Bye " + bar);
+}
+});
+}
+};
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
new file mode 100644
index 000..0b9ea95
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
@@ -0,0 +1,119 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless requi

[08/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
new file mode 100644
index 000..d5a289d
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.junit.Test;
+
+public class HttpBridgeMultipartRouteTest extends BaseJettyTest {
+
+private int port1;
+private int port2;
+
+private static class MultipartHeaderFilterStrategy extends 
DefaultHeaderFilterStrategy {
+public MultipartHeaderFilterStrategy() {
+initialize();
+}
+
+protected void initialize() {
+setLowerCase(true);
+
setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
+}
+}
+
+@Test
+public void testHttpClient() throws Exception {
+File jpg = new File("src/test/resources/java.jpg");
+String body = "TEST";
+Part[] parts = new Part[] {new StringPart("body", body), new 
FilePart(jpg.getName(), jpg)};
+
+PostMethod method = new PostMethod("http://localhost:"; + port2 + 
"/test/hello");
+MultipartRequestEntity requestEntity = new 
MultipartRequestEntity(parts, method.getParams());
+method.setRequestEntity(requestEntity);
+
+HttpClient client = new HttpClient();
+client.executeMethod(method);
+
+String responseBody = method.getResponseBodyAsString();
+assertEquals(body, responseBody);
+
+String numAttachments = 
method.getResponseHeader("numAttachments").getValue();
+assertEquals(numAttachments, "1");
+}
+
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+public void configure() {
+port1 = getPort();
+port2 = getNextPort();
+
+errorHandler(noErrorHandler());
+
+Processor serviceProc = new Processor() {
+public void process(Exchange exchange) throws Exception {
+Message in = exchange.getIn();
+// put the number of attachments in a response header
+exchange.getOut().setHeader("numAttachments", 
in.getAttachments().size());
+exchange.getOut().setBody(in.getHeader("body"));
+}
+};
+
+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:"; + port1 + 
"?matchOnUriPrefix=true").process(serviceProc);
+}
+};
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache

[01/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
Repository: camel
Updated Branches:
  refs/heads/temp-jetty9-2 [created] a59becd7f


http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
new file mode 100644
index 000..5022681
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyGetTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.jetty.JettyRestHttpBinding;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class RestJettyGetTest extends BaseJettyTest {
+
+
+@Override
+protected JndiRegistry createRegistry() throws Exception {
+JndiRegistry jndi = super.createRegistry();
+jndi.bind("mybinding", new JettyRestHttpBinding());
+return jndi;
+}
+
+@Test
+public void testJettyProducerGet() throws Exception {
+String out = template.requestBody("http://localhost:"; + getPort() + 
"/users/123/basic", null, String.class);
+assertEquals("123;Donald Duck", out);
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+// configure to use jetty on localhost with the given port
+
restConfiguration().component("jetty").host("localhost").port(getPort()).endpointProperty("httpBindingRef",
 "#mybinding");
+
+// 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");
+}
+});
+}
+};
+}
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
new file mode 100644
index 000..3f9dd28
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPojoInOutTest.java
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.rest;
+
+import org.a

[05/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
new file mode 100644
index 000..acca07d
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * 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
+public void testHttpGetWithParamsViaURI() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("one", "einz");
+mock.expectedHeaderReceived("two", "twei");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+template.requestBody(serverUri + "?one=einz&two=twei", null, 
Object.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testHttpGetWithUTF8EncodedParamsViaURI() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("message", "Keine g\u00FCltige 
GPS-Daten!");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+template.requestBody(serverUri + 
"?message=Keine%20g%C3%BCltige%20GPS-Daten!", null, Object.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+@Ignore
+public void testHttpGetWithISO8859EncodedParamsViaURI() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("message", "Keine g\u00C6ltige 
GPS-Daten!");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+template.requestBody(serverUri + 
"?message=Keine+g%C6ltige+GPS-Daten%21", null, Object.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testHttpGetWithSpaceInParams() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("message", " World");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+// parameter starts with a space using %2B as decimal encoded
+template.requestBody(serverUri + "?message=%2BWorld", null, 
Object.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testHttpGetWithSpaceAsPlusInParams() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("message", " World");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+// parameter starts with a space using + decoded
+template.requestBody(serverUri + "?message=+World", null, 
Object.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testHttpGetWithParamsViaHeader() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:result");
+mock.expectedMessageCount(1);
+mock.expectedHeaderReceived("one", "uno");
+mock.expectedHeaderReceived("two", "dos");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+template.requestBodyAndHeader(serverUri, null, Exchange.HTTP_QUERY, 
"one=

[15/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
--
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
deleted file mode 100644
index 135241f..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyContinuationDisabledTest extends BaseJettyTest {
-
-@Test
-public void testJettyContinuationDisabled() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String out = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", out);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable continuation
-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");
-}
-};
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
--
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
deleted file mode 100644
index d5b0adb..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import java.util.Set;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyEnableJmxTest extends BaseJettyTest {
-
-private String serverUri0;
-private String serverUri1;
-private String serverUri2;
-private Stri

[02/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
new file mode 100644
index 000..72a3edd
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerSimulate404ErrorTest extends BaseJettyTest {
+
+private String url = "jetty://http://0.0.0.0:"; + getPort() + "/bar";
+
+@Test
+public void test404() throws Exception {
+// these tests does not run well on Windows
+if (isPlatform("windows")) {
+return;
+}
+
+// give Jetty time to startup properly
+Thread.sleep(1000);
+
+try {
+template.sendBody(url, null);
+fail("Should have thrown exception");
+} catch (Exception e) {
+HttpOperationFailedException cause = 
assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
+assertEquals(404, cause.getStatusCode());
+assertEquals("http://0.0.0.0:"; + getPort() + "/bar", 
cause.getUri());
+assertEquals("Page not found", cause.getResponseBody());
+assertNotNull(cause.getResponseHeaders());
+}
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from(url).process(new Processor() {
+public void process(Exchange exchange) throws Exception {
+Thread.sleep(1000);
+
+exchange.getOut().setBody("Page not found");
+
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+}
+});
+}
+};
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java
new file mode 100644
index 000..c4cfd99
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permission

[14/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
--
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
deleted file mode 100644
index 8d2eeed..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.aggregate.AggregationStrategy;
-import org.junit.Test;
-
-/**
- * Based on end user on forum how to get the 404 error code in his enrich 
aggregator
- *
- * @version 
- */
-public class JettySimplifiedHandle404Test extends BaseJettyTest {
-
-@Test
-public void testSimulate404() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedBodiesReceived("Page not found");
-mock.expectedHeaderReceived(Exchange.HTTP_RESPONSE_CODE, 404);
-
-template.sendBody("direct:start", "Hello World");
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-// disable error handling
-errorHandler(noErrorHandler());
-
-// START SNIPPET: e1
-// 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
-
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
-Integer code = 
resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
-assertEquals(404, code.intValue());
-return resource;
-}
-}).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);
-}
-});
-// END SNIPPET: e1
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
--
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
deleted file mode 100644
index 1d5000d..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
-

[11/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
deleted file mode 100644
index bb39070..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.jetty.HttpsRouteTest;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class JettyProducerHttpsRouteTest extends HttpsRouteTest {
-
-public String getHttpProducerScheme() {
-return "jetty://https://";;
-}
-
-@Test
-public void testEndpointWithoutHttps() throws Exception {
-// these tests does not run well on Windows
-if (isPlatform("windows")) {
-return;
-}
-
-// give Jetty time to startup properly
-Thread.sleep(1000);
-
-MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:a", 
MockEndpoint.class);
-try {
-template.sendBodyAndHeader("jetty://http://localhost:"; + port1 + 
"/test", expectedBody, "Content-Type", "application/xml");
-fail("expect exception on access to https endpoint via http");
-} catch (RuntimeCamelException expected) {
-}
-assertTrue("mock endpoint was not called", 
mockEndpoint.getExchanges().isEmpty());
-}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
 
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
deleted file mode 100644
index b93fb26..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.jettyproducer;
-
-import java.io.Serializable;
-
-/**
- * @version 
- */
-public class MyCoolBean implements Serializable {
-
-private static final long serialVersionUID = 1L;
-private final int id;
-private final String name;
-
-public MyCoolBean(int id, String name) {
-this.id = id;
-this.name = name;
-}
-
-public int getId() {
-return id;
-}
-
-public String getName() {
-return name;
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyInputStream.java
--
diff --git 
a/components/camel-jetty/src/test/java/org/apache/camel/component/je

[21/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/pom.xml
--
diff --git a/components/camel-jetty/pom.xml b/components/camel-jetty/pom.xml
deleted file mode 100644
index b2d3270..000
--- a/components/camel-jetty/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-4.0.0
-
-
-org.apache.camel
-components
-2.15-SNAPSHOT
-
-
-camel-jetty
-bundle
-Camel :: Jetty
-Camel Jetty support
-
-
-
-javax.servlet.*;version="${servlet-version-range}"
-
-
org.apache.camel.component.jetty*
-
org.apache.camel.spi.ComponentResolver;component=jetty
-
-
-
-
-
-org.apache.camel
-camel-core
-
-
-org.apache.camel
-camel-http
-
-
-org.apache.geronimo.specs
-geronimo-servlet_3.0_spec
-
-
-org.eclipse.jetty
-jetty-server
-
-   
-   javax.servlet
-   servlet-api
-   
-   
-   org.eclipse.jetty.orbit
-   javax.servlet
-   
-
-
-
-org.eclipse.jetty
-jetty-servlet
-
-
-org.eclipse.jetty
-jetty-security
-
-
-org.eclipse.jetty
-jetty-servlets
-
-
-org.eclipse.jetty
-jetty-client
-
-
-org.eclipse.jetty
-jetty-jmx
-
-
-
-
-org.apache.camel
-camel-test-spring
-test
-
-
-org.apache.camel
-camel-spring
-test
-
-
-org.springframework
-spring-test
-true
-test
-
-
-
-  org.apache.camel
-  camel-jackson
-  test
-
-
-  org.apache.camel
-  camel-jaxb
-  test
-
-
-
-junit
-junit
-test
-
-
-org.slf4j
-slf4j-log4j12
-test
-
-
-
-
-
-jetty9
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty9
-
-
-
-
-
-
-
-
-
-jetty8
-
-true
-
-
-
-
-org.codehaus.mojo
-build-helper-maven-plugin
-
-
-generate-sources
-
-add-source
-
-
-
-src/main/jetty8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-maven-surefire-plugin
-
-   1
-   false
-
1800
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
deleted file mode 100644
index 3ab15f2..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) unde

[09/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
--
diff --git 
a/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
new file mode 100644
index 000..ec53cdc
--- /dev/null
+++ 
b/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
@@ -0,0 +1,140 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty9;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.component.jetty.CamelHttpClient;
+import org.apache.camel.component.jetty.JettyHttpComponent;
+import org.apache.camel.component.jetty.JettyHttpEndpoint;
+import org.apache.camel.util.IntrospectionSupport;
+import org.eclipse.jetty.server.AbstractConnector;
+import org.eclipse.jetty.server.ConnectionFactory;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+public class JettyHttpComponent9 extends JettyHttpComponent {
+
+protected CamelHttpClient createCamelHttpClient(SslContextFactory 
sslContextFactory) {
+return new CamelHttpClient9(sslContextFactory);
+}
+
+protected JettyHttpEndpoint createEndpoint(URI endpointUri, URI httpUri) 
throws URISyntaxException {
+return new JettyHttpEndpoint9(this, endpointUri.toString(), httpUri);
+}
+
+protected Connector getSslSocketConnector(Server server, JettyHttpEndpoint 
endpoint) {
+Connector answer = null;
+/*
+if (sslSocketConnectors != null) {
+SslContextFactory con = 
sslSocketConnectors.get(endpoint.getPort());
+if (con != null) {
+SslConnectionFactory sslConnectionFactory = new 
SslConnectionFactory(con, null);
+@SuppressWarnings("resource")
+ServerConnector sc = new ServerConnector(server, 
sslConnectionFactory);
+sc.setPort(endpoint.getPort());
+sc.setHost(endpoint.getHttpUri().getHost());
+answer = sc;
+}
+}
+*/
+if (answer == null) {
+answer = createConnector(server, endpoint);
+}
+return answer;
+}
+
+protected AbstractConnector createConnectorJettyInternal(Server server,
+  JettyHttpEndpoint 
endpoint,
+  SslContextFactory sslcf) 
{
+try {
+String hosto = endpoint.getHttpUri().getHost();
+int porto = endpoint.getPort();
+org.eclipse.jetty.server.HttpConfiguration httpConfig = new 
org.eclipse.jetty.server.HttpConfiguration();
+httpConfig.setSendServerVersion(endpoint.isSendServerVersion());
+httpConfig.setSendDateHeader(endpoint.isSendDateHeader());
+httpConfig.setSendDateHeader(endpoint.isSendDateHeader());
+
+if (requestBufferSize != null) {
+// Does not work
+//httpConfig.setRequestBufferSize(requestBufferSize);
+}
+if (requestHeaderSize != null) {
+httpConfig.setRequestHeaderSize(requestHeaderSize);
+}
+if (responseBufferSize != null) {
+httpConfig.setOutputBufferSize(responseBufferSize);
+}
+if (responseHeaderSize != null) {
+httpConfig.setResponseHeaderSize(responseHeaderSize);
+}
+
+HttpConnectionFactory httpFactory = new 
org.eclipse.jetty.server.HttpConnectionFactory(httpConfig); 
+
+ArrayList connectionFactories = new 
Arr

[13/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
--
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
deleted file mode 100644
index 07614f7..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncFilterTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, "Hello Camel", 
String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-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");
-}
-};
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
--
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
deleted file mode 100644
index e082076..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty.async;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.BaseJettyTest;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class JettyAsyncTest extends BaseJettyTest {
-
-@Test
-public void testJettyAsync() throws Exception {
-getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
-String reply = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
-assertEquals("Bye World", reply);
-
-assertMockEndpointsSatisfied();
-}
-
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
-@Override
-public void configure() throws Exception {
-context.addComponent("async", 

[20/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
--
diff --git 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
 
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
deleted file mode 100644
index c3bc309..000
--- 
a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ /dev/null
@@ -1,1203 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.servlet.Filter;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.http.CamelServlet;
-import org.apache.camel.component.http.HttpBinding;
-import org.apache.camel.component.http.HttpComponent;
-import org.apache.camel.component.http.HttpConsumer;
-import org.apache.camel.component.http.HttpEndpoint;
-import org.apache.camel.component.http.UrlRewrite;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.ManagementAgent;
-import org.apache.camel.spi.ManagementStrategy;
-import org.apache.camel.spi.RestConfiguration;
-import org.apache.camel.spi.RestConsumerFactory;
-import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.HostUtils;
-import org.apache.camel.util.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.apache.camel.util.UnsafeUriCharactersEncoder;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.http.HttpStatus;
-import org.eclipse.jetty.jmx.MBeanContainer;
-import org.eclipse.jetty.server.AbstractConnector;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.handler.ErrorHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.server.handler.HandlerWrapper;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.servlets.CrossOriginFilter;
-import org.eclipse.jetty.servlets.MultiPartFilter;
-import org.eclipse.jetty.util.component.Container;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.util.thread.ThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An HttpComponent which starts an embedded Jetty for to handle consuming from
- * the http endpoints.
- *
- * @version 
- */
-public abstract class JettyHttpComponent extends HttpComponent implements 
RestConsumerFactory {
-public static final String TMP_DIR = "CamelJettyTempDir";
-
-protected static final HashMap CONNECTORS = new 
HashMap();
-   
-private static final Logger LOG = 
LoggerFactory.getLogger(JettyHttpComponent.class);
-private static final String JETTY_SSL_KEYSTORE = 
"org.eclipse.jetty.ssl.keystore";
-private static final String JETTY_SSL_KEY

[04/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
--
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
new file mode 100644
index 000..d1f77db
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpComponent;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class MultiThreadedHttpGetTest extends BaseJettyTest {
+
+@Test
+public void testHttpGetWithConversion() throws Exception {
+
+// In this scenario response stream is converted to String
+// so the stream has to be read to the end. When this happens
+// the associated connection is released automatically.
+
+String endpointName = "seda:withConversion?concurrentConsumers=5";
+sendMessagesTo(endpointName, 5);
+}
+
+@Test
+public void testHttpGetWithoutConversion() throws Exception {
+
+// This is needed as by default there are 2 parallel
+// connections to some host and there is nothing that
+// closes the http connection here.
+// Need to set the httpConnectionManager 
+HttpConnectionManager httpConnectionManager = new 
MultiThreadedHttpConnectionManager();
+httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(5);
+context.getComponent("http", 
HttpComponent.class).setHttpConnectionManager(httpConnectionManager);
+   
+
+String endpointName = "seda:withoutConversion?concurrentConsumers=5";
+sendMessagesTo(endpointName, 5);
+}
+
+@Test
+public void testHttpGetWithExplicitStreamClose() throws Exception {
+
+// We close connections explicitely at the very end of the flow
+// (camel doesn't know when the stream is not needed any more)
+
+MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", 
MockEndpoint.class);
+
+for (int i = 0; i < 5; i++) {
+mockEndpoint.expectedMessageCount(1);
+template.sendBody("seda:withoutConversion?concurrentConsumers=5", 
null);
+mockEndpoint.assertIsSatisfied();
+Object response = 
mockEndpoint.getReceivedExchanges().get(0).getIn().getBody();
+InputStream responseStream = assertIsInstanceOf(InputStream.class, 
response);
+responseStream.close();
+mockEndpoint.reset();
+}
+}
+
+protected void sendMessagesTo(String endpointName, int count) throws 
InterruptedException {
+MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", 
MockEndpoint.class);
+mockEndpoint.expectedMessageCount(count);
+
+for (int i = 0; i < count; i++) {
+template.sendBody(endpointName, null);
+}
+
+mockEndpoint.assertIsSatisfied();
+List list = mockEndpoint.getReceivedExchanges();
+for (Exchange exchange : list) {
+String body = exchange.getIn().getBody(String.class);
+
+log.debug("Body: " + body);
+assertNotNull("Should have a body!", body);
+assertTrue("body should contain: http://localhost:{{port}}/search";)
+.convertBodyTo(String.class).to("mock:results");
+
+
from("seda:withoutConversion?concurrentConsumers=5").to("http://localhost:{{port}}/search";)
+.to("mock:results");
+
+ 

[23/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
CAMEL-8239 Split jetty8 and jetty9 support into separate modules


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

Branch: refs/heads/temp-jetty9-2
Commit: a59becd7f80e1c6d64c8a91c4086384926b0f335
Parents: 601ea3a
Author: Christian Schneider 
Authored: Thu Jan 15 09:45:21 2015 +0100
Committer: Christian Schneider 
Committed: Thu Jan 15 09:45:21 2015 +0100

--
 apache-camel/pom.xml|   10 +-
 components/camel-ahc/pom.xml|2 +-
 components/camel-cxf-transport/pom.xml  |2 +-
 components/camel-cxf/pom.xml|2 +-
 components/camel-jetty-common/pom.xml   |  130 ++
 .../jetty/CamelContinuationServlet.java |  212 +++
 .../component/jetty/CamelFilterWrapper.java |   71 ++
 .../camel/component/jetty/CamelHttpClient.java  |   78 ++
 .../component/jetty/CamelMultipartFilter.java   |   31 +
 .../jetty/DefaultJettyHttpBinding.java  |  194 +++
 .../component/jetty/JettyContentExchange.java   |   70 +
 .../camel/component/jetty/JettyConverter.java   |   53 +
 .../camel/component/jetty/JettyHttpBinding.java |   86 ++
 .../component/jetty/JettyHttpComponent.java | 1203 ++
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 +
 .../component/jetty/JettyRestHttpBinding.java   |   75 ++
 ...JettyRestServletResolveConsumerStrategy.java |  163 +++
 .../apache/camel/component/jetty/package.html   |   25 +
 components/camel-jetty/pom.xml  |  198 ---
 .../jetty/CamelContinuationServlet.java |  212 ---
 .../component/jetty/CamelFilterWrapper.java |   71 --
 .../camel/component/jetty/CamelHttpClient.java  |   78 --
 .../component/jetty/CamelMultipartFilter.java   |   31 -
 .../jetty/DefaultJettyHttpBinding.java  |  194 ---
 .../component/jetty/JettyContentExchange.java   |   70 -
 .../camel/component/jetty/JettyConverter.java   |   53 -
 .../camel/component/jetty/JettyHttpBinding.java |   86 --
 .../component/jetty/JettyHttpComponent.java | 1203 --
 .../component/jetty/JettyHttpEndpoint.java  |  283 
 .../component/jetty/JettyHttpProducer.java  |  305 -
 .../component/jetty/JettyRestHttpBinding.java   |   75 --
 ...JettyRestServletResolveConsumerStrategy.java |  163 ---
 .../apache/camel/component/jetty/package.html   |   25 -
 .../component/jetty8/CamelHttpClient8.java  |   68 -
 .../component/jetty8/CamelRedirectListener.java |   52 -
 .../component/jetty8/JettyContentExchange8.java |  287 -
 .../component/jetty8/JettyHttpComponent8.java   |  132 --
 .../component/jetty8/JettyHttpEndpoint8.java|   36 -
 .../component/jetty9/AttachmentHttpBinding.java |   75 --
 .../component/jetty9/CamelHttpClient9.java  |   52 -
 .../component/jetty9/JettyContentExchange9.java |  295 -
 .../component/jetty9/JettyHttpComponent9.java   |  140 --
 .../component/jetty9/JettyHttpEndpoint9.java|   36 -
 .../src/main/resources/META-INF/LICENSE.txt |  203 ---
 .../src/main/resources/META-INF/NOTICE.txt  |   11 -
 .../services/org/apache/camel/TypeConverter |   18 -
 .../services/org/apache/camel/component/jetty   |   17 -
 components/camel-jetty/src/test/data/logo.jpeg  |  Bin 10249 -> 0 bytes
 components/camel-jetty/src/test/data/plain.txt  |   18 -
 .../camel/component/jetty/BaseJettyTest.java|  119 --
 .../jetty/ConvertPayloadToInputStreamTest.java  |   64 -
 .../component/jetty/CustomFiltersTest.java  |  109 --
 .../camel/component/jetty/EnableCORSTest.java   |   71 --
 .../component/jetty/ExplicitHttpsRouteTest.java |   69 -
 ...licitHttpsSslContextParametersRouteTest.java |   85 --
 .../component/jetty/ExplicitJettyRouteTest.java |   65 -
 .../camel/component/jetty/HandlerTest.java  |  106 --
 .../jetty/HttpAuthMethodPriorityTest.java   |  125 --
 .../HttpBasicAuthComponentConfiguredTest.java   |  109 --
 .../component/jetty/HttpBasicAuthTest.java  |  106 --
 ...ndingPreservePostFormUrlEncodedBodyTest.java |   66 -
 .../component/jetty/HttpBindingRefTest.java |   93 --
 .../jetty/HttpBridgeEncodedPathTest.java|   65 -
 .../jetty/HttpBridgeMultipartRouteTest.java |   99 --
 .../component/jetty/HttpBridgeRouteTest.java|   72 --
 .../jetty/HttpCharacterEncodingTest.java|   64 -
 .../jetty/HttpClientRouteEnableChunkedTest.java |   84 --
 .../component/jetty/HttpClientRouteTest.java|  147 ---
 .../component/jetty/HttpConverterTest.java  |  131 --
 .../component/jetty/HttpEndpointURLTest.java|   30 -
 .../jetty/HttpEndpointUriEncodingIssueTest.java |   68 -
 .../jetty/HttpFilterCamelHeadersTest.java   |   79 --
 .../

[16/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules

2015-01-15 Thread cschneider
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
--
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
deleted file mode 100644
index 89cfbd0..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class HttpSendFileTest extends BaseJettyTest {
-
-@Test
-public void testSendImage() throws Exception {
-MockEndpoint mock = getMockEndpoint("mock:result");
-mock.expectedMinimumMessageCount(1);
-mock.message(0).body().isInstanceOf(InputStream.class);
-mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
-
-Exchange out = 
template.send("http://localhost:{{port}}/myapp/myservice";, new Processor() {
-public void process(Exchange exchange) throws Exception {
-exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
-exchange.getIn().setHeader("Content-Type", "image/jpeg");
-}
-});
-
-assertMockEndpointsSatisfied();
-
-assertEquals("OK", out.getOut().getBody(String.class));
-assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
-}
-
-@Override
-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"));
-}
-};
-}
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
--
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
deleted file mode 100644
index d86b37b..000
--- 
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileIssueTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jetty;
-
-import java.io.File;
-
-import org.apache.camel

  1   2   3   >