aboutsummaryrefslogtreecommitdiffstats
path: root/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service
diff options
context:
space:
mode:
Diffstat (limited to 'dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service')
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java151
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessorTest.java68
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContextTest.java79
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessorTest.java96
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfoTest.java53
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestEarlyTerminatingProcessor.java39
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor1.java41
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor2.java41
-rw-r--r--dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestProcessorContext.java84
9 files changed, 652 insertions, 0 deletions
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java
new file mode 100644
index 0000000..3a0d8bd
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java
@@ -0,0 +1,151 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.filter;
+
+import com.google.common.collect.ImmutableList;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
+import org.openecomp.dcae.apod.analytics.common.service.processor.GenericMessageChainProcessor;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Rajiv Singla . Creation Date: 2/10/2017.
+ */
+public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest {
+
+ private String jsonMessage;
+
+ @Before
+ public void before() throws Exception {
+ jsonMessage = fromStream(CEF_MESSAGE_FILE_PATH);
+
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenAllFiltersPassed() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain(jsonMessage,
+ "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, true, true, 2);
+
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenJsonPathValueIsANumber() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain(jsonMessage,
+ "domainFilter", "$.event.commonEventHeader.sequence", "375",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, true, true, 2);
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenOneFilterDoesNotMatch() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain(jsonMessage,
+ "domainFilter", "$.event.commonEventHeader.domain", "xxxxxxxxxxx",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, false, false, 1);
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenJsonPathDoesNotExist() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain(jsonMessage,
+ "domainFilter", "$.event.commonEventHeader.xxxxxxx", "measurementsForVfScaling",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, false, false, 1);
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenIncomingMessageIsBlank() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain("",
+ "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions("", finalMessageProcessorContext, false, null, 1);
+
+ }
+
+ @Test
+ public void testJsonMessageFilterWhenIncomingMessageIsNotValidJson() throws Exception {
+
+ final JsonMessageFilterProcessorContext finalMessageProcessorContext =
+ processJsonMessageFilterChain("invalidJson",
+ "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling",
+ "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall");
+
+ assertJsonMessageAssertions("invalidJson", finalMessageProcessorContext, false, null, 1);
+
+ }
+
+
+ private static void assertJsonMessageAssertions(
+ final String jsonMessage, final JsonMessageFilterProcessorContext finalMessageProcessorContext,
+ final Boolean canProcessingContinueFlag, final Boolean matchedFlag,
+ final int messageProcessorCount) throws Exception {
+
+ assertJson(jsonMessage, finalMessageProcessorContext.getMessage());
+ Assert.assertEquals(canProcessingContinueFlag, finalMessageProcessorContext.canProcessingContinue());
+ assertEquals(matchedFlag, finalMessageProcessorContext.getMatched());
+ Assert.assertEquals(finalMessageProcessorContext.getMessageProcessors().size(), messageProcessorCount);
+
+ }
+
+
+ private static JsonMessageFilterProcessorContext processJsonMessageFilterChain(
+ final String jsonMessage,
+ final String firstFilterName, final String firstFilterPath, final String firstFilterValue,
+ final String secondFilterName, final String secondFilterPath, final String secondFilterValue) {
+
+ // create processors
+ final GenericJsonMessageFilter firstFilter = new GenericJsonMessageFilter(firstFilterName, firstFilterPath,
+ firstFilterValue);
+ final GenericJsonMessageFilter secondFilter = new GenericJsonMessageFilter(secondFilterName,
+ secondFilterPath, secondFilterValue);
+
+ // create initial processor context containing the json message that need to be processed
+ final JsonMessageFilterProcessorContext initialProcessorContext =
+ new JsonMessageFilterProcessorContext(jsonMessage);
+
+ // create a generic message chain processor and feed it list of processors and initialProcessor context
+ final GenericMessageChainProcessor<JsonMessageFilterProcessorContext> messageChainProcessor =
+ new GenericMessageChainProcessor<>(ImmutableList.of(firstFilter, secondFilter),
+ initialProcessorContext);
+
+ // process the generic message chain
+ return messageChainProcessor.processChain();
+ }
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessorTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessorTest.java
new file mode 100644
index 0000000..6e8e146
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessorTest.java
@@ -0,0 +1,68 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import org.junit.Test;
+import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
+import org.openecomp.dcae.apod.analytics.common.exception.MessageProcessingException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Rajiv Singla . Creation Date: 12/12/2016.
+ */
+public class AbstractMessageProcessorTest extends BaseAnalyticsCommonUnitTest {
+
+
+ @Test
+ public void testPreProcessorWhenProcessingContextFlagIsTrue() throws Exception {
+ TestMessageProcessor1 messageProcessor1 = new TestMessageProcessor1();
+ final TestProcessorContext processorContext =
+ new TestProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ final TestProcessorContext testProcessorContext = messageProcessor1.preProcessor(processorContext);
+ assertThat("Processing flag must be true",
+ testProcessorContext.canProcessingContinue(), is(true));
+ }
+
+ @Test(expected = MessageProcessingException.class)
+ public void testPreProcessorWhenProcessingContextFlagIsFalse() throws Exception {
+ TestMessageProcessor1 messageProcessor1 = new TestMessageProcessor1();
+ final TestProcessorContext testProcessorContext =
+ new TestProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, false);
+ messageProcessor1.preProcessor(testProcessorContext);
+ }
+
+ @Test
+ public void testPostProcessorWhenProcessingStateIsNotFinishedSuccessfully() throws Exception {
+ TestMessageProcessor1 messageProcessor1 = new TestMessageProcessor1();
+ final ProcessingState processingState = messageProcessor1.getProcessingState();
+ assertTrue("Processing state is not processing finished successfully",
+ processingState != ProcessingState.PROCESSING_FINISHED_SUCCESSFULLY);
+ final TestProcessorContext processorContext =
+ new TestProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ final TestProcessorContext testProcessorContext = messageProcessor1.postProcessor(processorContext);
+ assertThat("Processing flag must be false",
+ testProcessorContext.canProcessingContinue(), is(false));
+ }
+
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContextTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContextTest.java
new file mode 100644
index 0000000..6a4b500
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContextTest.java
@@ -0,0 +1,79 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import org.junit.Test;
+import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Rajiv Singla . Creation Date: 12/12/2016.
+ */
+public class AbstractProcessorContextTest extends BaseAnalyticsCommonUnitTest {
+
+ class TestAbstractMessageProcessorContext extends AbstractProcessorContext {
+
+ public TestAbstractMessageProcessorContext(String message, boolean canProcessingContinue) {
+ super(message, canProcessingContinue);
+ }
+ }
+
+
+ @Test
+ public void testGetMessage() throws Exception {
+ TestAbstractMessageProcessorContext testProcessorContext =
+ new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ final String message = testProcessorContext.getMessage();
+ assertThat("Message Processor message must match", message, is(TEST_MESSAGE_PROCESSOR_MESSAGE));
+ }
+
+ @Test
+ public void testCanProcessingContinue() throws Exception {
+ TestAbstractMessageProcessorContext testProcessorContext =
+ new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ final boolean canProcessingContinue = testProcessorContext.canProcessingContinue();
+ assertThat("Message Can Processing flag must be true", canProcessingContinue, is(true));
+ }
+
+ @Test
+ public void testSetProcessingContinueFlag() throws Exception {
+ TestAbstractMessageProcessorContext testProcessorContext =
+ new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ testProcessorContext.setProcessingContinueFlag(false);
+ assertThat("Message Can processing flag must be false",
+ testProcessorContext.canProcessingContinue(), is(false));
+
+ }
+
+ @Test
+ public void testGetMessageProcessors() throws Exception {
+ TestAbstractMessageProcessorContext testProcessorContext =
+ new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
+ final List<? super MessageProcessor<? extends ProcessorContext>> messageProcessors =
+ testProcessorContext.getMessageProcessors();
+ assertThat("Message processor processing message must match", messageProcessors.size(), is(0));
+ }
+
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessorTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessorTest.java
new file mode 100644
index 0000000..2578406
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessorTest.java
@@ -0,0 +1,96 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import com.google.common.collect.ImmutableList;
+import org.junit.Test;
+import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
+import org.openecomp.dcae.apod.analytics.common.exception.MessageProcessingException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+
+
+/**
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class GenericMessageChainProcessorTest extends BaseAnalyticsCommonUnitTest {
+
+
+ @Test
+ public void testProcessChainWhenProcessChainHasNoEarlyTermination() throws Exception {
+
+ final TestMessageProcessor1 testMessageProcessor1 = getTestMessageProcessor1();
+ final TestMessageProcessor2 testMessageProcessor2 = getTestMessageProcessor2();
+ final ImmutableList<? extends MessageProcessor<TestProcessorContext>> testMessageChain =
+ ImmutableList.of(testMessageProcessor1, testMessageProcessor2);
+
+ final TestProcessorContext testProcessorContext = new TestProcessorContext("Hello", true);
+
+ final GenericMessageChainProcessor<TestProcessorContext> genericMessageChainProcessor =
+ new GenericMessageChainProcessor<>(testMessageChain, testProcessorContext);
+
+ final TestProcessorContext finalProcessorContext = genericMessageChainProcessor.processChain();
+
+ final String result = finalProcessorContext.getResult();
+ assertThat("Final Result must be Hello World! Again", result, is("Hello World! Again"));
+ assertThat("TestProcessor1 state is correct", testMessageProcessor1.getProcessingState(),
+ is(ProcessingState.PROCESSING_FINISHED_SUCCESSFULLY));
+ assertThat("TestProcessor2 state is correct", testMessageProcessor2.getProcessingState(),
+ is(ProcessingState.PROCESSING_FINISHED_SUCCESSFULLY));
+ }
+
+
+ @Test
+ public void testProcessChainWhenProcessChainEarlyTermination() throws Exception {
+
+ final TestEarlyTerminatingProcessor testEarlyTerminatingProcessor = getTestEarlyTerminationProcessor();
+ final ImmutableList<? extends MessageProcessor<TestProcessorContext>> testMessageChain =
+ ImmutableList.of(testEarlyTerminatingProcessor, getTestMessageProcessor2());
+ final TestProcessorContext testProcessorContext = new TestProcessorContext("Hello", true);
+
+ final GenericMessageChainProcessor<TestProcessorContext> genericMessageChainProcessor =
+ new GenericMessageChainProcessor<>(testMessageChain, testProcessorContext);
+
+ final TestProcessorContext finalProcessorContext = genericMessageChainProcessor.processChain();
+ final String result = finalProcessorContext.getResult();
+ assertNull("Final Result must be null", result);
+ assertThat("TestEarlyTerminatingProcessor state is correct",
+ testEarlyTerminatingProcessor.getProcessingState(), is(ProcessingState.PROCESSING_TERMINATED_EARLY));
+ }
+
+ @Test(expected = MessageProcessingException.class)
+ public void testProcessChainWhenIncomingMessageContextIsNull() throws Exception {
+
+ final TestEarlyTerminatingProcessor testEarlyTerminatingProcessor = getTestEarlyTerminationProcessor();
+ final ImmutableList<? extends MessageProcessor<TestProcessorContext>> testMessageChain =
+ ImmutableList.of(testEarlyTerminatingProcessor, getTestMessageProcessor2());
+ final TestProcessorContext testProcessorContext = null;
+
+ final GenericMessageChainProcessor<TestProcessorContext> genericMessageChainProcessor =
+ new GenericMessageChainProcessor<>(testMessageChain, testProcessorContext);
+
+ genericMessageChainProcessor.processChain();
+ }
+
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfoTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfoTest.java
new file mode 100644
index 0000000..d52789e
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfoTest.java
@@ -0,0 +1,53 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import org.junit.Test;
+import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Rajiv Singla . Creation Date: 12/12/2016.
+ */
+public class GenericProcessorInfoTest extends BaseAnalyticsCommonUnitTest {
+
+
+ @Test
+ public void getProcessorName() throws Exception {
+ final String processorName = "testProcessorName";
+ final String processorDescription = "testProcessorDescription";
+ GenericProcessorInfo genericProcessorInfo = new GenericProcessorInfo(processorName, processorDescription);
+ assertThat("Processor Name must match", genericProcessorInfo.getProcessorName(), is(processorName));
+
+ }
+
+ @Test
+ public void getProcessorDescription() throws Exception {
+ final String processorName = "testProcessorName";
+ final String processorDescription = "testProcessorDescription";
+ GenericProcessorInfo genericProcessorInfo = new GenericProcessorInfo(processorName, processorDescription);
+ assertThat("Processor Description must match", genericProcessorInfo.getProcessorDescription(),
+ is(processorDescription));
+ }
+
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestEarlyTerminatingProcessor.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestEarlyTerminatingProcessor.java
new file mode 100644
index 0000000..814ea4b
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestEarlyTerminatingProcessor.java
@@ -0,0 +1,39 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+/**
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class TestEarlyTerminatingProcessor extends AbstractMessageProcessor<TestProcessorContext> {
+
+ @Override
+ public String getProcessorDescription() {
+ return "Terminates the chain early";
+ }
+
+ @Override
+ public TestProcessorContext processMessage(TestProcessorContext processorContext) {
+ setTerminatingProcessingMessage("Terminating early", processorContext);
+ return processorContext;
+ }
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor1.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor1.java
new file mode 100644
index 0000000..e8f8b0e
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor1.java
@@ -0,0 +1,41 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+/**
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class TestMessageProcessor1 extends AbstractMessageProcessor<TestProcessorContext> {
+
+ @Override
+ public String getProcessorDescription() {
+ return "Appends \" World!\" to the message string and set it to result string";
+ }
+
+ @Override
+ public TestProcessorContext processMessage(TestProcessorContext processorContext) {
+ final String message = processorContext.getMessage();
+ processorContext.setResult(message + " World!");
+ setFinishedProcessingMessage("Finished Appending world", processorContext);
+ return processorContext;
+ }
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor2.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor2.java
new file mode 100644
index 0000000..ce3a2dc
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestMessageProcessor2.java
@@ -0,0 +1,41 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+/**
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class TestMessageProcessor2 extends AbstractMessageProcessor<TestProcessorContext> {
+
+ @Override
+ public String getProcessorDescription() {
+ return "Appends \" Again\" to the result string";
+ }
+
+ @Override
+ public TestProcessorContext processMessage(TestProcessorContext processorContext) {
+ final String result = processorContext.getResult();
+ processorContext.setResult(result + " Again");
+ setFinishedProcessingMessage("Finished Appending again to result", processorContext);
+ return processorContext;
+ }
+}
diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestProcessorContext.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestProcessorContext.java
new file mode 100644
index 0000000..9ed7f4c
--- /dev/null
+++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/processor/TestProcessorContext.java
@@ -0,0 +1,84 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. 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.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class TestProcessorContext implements ProcessorContext {
+
+ private String message;
+ private boolean continueProcessingFlag;
+ private String result;
+ private List<? super MessageProcessor<? extends ProcessorContext>> messageProcessors;
+
+ public TestProcessorContext(String message, boolean continueProcessingFlag) {
+ this.message = message;
+ this.continueProcessingFlag = continueProcessingFlag;
+ this.messageProcessors = new LinkedList<>();
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public boolean canProcessingContinue() {
+ return continueProcessingFlag;
+ }
+
+ @Override
+ public void setProcessingContinueFlag(boolean canProcessingContinue) {
+ this.continueProcessingFlag = canProcessingContinue;
+ }
+
+ @Override
+ public List<? super MessageProcessor<? extends ProcessorContext>> getMessageProcessors() {
+ return messageProcessors;
+ }
+
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isContinueProcessingFlag() {
+ return continueProcessingFlag;
+ }
+
+ public void setContinueProcessingFlag(boolean continueProcessingFlag) {
+ this.continueProcessingFlag = continueProcessingFlag;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}