summaryrefslogtreecommitdiffstats
path: root/models/src/test
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-10 15:46:51 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2023-01-10 15:53:20 +0000
commit9805ab974b97fe89e4c7491a282665ffb3f9feff (patch)
tree9dcd50026481e9bd1ea6e1b176fd371e49400fdd /models/src/test
parentbce4edfb6a9140a07d12470d977352d7b3a4105c (diff)
Refactor AcTypeState Update
Refactor AcTypeState Update and add AcTypeState Resolved that will used by priming/depriming. Issue-ID: POLICY-4503 Change-Id: I2dd70cd8f569f29d35709e741616079499757bfd Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/test')
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java
new file mode 100644
index 000000000..bf27c3e4f
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
+import org.onap.policy.clamp.models.acm.messages.rest.commissioning.PrimeOrder;
+
+class AcTypeStateResolverTest {
+
+ @Test
+ void testAcTypeState() {
+ var acTypeStateResolver = new AcTypeStateResolver();
+ var result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.COMMISSIONED);
+ assertThat(result).isEqualTo(PrimeOrder.PRIME);
+ result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.PRIMED);
+ assertThat(result).isEqualTo(PrimeOrder.PRIME);
+ result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.PRIMING);
+ assertThat(result).isEqualTo(PrimeOrder.NONE);
+ result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.DEPRIMING);
+ assertThat(result).isEqualTo(PrimeOrder.NONE);
+
+ result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.COMMISSIONED);
+ assertThat(result).isEqualTo(PrimeOrder.DEPRIME);
+ result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.PRIMED);
+ assertThat(result).isEqualTo(PrimeOrder.DEPRIME);
+ result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.PRIMING);
+ assertThat(result).isEqualTo(PrimeOrder.NONE);
+ result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.DEPRIMING);
+ assertThat(result).isEqualTo(PrimeOrder.NONE);
+
+ result = acTypeStateResolver.resolve(null, null);
+ assertThat(result).isEqualTo(PrimeOrder.NONE);
+ }
+}