From 7b3a0d2b5522ae4d43ef384e63d03d07438c23d9 Mon Sep 17 00:00:00 2001
From: Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>
Date: Tue, 19 Mar 2019 12:38:33 +0100
Subject: Add Unit Test Stub for App2MzsService

- Unit test makes a http request to the service
- Fix NPE by adding endpoint.setAdress("/")
- Choose better name for App2MzsService
---
 .../at/gv/egiz/moazs/App2MzsEndpointConfig.java    | 24 ----------------
 .../egiz/moazs/App2MzsPortTypeImplementation.java  | 32 ----------------------
 src/main/java/at/gv/egiz/moazs/App2MzsService.java | 32 ++++++++++++++++++++++
 .../at/gv/egiz/moazs/App2MzsServiceConfig.java     | 25 +++++++++++++++++
 4 files changed, 57 insertions(+), 56 deletions(-)
 delete mode 100644 src/main/java/at/gv/egiz/moazs/App2MzsEndpointConfig.java
 delete mode 100644 src/main/java/at/gv/egiz/moazs/App2MzsPortTypeImplementation.java
 create mode 100644 src/main/java/at/gv/egiz/moazs/App2MzsService.java
 create mode 100644 src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java

(limited to 'src/main')

diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsEndpointConfig.java b/src/main/java/at/gv/egiz/moazs/App2MzsEndpointConfig.java
deleted file mode 100644
index 2d524df..0000000
--- a/src/main/java/at/gv/egiz/moazs/App2MzsEndpointConfig.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package at.gv.egiz.moazs;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.jaxws.EndpointImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import javax.xml.ws.Endpoint;
-
-@Configuration
-public class App2MzsEndpointConfig {
-
-    @Autowired
-    private Bus bus;
-
-    @Bean
-    public Endpoint endpoint() {
-        EndpointImpl endpoint = new EndpointImpl(bus, new App2MzsPortTypeImplementation());
-        endpoint.publish();
-        return endpoint;
-    }
-
-}
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsPortTypeImplementation.java b/src/main/java/at/gv/egiz/moazs/App2MzsPortTypeImplementation.java
deleted file mode 100644
index 244cf4d..0000000
--- a/src/main/java/at/gv/egiz/moazs/App2MzsPortTypeImplementation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package at.gv.egiz.moazs;
-
-import at.gv.e_government.reference.namespace.app2mzs.App2MzsPortType;
-import at.gv.e_government.reference.namespace.moazs10.app2mzs_.DeliveryRequestType;
-import at.gv.e_government.reference.namespace.moazs10.app2mzs_.DeliveryResponseType;
-import at.gv.e_government.reference.namespace.moazs10.app2mzs_.ObjectFactory;
-import at.gv.e_government.reference.namespace.moazs10.app2mzs_.SuccessType;
-
-import javax.jws.WebParam;
-
-public class App2MzsPortTypeImplementation implements App2MzsPortType {
-
-    @Override
-    public DeliveryResponseType app2Mzs(
-            @WebParam(partName = "DeliveryRequest",
-                      name = "DeliveryRequest",
-                      targetNamespace = "http://reference.e-government.gv.at/namespace/moazs10/app2mzs#")
-                    DeliveryRequestType deliveryRequest) {
-        System.out.println("app2mzs got called");
-
-        ObjectFactory factory = new ObjectFactory();
-        DeliveryResponseType response = factory.createDeliveryResponseType();
-
-        SuccessType success = factory.createSuccessType();
-        success.setAppDeliveryID("12345");
-        success.setMZSDeliveryID("12345");
-        response.setSuccess(success);
-
-        return response;
-    }
-
-}
\ No newline at end of file
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsService.java b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
new file mode 100644
index 0000000..ccca4f5
--- /dev/null
+++ b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
@@ -0,0 +1,32 @@
+package at.gv.egiz.moazs;
+
+import at.gv.e_government.reference.namespace.app2mzs.App2MzsPortType;
+import at.gv.e_government.reference.namespace.moazs10.app2mzs_.DeliveryRequestType;
+import at.gv.e_government.reference.namespace.moazs10.app2mzs_.DeliveryResponseType;
+import at.gv.e_government.reference.namespace.moazs10.app2mzs_.ObjectFactory;
+import at.gv.e_government.reference.namespace.moazs10.app2mzs_.SuccessType;
+
+import javax.jws.WebParam;
+
+public class App2MzsService implements App2MzsPortType {
+
+    @Override
+    public DeliveryResponseType app2Mzs(
+            @WebParam(partName = "DeliveryRequest",
+                      name = "DeliveryRequest",
+                      targetNamespace = "http://reference.e-government.gv.at/namespace/moazs10/app2mzs#")
+                    DeliveryRequestType deliveryRequest) {
+        System.out.println("app2mzs got called");
+
+        ObjectFactory factory = new ObjectFactory();
+        DeliveryResponseType response = factory.createDeliveryResponseType();
+
+        SuccessType success = factory.createSuccessType();
+        success.setAppDeliveryID("12345");
+        success.setMZSDeliveryID("12345");
+        response.setSuccess(success);
+
+        return response;
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java b/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java
new file mode 100644
index 0000000..64e353d
--- /dev/null
+++ b/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java
@@ -0,0 +1,25 @@
+package at.gv.egiz.moazs;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.xml.ws.Endpoint;
+
+@Configuration
+public class App2MzsServiceConfig {
+
+    @Autowired
+    private Bus bus;
+
+    @Bean
+    public Endpoint endpoint() {
+        EndpointImpl endpoint = new EndpointImpl(bus, new App2MzsService());
+        endpoint.setAddress("/");
+        endpoint.publish();
+        return endpoint;
+    }
+
+}
-- 
cgit v1.2.3