2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 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.sdc.ci.tests.run;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.concurrent.atomic.AtomicBoolean;
27 import org.apache.log4j.Logger;
28 import org.apache.log4j.PropertyConfigurator;
29 import org.testng.TestNG;
31 public class StartTest {
33 public static long timeOfTest = 0;
35 public static boolean debug = false;
37 public static AtomicBoolean loggerInitialized = new AtomicBoolean(false);
39 protected static Logger logger = null;
41 public static void main(String[] args) {
43 String debugEnabled = System.getProperty("debug");
44 if (debugEnabled != null && debugEnabled.equalsIgnoreCase("true")) {
47 System.out.println("Debug mode is " + (debug ? "enabled" : "disabled"));
51 TestNG testng = new TestNG();
53 List<String> suites = new ArrayList<String>();
55 testng.setTestSuites(suites);
56 testng.setUseDefaultListeners(true);
57 testng.setOutputDirectory("target/");
64 logger = Logger.getLogger(StartTest.class.getName());
67 public static void enableLogger() {
69 if (false == loggerInitialized.get()) {
71 loggerInitialized.set(true);
73 String log4jPropsFile = System.getProperty("log4j.configuration");
74 if (System.getProperty("os.name").contains("Windows")) {
75 String logProps = "src/main/resources/ci/conf/log4j.properties";
76 if (log4jPropsFile == null) {
77 System.setProperty("targetlog", "target/");
78 log4jPropsFile = logProps;
82 PropertyConfigurator.configureAndWatch(log4jPropsFile);