Fix sonars and target dir 83/118083/3
authorPamela Dragosh <pdragosh@research.att.com>
Thu, 18 Feb 2021 21:15:26 +0000 (15:15 -0600)
committerPamela Dragosh <pdragosh@research.att.com>
Thu, 18 Feb 2021 21:23:48 +0000 (15:23 -0600)
Fix a couple of sonars introduced by the PdpType review.

Also creation of a target directory below the xacml-pdp directory.

Issue-ID: POLICY-3071
Change-Id: I9fe325d0a75970fbe3d42be36906013c1fc2ecb9
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
applications/pom.xml
main/pom.xml
main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterHandler.java
pom.xml

index ced2221..0bb48c4 100644 (file)
@@ -2,14 +2,14 @@
   ============LICENSE_START=======================================================
   ONAP
   ================================================================================
-  Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+  Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@
   <artifactId>applications</artifactId>
 
   <properties>
-    <jacoco.dataFile>${project.basedir}/../../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
+    <jacoco.dataFile>${project.basedir}/../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
   </properties>
 
   <modules>
index fea525e..08503bf 100644 (file)
@@ -2,15 +2,15 @@
   ============LICENSE_START=======================================================
   ONAP Policy Engine - XACML PDP
   ================================================================================
-  Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+  Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
   Modifications Copyright (C) 2020 Bell Canada.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     <name>${project.artifactId}</name>
     <description>The main module of Policy PDP-X that handles startup, lifecycle management, and parameters.</description>
 
+    <properties>
+        <jacoco.dataFile>${project.basedir}/../target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.onap.policy.common</groupId>
index 9c8eae0..cb8425b 100644 (file)
@@ -41,6 +41,8 @@ public class XacmlPdpParameterGroup implements ParameterGroup {
     private static final String PARAM_TOPIC_PARAMETER_GROUP = "topicParameterGroup";
     private static final String PARAM_APPLICATION_PATH = "applicationPath";
 
+    private static final String ERROR_MSG = "must be a non-blank string";
+
     @Setter
     private String name;
 
@@ -78,13 +80,13 @@ public class XacmlPdpParameterGroup implements ParameterGroup {
     public GroupValidationResult validate() {
         final GroupValidationResult validationResult = new GroupValidationResult(this);
         if (!ParameterValidationUtils.validateStringParameter(name)) {
-            validationResult.setResult("name", ValidationStatus.INVALID, "must be a non-blank string");
+            validationResult.setResult("name", ValidationStatus.INVALID, ERROR_MSG);
         }
         if (!ParameterValidationUtils.validateStringParameter(pdpGroup)) {
-            validationResult.setResult("pdpGroup", ValidationStatus.INVALID, "must be a non-blank string");
+            validationResult.setResult("pdpGroup", ValidationStatus.INVALID, ERROR_MSG);
         }
         if (!ParameterValidationUtils.validateStringParameter(pdpType)) {
-            validationResult.setResult("pdpType", ValidationStatus.INVALID, "must be a non-blank string");
+            validationResult.setResult("pdpType", ValidationStatus.INVALID, ERROR_MSG);
         }
         if (restServerParameters == null) {
             validationResult.setResult(PARAM_REST_SERVER, ValidationStatus.INVALID,
index 9a99719..1b62965 100644 (file)
@@ -135,7 +135,7 @@ public class TestXacmlPdpParameterHandler {
     }
 
     @Test
-    public void testXacmlPdpParameterGroup_InvalidName() throws PolicyXacmlPdpException {
+    public void testXacmlPdpParameterGroup_Invalid() throws PolicyXacmlPdpException {
         final String[] xacmlPdpConfigParameters = {"-c", "parameters/XacmlPdpConfigParameters_InvalidName.json"};
 
         final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
@@ -143,24 +143,15 @@ public class TestXacmlPdpParameterHandler {
 
         assertThatThrownBy(() -> new XacmlPdpParameterHandler().getParameters(arguments)).hasMessageContaining(
                 "field \"name\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string");
-    }
-
-    @Test
-    public void testXacmlPdpParameterGroup_InvalidPdpGroup() throws PolicyXacmlPdpException {
-        final String[] xacmlPdpConfigParameters = {"-c", "parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json"};
+        xacmlPdpConfigParameters[1] = "parameters/XacmlPdpConfigParameters_InvalidPdpGroup.json";
 
-        final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
         arguments.parse(xacmlPdpConfigParameters);
 
         assertThatThrownBy(() -> new XacmlPdpParameterHandler().getParameters(arguments)).hasMessageContaining(
                 "field \"pdpGroup\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string");
-    }
 
-    @Test
-    public void testXacmlPdpParameterGroup_InvalidPdpType() throws PolicyXacmlPdpException {
-        final String[] xacmlPdpConfigParameters = {"-c", "parameters/XacmlPdpConfigParameters_InvalidPdpType.json"};
+        xacmlPdpConfigParameters[1] = "parameters/XacmlPdpConfigParameters_InvalidPdpType.json";
 
-        final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
         arguments.parse(xacmlPdpConfigParameters);
 
         assertThatThrownBy(() -> new XacmlPdpParameterHandler().getParameters(arguments)).hasMessageContaining(
diff --git a/pom.xml b/pom.xml
index 9657ae2..7837739 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
   ============LICENSE_START=======================================================
   ONAP Policy Engine - XACML PDP
   ================================================================================
-  Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+  Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
   Modifications Copyright (C) 2020 Nordix Foundation.
   Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
   ================================================================================
@@ -43,6 +43,7 @@
     <properties>
         <policy.common.version>1.8.0-SNAPSHOT</policy.common.version>
         <policy.models.version>2.4.0-SNAPSHOT</policy.models.version>
+        <jacoco.dataFile>${project.basedir}/target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
     </properties>
 
     <modules>