forked from aliyun/aliyun-odps-java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.sh
103 lines (81 loc) · 2.88 KB
/
run_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
set -e
function getParameter()
{
key=$1
section=$2
file=$3
awk -F $key= '/\['$section'\]/{a=1}a==1&&/'$key'=/{print $2;exit}' $file
}
#arg1 is the key matched to replace, arg2 is the value, arg3 is file
function sedOnePara()
{
key=$1
value=$2
file=$3
sed -i '' "s&$key=.*&$key=$value&g" $file
}
function printParameters()
{
echo "DEFAULT PROJECT: ${DEFAULT_PROJECT}"
echo "DEFAULT ENDPOINT: ${DEFAULT_ENDPOINT}"
echo "DEFAULT ACCESS ID: ${DEFAULT_ACCESS_ID}"
echo "DEFAULT ACCESS KEY: ${DEFAULT_ACCESS_KEY}"
echo "DEFAULT TUNNEL: ${DEFAULT_TUNNEL}"
echo "SECURITY PROJECT: ${SECURITY_PROJECT}"
echo "SECURITY EDNPOINT: ${SECURITY_EDNPOINT}"
echo "SECURITY ACCESS ID: ${SECURITY_ACCESS_ID}"
echo "SECURITY ACCESS KEY: ${SECURITY_ACCESS_KEY}"
echo "HTTPS ENDPOINT: ${HTTPS_ENDPOINT}"
}
#arg1 is the config file name
function setParameters()
{
SDK_CONFIG=$1
echo $1
sedOnePara default.project $DEFAULT_PROJECT $SDK_CONFIG
sedOnePara default.endpoint $DEFAULT_ENDPOINT $SDK_CONFIG
sedOnePara default.access.id $DEFAULT_ACCESS_ID $SDK_CONFIG
sedOnePara default.access.key $DEFAULT_ACCESS_KEY $SDK_CONFIG
sedOnePara default.tunnel.endpoint $DEFAULT_TUNNEL $SDK_CONFIG
sedOnePara security.project $SECURITY_PROJECT $SDK_CONFIG
sedOnePara security.endpoint $SECURITY_EDNPOINT $SDK_CONFIG
sedOnePara security.access.id $SECURITY_ACCESS_ID $SDK_CONFIG
sedOnePara security.access.key $SECURITY_ACCESS_KEY $SDK_CONFIG
sedOnePara https.endpoint $HTTPS_ENDPOINT $SDK_CONFIG
}
if [ "$#" != "1" ]; then
echo "Usage:"
echo "sh run_test.sh /path/to/odps_config.ini"
exit 1
fi
CONFIG_PATH=$1
DEFAULT_PROJECT=$(getParameter project default $CONFIG_PATH)
DEFAULT_ENDPOINT=$(getParameter endpoint default $CONFIG_PATH)
DEFAULT_ACCESS_ID=$(getParameter access.id default $CONFIG_PATH)
DEFAULT_ACCESS_KEY=$(getParameter access.key default $CONFIG_PATH)
DEFAULT_TUNNEL=$(getParameter tunnel default $CONFIG_PATH)
SECURITY_PROJECT=$(getParameter project security $CONFIG_PATH)
SECURITY_EDNPOINT=$(getParameter endpoint security $CONFIG_PATH)
SECURITY_ACCESS_ID=$(getParameter access.id security $CONFIG_PATH)
SECURITY_ACCESS_KEY=$(getParameter access.key security $CONFIG_PATH)
HTTPS_ENDPOINT=$(getParameter endpoint https $CONFIG_PATH)
printParameters
for i in `find . -name '*test.conf'`
do
setParameters $i
done
########################
mvn -U clean test -fn
mkdir -p target/surefire-reports
for i in `find ./ -name 'TEST-*.xml'`
do
cp $i target/surefire-reports
done
mkdir -p target/junit-report
mvn -N antrun:run
echo >> $CONFIG_PATH
echo >> $CONFIG_PATH
echo "################################################ CONFIG INFO #####################################################################" >> $CONFIG_PATH
echo "##################################################################################################################################" >> $CONFIG_PATH
cat $CONFIG_PATH
echo "RUN DONE"