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.cdap.tca.validator;
23 import org.junit.Test;
24 import org.onap.dcae.apod.analytics.cdap.tca.BaseAnalyticsCDAPTCAUnitTest;
25 import org.onap.dcae.apod.analytics.cdap.tca.settings.TCAAppConfig;
26 import org.onap.dcae.apod.analytics.cdap.tca.settings.TCATestAppConfig;
27 import org.onap.dcae.apod.analytics.common.validation.GenericValidationResponse;
29 import static org.junit.Assert.assertFalse;
30 import static org.junit.Assert.assertTrue;
33 * @author Rajiv Singla . Creation Date: 12/16/2016.
35 public class TCAAppConfigValidatorTest extends BaseAnalyticsCDAPTCAUnitTest {
39 public void validateAppSettingsWhenAppConfigIsValid() throws Exception {
40 final TCAAppConfigValidator tcaAppConfigValidator = new TCAAppConfigValidator();
41 final TCATestAppConfig tcaTestAppConfig = getTCATestAppConfig();
42 final GenericValidationResponse<TCAAppConfig> validationResponse =
43 tcaAppConfigValidator.validateAppSettings(tcaTestAppConfig);
44 assertFalse(validationResponse.hasErrors());
48 public void testWhenSubscriberOutputStreamIsNull() throws Exception {
49 final TCAAppConfigValidator tcaAppConfigValidator = new TCAAppConfigValidator();
50 final TCATestAppConfig tcaTestAppConfig = getTCATestAppConfig();
51 tcaTestAppConfig.setTcaSubscriberOutputStreamName(null);
52 final GenericValidationResponse<TCAAppConfig> validationResponse =
53 tcaAppConfigValidator.validateAppSettings(tcaTestAppConfig);
54 assertTrue(validationResponse.hasErrors());
58 public void testWhenVESMessageStatusTableNameIsNull() throws Exception {
59 final TCAAppConfigValidator tcaAppConfigValidator = new TCAAppConfigValidator();
60 final TCATestAppConfig tcaTestAppConfig = getTCATestAppConfig();
61 tcaTestAppConfig.setTcaVESMessageStatusTableName(null);
62 final GenericValidationResponse<TCAAppConfig> validationResponse =
63 tcaAppConfigValidator.validateAppSettings(tcaTestAppConfig);
64 assertTrue(validationResponse.hasErrors());
68 public void testWhenVESAlertsTableNameIsNull() throws Exception {
69 final TCAAppConfigValidator tcaAppConfigValidator = new TCAAppConfigValidator();
70 final TCATestAppConfig tcaTestAppConfig = getTCATestAppConfig();
71 tcaTestAppConfig.setTcaVESAlertsTableName(null);
72 final GenericValidationResponse<TCAAppConfig> validationResponse =
73 tcaAppConfigValidator.validateAppSettings(tcaTestAppConfig);
74 assertTrue(validationResponse.hasErrors());