TCA: Replace any openecomp reference by onap
[dcaegen2/analytics/tca.git] / dcae-analytics-common / src / test / java / org / onap / dcae / apod / analytics / common / BaseAnalyticsCommonUnitTest.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *   You may obtain a copy of the License at
10  *
11  *          http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *  Unless required by applicable law or agreed to in writing, software
14  *  distributed under the License is distributed on an "AS IS" BASIS,
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *  See the License for the specific language governing permissions and
17  *  limitations under the License.
18  *  ============================LICENSE_END===========================================
19  */
20
21 package org.onap.dcae.apod.analytics.common;
22
23 import com.fasterxml.jackson.databind.ObjectMapper;
24 import com.google.common.base.Suppliers;
25 import org.junit.BeforeClass;
26 import org.onap.dcae.apod.analytics.common.service.processor.TestEarlyTerminatingProcessor;
27 import org.onap.dcae.apod.analytics.common.service.processor.TestMessageProcessor1;
28 import org.onap.dcae.apod.analytics.common.service.processor.TestMessageProcessor2;
29 import org.onap.dcae.apod.analytics.model.util.json.AnalyticsModelObjectMapperSupplier;
30 import org.onap.dcae.apod.analytics.test.BaseDCAEAnalyticsUnitTest;
31
32 /**
33  * Base class from all DCEA Analytics Common Module Unit Tests
34  * <p>
35  * @author Rajiv Singla . Creation Date: 10/6/2016.
36  */
37 public abstract class BaseAnalyticsCommonUnitTest extends BaseDCAEAnalyticsUnitTest {
38
39
40     protected static final String TEST_MESSAGE_PROCESSOR_MESSAGE = "Test Processor Message";
41
42     protected static final String CEF_MESSAGE_FILE_PATH = "data/json/cef/cef_message.json";
43
44     protected static ObjectMapper objectMapper;
45
46     /**
47      * Before running test cases need to assign object mapper.
48      */
49     @BeforeClass
50     public static void beforeClass() {
51         final AnalyticsModelObjectMapperSupplier analyticsModelObjectMapperSupplier =
52                 new AnalyticsModelObjectMapperSupplier();
53         objectMapper = Suppliers.memoize(analyticsModelObjectMapperSupplier).get();
54     }
55
56     /*
57      * Test implementation for {@link CDAPAppSettings}
58      */
59     protected class CDAPTestAppSettings {
60
61         private String settingsField;
62
63         public String getSettingsField() {
64             return settingsField;
65         }
66
67         public void setSettingsField(String settingsField) {
68             this.settingsField = settingsField;
69         }
70     }
71
72     protected TestMessageProcessor1 getTestMessageProcessor1() {
73          return new TestMessageProcessor1();
74     }
75     protected TestMessageProcessor2 getTestMessageProcessor2() {
76         return new TestMessageProcessor2();
77     }
78     protected TestEarlyTerminatingProcessor getTestEarlyTerminationProcessor() {
79         return new TestEarlyTerminatingProcessor();
80     }
81 }