aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-02-13 05:49:21 -0800
committersebdet <sebastien.determe@intl.att.com>2020-02-14 05:11:42 -0800
commit29e3cd1afbd3202a0c16ef6a4057662942ddefa2 (patch)
treeb7811512dc4f7c08f7f2695868e3be66e57572a3 /src/test/java/org
parent728ad5ce6d3b5e3d973b6349469f96d6c3600fef (diff)
Add tests
Add tests for https and aaf Issue-ID: CLAMP-624 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ia78ed8da7e54eaeaaed4fb87f483e0aff3a4a8c5
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java10
-rw-r--r--src/test/java/org/onap/clamp/util/PassDecoderTest.java4
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");
}
}