You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/09/03 17:09:21 UTC

svn commit: r572359 - in /activemq/camel/trunk/components/camel-jetty/src: main/java/org/apache/camel/component/jetty/ test/java/org/apache/camel/component/jetty/

Author: jstrachan
Date: Mon Sep  3 08:09:20 2007
New Revision: 572359

URL: http://svn.apache.org/viewvc?rev=572359&view=rev
Log:
fixed the failing tests in the camel-jetty after they were broken by the polling mechanism in camel-http being added

Added:
    activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java   (with props)
Modified:
    activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
    activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGetTest.java

Modified: activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=572359&r1=572358&r2=572359&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java (original)
+++ activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java Mon Sep  3 08:09:20 2007
@@ -21,7 +21,6 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.http.CamelServlet;
 import org.apache.camel.component.http.HttpComponent;
 import org.apache.camel.component.http.HttpConsumer;
@@ -70,12 +69,7 @@
     @Override
     protected Endpoint<HttpExchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
         URI httpURL = uri.startsWith("jetty:") ? new URI(remaining) : new URI(uri);
-        return new HttpEndpoint(uri, this, httpURL) {
-            @Override
-            public JettyHttpProducer createProducer() throws Exception {
-                return new JettyHttpProducer(this);
-            }
-        };
+        return new JettyHttpEndpoint(this, uri, httpURL);
     }
 
     /**

Added: activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java?rev=572359&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java (added)
+++ activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java Mon Sep  3 08:09:20 2007
@@ -0,0 +1,61 @@
+/**
+ *
+ * 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.Consumer;
+import org.apache.camel.PollingConsumer;
+import org.apache.camel.Processor;
+import org.apache.camel.component.http.HttpConsumer;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpExchange;
+import org.apache.camel.impl.DefaultPollingConsumer;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JettyHttpEndpoint extends HttpEndpoint {
+    private JettyHttpComponent component;
+
+    public JettyHttpEndpoint(JettyHttpComponent component, String uri, URI httpURL) throws URISyntaxException {
+        super(uri, component, httpURL);
+        this.component = component;
+    }
+
+    @Override
+    public JettyHttpProducer createProducer() throws Exception {
+        return new JettyHttpProducer(this);
+    }
+
+    @Override
+    public Consumer<HttpExchange> createConsumer(Processor processor) throws Exception {
+        return new HttpConsumer(this, processor);
+    }
+
+    @Override
+    public PollingConsumer<HttpExchange> createPollingConsumer() throws Exception {
+        return new DefaultPollingConsumer(this);
+    }
+
+    @Override
+    public JettyHttpComponent getComponent() {
+        return component;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGetTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGetTest.java?rev=572359&r1=572358&r2=572359&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGetTest.java (original)
+++ activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGetTest.java Mon Sep  3 08:09:20 2007
@@ -54,7 +54,8 @@
 
         log.debug("Body: " + body);
         assertNotNull("Should have a body!", body);
-        assertTrue("body should contain: " + expectedText, body.contains(expectedText));
+        body = body.toLowerCase();
+        assertTrue("body should contain: " + expectedText + " but was: " + body, body.contains(expectedText));
     }
 
     @Override