This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit d3782803cd6f7566d3b6a3fef3007aabf6969f2d Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Tue Apr 12 18:23:41 2022 +0200 CAMEL-17763: cleaned up unused exceptions in camel-resteasy --- .../test/ResteasyConsumerMatchUriOnPrefix.java | 5 ++--- .../resteasy/test/ResteasyConsumerProxyTest.java | 8 +++---- .../resteasy/test/ResteasyConsumerTest.java | 2 +- .../test/ResteasyConsumerTwoServletsTest.java | 2 +- .../resteasy/test/ResteasyMethodRestrictTest.java | 2 +- .../resteasy/test/ResteasyProducerProxyTest.java | 26 +++++++++++----------- .../resteasy/test/ResteasyProducerTest.java | 24 ++++++++++---------- .../test/ResteasyRestDSLProxyCamelTest.java | 2 +- .../resteasy/test/ResteasyRestDSLProxyTest.java | 2 +- .../resteasy/test/ResteasyRestDSLTest.java | 2 +- .../resteasy/test/ResteasySimpleConsumerTest.java | 4 ++-- .../resteasy/test/ServletInitializerTest.java | 5 ++--- .../camel/component/resteasy/test/WebTest.java | 4 ++-- .../resteasy/test/beans/CustomerService.java | 20 ++++++++--------- .../component/resteasy/test/beans/ProxyBean.java | 2 +- .../resteasy/test/beans/ServletOneService.java | 5 +---- .../resteasy/test/beans/ServletTwoService.java | 5 +---- .../resteasy/test/beans/SimpleService.java | 11 ++++----- .../component/resteasy/test/beans/TestBean.java | 2 +- 19 files changed, 60 insertions(+), 73 deletions(-) diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerMatchUriOnPrefix.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerMatchUriOnPrefix.java index dcf864e7c73..d56f714af49 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerMatchUriOnPrefix.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerMatchUriOnPrefix.java @@ -56,11 +56,10 @@ public class ResteasyConsumerMatchUriOnPrefix { /** * App declares files via the web.xml - * - * @throws Exception + * */ @Test - public void testEndpoint() throws Exception { + public void testEndpoint() { Response response = ResteasyClientBuilder.newClient().target(baseUri.toString() + "simpleService/match/prefix") .request().get(); String entity = response.readEntity(String.class); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerProxyTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerProxyTest.java index 443528074dd..bda5a6a56a2 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerProxyTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerProxyTest.java @@ -62,7 +62,7 @@ public class ResteasyConsumerProxyTest { } @Test - public void testProxyOnlyFromCamel() throws Exception { + public void testProxyOnlyFromCamel() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "camel/address"); Response response = target.request().get(); @@ -72,7 +72,7 @@ public class ResteasyConsumerProxyTest { } @Test - public void testProxyFromInterface() throws Exception { + public void testProxyFromInterface() { Response response = ResteasyClientBuilder.newClient().target(baseUri.toString() + "proxy/get").request().get(); assertEquals(200, response.getStatus()); @@ -83,7 +83,7 @@ public class ResteasyConsumerProxyTest { // FIX THIS: using bean in camel route a getting body as Customer.class doesn't work -> need to investigate // RESOLUTION: resteasy-jackson2-provider test dependency resolves it. @Test - public void testProxyPostFromInterface() throws Exception { + public void testProxyPostFromInterface() { Customer customer = new Customer("Camel", "Rider", 1); Client client = ClientBuilder.newBuilder().build(); @@ -97,7 +97,7 @@ public class ResteasyConsumerProxyTest { } @Test - public void testWrongMethodOnProxyInterface() throws Exception { + public void testWrongMethodOnProxyInterface() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "proxy/createCustomer"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTest.java index 710e0ee160a..11caf463fac 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTest.java @@ -208,7 +208,7 @@ public class ResteasyConsumerTest { } @Test - public void testWrongMethod() throws Exception { + public void testWrongMethod() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "customer/createCustomer"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTwoServletsTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTwoServletsTest.java index 4363c265e88..b5df3feaa96 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTwoServletsTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyConsumerTwoServletsTest.java @@ -56,7 +56,7 @@ public class ResteasyConsumerTwoServletsTest { } @Test - public void testServletNameOption() throws Exception { + public void testServletNameOption() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "numberOne/simpleServiceSecure/getMsg"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyMethodRestrictTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyMethodRestrictTest.java index 68ce878c388..74545021a19 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyMethodRestrictTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyMethodRestrictTest.java @@ -53,7 +53,7 @@ public class ResteasyMethodRestrictTest { } @Test - public void testGettingResponseFromBean() throws Exception { + public void testGettingResponseFromBean() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "method/restrict"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerProxyTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerProxyTest.java index 9385a76e1bb..d78b8c44468 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerProxyTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerProxyTest.java @@ -142,7 +142,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { @Test @Order(1) - public void testProxyGetAll() throws Exception { + public void testProxyGetAll() { String expectedUser1 = "{\"name\":\"Roman\",\"surname\":\"Jakubco\",\"id\":1}"; String expectedUser2 = "{\"name\":\"Camel\",\"surname\":\"Rider\",\"id\":2}"; @@ -152,12 +152,12 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyGet() throws Exception { + public void testProxyGet() { String expectedBody = "{\"name\":\"Camel\",\"surname\":\"Rider\",\"id\":2}"; Exchange response = template.request("direct:get", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { ArrayList<Object> params = new ArrayList<Object>(); params.add(2); exchange.getIn().getHeaders().put(ResteasyConstants.RESTEASY_PROXY_METHOD_PARAMS, params); @@ -167,12 +167,12 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyGetUnmarshal() throws Exception { + public void testProxyGetUnmarshal() { Customer expectedCustomer = new Customer("Camel", "Rider", 2); Exchange response = template.request("direct:getUnmarshal", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { ArrayList<Object> params = new ArrayList<Object>(); params.add(2); @@ -184,7 +184,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyPost() throws Exception { + public void testProxyPost() { Integer customerId = 3; Customer expectedCustomer = new Customer("TestPost", "TestPost", customerId); @@ -200,7 +200,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyPut() throws Exception { + public void testProxyPut() { Integer customerId = 4; Customer expectedCustomer = new Customer("TestPut", "TestPut", customerId); @@ -226,7 +226,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyDelete() throws Exception { + public void testProxyDelete() { Integer customerId = 5; Customer expectedCustomer = new Customer("TestDelete", "TestDelete", customerId); @@ -249,7 +249,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyCallWithMoreAttributes() throws Exception { + public void testProxyCallWithMoreAttributes() { Integer customerId = 6; Customer expectedCustomer = new Customer("Test", "Test", customerId); @@ -276,7 +276,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyCallWithDifferentTypeAttributes() throws Exception { + public void testProxyCallWithDifferentTypeAttributes() { Integer customerId = 7; Customer expectedCustomer = new Customer("TestAttr", "TestAttr", customerId); @@ -319,7 +319,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyCallWithAttributesInWrongOrder() throws Exception { + public void testProxyCallWithAttributesInWrongOrder() { Integer customerId = 8; final Customer expectedCustomer = new Customer("TestWrong", "TestWrong", customerId); @@ -335,7 +335,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { headers.put(ResteasyConstants.RESTEASY_PROXY_METHOD_PARAMS, params); Exchange exchange = template.request("direct:differentType", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { ArrayList<Object> exchangeParams = new ArrayList<Object>(); exchangeParams.add(expectedCustomer); exchangeParams.add(8); @@ -350,7 +350,7 @@ public class ResteasyProducerProxyTest extends CamelTestSupport { } @Test - public void testProxyCallOnMethodWithoutReturnTypeResponse() throws Exception { + public void testProxyCallOnMethodWithoutReturnTypeResponse() { Integer customerId = 9; Customer expectedCustomer = new Customer("Test", "Test", customerId); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerTest.java index ff11ed14685..0472f56c4d7 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyProducerTest.java @@ -111,7 +111,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testGet() throws Exception { + public void testGet() { String expectedUser1 = "{\"name\":\"Roman\",\"surname\":\"Jakubco\",\"id\":1}"; String expectedUser2 = "{\"name\":\"Camel\",\"surname\":\"Rider\",\"id\":2}"; String response = template.requestBody("direct:getAll", null, String.class); @@ -120,7 +120,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testGetWithQuery() throws Exception { + public void testGetWithQuery() { String expectedBody = "{\"name\":\"Camel\",\"surname\":\"Rider\",\"id\":2}"; String response = template.requestBodyAndHeader("direct:get", null, Exchange.HTTP_QUERY, "id=2", String.class); @@ -128,7 +128,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testGetWithQueryUnmarshal() throws Exception { + public void testGetWithQueryUnmarshal() { Integer customerId = 2; Customer expectedCustomer = new Customer("Camel", "Rider", customerId); Customer customer = template.requestBodyAndHeader("direct:getUnmarshal", null, Exchange.HTTP_QUERY, "id=" + customerId, @@ -137,7 +137,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testPost() throws Exception { + public void testPost() { Integer customerId = 3; Customer expectedCustomer = new Customer("TestPost", "TestPost", customerId); String response @@ -153,7 +153,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testPostMarshal() throws Exception { + public void testPostMarshal() { Integer customerId = 4; Customer expectedCustomer = new Customer("TestPostMarshal", "TestPostMarshal", customerId); @@ -169,7 +169,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testPut() throws Exception { + public void testPut() { Integer customerId = 5; Customer customer = new Customer("TestPut", "TestPut", customerId); @@ -197,7 +197,7 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testDelete() throws Exception { + public void testDelete() { Integer customerId = 6; Customer expectedCustomer = new Customer("TestDelete", "TestDelete", customerId); @@ -216,14 +216,14 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testMethodInHeader() throws Exception { + public void testMethodInHeader() { Integer customerId = 7; Customer expectedCustomer = new Customer("TestPostInHeader", "TestPostInHeader", customerId); //check default value for http method Exchange exchange = template.request("direct:postInHeader", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { } }); @@ -246,17 +246,17 @@ public class ResteasyProducerTest extends CamelTestSupport { } @Test - public void testSettingNotExistingHttpMethod() throws Exception { + public void testSettingNotExistingHttpMethod() { assertThrows(CamelExecutionException.class, () -> template.requestBodyAndHeader("direct:getAll", null, ResteasyConstants.RESTEASY_HTTP_METHOD, "GAT")); } @SuppressWarnings("rawtypes") @Test - public void testHead() throws Exception { + public void testHead() { Exchange exchange = template.request("direct:getAll", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getMessage().setHeader(ResteasyConstants.RESTEASY_HTTP_METHOD, "HEAD"); } }); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyCamelTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyCamelTest.java index 0b2e5ab9b6e..11ca48ddd78 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyCamelTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyCamelTest.java @@ -55,7 +55,7 @@ public class ResteasyRestDSLProxyCamelTest { } @Test - public void testRestDSLProxyCamel() throws Exception { + public void testRestDSLProxyCamel() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "say/hello"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyTest.java index ea632df61d1..66b769f8281 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLProxyTest.java @@ -58,7 +58,7 @@ public class ResteasyRestDSLProxyTest { } @Test - public void testRestDSLProxy() throws Exception { + public void testRestDSLProxy() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "proxy/get"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLTest.java index 0e9b7685b63..c09669665bd 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasyRestDSLTest.java @@ -57,7 +57,7 @@ public class ResteasyRestDSLTest { } @Test - public void testRestDSL() throws Exception { + public void testRestDSL() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "simpleService/getMsg"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasySimpleConsumerTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasySimpleConsumerTest.java index 988bd5cbbca..ca4a1bc8dd8 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasySimpleConsumerTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ResteasySimpleConsumerTest.java @@ -57,7 +57,7 @@ public class ResteasySimpleConsumerTest { } @Test - public void testGettingResponseFromBean() throws Exception { + public void testGettingResponseFromBean() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "simpleService/getMsg"); Response response = target.request().get(); @@ -68,7 +68,7 @@ public class ResteasySimpleConsumerTest { } @Test - public void testGettingBodyFromCamelRoute() throws Exception { + public void testGettingBodyFromCamelRoute() { Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(baseUri.toString() + "simpleService/getMsg2"); Response response = target.request().get(); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ServletInitializerTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ServletInitializerTest.java index 9002d7e9cd2..4b3ac74bb3a 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ServletInitializerTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/ServletInitializerTest.java @@ -65,11 +65,10 @@ public class ServletInitializerTest { /** * App declares files via the web.xml - * - * @throws Exception + * */ @Test - public void testEndpoint() throws Exception { + public void testEndpoint() { Response response = ResteasyClientBuilder.newClient() .target(baseUri.toString() + "test/17").request().get(); String entity = response.readEntity(String.class); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/WebTest.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/WebTest.java index 0b441da1ec2..8b87d37d51f 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/WebTest.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/WebTest.java @@ -144,7 +144,7 @@ public @interface WebTest { } @Override - public void beforeEach(ExtensionContext context) throws Exception { + public void beforeEach(ExtensionContext context) { Class<?> testClass = context.getRequiredTestClass(); List<Field> fields = Stream.of(testClass.getDeclaredFields()) .filter(f -> f.isAnnotationPresent(Resource.class)) @@ -168,7 +168,7 @@ public @interface WebTest { } @Override - public void afterEach(ExtensionContext context) throws Exception { + public void afterEach(ExtensionContext context) { } @Override diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/CustomerService.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/CustomerService.java index 83b8bd4943c..a2f38d917f0 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/CustomerService.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/CustomerService.java @@ -16,11 +16,9 @@ */ package org.apache.camel.component.resteasy.test.beans; -import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.servlet.ServletException; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -45,14 +43,14 @@ public class CustomerService { @GET @Produces("application/json") @Path("/getAll") - public Response getAllCustomers() throws IOException, ServletException { + public Response getAllCustomers() { return Response.status(200).entity(list.getCustomerList()).build(); } @GET @Produces("application/json") @Path("/getCustomer") - public Response getCustomer(@QueryParam("id") Integer id) throws Exception { + public Response getCustomer(@QueryParam("id") Integer id) { Customer c = list.getCustomer(id); if (c != null) { return Response.status(200).entity(c).build(); @@ -63,7 +61,7 @@ public class CustomerService { @DELETE @Path("/deleteCustomer") - public Response deleteCustomer(@QueryParam("id") Integer id) throws IOException, ServletException { + public Response deleteCustomer(@QueryParam("id") Integer id) { Customer c = list.deleteCustomer(id); return Response.status(200).entity("Customer deleted : " + c).build(); } @@ -71,7 +69,7 @@ public class CustomerService { @POST @Consumes("application/json") @Path("/createCustomer") - public Response createCustomer(Customer customer) throws IOException, ServletException { + public Response createCustomer(Customer customer) { list.addCustomer(customer); return Response.status(200).entity("Customer added : " + customer).build(); } @@ -79,7 +77,7 @@ public class CustomerService { @PUT @Consumes("application/json") @Path("/updateCustomer") - public Response updateCustomer(Customer customer) throws Exception { + public Response updateCustomer(Customer customer) { Customer update = list.getCustomer(customer.getId()); if (update != null) { list.deleteCustomer(customer.getId()); @@ -98,8 +96,8 @@ public class CustomerService { @Produces("application/json") @Path("/getSpecificThreeCustomers") public Response getSpecificThreeCustomers( - @QueryParam("c1") Integer customerId1, @QueryParam("c2") Integer customerId2, @QueryParam("c3") Integer customerId3) - throws Exception { + @QueryParam("c1") Integer customerId1, @QueryParam("c2") Integer customerId2, + @QueryParam("c3") Integer customerId3) { List<Customer> customers = new ArrayList<>(); customers.add(list.getCustomer(customerId1)); customers.add(list.getCustomer(customerId2)); @@ -112,7 +110,7 @@ public class CustomerService { @Produces("application/json") @Consumes("application/json") @Path("/checkCustomer") - public Response checkIfCustomerExists(@QueryParam("c1") Integer customerId1, Customer customer) throws Exception { + public Response checkIfCustomerExists(@QueryParam("c1") Integer customerId1, Customer customer) { Customer foundCustomer = list.getCustomer(customerId1); if (foundCustomer.equals(customer)) { return Response.status(200).entity("Customers are equal").build(); @@ -125,7 +123,7 @@ public class CustomerService { @GET @Produces("application/json") @Path("/getCustomerWithoutResponse") - public Customer getCustomerWithoutResponse(@QueryParam("c1") Integer customerId1) throws Exception { + public Customer getCustomerWithoutResponse(@QueryParam("c1") Integer customerId1) { Customer c = list.getCustomer(customerId1); return c; } diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ProxyBean.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ProxyBean.java index 664458181da..b6743a49741 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ProxyBean.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ProxyBean.java @@ -21,7 +21,7 @@ import org.apache.camel.Processor; public class ProxyBean implements Processor { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { String customer = exchange.getIn().getBody(String.class); exchange.getMessage().setBody("Customer added : " + customer); diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletOneService.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletOneService.java index 2e2248c2bad..9235a302f84 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletOneService.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletOneService.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.resteasy.test.beans; -import java.io.IOException; - -import javax.servlet.ServletException; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @@ -28,7 +25,7 @@ public class ServletOneService { @GET @Path("/getMsg") - public Response getMessage() throws IOException, ServletException { + public Response getMessage() { return Response.status(200).entity("Message from camel-servlet-1").build(); } diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletTwoService.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletTwoService.java index bbcc83ee519..af67f81e154 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletTwoService.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/ServletTwoService.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.resteasy.test.beans; -import java.io.IOException; - -import javax.servlet.ServletException; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @@ -28,7 +25,7 @@ public class ServletTwoService { @GET @Path("/getMsg") - public Response getMessage() throws IOException, ServletException { + public Response getMessage() { return Response.status(200).entity("Message from camel-servlet-2").build(); } diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/SimpleService.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/SimpleService.java index 49b9a56de4c..e5b932ec95b 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/SimpleService.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/SimpleService.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.resteasy.test.beans; -import java.io.IOException; - -import javax.servlet.ServletException; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @@ -28,25 +25,25 @@ public class SimpleService { @GET @Path("/getMsg") - public Response getMessage() throws IOException, ServletException { + public Response getMessage() { return Response.status(200).entity("Message1 from Rest service").build(); } @GET @Path("/getMsg2") - public Response getMessage2() throws IOException, ServletException { + public Response getMessage2() { return Response.status(200).entity("Message2 from Rest service").build(); } @GET @Path("/getMsg3") - public Response getMessage3() throws IOException, ServletException { + public Response getMessage3() { return Response.status(200).entity("Message3 from Rest service").build(); } @GET @Path("/match/prefix") - public Response matchOnUri() throws IOException, ServletException { + public Response matchOnUri() { return Response.status(200).entity("Prefix").build(); } diff --git a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/TestBean.java b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/TestBean.java index e6b448c8fb7..b9522635bd4 100644 --- a/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/TestBean.java +++ b/components/camel-resteasy/src/test/java/org/apache/camel/component/resteasy/test/beans/TestBean.java @@ -23,7 +23,7 @@ import org.apache.camel.Processor; public class TestBean implements Processor { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { ByteArrayOutputStream body = exchange.getIn().getBody(ByteArrayOutputStream.class); exchange.getMessage().setBody("Added this message from bean to original message from Rest Service -> " + body); }