You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/11/02 13:06:17 UTC
svn commit: r1404934 - in /camel/trunk/components/camel-jetty/src:
main/java/org/apache/camel/component/jetty/
test/java/org/apache/camel/component/jetty/
test/resources/org/apache/camel/component/jetty/
Author: davsclaus
Date: Fri Nov 2 12:06:16 2012
New Revision: 1404934
URL: http://svn.apache.org/viewvc?rev=1404934&view=rev
Log:
CAMEL-5766: Fixed issue with using jetty component with other name than jetty.
Added:
camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java (with props)
camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml
- copied, changed from r1404920, camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
Modified:
camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=1404934&r1=1404933&r2=1404934&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java (original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java Fri Nov 2 12:06:16 2012
@@ -194,7 +194,7 @@ public class JettyHttpComponent extends
httpClientParameters.remove(key);
}
- String address = uri.startsWith("jetty:") ? remaining : uri;
+ String address = remaining;
URI addressUri = new URI(UnsafeUriCharactersEncoder.encode(address));
URI endpointUri = URISupport.createRemainingURI(addressUri, httpClientParameters);
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
Added: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java?rev=1404934&view=auto
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java (added)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java Fri Nov 2 12:06:16 2012
@@ -0,0 +1,48 @@
+/**
+ * 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.test.junit4.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ *
+ */
+public class JettyComponentSpringConfiguredTest extends CamelSpringTestSupport {
+
+ @Override
+ protected boolean useJmx() {
+ return true;
+ }
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml");
+ }
+
+ @Test
+ @Ignore("run manual test")
+ public void testJetty2() throws Exception {
+ assertNotNull("Should have jetty2 component", context.hasComponent("jetty2"));
+
+ String reply = template.requestBody("jetty2:http://localhost:9090/myapp", "Camel", String.class);
+ assertEquals("Hello Camel", reply);
+ }
+}
Propchange: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml (from r1404920, camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml?p2=camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml&p1=camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml&r1=1404920&r2=1404934&rev=1404934&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml (original)
+++ camel/trunk/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml Fri Nov 2 12:06:16 2012
@@ -16,41 +16,27 @@
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
+ 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
">
+ <bean id="jetty2" class="org.apache.camel.component.jetty.JettyHttpComponent">
+ <property name="enableJmx" value="true"/>
+ <property name="minThreads" value="10"/>
+ <property name="maxThreads" value="50"/>
+ </bean>
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="jetty2:http://localhost:9090/myapp"/>
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ </route>
- <bean id="dynaPort" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="targetClass">
- <value>org.apache.camel.test.AvailablePortFinder</value>
- </property>
- <property name="targetMethod">
- <value>getNextAvailable</value>
- </property>
- <property name="arguments">
- <list>
- <value>5000</value>
- </list>
- </property>
- </bean>
-
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <endpoint id="httpEndpoint" uri="http://localhost:#{dynaPort}/hi"/>
- <endpoint id="jettyEndpoint" uri="jetty:http://localhost:#{dynaPort}/hi"/>
-
- <route>
- <from uri="direct:start"/>
- <to ref="httpEndpoint"/>
- </route>
-
- <route id="jetty">
- <from ref="jettyEndpoint"/>
- <transform><simple>Bye ${body}</simple></transform>
- </route>
-
- </camelContext>
+ </camelContext>
</beans>