This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit a6f90b68e799fcf5609e7663a2bbc90f010ddf1f Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Mar 1 14:27:51 2018 +0100 Lets remove restlet tests as restlet is only available in 3rd party maven repo and we want to avoid using those. --- tests/camel-itest/pom.xml | 17 ----- .../CheckDomainAvailabilityRestResponse.java | 42 ----------- .../example/CheckDomainAvailabilityResult.java | 42 ----------- .../itest/restlet/example/CheckDomainRequest.java | 59 --------------- .../restlet/example/CxfRSDomainServiceTest.java | 88 ---------------------- .../camel/itest/restlet/example/DomainService.java | 58 -------------- .../apache/camel/itest/restlet/example/Order.java | 72 ------------------ .../camel/itest/restlet/example/Product.java | 41 ---------- .../restlet/example/RestletDomainServiceTest.java | 54 ------------- .../restlet/example/RestletGroovyIssueTest.java | 82 -------------------- 10 files changed, 555 deletions(-) diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml index 48bb056..a461645 100644 --- a/tests/camel-itest/pom.xml +++ b/tests/camel-itest/pom.xml @@ -32,11 +32,6 @@ <description>Performs cross component integration tests</description> <repositories> - <repository> - <id>maven-restlet</id> - <name>Public online Restlet repository</name> - <url>http://maven.restlet.org</url> - </repository> <!-- required for validator tests --> <repository> @@ -142,18 +137,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-restlet</artifactId> - <scope>test</scope> - </dependency> - <!-- restlet JAXB binding --> - <dependency> - <groupId>org.restlet.osgi</groupId> - <artifactId>org.restlet.ext.jaxb</artifactId> - <version>${restlet-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-spring-security</artifactId> <scope>test</scope> </dependency> diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityRestResponse.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityRestResponse.java deleted file mode 100644 index a308954..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityRestResponse.java +++ /dev/null @@ -1,42 +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.itest.restlet.example; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "CheckDomainResponse") -public class CheckDomainAvailabilityRestResponse { - private String requestId; - private String responseBody; - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getResponseBody() { - return responseBody; - } - - public void setResponseBody(String responseBody) { - this.responseBody = responseBody; - } - -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityResult.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityResult.java deleted file mode 100644 index 6d0ce63..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainAvailabilityResult.java +++ /dev/null @@ -1,42 +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.itest.restlet.example; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "CheckDomainAvailabilityResult") -public class CheckDomainAvailabilityResult { - private String requestId; - private String responseBody; - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getResponseBody() { - return responseBody; - } - - public void setResponseBody(String responseBody) { - this.responseBody = responseBody; - } - -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainRequest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainRequest.java deleted file mode 100644 index 7140550..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CheckDomainRequest.java +++ /dev/null @@ -1,59 +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.itest.restlet.example; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "checkDomainRequest") -public class CheckDomainRequest { - private long id; - private String name; - private String username; - private String password; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest.java deleted file mode 100644 index 26dd216..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest.java +++ /dev/null @@ -1,88 +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.itest.restlet.example; - -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; - -/** - * @version - */ -@ContextConfiguration -public class CxfRSDomainServiceTest extends AbstractJUnit4SpringContextTests { - - @Autowired - protected CamelContext context; - - @Autowired - protected ProducerTemplate template; - - @Test - public void testAddDomainString() throws Exception { - String input = "<checkDomainRequest><id>123</id><name>www.google.com</name><username>test</username><password>test</password></checkDomainRequest>"; - - String response = template.requestBody("cxfrs:http://localhost:9000/domainservice/domains", input, String.class); - - Assert.assertNotNull(response); - Assert.assertTrue("Should contains response", response.endsWith("<CheckDomainResponse><requestId>123</requestId><responseBody>OK</responseBody></CheckDomainResponse>")); - } - - @Test - public void testAddDomainStringObject() throws Exception { - String input = "<checkDomainRequest><id>123</id><name>www.google.com</name><username>test</username><password>test</password></checkDomainRequest>"; - - CheckDomainAvailabilityRestResponse response = template.requestBody("cxfrs:http://localhost:9000/domainservice/domains", - input, CheckDomainAvailabilityRestResponse.class); - - Assert.assertNotNull(response); - Assert.assertEquals("123", response.getRequestId()); - Assert.assertEquals("OK", response.getResponseBody()); - } - - @Test - public void testAddDomainBothObjects() throws Exception { - CheckDomainRequest input = new CheckDomainRequest(); - input.setId(123); - input.setName("www.google.com"); - input.setUsername("test"); - input.setPassword("test"); - - CheckDomainAvailabilityRestResponse response = template.requestBody("cxfrs:http://localhost:9000/domainservice/domains", - input, CheckDomainAvailabilityRestResponse.class); - - Assert.assertNotNull(response); - Assert.assertEquals("123", response.getRequestId()); - Assert.assertEquals("OK", response.getResponseBody()); - } - - @Test - @Ignore - public void testGetDomain() throws Exception { - // TODO: Must make CXF-RS easier to use - Object response = template.requestBodyAndHeader("cxfrs:http://localhost:9000/domainservice/domains/123", null, - Exchange.HTTP_METHOD, "GET"); - Assert.assertEquals("{www.google.com}", response); - } - -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/DomainService.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/DomainService.java deleted file mode 100644 index 11cc8a2..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/DomainService.java +++ /dev/null @@ -1,58 +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.itest.restlet.example; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -@Path("/domainservice/") -public class DomainService { - - public DomainService() { - } - - @GET - @Path("/domains/{id}/") - @Produces("application/json") - public String getDomain(@PathParam("id") String id) { - return "{www.google.com}"; - } - - @PUT - @Path("/domains/") - @Produces("application/json") - public Response updateDomain(String domain) { - return Response.ok().build(); - } - - @POST - @Path("/domains/") - @Produces("application/xml") - public CheckDomainAvailabilityRestResponse addDomain(CheckDomainRequest request) { - CheckDomainAvailabilityRestResponse response = new CheckDomainAvailabilityRestResponse(); - - response.setRequestId(String.valueOf(request.getId())); - response.setResponseBody("OK"); - - return response; - } -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Order.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Order.java deleted file mode 100644 index cd20b74..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Order.java +++ /dev/null @@ -1,72 +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.itest.restlet.example; - -import java.util.HashMap; -import java.util.Map; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.xml.bind.annotation.XmlRootElement; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@XmlRootElement(name = "Order") -public class Order { - private static final Logger LOG = LoggerFactory.getLogger(Order.class); - private long id; - private String description; - private Map<Long, Product> products = new HashMap<Long, Product>(); - - public Order() { - init(); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getDescription() { - return description; - } - - public void setDescription(String d) { - this.description = d; - } - - @GET - @Path("products/{productId}/") - @Produces("application/xml") - public Product getProduct(@PathParam("productId")int productId) { - LOG.info("----invoking getProduct with id: " + productId); - Product p = products.get(new Long(productId)); - return p; - } - - final void init() { - Product p = new Product(); - p.setId(323); - p.setDescription("product 323"); - products.put(p.getId(), p); - } -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Product.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Product.java deleted file mode 100644 index 370360e..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/Product.java +++ /dev/null @@ -1,41 +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.itest.restlet.example; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Product") -public class Product { - private long id; - private String description; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getDescription() { - return description; - } - - public void setDescription(String d) { - this.description = d; - } -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletDomainServiceTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletDomainServiceTest.java deleted file mode 100644 index a85771b..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletDomainServiceTest.java +++ /dev/null @@ -1,54 +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.itest.restlet.example; - -import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; - -/** - * @version - */ -@ContextConfiguration -public class RestletDomainServiceTest extends AbstractJUnit4SpringContextTests { - - @Autowired - protected ProducerTemplate template; - - @Test - public void testAddDomain() throws Exception { - String input = "<checkDomainRequest><id>123</id><name>www.google.com</name><username>test</username><password>test</password></checkDomainRequest>"; - - String response = template.requestBodyAndHeader("restlet:http://localhost:9000/domainservice/domains?restletMethod=POST", - input, Exchange.CONTENT_TYPE, "application/xml", String.class); - - Assert.assertNotNull(response); - Assert.assertTrue("Should contains response", response.endsWith("<CheckDomainResponse><requestId>123</requestId><responseBody>OK</responseBody></CheckDomainResponse>")); - } - - @Test - public void testGetDomain() throws Exception { - String response = template.requestBody("restlet:http://localhost:9000/domainservice/domains/123?restletMethod=GET", null, String.class); - - Assert.assertEquals("{www.google.com}", response); - } - -} diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletGroovyIssueTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletGroovyIssueTest.java deleted file mode 100644 index 68f68f4..0000000 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/restlet/example/RestletGroovyIssueTest.java +++ /dev/null @@ -1,82 +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.itest.restlet.example; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @version - */ -public class RestletGroovyIssueTest extends CamelTestSupport { - protected static final Logger LOG = LoggerFactory.getLogger(RestletGroovyIssueTest.class); - private long port = AvailablePortFinder.getNextAvailable(16000); - private ExecutorService executorService = Executors.newFixedThreadPool(5); - - @Test - public void testRestletGroovy() throws Exception { - String[] bodies = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; - List<String> expectedBodies = Arrays.asList(bodies); - final CountDownLatch responsesToReceive = new CountDownLatch(expectedBodies.size()); - getMockEndpoint("mock:input").expectedMessageCount(expectedBodies.size()); - getMockEndpoint("mock:output").expectedBodiesReceivedInAnyOrder(expectedBodies); - - for (final String s : expectedBodies) { - executorService.submit(new Runnable() { - @Override - public void run() { - Object response = template.requestBody("restlet:http://localhost:" + port + "/foo/" + s + "?restletMethod=GET", ""); - assertEquals(s, response); - responsesToReceive.countDown(); - }; - }); - } - - responsesToReceive.await(5, TimeUnit.SECONDS); - assertMockEndpointsSatisfied(); - - executorService.shutdownNow(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - fromF("restlet:http://localhost:%s/foo/{id}", port) - .to("log:input?showHeaders=true") - .to("mock:input") - .transform().groovy("request.headers.id") - // sleep a bit so multiple threads are in use - .delay(1000) - .to("log:output") - .to("mock:output"); - } - }; - } -} -- To stop receiving notification emails like this one, please contact davscl...@apache.org.