From 5c0ec00fae551b3efe40f2b9455cabb129789c28 Mon Sep 17 00:00:00 2001 From: gumartinm Date: Sun, 11 Nov 2012 16:53:11 +0100 Subject: [PATCH] Minor changes. --- .../webservices/business/BusinessExample.java | 2 +- .../de/spring/webservices/porttypes/PortType.java | 59 ++++++++++++++-------- .../tests/ExampleEndPointIntegrationTest.java | 33 ++++++------ 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/src/main/java/de/spring/webservices/business/BusinessExample.java b/src/main/java/de/spring/webservices/business/BusinessExample.java index 9590c7d..c3852db 100644 --- a/src/main/java/de/spring/webservices/business/BusinessExample.java +++ b/src/main/java/de/spring/webservices/business/BusinessExample.java @@ -12,7 +12,7 @@ import de.spring.webservices.porttypes.PortType; public class BusinessExample implements PortType.RequestResponse { @Override - public ExampleResponse requestResponse(ExampleRequest request) { + public ExampleResponse requestResponse(final ExampleRequest request) { final ExampleResponse response = new ObjectFactory().createExampleResponse(); response.setData("SNAKE EYES AND " + request.getData()); diff --git a/src/main/java/de/spring/webservices/porttypes/PortType.java b/src/main/java/de/spring/webservices/porttypes/PortType.java index da73454..d0e7d1f 100644 --- a/src/main/java/de/spring/webservices/porttypes/PortType.java +++ b/src/main/java/de/spring/webservices/porttypes/PortType.java @@ -2,10 +2,17 @@ package de.spring.webservices.porttypes; /** *

- * WSDL Port Types + * WSDL 1.1 Port Types *

- * See: http://www.w3.org/TR/wsdl#_porttypes - * + *

+ * WSDL 2.0 is different, so this interface just works with 1.1. Indeed I should + * not implement this interface because of the differences between 2.0 and 1.1 but I + * am doing it because I want to improve my skills related to Java Generics. + *

+ * See: http://www.w3.org/TR/wsdl# + * _porttypes + * */ public interface PortType { @@ -13,38 +20,50 @@ public interface PortType { *

* Request-response operation *

- * See: http://www.w3.org/TR/wsdl#_request-response - * - * @param Describes {@link Response} - * @param Describes {@link Request} + * See: http://www.w3.org + * /TR/wsdl#_request-response + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} */ public interface RequestResponse { - T requestResponse (E request); + T requestResponse(E request); } - + /** *

* One-way operation *

- * See: http://www.w3.org/TR/wsdl#_one-way - * - * @param Describes {@link Response} - * @param Describes {@link Request} + * See: http://www.w3.org/TR/wsdl + * #_one-way + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} */ public interface OneWay { - void oneWay (E request); + void oneWay(E request); } - + /** *

* Notification operation *

- * See: http://www.w3.org/TR/wsdl#_notification - * - * @param Describes {@link Response} - * @param Describes {@link Request} + * See: http://www.w3.org/TR + * /wsdl#_notification + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} */ public interface Notification { - T notification (); + T notification(); } } diff --git a/src/test/java/de/spring/webservices/tests/ExampleEndPointIntegrationTest.java b/src/test/java/de/spring/webservices/tests/ExampleEndPointIntegrationTest.java index 8ae72c2..4c102c6 100644 --- a/src/test/java/de/spring/webservices/tests/ExampleEndPointIntegrationTest.java +++ b/src/test/java/de/spring/webservices/tests/ExampleEndPointIntegrationTest.java @@ -1,19 +1,19 @@ package de.spring.webservices.tests; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import static org.springframework.ws.test.server.RequestCreators.withPayload; +import static org.springframework.ws.test.server.ResponseMatchers.payload; import javax.xml.transform.Source; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.test.server.MockWebServiceClient; import org.springframework.xml.transform.StringSource; -import static org.springframework.ws.test.server.RequestCreators.*; -import static org.springframework.ws.test.server.ResponseMatchers.*; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring-configuration.xml") @@ -21,24 +21,25 @@ public class ExampleEndPointIntegrationTest { @Autowired private ApplicationContext applicationContext; - + private MockWebServiceClient mockClient; @Before public void createClient() { - mockClient = MockWebServiceClient.createClient(applicationContext); + mockClient = MockWebServiceClient.createClient(applicationContext); } @Test public void exampleEndpoint() throws Exception { - Source requestPayload = new StringSource( - "" + - "Houston" + - ""); - Source responsePayload = new StringSource( - "" + - " SNAKE EYES AND Houston" + - ""); - mockClient.sendRequest(withPayload(requestPayload)).andExpect(payload(responsePayload)); + final Source requestPayload = new StringSource( + "" + + "SCARLETT" + + ""); + final Source responsePayload = new StringSource( + "" + + "SNAKE EYES AND SCARLETT" + + ""); + mockClient.sendRequest(withPayload(requestPayload)).andExpect( + payload(responsePayload)); } } -- 2.1.4