aboutsummaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'feature-lifecycle/src/test')
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java31
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java2
2 files changed, 20 insertions, 13 deletions
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java
index df9e5eed..0ad776cc 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021-2022 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,6 +30,7 @@ import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import org.junit.AfterClass;
import org.junit.Before;
@@ -259,17 +260,23 @@ public class LifecycleFsmTest {
fsm.deployedPolicyAction(opPolicy);
fsm.deployedPolicyAction(controllerPolicy);
- assertEquals(List.of(opPolicy, controllerPolicy), fsm.getActivePolicies());
- assertEquals(List.of(opPolicy, controllerPolicy), fsm.mergePolicies(List.of(), List.of()));
- assertEquals(List.of(opPolicy), fsm.mergePolicies(List.of(), List.of(controllerPolicy.getIdentifier())));
-
- assertEquals(List.of(controllerPolicy, op2Policy, valPolicy, opPolicy, unvalPolicy),
- fsm.mergePolicies(List.of(op2Policy, valPolicy, unvalPolicy), List.of()));
- assertEquals(List.of(controllerPolicy, op2Policy, valPolicy, opPolicy, unvalPolicy),
- fsm.mergePolicies(List.of(controllerPolicy, opPolicy, op2Policy, valPolicy, unvalPolicy), List.of()));
- assertEquals(List.of(op2Policy, valPolicy, unvalPolicy),
- fsm.mergePolicies(List.of(op2Policy, valPolicy, unvalPolicy),
- List.of(controllerPolicy.getIdentifier(), opPolicy.getIdentifier())));
+ assertEquals(Set.of(opPolicy, controllerPolicy), toSet(fsm.getActivePolicies()));
+ assertEquals(Set.of(opPolicy, controllerPolicy), toSet(fsm.mergePolicies(List.of(), List.of())));
+ assertEquals(Set.of(opPolicy), toSet(fsm.mergePolicies(List.of(), List.of(controllerPolicy.getIdentifier()))));
+
+ assertEquals(Set.of(controllerPolicy, op2Policy, valPolicy, opPolicy, unvalPolicy),
+ toSet(fsm.mergePolicies(List.of(op2Policy, valPolicy, unvalPolicy), List.of())));
+ assertEquals(Set.of(controllerPolicy, op2Policy, valPolicy, opPolicy, unvalPolicy),
+ toSet(fsm.mergePolicies(List.of(controllerPolicy, opPolicy, op2Policy, valPolicy, unvalPolicy),
+ List.of())));
+ assertEquals(Set.of(op2Policy, valPolicy, unvalPolicy),
+ toSet(fsm.mergePolicies(List.of(op2Policy, valPolicy, unvalPolicy),
+ List.of(controllerPolicy.getIdentifier(), opPolicy.getIdentifier()))));
+ }
+
+ private Set<ToscaPolicy> toSet(List<ToscaPolicy> policies) {
+ return Set.copyOf(policies);
+
}
@Test
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
index cb2d5add..b8139e6e 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
@@ -254,7 +254,7 @@ public class RestLifecycleManagerTest {
ToscaPolicy opPolicy = getExamplesPolicy(VCPE_OPERATIONAL_DROOLS_POLICY_JSON, OP_POLICY_NAME_VCPE);
opPolicy.getProperties().put("controllerName", "lifecycle");
if (StringUtils.isBlank(opPolicy.getName())) {
- opPolicy.setName(opPolicy.getMetadata().get("policy-id"));
+ opPolicy.setName("" + opPolicy.getMetadata().get("policy-id"));
}
testNotNativePolicy(opPolicy);