diff options
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r-- | src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java | 10 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/util/PassDecoderTest.java | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java index 912e0d604..7762111b0 100644 --- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java @@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.JsonSyntaxException; import java.io.IOException; +import java.time.Instant; import java.util.List; import javax.transaction.Transactional; @@ -56,10 +57,19 @@ public class PolicyEngineControllerTestItCase { @Transactional public void synchronizeAllPoliciesTest() throws JsonSyntaxException, IOException, InterruptedException { policyController.synchronizeAllPolicies(); + Instant firstExecution = policyController.getLastInstantExecuted(); + assertThat (firstExecution).isNotNull(); List<PolicyModel> policyModelsList = policyModelsRepository.findAll(); assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(8); assertThat(policyModelsList).contains(new PolicyModel("onap.policies.Monitoring", null, "1.0.0")); assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0")); + + // Re-do it to check that there is no issue with duplicate key + policyController.synchronizeAllPolicies(); + Instant secondExecution = policyController.getLastInstantExecuted(); + assertThat (secondExecution).isNotNull(); + + assertThat(firstExecution).isBefore(secondExecution); } } diff --git a/src/test/java/org/onap/clamp/util/PassDecoderTest.java b/src/test/java/org/onap/clamp/util/PassDecoderTest.java index 56443e31d..e5de8b0a8 100644 --- a/src/test/java/org/onap/clamp/util/PassDecoderTest.java +++ b/src/test/java/org/onap/clamp/util/PassDecoderTest.java @@ -40,13 +40,13 @@ public class PassDecoderTest { @Test public final void testDecryptionNoPassword() throws Exception { - String decodedPass = PassDecoder.decode(null, "src/test/resources/clds/aaf/org.onap.clamp.keyfile"); + String decodedPass = PassDecoder.decode(null, "classpath:clds/aaf/org.onap.clamp.keyfile"); assertNull(decodedPass); } @Test public final void testDecryption() throws Exception { - String decodedPass = PassDecoder.decode(encrypted, "src/test/resources/clds/aaf/org.onap.clamp.keyfile"); + String decodedPass = PassDecoder.decode(encrypted, "classpath:clds/aaf/org.onap.clamp.keyfile"); assertEquals(decodedPass, "China in the Spring"); } } |