Re-factor matchable to reduce complexity 55/103855/6
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 18 Mar 2020 11:50:22 +0000 (07:50 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Thu, 19 Mar 2020 12:03:24 +0000 (08:03 -0400)
commit3b755ec2e3d9776980236db6ba754ae6b7cc2402
treed9503508e748d9b6f516a2665461b32c66ee2ac0
parent6b4f9b69bc4acec28da8ef50b8f234d0182f0d78
Re-factor matchable to reduce complexity

This solution is much cleaner than what is in StdMatchableTranslator.
Over 90% code coverage on it - utilizes a callback to retrieve DataType
and PolicyTypes. Support for missing timestamp TOSCA type. Also can
do a better job differentiating between a property contained in the policy
vs a schema.

Changed StdMatchableTranslator to utilize these classes. And removed the
old spaghetti.

Added some JUnit coverage for ToscaPolicyTranslatorUtils.

Removed duplicate code in the XACML Native Exception classes.

Issue-ID: POLICY-2242
Change-Id: I18f898d9e65f6da28e3b27517d40f8d389de18a0
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
24 files changed:
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/ToscaPolicyTranslatorUtils.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableCallback.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyType.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableProperty.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyType.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeBase.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeBoolean.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeFloat.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeInteger.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeList.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeMap.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeString.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeTimestamp.java [new file with mode: 0644]
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/ToscaPolicyTranslatorUtilsTest.java
applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java [new file with mode: 0644]
applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java
applications/common/src/test/resources/matchable/onap.policies.Test-1.0.0.yaml
applications/common/src/test/resources/matchable/test.policies.input.tosca.yaml
applications/optimization/src/test/resources/bad-subscriber-policies.yaml
applications/optimization/src/test/resources/test-optimization-policies.yaml
main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java [new file with mode: 0644]
main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java
main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java