Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java (added) +++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java Mon Nov 16 08:45:58 2009 @@ -0,0 +1,91 @@ +/** + * 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.InputStream; + +import com.meterware.httpunit.HttpUnitOptions; +import com.meterware.servletunit.ServletRunner; + +import org.apache.camel.CamelContext; +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.junit.After; +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.core.io.ClassPathResource; +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/task/context-combined.xml" }) +public class GTaskCombinedRouteBuilderTest extends ServletTestSupport { + + @Autowired + private CamelContext camelContext; + + @Autowired + private ProducerTemplate producerTemplate; + + @Autowired + private MockQueue mockQueue; + + @BeforeClass + public static void setUpClass() throws Exception { + String webxml = "org/apache/camel/component/gae/task/web-combined.xml"; + InputStream is = new ClassPathResource(webxml).getInputStream(); + servletRunner = new ServletRunner(is, CTX_PATH); + HttpUnitOptions.setExceptionsThrownOnErrorStatus(true); + // Servlet needs to be initialized explicitly because + // route creation is not bound to servlet lifecycle. + initServlet(); + is.close(); + } + + @Before + public void setUp() { + mockQueue.setServletUnitClient(newClient()); + } + + @After + public void tearDown() { + getMockEndpoint().reset(); + } + + @Test + public void testDefault() throws Exception { + getMockEndpoint().expectedBodiesReceived("test1"); + getMockEndpoint().expectedHeaderReceived("test", "test2"); + producerTemplate.sendBodyAndHeader("direct:input", "test1", "test", "test2"); + getMockEndpoint().assertIsSatisfied(); + Message received = getMockEndpoint().getExchanges().get(0).getIn(); + assertEquals("default", received.getHeader(GTaskBinding.GTASK_QUEUE_NAME)); + assertEquals(0, received.getHeader(GTaskBinding.GTASK_RETRY_COUNT)); + } + + private MockEndpoint getMockEndpoint() { + return (MockEndpoint)camelContext.getEndpoint("mock:mock"); + } + +}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskCombinedRouteBuilderTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java (added) +++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java Mon Nov 16 08:45:58 2009 @@ -0,0 +1,58 @@ +/** + * 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)); + assertFalse(endpoint.getQueue() instanceof MockQueue); + } + + @Test + public void testPropertiesCustom() throws Exception { + StringBuffer buffer = new StringBuffer("gtask:myqueue") + .append("?").append("queueRef=#mockQueue") + .append(AMP).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); + assertTrue(endpoint.getQueue() instanceof MockQueue); + assertEquals("gtask:/myqueue", endpoint.getEndpointUri()); + } + +} Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskEndpointTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java (added) +++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java Mon Nov 16 08:45:58 2009 @@ -0,0 +1,55 @@ +/** + * 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.api.labs.taskqueue.TaskOptions; +import com.google.appengine.api.labs.taskqueue.TaskOptionsAccessor; + +import org.apache.camel.CamelContext; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.impl.SimpleRegistry; + +public final class GTaskTestUtils { + + private static CamelContext context; + private static GTaskComponent component; + + static { + SimpleRegistry registry = new SimpleRegistry(); + registry.put("mockQueue", new MockQueue()); + 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 GTaskEndpoint createEndpoint(String endpointUri) throws Exception { + return (GTaskEndpoint)component.createEndpoint(endpointUri); + } + + public static TaskOptionsAccessor createTaskOptionsAccessor() throws Exception { + return new TaskOptionsAccessor(TaskOptions.Builder.withDefaults()); + } + +} Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/GTaskTestUtils.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/MockQueue.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/MockQueue.java?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/MockQueue.java (added) +++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/MockQueue.java Mon Nov 16 08:45:58 2009 @@ -0,0 +1,80 @@ +/** + * 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.Map; + +import com.google.appengine.api.datastore.Transaction; +import com.google.appengine.api.labs.taskqueue.Queue; +import com.google.appengine.api.labs.taskqueue.TaskHandle; +import com.google.appengine.api.labs.taskqueue.TaskOptions; +import com.google.appengine.api.labs.taskqueue.TaskOptionsAccessor; +import com.meterware.httpunit.PostMethodWebRequest; +import com.meterware.servletunit.ServletUnitClient; + +import org.junit.Assert; + +public class MockQueue implements Queue { + + private String name; + + private ServletUnitClient servletUnitClient; + + public MockQueue() { + this("default"); + } + + public MockQueue(String name) { + this.name = name; + } + + public void setServletUnitClient(ServletUnitClient servletUnitClient) { + this.servletUnitClient = servletUnitClient; + } + + public TaskHandle add() { + throw new UnsupportedOperationException("not implemented"); + } + + public TaskHandle add(TaskOptions taskOptions) { + return add(null, taskOptions); + } + + public TaskHandle add(Transaction transaction, TaskOptions taskOptions) { + TaskOptionsAccessor accessor = new TaskOptionsAccessor(taskOptions); + try { + PostMethodWebRequest request = new PostMethodWebRequest(accessor.getUrl(), accessor.getPayload(), null); + request.setHeaderField(GTaskBinding.GAE_QUEUE_NAME, name); + request.setHeaderField(GTaskBinding.GAE_RETRY_COUNT, "0"); + if (accessor.getTaskName() != null) { + request.setHeaderField(GTaskBinding.GAE_TASK_NAME, accessor.getTaskName()); + } + for (Map.Entry<String, String> entry : accessor.getHeaders().entrySet()) { + request.setHeaderField(entry.getKey(), entry.getValue()); + } + servletUnitClient.getResponse(request); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + return null; + } + + public String getQueueName() { + return name; + } + +} Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/task/MockQueue.java ------------------------------------------------------------------------------ svn:eol-style = native Added: 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=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,44 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" +http://www.springframework.org/schema/beans +http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <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> + + <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> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-combined.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: 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=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,35 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" +http://www.springframework.org/schema/beans +http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <bean id="camelContext" + class="org.apache.camel.component.gae.context.GaeSpringCamelContext"> + <property name="routeBuilder" ref="routeBuilder" /> + </bean> + + <bean id="routeBuilder" + class="org.apache.camel.component.gae.http.GHttpInboundRouteBuilder"> + </bean> + +</beans> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-inbound.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: 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=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,44 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" +http://www.springframework.org/schema/beans +http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <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> + + <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> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/context-outbound.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-combined.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-combined.xml?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-combined.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-combined.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,36 @@ +<!-- + 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. +--> + +<web-app> + + <servlet> + <servlet-name>CamelServlet</servlet-name> + <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> + <init-param> + <param-name>contextConfigLocation</param-name> + <param-value>org/apache/camel/component/gae/http/context-combined.xml</param-value> + </init-param> + </servlet> + + <servlet-mapping> + <servlet-name>CamelServlet</servlet-name> + <url-pattern>/camel/*</url-pattern> + </servlet-mapping> + +</web-app> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-combined.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-inbound.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-inbound.xml?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-inbound.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-inbound.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,36 @@ +<!-- + 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. +--> + +<web-app> + + <servlet> + <servlet-name>CamelServlet</servlet-name> + <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> + <init-param> + <param-name>contextConfigLocation</param-name> + <param-value>org/apache/camel/component/gae/http/context-inbound.xml</param-value> + </init-param> + </servlet> + + <servlet-mapping> + <servlet-name>CamelServlet</servlet-name> + <url-pattern>/camel/*</url-pattern> + </servlet-mapping> + +</web-app> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/http/web-inbound.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/mail/context-outbound.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/mail/context-outbound.xml?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/mail/context-outbound.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/mail/context-outbound.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,44 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" +http://www.springframework.org/schema/beans +http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <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> + + <bean id="routeBuilder" + class="org.apache.camel.component.gae.mail.GMailOutboundRouteBuilder"> + </bean> + + <bean id="mockMailService" + class="org.apache.camel.component.gae.mail.MockMailService"> + </bean> + +</beans> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/mail/context-outbound.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/context-combined.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/context-combined.xml?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/context-combined.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/context-combined.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,44 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" +http://www.springframework.org/schema/beans +http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <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> + + <bean id="routeBuilder" + class="org.apache.camel.component.gae.task.GTaskCombinedRouteBuilder"> + </bean> + + <bean id="mockQueue" + class="org.apache.camel.component.gae.task.MockQueue"> + </bean> + +</beans> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/context-combined.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/web-combined.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/web-combined.xml?rev=880672&view=auto ============================================================================== --- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/web-combined.xml (added) +++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/web-combined.xml Mon Nov 16 08:45:58 2009 @@ -0,0 +1,32 @@ +<!-- + 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. +--> + +<web-app> + + <servlet> + <servlet-name>CamelServlet</servlet-name> + <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>CamelServlet</servlet-name> + <url-pattern>/camel/*</url-pattern> + </servlet-mapping> + +</web-app> Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/task/web-combined.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: camel/trunk/components/camel-servlet/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-servlet/pom.xml?rev=880672&r1=880671&r2=880672&view=diff ============================================================================== --- camel/trunk/components/camel-servlet/pom.xml (original) +++ camel/trunk/components/camel-servlet/pom.xml Mon Nov 16 08:45:58 2009 @@ -51,7 +51,6 @@ <dependency> <groupId>httpunit</groupId> <artifactId>httpunit</artifactId> - <version>1.6.2</version> <scope>test</scope> </dependency> </dependencies> Modified: camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java?rev=880672&r1=880671&r2=880672&view=diff ============================================================================== --- camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java (original) +++ camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java Mon Nov 16 08:45:58 2009 @@ -21,6 +21,7 @@ import org.apache.camel.Endpoint; import org.apache.camel.component.http.CamelServlet; +import org.apache.camel.component.http.HttpClientConfigurer; import org.apache.camel.component.http.HttpComponent; import org.apache.camel.component.http.HttpConsumer; import org.apache.camel.util.CastUtils; @@ -28,6 +29,7 @@ import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; import org.apache.camel.util.UnsafeUriCharactersEncoder; +import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.params.HttpClientParams; public class ServletComponent extends HttpComponent { @@ -67,7 +69,7 @@ CastUtils.cast(parameters)); uri = httpUri.toString(); - ServletEndpoint result = new ServletEndpoint(uri, this, httpUri, params, getHttpConnectionManager(), httpClientConfigurer); + ServletEndpoint result = createServletEndpoint(uri, this, httpUri, params, getHttpConnectionManager(), httpClientConfigurer); if (httpBinding != null) { result.setBinding(httpBinding); } @@ -76,6 +78,14 @@ return result; } + protected ServletEndpoint createServletEndpoint(String endpointUri, + ServletComponent component, URI httpUri, HttpClientParams params, + HttpConnectionManager httpConnectionManager, + HttpClientConfigurer clientConfigurer) throws Exception { + return new ServletEndpoint(endpointUri, component, httpUri, params, + httpConnectionManager, clientConfigurer); + } + public void connect(HttpConsumer consumer) throws Exception { ServletEndpoint endpoint = (ServletEndpoint) consumer.getEndpoint(); CamelServlet servlet = getCamelServlet(endpoint.getServletName()); Modified: camel/trunk/components/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=880672&r1=880671&r2=880672&view=diff ============================================================================== --- camel/trunk/components/pom.xml (original) +++ camel/trunk/components/pom.xml Mon Nov 16 08:45:58 2009 @@ -44,6 +44,7 @@ <module>camel-flatpack</module> <module>camel-freemarker</module> <module>camel-ftp</module> + <module>camel-gae</module> <module>camel-guice</module> <module>camel-groovy</module> <module>camel-http</module> Modified: camel/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=880672&r1=880671&r2=880672&view=diff ============================================================================== --- camel/trunk/parent/pom.xml (original) +++ camel/trunk/parent/pom.xml Mon Nov 16 08:45:58 2009 @@ -72,6 +72,7 @@ <hamcrest-version>1.2-dev1</hamcrest-version> <hibernate-version>3.2.6.ga</hibernate-version> <hibernate-entitymanager-version>3.2.1.ga</hibernate-entitymanager-version> + <httpunit-version>1.6.2</httpunit-version> <hsqldb-version>1.8.0.7</hsqldb-version> <groovy-version>1.6.3</groovy-version> <guiceyfruit-version>2.0</guiceyfruit-version> @@ -936,6 +937,11 @@ <artifactId>easymockclassextension</artifactId> <version>${easymock-version}</version> </dependency> + <dependency> + <groupId>httpunit</groupId> + <artifactId>httpunit</artifactId> + <version>${httpunit-version}</version> + </dependency> <!-- default JPA support --> <dependency>