├── .envrc ├── .gitignore ├── .travis.yml ├── .travis ├── .envrc ├── default.nix ├── deploy-snapshot ├── feature-to-markdown.awk ├── publish-documentation.sh ├── settings.xml.enc ├── travis_rsa.enc └── travis_rsa.pub ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── appveyor.yml ├── checkstyle-tests.xml ├── checkstyle.xml ├── default.nix ├── docs ├── .envrc ├── .gitignore ├── _config.yml ├── _includes │ ├── disqus.html │ ├── footer.html │ ├── google_analytics.html │ ├── header.html │ └── navigation.html ├── _layouts │ ├── default.html │ └── page.html ├── _posts │ └── .gitkeep ├── bin │ └── jekyll-page ├── css │ ├── main.css │ └── syntax.css ├── current ├── default.nix ├── documentation │ ├── 1.0.0-RC1 │ │ └── index.md │ ├── 1.0.0-RC2 │ │ └── index.md │ ├── 1.0.0-RC3 │ │ └── index.md │ ├── 1.0.0-RC4 │ │ └── index.md │ ├── 1.0.0-RC5 │ │ └── index.md │ ├── 1.0.1-SNAPSHOT │ │ └── index.md │ ├── current │ └── snapshot ├── index.md ├── javadoc │ ├── 1.0.0-RC1 │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── 1.0.0-RC2 │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── 1.0.0-RC3 │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── 1.0.0-RC4 │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── 1.0.0-RC5 │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── 1.0.1-SNAPSHOT │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── com │ │ │ └── github │ │ │ │ └── junit5docker │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ ├── WaitFor.html │ │ │ │ ├── class-use │ │ │ │ ├── Docker.html │ │ │ │ ├── Environment.html │ │ │ │ ├── Port.html │ │ │ │ └── WaitFor.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ └── stylesheet.css │ ├── current │ └── snapshot └── snapshot ├── images-for-tests ├── .envrc ├── default.nix ├── log-and-quit │ ├── Dockerfile │ ├── build.sh │ └── hello.go ├── open-port-later │ ├── Dockerfile │ ├── build.sh │ └── hello.go ├── simple-two-ports │ ├── Dockerfile │ ├── build.sh │ └── hello.go └── with-volume │ ├── Dockerfile │ ├── build.sh │ └── hello.go ├── pmd.xml ├── pom.xml └── src ├── main └── java │ └── com │ └── github │ └── junit5docker │ ├── DefaultDockerClient.java │ ├── Docker.java │ ├── DockerClientAdapter.java │ ├── DockerExtension.java │ ├── Environment.java │ ├── Port.java │ ├── PortBinding.java │ ├── QueueIterator.java │ ├── StreamLog.java │ └── WaitFor.java └── test ├── java └── com │ └── github │ └── junit5docker │ ├── DefaultDockerClientIT.java │ ├── DockerExtensionTest.java │ ├── PortBindingTest.java │ ├── QueueIteratorTest.java │ ├── StartDockerContainerIT.java │ ├── StartDockerContainerWithEnvironmentVariableIT.java │ ├── StartDockerContainerWithMultiplePortsIT.java │ ├── StreamLogTest.java │ ├── WaitForLogIT.java │ ├── assertions │ ├── CountDownLatchAssertions.java │ ├── ExecutionAssertions.java │ ├── ExecutorAssertions.java │ └── ThreadedAssertions.java │ ├── cucumber │ ├── CucumberTestRunner.java │ ├── engine │ │ ├── ClassTestDescriptorForCucumber.java │ │ ├── JupiterExecutionListener.java │ │ ├── JupiterTestEngineForTests.java │ │ ├── MethodTestDescriptorForCucumber.java │ │ └── TestDescriptorForCucumber.java │ ├── state │ │ ├── CompiledClass.java │ │ └── Containers.java │ └── steps │ │ ├── AfterAllCheckSteps.java │ │ ├── AfterEachCheckSteps.java │ │ ├── AfterSteps.java │ │ ├── BeforeAllCheckSteps.java │ │ ├── BeforeEachCheckSteps.java │ │ ├── CompilationSteps.java │ │ └── ExecutionSteps.java │ └── fakes │ ├── FakeExtensionContext.java │ └── FakeLog.java └── resources ├── documentation └── index.feature └── logback-test.xml /.envrc: -------------------------------------------------------------------------------- 1 | use_nix -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | target/ 4 | 5 | # Mobile Tools for Java (J2ME) 6 | .mtj.tmp/ 7 | 8 | # Package Files # 9 | *.jar 10 | *.war 11 | *.ear 12 | 13 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 14 | hs_err_pid* 15 | 16 | # intelliJ idea 17 | .idea/ 18 | *.iml 19 | 20 | hello 21 | .travis/travis_rsa 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | matrix: 3 | include: 4 | - os: linux 5 | jdk: oraclejdk8 6 | services: 7 | - docker 8 | env: goal=verify 9 | - os: osx 10 | osx_image: xcode8.2 11 | env: goal=test 12 | script: 13 | - mvn $goal 14 | after_success: 15 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then .travis/publish-documentation.sh; fi 16 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then .travis/deploy-snapshot; fi 17 | branches: 18 | only: 19 | - master 20 | -------------------------------------------------------------------------------- /.travis/.envrc: -------------------------------------------------------------------------------- 1 | use_nix -------------------------------------------------------------------------------- /.travis/default.nix: -------------------------------------------------------------------------------- 1 | { }: 2 | 3 | let 4 | pkgs = import { }; 5 | in 6 | pkgs.stdenv.mkDerivation { 7 | name = "junit5-docker-travis"; 8 | buildInputs = [ 9 | pkgs.travis 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /.travis/deploy-snapshot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | function prepare_maven { 5 | openssl aes-256-cbc -K $encrypted_e6b9672fee19_key -iv $encrypted_e6b9672fee19_iv -in settings.xml.enc -out ~/.m2/settings.xml -d 6 | chmod og-rwx ~/.m2/settings.xml 7 | } 8 | 9 | function get_version { 10 | echo 'VERSION=${project.version}' | mvn help:evaluate | grep ^VERSION | sed -E 's/VERSION=(.*)/\1/' 11 | } 12 | 13 | if [ ${TRAVIS} ] && [ "$TRAVIS_BRANCH" == "master" ] && [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ] 14 | then 15 | prepare_maven 16 | local VERSION=$(get_version) 17 | if [[ ${VERSION} =~ "SNAPSHOT" ]] 18 | then 19 | mvn deploy 20 | fi 21 | else 22 | echo "On a branch or not on travis, not deploying !" 23 | fi 24 | -------------------------------------------------------------------------------- /.travis/feature-to-markdown.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env awk -f 2 | BEGIN { 3 | TRUE=0 4 | FALSE=1 5 | JAVA_STARTED=FALSE; 6 | } 7 | { 8 | if(match($0,"^#")){ 9 | } else if(match($0,"^Feature:(.*)$")) { 10 | print "---"; 11 | print "layout: page"; 12 | print gensub(/^Feature:(.*)$/, "title:\\1", "g", $0); 13 | print "category: doc"; 14 | print "order: 0"; 15 | print "---"; 16 | } else if(match($0,"^\"\"\"$")) { 17 | if(JAVA_STARTED) { 18 | print "```java"; 19 | JAVA_STARTED=TRUE 20 | } else { 21 | print "```"; 22 | JAVA_STARTED=FALSE 23 | } 24 | } else if(match($0,"^ *Scenario:(.*)$")) { 25 | print gensub(/^ *Scenario:(.*)$/, "###\\1", "g", $0); 26 | } else { 27 | print $0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.travis/publish-documentation.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | DOCS_FOLDER=docs 5 | DOCUMENTATION_FOLDER=${DOCS_FOLDER}/documentation 6 | JAVADOC_FOLDER=${DOCS_FOLDER}/javadoc 7 | 8 | function prepare_ssh { 9 | openssl aes-256-cbc -K ${encrypted_1aab6c06035c_key} -iv ${encrypted_1aab6c06035c_iv} -in .travis/travis_rsa.enc -out .travis/travis_rsa -d 10 | chmod og-rwx .travis/travis_rsa 11 | eval `ssh-agent -s` 12 | ssh-add .travis/travis_rsa 13 | } 14 | 15 | function configure_git { 16 | git config --global user.email "travis@travis-ci.org" 17 | git config --global user.name "travis-ci" 18 | git remote set-url origin git@github.com:FaustXVI/junit5-docker.git 19 | } 20 | 21 | function get_version { 22 | echo 'VERSION=${project.version}' | mvn help:evaluate | grep ^VERSION | sed -E 's/VERSION=(.*)/\1/' 23 | } 24 | 25 | function create_documentation { 26 | local VERSION="$1" 27 | mvn resources:testResources 28 | rm -rf ${DOCUMENTATION_FOLDER}/${VERSION} 29 | if [[ ${VERSION} =~ "SNAPSHOT" ]] 30 | then 31 | rm -rf ${DOCUMENTATION_FOLDER}/*SNAPSHOT 32 | fi 33 | mkdir -p ${DOCUMENTATION_FOLDER}/${VERSION} 34 | mv target/test-classes/documentation/* ${DOCUMENTATION_FOLDER}/${VERSION} 35 | for file in ${DOCUMENTATION_FOLDER}/${VERSION}/*.feature 36 | do 37 | cat $file | awk -f .travis/feature-to-markdown.awk > ${file%%.feature}.md 38 | rm $file 39 | done 40 | } 41 | 42 | function create_javadoc { 43 | local VERSION="$1" 44 | # The -D option is required here because the javadoc maven plugin does not work when specifying a different destination in report mode than in build mode. 45 | mvn clean javadoc:javadoc -DdestDir=${VERSION} 46 | rm -rf ${JAVADOC_FOLDER}/${VERSION} 47 | if [[ ${VERSION} =~ "SNAPSHOT" ]] 48 | then 49 | rm -rf ${JAVADOC_FOLDER}/*SNAPSHOT 50 | fi 51 | mv target/site/apidocs/${VERSION} ${JAVADOC_FOLDER}/ 52 | } 53 | 54 | function push_documentation { 55 | git add docs 56 | 57 | local CHANGED=$(git status -uno -s) 58 | 59 | if [ -n "$CHANGED" ] 60 | then 61 | git commit -m "Update documentation" 62 | git push 63 | else 64 | echo "No changes on documentation" 65 | fi 66 | } 67 | 68 | function update_link { 69 | cd $1 70 | ln -s -n -f $2 $3 71 | cd - > /dev/null 72 | } 73 | 74 | function update_symlinks { 75 | local VERSION="$1" 76 | if [[ ${VERSION} =~ "SNAPSHOT" ]] 77 | then 78 | update_link ${DOCUMENTATION_FOLDER} ${VERSION} snapshot 79 | update_link ${JAVADOC_FOLDER} ${VERSION} snapshot 80 | else 81 | update_link ${DOCUMENTATION_FOLDER} ${VERSION} current 82 | update_link ${JAVADOC_FOLDER} ${VERSION} current 83 | fi 84 | } 85 | 86 | function publish_all_documentation { 87 | local VERSION=$(get_version) 88 | create_documentation ${VERSION} 89 | create_javadoc ${VERSION} 90 | update_symlinks ${VERSION} 91 | } 92 | 93 | if [ ${TRAVIS} ] && [ "$TRAVIS_BRANCH" == "master" ] && [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ] 94 | then 95 | prepare_ssh 96 | configure_git 97 | publish_all_documentation 98 | git checkout master 99 | push_documentation 100 | else 101 | echo "On a branch or not on travis, doing nothing !" 102 | fi 103 | -------------------------------------------------------------------------------- /.travis/settings.xml.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FaustXVI/junit5-docker/b6bc5314246d87c844fcad127a769756edf0f66d/.travis/settings.xml.enc -------------------------------------------------------------------------------- /.travis/travis_rsa.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FaustXVI/junit5-docker/b6bc5314246d87c844fcad127a769756edf0f66d/.travis/travis_rsa.enc -------------------------------------------------------------------------------- /.travis/travis_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDqOuoaxz1RM/i1hN4HaSs4SsLyzfM/iddoe/Imjf04Ft4RaMiHeqtzVOyPf+JEb6L8wz03FHx7QJDg9yIfMhoXM/yj10qoxqdfY/ARoj/+g/yokS1m/imFPjTfp/7XSXYeGv2w4dqvKgvu5rc8NbDp4YDgoN9ujfTXOE27j6k9swoXlDpWA1JSzrnzVNoR+3qZJzbAji64Qx0oMz8ehp1byBaKf+HD576w1m9hM0AZYvft8X8jMnoruVUlprjy0ql8p/OuGE8+r9gG3lIvBwukguKH0LJDeqvcAPuEGh884tz/55hr11vcPNIiMjqKCf1bMyNTO7IjM6/D6bjIhHVKpmnWPps63JbKhh8YMi3Gzg1qziDRc0p1jNORQHo8/Pg1yCGm8O93q3E8PqAKCEplO0f0hyLod1jtAa/FfsxoF86gMCIUD4rWyOe0Monh5GPDFuyTNHDsL5b1orSsuEYkVU8nkqF07lMYt20TMsdY+VusIGPNw/bo9KceQfBEFADIqZU4p4qIbCZ5FgQfbINnUc91KDE3A5zAMl4UzLXU9T5kmEYLBsvkJwtyPs1weeNT++DAdjcXVVy5cMJNFydTEla/Hw6HCsmvwFEwNvBvlE/VGqP1IHFiiPFbYTPLHgxukuARG8+jgNcazmi41X9rPw/8bTOGF40I+/f8ntsVgQ== travis@travis.com 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | First of all, **thanks for contributing**! Here are some guidelines to make it happen in the best way possible. 4 | 5 | ## Opening an issue 6 | 7 | When you open an issue, please be as precise as possible : 8 | - if it's a bug, how can we reproduce it ? On which environment are your running ? 9 | - if it's a feature request, could you give us some examples of what you'd like ? 10 | 11 | ## Working on an issue 12 | 13 | When you start working on an issue, please make it visible as soon as possible by opening a pull request even though 14 | the problem is not fixed. 15 | 16 | ## Opening a pull request 17 | 18 | When opening a pull request, please change as little code as possible to fix the problem. If you see a way to improve 19 | the code but that doesn't fit well with what you're doing, please do it in another pull request. 20 | 21 | In the description of the pull request, please start with `Closes #XX` where `XX` is the number of the issue you're 22 | working on and list the work to do by using github's todo list markdown flavor. 23 | Then, while working on it, check it as you go. 24 | Finally, if you want your pull request to be reviewed, please set some reviewers (we'll deal with the assignee :) ) 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # junit5-docker 2 | 3 | The [testcontainers project is adding support to JUnit 5](https://github.com/testcontainers/testcontainers-java/issues/87#issuecomment-272088989) and we want to avoid unnecessary standards. 4 | This library is a small workaround while waiting for testcontainers to fully support JUnit5 but won't evolve. 5 | 6 | [![Build Status](https://travis-ci.org/FaustXVI/junit5-docker.svg?branch=master)](https://travis-ci.org/FaustXVI/junit5-docker) 7 | [![Build status](https://ci.appveyor.com/api/projects/status/j2bfqs6klneyohli/branch/master?svg=true)](https://ci.appveyor.com/project/FaustXVI/junit5-docker/branch/master) 8 | 9 | Start docker containers from your junit tests 10 | 11 | The documentation can be found here : https://faustxvi.github.io/junit5-docker/ 12 | 13 | [![Codescene analysis](https://codescene.io/projects/317/status.svg)](https://codescene.io/projects/317/jobs/latest-successful/results) 14 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | build_script: 2 | - mvn test 3 | branches: 4 | only: 5 | - master -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | # This file descibe the environment needed to build junit5-docker 2 | # Make sure you have `nix` install (https://nixos.org/nix/) 3 | # In order to create the environment, just run `nix-shell` 4 | 5 | # First, lets fix the version of the repository we will get ou dependencies from 6 | let 7 | _pkgs = import {}; 8 | nixpkgs = _pkgs.fetchFromGitHub { owner = "NixOS"; 9 | repo = "nixpkgs-channels"; 10 | rev = "1849e695b00a54cda86cb75202240d949c10c7ce"; 11 | sha256 = "1fw9ryrz1qzbaxnjqqf91yxk1pb9hgci0z0pzw53f675almmv9q2"; 12 | }; 13 | in 14 | # then override the packages with the version-fixed one 15 | with import nixpkgs {}; 16 | 17 | # now we can build our specific environment (named derivation by nix) 18 | stdenv.mkDerivation { 19 | name = "junit5-docker"; 20 | # let's declare our depencies. 21 | # The names to put here can be find thanks to the commande `nix-env -qaP "regex"` 22 | buildInputs = [ 23 | openjdk 24 | maven 25 | docker 26 | ]; 27 | # declare the environment variables we need 28 | MAVEN_OPTS = "-Djvm=${openjdk}/bin/java"; 29 | } 30 | -------------------------------------------------------------------------------- /docs/.envrc: -------------------------------------------------------------------------------- 1 | use_nix -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | _site 3 | _pages 4 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | # Site title and subtitle. This is used in _includes/header.html 2 | 3 | # if you wish to integrate disqus on pages set your shortname here 4 | disqus_shortname: '' 5 | 6 | # if you use google analytics, add your tracking id here 7 | google_analytics_id: '' 8 | 9 | # Enable/show navigation. There are there options: 10 | # 0 - always hide 11 | # 1 - always show 12 | # 2 - show only if posts are present 13 | navigation: 2 14 | 15 | # URL to source code, used in _includes/footer.html 16 | codeurl: 'https://github.com/FaustXVI/junit5-docker' 17 | 18 | # Default categories (in order) to appear in the navigation 19 | sections: [ 20 | ['doc', 'Documentation'], 21 | ['tut', 'Tutorial'], 22 | ['ref', 'Reference'], 23 | ['dev', 'Developers'], 24 | ['post', 'Posts'] 25 | ] 26 | 27 | # Keep as an empty string if served up at the root. If served up at a specific 28 | # path (e.g. on GitHub pages) leave off the trailing slash, e.g. /my-project 29 | baseurl: '' 30 | 31 | # Dates are not included in permalinks 32 | permalink: none 33 | 34 | # Syntax highlighting 35 | highlighter: rouge 36 | 37 | # Since these are pages, it doesn't really matter 38 | future: true 39 | 40 | include: ['javadoc', 'documentation'] 41 | 42 | # Exclude non-site files 43 | exclude: ['bin'] 44 | 45 | # Use the kramdown Markdown renderer 46 | markdown: kramdown 47 | redcarpet: 48 | extensions: [ 49 | 'no_intra_emphasis', 50 | 'fenced_code_blocks', 51 | 'autolink', 52 | 'strikethrough', 53 | 'superscript', 54 | 'with_toc_data', 55 | 'tables', 56 | 'hardwrap' 57 | ] 58 | 59 | kramdown: 60 | input: GFM 61 | hard_wrap: false 62 | math_engine: mathjax 63 | -------------------------------------------------------------------------------- /docs/_includes/disqus.html: -------------------------------------------------------------------------------- 1 |
2 | 13 | 14 | -------------------------------------------------------------------------------- /docs/_includes/footer.html: -------------------------------------------------------------------------------- 1 | Documentation for {{ site.title }} 2 | -------------------------------------------------------------------------------- /docs/_includes/google_analytics.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /docs/_includes/header.html: -------------------------------------------------------------------------------- 1 |

{{ site.title }} 2 | {% if site.subtitle %}{{ site.subtitle }}{% endif %} 3 |

4 | -------------------------------------------------------------------------------- /docs/_includes/navigation.html: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ site.title }}{% if page.title %} : {{ page.title }}{% endif %} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 | 22 |
23 | 24 |
25 | {% assign post_count = site.posts|size %} 26 | {% if site.navigation != 0 and site.navigation == 1 or post_count > 0 %} 27 | 30 | 31 |
32 | {{ content }} 33 |
34 | {% else %} 35 |
36 | {{ content }} 37 |
38 | {% endif %} 39 |
40 | 41 | {% if page.disqus == 1 %} 42 |
43 | {% if site.navigation == 1 or post_count > 0 %} 44 | 45 |
46 | {% include disqus.html %} 47 |
48 | {% else %} 49 |
50 | {% include disqus.html %} 51 |
52 | {% endif %} 53 |
54 | {% endif %} 55 | 56 |
57 | 60 |
61 |
62 | 63 | 112 | {% if site.google_analytics_id != "" %} 113 | {% include google_analytics.html %} 114 | {% endif %} 115 | 116 | 117 | -------------------------------------------------------------------------------- /docs/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | 10 | 11 | {{ content }} 12 | -------------------------------------------------------------------------------- /docs/_posts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FaustXVI/junit5-docker/b6bc5314246d87c844fcad127a769756edf0f66d/docs/_posts/.gitkeep -------------------------------------------------------------------------------- /docs/bin/jekyll-page: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'date' 4 | require 'optparse' 5 | 6 | options = { 7 | # Expects to be in the bin/ sub-directory by default 8 | :path => File.dirname(File.dirname(__FILE__)) 9 | } 10 | 11 | parser = OptionParser.new do |opt| 12 | opt.banner = 'usage: jekyll-page TITLE CATEGORY [FILENAME] [OPTIONS]' 13 | opt.separator '' 14 | opt.separator 'Options' 15 | opt.on('-e', '--edit', 'Edit the page') do |edit| 16 | options[:edit] = true 17 | end 18 | opt.on('-l', '--link', 'Relink pages') do |link| 19 | options[:link] = true 20 | end 21 | opt.on('-p PATH', '--path PATH', String, 'Path to project root') do |path| 22 | options[:path] = path 23 | end 24 | opt.separator '' 25 | end 26 | 27 | parser.parse! 28 | 29 | title = ARGV[0] 30 | category = ARGV[1] 31 | filename = ARGV[2] 32 | 33 | # Resolve any relative links 34 | BASE_DIR = File.expand_path(options[:path]) 35 | POSTS_DIR = "#{BASE_DIR}/_posts" 36 | PAGES_DIR = "#{BASE_DIR}/_pages" 37 | 38 | # Ensure the _posts directory exists (we are in the correct directory) 39 | if not Dir.exists?(POSTS_DIR) 40 | puts "#{POSTS_DIR} directory does not exists" 41 | exit 42 | end 43 | 44 | # Create _pages directory if it doesn't exist 45 | if not Dir.exists?(PAGES_DIR) 46 | Dir.mkdir(PAGES_DIR) 47 | end 48 | 49 | if options[:link] 50 | Dir.foreach(POSTS_DIR) do |name| 51 | next if name[0] == '.' 52 | nodate = name[/\d{4}-\d{2}-\d{2}-(?.*)/, 'rest'] 53 | if File.symlink?("#{PAGES_DIR}/#{nodate}") 54 | File.delete("#{PAGES_DIR}/#{nodate}") 55 | end 56 | abspath = File.absolute_path("#{POSTS_DIR}/#{name}") 57 | File.symlink(abspath, "#{PAGES_DIR}/#{nodate}") 58 | end 59 | end 60 | 61 | if not title or not category 62 | # This flag can be used by itself, exit silently if no arguments 63 | # are defined 64 | if not options[:link] 65 | puts parser 66 | end 67 | exit 68 | end 69 | 70 | if not filename 71 | filename = title.downcase.gsub(/[^a-z0-9\s]/, '').gsub(/\s+/, '-') 72 | end 73 | 74 | today=Date.today().strftime('%F') 75 | now=DateTime.now().strftime('%F %T') 76 | 77 | filepath = "#{POSTS_DIR}/#{today}-#{filename}.md" 78 | symlink = "#{PAGES_DIR}/#{filename}.md" 79 | 80 | if File.exists?(filepath) 81 | puts "File #{filepath} already exists" 82 | exit 83 | end 84 | 85 | content = < .page-header:first-child { 42 | margin-top: 0; 43 | } 44 | 45 | #content > .page-header:first-child h2 { 46 | margin-top: 0; 47 | } 48 | 49 | 50 | #navigation { 51 | font-size: 0.9em; 52 | } 53 | 54 | #navigation li a { 55 | padding-left: 10px; 56 | padding-right: 10px; 57 | } 58 | 59 | #navigation .nav-header { 60 | padding-left: 0; 61 | padding-right: 0; 62 | } 63 | 64 | body.rtl { 65 | direction: rtl; 66 | } 67 | 68 | body.rtl #header .brand { 69 | float: right; 70 | margin-left: 5px; 71 | } 72 | body.rtl .row-fluid [class*="span"] { 73 | float: right !important; 74 | margin-left: 0; 75 | margin-right: 2.564102564102564%; 76 | } 77 | body.rtl .row-fluid [class*="span"]:first-child { 78 | margin-right: 0; 79 | } 80 | 81 | body.rtl ul, body.rtl ol { 82 | margin: 0 25px 10px 0; 83 | } 84 | 85 | table { 86 | margin-bottom: 1rem; 87 | border: 1px solid #e5e5e5; 88 | border-collapse: collapse; 89 | } 90 | 91 | td, th { 92 | padding: .25rem .5rem; 93 | border: 1px solid #e5e5e5; 94 | } 95 | -------------------------------------------------------------------------------- /docs/css/syntax.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #ffffff; } 3 | .highlight .c { color: #888888 } /* Comment */ 4 | .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 5 | .highlight .k { color: #008800; font-weight: bold } /* Keyword */ 6 | .highlight .cm { color: #888888 } /* Comment.Multiline */ 7 | .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ 8 | .highlight .c1 { color: #888888 } /* Comment.Single */ 9 | .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ 10 | .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 11 | .highlight .ge { font-style: italic } /* Generic.Emph */ 12 | .highlight .gr { color: #aa0000 } /* Generic.Error */ 13 | .highlight .gh { color: #333333 } /* Generic.Heading */ 14 | .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 15 | .highlight .go { color: #888888 } /* Generic.Output */ 16 | .highlight .gp { color: #555555 } /* Generic.Prompt */ 17 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 18 | .highlight .gu { color: #666666 } /* Generic.Subheading */ 19 | .highlight .gt { color: #aa0000 } /* Generic.Traceback */ 20 | .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ 21 | .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ 22 | .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ 23 | .highlight .kp { color: #008800 } /* Keyword.Pseudo */ 24 | .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ 25 | .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ 26 | .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ 27 | .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ 28 | .highlight .na { color: #336699 } /* Name.Attribute */ 29 | .highlight .nb { color: #003388 } /* Name.Builtin */ 30 | .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ 31 | .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ 32 | .highlight .nd { color: #555555 } /* Name.Decorator */ 33 | .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ 34 | .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ 35 | .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ 36 | .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ 37 | .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ 38 | .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ 39 | .highlight .nv { color: #336699 } /* Name.Variable */ 40 | .highlight .ow { color: #008800 } /* Operator.Word */ 41 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ 43 | .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ 44 | .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ 45 | .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ 46 | .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ 47 | .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ 48 | .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ 49 | .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ 50 | .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ 51 | .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ 52 | .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ 53 | .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ 54 | .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ 55 | .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ 56 | .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ 57 | .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ 58 | .highlight .vc { color: #336699 } /* Name.Variable.Class */ 59 | .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ 60 | .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ 61 | .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /docs/current: -------------------------------------------------------------------------------- 1 | documentation/current -------------------------------------------------------------------------------- /docs/default.nix: -------------------------------------------------------------------------------- 1 | { }: 2 | 3 | let 4 | pkgs = import { }; 5 | in 6 | pkgs.stdenv.mkDerivation { 7 | name = "junit5-docker-jekyll"; 8 | buildInputs = [ 9 | pkgs.jekyll 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /docs/documentation/1.0.0-RC1/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: JUnit5-Docker 4 | category: doc 5 | order: 0 6 | --- 7 | 8 | [`JUnit5-Docker`](https://github.com/FaustXVI/junit5-docker) is a `JUnit5` extension that start docker containers before running tests and stop them afterwards. 9 | _This is the documentation for the version 1.0.0-RC1._ 10 | 11 | _The last released version can be found at [https://faustxvi.github.io/junit5-docker/current](https://faustxvi.github.io/junit5-docker/current) and the documentation of the under developpment version can be found at [https://faustxvi.github.io/junit5-docker/snapshot](https://faustxvi.github.io/junit5-docker/snapshot)_ 12 | 13 | ## Dependency 14 | 15 | {% if "1.0.0-RC1" contains "SNAPSHOT" %} 16 | 17 | Since this is a SNAPSHOT version, you can't find it on maven central so you'll need to add the repository to your `pom.xml` like this : 18 | 19 | ```xml 20 | 21 | 22 | https://oss.sonatype.org/content/repositories/snapshots/ 23 | ossrh 24 | 25 | 26 | ``` 27 | 28 | {% endif %} 29 | 30 | To use `JUnit5-Docker`, you first need to declare it as a dependency. Add these lines to your `pom.xml` if you are using maven. 31 | 32 | ```xml 33 | 34 | com.github.faustxvi 35 | junit5-docker 36 | 1.0.0-RC1 37 | test 38 | 39 | ``` 40 | 41 | ## Usage 42 | 43 | The entrypoint is the `@Docker` annotation. 44 | Please refer to the [Javadoc](https://faustxvi.github.io/junit5-docker/javadoc/1.0.0-RC1) for more details. 45 | 46 | The container is started once for the whole class and before any test method is called; and stopped afterward. 47 | 48 | This mean that the container is already started when the `@BeforeEach` and `@BeforeAll` methods are called and destroyed after the `@AfterEach` and `@AfterAll` methods. 49 | 50 | Be aware that the container is not restarted between tests so changing the state of the container in one test may affect other tests. 51 | 52 | ### Simple Example 53 | 54 | Given that you have a test like : 55 | 56 | ```java 57 | @Docker(image = "faustxvi/simple-two-ports", ports = @Port(exposed = 8801, inner = 8080)) 58 | public class MyAwesomeTest { 59 | 60 | @Test 61 | void checkMyCode() { 62 | // Add your test content here 63 | } 64 | 65 | } 66 | ``` 67 | 68 | When you run your test : 69 | 70 | * the container "faustxvi/simple-two-ports" is started before running your tests 71 | * the port 8801 is bound to the container's port 8080 so you can exchange through this port 72 | * the container is stopped and removed after your tests 73 | 74 | 75 | ### Real life exemple 76 | 77 | Given that you have a test like : 78 | 79 | ```java 80 | @Docker(image = "mysql", ports = @Port(exposed = 8801, inner = 3306), 81 | environments = { 82 | @Environment(key = "MYSQL_ROOT_PASSWORD", value = "root"), 83 | @Environment(key = "MYSQL_DATABASE", value = "testdb"), 84 | @Environment(key = "MYSQL_USER", value = "testuser"), 85 | @Environment(key = "MYSQL_PASSWORD", value = "s3cr3t"), 86 | }, 87 | waitFor = @WaitFor("mysqld: ready for connections")) 88 | public class MyAwesomeTest { 89 | 90 | @Test 91 | void checkMyCode() { 92 | // Add your test content here 93 | } 94 | 95 | } 96 | ``` 97 | 98 | When you run your test : 99 | 100 | * the container is started with the given environment variables 101 | * the tests are started only after the string "started" is found in the container's logs 102 | 103 | -------------------------------------------------------------------------------- /docs/documentation/1.0.0-RC2/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: JUnit5 Docker 4 | category: doc 5 | order: 0 6 | --- 7 | 8 | [`JUnit5-Docker`](https://github.com/FaustXVI/junit5-docker) is a `JUnit5` extension that start docker containers before running tests and stop them afterwards. 9 | _This is the documentation for the version 1.0.0-RC2._ 10 | 11 | _The last released version can be found at [https://faustxvi.github.io/junit5-docker/current](https://faustxvi.github.io/junit5-docker/current) and the documentation of the under developpment version can be found at [https://faustxvi.github.io/junit5-docker/snapshot](https://faustxvi.github.io/junit5-docker/snapshot)_ 12 | 13 | Dependency 14 | ---------- 15 | 16 | {% if "1.0.0-RC2" contains "SNAPSHOT" %} 17 | 18 | Since this is a SNAPSHOT version, you can't find it on maven central so you'll need to add the repository to your `pom.xml` like this : 19 | 20 | ```xml 21 | 22 | 23 | https://oss.sonatype.org/content/repositories/snapshots/ 24 | ossrh 25 | 26 | 27 | ``` 28 | 29 | {% endif %} 30 | 31 | To use `JUnit5-Docker`, you first need to declare it as a dependency. Add these lines to your `pom.xml` if you are using maven. 32 | 33 | ```xml 34 | 35 | com.github.faustxvi 36 | junit5-docker 37 | 1.0.0-RC2 38 | test 39 | 40 | ``` 41 | 42 | Usage 43 | ----- 44 | 45 | The entrypoint is the `@Docker` annotation. 46 | Please refer to the [Javadoc](https://faustxvi.github.io/junit5-docker/javadoc/1.0.0-RC2) for more details. 47 | 48 | The container is started once for the whole class and before any test method is called; and stopped afterward. 49 | 50 | This mean that the container is already started when the `@BeforeEach` and `@BeforeAll` methods are called and destroyed after the `@AfterEach` and `@AfterAll` methods. 51 | 52 | Be aware that the container is not restarted between tests so changing the state of the container in one test may affect other tests. 53 | 54 | ### Simple Example 55 | 56 | Given that you have a test like : 57 | 58 | ```java 59 | @Docker(image = "faustxvi/simple-two-ports", ports = @Port(exposed = 8801, inner = 8080)) 60 | public class MyAwesomeTest { 61 | 62 | @Test 63 | void checkMyCode() { 64 | // Add your test content here 65 | } 66 | 67 | } 68 | ``` 69 | 70 | When you run your test : 71 | 72 | * the container `faustxvi/simple-two-ports` is started before running your tests using the version `latest` 73 | * the port `8801` is bound to the container's port `8080` so you can exchange through this port 74 | * the container is stopped and removed after your tests 75 | 76 | 77 | ### Real life exemple 78 | 79 | Given that you have a test like : 80 | 81 | ```java 82 | @Docker(image = "mysql", ports = @Port(exposed = 8801, inner = 3306), 83 | environments = { 84 | @Environment(key = "MYSQL_ROOT_PASSWORD", value = "root"), 85 | @Environment(key = "MYSQL_DATABASE", value = "testdb"), 86 | @Environment(key = "MYSQL_USER", value = "testuser"), 87 | @Environment(key = "MYSQL_PASSWORD", value = "s3cr3t"), 88 | }, 89 | waitFor = @WaitFor("mysqld: ready for connections")) 90 | public class MyAwesomeTest { 91 | 92 | @Test 93 | void checkMyCode() { 94 | // Add your test content here 95 | } 96 | 97 | } 98 | ``` 99 | 100 | When you run your test : 101 | 102 | * the container is started with the given environment variables 103 | * the tests are started only after the string `mysqld: ready for connections` is found in the container's logs 104 | 105 | -------------------------------------------------------------------------------- /docs/documentation/current: -------------------------------------------------------------------------------- 1 | 1.0.0-RC5 -------------------------------------------------------------------------------- /docs/documentation/snapshot: -------------------------------------------------------------------------------- 1 | 1.0.1-SNAPSHOT -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | documentation/current/index.md -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/com/github/junit5docker/class-use/Port.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class com.github.junit5docker.Port (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
com.github.junit5docker.Port

73 |
74 |
No usage of com.github.junit5docker.Port
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.0-RC1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.0-RC1 API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC1/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/com/github/junit5docker/class-use/Port.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class com.github.junit5docker.Port (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
com.github.junit5docker.Port

73 |
74 |
No usage of com.github.junit5docker.Port
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.0-RC2 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2016. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.0-RC2 API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC2/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/com/github/junit5docker/class-use/Port.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class com.github.junit5docker.Port (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
com.github.junit5docker.Port

73 |
74 |
No usage of com.github.junit5docker.Port
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.0-RC3 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.0-RC3 API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC3/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC4 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC4 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.0-RC4 API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.0-RC4 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.0-RC4 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.0-RC4 API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC4/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC5 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.0-RC5 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.0-RC5 API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.0-RC5 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.0-RC5 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.0-RC5 API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.0-RC5/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.1-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (JUnit5-Docker 1.0.1-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/com/github/junit5docker/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.github.junit5docker (JUnit5-Docker 1.0.1-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 |

com.github.junit5docker

13 |
14 |

Annotation Types

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/com/github/junit5docker/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package com.github.junit5docker (JUnit5-Docker 1.0.1-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
com.github.junit5docker

73 |
74 |
No usage of com.github.junit5docker
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Deprecated List (JUnit5-Docker 1.0.1-SNAPSHOT API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2017. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JUnit5-Docker 1.0.1-SNAPSHOT API 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>JavaScript is disabled on your browser.</div> 68 | </noscript> 69 | <h2>Frame Alert</h2> 70 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/github/junit5docker/package-summary.html">Non-frame version</a>.</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/package-list: -------------------------------------------------------------------------------- 1 | com.github.junit5docker 2 | -------------------------------------------------------------------------------- /docs/javadoc/1.0.1-SNAPSHOT/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/current: -------------------------------------------------------------------------------- 1 | 1.0.0-RC5 -------------------------------------------------------------------------------- /docs/javadoc/snapshot: -------------------------------------------------------------------------------- 1 | 1.0.1-SNAPSHOT -------------------------------------------------------------------------------- /docs/snapshot: -------------------------------------------------------------------------------- 1 | documentation/snapshot -------------------------------------------------------------------------------- /images-for-tests/.envrc: -------------------------------------------------------------------------------- 1 | use_nix -------------------------------------------------------------------------------- /images-for-tests/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | _pkgs = import {}; 3 | in 4 | { pkgs ? import (_pkgs.fetchFromGitHub { owner = "NixOS"; 5 | repo = "nixpkgs-channels"; 6 | rev = "759620505595d72879d1d8c74a59c0868cce8f71"; 7 | sha256 = "05x9szam0yqjdiz69px165krzsycsa419yq0zsv6s5lczmbl7cvn"; 8 | }) {} 9 | }: 10 | 11 | pkgs.stdenv.mkDerivation rec { 12 | name = "docker-images"; 13 | env = pkgs.buildEnv { name = name; paths = buildInputs; }; 14 | buildInputs = [ 15 | pkgs.go 16 | pkgs.docker 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /images-for-tests/log-and-quit/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY hello / 3 | ENTRYPOINT ["/hello"] 4 | EXPOSE 8080 5 | -------------------------------------------------------------------------------- /images-for-tests/log-and-quit/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | docker run -v $(pwd):/go \ 5 | -e CGO_ENABLED=0 \ 6 | golang:1.6.3-alpine \ 7 | go build -a --installsuffix cgo --ldflags="-s" -o ./hello 8 | 9 | docker build -t faustxvi/log-and-quit . 10 | docker push faustxvi/log-and-quit 11 | 12 | -------------------------------------------------------------------------------- /images-for-tests/log-and-quit/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "log" 4 | 5 | func main() { 6 | log.Print("started") 7 | } 8 | -------------------------------------------------------------------------------- /images-for-tests/open-port-later/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY hello / 3 | ENTRYPOINT ["/hello"] 4 | EXPOSE 8080 5 | -------------------------------------------------------------------------------- /images-for-tests/open-port-later/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | docker run -v $(pwd):/go \ 5 | -e CGO_ENABLED=0 \ 6 | golang:1.6.3-alpine \ 7 | go build -a --installsuffix cgo --ldflags="-s" -o ./hello 8 | 9 | docker build -t faustxvi/open-port-later . 10 | docker push faustxvi/open-port-later 11 | 12 | -------------------------------------------------------------------------------- /images-for-tests/open-port-later/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | "os" 8 | "time" 9 | ) 10 | 11 | const ( 12 | waitEnv = "WAITING_TIME" 13 | ) 14 | 15 | func main() { 16 | waitingTimeEnv := os.Getenv(waitEnv) 17 | waitingTime, err := time.ParseDuration(waitingTimeEnv) 18 | if err != nil { 19 | os.Exit(1) 20 | } 21 | time.Sleep(waitingTime) 22 | log.Print("started") 23 | startHTTPOn("/hello", "8080", helloHandler) 24 | } 25 | 26 | func startHTTPOn(path string, port string, handler http.HandlerFunc) { 27 | http.HandleFunc(path, handler) 28 | log.Fatal(http.ListenAndServe(":"+port, nil)) 29 | } 30 | 31 | func helloHandler(writer http.ResponseWriter, request *http.Request) { 32 | fmt.Fprintf(writer, "Hello world\n") 33 | } 34 | -------------------------------------------------------------------------------- /images-for-tests/simple-two-ports/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY hello / 3 | ENTRYPOINT ["/hello"] 4 | EXPOSE 8080 8081 5 | -------------------------------------------------------------------------------- /images-for-tests/simple-two-ports/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | docker run -v $(pwd):/go \ 5 | -e CGO_ENABLED=0 \ 6 | golang:1.6.3-alpine \ 7 | go build -a --installsuffix cgo --ldflags="-s" -o ./hello 8 | 9 | docker build -t faustxvi/simple-two-ports . 10 | docker push faustxvi/simple-two-ports 11 | 12 | docker build -t faustxvi/simple-two-ports:wrong-one - < 2 | 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 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/DefaultDockerClient.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import com.github.dockerjava.api.DockerClient; 4 | import com.github.dockerjava.api.exception.NotFoundException; 5 | import com.github.dockerjava.api.model.ExposedPort; 6 | import com.github.dockerjava.api.model.Ports; 7 | import com.github.dockerjava.core.DockerClientBuilder; 8 | import com.github.dockerjava.core.command.PullImageResultCallback; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | import java.util.stream.Stream; 13 | 14 | import static com.github.dockerjava.api.model.ExposedPort.tcp; 15 | import static com.github.dockerjava.api.model.Ports.Binding.bindPort; 16 | import static com.github.dockerjava.core.DefaultDockerClientConfig.createDefaultConfigBuilder; 17 | import static java.util.stream.Collectors.toList; 18 | 19 | class DefaultDockerClient implements DockerClientAdapter { 20 | 21 | private final DockerClient dockerClient; 22 | 23 | DefaultDockerClient() { 24 | dockerClient = DockerClientBuilder.getInstance(createDefaultConfigBuilder().withApiVersion("1.22")).build(); 25 | } 26 | 27 | @Override 28 | public String startContainer(String wantedImage, Map environment, PortBinding... portBinding) { 29 | Ports bindings = createPortBindings(portBinding); 30 | List environmentStrings = createEnvironmentList(environment); 31 | String containerId = createContainer(wantedImage, bindings, environmentStrings); 32 | dockerClient.startContainerCmd(containerId).exec(); 33 | return containerId; 34 | } 35 | 36 | @Override 37 | public void stopAndRemoveContainer(String containerId) { 38 | dockerClient.stopContainerCmd(containerId).exec(); 39 | dockerClient.removeContainerCmd(containerId).withRemoveVolumes(true).exec(); 40 | } 41 | 42 | @Override 43 | public Stream logs(String containerId) { 44 | return dockerClient.logContainerCmd(containerId).withFollowStream(true) 45 | .withStdOut(true) 46 | .withStdErr(true) 47 | .exec(new StreamLog()) 48 | .stream(); 49 | } 50 | 51 | private String createContainer(String wantedImage, Ports bindings, List environmentStrings) { 52 | String imageWithVersion = wantedImage; 53 | if (!imageWithVersion.contains(":")) { 54 | imageWithVersion += ":latest"; 55 | } 56 | this.ensureImageExists(imageWithVersion); 57 | return dockerClient.createContainerCmd(imageWithVersion) 58 | .withEnv(environmentStrings) 59 | .withPortBindings(bindings) 60 | .exec().getId(); 61 | } 62 | 63 | private List createEnvironmentList(Map environment) { 64 | return environment.entrySet().stream().map(this::toEnvString).collect(toList()); 65 | } 66 | 67 | private Ports createPortBindings(PortBinding... portBinding) { 68 | Ports bindings = new Ports(); 69 | for (PortBinding binding : portBinding) { 70 | ExposedPort inner = tcp(binding.inner); 71 | bindings.bind(inner, bindPort(binding.exposed)); 72 | } 73 | return bindings; 74 | } 75 | 76 | private String toEnvString(Map.Entry environmentEntry) { 77 | return environmentEntry.getKey() + "=" + environmentEntry.getValue(); 78 | } 79 | 80 | private void ensureImageExists(String wantedImage) { 81 | try { 82 | dockerClient.inspectImageCmd(wantedImage).exec(); 83 | } catch (NotFoundException e) { 84 | dockerClient.pullImageCmd(wantedImage).exec(new PullImageResultCallback()).awaitSuccess(); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/Docker.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.junit.jupiter.api.extension.ExtendWith; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | import static com.github.junit5docker.WaitFor.NOTHING; 11 | 12 | /** 13 | *

This annotation is the junit-docker entry point.

14 | * 15 | *

Adding this annotation to a test's class will start a docker container before running the tests and will be stop 16 | * at the end of the tests. This is done once per class.

17 | * 18 | * @since 1.0 19 | */ 20 | @Target({ElementType.TYPE}) 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @ExtendWith(DockerExtension.class) 23 | public @interface Docker { 24 | 25 | /** 26 | * @return the image's name to start. 27 | */ 28 | String image(); 29 | 30 | /** 31 | * @return the port mapping to send to docker. This is required since at least one port must be visible for the 32 | * container to be useful. 33 | * @see Port 34 | */ 35 | Port[] ports(); 36 | 37 | /** 38 | * @return the optional environment variables to pass to the docker container. 39 | * @see Environment 40 | */ 41 | Environment[] environments() default {}; 42 | 43 | /** 44 | * @return the optional log to wait for before running the tests. 45 | * @see WaitFor 46 | */ 47 | WaitFor waitFor() default @WaitFor(NOTHING); 48 | 49 | /** 50 | * @return true if the container should be recreated for each test case. 51 | * False if it should be created only once for the test class. 52 | */ 53 | boolean newForEachCase() default true; 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/DockerClientAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import java.util.Map; 4 | import java.util.stream.Stream; 5 | 6 | interface DockerClientAdapter { 7 | String startContainer(String wantedImage, Map environment, PortBinding... portBinding); 8 | 9 | void stopAndRemoveContainer(String containerId); 10 | 11 | Stream logs(String containerId); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/Environment.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | /** 4 | * Describes an environment variable to set for a docker container. 5 | * 6 | * @since 1.0 7 | */ 8 | public @interface Environment { 9 | 10 | /** 11 | * @return the environment's variable name. 12 | */ 13 | String key(); 14 | 15 | /** 16 | * @return the environment's variable value. 17 | */ 18 | String value(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/Port.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | /** 4 | * Describes a port binding for a docker container. 5 | * 6 | * @since 1.0 7 | */ 8 | public @interface Port { 9 | 10 | /** 11 | * This is the port number to use in the test code for data exchange with the container. 12 | * 13 | * @return the port number exposed on the host. 14 | */ 15 | int exposed(); 16 | 17 | /** 18 | * This is the port number used by the application inside the container. 19 | * 20 | * @return the port number declared by the container. 21 | */ 22 | int inner(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/PortBinding.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import java.util.Objects; 4 | 5 | final class PortBinding { 6 | 7 | final int exposed; 8 | 9 | final int inner; 10 | 11 | PortBinding(int exposed, int inner) { 12 | this.exposed = exposed; 13 | this.inner = inner; 14 | } 15 | 16 | @Override 17 | public boolean equals(Object other) { 18 | if (this == other) return true; 19 | if (other == null || getClass() != other.getClass()) return false; 20 | PortBinding that = (PortBinding) other; 21 | return exposed == that.exposed 22 | && inner == that.inner; 23 | } 24 | 25 | @Override 26 | public int hashCode() { 27 | return Objects.hash(exposed, inner); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/QueueIterator.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import java.util.Iterator; 4 | import java.util.NoSuchElementException; 5 | import java.util.Optional; 6 | import java.util.concurrent.BlockingQueue; 7 | import java.util.concurrent.TimeUnit; 8 | import java.util.concurrent.atomic.AtomicBoolean; 9 | 10 | import static java.lang.Thread.currentThread; 11 | import static java.util.Optional.empty; 12 | import static java.util.Optional.ofNullable; 13 | 14 | class QueueIterator implements Iterator, AutoCloseable { 15 | 16 | private static final int POLL_TIMEOUT = 10; 17 | 18 | private final AtomicBoolean opened; 19 | 20 | private final BlockingQueue lines; 21 | 22 | private Optional lineRead = empty(); 23 | 24 | QueueIterator(BlockingQueue lines) { 25 | this.opened = new AtomicBoolean(true); 26 | this.lines = lines; 27 | } 28 | 29 | @Override 30 | public boolean hasNext() { 31 | while (opened.get() && !lineRead.isPresent()) { 32 | try { 33 | lineRead = ofNullable(lines.poll(POLL_TIMEOUT, TimeUnit.MILLISECONDS)); 34 | } catch (InterruptedException e) { 35 | opened.set(false); 36 | currentThread().interrupt(); 37 | } 38 | } 39 | return lineRead.isPresent(); 40 | } 41 | 42 | @Override 43 | public String next() { 44 | if (!lineRead.isPresent()) throw new NoSuchElementException("Line read is null"); 45 | String result = lineRead.get(); 46 | lineRead = empty(); 47 | return result; 48 | } 49 | 50 | @Override 51 | public void close() { 52 | opened.set(false); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/StreamLog.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import com.github.dockerjava.api.model.Frame; 4 | import com.github.dockerjava.core.command.LogContainerResultCallback; 5 | 6 | import java.io.IOException; 7 | import java.nio.charset.Charset; 8 | import java.util.concurrent.ArrayBlockingQueue; 9 | import java.util.concurrent.BlockingQueue; 10 | import java.util.stream.Stream; 11 | import java.util.stream.StreamSupport; 12 | 13 | import static java.lang.Thread.currentThread; 14 | import static java.util.Spliterators.spliteratorUnknownSize; 15 | 16 | class StreamLog extends LogContainerResultCallback { 17 | 18 | private static final Charset UTF_8 = Charset.forName("UTF-8"); 19 | 20 | private final BlockingQueue lines = new ArrayBlockingQueue<>(1); 21 | 22 | private final QueueIterator queueIterator = new QueueIterator(lines); 23 | 24 | @Override 25 | public void onNext(Frame item) { 26 | try { 27 | lines.put(new String(item.getPayload(), UTF_8)); 28 | } catch (InterruptedException e) { 29 | currentThread().interrupt(); 30 | } 31 | } 32 | 33 | @Override 34 | public void onComplete() { 35 | super.onComplete(); 36 | queueIterator.close(); 37 | } 38 | 39 | @Override 40 | public void onError(Throwable throwable) { 41 | super.onError(throwable); 42 | queueIterator.close(); 43 | } 44 | 45 | public Stream stream() { 46 | return StreamSupport.stream(spliteratorUnknownSize(queueIterator, 0), false) 47 | .onClose(() -> { 48 | try { 49 | this.close(); 50 | } catch (IOException e) { 51 | throw new IllegalStateException(e); 52 | } 53 | }); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/github/junit5docker/WaitFor.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | /** 4 | *

Asks JUnit-docker to wait for something to appear in the container's log before running any test.

5 | * 6 | * @since 1.0 7 | */ 8 | public @interface WaitFor { 9 | 10 | /** 11 | *

Special value. 12 | * If used, JUnit-docker does not wait for anything and just start the tests.

13 | *

This is the default value in {@link Docker}

14 | */ 15 | static final String NOTHING = ""; 16 | 17 | /** 18 | * The default timeout duration. 19 | */ 20 | static final int DEFAULT_TIMEOUT = 10 * 1000; 21 | 22 | /** 23 | * @return the log text to wait for. 24 | */ 25 | String value(); 26 | 27 | /** 28 | * @return the time in milliseconds to wait for the log before giving up. 29 | */ 30 | int timeoutInMillis() default DEFAULT_TIMEOUT; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/PortBindingTest.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import nl.jqno.equalsverifier.EqualsVerifier; 4 | import org.junit.jupiter.api.Test; 5 | 6 | class PortBindingTest { 7 | 8 | @Test 9 | void shouldValidateEqualsContract() { 10 | EqualsVerifier.forClass(PortBinding.class).verify(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/QueueIteratorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Nested; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.NoSuchElementException; 9 | import java.util.concurrent.ArrayBlockingQueue; 10 | import java.util.concurrent.BlockingQueue; 11 | import java.util.concurrent.CountDownLatch; 12 | import java.util.concurrent.ExecutorService; 13 | import java.util.concurrent.Executors; 14 | 15 | import static com.github.junit5docker.assertions.CountDownLatchAssertions.assertThat; 16 | import static com.github.junit5docker.assertions.ExecutionAssertions.assertNoInterruptionThrown; 17 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 18 | import static org.assertj.core.api.Assertions.assertThat; 19 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType; 20 | 21 | public class QueueIteratorTest { 22 | 23 | private BlockingQueue lines; 24 | 25 | private QueueIterator iterator; 26 | 27 | @BeforeEach 28 | public void createIterater() { 29 | lines = new ArrayBlockingQueue<>(1); 30 | iterator = new QueueIterator(lines); 31 | } 32 | 33 | @Test 34 | public void shouldHaveNothingIfClosed() throws InterruptedException { 35 | iterator.close(); 36 | lines.put("a line"); 37 | assertThat(iterator.hasNext()).isFalse(); 38 | } 39 | 40 | @Test 41 | public void shouldHaveContentIfDataIsInQueue() throws InterruptedException { 42 | lines.put("a line"); 43 | assertThat(iterator.hasNext()).isTrue(); 44 | assertThat(iterator.next()).isEqualTo("a line"); 45 | } 46 | 47 | @Test 48 | public void shouldReadLineOnlyOnce() throws InterruptedException { 49 | lines.put("a line"); 50 | iterator.hasNext(); 51 | iterator.next(); 52 | iterator.close(); 53 | assertThat(iterator.hasNext()).isFalse(); 54 | } 55 | 56 | @Test 57 | public void shouldThrowAnExceptionIfNoElement() throws InterruptedException { 58 | lines.put("a line"); 59 | iterator.hasNext(); 60 | iterator.next(); 61 | assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(() -> iterator.next()); 62 | } 63 | 64 | @Test 65 | public void shouldInterruptIfThreadIsInterrupted() { 66 | Thread.currentThread().interrupt(); 67 | assertThat(iterator.hasNext()).isFalse(); 68 | assertThat(Thread.interrupted()).isTrue(); 69 | } 70 | 71 | @Nested 72 | class InAMultiThreadContext { 73 | 74 | private ExecutorService executor; 75 | 76 | @BeforeEach 77 | public void createOtherThread() { 78 | executor = Executors.newSingleThreadExecutor(); 79 | } 80 | 81 | @AfterEach 82 | public void stopExecutor() { 83 | executor.shutdownNow(); 84 | } 85 | 86 | @Test 87 | void shouldInterruptIfClosedByAnotherThread() throws InterruptedException { 88 | CountDownLatch hasNextStarted = new CountDownLatch(1); 89 | CountDownLatch hasNextReturned = new CountDownLatch(1); 90 | executor.submit(() -> { 91 | hasNextStarted.countDown(); 92 | iterator.hasNext(); 93 | hasNextReturned.countDown(); 94 | }); 95 | hasNextStarted.await(); 96 | iterator.close(); 97 | assertThat(hasNextReturned) 98 | .overridingErrorMessage("hasNext should have returned") 99 | .isDownBefore(100, MILLISECONDS); 100 | } 101 | 102 | @Test 103 | void shouldGiveFirstLineEvenAfterTwoCallToHasNext() { 104 | CountDownLatch firstLinePushed = new CountDownLatch(1); 105 | executor.submit(assertNoInterruptionThrown(() -> { 106 | lines.put("a line"); 107 | firstLinePushed.countDown(); 108 | })); 109 | executor.submit(assertNoInterruptionThrown(() -> { 110 | firstLinePushed.await(); 111 | lines.put("a line 2"); 112 | })); 113 | assertThat(iterator.hasNext()).isTrue(); 114 | assertThat(iterator.hasNext()).isTrue(); 115 | assertThat(iterator.next()).isEqualTo("a line"); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/StartDockerContainerIT.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.apache.http.client.methods.CloseableHttpResponse; 4 | import org.apache.http.client.methods.HttpGet; 5 | import org.apache.http.impl.client.HttpClientBuilder; 6 | import org.junit.jupiter.api.AfterEach; 7 | import org.junit.jupiter.api.BeforeEach; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import java.io.IOException; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.assertj.core.api.Assertions.fail; 14 | 15 | 16 | @Docker(image = "faustxvi/simple-two-ports", ports = @Port(exposed = 8801, inner = 8080)) 17 | public class StartDockerContainerIT { 18 | 19 | @BeforeEach 20 | void verifyContainerIsReady() { 21 | checkConnectionToContainer(); 22 | } 23 | 24 | @Test 25 | void verifyFirstContainerIsStarted() { 26 | checkConnectionToContainer(); 27 | } 28 | 29 | @AfterEach 30 | void verifyContainerIsStillAlive() { 31 | checkConnectionToContainer(); 32 | } 33 | 34 | private void checkConnectionToContainer() { 35 | try (CloseableHttpResponse container = HttpClientBuilder.create().build() 36 | .execute(new HttpGet("http://localhost:8801"))) { 37 | assertThat(container).isNotNull(); 38 | } catch (IOException e) { 39 | fail("The port 8801 should be listening"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/StartDockerContainerWithEnvironmentVariableIT.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.apache.http.client.methods.CloseableHttpResponse; 4 | import org.apache.http.client.methods.HttpGet; 5 | import org.apache.http.impl.client.HttpClientBuilder; 6 | import org.apache.http.util.EntityUtils; 7 | import org.junit.jupiter.api.AfterEach; 8 | import org.junit.jupiter.api.BeforeEach; 9 | import org.junit.jupiter.api.Test; 10 | 11 | import java.io.IOException; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | import static org.assertj.core.api.Assertions.fail; 15 | 16 | 17 | @Docker(image = "faustxvi/simple-two-ports", ports = @Port(exposed = 8080, inner = 8080), 18 | environments = {@Environment(key = "test", value = "42"), @Environment(key = "toRead", value = "theAnswer")}) 19 | public class StartDockerContainerWithEnvironmentVariableIT { 20 | 21 | @BeforeEach 22 | void verifyContainerIsReady() { 23 | checkConnectionsToContainer(); 24 | } 25 | 26 | @Test 27 | void verifyFirstContainerIsStarted() { 28 | checkConnectionsToContainer(); 29 | } 30 | 31 | @AfterEach 32 | void verifyContainerIsStillAlive() { 33 | checkConnectionsToContainer(); 34 | } 35 | 36 | private void checkConnectionsToContainer() { 37 | checkConnectionToContainer(); 38 | } 39 | 40 | private void checkConnectionToContainer() { 41 | try (CloseableHttpResponse container = HttpClientBuilder.create().build() 42 | .execute(new HttpGet("http://localhost:8080/env")) 43 | ) { 44 | assertThat(container).isNotNull(); 45 | String[] envs = EntityUtils.toString(container.getEntity()).split("\\n"); 46 | assertThat(envs).contains("test=42", "toRead=theAnswer"); 47 | } catch (IOException e) { 48 | fail("The port 8080 should be listening"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/StartDockerContainerWithMultiplePortsIT.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.apache.http.client.methods.CloseableHttpResponse; 4 | import org.apache.http.client.methods.HttpGet; 5 | import org.apache.http.impl.client.HttpClientBuilder; 6 | import org.junit.jupiter.api.AfterEach; 7 | import org.junit.jupiter.api.BeforeEach; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import java.io.IOException; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.assertj.core.api.Assertions.fail; 14 | 15 | 16 | @Docker(image = "faustxvi/simple-two-ports", ports = {@Port(exposed = 8080, inner = 8080), @Port(exposed = 8443, inner = 17 | 8081)}) 18 | public class StartDockerContainerWithMultiplePortsIT { 19 | 20 | @BeforeEach 21 | void verifyContainerIsReady() { 22 | checkConnectionsToContainer(); 23 | } 24 | 25 | @Test 26 | void verifyFirstContainerIsStarted() { 27 | checkConnectionsToContainer(); 28 | } 29 | 30 | @AfterEach 31 | void verifyContainerIsStillAlive() { 32 | checkConnectionsToContainer(); 33 | } 34 | 35 | private void checkConnectionsToContainer() { 36 | checkConnectionToContainer(8080); 37 | checkConnectionToContainer(8443); 38 | } 39 | 40 | private void checkConnectionToContainer(int port) { 41 | try (CloseableHttpResponse container = HttpClientBuilder.create().build() 42 | .execute(new HttpGet("http://localhost:" + port + "/env")) 43 | ) { 44 | assertThat(container).isNotNull(); 45 | } catch (IOException e) { 46 | fail("The port " + port + " should be listening"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/WaitForLogIT.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker; 2 | 3 | import org.apache.http.client.methods.CloseableHttpResponse; 4 | import org.apache.http.client.methods.HttpGet; 5 | import org.apache.http.impl.client.HttpClientBuilder; 6 | import org.junit.jupiter.api.AfterEach; 7 | import org.junit.jupiter.api.BeforeEach; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import java.io.IOException; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.assertj.core.api.Assertions.fail; 14 | 15 | 16 | @Docker(image = "faustxvi/open-port-later", ports = @Port(exposed = 8801, inner = 8080), 17 | environments = @Environment(key = "WAITING_TIME", value = "1s"), 18 | waitFor = @WaitFor("started")) 19 | public class WaitForLogIT { 20 | 21 | @BeforeEach 22 | void verifyContainerIsReady() { 23 | checkConnectionToContainer(); 24 | } 25 | 26 | @Test 27 | void verifyFirstContainerIsStarted() { 28 | checkConnectionToContainer(); 29 | } 30 | 31 | @AfterEach 32 | void verifyContainerIsStillAlive() { 33 | checkConnectionToContainer(); 34 | } 35 | 36 | private void checkConnectionToContainer() { 37 | try (CloseableHttpResponse container = HttpClientBuilder.create().build() 38 | .execute(new HttpGet("http://localhost:8801"))) { 39 | assertThat(container).isNotNull(); 40 | } catch (IOException e) { 41 | fail("The port 8801 should be listening"); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/assertions/CountDownLatchAssertions.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.assertions; 2 | 3 | import org.assertj.core.api.AbstractAssert; 4 | import org.assertj.core.error.BasicErrorMessageFactory; 5 | 6 | import java.util.concurrent.CountDownLatch; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import static org.junit.jupiter.api.Assertions.fail; 10 | 11 | public final class CountDownLatchAssertions extends AbstractAssert { 12 | 13 | private CountDownLatchAssertions(CountDownLatch actual) { 14 | super(actual, CountDownLatchAssertions.class); 15 | } 16 | 17 | public static CountDownLatchAssertions assertThat(CountDownLatch actual) { 18 | return new CountDownLatchAssertions(actual); 19 | } 20 | 21 | public CountDownLatchAssertions isDownBefore(int timeout, TimeUnit timeUnit) { 22 | boolean await = waitFor(timeout, timeUnit); 23 | if (!await) throwAssertionError(new ShouldBeDownBefore(timeout, timeUnit)); 24 | return this; 25 | } 26 | 27 | public CountDownLatchAssertions isUpAfter(int timeout, TimeUnit timeUnit) { 28 | boolean await = waitFor(timeout, timeUnit); 29 | if (await) throwAssertionError(new ShouldBeUpAfter(timeout, timeUnit)); 30 | return this; 31 | } 32 | 33 | private boolean waitFor(int timeout, TimeUnit timeUnit) { 34 | boolean await = false; 35 | try { 36 | await = actual.await(timeout, timeUnit); 37 | } catch (InterruptedException e) { 38 | Thread.currentThread().interrupt(); 39 | fail("Test has been interrupted"); 40 | } 41 | return await; 42 | } 43 | 44 | private static class ShouldBeDownBefore extends BasicErrorMessageFactory { 45 | 46 | ShouldBeDownBefore(int timeout, TimeUnit timeUnit) { 47 | super("Count down latch expected to be down after %d %s", timeout, timeUnit); 48 | } 49 | } 50 | 51 | private static class ShouldBeUpAfter extends BasicErrorMessageFactory { 52 | 53 | ShouldBeUpAfter(int timeout, TimeUnit timeUnit) { 54 | super("Count down latch expected to still be up after %d %s", timeout, timeUnit); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/assertions/ExecutionAssertions.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.assertions; 2 | 3 | import static org.junit.jupiter.api.Assertions.fail; 4 | 5 | public final class ExecutionAssertions { 6 | 7 | private ExecutionAssertions() { 8 | } 9 | 10 | public static Runnable assertNoInterruptionThrown(InterruptibleRunnable callable) { 11 | return () -> { 12 | try { 13 | callable.run(); 14 | } catch (InterruptedException e) { 15 | Thread.currentThread().interrupt(); 16 | fail("Test has been interrupted"); 17 | } 18 | }; 19 | } 20 | 21 | @FunctionalInterface 22 | public interface InterruptibleRunnable { 23 | 24 | void run() throws InterruptedException; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/assertions/ExecutorAssertions.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.assertions; 2 | 3 | import org.assertj.core.api.AbstractAssert; 4 | import org.assertj.core.error.BasicErrorMessageFactory; 5 | 6 | import java.util.concurrent.ExecutorService; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | public final class ExecutorAssertions extends AbstractAssert { 10 | 11 | private ExecutorAssertions(ExecutorService actual) { 12 | super(actual, ExecutorAssertions.class); 13 | } 14 | 15 | public static ExecutorAssertions assertThat(ExecutorService actual) { 16 | return new ExecutorAssertions(actual); 17 | } 18 | 19 | public ExecutorAssertions isShutedDownBefore(int timeout, TimeUnit timeUnit) throws InterruptedException { 20 | boolean await = actual.awaitTermination(timeout, timeUnit); 21 | if (!await) throwAssertionError(new ShouldBeShutedDown(timeout, timeUnit)); 22 | return this; 23 | } 24 | 25 | private static class ShouldBeShutedDown extends BasicErrorMessageFactory { 26 | 27 | ShouldBeShutedDown(int timeout, TimeUnit timeUnit) { 28 | super("Executor expected to be shuted down before %d %s", timeout, timeUnit); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/assertions/ThreadedAssertions.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.assertions; 2 | 3 | import org.assertj.core.api.AbstractAssert; 4 | 5 | import java.util.concurrent.ExecutionException; 6 | 7 | public final class ThreadedAssertions 8 | extends AbstractAssert, ThreadedAssertions.ThrowableSupplier> { 9 | 10 | private ThreadedAssertions(ThrowableSupplier actual) { 11 | super(actual, ThreadedAssertions.class); 12 | } 13 | 14 | public T hasNoAssertionFailures() throws ExecutionException, E { 15 | try { 16 | return actual.get(); 17 | } catch (ExecutionException e) { 18 | if (e.getCause() instanceof AssertionError) { 19 | throw (AssertionError) e.getCause(); 20 | } else { 21 | throw e; 22 | } 23 | } 24 | } 25 | 26 | public static ThreadedAssertions assertExecutionOf(ThrowableSupplier o) { 27 | return new ThreadedAssertions<>(o); 28 | } 29 | 30 | @FunctionalInterface 31 | public interface ThrowableSupplier { 32 | 33 | T get() throws ExecutionException, E; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/CucumberTestRunner.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber; 2 | 3 | import cucumber.api.CucumberOptions; 4 | import cucumber.api.junit.Cucumber; 5 | import org.junit.runner.RunWith; 6 | 7 | @RunWith(Cucumber.class) 8 | @CucumberOptions( 9 | features = "target/test-classes/documentation", 10 | plugin = {"pretty"}, 11 | strict = true) 12 | public class CucumberTestRunner { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/engine/ClassTestDescriptorForCucumber.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.engine; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; 5 | import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; 6 | 7 | class ClassTestDescriptorForCucumber extends ClassTestDescriptor { 8 | 9 | private final Containers containers; 10 | 11 | private final ClassTestDescriptor testDescriptor; 12 | 13 | ClassTestDescriptorForCucumber(ClassTestDescriptor testDescriptor, Containers containers) { 14 | super(testDescriptor.getUniqueId(), testDescriptor.getTestClass()); 15 | this.testDescriptor = testDescriptor; 16 | this.containers = containers; 17 | } 18 | 19 | @Override 20 | public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) { 21 | return testDescriptor.prepare(context); 22 | } 23 | 24 | @Override 25 | public JupiterEngineExecutionContext before(JupiterEngineExecutionContext context) throws Exception { 26 | JupiterEngineExecutionContext result = testDescriptor.before(context); 27 | containers.updateStarted(); 28 | return result; 29 | } 30 | 31 | @Override 32 | public void after(JupiterEngineExecutionContext context) throws Exception { 33 | testDescriptor.after(context); 34 | containers.updateRemainings(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/engine/JupiterExecutionListener.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.engine; 2 | 3 | import org.junit.platform.engine.EngineExecutionListener; 4 | import org.junit.platform.engine.TestDescriptor; 5 | import org.junit.platform.engine.TestExecutionResult; 6 | import org.junit.platform.engine.reporting.ReportEntry; 7 | 8 | import static org.junit.platform.engine.TestExecutionResult.Status.SUCCESSFUL; 9 | 10 | public class JupiterExecutionListener implements EngineExecutionListener { 11 | 12 | private boolean allTestsPassed = true; 13 | 14 | @Override 15 | public void dynamicTestRegistered(TestDescriptor testDescriptor) { 16 | 17 | } 18 | 19 | @Override 20 | public void executionSkipped(TestDescriptor testDescriptor, String s) { 21 | allTestsPassed = false; 22 | } 23 | 24 | @Override 25 | public void executionStarted(TestDescriptor testDescriptor) { 26 | } 27 | 28 | @Override 29 | public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) { 30 | allTestsPassed = allTestsPassed && testExecutionResult.getStatus() == SUCCESSFUL; 31 | } 32 | 33 | @Override 34 | public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry reportEntry) { 35 | 36 | } 37 | 38 | public boolean allTestsPassed() { 39 | return allTestsPassed; 40 | } 41 | 42 | public void reset() { 43 | allTestsPassed = true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/engine/JupiterTestEngineForTests.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.engine; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import org.junit.jupiter.engine.JupiterTestEngine; 5 | import org.junit.platform.engine.ExecutionRequest; 6 | import org.junit.platform.engine.TestDescriptor; 7 | import org.junit.platform.launcher.LauncherDiscoveryRequest; 8 | 9 | import static com.github.junit5docker.cucumber.engine.TestDescriptorForCucumber.createTestDescriptorForCucumber; 10 | import static org.junit.platform.engine.UniqueId.forEngine; 11 | import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; 12 | import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; 13 | 14 | public class JupiterTestEngineForTests { 15 | 16 | private final JupiterTestEngine engine; 17 | 18 | private final Containers containers; 19 | 20 | private final JupiterExecutionListener eventRecorder; 21 | 22 | public JupiterTestEngineForTests(Containers containers, JupiterExecutionListener eventRecorder) { 23 | this.containers = containers; 24 | this.eventRecorder = eventRecorder; 25 | this.engine = new JupiterTestEngine(); 26 | } 27 | 28 | public JupiterExecutionListener executeTestsForClass(Class testClass) throws Exception { 29 | return executeTests(request().selectors(selectClass(testClass)).build()); 30 | } 31 | 32 | private JupiterExecutionListener executeTests(LauncherDiscoveryRequest request) throws Exception { 33 | TestDescriptor testDescriptor = createTestDescriptorForCucumber( 34 | engine.discover(request, forEngine(engine.getId())), containers); 35 | eventRecorder.reset(); 36 | engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters())); 37 | return eventRecorder; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/engine/MethodTestDescriptorForCucumber.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.engine; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; 5 | import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; 6 | 7 | class MethodTestDescriptorForCucumber extends TestMethodTestDescriptor { 8 | 9 | private Containers containers; 10 | 11 | MethodTestDescriptorForCucumber(TestMethodTestDescriptor methodTestDescriptor, Containers containers) { 12 | super(methodTestDescriptor.getUniqueId(), 13 | methodTestDescriptor.getTestClass(), 14 | methodTestDescriptor.getTestMethod()); 15 | this.containers = containers; 16 | } 17 | 18 | @Override 19 | protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { 20 | containers.updateStartedForTest(); 21 | super.invokeTestMethod(context, dynamicTestExecutor); 22 | } 23 | 24 | @Override 25 | public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, 26 | DynamicTestExecutor dynamicTestExecutor) throws Exception { 27 | try { 28 | return super.execute(context, dynamicTestExecutor); 29 | } finally { 30 | containers.updateRemainingsForTest(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/engine/TestDescriptorForCucumber.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.engine; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; 5 | import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; 6 | import org.junit.platform.engine.TestDescriptor; 7 | import org.junit.platform.engine.support.hierarchical.Node; 8 | 9 | import java.lang.reflect.InvocationHandler; 10 | import java.lang.reflect.Method; 11 | import java.lang.reflect.Proxy; 12 | import java.util.Optional; 13 | import java.util.Set; 14 | import java.util.stream.Collectors; 15 | import java.util.stream.Stream; 16 | 17 | final class TestDescriptorForCucumber implements InvocationHandler { 18 | 19 | private final TestDescriptor testDescriptor; 20 | 21 | private final Containers containers; 22 | 23 | private TestDescriptorForCucumber(TestDescriptor testDescriptor, Containers containers) { 24 | this.testDescriptor = testDescriptor; 25 | this.containers = containers; 26 | } 27 | 28 | // Method is used via introspection in #invoke 29 | public Set getChildren() { 30 | return testDescriptor.getChildren().stream() 31 | .map((discover1) -> (TestDescriptor) createTestDescriptorForCucumber(discover1, containers)) 32 | .collect(Collectors.toSet()); 33 | } 34 | 35 | @Override 36 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { 37 | Method[] declaredMethods = TestDescriptorForCucumber.class.getDeclaredMethods(); 38 | Optional foundedMethod = 39 | Stream.of(declaredMethods) 40 | .filter(m -> method.getName().equals(m.getName())) 41 | .findFirst(); 42 | if (foundedMethod.isPresent()) { 43 | return foundedMethod.get().invoke(this, args); 44 | } 45 | return method.invoke(wrapDescriptorForCucumber(), args); 46 | } 47 | 48 | private TestDescriptor wrapDescriptorForCucumber() { 49 | TestDescriptor usedDescriptor = this.testDescriptor; 50 | if (testDescriptor instanceof TestMethodTestDescriptor) { 51 | usedDescriptor = 52 | new MethodTestDescriptorForCucumber((TestMethodTestDescriptor) testDescriptor, containers); 53 | } 54 | if (testDescriptor instanceof ClassTestDescriptor) { 55 | usedDescriptor = 56 | new ClassTestDescriptorForCucumber((ClassTestDescriptor) testDescriptor, containers); 57 | } 58 | return usedDescriptor; 59 | } 60 | 61 | static TestDescriptor createTestDescriptorForCucumber(TestDescriptor testDescriptor, Containers containers) { 62 | return (TestDescriptor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), 63 | new Class[]{TestDescriptor.class, Node.class}, new TestDescriptorForCucumber(testDescriptor, containers)); 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/state/CompiledClass.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.state; 2 | 3 | import com.github.junit5docker.Docker; 4 | import com.github.junit5docker.WaitFor; 5 | import com.github.junit5docker.fakes.FakeExtensionContext; 6 | import org.junit.jupiter.api.extension.ExtensionContext; 7 | 8 | import java.util.List; 9 | import java.util.stream.Collectors; 10 | import java.util.stream.Stream; 11 | 12 | public class CompiledClass { 13 | 14 | private Class compiledClass; 15 | 16 | public void setClass(Class clazz) { 17 | this.compiledClass = clazz; 18 | } 19 | 20 | public Class getCompiledClass() { 21 | return compiledClass; 22 | } 23 | 24 | public String[] environmentAnnotations() { 25 | return Stream.of(compiledClass.getAnnotation(Docker.class).environments()) 26 | .map(e -> e.key() + "=" + e.value()) 27 | .collect(Collectors.toList()) 28 | .toArray(new String[]{}); 29 | } 30 | 31 | public List waitAnnotations() { 32 | return Stream.of(compiledClass.getAnnotation(Docker.class).waitFor()) 33 | .map(WaitFor::value) 34 | .collect(Collectors.toList()); 35 | } 36 | 37 | public ExtensionContext getExtensionContext() { 38 | return new FakeExtensionContext(compiledClass); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/AfterAllCheckSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import cucumber.api.java.en.When; 5 | 6 | import static org.assertj.core.api.Assertions.assertThat; 7 | 8 | public class AfterAllCheckSteps { 9 | 10 | private Containers containers; 11 | 12 | public AfterAllCheckSteps(Containers containers) { 13 | 14 | this.containers = containers; 15 | } 16 | 17 | @When("^the container is stopped and removed after your tests$") 18 | public void checkedAndRemoved() { 19 | assertThat(containers.remaining()).isEmpty(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/AfterEachCheckSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import cucumber.api.java.en.When; 5 | 6 | import static org.assertj.core.api.Assertions.assertThat; 7 | 8 | public class AfterEachCheckSteps { 9 | 10 | private Containers containers; 11 | 12 | public AfterEachCheckSteps(Containers containers) { 13 | 14 | this.containers = containers; 15 | } 16 | 17 | @When("^this container is stopped and removed after usage$") 18 | public void checkedAndRemoved() { 19 | assertThat(containers.remainingForTest()).isEmpty(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/AfterSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.state.Containers; 4 | import cucumber.api.java.After; 5 | 6 | public class AfterSteps { 7 | 8 | private Containers containers; 9 | 10 | public AfterSteps(Containers containers) { 11 | this.containers = containers; 12 | } 13 | 14 | @After 15 | public void verifyContainersAreCleared() { 16 | containers.verifyAllClean(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/BeforeAllCheckSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.state.CompiledClass; 4 | import com.github.junit5docker.cucumber.state.Containers; 5 | import cucumber.api.java.en.When; 6 | 7 | import static org.assertj.core.api.Assertions.assertThat; 8 | 9 | public class BeforeAllCheckSteps { 10 | 11 | private final Containers containers; 12 | 13 | private final CompiledClass compiledClass; 14 | 15 | public BeforeAllCheckSteps(Containers containers, CompiledClass compiledClass) { 16 | this.containers = containers; 17 | this.compiledClass = compiledClass; 18 | } 19 | 20 | @When("^the container `([^`]*)` is started before running your tests using the version `([^`]*)`$") 21 | public void startedStep(String containerName, String version) { 22 | assertThat(containers.startedImageNames()).contains(containerName + ":" + version); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/BeforeEachCheckSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.dockerjava.api.model.Container; 4 | import com.github.junit5docker.cucumber.state.CompiledClass; 5 | import com.github.junit5docker.cucumber.state.Containers; 6 | import cucumber.api.java.en.When; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | public class BeforeEachCheckSteps { 11 | 12 | private final Containers containers; 13 | 14 | private final CompiledClass compiledClass; 15 | 16 | private String lastContainerStarted; 17 | 18 | public BeforeEachCheckSteps(Containers containers, CompiledClass compiledClass) { 19 | this.containers = containers; 20 | this.compiledClass = compiledClass; 21 | } 22 | 23 | @When("a new container `([^`]*)` is started before running each tests using the version `([^`]*)`") 24 | public void startedStep(String imageName, String version) { 25 | assertThat(containers.startedImageNamesPerTest()).contains(imageName + ":" + version); 26 | assertThat(containers.startedContainersPerTest()).extracting(Container::getId) 27 | .isNotEqualTo(lastContainerStarted); 28 | lastContainerStarted = containers.startedContainersPerTest() 29 | .findFirst() 30 | .map(Container::getId) 31 | .orElseThrow(IllegalStateException::new); 32 | } 33 | 34 | @When("^the port `(\\d+)` is bound to the container's port `(\\d+)` so you can exchange through this port$") 35 | public void portStep(Integer outerPort, Integer innerPort) { 36 | assertThat(containers.portMapping()).contains(new Integer[]{outerPort, innerPort}); 37 | } 38 | 39 | @When("^the container is started with the given environment variables$") 40 | public void environmentStep() { 41 | assertThat(containers.environment()).contains(compiledClass.environmentAnnotations()); 42 | } 43 | 44 | @When("^the tests are started only after the string `([^`]*)` is found in the container's logs$") 45 | public void waitForLogStep(String wantedLog) { 46 | assertThat(compiledClass.waitAnnotations()) 47 | .describedAs("Java code and expectation mismatch on waited log \"%s\"", wantedLog) 48 | .contains(wantedLog); 49 | assertThat(containers.logs() 50 | .anyMatch(s -> s.contains(wantedLog))) 51 | .describedAs("Logs should contains \"%s\"", wantedLog) 52 | .isTrue(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/CompilationSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.state.CompiledClass; 4 | import cucumber.api.java.en.Given; 5 | 6 | import javax.tools.JavaCompiler; 7 | import javax.tools.ToolProvider; 8 | import java.io.IOException; 9 | import java.net.MalformedURLException; 10 | import java.net.URL; 11 | import java.net.URLClassLoader; 12 | import java.nio.file.Files; 13 | import java.nio.file.Path; 14 | 15 | import static java.nio.charset.StandardCharsets.UTF_8; 16 | import static org.assertj.core.api.Assertions.fail; 17 | 18 | public class CompilationSteps { 19 | 20 | private CompiledClass compiledClass; 21 | 22 | public CompilationSteps(CompiledClass compiledClass) { 23 | this.compiledClass = compiledClass; 24 | } 25 | 26 | @Given("^that you have a test like :$") 27 | public void createClassFrom(String classCode) { 28 | try { 29 | Path source = createSourceFile(classCode); 30 | compiledClass.setClass(compile(source)); 31 | } catch (IOException | ClassNotFoundException e) { 32 | fail("Failing because of unexpected exception", e); 33 | } 34 | } 35 | 36 | private Class compile(Path source) throws MalformedURLException, ClassNotFoundException { 37 | JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); 38 | if (javaCompiler.run(null, null, System.err, source.toString()) != 0) { 39 | fail("Fail to compile"); 40 | } 41 | 42 | URLClassLoader classLoader = URLClassLoader.newInstance(new URL[]{source.getParent().toUri().toURL()}, 43 | Thread.currentThread().getContextClassLoader()); 44 | return Class.forName("MyAwesomeTest", true, classLoader); 45 | } 46 | 47 | private Path createSourceFile(String classCode) throws IOException { 48 | String imports = "import com.github.junit5docker.*;\n" 49 | + "import org.junit.jupiter.api.*;\n"; 50 | Path directory = Files.createTempDirectory("test"); 51 | Path source = Files.createFile(directory.resolve("MyAwesomeTest.java")); 52 | Files.write(source, (imports + classCode).getBytes(UTF_8)); 53 | return source; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/cucumber/steps/ExecutionSteps.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.cucumber.steps; 2 | 3 | import com.github.junit5docker.cucumber.engine.JupiterExecutionListener; 4 | import com.github.junit5docker.cucumber.engine.JupiterTestEngineForTests; 5 | import com.github.junit5docker.cucumber.state.CompiledClass; 6 | import cucumber.api.java.en.When; 7 | 8 | import java.util.concurrent.ExecutorService; 9 | import java.util.concurrent.Executors; 10 | import java.util.concurrent.Future; 11 | import java.util.concurrent.TimeUnit; 12 | import java.util.concurrent.TimeoutException; 13 | 14 | import static org.assertj.core.api.Assertions.assertThat; 15 | import static org.assertj.core.api.Assertions.fail; 16 | 17 | public class ExecutionSteps { 18 | 19 | private final CompiledClass compiledClass; 20 | 21 | private final JupiterTestEngineForTests testEngine; 22 | 23 | public ExecutionSteps(CompiledClass compiledClass, JupiterTestEngineForTests testEngine) { 24 | this.compiledClass = compiledClass; 25 | this.testEngine = testEngine; 26 | } 27 | 28 | @When("^you run your tests? :$") 29 | public void executeTest() throws Exception { 30 | ExecutorService executor = Executors.newSingleThreadExecutor(); 31 | Future future = executor.submit( 32 | () -> testEngine.executeTestsForClass(compiledClass.getCompiledClass()) 33 | ); 34 | try { 35 | JupiterExecutionListener listener = future.get(5, TimeUnit.MINUTES); 36 | assertThat(listener.allTestsPassed()) 37 | .overridingErrorMessage("Tests should be green") 38 | .isTrue(); 39 | } catch (TimeoutException e) { 40 | fail("Tests should have finished"); 41 | } finally { 42 | executor.shutdownNow(); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/fakes/FakeExtensionContext.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.fakes; 2 | 3 | import org.junit.jupiter.api.extension.ExtensionContext; 4 | 5 | import java.lang.reflect.AnnotatedElement; 6 | import java.lang.reflect.Method; 7 | import java.util.Map; 8 | import java.util.Optional; 9 | import java.util.Set; 10 | 11 | public class FakeExtensionContext implements ExtensionContext { 12 | private final Class testSampleClass; 13 | 14 | public FakeExtensionContext(Class testSampleClass) { 15 | this.testSampleClass = testSampleClass; 16 | } 17 | 18 | @Override 19 | public Optional getParent() { 20 | return null; 21 | } 22 | 23 | @Override 24 | public ExtensionContext getRoot() { 25 | return null; 26 | } 27 | 28 | @Override 29 | public String getUniqueId() { 30 | return null; 31 | } 32 | 33 | @Override 34 | public String getDisplayName() { 35 | return null; 36 | } 37 | 38 | @Override 39 | public Set getTags() { 40 | return null; 41 | } 42 | 43 | @Override 44 | public Optional getElement() { 45 | return null; 46 | } 47 | 48 | @Override 49 | public Optional> getTestClass() { 50 | return Optional.of(testSampleClass); 51 | } 52 | 53 | @Override 54 | public Optional getTestInstance() { 55 | return null; 56 | } 57 | 58 | @Override 59 | public Optional getTestMethod() { 60 | return null; 61 | } 62 | 63 | @Override 64 | public Optional getExecutionException() { 65 | return null; 66 | } 67 | 68 | @Override 69 | public void publishReportEntry(Map map) { 70 | } 71 | 72 | @Override 73 | public Store getStore(Namespace namespace) { 74 | return null; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/com/github/junit5docker/fakes/FakeLog.java: -------------------------------------------------------------------------------- 1 | package com.github.junit5docker.fakes; 2 | 3 | import java.util.Iterator; 4 | import java.util.concurrent.atomic.AtomicBoolean; 5 | import java.util.stream.Stream; 6 | 7 | import static java.util.Spliterators.spliteratorUnknownSize; 8 | import static java.util.stream.StreamSupport.stream; 9 | 10 | public final class FakeLog implements Iterator { 11 | 12 | private final AtomicBoolean started; 13 | 14 | private boolean hasNext; 15 | 16 | private String waitedLog; 17 | 18 | private FakeLog(AtomicBoolean started, String waitedLog) { 19 | this.started = started; 20 | hasNext = true; 21 | this.waitedLog = waitedLog; 22 | } 23 | 24 | public static Stream unfoundableLog() { 25 | return fakeLog(new AtomicBoolean(false), ""); 26 | } 27 | 28 | public static Stream fakeLog(AtomicBoolean started, String waitedLog) { 29 | return stream(spliteratorUnknownSize(new FakeLog(started, waitedLog), 0), false); 30 | } 31 | 32 | @Override 33 | public boolean hasNext() { 34 | return hasNext; 35 | } 36 | 37 | @Override 38 | public String next() { 39 | if (started.get()) { 40 | hasNext = false; 41 | return "19/11/2016 : " + waitedLog; 42 | } 43 | return ""; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | --------------------------------------------------------------------------------