http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java deleted file mode 100644 index 35d6b5f..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpEndpointTest.java +++ /dev/null @@ -1,65 +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.gae.http; - -import org.junit.Before; -import org.junit.Test; - -import static org.apache.camel.component.gae.http.GHttpTestUtils.createEndpoint; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class GHttpEndpointTest { - - private static final String AMP = "&"; - - @Before - public void setUp() throws Exception { - } - - @Test - public void testGetEndpointUrl() throws Exception { - GHttpEndpoint endpoint1 = createEndpoint("ghttp://somewhere.com/path?a=b"); - GHttpEndpoint endpoint2 = createEndpoint("ghttps://somewhere.com/path?a=b"); - GHttpEndpoint endpoint3 = createEndpoint("xhttps://somewhere.com/path?a=b"); - - assertEquals("http://somewhere.com/path?a=b", endpoint1.getEndpointUrl().toString()); - assertEquals("https://somewhere.com/path?a=b", endpoint2.getEndpointUrl().toString()); - assertEquals("http://somewhere.com/path?a=b", endpoint3.getEndpointUrl().toString()); - } - - @Test - public void testPropertiesDefault() throws Exception { - GHttpEndpoint endpoint = createEndpoint("ghttp://somewhere.com/path?a=b"); - assertTrue(endpoint.getOutboundBinding().getClass().equals(GHttpBinding.class)); - } - - @Test - public void testPropertiesCustom() throws Exception { - StringBuilder buffer = new StringBuilder("ghttp://somewhere.com/path") - .append("?").append("a=b") - .append(AMP).append("bridgeEndpoint=false") - .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); - assertEquals("ghttp://somewhere.com/path?a=b", endpoint.getEndpointUri()); - } - -}
http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilder.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilder.java deleted file mode 100644 index 803a9ee..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilder.java +++ /dev/null @@ -1,33 +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.gae.http; - -import org.apache.camel.builder.RouteBuilder; - -public class GHttpInboundRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - - // use for GET - from("ghttp:///test1").transform().header("test"); - // use for POST - from("ghttp:///test2").transform().body(); - - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java deleted file mode 100644 index ec7ab28..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpInboundRouteBuilderTest.java +++ /dev/null @@ -1,63 +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.gae.http; - -import java.io.InputStream; - -import com.meterware.httpunit.GetMethodWebRequest; -import com.meterware.httpunit.HttpUnitOptions; -import com.meterware.httpunit.PostMethodWebRequest; -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; -import org.springframework.core.io.ClassPathResource; - -import static org.junit.Assert.assertEquals; - -public class GHttpInboundRouteBuilderTest extends ServletTestSupport { - - @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); - HttpUnitOptions.setExceptionsThrownOnErrorStatus(true); - is.close(); - } - - @Test - public void testGet() throws Exception { - WebRequest req = new GetMethodWebRequest(createUrl("/test1?test=input1")); - ServletUnitClient client = newClient(); - WebResponse response = client.getResponse(req); - assertEquals("input1", response.getText()); - } - - @Test - public void testPost() throws Exception { - WebRequest req = new PostMethodWebRequest(createUrl("/test2"), createInput("input2"), getContentType()); - ServletUnitClient client = newClient(); - WebResponse response = client.getResponse(req); - assertEquals("input2", response.getText()); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java deleted file mode 100644 index b72e2a6..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilder.java +++ /dev/null @@ -1,32 +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.gae.http; - -import org.apache.camel.builder.RouteBuilder; - -import static org.apache.camel.component.gae.TestConfig.getBaseUri; - -public class GHttpOutboundRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - - from("direct:input1").to(getBaseUri("ghttp") + "/test?a=b"); - - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java deleted file mode 100644 index eb7b08a..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpOutboundRouteBuilderTest.java +++ /dev/null @@ -1,97 +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.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; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"/org/apache/camel/component/gae/http/context-outbound.xml"}) -public class GHttpOutboundRouteBuilderTest { - - private static Server testServer = GHttpTestUtils.createTestServer(); - - 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 - public void testPost() { - Exchange result = producerTemplate.request("direct:input1", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("testBody1"); - exchange.getIn().setHeader("test", "testHeader1"); - } - }); - assertEquals("testBody1", result.getOut().getBody(String.class)); - assertEquals("testHeader1", result.getOut().getHeader("test")); - assertEquals("a=b", result.getOut().getHeader("testQuery")); - assertEquals("POST", result.getOut().getHeader("testMethod")); - assertEquals(200, result.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE)); - } - - @Test - public void testGet() { - Exchange result = producerTemplate.request("direct:input1", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader("test", "testHeader1"); - } - }); - assertEquals("testHeader1", result.getOut().getHeader("test")); - assertEquals("a=b", result.getOut().getHeader("testQuery")); - assertEquals("GET", result.getOut().getHeader("testMethod")); - assertEquals(200, result.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java deleted file mode 100644 index 476bf39..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java +++ /dev/null @@ -1,69 +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.gae.http; - -import java.io.IOException; -import java.util.Enumeration; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.camel.util.IOHelper; - -public class GHttpTestServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - doPost(req, resp); - } - - @SuppressWarnings("unchecked") - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - // Set default response code - resp.setStatus(200); - // Copy headers from request to response - Enumeration<String> headerNames = req.getHeaderNames(); - while (headerNames.hasMoreElements()) { - String headerName = headerNames.nextElement(); - Enumeration<String> headers = req.getHeaders(headerName); - while (headers.hasMoreElements()) { - String headerValue = headers.nextElement(); - resp.addHeader(headerName, headerValue); - // Set custom response code - // if requested by client - if (headerName.equals("code")) { - resp.setStatus(Integer.parseInt(headerValue)); - } - } - } - - // add some special response headers - resp.addHeader("testUrl", req.getRequestURL().toString()); - resp.addHeader("testMethod", req.getMethod().toString()); - if (req.getQueryString() != null) { - resp.addHeader("testQuery", req.getQueryString()); - } - - // Copy body from request to response - IOHelper.copyAndCloseInput(req.getInputStream(), resp.getOutputStream()); - resp.getWriter().flush(); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java deleted file mode 100644 index ff271c8..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestUtils.java +++ /dev/null @@ -1,71 +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.gae.http; - -import java.net.URL; - -import com.google.appengine.api.urlfetch.HTTPRequest; -import org.apache.camel.CamelContext; -import org.apache.camel.component.gae.TestConfig; -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 { - - private static CamelContext context; - private static GHttpComponent component; - - static { - SimpleRegistry registry = new SimpleRegistry(); - registry.put("customBinding", new GHttpBinding() { }); // subclass - context = new DefaultCamelContext(registry); - component = new GHttpComponent(); - component.setCamelContext(context); - } - - private GHttpTestUtils() { - } - - public static CamelContext getCamelContext() { - return context; - } - - public static Server createTestServer() { - ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); - handler.addServlet(new ServletHolder(new GHttpTestServlet()), "/*"); - handler.setContextPath("/"); - Server server = new Server(TestConfig.getPort()); - server.setHandler(handler); - return server; - } - - public static GHttpEndpoint createEndpoint(String endpointUri) throws Exception { - return (GHttpEndpoint)component.createEndpoint(endpointUri); - } - - public static HTTPRequest createRequest() throws Exception { - return createRequest("http://localhost:8080"); - } - - public static HTTPRequest createRequest(String url) throws Exception { - return new HTTPRequest(new URL(url)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java deleted file mode 100644 index 803d08d..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java +++ /dev/null @@ -1,86 +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.gae.login; - -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.login.GLoginBinding.GLOGIN_COOKIE; -import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_HOST_NAME; -import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_PASSWORD; -import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_TOKEN; -import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_USER_NAME; -import static org.apache.camel.component.gae.login.GLoginTestUtils.createEndpoint; -import static org.apache.camel.component.gae.login.GLoginTestUtils.getCamelContext; -import static org.junit.Assert.assertEquals; - -public class GLoginBindingTest { - - private static GLoginBinding binding; - - private static GLoginEndpoint endpoint; - - private Exchange exchange; - - @BeforeClass - public static void setUpClass() throws Exception { - binding = new GLoginBinding(); - StringBuilder buffer = new StringBuilder("glogin:test.appspot.com") - .append("?").append("userName=testUserName") - .append("&").append("password=testPassword"); - endpoint = createEndpoint(buffer.toString()); - } - - @Before - public void setUp() throws Exception { - exchange = new DefaultExchange(getCamelContext()); - } - - @Test - public void testWriteRequestDefault() { - GLoginData data = binding.writeRequest(endpoint, exchange, null); - assertEquals("apache-camel-2.x", data.getClientName()); - assertEquals("test.appspot.com", data.getHostName()); - assertEquals("testUserName", data.getUserName()); - assertEquals("testPassword", data.getPassword()); - } - - @Test - public void testWriteRequestCustom() { - exchange.getIn().setHeader(GLOGIN_HOST_NAME, "custom.appspot.com"); - exchange.getIn().setHeader(GLOGIN_USER_NAME, "customUserName"); - exchange.getIn().setHeader(GLOGIN_PASSWORD, "customPassword"); - GLoginData data = binding.writeRequest(endpoint, exchange, null); - assertEquals("custom.appspot.com", data.getHostName()); - assertEquals("customUserName", data.getUserName()); - assertEquals("customPassword", data.getPassword()); - } - - @Test - public void testReadResponse() throws Exception { - GLoginData data = new GLoginData(); - data.setAuthenticationToken("testToken"); - data.setAuthorizationCookie("testCookie=1234ABCD"); - binding.readResponse(endpoint, exchange, data); - assertEquals("testToken", exchange.getOut().getHeader(GLOGIN_TOKEN)); - assertEquals("testCookie=1234ABCD", exchange.getOut().getHeader(GLOGIN_COOKIE)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java deleted file mode 100644 index 870e1c4..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java +++ /dev/null @@ -1,56 +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.gae.login; - -import org.junit.Test; - -import static org.apache.camel.component.gae.login.GLoginTestUtils.createEndpoint; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class GLoginEndpointTest { - - @Test - public void testEndpointProperties() throws Exception { - // test internet hostname - StringBuilder buffer = new StringBuilder("glogin:test.appspot.com") - .append("?").append("clientName=testClientName") - .append("&").append("userName=testUserName") - .append("&").append("password=testPassword"); - GLoginEndpoint endpoint = createEndpoint(buffer.toString()); - assertEquals("test.appspot.com", endpoint.getHostName()); - assertEquals("testClientName", endpoint.getClientName()); - assertEquals("testUserName", endpoint.getUserName()); - assertEquals("testPassword", endpoint.getPassword()); - assertFalse(endpoint.isDevMode()); - endpoint = createEndpoint("glogin:test.appspot.com"); - assertEquals("apache-camel-2.x", endpoint.getClientName()); - // test localhost with default port - endpoint = createEndpoint("glogin:localhost?devMode=true&devAdmin=true"); - assertEquals("localhost", endpoint.getHostName()); - assertEquals(8080, endpoint.getDevPort()); - assertTrue(endpoint.isDevMode()); - assertTrue(endpoint.isDevAdmin()); - // test localhost with custom port - endpoint = createEndpoint("glogin:localhost:9090?devMode=true"); - assertEquals("localhost", endpoint.getHostName()); - assertEquals(9090, endpoint.getDevPort()); - assertFalse(endpoint.isDevAdmin()); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java deleted file mode 100644 index 530b14b..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java +++ /dev/null @@ -1,32 +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.gae.login; - -import org.apache.camel.builder.RouteBuilder; - -public class GLoginRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - from("direct:input1") - .to("glogin:test.example.org" - + "?userName=testuser" - + "&password=testpass" - + "&serviceRef=#testService"); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java deleted file mode 100644 index b81c375..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java +++ /dev/null @@ -1,47 +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.gae.login; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"/org/apache/camel/component/gae/login/context.xml"}) -public class GLoginRouteBuilderTest { - - @Autowired - private ProducerTemplate template; - - @Test - public void testLogin() { - Exchange exchange = template.request("direct:input1", new Processor() { - public void process(Exchange exchange) { - } - }); - assertEquals("testAuthenticationToken", exchange.getOut().getHeader(GLoginBinding.GLOGIN_TOKEN)); - assertEquals("testAuthorizationCookie=1234ABCD", exchange.getOut().getHeader(GLoginBinding.GLOGIN_COOKIE)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java deleted file mode 100644 index 4e687fd..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java +++ /dev/null @@ -1,29 +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.gae.login; - -public class GLoginServiceMock implements GLoginService { - - public void authenticate(GLoginData data) throws Exception { - data.setAuthenticationToken("testAuthenticationToken"); - } - - public void authorize(GLoginData data) throws Exception { - data.setAuthorizationCookie("testAuthorizationCookie=1234ABCD"); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java deleted file mode 100644 index 939f8f9..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.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.gae.login; - -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; - -public final class GLoginTestUtils { - - private static CamelContext context; - private static GLoginComponent component; - - static { - SimpleRegistry registry = new SimpleRegistry(); - registry.put("customOutboundBinding", new GLoginBinding() { }); // subclass - context = new DefaultCamelContext(registry); - component = new GLoginComponent(); - component.setCamelContext(context); - } - - private GLoginTestUtils() { - } - - public static CamelContext getCamelContext() { - return context; - } - - public static GLoginEndpoint createEndpoint(String endpointUri) throws Exception { - return (GLoginEndpoint)component.createEndpoint(endpointUri); - } - - public static Message createMessage() throws Exception { - return new Message(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java deleted file mode 100644 index 219974c..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java +++ /dev/null @@ -1,143 +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.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.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class GMailBindingTest { - - private static GMailBinding binding; - - private static GMailEndpoint endpoint; - - private Exchange exchange; - - private Message message; - - @BeforeClass - public static void setUpClass() throws Exception { - binding = new GMailBinding(); - endpoint = createEndpoint("gmail:us...@gmail.com" - + "?to=us...@gmail.com" - + "&cc=us...@gmail.com" - + "&bcc=us...@gmail.com" - + "&subject=test"); - } - - @Before - public void setUp() throws Exception { - exchange = new DefaultExchange(getCamelContext()); - message = createMessage(); - } - - @Test - public void testWriteFrom() { - binding.writeFrom(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getSender()); - exchange.getIn().setHeader(GMailBinding.GMAIL_SENDER, "us...@gmail.com"); - binding.writeFrom(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getSender()); - } - - @Test - public void testWriteTo() { - binding.writeTo(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getTo().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_TO, "us...@gmail.com"); - binding.writeTo(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getTo().iterator().next()); - } - - @Test - public void testWriteCc() { - binding.writeCc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getCc().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_CC, "us...@gmail.com"); - binding.writeCc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getCc().iterator().next()); - } - - @Test - public void testWriteBcc() { - binding.writeBcc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getBcc().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_BCC, "us...@gmail.com"); - binding.writeBcc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getBcc().iterator().next()); - } - - @Test - public void testWriteToMultiple() { - binding.writeTo(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getTo().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_TO, "us...@gmail.com,us...@gmail.com"); - binding.writeTo(endpoint, exchange, message); - assertEquals(2, message.getTo().size()); - assertTrue(message.getTo().contains("us...@gmail.com")); - assertTrue(message.getTo().contains("us...@gmail.com")); - } - - @Test - public void testWriteCcMultiple() { - binding.writeCc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getCc().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_CC, "us...@gmail.com,us...@gmail.com"); - binding.writeCc(endpoint, exchange, message); - assertEquals(2, message.getCc().size()); - assertTrue(message.getCc().contains("us...@gmail.com")); - assertTrue(message.getCc().contains("us...@gmail.com")); - } - - @Test - public void testWriteBccMultiple() { - binding.writeBcc(endpoint, exchange, message); - assertEquals("us...@gmail.com", message.getBcc().iterator().next()); - exchange.getIn().setHeader(GMailBinding.GMAIL_BCC, "us...@gmail.com,us...@gmail.com"); - binding.writeBcc(endpoint, exchange, message); - assertEquals(2, message.getBcc().size()); - assertTrue(message.getBcc().contains("us...@gmail.com")); - assertTrue(message.getBcc().contains("us...@gmail.com")); - } - - @Test - public void testWriteSubject() { - binding.writeSubject(endpoint, exchange, message); - assertEquals("test", message.getSubject()); - exchange.getIn().setHeader(GMailBinding.GMAIL_SUBJECT, "another"); - binding.writeSubject(endpoint, exchange, message); - assertEquals("another", message.getSubject()); - } - - @Test - public void testWriteBody() { - exchange.getIn().setBody("test"); - binding.writeBody(endpoint, exchange, message); - assertEquals("test", message.getTextBody()); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java deleted file mode 100644 index 1127e96..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java +++ /dev/null @@ -1,48 +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.gae.mail; - -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; - -public class GMailEndpointTest { - - private static final String AMP = "&"; - - @Test - public void testPropertiesCustom() throws Exception { - StringBuilder buffer = new StringBuilder("gmail:us...@gmail.com") - .append("?").append("subject=test") - .append(AMP).append("to=us...@gmail.com") - .append(AMP).append("cc=us...@gmail.com") - .append(AMP).append("bcc=us...@gmail.com") - .append(AMP).append("outboundBindingRef=#customBinding"); - GMailEndpoint endpoint = createEndpoint(buffer.toString()); - assertEquals("test", endpoint.getSubject()); - assertEquals("us...@gmail.com", endpoint.getSender()); - assertEquals("us...@gmail.com", endpoint.getTo()); - assertEquals("us...@gmail.com", endpoint.getCc()); - assertEquals("us...@gmail.com", endpoint.getBcc()); - assertFalse(endpoint.getOutboundBinding().getClass().equals(GMailBinding.class)); - assertTrue(endpoint.getOutboundBinding() instanceof GMailBinding); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilder.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilder.java deleted file mode 100644 index 4c2b178..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilder.java +++ /dev/null @@ -1,31 +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.gae.mail; - -import org.apache.camel.builder.RouteBuilder; - -public class GMailOutboundRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - - from("direct:input1") - .to("gmail:te...@example.org?to=te...@example.org&subject=testSubject"); - - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java deleted file mode 100644 index b7925be..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailOutboundRouteBuilderTest.java +++ /dev/null @@ -1,98 +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.gae.mail; - -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.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.apache.camel.component.gae.mail.GMailBinding.GMAIL_SUBJECT; -import static org.apache.camel.component.gae.mail.GMailBinding.GMAIL_TO; -import static org.junit.Assert.assertEquals; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"/org/apache/camel/component/gae/mail/context-outbound.xml"}) -public class GMailOutboundRouteBuilderTest { - - @Autowired - private ProducerTemplate producerTemplate; - - private final LocalMailServiceTestConfig config = new LocalMailServiceTestConfig(); - private final LocalServiceTestHelper helper = new LocalServiceTestHelper(config); - - private LocalMailService service; - - @Before - public void setUp() { - helper.setUp(); - service = LocalMailServiceTestConfig.getLocalMailService(); - } - - @After - public void tearDown() { - helper.tearDown(); - } - - @Test - public void testSendDefault() { - producerTemplate.sendBody("direct:input1", "testBody"); - assertEquals(1, service.getSentMessages().size()); - assertEquals("testSubject", service.getSentMessages().get(0).getSubject()); - assertEquals("testBody", service.getSentMessages().get(0).getTextBody()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getSender()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getTo(0)); - } - - @Test - public void testSendCustomTo() { - producerTemplate.send("direct:input1", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("fooBody"); - exchange.getIn().setHeader(GMAIL_TO, "te...@example.org"); - } - }); - assertEquals("testSubject", service.getSentMessages().get(0).getSubject()); - assertEquals("fooBody", service.getSentMessages().get(0).getTextBody()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getSender()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getTo(0)); - } - - @Test - public void testSendCustomSubject() { - producerTemplate.send("direct:input1", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("fooBody"); - exchange.getIn().setHeader(GMAIL_SUBJECT, "anotherSubject"); - } - }); - assertEquals("anotherSubject", service.getSentMessages().get(0).getSubject()); - assertEquals("fooBody", service.getSentMessages().get(0).getTextBody()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getSender()); - assertEquals("te...@example.org", service.getSentMessages().get(0).getTo(0)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.java deleted file mode 100644 index 9789cbf..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailTestUtils.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.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; - -public final class GMailTestUtils { - - private static CamelContext context; - private static GMailComponent component; - - static { - SimpleRegistry registry = new SimpleRegistry(); - registry.put("customBinding", new GMailBinding() { }); // subclass - context = new DefaultCamelContext(registry); - component = new GMailComponent(); - component.setCamelContext(context); - } - - private GMailTestUtils() { - } - - public static CamelContext getCamelContext() { - return context; - } - - public static GMailEndpoint createEndpoint(String endpointUri) throws Exception { - return (GMailEndpoint)component.createEndpoint(endpointUri); - } - - public static Message createMessage() throws Exception { - return new Message(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java deleted file mode 100644 index 38ab276..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/support/ServletTestSupport.java +++ /dev/null @@ -1,64 +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.gae.support; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import com.meterware.servletunit.ServletRunner; -import com.meterware.servletunit.ServletUnitClient; -import org.junit.After; -import org.junit.Before; - -public abstract class ServletTestSupport { - - protected static final String CTX_PATH = ""; - protected static final String CTX_URL = "http://localhost"; - - protected static ServletRunner servletRunner; - - @Before - public void setUp() throws Exception { - // ... - } - - @After - public void tearDown() throws Exception { - // ... - } - - protected String getContentType() { - return "text/plain; charset=UTF-8"; - } - - protected static String createUrl(String sub) { - return CTX_URL + "/camel" + sub; - } - - protected static InputStream createInput(String data) { - return new ByteArrayInputStream(data.getBytes()); - } - - protected static ServletUnitClient newClient() { - return servletRunner.newClient(); - } - - protected static void initServlet() throws Exception { - servletRunner.newClient().newInvocation(createUrl("")).getServlet(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskBindingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskBindingTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskBindingTest.java deleted file mode 100644 index 0154529..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskBindingTest.java +++ /dev/null @@ -1,149 +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.gae.task; - -import java.util.List; - -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import com.google.appengine.api.taskqueue.dev.LocalTaskQueue; -import com.google.appengine.api.taskqueue.dev.QueueStateInfo.HeaderWrapper; -import com.google.appengine.api.taskqueue.dev.QueueStateInfo.TaskStateInfo; -import com.google.appengine.tools.development.testing.LocalServiceTestHelper; -import com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig; -import org.apache.camel.Exchange; -import org.apache.camel.http.common.HttpMessage; -import org.apache.camel.impl.DefaultExchange; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.springframework.mock.web.MockHttpServletRequest; - -import static com.google.appengine.api.taskqueue.TaskOptions.Builder.withDefaults; -import static org.apache.camel.component.gae.http.GHttpTestUtils.getCamelContext; -import static org.apache.camel.component.gae.task.GTaskTestUtils.createEndpoint; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; - -public class GTaskBindingTest { - - private static GTaskBinding binding; - - private DefaultExchange exchange; - private GTaskEndpoint endpoint; - - private LocalTaskQueueTestConfig config = new LocalTaskQueueTestConfig(); - private LocalServiceTestHelper helper = new LocalServiceTestHelper(config); - private Queue queue; - - - @BeforeClass - public static void setUpClass() { - binding = new GTaskBinding(); - } - - @Before - public void setUp() throws Exception { - helper.setUp(); - queue = QueueFactory.getDefaultQueue(); - exchange = new DefaultExchange(getCamelContext()); - endpoint = createEndpoint("test"); - } - - @After - public void tearDown() { - helper.tearDown(); - } - - @Test - public void testWriteRequestHeaders() throws Exception { - exchange.getIn().setHeader("test", "abc"); - exchange.getIn().setHeader(Exchange.HTTP_QUERY, "x=y"); - TaskOptions options = withDefaults(); - binding.writeRequestHeaders(endpoint, exchange, options); - queue.add(options); - TaskStateInfo info = getTaskStateInfos().get(0); - assertEquals("abc", getHeader(info, "test")); - assertNull(getHeader(info, Exchange.HTTP_QUERY)); - } - - @Test - public void testWriteRequestBody() { - exchange.getIn().setBody("test"); - TaskOptions options = withDefaults(); - binding.writeRequestBody(endpoint, exchange, options); - queue.add(options); - TaskStateInfo info = getTaskStateInfos().get(0); - assertEquals("test", info.getBody()); - assertNull("application/octet-stream", getHeader(info , Exchange.CONTENT_TYPE)); - } - - @Test - public void testWriteRequestWithDefaultWorkerRoot() throws Exception { - exchange.getIn().setBody("anything"); - TaskOptions options = binding.writeRequest(endpoint, exchange, null); - queue.add(options); - TaskStateInfo info = getTaskStateInfos().get(0); - assertEquals("/worker/test", info.getUrl()); - } - - @Test - public void testWriteRequestWithCustomWorkerRoot() throws Exception { - GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy"); - exchange.getIn().setBody("anything"); - TaskOptions options = binding.writeRequest(custom, exchange, null); - queue.add(options); - TaskStateInfo info = getTaskStateInfos().get(0); - assertEquals("/lazy/test", info.getUrl()); - } - - @Test - public void testReadRequest() { - exchange.setFromEndpoint(endpoint); - MockHttpServletRequest request = new MockHttpServletRequest(); - HttpMessage message = new HttpMessage(exchange, request, null); - request.addHeader(GTaskBinding.GAE_QUEUE_NAME, "a"); - request.addHeader(GTaskBinding.GAE_TASK_NAME, "b"); - request.addHeader(GTaskBinding.GAE_RETRY_COUNT, "1"); - // test invocation of inbound binding via dynamic proxy - endpoint.getBinding().readRequest(request, message); - assertEquals("a", message.getHeader(GTaskBinding.GTASK_QUEUE_NAME)); - assertEquals("b", message.getHeader(GTaskBinding.GTASK_TASK_NAME)); - assertEquals(1, message.getHeader(GTaskBinding.GTASK_RETRY_COUNT)); - assertFalse(message.getHeaders().containsKey(GTaskBinding.GAE_QUEUE_NAME)); - assertFalse(message.getHeaders().containsKey(GTaskBinding.GAE_TASK_NAME)); - assertFalse(message.getHeaders().containsKey(GTaskBinding.GAE_RETRY_COUNT)); - } - - private List<TaskStateInfo> getTaskStateInfos() { - LocalTaskQueue queue = LocalTaskQueueTestConfig.getLocalTaskQueue(); - return queue.getQueueStateInfo().get("default").getTaskInfo(); - } - - private String getHeader(TaskStateInfo info, String name) { - for (HeaderWrapper header : info.getHeaders()) { - if (name.equals(header.getKey())) { - return header.getValue(); - } - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilder.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilder.java deleted file mode 100644 index 0963934..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilder.java +++ /dev/null @@ -1,29 +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.gae.task; - -import org.apache.camel.builder.RouteBuilder; - -public class GTaskCombinedRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - from("direct:input").to("gtask:default?workerRoot=camel"); - from("gtask:default").convertBodyTo(String.class).to("mock:mock"); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java deleted file mode 100644 index 0532b25..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java +++ /dev/null @@ -1,91 +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.gae.task; - -import com.google.appengine.tools.development.testing.LocalServiceTestHelper; -import com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig; -import org.apache.camel.EndpointInject; -import org.apache.camel.Message; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.component.gae.support.ServletTestSupport; -import org.apache.camel.component.mock.MockEndpoint; -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.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.apache.camel.component.gae.task.GTaskTestUtils.newLocalServiceTestHelper; -import static org.junit.Assert.assertEquals; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "/org/apache/camel/component/gae/task/context-combined.xml" }) -@Ignore -public class GTaskCombinedRouteBuilderTest extends ServletTestSupport { - - private static Server server = GTaskTestUtils.createTestServer(); - - private final LocalTaskQueueTestConfig config = new LocalTaskQueueTestConfig(); - private final LocalServiceTestHelper helper = newLocalServiceTestHelper(config.setDisableAutoTaskExecution(false)); - - @Autowired - private ProducerTemplate producerTemplate; - - @EndpointInject(uri = "mock:mock") - private MockEndpoint mock; - - @BeforeClass - public static void setUpClass() throws Exception { - server.start(); - } - - @AfterClass - public static void tearDownClass() throws Exception { - server.stop(); - } - - @Before - public void setUp() throws Exception { - super.setUp(); - helper.setUp(); - } - - @After - public void tearDown() throws Exception { - mock.reset(); - helper.tearDown(); - super.tearDown(); - } - - @Test - public void testDefault() throws Exception { - mock.expectedBodiesReceived("test1"); - mock.expectedHeaderReceived("test", "test2"); - producerTemplate.sendBodyAndHeader("direct:input", "test1", "test", "test2"); - mock.assertIsSatisfied(); - Message received = mock.getExchanges().get(0).getIn(); - assertEquals("default", received.getHeader(GTaskBinding.GTASK_QUEUE_NAME)); - assertEquals(0, received.getHeader(GTaskBinding.GTASK_RETRY_COUNT)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java deleted file mode 100644 index b5b941d..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java +++ /dev/null @@ -1,55 +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.gae.task; - -import org.junit.Before; -import org.junit.Test; - -import static org.apache.camel.component.gae.task.GTaskTestUtils.createEndpoint; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class GTaskEndpointTest { - - private static final String AMP = "&"; - - @Before - public void setUp() throws Exception { - } - - @Test - public void testPropertiesDefault() throws Exception { - GTaskEndpoint endpoint = createEndpoint("gtask:myqueue"); - assertEquals("worker", endpoint.getWorkerRoot()); - assertTrue(endpoint.getOutboundBinding().getClass().equals(GTaskBinding.class)); - } - - @Test - public void testPropertiesCustom() throws Exception { - StringBuilder buffer = new StringBuilder("gtask:myqueue") - .append("?").append("outboundBindingRef=#customBinding") - .append(AMP).append("inboundBindingRef=#customBinding") - .append(AMP).append("workerRoot=test"); - GTaskEndpoint endpoint = createEndpoint(buffer.toString()); - assertEquals("test", endpoint.getWorkerRoot()); - assertFalse(endpoint.getOutboundBinding().getClass().equals(GTaskBinding.class)); - assertTrue(endpoint.getOutboundBinding() instanceof GTaskBinding); - assertEquals("gtask:/myqueue", endpoint.getEndpointUri()); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java deleted file mode 100644 index a15d15e..0000000 --- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java +++ /dev/null @@ -1,110 +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.gae.task; - -import java.io.File; - -import com.google.appengine.tools.development.LocalServerEnvironment; -import com.google.appengine.tools.development.testing.LocalServiceTestConfig; -import com.google.appengine.tools.development.testing.LocalServiceTestHelper; -import org.apache.camel.CamelContext; -import org.apache.camel.component.gae.TestConfig; -import org.apache.camel.component.servlet.CamelHttpTransportServlet; -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 GTaskTestUtils { - - private static CamelContext context; - private static GTaskComponent component; - - static { - SimpleRegistry registry = new SimpleRegistry(); - registry.put("customBinding", new GTaskBinding() { }); // subclass - context = new DefaultCamelContext(registry); - component = new GTaskComponent(); - component.setCamelContext(context); - } - - private GTaskTestUtils() { - } - - public static CamelContext getCamelContext() { - return context; - } - - public static Server createTestServer() { - ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); - handler.addServlet(new ServletHolder(new CamelHttpTransportServlet()), "/camel/*"); - handler.setContextPath("/"); - Server server = new Server(TestConfig.getPort()); - server.setHandler(handler); - return server; - } - - public static GTaskEndpoint createEndpoint(String endpointUri) throws Exception { - return (GTaskEndpoint)component.createEndpoint(endpointUri); - } - - public static LocalServiceTestHelper newLocalServiceTestHelper(LocalServiceTestConfig... configs) { - return new QueueServiceTestHelper(configs); - } - - private static class QueueServiceTestHelper extends LocalServiceTestHelper { - - public QueueServiceTestHelper(LocalServiceTestConfig... configs) { - super(configs); - } - - @Override - protected LocalServerEnvironment newLocalServerEnvironment() { - return new LocalServerEnvironment() { - - public File getAppDir() { - return new File("."); - } - - public String getAddress() { - return "localhost"; - } - - public int getPort() { - return TestConfig.getPort(); - } - - public String getHostName() { - return "localhost"; - } - - public void waitForServerToStart() { - } - - public boolean enforceApiDeadlines() { - return false; - } - - public boolean simulateProductionLatencies() { - return false; - } - }; - } - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/resources/log4j.properties b/components/camel-gae/src/test/resources/log4j.properties deleted file mode 100644 index 9a58ee6..0000000 --- a/components/camel-gae/src/test/resources/log4j.properties +++ /dev/null @@ -1,36 +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. -## --------------------------------------------------------------------------- - -# -# The logging properties used -# -log4j.rootLogger=INFO, file - -#log4j.logger.org.apache.camel=DEBUG - -# CONSOLE appender not used by default -log4j.appender.out=org.apache.log4j.ConsoleAppender -log4j.appender.out.layout=org.apache.log4j.PatternLayout -log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n - -# File appender -log4j.appender.file=org.apache.log4j.FileAppender -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n -log4j.appender.file.file=target/camel-gae-test.log -log4j.appender.file.append=true - http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml b/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml deleted file mode 100644 index 8eda27e..0000000 --- a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml +++ /dev/null @@ -1,53 +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. ---> - -<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.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.auth.GAuthRouteBuilder"/> - - <bean id="gauth-cs" class="org.apache.camel.component.gae.auth.GAuthComponent"> - <property name="consumerKey" value="testComsumerKey"/> - <property name="consumerSecret" value="testComsumerSecret"/> - </bean> - - <bean id="gauth-pk" class="org.apache.camel.component.gae.auth.GAuthComponent"> - <property name="consumerKey" value="test"/> - <property name="keyLoader" ref="keyLoader"/> - </bean> - - <bean id="keyLoader" class="org.apache.camel.component.gae.auth.GAuthJksLoader"> - <property name="keyStoreLocation" value="org/apache/camel/component/gae/auth/test1.jks"/> - <property name="keyAlias" value="test1"/> - <property name="keyPass" value="test1pass"/> - <property name="storePass" value="test1pass"/> - </bean> - - <bean id="testService" class="org.apache.camel.component.gae.auth.GAuthServiceMock"/> - -</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks b/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks deleted file mode 100644 index 3b93c2b..0000000 Binary files a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 b/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 deleted file mode 100644 index c5e66c7..0000000 --- a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMeSUIoDPJ2Xn7Jd -nm8+fzP1Ls4p/aTILw/7MprVu9pOoMw1JN1suEnH+5jlEEr5QSdm044TV2SlDx5l -8zYDdInaRw6VevnuZ3ZhcfLe7uguf2xllGncjwBrHfEv+QNpxm7k2lwUA35b9p9H -4M1K205K9g6lE/jMfmOeW2MOblxdAgMBAAECgYAnD3kZ+hY0FggYpgArb8T/y140 -1b0iMlgbvaOi8HBLAxavwTsM54mOT0jsHPE6a1yYNKT1as2xEilKXtPiX3zAYfAA -xPUYtQ3tTtCbrULCVc/CV4puwrrJWK0Rha7fKh+fSoMamVAWQansjqYOzFEdfUjb -aZN6aH9umuiglkPClQJBAOPGhXwtxPnKOfaKv3L/K0SXfJ08Sh1f6xYxb89lSYrG -Z3i5UYInI9b4E5ESt/PEOXzrKd+ziP3h5Vq5e9LIw68CQQDgTRwhJdEQLvEAeCUx -uwRpVdd8403tGJv1YIlipRKQaP/Q1ClG00gGBL+No7lJcNDcNKvsGONS6ljQ/Vco -uEezAkEAliukhiKG40j4vhrr7h1doXNerSu6kXNTwuYFGW9l9SCpx2Ym3vB/KJOW -EueMcCLG5B0HFn1/rCLq282+XVIP8QJBAJEJK1w/wLyPLeUYyywp+sNF743gyP27 -wPTclFmF1cgtLOVSmtIiQlsp7NbgfCoB2fvZzyVePnfZ8s5IUniRGEMCQCUb1Ckq -0RskVGzpp2meDgg8BrT9EZNAvRc1CrhxSkzJlUTsae8KRwcAawDlC/BxwwIphhmJ -uKWdE17Ig4Idm88= ------END PRIVATE KEY----- http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml b/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml deleted file mode 100644 index 4c939de..0000000 --- a/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml +++ /dev/null @@ -1,34 +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. ---> - -<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.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"/> - -</beans>