Skip to content

Commit a06268d

Browse files
author
Hoisko Sakari.M 10802213
committed
Added local execution support, use test.sh script with local/remote/all parameters to execution
1 parent 68b90c4 commit a06268d

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

Dockerfile_build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-i
1818
openjdk-8-jre \
1919
openjfx \
2020
&& rm -rf /var/lib/apt/lists/*
21-
COPY --from=builder /code/target/javafxlibrary-*-jar-with-dependencies.jar .
21+
COPY --from=builder /code/target/javafxlibrary-*-jar-with-dependencies.jar /.
2222
EXPOSE 8270
23-
ENTRYPOINT java -jar javafxlibrary-*-jar-with-dependencies.jar
23+
COPY entrypoint_build.sh /.
24+
ENTRYPOINT /entrypoint_build.sh

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ services:
99
volumes:
1010
- './src/test/robotframework/:/robot'
1111
- screen-thing:/tmp/.X11-unix
12+
- './src/:/src' # ScreenCapturingTest.robot require this.
13+
- javafxbinaryshare:/javafxbinary
1214
networks:
1315
- testapp
1416

@@ -20,8 +22,10 @@ services:
2022
networks:
2123
- testapp
2224
volumes:
25+
- './src/test/robotframework/:/robot' # Screen capures are saved to here "hack until remote usage copy photos to results folder"
2326
- './src/:/src' # ScreenCapturingTest.robot require this.
2427
- screen-thing:/tmp/.X11-unix
28+
- javafxbinaryshare:/javafxbinary
2529
environment:
2630
- DISPLAY=:20.0
2731

@@ -44,3 +48,4 @@ networks:
4448
testapp:
4549
volumes:
4650
screen-thing:
51+
javafxbinaryshare:

docker/robot-javafx-demo/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-i
1717
wget \
1818
xvfb \
1919
xorg \
20+
openjdk-8-jre \
21+
openjfx \
2022
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2123

2224
RUN pip install --no-cache-dir \
@@ -25,6 +27,7 @@ RUN pip install --no-cache-dir \
2527
RUN mkdir ~/.vnc
2628
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
2729
COPY entrypoint.sh /entrypoint.sh
30+
COPY test.sh /bin/test.sh
2831
EXPOSE 5900
2932

3033
ENTRYPOINT ["x11vnc", "-create", "-forever", "-env", "FD_PROG=/entrypoint.sh", "-env", "X11VNC_CREATE_GEOM=${1:-1024x768x16}", "-usepw"]

docker/robot-javafx-demo/test.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
EXIT_VALUE=0
3+
4+
function local() {
5+
echo "INFO: Local execution:"
6+
file=$(ls -1 /javafxbinary/javafxlibrary-*-jar-with-dependencies.jar)
7+
java -cp "${file}" org.robotframework.RobotFramework -d /robot/results/local --include smoke $@ /robot/acceptance
8+
# $@ #just to testing script
9+
if [[ "$?" != "0" ]]; then
10+
EXIT_VALUE=$((EXIT_VALUE+1))
11+
fi
12+
}
13+
14+
function remote() {
15+
echo "INFO: Remote execution:"
16+
robot -d /robot/results/remote --include smoke $@ /robot/acceptance
17+
# $@ #just to testing script
18+
if [[ "$?" != "0" ]]; then
19+
EXIT_VALUE=$((EXIT_VALUE+2))
20+
fi
21+
}
22+
23+
24+
case $1 in
25+
local | LOCAL )
26+
shift
27+
local $@
28+
;;
29+
remote | REMOTE | demo | DEMO)
30+
shift
31+
remote $@
32+
;;
33+
"" | all | ALL )
34+
echo "INFO: All execution:"
35+
shift
36+
local $@
37+
remote $@
38+
;;
39+
* )
40+
echo "ERROR:$@ is not supported parameter"
41+
EXIT_VALUE=$((EXIT_VALUE+4))
42+
;;
43+
esac
44+
echo "*************************************************"
45+
case ${EXIT_VALUE} in
46+
0 )
47+
echo "INFO: All fine, tests PASS"
48+
;;
49+
1 )
50+
echo "ERROR: Local library tests fail"
51+
;;
52+
2 )
53+
echo "ERROR: Remote library tests fail"
54+
;;
55+
3 )
56+
echo "ERROR: Local and Remote library tests fails"
57+
;;
58+
esac
59+
exit ${EXIT_VALUE}

entrypoint_build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
rm -rvf /javafxbinary/*
3+
cp -vf /javafxlibrary-*-jar-with-dependencies.jar /javafxbinary/.
4+
java -jar /javafxlibrary-*-jar-with-dependencies.jar

0 commit comments

Comments
 (0)