Hi Martin

You may have forgotten to add a class to SVN

[INFO] Compiling 39 source files to
/Users/davsclaus/workspace/camel/components/camel-gae/target/test-classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/Users/davsclaus/workspace/camel/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java:[51,49]
cannot find symbol
symbol  : class GHttpTestServlet
location: class org.apache.camel.component.gae.http.GHttpTestUtils



On Sat, Apr 3, 2010 at 5:57 PM,  <krass...@apache.org> wrote:
> Author: krasserm
> Date: Sat Apr  3 15:57:29 2010
> New Revision: 930535
>
> URL: http://svn.apache.org/viewvc?rev=930535&view=rev
> Log:
> use GAE SDK mocks for gmail component tests, minor edits in gmail component
>
> Removed:
>    
> camel/trunk/components/camel-gae/src/test/java/com/google/appengine/api/urlfetch/
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/MockUrlFetchService.java
> Modified:
>    camel/trunk/components/camel-gae/pom.xml
>    
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
>    
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
>    
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpBindingTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilder.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilderTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java
>    
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java
>    
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml
>    
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml
>    
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml
>
> Modified: camel/trunk/components/camel-gae/pom.xml
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/pom.xml?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- camel/trunk/components/camel-gae/pom.xml (original)
> +++ camel/trunk/components/camel-gae/pom.xml Sat Apr  3 15:57:29 2010
> @@ -78,6 +78,14 @@
>       <version>${appengine-sdk-version}</version>
>     </dependency>
>     <dependency>
> +      <groupId>org.eclipse.jetty</groupId>
> +      <artifactId>jetty-server</artifactId>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.eclipse.jetty</groupId>
> +      <artifactId>jetty-servlet</artifactId>
> +    </dependency>
> +    <dependency>
>       <groupId>org.apache.camel</groupId>
>       <artifactId>camel-test</artifactId>
>       <scope>test</scope>
>
> Modified: 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
>  Sat Apr  3 15:57:29 2010
> @@ -19,9 +19,6 @@ package org.apache.camel.component.gae.h
>  import java.net.URI;
>  import java.util.Map;
>
> -import com.google.appengine.api.urlfetch.URLFetchService;
> -import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
> -
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.component.gae.bind.InboundBinding;
>  import org.apache.camel.component.gae.bind.OutboundBinding;
> @@ -50,14 +47,11 @@ public class GHttpComponent extends Serv
>                 parameters, "outboundBindingRef", OutboundBinding.class, new 
> GHttpBinding());
>         InboundBinding inboundBinding = resolveAndRemoveReferenceParameter(
>                 parameters, "inboundBindingRef", InboundBinding.class, new 
> GHttpBinding());
> -        URLFetchService service = resolveAndRemoveReferenceParameter(
> -                parameters, "urlFetchServiceRef", URLFetchService.class, 
> URLFetchServiceFactory.getURLFetchService());
>         GHttpEndpoint endpoint = (GHttpEndpoint)super.createEndpoint(uri, 
> remaining, parameters);
>         endpoint.setThrowExceptionOnFailure(throwException);
>         endpoint.setBridgeEndpoint(bridgeEndpoint);
>         endpoint.setOutboundBinding(outboundBinding);
>         endpoint.setInboundBinding(inboundBinding);
> -        endpoint.setUrlFetchService(service);
>         return endpoint;
>     }
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
>  Sat Apr  3 15:57:29 2010
> @@ -29,6 +29,7 @@ import com.google.appengine.api.urlfetch
>  import com.google.appengine.api.urlfetch.HTTPResponse;
>  import com.google.appengine.api.urlfetch.URLFetchService;
>
> +import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Producer;
>  import org.apache.camel.component.gae.bind.HttpBindingInvocationHandler;
> @@ -66,6 +67,7 @@ public class GHttpEndpoint extends Servl
>             ClientConnectionManager httpConnectionManager,
>             HttpClientConfigurer clientConfigurer) throws URISyntaxException {
>         super(endpointUri, component, httpUri, params, httpConnectionManager, 
> clientConfigurer);
> +        urlFetchService = URLFetchServiceFactory.getURLFetchService();
>     }
>
>     /**
>
> Modified: 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
>  Sat Apr  3 15:57:29 2010
> @@ -18,9 +18,6 @@ package org.apache.camel.component.gae.m
>
>  import java.util.Map;
>
> -import com.google.appengine.api.mail.MailService;
> -import com.google.appengine.api.mail.MailServiceFactory;
> -
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.component.gae.bind.OutboundBinding;
>  import org.apache.camel.impl.DefaultComponent;
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpBindingTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpBindingTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpBindingTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpBindingTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -16,14 +16,19 @@
>  */
>  package org.apache.camel.component.gae.http;
>
> -import java.io.InputStream;
> -
> +import com.google.appengine.api.urlfetch.HTTPHeader;
>  import com.google.appengine.api.urlfetch.HTTPMethod;
>  import com.google.appengine.api.urlfetch.HTTPRequest;
> -import com.google.appengine.api.urlfetch.MockHttpResponse;
> -
> +import com.google.appengine.api.urlfetch.HTTPResponse;
> +import com.google.appengine.api.urlfetch.URLFetchService;
> +import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
> +import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
> +import 
> com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.impl.DefaultExchange;
> +import org.eclipse.jetty.server.Server;
> +import org.junit.After;
> +import org.junit.AfterClass;
>  import org.junit.Before;
>  import org.junit.BeforeClass;
>  import org.junit.Test;
> @@ -33,25 +38,44 @@ import static org.apache.camel.component
>  import static 
> org.apache.camel.component.gae.http.GHttpTestUtils.getCamelContext;
>  import static org.junit.Assert.assertArrayEquals;
>  import static org.junit.Assert.assertEquals;
> -import static org.junit.Assert.assertNull;
>
>  public class GHttpBindingTest {
>
> +    private static Server testServer;
>     private static GHttpBinding binding;
>
> +    private final LocalURLFetchServiceTestConfig config = new 
> LocalURLFetchServiceTestConfig();
> +    private final LocalServiceTestHelper helper = new 
> LocalServiceTestHelper(config);
> +
> +    private URLFetchService service;
> +
>     private Exchange exchange;
>
>
>     @BeforeClass
> -    public static void setUpClass() {
> +    public static void setUpClass() throws Exception {
>         binding = new GHttpBinding();
> +        testServer = GHttpTestUtils.createTestServer(7441);
> +        testServer.start();
>     }
>
> +   �...@afterclass
> +    public static void tearDownAfterClass() throws Exception  {
> +        testServer.stop();
> +    }
> +
>     @Before
>     public void setUp() throws Exception {
> +        helper.setUp();
> +        service = URLFetchServiceFactory.getURLFetchService();
>         exchange = new DefaultExchange(getCamelContext());
>     }
>
> +   �...@after
> +    public void tearDown() throws Exception {
> +        helper.tearDown();
> +    }
> +
>     @Test
>     public void testGetRequestMethod() {
>         assertEquals(HTTPMethod.GET, binding.getRequestMethod(null, 
> exchange));
> @@ -126,46 +150,44 @@ public class GHttpBindingTest {
>
>     @Test
>     public void testReadResponseHeaders() throws Exception {
> -        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://somewhere.com:9090/path";);
> -        MockHttpResponse response = new MockHttpResponse(200);
> -        response.addHeader("test", "abc");
> -        response.addHeader("content-type", "text/plain");
> +        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://localhost:7441/test";);
> +        HTTPRequest request = new HTTPRequest(endpoint.getEndpointUrl());
> +        request.addHeader(new HTTPHeader("test", "abc"));
> +        request.addHeader(new HTTPHeader("content-type", "text/plain"));
> +        HTTPResponse response = service.fetch(request);
>         binding.readResponseHeaders(endpoint, exchange, response);
>         assertEquals(200, 
> exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
>         assertEquals("abc", exchange.getOut().getHeader("test"));
>         assertEquals("text/plain", 
> exchange.getOut().getHeader("content-type"));
>     }
> -
> +
>     @Test
>     public void testReadResponseBody() throws Exception {
> -        MockHttpResponse response = new MockHttpResponse(200);
> -        response.setContent("abc".getBytes());
> +        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://localhost:7441/test";);
> +        HTTPRequest request = new HTTPRequest(endpoint.getEndpointUrl(), 
> HTTPMethod.POST);
> +        request.setPayload("abc".getBytes());
> +        HTTPResponse response = service.fetch(request);
>         binding.readResponseBody(null, exchange, response);
> -        InputStream stream = exchange.getOut().getBody(InputStream.class);
> -        assertEquals("abc".getBytes()[0], stream.read());
> -    }
> -
> -   �...@test
> -    public void testReadNullResponseBody() throws Exception {
> -        MockHttpResponse response = new MockHttpResponse(200);
> -        binding.readResponseBody(null, exchange, response);
> -        InputStream stream = exchange.getOut().getBody(InputStream.class);
> -        assertNull(stream);
> +        assertEquals("abc", exchange.getOut().getBody(String.class));
>     }
>
>     @Test(expected = GHttpException.class)
>     public void testFailureException() throws Exception {
> -        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://somewhere.com:9090/path";);
> -        MockHttpResponse response = new MockHttpResponse(500);
> +        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://localhost:7441/test";);
> +        HTTPRequest request = new HTTPRequest(endpoint.getEndpointUrl());
> +        request.addHeader(new HTTPHeader("code", "500"));
> +        HTTPResponse response = service.fetch(request);
>         binding.readResponse(endpoint, exchange, response);
>     }
>
>     @Test
>     public void testFailureNoException() throws Exception {
> -        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://somewhere.com:9090/path?throwExceptionOnFailure=false";);
> -        MockHttpResponse response = new MockHttpResponse(500);
> +        GHttpEndpoint endpoint = 
> createEndpoint("ghttp://localhost:7441/test?throwExceptionOnFailure=false";);
> +        HTTPRequest request = new HTTPRequest(endpoint.getEndpointUrl());
> +        request.addHeader(new HTTPHeader("code", "500"));
> +        HTTPResponse response = service.fetch(request);
>         binding.readResponse(endpoint, exchange, response);
>         assertEquals(500, 
> exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
>     }
> -
> +
>  }
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilder.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilder.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilder.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilder.java
>  Sat Apr  3 15:57:29 2010
> @@ -25,11 +25,11 @@ public class GHttpCombinedRouteBuilder e
>     public void configure() throws Exception {
>
>         from("ghttp:///test1";)
> -            
> .to("ghttp://somewhere.com/test?urlFetchServiceRef=#mockUrlFetchService";);
> +            .to("ghttp://localhost:7441/test";);
>
>         from("ghttp:///test2";)
> -            
> .setHeader(Exchange.HTTP_URI).constant("http://another.org:1234/abc";)
> -            
> .to("ghttp://somewhere.com/test?bridgeEndpoint=false&urlFetchServiceRef=#mockUrlFetchService";);
> +            
> .setHeader(Exchange.HTTP_URI).constant("ghttp://localhost:7441/blah";)
> +            .to("ghttp://localhost:7441/test?bridgeEndpoint=false";);
>     }
>
>  }
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilderTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilderTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilderTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpCombinedRouteBuilderTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -18,6 +18,8 @@ package org.apache.camel.component.gae.h
>
>  import java.io.InputStream;
>
> +import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
> +import 
> com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
>  import com.meterware.httpunit.GetMethodWebRequest;
>  import com.meterware.httpunit.HttpUnitOptions;
>  import com.meterware.httpunit.PostMethodWebRequest;
> @@ -25,25 +27,59 @@ import com.meterware.httpunit.WebRequest
>  import com.meterware.httpunit.WebResponse;
>  import com.meterware.servletunit.ServletRunner;
>  import com.meterware.servletunit.ServletUnitClient;
> -
> +import org.apache.camel.ProducerTemplate;
>  import org.apache.camel.component.gae.support.ServletTestSupport;
> +import org.eclipse.jetty.server.Server;
> +import org.junit.After;
> +import org.junit.AfterClass;
> +import org.junit.Before;
>  import org.junit.BeforeClass;
>  import org.junit.Test;
> +import org.springframework.beans.factory.annotation.Autowired;
>  import org.springframework.core.io.ClassPathResource;
>
>  import static org.junit.Assert.assertEquals;
>
>  public class GHttpCombinedRouteBuilderTest extends ServletTestSupport {
>
> +    private static Server testServer = GHttpTestUtils.createTestServer(7441);
> +
> +    private final LocalURLFetchServiceTestConfig config = new 
> LocalURLFetchServiceTestConfig();
> +    private final LocalServiceTestHelper helper = new 
> LocalServiceTestHelper(config);
> +
> +   �...@autowired
> +    private ProducerTemplate producerTemplate;
> +
>     @BeforeClass
> -    public static void setUpClass() throws Exception {
> +    public static void setUpBeforeClass() throws Exception {
> +        // Start servlet container for running the CamelHttpTransportServlet
>         String webxml = 
> "org/apache/camel/component/gae/http/web-combined.xml";
>         InputStream is = new ClassPathResource(webxml).getInputStream();
>         servletRunner = new ServletRunner(is, CTX_PATH);
>         HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
>         is.close();
> +
> +        // Start servlet container for running the GHttpTestServlet
> +        testServer.start();
>     }
> -
> +
> +   �...@afterclass
> +    public static void tearDownAfterClass() throws Exception  {
> +        testServer.stop();
> +    }
> +
> +   �...@before
> +    public void setUp() throws Exception {
> +        super.setUp();
> +        helper.setUp();
> +    }
> +
> +   �...@after
> +    public void tearDown() throws Exception {
> +        helper.tearDown();
> +        super.tearDown();
> +    }
> +
>     @Test
>     public void testGet() throws Exception {
>         WebRequest req = new 
> GetMethodWebRequest(createUrl("/test1?test=input1"));
> @@ -66,7 +102,7 @@ public class GHttpCombinedRouteBuilderTe
>         WebRequest req = new GetMethodWebRequest(createUrl("/test2"));
>         ServletUnitClient client = newClient();
>         WebResponse response = client.getResponse(req);
> -        assertEquals("http://another.org:1234/abc";, 
> response.getHeaderField("testUrl"));
> +        assertEquals("http://localhost:7441/blah";, 
> response.getHeaderField("testUrl"));
>     }
>
>  }
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -47,7 +47,6 @@ public class GHttpEndpointTest {
>     public void testPropertiesDefault() throws Exception {
>         GHttpEndpoint endpoint = 
> createEndpoint("ghttp://somewhere.com/path?a=b";);
>         
> assertTrue(endpoint.getOutboundBinding().getClass().equals(GHttpBinding.class));
> -        assertFalse(endpoint.getUrlFetchService() instanceof 
> MockUrlFetchService);
>     }
>
>     @Test
> @@ -55,13 +54,11 @@ public class GHttpEndpointTest {
>         StringBuffer buffer = new StringBuffer("ghttp://somewhere.com/path";)
>             .append("?").append("a=b")
>             .append(AMP).append("bridgeEndpoint=false")
> -            .append(AMP).append("urlFetchServiceRef=#mockUrlFetchService")
>             .append(AMP).append("outboundBindingRef=#customBinding")
>             .append(AMP).append("throwExceptionOnFailure=false");
>         GHttpEndpoint endpoint = createEndpoint(buffer.toString());
>         
> assertFalse(endpoint.getOutboundBinding().getClass().equals(GHttpBinding.class));
>         assertTrue(endpoint.getOutboundBinding() instanceof GHttpBinding);
> -        assertTrue(endpoint.getUrlFetchService() instanceof 
> MockUrlFetchService);
>         assertEquals("ghttp://somewhere.com/path?a=b";, 
> endpoint.getEndpointUri());
>     }
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -25,7 +25,6 @@ import com.meterware.httpunit.WebRequest
>  import com.meterware.httpunit.WebResponse;
>  import com.meterware.servletunit.ServletRunner;
>  import com.meterware.servletunit.ServletUnitClient;
> -
>  import org.apache.camel.component.gae.support.ServletTestSupport;
>  import org.junit.BeforeClass;
>  import org.junit.Test;
> @@ -37,6 +36,7 @@ public class GHttpInboundRouteBuilderTes
>
>     @BeforeClass
>     public static void setUpClass() throws Exception {
> +        // Start servlet container for running the CamelHttpTransportServlet
>         String webxml = "org/apache/camel/component/gae/http/web-inbound.xml";
>         InputStream is = new ClassPathResource(webxml).getInputStream();
>         servletRunner = new ServletRunner(is, CTX_PATH);
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java
>  Sat Apr  3 15:57:29 2010
> @@ -23,7 +23,7 @@ public class GHttpOutboundRouteBuilder e
>     @Override
>     public void configure() throws Exception {
>
> -        
> from("direct:input1").to("ghttp://somewhere.com/test?a=b&urlFetchServiceRef=#mockUrlFetchService";);
> +        from("direct:input1").to("ghttp://localhost:7441/test?a=b";);
>
>     }
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -16,10 +16,16 @@
>  */
>  package org.apache.camel.component.gae.http;
>
> +import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
> +import 
> com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Processor;
>  import org.apache.camel.ProducerTemplate;
> +import org.eclipse.jetty.server.Server;
> +import org.junit.After;
> +import org.junit.AfterClass;
>  import org.junit.Before;
> +import org.junit.BeforeClass;
>  import org.junit.Test;
>  import org.junit.runner.RunWith;
>  import org.springframework.beans.factory.annotation.Autowired;
> @@ -27,17 +33,37 @@ import org.springframework.test.context.
>  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
>
>  import static org.junit.Assert.assertEquals;
> -import static org.junit.Assert.assertNull;
>
> �...@runwith(SpringJUnit4ClassRunner.class)
> �...@contextconfiguration(locations = 
> {"/org/apache/camel/component/gae/http/context-outbound.xml"})
>  public class GHttpOutboundRouteBuilderTest {
>
> +    private static Server testServer = GHttpTestUtils.createTestServer(7441);
> +
> +    private final LocalURLFetchServiceTestConfig config = new 
> LocalURLFetchServiceTestConfig();
> +    private final LocalServiceTestHelper helper = new 
> LocalServiceTestHelper(config);
> +
>     @Autowired
>     private ProducerTemplate producerTemplate;
>
> +   �...@beforeclass
> +    public static void setUpBeforeClass() throws Exception {
> +        testServer.start();
> +    }
> +
> +   �...@afterclass
> +    public static void tearDownAfterClass() throws Exception  {
> +        testServer.stop();
> +    }
> +
>     @Before
>     public void setUp() throws Exception {
> +        helper.setUp();
> +    }
> +
> +   �...@after
> +    public void tearDown() throws Exception {
> +        helper.tearDown();
>     }
>
>     @Test
> @@ -62,7 +88,6 @@ public class GHttpOutboundRouteBuilderTe
>                 exchange.getIn().setHeader("test", "testHeader1");
>             }
>         });
> -        assertNull(result.getOut().getBody());
>         assertEquals("testHeader1", result.getOut().getHeader("test"));
>         assertEquals("a=b", result.getOut().getHeader("testQuery"));
>         assertEquals("GET", result.getOut().getHeader("testMethod"));
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java
>  Sat Apr  3 15:57:29 2010
> @@ -19,10 +19,12 @@ package org.apache.camel.component.gae.h
>  import java.net.URL;
>
>  import com.google.appengine.api.urlfetch.HTTPRequest;
> -
>  import org.apache.camel.CamelContext;
>  import org.apache.camel.impl.DefaultCamelContext;
>  import org.apache.camel.impl.SimpleRegistry;
> +import org.eclipse.jetty.server.Server;
> +import org.eclipse.jetty.servlet.ServletContextHandler;
> +import org.eclipse.jetty.servlet.ServletHolder;
>
>  public final class GHttpTestUtils {
>
> @@ -31,7 +33,6 @@ public final class GHttpTestUtils {
>
>     static {
>         SimpleRegistry registry = new SimpleRegistry();
> -        registry.put("mockUrlFetchService", new MockUrlFetchService());
>         registry.put("customBinding", new GHttpBinding() { }); // subclass
>         context = new DefaultCamelContext(registry);
>         component = new GHttpComponent();
> @@ -44,7 +45,16 @@ public final class GHttpTestUtils {
>     public static CamelContext getCamelContext() {
>         return context;
>     }
> -
> +
> +    public static Server createTestServer(int port) {
> +        ServletContextHandler handler = new 
> ServletContextHandler(ServletContextHandler.NO_SESSIONS);
> +        handler.addServlet(new ServletHolder(new GHttpTestServlet()), "/*");
> +        handler.setContextPath("/");
> +        Server server = new Server(port);
> +        server.setHandler(handler);
> +        return server;
> +    }
> +
>     public static GHttpEndpoint createEndpoint(String endpointUri) throws 
> Exception {
>         return (GHttpEndpoint)component.createEndpoint(endpointUri);
>     }
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -17,16 +17,13 @@
>  package org.apache.camel.component.gae.mail;
>
>  import com.google.appengine.api.mail.MailService.Message;
> -
>  import org.apache.camel.Exchange;
>  import org.apache.camel.impl.DefaultExchange;
>  import org.junit.Before;
>  import org.junit.BeforeClass;
>  import org.junit.Test;
>
> -import static 
> org.apache.camel.component.gae.mail.GMailTestUtils.createEndpoint;
> -import static 
> org.apache.camel.component.gae.mail.GMailTestUtils.createMessage;
> -import static 
> org.apache.camel.component.gae.mail.GMailTestUtils.getCamelContext;
> +import static org.apache.camel.component.gae.mail.GMailTestUtils.*;
>  import static org.junit.Assert.assertEquals;
>  import static org.junit.Assert.assertTrue;
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -19,9 +19,7 @@ package org.apache.camel.component.gae.m
>  import org.junit.Test;
>
>  import static 
> org.apache.camel.component.gae.mail.GMailTestUtils.createEndpoint;
> -import static org.junit.Assert.assertEquals;
> -import static org.junit.Assert.assertFalse;
> -import static org.junit.Assert.assertTrue;
> +import static org.junit.Assert.*;
>
>  public class GMailEndpointTest {
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java
>  Sat Apr  3 15:57:29 2010
> @@ -19,7 +19,6 @@ package org.apache.camel.component.gae.m
>  import com.google.appengine.api.mail.dev.LocalMailService;
>  import 
> com.google.appengine.tools.development.testing.LocalMailServiceTestConfig;
>  import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
> -import org.apache.camel.EndpointInject;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Processor;
>  import org.apache.camel.ProducerTemplate;
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java
>  Sat Apr  3 15:57:29 2010
> @@ -17,7 +17,6 @@
>  package org.apache.camel.component.gae.mail;
>
>  import com.google.appengine.api.mail.MailService.Message;
> -
>  import org.apache.camel.CamelContext;
>  import org.apache.camel.impl.DefaultCamelContext;
>  import org.apache.camel.impl.SimpleRegistry;
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java
>  Sat Apr  3 15:57:29 2010
> @@ -38,7 +38,7 @@ public abstract class ServletTestSupport
>     }
>
>     @After
> -    public void tearDown() {
> +    public void tearDown() throws Exception {
>         // ...
>     }
>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml
>  Sat Apr  3 15:57:29 2010
> @@ -19,26 +19,20 @@
>
>  <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> +       xmlns:camel="http://camel.apache.org/schema/spring";
>        xsi:schemaLocation="
>  http://www.springframework.org/schema/beans
> -http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
> -
> -    <bean id="camelContext"
> -        class="org.apache.camel.component.gae.context.GaeSpringCamelContext">
> -        <property name="routeBuilder" ref="routeBuilder" />
> -    </bean>
> -
> -    <bean id="producerTemplate"
> -        factory-bean="camelContext"
> -        factory-method="createProducerTemplate">
> -    </bean>
> -
> +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";>
> +
> +    <camel:camelContext id="camelContext">
> +        <camel:jmxAgent id="agent" disabled="true" />
> +        <camel:routeBuilder ref="routeBuilder"/>
> +    </camel:camelContext>
> +
>     <bean id="routeBuilder"
>         class="org.apache.camel.component.gae.http.GHttpCombinedRouteBuilder">
>     </bean>
>
> -    <bean id="mockUrlFetchService"
> -        class="org.apache.camel.component.gae.http.MockUrlFetchService">
> -    </bean>
> -
>  </beans>
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml
>  Sat Apr  3 15:57:29 2010
> @@ -19,14 +19,17 @@
>
>  <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> +       xmlns:camel="http://camel.apache.org/schema/spring";
>        xsi:schemaLocation="
>  http://www.springframework.org/schema/beans
> -http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
> -
> -    <bean id="camelContext"
> -        class="org.apache.camel.component.gae.context.GaeSpringCamelContext">
> -        <property name="routeBuilder" ref="routeBuilder" />
> -    </bean>
> +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";>
> +
> +    <camel:camelContext id="camelContext">
> +        <camel:jmxAgent id="agent" disabled="true" />
> +        <camel:routeBuilder ref="routeBuilder"/>
> +    </camel:camelContext>
>
>     <bean id="routeBuilder"
>         class="org.apache.camel.component.gae.http.GHttpInboundRouteBuilder">
>
> Modified: 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml?rev=930535&r1=930534&r2=930535&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml
>  (original)
> +++ 
> camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml
>  Sat Apr  3 15:57:29 2010
> @@ -19,26 +19,20 @@
>
>  <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> +       xmlns:camel="http://camel.apache.org/schema/spring";
>        xsi:schemaLocation="
>  http://www.springframework.org/schema/beans
> -http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
> -
> -    <bean id="camelContext"
> -        class="org.apache.camel.component.gae.context.GaeSpringCamelContext">
> -        <property name="routeBuilder" ref="routeBuilder" />
> -    </bean>
> -
> -    <bean id="producerTemplate"
> -        factory-bean="camelContext"
> -        factory-method="createProducerTemplate">
> -    </bean>
> -
> +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";>
> +
> +    <camel:camelContext id="camelContext">
> +        <camel:jmxAgent id="agent" disabled="true" />
> +        <camel:routeBuilder ref="routeBuilder"/>
> +    </camel:camelContext>
> +
>     <bean id="routeBuilder"
>         class="org.apache.camel.component.gae.http.GHttpOutboundRouteBuilder">
>     </bean>
>
> -    <bean id="mockUrlFetchService"
> -        class="org.apache.camel.component.gae.http.MockUrlFetchService">
> -    </bean>
> -
>  </beans>
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to