aboutsummaryrefslogtreecommitdiffstats
path: root/core/core-protocols/src/test
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-06-01 11:51:36 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-06-04 10:50:44 +0100
commit37d6fd9069eb30d88c4ad80b5f35099ed173cc13 (patch)
tree0f30a71577644047feee43bd8857dc5a82a51c87 /core/core-protocols/src/test
parent5722440b2eb8ff1923dda9d4d856f0adc1ac8e6f (diff)
Adding apex core module to apex-pdp
Change-Id: I4bfe1df3e44fe62ff6789e813e59836e267ab3b2 Issue-ID: POLICY-858 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'core/core-protocols/src/test')
-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
-rw-r--r--core/core-protocols/src/test/resources/logback-test.xml70
5 files changed, 309 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"));
+ }
+}
diff --git a/core/core-protocols/src/test/resources/logback-test.xml b/core/core-protocols/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..034511335
--- /dev/null
+++ b/core/core-protocols/src/test/resources/logback-test.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+-->
+
+<configuration>
+
+ <contextName>Apex</contextName>
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
+
+ <!-- USE FOR STD OUT ONLY -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger name="org.infinispan" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>${LOG_DIR}/apex.log</file>
+ <encoder>
+ <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+ %logger{26} - %msg %n %ex{full}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
+ <file>${LOG_DIR}/apex_ctxt.log</file>
+ <encoder>
+ <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+ %logger{26} - %msg %n %ex{full}</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <appender-ref ref="CTXT_FILE" />
+ </logger>
+
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+</configuration>