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 2010/04/10 14:19:16 UTC

svn commit: r932709 - in /camel/trunk/tests/camel-itest/src/test: java/org/apache/camel/itest/http/ resources/org/apache/camel/itest/http/

Author: davsclaus
Date: Sat Apr 10 12:19:16 2010
New Revision: 932709

URL: http://svn.apache.org/viewvc?rev=932709&view=rev
Log:
CAMEL-2608: Added the tests for the old camel-http component.

Added:
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java   (with props)
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java   (with props)
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml   (with props)
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml   (with props)

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java?rev=932709&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java Sat Apr 10 12:19:16 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.itest.http;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+
+@ContextConfiguration
+public class HttpEndpointTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    protected CamelContext camelContext;
+
+    @EndpointInject(uri = "direct:start")
+    protected ProducerTemplate producer;
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint mock;
+
+    @Test
+    public void testMocksIsValid() throws Exception {
+        mock.expectedMessageCount(1);
+
+        producer.sendBody(null);
+
+        mock.assertIsSatisfied();
+    }
+
+}

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpEndpointTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java?rev=932709&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java Sat Apr 10 12:19:16 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.itest.http;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class HttpMaxConnectionPerHostTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    protected CamelContext camelContext;
+
+    @EndpointInject(uri = "direct:start")
+    protected ProducerTemplate producer;
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint mock;
+
+    @Test
+    public void testMocksIsValid() throws Exception {
+        mock.expectedMessageCount(1);
+
+        producer.sendBody(null);
+
+        mock.assertIsSatisfied();
+    }
+
+}

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml?rev=932709&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml Sat Apr 10 12:19:16 2010
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="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-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: e1 -->
+    <bean id="google" class="org.apache.camel.component.http.HttpEndpoint">
+        <property name="httpUri" value="http://www.google.com"/>
+        <property name="clientParams" ref="myParams"/>
+        <property name="httpConnectionManager" ref="myManager"/>
+    </bean>
+
+    <bean id="myParams" class="org.apache.commons.httpclient.params.HttpClientParams"/>
+    
+    <bean id="myManager" class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager"/>
+    <!-- END SNIPPET: e1 -->
+
+    <!-- START SNIPPET: e2 -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true">
+        <route>
+            <from uri="direct:start"/>
+            <to uri="google"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: e2 -->
+
+</beans>

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpEndpointTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml?rev=932709&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml Sat Apr 10 12:19:16 2010
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="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-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: e1 -->
+    <bean id="http" class="org.apache.camel.component.http.HttpComponent">
+        <property name="camelContext" ref="camel"/>
+        <property name="httpConnectionManager" ref="myHttpConnectionManager"/>
+    </bean>
+
+    <bean id="myHttpConnectionManager" class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
+        <property name="params" ref="myHttpConnectionManagerParams"/>
+    </bean>
+
+    <bean id="myHttpConnectionManagerParams" class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
+        <property name="defaultMaxConnectionsPerHost" value="5"/>
+    </bean>
+
+    <!-- END SNIPPET: e1 -->
+
+    <!-- START SNIPPET: e2 -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true">
+        <route>
+            <from uri="direct:start"/>
+            <to uri="http://www.google.com"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: e2 -->
+
+</beans>

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml