2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.common.service.processor;
\r
23 import org.junit.Test;
\r
24 import org.openecomp.dcae.apod.analytics.common.BaseAnalyticsCommonUnitTest;
\r
26 import java.util.List;
\r
28 import static org.hamcrest.CoreMatchers.is;
\r
29 import static org.junit.Assert.assertThat;
\r
32 * @author Rajiv Singla . Creation Date: 12/12/2016.
\r
34 public class AbstractProcessorContextTest extends BaseAnalyticsCommonUnitTest {
\r
36 class TestAbstractMessageProcessorContext extends AbstractProcessorContext {
\r
38 public TestAbstractMessageProcessorContext(String message, boolean canProcessingContinue) {
\r
39 super(message, canProcessingContinue);
\r
45 public void testGetMessage() throws Exception {
\r
46 TestAbstractMessageProcessorContext testProcessorContext =
\r
47 new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
\r
48 final String message = testProcessorContext.getMessage();
\r
49 assertThat("Message Processor message must match", message, is(TEST_MESSAGE_PROCESSOR_MESSAGE));
\r
53 public void testCanProcessingContinue() throws Exception {
\r
54 TestAbstractMessageProcessorContext testProcessorContext =
\r
55 new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
\r
56 final boolean canProcessingContinue = testProcessorContext.canProcessingContinue();
\r
57 assertThat("Message Can Processing flag must be true", canProcessingContinue, is(true));
\r
61 public void testSetProcessingContinueFlag() throws Exception {
\r
62 TestAbstractMessageProcessorContext testProcessorContext =
\r
63 new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
\r
64 testProcessorContext.setProcessingContinueFlag(false);
\r
65 assertThat("Message Can processing flag must be false",
\r
66 testProcessorContext.canProcessingContinue(), is(false));
\r
71 public void testGetMessageProcessors() throws Exception {
\r
72 TestAbstractMessageProcessorContext testProcessorContext =
\r
73 new TestAbstractMessageProcessorContext(TEST_MESSAGE_PROCESSOR_MESSAGE, true);
\r
74 final List<? super MessageProcessor<? extends ProcessorContext>> messageProcessors =
\r
75 testProcessorContext.getMessageProcessors();
\r
76 assertThat("Message processor processing message must match", messageProcessors.size(), is(0));
\r