Update Data Router to support API V1 65/65865/7
authorPhillip Leigh <phillip.leigh@amdocs.com>
Tue, 11 Sep 2018 15:02:53 +0000 (11:02 -0400)
committerPhillip Leigh <phillip.leigh@amdocs.com>
Thu, 13 Sep 2018 17:59:44 +0000 (13:59 -0400)
Issue-ID: LOG-428
Change-Id: I6cf971539880f19ffb3e0e9cee5535d34c7b71df
Signed-off-by: Phillip Leigh <phillip.leigh@amdocs.com>
pom.xml
src/main/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntity.java
src/test/java/org/onap/aai/datarouter/entity/POAServiceInstanceEntityTest.java

diff --git a/pom.xml b/pom.xml
index 3249966..546e378 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<!--
+<!--
 ============LICENSE_START=======================================================
 org.onap.aai
 ================================================================================
@@ -237,6 +237,72 @@ limitations under the License.
    <build>
       <finalName>${project.artifactId}</finalName>
       <plugins>
+        <!-- jacoco-maven-plugin provides the basic report creation during unit testing, such as code-coverage, sonar, etc. -->
+         <plugin>
+            <groupId>org.jacoco</groupId>
+            <artifactId>jacoco-maven-plugin</artifactId>
+            <executions>
+               <!-- Prepares the property pointing to the JaCoCo runtime agent which
+                    is passed as VM argument when Maven the Surefire plugin is executed. -->
+               <execution>
+                  <id>pre-unit-test</id>
+                  <goals>
+                     <goal>prepare-agent</goal>
+                  </goals>
+                  <configuration>
+                     <!-- Sets the path to the file which contains the execution data. -->
+                     <destFile>${sonar.jacoco.reportPath}</destFile>
+                     <propertyName>surefireArgLine</propertyName>
+                  </configuration>
+               </execution>
+               <!-- Ensures that the code coverage report for unit tests is created
+                    after unit tests have been run. -->
+               <execution>
+                  <id>post-unit-test</id>
+                  <phase>test</phase>
+                  <goals>
+                     <goal>report</goal>
+                  </goals>
+                  <configuration>
+                     <!-- Sets the path to the file which contains the execution data. -->
+                     <dataFile>${sonar.jacoco.reportPath}</dataFile>
+                     <!-- Sets the output directory for the code coverage report. -->
+                     <outputDirectory>${jacoco.path}</outputDirectory>
+                  </configuration>
+               </execution>
+               <!-- Prepares the property pointing to the JaCoCo runtime agent which
+                    is passed as VM argument when Maven the Failsafe plugin is executed. -->
+               <execution>
+                  <id>pre-integration-test</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                     <goal>prepare-agent</goal>
+                  </goals>
+                  <configuration>
+                     <!-- Sets the path to the file which contains the execution data. -->
+                     <destFile>${sonar.jacoco.itReportPath}</destFile>
+                     <!-- Sets the name of the property containing the settings for JaCoCo
+                          runtime agent. -->
+                     <propertyName>failsafeArgLine</propertyName>
+                  </configuration>
+               </execution>
+               <!-- Ensures that the code coverage report for integration tests after
+                    integration tests have been run. -->
+               <execution>
+                  <id>post-integration-test</id>
+                  <phase>post-integration-test</phase>
+                  <goals>
+                     <goal>report</goal>
+                  </goals>
+                  <configuration>
+                     <!-- Sets the path to the file which contains the execution data. -->
+                     <dataFile>${sonar.jacoco.itReportPath}/</dataFile>
+                     <!-- Sets the output directory for the code coverage report. -->
+                     <outputDirectory>${jacoco.itPath}</outputDirectory>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
          <!-- Checkstyle plugin - used to report on compliance with -->
          <!-- the Google style guide. -->
          <plugin>
index 419db87..810255c 100644 (file)
@@ -36,20 +36,16 @@ import org.onap.aai.datarouter.service.AuditService;
 public class POAServiceInstanceEntity\r
 {\r
     private static final String ATTR_SERVICE_INST_ID = "serviceInstanceId";\r
-    private static final String ATTR_SERVICE_TYPE = "serviceType";\r
     private static final String ATTR_MODEL_VERSION_ID = "modelVersionId";\r
     private static final String ATTR_MODEL_INVARIANT_ID = "modelInvariantId";\r
-    private static final String ATTR_CUSTOMER_ID = "customerId";\r
 \r
     private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();\r
 \r
     private String xFromAppId;\r
     private String xTransactionId;\r
     private String serviceInstanceId;\r
-    private String serviceType;\r
     private String modelVersionId;\r
     private String modelInvariantId;\r
-    private String customerId;\r
 \r
     private static Logger logger = LoggerFactory.getInstance().getLogger(POAServiceInstanceEntity.class.getName());\r
 \r
@@ -78,14 +74,6 @@ public class POAServiceInstanceEntity
         this.serviceInstanceId = serviceInstanceId;\r
     }\r
 \r
-    public String getServiceType() {\r
-        return serviceType;\r
-    }\r
-\r
-    public void setServiceType(String serviceType) {\r
-        this.serviceType = serviceType;\r
-    }\r
-\r
     public String getModelVersionId() {\r
         return modelVersionId;\r
     }\r
@@ -102,15 +90,6 @@ public class POAServiceInstanceEntity
         this.modelInvariantId = modelInvariantId;\r
     }\r
 \r
-    public String getCustomerId() {\r
-        return customerId;\r
-    }\r
-\r
-    public void setCustomerId(String customerId) {\r
-        this.customerId = customerId;\r
-    }\r
-\r
-\r
     public String toJson() {\r
         return gson.toJson(this);\r
     }\r
@@ -142,11 +121,6 @@ public class POAServiceInstanceEntity
             throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);\r
         }\r
 \r
-        if(serviceType == null || serviceType.isEmpty()) {\r
-            String error = "Missing attribute: " + ATTR_SERVICE_TYPE;\r
-            throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);\r
-        }\r
-\r
         if(modelVersionId == null || modelVersionId.isEmpty()) {\r
             String error = "Missing attribute: " + ATTR_MODEL_VERSION_ID;\r
             throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);\r
@@ -157,17 +131,13 @@ public class POAServiceInstanceEntity
             throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);\r
         }\r
 \r
-        if(customerId == null || customerId.isEmpty()) {\r
-            String error = "Missing attribute: " + ATTR_CUSTOMER_ID;\r
-            throw new POAAuditException(error, Status.BAD_REQUEST, DataRouterMsgs.BAD_REST_REQUEST, error);\r
-        }\r
     }\r
 \r
 \r
     @Override\r
     public String toString() {\r
         return "ServiceInstance [xFromAppId=" + xFromAppId + ", xTransactionId=" + xTransactionId\r
-                + ", serviceInstanceId=" + serviceInstanceId + ", serviceType=" + serviceType + ", modelVersionId="\r
-                + modelVersionId + ", modelInvariantId=" + modelInvariantId + ", customerId=" + customerId + "]";\r
+                + ", serviceInstanceId=" + serviceInstanceId + ", modelVersionId="\r
+                + modelVersionId + ", modelInvariantId=" + modelInvariantId + "]";\r
     }\r
 }\r
index 1f3db97..4f9142c 100644 (file)
@@ -34,8 +34,6 @@ public class POAServiceInstanceEntityTest {
         String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
         String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
         String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
         String xFromAppId ="REST-client";\r
         String xTransactionId = "aaa111cccc4444";\r
 \r
@@ -43,8 +41,6 @@ public class POAServiceInstanceEntityTest {
         svcEntity.setServiceInstanceId(svcInstanceId);\r
         svcEntity.setModelVersionId(modelVersionId);\r
         svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
         svcEntity.setxFromAppId(xFromAppId);\r
         svcEntity.setxTransactionId(xTransactionId);\r
 \r
@@ -52,8 +48,6 @@ public class POAServiceInstanceEntityTest {
         Assert.assertEquals(modelVersionId, svcEntity.getModelVersionId());\r
         Assert.assertEquals(modelInvariantId, svcEntity.getModelInvariantId());\r
 \r
-        Assert.assertEquals(customerId, svcEntity.getCustomerId());\r
-        Assert.assertEquals(serviceType, svcEntity.getServiceType());\r
         Assert.assertEquals(xFromAppId, svcEntity.getxFromAppId());\r
         Assert.assertEquals(xTransactionId, svcEntity.getxTransactionId());\r
 \r
@@ -63,15 +57,11 @@ public class POAServiceInstanceEntityTest {
     public void testNullServiceInstanceId() throws POAAuditException {\r
         String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
         String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId(null);\r
         svcEntity.setModelVersionId(modelVersionId);\r
         svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
 \r
         try  {\r
             svcEntity.validate();\r
@@ -85,15 +75,11 @@ public class POAServiceInstanceEntityTest {
     public void testEmptyServiceInstanceId() throws POAAuditException {\r
         String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
         String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId("");\r
         svcEntity.setModelVersionId(modelVersionId);\r
         svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
 \r
         try  {\r
             svcEntity.validate();\r
@@ -107,16 +93,11 @@ public class POAServiceInstanceEntityTest {
     public void testNullModelVersionId() throws POAAuditException {\r
         String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
         String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId(svcInstanceId);\r
         svcEntity.setModelVersionId(null);\r
         svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
-\r
         try  {\r
             svcEntity.validate();\r
         } catch (POAAuditException e) {\r
@@ -128,15 +109,11 @@ public class POAServiceInstanceEntityTest {
     public void testEmptyModelVersionId() throws POAAuditException {\r
         String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
         String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId(svcInstanceId);\r
         svcEntity.setModelVersionId("");\r
         svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
 \r
         try  {\r
             svcEntity.validate();\r
@@ -150,15 +127,11 @@ public class POAServiceInstanceEntityTest {
     public void testNullModelInvariantId() throws POAAuditException {\r
         String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
         String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId(svcInstanceId);\r
         svcEntity.setModelVersionId(modelVersionId);\r
         svcEntity.setModelInvariantId(null);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
 \r
         try  {\r
             svcEntity.validate();\r
@@ -172,105 +145,11 @@ public class POAServiceInstanceEntityTest {
     public void testEmptyModelInvariantId() throws POAAuditException {\r
         String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
         String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String  customerId =  "global-customer-01";\r
-        String  serviceType = "vFW";\r
 \r
         POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
         svcEntity.setServiceInstanceId(svcInstanceId);\r
         svcEntity.setModelVersionId(modelVersionId);\r
         svcEntity.setModelInvariantId("");\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(serviceType);\r
-\r
-        try  {\r
-            svcEntity.validate();\r
-        } catch (POAAuditException e) {\r
-            assertEquals(Status.BAD_REQUEST,  e.getHttpStatus());\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testNullServiceType() throws POAAuditException {\r
-        String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
-        String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-\r
-\r
-        POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
-        svcEntity.setServiceInstanceId(svcInstanceId);\r
-        svcEntity.setModelVersionId(modelVersionId);\r
-        svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType(null);\r
-\r
-        try  {\r
-            svcEntity.validate();\r
-        } catch (POAAuditException e) {\r
-            assertEquals(Status.BAD_REQUEST,  e.getHttpStatus());\r
-        }\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testEmptyServiceType() throws POAAuditException {\r
-        String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
-        String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  customerId =  "global-customer-01";\r
-\r
-\r
-        POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
-        svcEntity.setServiceInstanceId(svcInstanceId);\r
-        svcEntity.setModelVersionId(modelVersionId);\r
-        svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(customerId);\r
-        svcEntity.setServiceType("");\r
-\r
-        try  {\r
-            svcEntity.validate();\r
-        } catch (POAAuditException e) {\r
-            assertEquals(Status.BAD_REQUEST,  e.getHttpStatus());\r
-        }\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testNullCustomerId() throws POAAuditException {\r
-        String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
-        String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  serviceType = "vFW";\r
-\r
-        POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
-        svcEntity.setServiceInstanceId(svcInstanceId);\r
-        svcEntity.setModelVersionId(modelVersionId);\r
-        svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId(null);\r
-        svcEntity.setServiceType(serviceType);\r
-\r
-        try  {\r
-            svcEntity.validate();\r
-        } catch (POAAuditException e) {\r
-            assertEquals(Status.BAD_REQUEST,  e.getHttpStatus());\r
-        }\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testEmptyCustomerId() throws POAAuditException {\r
-        String svcInstanceId = "24602405-7714-4c64-81da-9e182a3eba59";\r
-        String modelVersionId = "2f836857-d399-4de3-a6f8-e4a09d3017eb";\r
-        String modelInvariantId = "8c383ba3-20c3-4196-b092-c8c007ef7ddc";\r
-        String  serviceType = "vFW";\r
-\r
-        POAServiceInstanceEntity  svcEntity= new POAServiceInstanceEntity();\r
-        svcEntity.setServiceInstanceId(svcInstanceId);\r
-        svcEntity.setModelVersionId(modelVersionId);\r
-        svcEntity.setModelInvariantId(modelInvariantId);\r
-        svcEntity.setCustomerId("");\r
-        svcEntity.setServiceType(serviceType);\r
-\r
         try  {\r
             svcEntity.validate();\r
         } catch (POAAuditException e) {\r