diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-16 11:09:36 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-16 11:24:19 -0400 |
commit | 6b4f9b69bc4acec28da8ef50b8f234d0182f0d78 (patch) | |
tree | 877cc134b10d08393f0868a7dae7d5f604e49a5b /applications/guard/src/main/java/org | |
parent | ec20e47d350e16e1bf52f0396b777063b23770c7 (diff) |
Missing support for PolicySetType
Adds support for PolicySetType specifically for Native policies. When/If
the other applications change to support they can easily do so.
Adding some more code coverage for Native application and translator.
Issue-ID: POLICY-2433
Change-Id: I463ca9f04928d759624a2176598b463057d386bd
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/guard/src/main/java/org')
2 files changed, 6 insertions, 6 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java index f1006c6d..2c7ad587 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java @@ -39,9 +39,6 @@ import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; - -import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; - import org.apache.commons.io.IOUtils; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; @@ -63,7 +60,7 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator { } @Override - public PolicyType convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { + public Object convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { LOGGER.debug("Using CoordinationGuardTranslator.convertPolicy"); // // Policy name should be at the root @@ -88,7 +85,7 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator { // Scan the string and convert to PoilcyType // try (InputStream is = new ByteArrayInputStream(xacmlStr.getBytes(StandardCharsets.UTF_8))) { - return (PolicyType) XACMLPolicyScanner.readPolicy(is); + return XACMLPolicyScanner.readPolicy(is); } catch (IOException e) { throw new ToscaPolicyConversionException("Failed to read policy", e); } diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java index fd46a988..1e4333ea 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java @@ -96,7 +96,8 @@ public class GuardTranslator implements ToscaPolicyTranslator { /** * Convert the policy. */ - public PolicyType convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { + @Override + public Object convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { // // Policy name should be at the root // @@ -140,6 +141,7 @@ public class GuardTranslator implements ToscaPolicyTranslator { /** * Convert Request. */ + @Override public Request convertRequest(DecisionRequest request) throws ToscaPolicyConversionException { LOGGER.info("Converting Request {}", request); try { @@ -152,6 +154,7 @@ public class GuardTranslator implements ToscaPolicyTranslator { /** * Convert response. */ + @Override public DecisionResponse convertResponse(Response xacmlResponse) { LOGGER.info("Converting Response {}", xacmlResponse); DecisionResponse decisionResponse = new DecisionResponse(); |