From fe3a8ec467beae89bca9d10b8b5b39f98c81ca01 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 4 Nov 2019 16:18:08 -0500 Subject: Implement closest match algorithm Needed to add more obligations, which make it easier to scan through obligations and be able to pull information about the policy. Adding weight as an obligation for Optimization policies in order to implement "closest match" algorithm. Moved Obligation to a support class. Added JUnit code coverage on the translator classes. Split some methods up to reduce complexity via sonar. Issue-ID: POLICY-2066 Change-Id: Ibb13d2dc0a63ab2a6d585b0697a0c1d129fa8f7b Signed-off-by: Pamela Dragosh --- .../common/src/test/resources/test.policy.bad.json | 17 +++++++++++++++++ .../common/src/test/resources/test.policy.json | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 applications/common/src/test/resources/test.policy.bad.json create mode 100644 applications/common/src/test/resources/test.policy.json (limited to 'applications/common/src/test/resources') diff --git a/applications/common/src/test/resources/test.policy.bad.json b/applications/common/src/test/resources/test.policy.bad.json new file mode 100644 index 00000000..6bc06c3b --- /dev/null +++ b/applications/common/src/test/resources/test.policy.bad.json @@ -0,0 +1,17 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "Test.policy": { + "type": "onap.policies.Test", + "type_version": "1.0.0", + "version": "1.0.0", + "properties": { + "foo": "bar" + } + } + } + ] + } +} diff --git a/applications/common/src/test/resources/test.policy.json b/applications/common/src/test/resources/test.policy.json new file mode 100644 index 00000000..f1529387 --- /dev/null +++ b/applications/common/src/test/resources/test.policy.json @@ -0,0 +1,21 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "Test.policy": { + "type": "onap.policies.Test", + "type_version": "1.0.0", + "version": "1.0.0", + "metadata": { + "policy-id": "Test.policy", + "policy-version": 1 + }, + "properties": { + "foo": "bar" + } + } + } + ] + } +} -- cgit