aboutsummaryrefslogtreecommitdiffstats
path: root/applications/common/src/test/java/org/onap
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-22 13:06:56 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-23 09:19:24 -0400
commit5bc83b197ad010bbdf5916493d078818c2c10bcb (patch)
treec4cc4bcf283047ebb71e2f338048a1f1760be11c /applications/common/src/test/java/org/onap
parentfc07c32a4c01a2541c8061a37c3c6589c720e2b3 (diff)
Consolidate common translatable code some sonar
There is duplicate code for some common translation of policy decision responses and for scanning obligations. Removed some TODO items (left others because I want to look at them more closely). Stored System.lineSeparator into a static var so that I can remove some unnecessary ifs. There's still one left that I am not worried about. Gson as a static variable. Issue-ID: POLICY-2066 Change-Id: I9c8162d5ad1c5f884be347dd94631fa74ca76f85 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/common/src/test/java/org/onap')
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java4
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java5
2 files changed, 5 insertions, 4 deletions
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
index 318d9f9f..1e13d529 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
@@ -222,7 +222,7 @@ public class XacmlPolicyUtilsTest {
//
try (OutputStream os = new ByteArrayOutputStream()) {
XACMLPolicyWriter.writePolicyFile(os, rootPolicy);
- LOGGER.debug("New Root Policy:{}{}", System.lineSeparator(), os.toString());
+ LOGGER.debug("New Root Policy:{}{}", XacmlPolicyUtils.LINE_SEPARATOR, os);
}
//
// Just update root and PolicySet
@@ -230,7 +230,7 @@ public class XacmlPolicyUtilsTest {
XacmlPolicyUtils.addPolicySetsToXacmlRootPolicy(rootPolicy, policySet5);
try (OutputStream os = new ByteArrayOutputStream()) {
XACMLPolicyWriter.writePolicyFile(os, rootPolicy);
- LOGGER.debug("New Root Policy:{}{}", System.lineSeparator(), os.toString());
+ LOGGER.debug("New Root Policy:{}{}", XacmlPolicyUtils.LINE_SEPARATOR, os);
}
}).doesNotThrowAnyException();
}
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java
index 3323040f..07317c0a 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java
@@ -57,6 +57,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionException;
+import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -131,7 +132,7 @@ public class StdMatchableTranslatorTest {
assertEquals(1, completedJtst.getPolicyTypes().size());
testPolicyType = completedJtst.getPolicyTypes().get("onap.policies.Test");
assertNotNull(testPolicyType);
- logger.info("Test Policy Type {}{}", System.lineSeparator(), testPolicyType);
+ logger.info("Test Policy Type {}{}", XacmlPolicyUtils.LINE_SEPARATOR, testPolicyType);
}
@AfterClass
@@ -173,7 +174,7 @@ public class StdMatchableTranslatorTest {
for (ToscaPolicy policy : policies.values()) {
PolicyType translatedPolicy = translator.convertPolicy(policy);
assertNotNull(translatedPolicy);
- logger.info("Translated policy {} {}", System.lineSeparator(), translatedPolicy);
+ logger.info("Translated policy {} {}", XacmlPolicyUtils.LINE_SEPARATOR, translatedPolicy);
}
}
}