blob: 01b8979781df4f7a3cd3127b4bdcbcdfba5c8340 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/bash
2
3function usage {
4 echo "Usage: $0 <jar file>"
5}
6
7function exitOnError() {
8 if [ $1 -ne 0 ]
9 then
10 echo "Failed running task $2"
11 exit 2
12 fi
13}
14
15if [ $# -lt 1 ]
16then
17 usage
18 exit 2
19fi
20
21CURRENT_DIR=`pwd`
22BASEDIR=$(dirname $0)
23
24if [ ${BASEDIR:0:1} = "/" ]
25then
26 FULL_PATH=$BASEDIR
27else
28 FULL_PATH=$CURRENT_DIR/$BASEDIR
29fi
30
31LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
32#############################################
33TARGET_DIR=${FULL_PATH}/target
Michael Landoed64b5e2017-06-09 03:19:04 +030034CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
Michael Lando451a3402017-02-19 10:28:42 +020035DEBUG=true
36MainClass=org.openecomp.sdc.ci.tests.run.StartTest
37
38JAR_FILE=$1
39SUITE_FILE=$2
40
41#TARGET_DIR=`echo ${TARGET_DIR} | sed 's/\//\//g'`
42#echo $TARGET_DIR
43
44TESTS_DIR=/opt/app/sdc/ci/resources/tests
45COMPONENTS_DIR=/opt/app/sdc/ci/resources/components
46
47#sed -i 's#\(outputFolder:\).*#\1 '${TARGET_DIR}'#g' $CONF_FILE
48#sed -i 's#\(resourceConfigDir:\).*#\1 '${TESTS_DIR}'#g' $CONF_FILE
49#sed -i 's#\(componentsConfigDir:\).*#\1 '${COMPONENTS_DIR}'#g' $CONF_FILE
50TARGET_LOG_DIR="${TARGET_DIR}/"
51
52# mkdir -p ${TARGET_DIR}
53#if [ -d ${TARGET_DIR} ]
54#then
55# rm -rf ${TARGET_DIR}/*
56#exitOnError $? "Failed_to_delete_target_dir"
57#fi
58
59debug_port=8800
60#JAVA_OPTION="-javaagent:/var/tmp/jacoco/lib/jacocoagent.jar=destfile=jacoco-it.exec"
61JAVA_OPTION=""
62case "$2" in
63 -debug) echo "Debug mode, Listen on port $debug_port"; JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;;
64 "") echo "Standard mode";;
65 *) echo "USAGE: startTest.sh [-debug]";;
66esac
67
68cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE"
69
70#echo $cmd
71#console=`$cmd`
72
73if [ $DEBUG == "true" ]
74then
75 $cmd
76else
77 $cmd >> /dev/null
78fi
79status=`echo $?`
80
81
82
83echo "##################################################"
84echo "################# status is ${status} #################"
85echo "##################################################"
86
87exit $status
88