summaryrefslogtreecommitdiffstats
path: root/core/core-protocols/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/core-protocols/src/test/java')
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetExecutionStatusTest.java58
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetPolicyStatusTest.java58
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/ResponseTest.java65
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/UpdateModelTest.java58
4 files changed, 239 insertions, 0 deletions
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetExecutionStatusTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetExecutionStatusTest.java
new file mode 100644
index 000000000..d5cf2bcba
--- /dev/null
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetExecutionStatusTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.apex.core.protocols.engdep;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.UnknownHostException;
+
+import org.junit.Test;
+import org.onap.policy.apex.core.protocols.engdep.messages.GetEngineStatus;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class GetExecutionStatusTest.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class GetExecutionStatusTest {
+ // Logger for this class
+ private static final XLogger logger = XLoggerFactory.getXLogger(GetExecutionStatusTest.class);
+
+ GetEngineStatus message = null;
+
+ /**
+ * Test register entity.
+ *
+ * @throws UnknownHostException the unknown host exception
+ */
+ @Test
+ public void testRegisterEntity() throws UnknownHostException {
+ final AxArtifactKey targetKey = new AxArtifactKey("UpdateModelTest", "0.0.1");
+ message = new GetEngineStatus(targetKey);
+ assertNotNull(message);
+ logger.debug(message.toString());
+ assertTrue((message.toString()).contains("UpdateModelTest"));
+ }
+}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetPolicyStatusTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetPolicyStatusTest.java
new file mode 100644
index 000000000..97cc8d5b9
--- /dev/null
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/GetPolicyStatusTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.apex.core.protocols.engdep;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.UnknownHostException;
+
+import org.junit.Test;
+import org.onap.policy.apex.core.protocols.engdep.messages.GetEngineStatus;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class GetPolicyStatusTest.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class GetPolicyStatusTest {
+ // Logger for this class
+ private static final XLogger logger = XLoggerFactory.getXLogger(GetPolicyStatusTest.class);
+
+ GetEngineStatus message = null;
+
+ /**
+ * Test register entity.
+ *
+ * @throws UnknownHostException the unknown host exception
+ */
+ @Test
+ public void testRegisterEntity() throws UnknownHostException {
+ final AxArtifactKey targetKey = new AxArtifactKey("PolicyStatusTest", "0.0.1");
+ message = new GetEngineStatus(targetKey);
+ assertNotNull(message);
+ logger.debug(message.toString());
+ assertTrue((message.toString()).contains("PolicyStatusTest"));
+ }
+}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/ResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/ResponseTest.java
new file mode 100644
index 000000000..74def7cc0
--- /dev/null
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/ResponseTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.apex.core.protocols.engdep;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.net.UnknownHostException;
+
+import org.junit.Test;
+import org.onap.policy.apex.core.protocols.engdep.messages.Response;
+import org.onap.policy.apex.core.protocols.engdep.messages.UpdateModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class ResponseTest.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ResponseTest {
+ // Logger for this class
+ private static final XLogger logger = XLoggerFactory.getXLogger(ResponseTest.class);
+
+ Response message = null;
+
+ /**
+ * Test response.
+ *
+ * @throws UnknownHostException the unknown host exception
+ */
+ @Test
+ public void testResponse() throws UnknownHostException {
+ final AxArtifactKey responseKey = new AxArtifactKey("ResponseTest", "0.0.1");
+ final AxArtifactKey responseToKey = new AxArtifactKey("ResponseTestTO", "0.0.1");
+ message = new Response(responseKey, false, new UpdateModel(responseToKey));
+ logger.debug(message.toString());
+ assertTrue(message.toString().contains("ResponseTest"));
+ assertFalse(message.isSuccessful());
+
+ message = new Response(responseKey, true, new UpdateModel(responseToKey));
+ logger.debug(message.toString());
+ assertTrue(message.toString().contains("ResponseTest"));
+ assertTrue(message.isSuccessful());
+ }
+}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/UpdateModelTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/UpdateModelTest.java
new file mode 100644
index 000000000..ca919c389
--- /dev/null
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/UpdateModelTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.apex.core.protocols.engdep;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.UnknownHostException;
+
+import org.junit.Test;
+import org.onap.policy.apex.core.protocols.engdep.messages.UpdateModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class UpdateModelTest.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class UpdateModelTest {
+ // Logger for this class
+ private static final XLogger logger = XLoggerFactory.getXLogger(UpdateModelTest.class);
+
+ UpdateModel message = null;
+
+ /**
+ * Test register entity.
+ *
+ * @throws UnknownHostException the unknown host exception
+ */
+ @Test
+ public void testRegisterEntity() throws UnknownHostException {
+ final AxArtifactKey targetKey = new AxArtifactKey("UpdateModelTest", "0.0.1");
+ message = new UpdateModel(targetKey, new String("Placeholder for Apex model XML"), false, false);
+ assertNotNull(message);
+ logger.debug(message.toString());
+ assertTrue((message.toString()).contains("Placeholder for Apex model XML"));
+ }
+}