Skip to content

Commit 73395ce

Browse files
authored
Merge pull request #3 from eficode/DockerizedEnv
Add dockerized env to build / test / demo JavaFXLibrary with minimal setup.
2 parents 5e6eefa + 67e0c90 commit 73395ce

34 files changed

+342
-117
lines changed

AUTHORS.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ Sami Pesonen 2017 -
44
Pasi Saikkonen 2017 -
55

66
Other contributors:
7-
Tatu Lahtela Find All With Pseudo Class and Find Class keywords
7+
Tatu Lahtela Find All With Pseudo Class and Find Class keywords
8+
Sakari Hoisko Dockerized linux env with X

Dockerfile_build

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:16.04 as builder
2+
ENV DEBIAN_FRONTEND noninteractive
3+
RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-install-recommends --allow-unauthenticated -y \
4+
openjdk-8-jdk \
5+
openjfx \
6+
python3-pip \
7+
maven \
8+
git-all \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& mkdir code
11+
COPY . /code
12+
WORKDIR /code
13+
RUN mvn package
14+
# ENTRYPOINT java -jar /code/target/javafxlibrary-*-SNAPSHOT-jar-with-dependencies.jar
15+
16+
FROM ubuntu:16.04
17+
COPY --from=builder /code/target/javafxlibrary-*-SNAPSHOT-jar-with-dependencies.jar /.
18+
COPY entrypoint_build.sh /.
19+
RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-install-recommends --allow-unauthenticated -y \
20+
openjdk-8-jre \
21+
openjfx \
22+
&& rm -rf /var/lib/apt/lists/* && chmod 555 /javafxlibrary-*-jar-with-dependencies.jar /entrypoint_build.sh
23+
EXPOSE 8270
24+
ENTRYPOINT /entrypoint_build.sh

Dockerfile_release

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
THIS IS JUST DRAFT!!!
2+
3+
FROM ubuntu:16.04 as builder
4+
ENV DEBIAN_FRONTEND noninteractive
5+
RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-install-recommends --allow-unauthenticated -y \
6+
openjdk-8-jdk \
7+
openjfx \
8+
python3-pip \
9+
maven \
10+
git-all \
11+
&& mkdir code
12+
RUN wget latest https://github.com/eficode/JavaFXLibrary/releases Source code.zip && unzip
13+
WORKDIR /code
14+
RUN mvn package
15+
16+
FROM ubuntu:16.04
17+
RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-install-recommends --allow-unauthenticated -y \
18+
openjdk-8-jre \
19+
openjfx \
20+
&& rm -rf /var/lib/apt/lists/*
21+
COPY --from=builder /code/target/JAVAFX:n testisoftat
22+
RUN wget https://github.com/eficode/JavaFXLibrary/releases JavaFXLibrary-0.4.1.jar
23+
EXPOSE 8270
24+
ENTRYPOINT java -jar JavaFXLibrary-0.4.1.jar jolle sisäään myös testisofta jarrit class pathinä/etc?

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,25 @@ Linux/OSX command line:
7676
java -cp "target/javafxlibrary-<version>.jar" org.robotframework.RobotFramework --include smoke src/test/robotframework/
7777

7878
```
79+
80+
## Remote library demo with Docker
81+
### Requirements:
82+
* VNC viewer e.g. https://www.realvnc.com/en/connect/download/viewer/
83+
* Docker CE: https://docs.docker.com/install/
84+
* Docker-compose: https://docs.docker.com/compose/install/
85+
* VNC port: vnc://localhost:5900
86+
87+
### Running the demo with testing env
88+
1. Build & Start Dockerized Environment: `docker-compose up -d robot-framework javafxcompile`
89+
2. Take VNC connection to: <i>vnc://<docker_daemon_ip>:5900</i>
90+
3. Password is: 1234
91+
4. Open shell by right clicking in VNC desktop and selecting Applications > Shells > Bash
92+
5. Execute tests: `test.sh`
93+
94+
FYI:
95+
Single testcase execution in locale and remote (replace spaces with _ ):<br>
96+
`test.sh all '--include tag_name' '-t test_case_name'`<br>
97+
Single suite execution in locale and remote (replace spaces with _ ):<br>
98+
`test.sh all '--include tag_name' '-s suite_name'`
99+
<br>
100+
NOTE: smoke tag is default included.

docker-compose.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: '2'
2+
services:
3+
4+
robot-framework:
5+
build:
6+
context: ./docker/robot-javafx-demo
7+
ports:
8+
- '5900:5900'
9+
volumes:
10+
- './src/test/robotframework/:/robot'
11+
- screen-thing:/tmp/.X11-unix
12+
- './src/:/src' # ScreenCapturingTest.robot require this.
13+
- javafxbinaryshare:/javafxbinary
14+
networks:
15+
- testapp
16+
17+
javafxcompile:
18+
build:
19+
context: ./
20+
dockerfile: Dockerfile_build
21+
restart: on-failure
22+
networks:
23+
- testapp
24+
volumes:
25+
- './src/test/robotframework/:/robot' # Screen capures are saved to here "hack until remote usage copy photos to results folder"
26+
- './src/:/src' # ScreenCapturingTest.robot require this.
27+
- screen-thing:/tmp/.X11-unix
28+
- javafxbinaryshare:/javafxbinary
29+
environment:
30+
- DISPLAY=:20.0
31+
32+
# javafxrelease:
33+
# build:
34+
# context: ./
35+
# dockerfile: Dockerfile_release
36+
# restart: on-failure
37+
# networks:
38+
# testapp:
39+
# aliases:
40+
# - javafxcompile
41+
# volumes:
42+
# - './src/:/src' # ScreenCapturingTest.robot require this.
43+
# - screen-thing:/tmp/.X11-unix
44+
# environment:
45+
# - DISPLAY=:20.0
46+
47+
networks:
48+
testapp:
49+
volumes:
50+
screen-thing:
51+
javafxbinaryshare:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:16.04
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN apt-get -qq update && apt-get dist-upgrade -y && apt-get install -qq --no-install-recommends --allow-unauthenticated -y \
6+
dbus \
7+
openssh-client \
8+
x11vnc \
9+
xvfb \
10+
bash \
11+
xterm \
12+
fluxbox \
13+
python-pip \
14+
git \
15+
nano \
16+
python-setuptools \
17+
wget \
18+
xvfb \
19+
xorg \
20+
openjdk-8-jre \
21+
openjfx \
22+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
23+
24+
RUN pip install --no-cache-dir \
25+
robotframework
26+
27+
COPY entrypoint.sh /entrypoint.sh
28+
COPY test.sh /bin/test.sh
29+
RUN mkdir ~/.vnc && x11vnc -storepasswd 1234 ~/.vnc/passwd && chmod 555 /entrypoint.sh /bin/test.sh
30+
EXPOSE 5900
31+
32+
ENTRYPOINT ["x11vnc", "-create", "-forever", "-env", "FD_PROG=/entrypoint.sh", "-env", "X11VNC_CREATE_GEOM=${1:-1024x768x16}", "-usepw"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
xhost +
3+
/usr/bin/fluxbox

docker/robot-javafx-demo/test.sh

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

entrypoint_build.sh

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

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@
322322
<artifactId>testfx-junit</artifactId>
323323
<version>4.0.13-alpha</version>
324324
</dependency>
325+
<dependency>
326+
<groupId>org.testfx</groupId>
327+
<artifactId>openjfx-monocle</artifactId>
328+
<version>8u76-b04</version>
329+
<scope>test</scope>
330+
</dependency>
325331
<dependency>
326332
<groupId>org.robotframework</groupId>
327333
<artifactId>javalib-core</artifactId>

0 commit comments

Comments
 (0)