aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/events/src/test
diff options
context:
space:
mode:
authorHengye <yehui.wang@est.tech>2019-03-25 14:32:21 +0000
committerHengye <yehui.wang@est.tech>2019-03-25 14:32:21 +0000
commitb150aa8197e8a21ab7ad4cf1d91cfa30f56fa3df (patch)
tree60c296267f496f3b40d838294e8f80b04ceb2607 /models-interactions/model-impl/events/src/test
parent2a245ef80e39a101015efb164de53f1753fa5d47 (diff)
migrate model-impl from drools-applications
migrate controlloop/common/model-impl from drools-applicaitons to policy/models Issue-ID: POLICY-1264 Change-Id: Ibe0bb5c49a7b1344f4104b30455f52834041e187 Signed-off-by: Hengye <yehui.wang@est.tech>
Diffstat (limited to 'models-interactions/model-impl/events/src/test')
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java42
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java97
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java118
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java50
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java90
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java51
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java40
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java38
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java39
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java50
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java59
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java51
12 files changed, 725 insertions, 0 deletions
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java
new file mode 100644
index 000000000..f890cfce8
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import org.junit.Test;
+
+public class ControlLoopEventStatusTest {
+
+ @Test
+ public void test() {
+ ControlLoopEventStatus status = ControlLoopEventStatus.ABATED;
+ assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString()));
+ assertNotEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString()));
+
+ status = ControlLoopEventStatus.ONSET;
+ assertEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString()));
+ assertNotEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString()));
+ assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus("abatement"));
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java
new file mode 100644
index 000000000..feaf22ee5
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.UUID;
+import org.junit.Test;
+
+public class ControlLoopEventTest {
+
+ private class TestControlLoopEvent extends ControlLoopEvent {
+ private static final long serialVersionUID = 1L;
+
+ public TestControlLoopEvent() {
+ super();
+ }
+
+ public TestControlLoopEvent(ControlLoopEvent event) {
+ super(event);
+ }
+ }
+
+ @Test
+ public void test() {
+ ControlLoopEvent event = new TestControlLoopEvent();
+
+ assertEquals("1.0.2", event.getVersion());
+
+ event = new TestControlLoopEvent(null);
+ assertEquals("1.0.2", event.getVersion());
+
+ event.setClosedLoopControlName("name");
+ assertEquals("name", event.getClosedLoopControlName());
+
+ event.setClosedLoopEventClient("client");
+ assertEquals("client", event.getClosedLoopEventClient());
+
+ event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
+ assertEquals(ControlLoopEventStatus.ONSET, event.getClosedLoopEventStatus());
+
+ event.setFrom("from");
+ assertEquals("from", event.getFrom());
+
+ event.setPayload("payload");
+ assertEquals("payload", event.getPayload());
+
+ event.setPolicyName("policyname");
+ assertEquals("policyname", event.getPolicyName());
+
+ event.setPolicyScope("scope");
+ assertEquals("scope", event.getPolicyScope());
+
+ event.setPolicyVersion("1");
+ assertEquals("1", event.getPolicyVersion());
+
+ UUID id = UUID.randomUUID();
+ event.setRequestId(id);
+ assertEquals(id, event.getRequestId());
+
+ event.setTarget("target");
+ assertEquals("target", event.getTarget());
+
+ event.setTargetType(ControlLoopTargetType.VF);
+ assertEquals(ControlLoopTargetType.VF, event.getTargetType());
+
+ event.setVersion("foo");
+ assertEquals("foo", event.getVersion());
+
+ ControlLoopEvent event2 = new TestControlLoopEvent(event);
+ assertTrue(event2.isEventStatusValid());
+
+ event2.setClosedLoopEventStatus(null);
+ assertFalse(event2.isEventStatusValid());
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java
new file mode 100644
index 000000000..0c1070e44
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.util.Collections;
+import java.util.UUID;
+import org.junit.Test;
+import org.onap.policy.controlloop.util.Serialization;
+
+public class ControlLoopNotificationTest {
+
+ private class TestControlLoopNotification extends ControlLoopNotification {
+ private static final long serialVersionUID = 1L;
+
+ public TestControlLoopNotification() {
+ super();
+ }
+
+ public TestControlLoopNotification(ControlLoopEvent event) {
+ super(event);
+ }
+ }
+
+ @Test
+ public void test() {
+ ControlLoopNotification notification = new TestControlLoopNotification();
+
+ assertEquals("1.0.2", notification.getVersion());
+
+ notification.setClosedLoopControlName("name");
+ assertEquals("name", notification.getClosedLoopControlName());
+
+ notification.setClosedLoopEventClient("client");
+ assertEquals("client", notification.getClosedLoopEventClient());
+
+ notification.setFrom("from");
+ assertEquals("from", notification.getFrom());
+
+ notification.setHistory(Collections.emptyList());
+ assertTrue(notification.getHistory().size() == 0);
+
+ notification.setMessage("message");
+ assertEquals("message", notification.getMessage());
+
+ notification.setNotification(ControlLoopNotificationType.ACTIVE);
+ assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification());
+
+ ZonedDateTime time = ZonedDateTime.now(ZoneOffset.UTC);
+ notification.setNotificationTime(time);
+ assertEquals(time, notification.getNotificationTime());
+
+ notification.setOpsClTimer(Integer.valueOf(1000));
+ assertEquals(Integer.valueOf(1000), notification.getOpsClTimer());
+
+ notification.setPolicyName("name");
+ assertEquals("name", notification.getPolicyName());
+
+ notification.setPolicyScope("scope");
+ assertEquals("scope", notification.getPolicyScope());
+
+ notification.setPolicyVersion("1");
+ assertEquals("1", notification.getPolicyVersion());
+
+ UUID id = UUID.randomUUID();
+ notification.setRequestId(id);
+ assertEquals(id, notification.getRequestId());
+
+ notification.setTarget("target");
+ assertEquals("target", notification.getTarget());
+
+ notification.setTargetType(ControlLoopTargetType.VFC);
+ assertEquals(ControlLoopTargetType.VFC, notification.getTargetType());
+
+ VirtualControlLoopEvent event = new VirtualControlLoopEvent();
+ event.setClosedLoopControlName("controlloop");
+
+ TestControlLoopNotification notification2 = new TestControlLoopNotification(event);
+ assertEquals("controlloop", notification2.getClosedLoopControlName());
+
+ notification2.setVersion("1");
+ assertEquals("1", notification2.getVersion());
+
+ String json = Serialization.gsonPretty.toJson(notification);
+
+ TestControlLoopNotification notification3 = Serialization.gson.fromJson(json,
+ TestControlLoopNotification.class);
+
+ //
+ // There is no equals for the class - chose not to create one
+ //
+ assertEquals(notification.getRequestId(), notification3.getRequestId());
+
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java
new file mode 100644
index 000000000..a8330ba2e
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class ControlLoopNotificationTypeTest {
+
+ @Test
+ public void test() {
+
+ assertEquals(ControlLoopNotificationType.ACTIVE, ControlLoopNotificationType.toType("ACTIVE"));
+ assertEquals(ControlLoopNotificationType.REJECTED, ControlLoopNotificationType.toType("REJECTED"));
+ assertEquals(ControlLoopNotificationType.OPERATION, ControlLoopNotificationType.toType("OPERATION"));
+ assertEquals(ControlLoopNotificationType.OPERATION_SUCCESS,
+ ControlLoopNotificationType.toType("OPERATION: SUCCESS"));
+ assertEquals(ControlLoopNotificationType.OPERATION_FAILURE,
+ ControlLoopNotificationType.toType("OPERATION: FAILURE"));
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE,
+ ControlLoopNotificationType.toType("FINAL: FAILURE"));
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS,
+ ControlLoopNotificationType.toType("FINAL: SUCCESS"));
+ assertEquals(ControlLoopNotificationType.FINAL_OPENLOOP,
+ ControlLoopNotificationType.toType("FINAL: OPENLOOP"));
+
+ assertNull(ControlLoopNotificationType.toType("foo"));
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
new file mode 100644
index 000000000..eb1a351d1
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.Instant;
+import org.junit.Test;
+
+public class ControlLoopOperationTest {
+
+ @Test
+ public void test() {
+ ControlLoopOperation operation = new ControlLoopOperation();
+
+ assertEquals(operation, operation);
+ assertNotEquals(operation, new String());
+ assertNotEquals(operation, null);
+
+ assertTrue(operation.hashCode() != 0);
+ assertTrue(operation.toString().startsWith("ControlLoopOperation"));
+
+ assertNotNull(operation);
+
+ operation.setActor("actor");
+ assertEquals("actor", operation.getActor());
+
+ operation.setOperation("operation");
+ assertEquals("operation", operation.getOperation());
+
+ Instant now = Instant.now();
+ operation.setStart(now);
+ assertEquals(now, operation.getStart());
+ operation.setEnd(now);
+ assertEquals(now, operation.getEnd());
+
+ operation.setMessage("message");
+ assertEquals("message", operation.getMessage());
+
+ operation.setOutcome("outcome");
+ assertEquals("outcome", operation.getOutcome());
+
+ operation.setSubRequestId("1");
+ assertEquals("1", operation.getSubRequestId());
+
+ operation.setTarget("target");
+ assertEquals("target", operation.getTarget());
+
+ assertTrue(operation.hashCode() != 0);
+
+ ControlLoopOperation operation2 = new ControlLoopOperation(operation);
+ assertEquals(now, operation2.getEnd());
+
+ assertEquals(operation, operation2);
+
+ operation2.setActor("foo");
+ assertNotEquals(operation, operation2);
+
+ operation = new ControlLoopOperation(null);
+ assertNotNull(operation.getStart());
+
+ assertNotEquals(operation, operation2);
+
+ assertTrue(operation.toMessage().startsWith("actor="));
+ assertTrue(operation.toHistory().startsWith("actor="));
+
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java
new file mode 100644
index 000000000..46fd9de96
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
+import org.junit.Test;
+
+public class ControlLoopOperationWrapperTest {
+
+ @Test
+ public void test() {
+ ControlLoopOperationWrapper wrapper = new ControlLoopOperationWrapper();
+
+ assertNotNull(wrapper);
+
+ ControlLoopOperation operation = new ControlLoopOperation();
+ wrapper.setOperation(operation);
+ UUID id = UUID.randomUUID();
+ wrapper.setRequestId(id);
+
+ ControlLoopOperationWrapper wrapper2 = new ControlLoopOperationWrapper(wrapper.getRequestId(),
+ wrapper.getOperation());
+
+ assertEquals(operation, wrapper2.getOperation());
+ assertEquals(id, wrapper2.getRequestId());
+
+
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java
new file mode 100644
index 000000000..d1412fe49
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class ControlLoopTargetTypeTest {
+
+ @Test
+ public void test() {
+ assertEquals(ControlLoopTargetType.VM, ControlLoopTargetType.toType("VM"));
+ assertEquals(ControlLoopTargetType.VF, ControlLoopTargetType.toType("VF"));
+ assertEquals(ControlLoopTargetType.VFC, ControlLoopTargetType.toType("VFC"));
+ assertEquals(ControlLoopTargetType.VNF, ControlLoopTargetType.toType("VNF"));
+
+ assertNull(ControlLoopTargetType.toType("foo"));
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java
new file mode 100644
index 000000000..80f043e6b
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class PhysicalControlLoopEventTest {
+
+ @Test
+ public void test() {
+ PhysicalControlLoopEvent event = new PhysicalControlLoopEvent();
+ assertNotNull(event);
+
+ PhysicalControlLoopEvent event2 = new PhysicalControlLoopEvent(event);
+ assertNotNull(event2);
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java
new file mode 100644
index 000000000..f52bbc9bf
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class PhysicalControlLoopNotificationTest {
+
+ @Test
+ public void test() {
+ PhysicalControlLoopNotification notification = new PhysicalControlLoopNotification();
+ assertNotNull(notification);
+
+ PhysicalControlLoopNotification notification2 = new PhysicalControlLoopNotification(
+ new PhysicalControlLoopEvent());
+ assertNotNull(notification2);
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java
new file mode 100644
index 000000000..2acd3038c
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.time.Instant;
+import org.junit.Test;
+
+public class VirtualControlLoopEventTest {
+
+ @Test
+ public void test() {
+ VirtualControlLoopEvent event = new VirtualControlLoopEvent();
+
+ assertNotNull(event);
+ assertNotNull(event.getAai());
+
+ Instant now = Instant.now();
+ event.setClosedLoopAlarmStart(now);
+ event.setClosedLoopAlarmEnd(now);
+
+ VirtualControlLoopEvent event2 = new VirtualControlLoopEvent(event);
+ assertEquals(now, event2.getClosedLoopAlarmStart());
+
+ event = new VirtualControlLoopEvent(null);
+ assertNull(event.getClosedLoopAlarmStart());
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java
new file mode 100644
index 000000000..2ab622230
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.Instant;
+import java.util.Collections;
+import org.junit.Test;
+
+public class VirtualControlLoopNotificationTest {
+
+ @Test
+ public void test() {
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification();
+ assertNotNull(notification);
+
+ notification.setAai(Collections.emptyMap());
+ assertTrue(notification.getAai().isEmpty());
+
+ Instant now = Instant.now();
+ notification.setClosedLoopAlarmStart(now);
+
+ notification.setClosedLoopAlarmEnd(now);
+
+ VirtualControlLoopEvent event = new VirtualControlLoopEvent();
+
+ Instant later = Instant.now();
+ event.setAai(Collections.emptyMap());
+ event.setClosedLoopAlarmStart(later);
+ event.setClosedLoopAlarmEnd(later);
+
+ notification = new VirtualControlLoopNotification(event);
+ assertEquals(later, notification.getClosedLoopAlarmStart());
+ assertEquals(later, notification.getClosedLoopAlarmEnd());
+
+ }
+}
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java
new file mode 100644
index 000000000..bf23e5706
--- /dev/null
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * controlloop
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.params;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ControlLoopParamsTest {
+
+ @Test
+ public void test() {
+ ControlLoopParams params = new ControlLoopParams();
+ assertNotNull(params);
+
+ params.setClosedLoopControlName("name");
+ params.setControlLoopYaml("yaml");
+ params.setPolicyName("name");
+ params.setPolicyScope("scope");
+ params.setPolicyVersion("1");
+
+ ControlLoopParams params2 = new ControlLoopParams(params);
+
+ assertTrue(params2.getClosedLoopControlName().equals("name"));
+ assertTrue(params2.getControlLoopYaml().equals("yaml"));
+ assertTrue(params2.getPolicyName().equals("name"));
+ assertTrue(params2.getPolicyScope().equals("scope"));
+ assertTrue(params2.getPolicyVersion().equals("1"));
+
+ }
+}