2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.openecomp.sdc.asdctool.main;
23 import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL;
24 import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager;
25 import org.openecomp.sdc.asdctool.impl.validator.config.ValidationToolConfiguration;
26 import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
27 import org.openecomp.sdc.be.config.ConfigurationManager;
28 import org.openecomp.sdc.common.api.ConfigurationSource;
29 import org.openecomp.sdc.common.impl.ExternalConfiguration;
30 import org.openecomp.sdc.common.impl.FSConfigurationSource;
31 import org.openecomp.sdc.common.log.wrappers.Logger;
32 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
35 * Created by chaya on 7/3/2017.
37 public class ValidationTool {
39 private static Logger log = Logger.getLogger(ValidationTool.class.getName());
41 public static void main(String[] args) {
43 String outputPath = args[0];
44 ValidationConfigManager.setOutputFullFilePath(outputPath);
45 ValidationConfigManager.setCsvReportFilePath(outputPath);
47 String appConfigDir = args[1];
48 AnnotationConfigApplicationContext context = initContext(appConfigDir);
49 ValidationToolBL validationToolBL = context.getBean(ValidationToolBL.class);
51 log.info("Start Validation Tool");
52 Boolean result = validationToolBL.validateAll();
53 ReportManager.reportEndOfToolRun();
55 log.info("Validation finished successfully");
58 log.info("Validation finished with warnings");
63 private static AnnotationConfigApplicationContext initContext(String appConfigDir) {
64 ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
65 ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
66 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValidationToolConfiguration.class);