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.onap.dcae.apod.analytics.cdap.common.validation.CDAPAppSettingsValidator;
24 import org.onap.dcae.apod.analytics.cdap.tca.settings.TCAAppConfig;
25 import org.onap.dcae.apod.analytics.common.validation.GenericValidationResponse;
27 import static org.onap.dcae.apod.analytics.cdap.common.utils.ValidationUtils.isEmpty;
31 * TCA App Config Validator validates any TCA App Config parameter values
34 * @author Rajiv Singla . Creation Date: 10/24/2016.
36 public class TCAAppConfigValidator implements CDAPAppSettingsValidator<TCAAppConfig,
37 GenericValidationResponse<TCAAppConfig>> {
39 private static final long serialVersionUID = 1L;
42 public GenericValidationResponse<TCAAppConfig> validateAppSettings(TCAAppConfig tcaAppConfig) {
44 final GenericValidationResponse<TCAAppConfig> validationResponse = new GenericValidationResponse<>();
46 if (isEmpty(tcaAppConfig.getTcaSubscriberOutputStreamName())) {
47 validationResponse.addErrorMessage("tcaSubscriberOutputStreamName",
48 "tcaSubscriberOutputStreamName must be present");
51 if (isEmpty(tcaAppConfig.getTcaVESMessageStatusTableName())) {
52 validationResponse.addErrorMessage("tcaVESMessageStatusTableName",
53 "tcaVESMessageStatusTableName must be present");
55 if (isEmpty(tcaAppConfig.getTcaVESAlertsTableName())) {
56 validationResponse.addErrorMessage("tcaVESAlertsTableName",
57 "tcaVESAlertsTableName must be present");
60 return validationResponse;