diff options
author | liamfallon <liam.fallon@est.tech> | 2020-03-18 11:47:20 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-03-18 11:47:23 +0000 |
commit | f98830a4ba01188538ca0b001143f7b573ecde77 (patch) | |
tree | e1b2239a4963a55185ae4168d5df187fe4c0d2f5 /models-provider | |
parent | f116f388adff2971f802035ca96415032b5fc5fd (diff) |
Return latest entity on null versions
This review amends the behaviour of "get" operations on entities to
always return the latest version of an entity when the version of the
search key is the null key (value of 0.0.0).
Issue-ID: POLICY-2377
Change-Id: I4f7c12637c90bc1a83ce2ba5ef40e15b461a7d51
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider')
-rw-r--r-- | models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java index 35ec95b45..2f36f9a3c 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java @@ -20,7 +20,7 @@ package org.onap.policy.models.provider.revisionhierarchy; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.assertThatCode; import java.util.Base64; @@ -28,7 +28,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.common.utils.coder.YamlJsonTranslator; import org.onap.policy.common.utils.resources.TextFileUtils; -import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderFactory; import org.onap.policy.models.provider.PolicyModelsProviderParameters; @@ -49,7 +48,7 @@ public class HierarchyFetchTest { } @Test - public void testInitAndClose() throws Exception { + public void testMultipleVersions() throws Exception { PolicyModelsProvider databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters); @@ -58,9 +57,9 @@ public class HierarchyFetchTest { .getTextFileAsString("src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml"), ToscaServiceTemplate.class); - assertThatThrownBy(() -> { + assertThatCode(() -> { databaseProvider.createPolicies(serviceTemplate); - }).isInstanceOf(PfModelRuntimeException.class); + }).doesNotThrowAnyException(); databaseProvider.close(); } |