Minor changes.
authorgumartinm <gustavo@gumartinm.name>
Sun, 11 Nov 2012 15:53:11 +0000 (16:53 +0100)
committergumartinm <gustavo@gumartinm.name>
Sun, 11 Nov 2012 15:53:11 +0000 (16:53 +0100)
src/main/java/de/spring/webservices/business/BusinessExample.java
src/main/java/de/spring/webservices/porttypes/PortType.java
src/test/java/de/spring/webservices/tests/ExampleEndPointIntegrationTest.java

index 9590c7d..c3852db 100644 (file)
@@ -12,7 +12,7 @@ import de.spring.webservices.porttypes.PortType;
 public class BusinessExample implements PortType.RequestResponse<ExampleResponse, ExampleRequest> {
 
     @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());
index da73454..d0e7d1f 100644 (file)
@@ -2,10 +2,17 @@ package de.spring.webservices.porttypes;
 
 /**
  * <p>
- * WSDL Port Types
+ * WSDL 1.1 Port Types
  * </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#_porttypes</a>
- *
+ * <p>
+ * 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.
+ * </p>
+ * See: <a
+ * href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#
+ * _porttypes</a>
+ * 
  */
 public interface PortType<E extends Request, T extends Response> {
 
@@ -13,38 +20,50 @@ public interface PortType<E extends Request, T extends Response> {
      * <p>
      * Request-response operation
      * </p>
-     * See: <a href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org/TR/wsdl#_request-response</a>
-     *
-     * @param <T> Describes {@link Response}
-     * @param <E> Describes {@link Request}
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org
+     * /TR/wsdl#_request-response</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
      */
     public interface RequestResponse<T, E> {
-        T requestResponse (E request);
+        T requestResponse(E request);
     }
-    
+
     /**
      * <p>
      * One-way operation
      * </p>
-     * See: <a href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl#_one-way</a>
-     *
-     * @param <T> Describes {@link Response}
-     * @param <E> Describes {@link Request}
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl
+     * #_one-way</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
      */
     public interface OneWay<E> {
-        void oneWay (E request);
+        void oneWay(E request);
     }
-    
+
     /**
      * <p>
      * Notification operation
      * </p>
-     * See: <a href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR/wsdl#_notification</a>
-     *
-     * @param <T> Describes {@link Response}
-     * @param <E> Describes {@link Request}
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR
+     * /wsdl#_notification</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
      */
     public interface Notification<T> {
-        T notification ();
+        T notification();
     }
 }
index 8ae72c2..4c102c6 100644 (file)
@@ -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(
-               "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>" +
-                       "<data>Houston</data>" +
-            "</ExampleRequest>");
-      Source responsePayload = new StringSource(
-              "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>" +
-              "     <ns2:data>SNAKE EYES AND Houston</ns2:data>" +
-              "</ns2:ExampleResponse>");
-      mockClient.sendRequest(withPayload(requestPayload)).andExpect(payload(responsePayload));
+        final Source requestPayload = new StringSource(
+                "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>" +
+                        "<data>SCARLETT</data>" +
+                "</ExampleRequest>");
+        final Source responsePayload = new StringSource(
+                "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>" +
+                        "<ns2:data>SNAKE EYES AND SCARLETT</ns2:data>" +
+                "</ns2:ExampleResponse>");
+        mockClient.sendRequest(withPayload(requestPayload)).andExpect(
+                payload(responsePayload));
     }
 }