diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-03-26 11:19:12 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-03-26 11:45:42 -0400 |
commit | d3438454879ec3f3c31ca8af2fc5903b7f8697ae (patch) | |
tree | 68abbf250babf352e9cc2b08a7cac0a04729e2b1 /applications/guard/src/test/java | |
parent | 2c847e0855b316c162c9fd31456fdf8e338a5dba (diff) |
Fix comments and add debugging
Added some fixes from previous review and some debugging
for the JUnits. The merge failed in the JUnits and I
could not see why. I think the wrong request was sent, but
I'm not sure why the JUnits woulnd't fail locally or in
the verify job. We need to do a lot of testing with these
policy translations.
Also fixed the guard policies to use correct VF Module Create
recipe.
Issue-ID: POLICY-1273
Change-Id: I813bcca92436d356c43da5613eab7ba7746a4e3d
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/guard/src/test/java')
-rw-r--r-- | applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java | 103 |
1 files changed, 54 insertions, 49 deletions
diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java index ff137e13..981afee7 100644 --- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java +++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java @@ -75,6 +75,7 @@ public class GuardPdpApplicationTest { */ @BeforeClass public static void setUp() throws Exception { + LOGGER.info("Setting up class"); // // Setup our temporary folder // @@ -108,7 +109,7 @@ public class GuardPdpApplicationTest { strDump.append(application.supportedPolicyTypes()); strDump.append(System.lineSeparator()); } - LOGGER.debug("{}", strDump); + LOGGER.info("{}", strDump); // // Tell it to initialize based on the properties file // we just built for it. @@ -118,6 +119,7 @@ public class GuardPdpApplicationTest { @Test public void test1Basics() throws CoderException, IOException { + LOGGER.info("**************** Running test1 ****************"); // // Load Single Decision Request // @@ -163,6 +165,7 @@ public class GuardPdpApplicationTest { @Test public void test2NoPolicies() { + LOGGER.info("**************** Running test2 ****************"); // // Ask for a decision // @@ -175,6 +178,7 @@ public class GuardPdpApplicationTest { @Test public void test3FrequencyLimiter() throws CoderException, FileNotFoundException, IOException { + LOGGER.info("**************** Running test3 ****************"); // // Now load the vDNS frequency limiter Policy - make sure // the pdp can support it and have it load @@ -190,36 +194,37 @@ public class GuardPdpApplicationTest { // Load the policies // service.loadPolicies(toscaObject); - // - // Ask for a decision - should get permit - // - DecisionResponse response = service.makeDecision(requestGuardPermit); - LOGGER.info("Looking for Permit Decision {}", response); - - assertThat(response).isNotNull(); - assertThat(response.getStatus()).isNotNull(); - assertThat(response.getStatus()).isEqualTo("Permit"); - // - // Dump it out as Json - // - LOGGER.info(gson.encode(response)); - // - // Ask for a decision - should get deny - // - response = service.makeDecision(requestGuardDeny2); - LOGGER.info("Looking for Deny Decision {}", response); - assertThat(response).isNotNull(); - assertThat(response.getStatus()).isNotNull(); - assertThat(response.getStatus()).isEqualTo("Deny"); - // - // Dump it out as Json - // - LOGGER.info(gson.encode(response)); } + // + // Ask for a decision - should get permit + // + DecisionResponse response = service.makeDecision(requestGuardPermit); + LOGGER.info("Looking for Permit Decision {}", response); + + assertThat(response).isNotNull(); + assertThat(response.getStatus()).isNotNull(); + assertThat(response.getStatus()).isEqualTo("Permit"); + // + // Dump it out as Json + // + LOGGER.info(gson.encode(response)); + // + // Ask for a decision - should get deny + // + response = service.makeDecision(requestGuardDeny); + LOGGER.info("Looking for Deny Decision {}", response); + assertThat(response).isNotNull(); + assertThat(response.getStatus()).isNotNull(); + assertThat(response.getStatus()).isEqualTo("Deny"); + // + // Dump it out as Json + // + LOGGER.info(gson.encode(response)); } @Test public void test4MinMax() throws CoderException, FileNotFoundException, IOException { + LOGGER.info("**************** Running test4 ****************"); // // Now load the vDNS min max Policy - make sure // the pdp can support it and have it load @@ -238,34 +243,34 @@ public class GuardPdpApplicationTest { // // Ask for a decision - should get permit // - DecisionResponse response = service.makeDecision(requestGuardPermit); - LOGGER.info("Looking for Permit Decision {}", response); - - assertThat(response).isNotNull(); - assertThat(response.getStatus()).isNotNull(); - assertThat(response.getStatus()).isEqualTo("Permit"); - // - // Dump it out as Json - // - LOGGER.info(gson.encode(response)); - // - // Ask for a decision - should get deny - // - response = service.makeDecision(requestGuardDeny); - LOGGER.info("Looking for Deny Decision {}", response); - assertThat(response).isNotNull(); - assertThat(response.getStatus()).isNotNull(); - assertThat(response.getStatus()).isEqualTo("Deny"); - // - // Dump it out as Json - // - LOGGER.info(gson.encode(response)); } + DecisionResponse response = service.makeDecision(requestGuardPermit); + LOGGER.info("Looking for Permit Decision {}", response); + + assertThat(response).isNotNull(); + assertThat(response.getStatus()).isNotNull(); + assertThat(response.getStatus()).isEqualTo("Permit"); + // + // Dump it out as Json + // + LOGGER.info(gson.encode(response)); + // + // Ask for a decision - should get deny + // + response = service.makeDecision(requestGuardDeny); + LOGGER.info("Looking for Deny Decision {}", response); + assertThat(response).isNotNull(); + assertThat(response.getStatus()).isNotNull(); + assertThat(response.getStatus()).isEqualTo("Deny"); + // + // Dump it out as Json + // + LOGGER.info(gson.encode(response)); } @Test public void test5MissingFields() throws FileNotFoundException, IOException { - LOGGER.debug("Running test5"); + LOGGER.info("**************** Running test5 ****************"); // // Most likely we would not get a policy with missing fields passed to // us from the API. But in case that happens, or we decide that some fields |