2 * ===============================LICENSE_START======================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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===========================================
21 package org.onap.dcae.apod.analytics.common;
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;
33 * Base class from all DCEA Analytics Common Module Unit Tests
35 * @author Rajiv Singla . Creation Date: 10/6/2016.
37 public abstract class BaseAnalyticsCommonUnitTest extends BaseDCAEAnalyticsUnitTest {
40 protected static final String TEST_MESSAGE_PROCESSOR_MESSAGE = "Test Processor Message";
42 protected static final String CEF_MESSAGE_FILE_PATH = "data/json/cef/cef_message.json";
44 protected static ObjectMapper objectMapper;
47 * Before running test cases need to assign object mapper.
50 public static void beforeClass() {
51 final AnalyticsModelObjectMapperSupplier analyticsModelObjectMapperSupplier =
52 new AnalyticsModelObjectMapperSupplier();
53 objectMapper = Suppliers.memoize(analyticsModelObjectMapperSupplier).get();
57 * Test implementation for {@link CDAPAppSettings}
59 protected class CDAPTestAppSettings {
61 private String settingsField;
63 public String getSettingsField() {
67 public void setSettingsField(String settingsField) {
68 this.settingsField = settingsField;
72 protected TestMessageProcessor1 getTestMessageProcessor1() {
73 return new TestMessageProcessor1();
75 protected TestMessageProcessor2 getTestMessageProcessor2() {
76 return new TestMessageProcessor2();
78 protected TestEarlyTerminatingProcessor getTestEarlyTerminationProcessor() {
79 return new TestEarlyTerminatingProcessor();