diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-10-22 07:53:44 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-10-23 13:33:56 -0400 |
commit | 1e61676b77dd09659027b8984f050df7e8538526 (patch) | |
tree | 115053dba12b4b27a0f92de0e7648a672a66893a /POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java | |
parent | f18fbfc026de9cf02126f57844c37abfee607394 (diff) |
Consolidate PolicyRestAdapter setup
Put common code into PolicyEngineUtils that the controllers use to
populate the PolicyRestController.
Also some more sonar cleanup and formatting of XML files.
Shortened 120 line characters. Removed some trailing spaces
from comments.
Fixed up one JUnit.
Licenses.
Issue-ID: POLICY-2133
Change-Id: Id7d8ac3ab60331535f048ec0f26aeb17a099414e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java')
-rw-r--r-- | POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java index 6a5e83f4e..8e1b8be87 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java @@ -66,14 +66,12 @@ import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.ConfigurationDataEntity; import org.onap.policy.rest.jpa.OptimizationModels; import org.onap.policy.rest.jpa.PolicyEntity; -import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; /** * The class <code>CreateOptimizationControllerTest</code> contains tests for the class - * {@link <code>CreateOptimizationController</code>}* * - * All JUnits are designed to run in the local development environment where they have write + * <p/>All JUnits are designed to run in the local development environment where they have write * privileges and can execute time-sensitive tasks. */ public class CreateOptimizationControllerTest { @@ -126,7 +124,7 @@ public class CreateOptimizationControllerTest { } /** - * Run the PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter, JsonNode) method test + * Run the PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter, JsonNode) method test. */ @Test @@ -143,7 +141,7 @@ public class CreateOptimizationControllerTest { PolicyRestAdapter policyData = null; try { root = JsonLoader.fromString(jsonString); - policyData = (PolicyRestAdapter) mapper.readValue(root.get("policyData").get("policy").toString(), + policyData = mapper.readValue(root.get("policyData").get("policy").toString(), PolicyRestAdapter.class); } catch (Exception e) { logger.error("testSetDataToPolicyRestAdapter", e); @@ -158,7 +156,7 @@ public class CreateOptimizationControllerTest { /** * Run the ModelAndView getOptimizationTemplateData(HttpServletRequest, HttpServletResponse) - * method test + * method test. */ @Test @@ -201,7 +199,7 @@ public class CreateOptimizationControllerTest { /** * Run the ModelAndView getModelServiceVersionData(HttpServletRequest, HttpServletResponse) - * method test + * method test. */ @Test @@ -244,7 +242,7 @@ public class CreateOptimizationControllerTest { } /** - * Run the void prePopulateDCAEMSPolicyData(PolicyRestAdapter, PolicyEntity) method test + * Run the void prePopulateDCAEMSPolicyData(PolicyRestAdapter, PolicyEntity) method test. */ @Test @@ -267,7 +265,7 @@ public class CreateOptimizationControllerTest { try { root = JsonLoader.fromString(jsonString); - restAdapter = (PolicyRestAdapter) mapper.readValue(root.get("policyData").get("policy").toString(), + restAdapter = mapper.readValue(root.get("policyData").get("policy").toString(), PolicyRestAdapter.class); PolicyType policyType = new PolicyType(); TargetType target = new TargetType(); @@ -387,7 +385,7 @@ public class CreateOptimizationControllerTest { } /** - * Run the void SetMSModelData(HttpServletRequest, HttpServletResponse) method test + * Run the void SetMSModelData(HttpServletRequest, HttpServletResponse) method test. */ @Test @@ -429,9 +427,7 @@ public class CreateOptimizationControllerTest { } /** - * - * @ Get File Stream - * + * @ Get File Stream. */ private class MockServletInputStream extends ServletInputStream { |