diff --git a/.gitattributes b/.gitattributes index 526c8a38d4a..07764a78d98 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.sh text eol=lf \ No newline at end of file +* text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 698be93b05e..8e548131d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ dependency-reduced-pom.xml # Gitbook _book/ node_modules/ + +.gradle/ +build/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 9cc84ea9b4d..00000000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index 56bb0164ec1..00000000000 --- a/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index aa2400ce261..544f0056c47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,60 +2,45 @@ language: java jdk: - oraclejdk8 -env: - global: - - secure: "lw8tahEBcjos2c5QMMoeE19AKZDDU+WoEg7bumZJ+wuLErBEwlJENYU1t1oW834s1s7wgJ1kgt3jQgO6AWxR9wkFgZC+ZMPK0y/92T4MRsmmrMJFzUiu77UGS9MBj/Hu8M7aBzFNtLf0w3JrN2IsVI1xsX2z8PkK6L/G8C/Gzac=" - - # ^^ OSSRH_JIRA_USERNAME - - secure: "p8rkrCcHH5/EM7CKiPKQZCn1Lhzh7a+drGCHFrzHqWsZCapEXIgmqM0SYMnievaIBI+8IljdSkkW/BNfmIxW3fYDckLj91eEslLEhlIKDb91NtklDpr96o7on7wGF/VvpiEzIahKgp+LVsun/G1v3NU0T/RPs9QJoMmnQi4K+8I=" - - # ^^ OSSRH_JIRA_PASSWORD - - secure: "CWGSIr/ig2rIWSJqnDtmrK+XcUayl80ydh+fbzwi0v4hFsbbcNzm4SXFR2+HBGTBlWpWapvJoyG2iii2RHbgxVwYSyG6fEBrxtQV1oD8B/JAJoc/VJgvCsNnO54WRACqEPgV8fUX7MfKThA4hpXL3jnhM2A8J7wM969H8e4jNHk=" - - # ^^ GPG_KEY_NAME - - secure: "n2RjM3CIvtqMGMXYxjMOXjXB2R7k2lbZ2aV3fcQ0uSlrFqbzyRcTB/oa+Sft3ayUzU5S/qYjCPnNbb7P49vk1K3q5z2A9RVofFk9H90JPBz4cuuLcsuW7apcDPohDNuk47QAccsL0K+KA2AjdiQ/cIe81LWJykV+ogDI7DVXBDY=" - - # ^^ GPG_PASSPHRASE - sudo: required services: - docker cache: directories: - - '$HOME/.m2' + - '$HOME/.gradle' install: - - echo "MAVEN_OPTS='-XX:+TieredCompilation -XX:TieredStopAtLevel=1'" > ~/.mavenrc - - ./mvnw -T4 -DskipTests=true -Dmaven.javadoc.skip=true install + - ./gradlew build -x check jobs: include: - stage: test env: [ NAME=core ] - script: ./mvnw -pl core test + script: ./gradlew testcontainers:check - stage: test env: [ NAME=core ] jdk: oraclejdk9 - script: - - ./mvnw -pl core test + script: ./gradlew testcontainers:check - env: [ NAME=selenium ] - script: ./mvnw -pl modules/selenium test + script: ./gradlew selenium:check - env: [ NAME=modules ] - script: ./mvnw -pl !core,!modules/selenium test + script: ./gradlew check -x testcontainers:check -x selenium:check - # Run Docker-in-Docker tests inside Alpine and shading tests - - env: [ NAME="docker-in-alpine-docker&shade" ] + # Run Docker-in-Docker tests inside Alpine + - env: [ NAME="docker-in-alpine-docker" ] script: - | DOCKER_HOST=unix:///var/run/docker.sock DOCKER_TLS_VERIFY= docker run -t --rm \ - -v "$HOME/.m2":/root/.m2/ \ + -v "$HOME/.gradle":/root/.gradle/ \ -v /var/run/docker.sock:/var/run/docker.sock \ -v "$(pwd)":"$(pwd)" \ -w "$(pwd)" \ openjdk:8-jdk-alpine \ - ./mvnw -pl core test -Dtest=*GenericContainerRuleTest - - - ./mvnw test -f shade-test/pom.xml + ./gradlew testcontainers:test --tests '*GenericContainerRuleTest' - stage: deploy sudo: false @@ -64,7 +49,7 @@ jobs: script: skip deploy: provider: script - script: release/deploy.sh + script: ./gradlew -Pversion=$TRAVIS_TAG release on: tags: true branch: master diff --git a/RELEASING.md b/RELEASING.md index 3a5688291a1..c479bc5ef54 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -6,15 +6,13 @@ Testcontainers' release process is automated as a Travis deployment. This descri 1. Ensure that the master branch is building and that tests are passing. 1. Ensure that the [`CHANGELOG`](CHANGELOG.md) file is up to date and includes all merged features. -1. Create a new release on GitHub. **The tag name is used as the Maven version**, so please keep the tag name plain (e.g. 1.2.3). +1. Create a new release on GitHub. **The tag name is used as the version**, so please keep the tag name plain (e.g. 1.2.3). 1. Check that the Travis build passed. 1. Release of published artifacts is fully automated. Once the Travis build completes, there are no further actions to perform on the repository. 1. When available through Maven Central, poke [@whichrich](https://twitter.com/whichrich) to announce the release on Twitter! ## Internal details -* The signing and publishing steps are initiated as a script-type Travis CI deployment phase. The [`release/deploy.sh`](release/deploy.sh) script performs this process. -* `mvn version:set` is applied to use the tag name to the version number for the build. -* An encrypted GPG key within the `release` directory is used for signing. This key file is decrypted using Travis secrets. -* Travis secrets also hold key passphrase and Maven Central API username/passwords that are used for publishing. -* The publication process is automated using `nexus-staging-maven-plugin`. +* The process is done with Gradle and Bintray. +* Bintray will automatically promote the release to Maven Central. +* Travis secrets hold Bintray username/passwords that are used for publishing. diff --git a/bom/build.gradle b/bom/build.gradle new file mode 100644 index 00000000000..32805571109 --- /dev/null +++ b/bom/build.gradle @@ -0,0 +1,22 @@ +description = "Testcontainers :: BOM" + +publishing { + publications { + mavenJava(MavenPublication) { publication -> + artifactId = "testcontainers-bom" + artifacts = [] + + pom.withXml { + def dependencyManagementNode = asNode().appendNode('dependencyManagement').appendNode('dependencies') + + rootProject.subprojects.findAll { it != project }.each { subProject -> + dependencyManagementNode.appendNode('dependency').with { + appendNode('groupId', subProject.group) + appendNode('artifactId',subProject.name) + appendNode('version', subProject.version) + } + } + } + } + } +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000000..dfc60e5107c --- /dev/null +++ b/build.gradle @@ -0,0 +1,55 @@ +plugins { + id 'io.franzbecker.gradle-lombok' version '1.11' + id 'nebula.provided-base' version '3.0.3' + id 'com.github.johnrengelman.shadow' version '2.0.2' + id "com.jfrog.bintray" version "1.8.0" apply false +} + +subprojects { + apply plugin: 'nebula.provided-base' + apply plugin: 'java' + apply plugin: 'idea' + apply plugin: 'io.franzbecker.gradle-lombok' + apply from: "$rootDir/gradle/publishing.gradle" + apply from: "$rootDir/gradle/bintray.gradle" + + group = "org.testcontainers" + + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + compileJava.options.encoding = 'UTF-8' + + lombok { + version = '1.16.20' + } + + task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) { + def outputDir = file("$buildDir/delombok") + outputs.dir(outputDir) + for (srcDir in project.sourceSets.main.java.srcDirs) { + inputs.dir(srcDir) + args(srcDir, "-d", outputDir) + } + } + + project.tasks.sourceJar.from(delombok) + + task release(dependsOn: bintrayUpload) + + test { + testLogging { + displayGranularity 1 + showStackTraces = true + exceptionFormat = 'full' + events "STARTED", "PASSED", "FAILED", "SKIPPED" + } + } + + repositories { + jcenter() + } + + dependencies { + testCompile 'ch.qos.logback:logback-classic:1.2.3' + } +} diff --git a/circle.yml b/circle.yml index cb0043ef053..43aff9d8f3d 100644 --- a/circle.yml +++ b/circle.yml @@ -1,7 +1,47 @@ version: 2 executorType: machine jobs: - build: + core: steps: - checkout - - run: ./mvnw -B test + - run: ./gradlew testcontainers:check + - run: + name: Save test results + command: | + mkdir -p ~/junit/ + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; + when: always + - store_test_results: + path: ~/junit + modules: + steps: + - checkout + - run: ./gradlew check -x testcontainers:check -x selenium:check + - run: + name: Save test results + command: | + mkdir -p ~/junit/ + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; + when: always + - store_test_results: + path: ~/junit + selenium: + steps: + - checkout + - run: ./gradlew selenium:check + - run: + name: Save test results + command: | + mkdir -p ~/junit/ + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; + when: always + - store_test_results: + path: ~/junit + +workflows: + version: 2 + test_all: + jobs: + - core + - modules + - selenium diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 00000000000..b2cf84fca2d --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,137 @@ +apply plugin: 'com.github.johnrengelman.shadow' + +description = "Testcontainers Core" + +publishing { + publications { + mavenJava(MavenPublication) { publication -> + artifacts.removeAll { it.classifier == null } + artifact project.tasks.shadowJar + } + } +} + +sourceSets { + jarFileTest +} + +idea.module.testSourceDirs += sourceSets.jarFileTest.allSource.srcDirs + +configurations { + shaded + [runtime, compileOnly, testCompile]*.extendsFrom shaded +} + +shadowJar { + configurations = [project.configurations.shaded] + classifier = null + + mergeServiceFiles() + + [ + 'META-INF/io.netty.versions.properties', + 'META-INF/NOTICE', + 'META-INF/NOTICE.txt', + 'META-INF/LICENSE', + 'META-INF/LICENSE.txt', + 'META-INF/DEPENDENCIES', + 'META-INF/maven/', + 'META-INF/services/README.md', + 'META-INF/services/com.fasterxml.jackson.core.*', + 'META-INF/services/com.github.dockerjava.api.command.*', + 'META-INF/services/javax.ws.rs.ext.*', + 'META-INF/services/org.glassfish.hk2.extension.*', + 'META-INF/services/org.jvnet.hk2.external.generator.*', + 'META-INF/services/org.glassfish.jersey.internal.spi.*', + 'mozilla/public-suffix-list.txt', + ].each { exclude(it) } + + relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty') + + [ + "org.apache.http", + "org.apache.commons.lang", + "org.glassfish", + "org.aopalliance", + "org.jvnet", + "javax.annotation", + "javax.inject", + "javax.ws.rs", + "com.fasterxml.jackson", + "jersey.repackaged", + "com.google", + "io.netty", + "org.bouncycastle", + "org.newsclub", + "org.zeroturnaround" + ].each { relocate(it, "org.testcontainers.shaded.$it") } + + dependencies { + include(dependency('org.apache.httpcomponents:.*')) + include(dependency('org.glassfish.*:.*')) + include(dependency('org.aopalliance.*:.*')) + include(dependency('javax.ws.rs:.*')) + include(dependency('com.fasterxml.*:.*')) + include(dependency('com.github.docker-java:.*')) + include(dependency('com.google.guava:.*')) + include(dependency('io.netty:.*')) + include(dependency('org.bouncycastle:.*')) + include(dependency('org.newsclub.*:.*')) + include(dependency('org.zeroturnaround:zt-exec')) + include(dependency('commons-lang:commons-lang')) + } +} + +task jarFileTest(type: Test) { + testClassesDirs = sourceSets.jarFileTest.output.classesDirs + classpath = sourceSets.jarFileTest.runtimeClasspath + + systemProperty("jarFile", shadowJar.outputs.files.singleFile) + + dependsOn(shadowJar) +} +project.tasks.check.dependsOn(jarFileTest) + +dependencies { + compile 'junit:junit:4.12' + compile 'org.slf4j:slf4j-api:1.7.25' + compile 'org.slf4j:slf4j-ext:1.7.25' + compile 'org.jetbrains:annotations:15.0' + compile 'javax.annotation:javax.annotation-api:1.3.1' + compile 'com.google.code.findbugs:jsr305:3.0.2' + compile 'org.apache.commons:commons-compress:1.15' + // Added for JDK9 compatibility since it's missing this package + compile 'javax.xml.bind:jaxb-api:2.3.0' + compile 'org.rnorth.duct-tape:duct-tape:1.0.6' + compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0' + + shaded ('com.github.docker-java:docker-java:3.0.12') { + exclude(group: 'org.glassfish.jersey.core') + exclude(group: 'org.glassfish.jersey.connectors') + exclude(group: 'log4j') + exclude(group: 'com.google.code.findbug') + } + shaded 'javax.ws.rs:javax.ws.rs-api:2.0.1' + shaded 'org.rnorth:tcp-unix-socket-proxy:1.0.1' + shaded 'org.zeroturnaround:zt-exec:1.8' + shaded 'commons-lang:commons-lang:2.6' + // docker-java uses SslConfigurator from jersey-common for TLS + shaded ('org.glassfish.jersey.core:jersey-common:2.23.1') { + // SslConfigurator doesn't use classes from dependencies + exclude(module: '*') + } + + testCompile 'redis.clients:jedis:2.8.0' + testCompile 'com.rabbitmq:amqp-client:3.5.3' + testCompile 'org.mongodb:mongo-java-driver:3.0.2' + testCompile ('org.mockito:mockito-core:1.10.19') { + exclude(module: 'hamcrest-core') + } + // Synthetic JAR used for MountableFileTest and DirectoryTarResourceTest + testCompile files('testlib/repo/fakejar/fakejar/0/fakejar-0.jar') + + jarFileTestCompileOnly 'org.projectlombok:lombok:1.16.20' + jarFileTestCompile 'junit:junit:4.12' + jarFileTestCompile 'org.assertj:assertj-core:3.8.0' + jarFileTestCompile 'org.ow2.asm:asm-debug-all:5.2' +} diff --git a/core/pom.xml b/core/pom.xml deleted file mode 100644 index fe13988ec63..00000000000 --- a/core/pom.xml +++ /dev/null @@ -1,314 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../pom.xml - - - testcontainers - - Testcontainers Core - - - - junit - junit - 4.12 - - - - org.slf4j - slf4j-api - 1.7.25 - - - - com.github.docker-java - docker-java - ${docker-java.version} - compile - - - org.glassfish.jersey.core - * - - - org.glassfish.jersey.connectors - * - - - log4j - log4j - - - - - - - - javax.xml.bind - jaxb-api - 2.3.0 - - - - - org.glassfish.jersey.core - jersey-common - 2.23.1 - - - - * - * - - - - - - javax.ws.rs - javax.ws.rs-api - 2.0.1 - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - - org.rnorth - tcp-unix-socket-proxy - 1.0.1 - - - - org.zeroturnaround - zt-exec - 1.8 - - - org.rnorth.duct-tape - duct-tape - 1.0.6 - - - org.slf4j - slf4j-ext - 1.7.25 - - - org.rnorth.visible-assertions - visible-assertions - 2.1.0 - - - - - redis.clients - jedis - 2.8.0 - test - - - com.rabbitmq - amqp-client - 3.5.3 - test - - - org.mongodb - mongo-java-driver - 3.0.2 - test - - - org.mockito - mockito-core - 1.10.19 - test - - - org.hamcrest - hamcrest-core - - - - - - - fakejar - fakejar - 0 - test - - - - - - - - - - - - - - maven-shade-plugin - 3.0.0 - - - package - - shade - - - - - - - - - - - org.apache.http - org.testcontainers.shaded.org.apache.http - - - org.glassfish - org.testcontainers.shaded.org.glassfish - - - org.aopalliance - org.testcontainers.shaded.org.aopalliance - - - org.jvnet - org.testcontainers.shaded.org.jvnet - - - javax.annotation - org.testcontainers.shaded.javax.annotation - - - javax.inject - org.testcontainers.shaded.javax.inject - - - javax.ws.rs - org.testcontainers.shaded.javax.ws.rs - - - com.fasterxml.jackson - org.testcontainers.shaded.com.fasterxml.jackson - - - jersey.repackaged - org.testcontainers.shaded.jersey.repackaged - - - com.google - org.testcontainers.shaded.com.google - - - io.netty - org.testcontainers.shaded.io.netty - - - org.bouncycastle - org.testcontainers.shaded.org.bouncycastle - - - org.newsclub - org.testcontainers.shaded.org.newsclub - - - - - org.apache.httpcomponents:* - org.glassfish.*:* - org.aopalliance.*:* - com.google.code.findbugs:jsr305 - javax.inject:* - javax.ws.rs:* - com.fasterxml.*:* - com.github.docker-java:* - com.google.guava:* - io.netty:* - org.bouncycastle:* - org.newsclub.*:* - - - true - false - - - *:* - - META-INF/NOTICE - META-INF/LICENSE - META-INF/DEPENDENCIES - META-INF/maven/ - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - META-INF/io.netty.versions.properties - mozilla/public-suffix-list.txt - - META-INF/services/README.md - META-INF/services/com.fasterxml.jackson.core.* - META-INF/services/com.github.dockerjava.api.command.* - META-INF/services/javax.ws.rs.ext.* - META-INF/services/org.glassfish.hk2.extension.* - META-INF/services/org.jvnet.hk2.external.generator.* - META-INF/services/org.glassfish.jersey.internal.spi.* - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - unpack - package - - - - - - - - - - - run - - - - - - - - - - testlib - file://${project.basedir}/testlib/repo - - - diff --git a/shade-test/jar-file/src/test/java/org/testcontainers/AbstractJarFileTest.java b/core/src/jarFileTest/java/org/testcontainers/AbstractJarFileTest.java similarity index 66% rename from shade-test/jar-file/src/test/java/org/testcontainers/AbstractJarFileTest.java rename to core/src/jarFileTest/java/org/testcontainers/AbstractJarFileTest.java index 47b74ede860..f3960e63bdb 100644 --- a/shade-test/jar-file/src/test/java/org/testcontainers/AbstractJarFileTest.java +++ b/core/src/jarFileTest/java/org/testcontainers/AbstractJarFileTest.java @@ -1,11 +1,9 @@ package org.testcontainers; -import java.io.IOException; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Path; -import java.nio.file.Paths; import static java.util.Collections.emptyMap; @@ -14,12 +12,10 @@ public abstract class AbstractJarFileTest { public static Path root; static { - Path path = Paths.get("..", "..", "core", "target", "testcontainers-0-SNAPSHOT.jar"); - try { - FileSystem fileSystem = FileSystems.newFileSystem(URI.create("jar:" + path.toUri()), emptyMap()); + FileSystem fileSystem = FileSystems.newFileSystem(URI.create("jar:file://" + System.getProperty("jarFile")), emptyMap()); root = fileSystem.getPath("/"); - } catch (IOException e) { + } catch (Exception e) { throw new RuntimeException(e); } } diff --git a/shade-test/jar-file/src/test/java/org/testcontainers/JarFileShadingTest.java b/core/src/jarFileTest/java/org/testcontainers/JarFileShadingTest.java similarity index 100% rename from shade-test/jar-file/src/test/java/org/testcontainers/JarFileShadingTest.java rename to core/src/jarFileTest/java/org/testcontainers/JarFileShadingTest.java diff --git a/shade-test/jar-file/src/test/java/org/testcontainers/PublicBinaryAPITest.java b/core/src/jarFileTest/java/org/testcontainers/PublicBinaryAPITest.java similarity index 100% rename from shade-test/jar-file/src/test/java/org/testcontainers/PublicBinaryAPITest.java rename to core/src/jarFileTest/java/org/testcontainers/PublicBinaryAPITest.java diff --git a/docs/index.md b/docs/index.md index f47eadd04a8..9664ae037a3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -47,7 +47,8 @@ This project was initially inspired by a [gist](https://gist.github.com/mosheesh * discuss with the authors on an issue ticket prior to doing anything big * follow the style, naming and structure conventions of the rest of the project * make commits atomic and easy to merge - * verify all tests are passing. Build the project with `mvn clean install -Pproprietary-deps` to do this. + * verify all tests are passing. Build the project with `./gradlew check` to do this. + **N.B.** Gradle's Build Cache is enabled by default, but you can add `--no-build-cache` flag to disable it. ## Copyright diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000000..dad41a4425a --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.parallel=false +org.gradle.caching=true diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle new file mode 100644 index 00000000000..6990393401e --- /dev/null +++ b/gradle/bintray.gradle @@ -0,0 +1,23 @@ +apply plugin: "com.jfrog.bintray" + +bintray { + user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') + key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') + + publications = ['mavenJava'] + + pkg { + userOrg = 'testcontainers' + repo = 'releases' + name = 'testcontainers' + + publish = true + + version { + name = project.version + vcsTag = project.version + released = new Date() + gpg.sign = true + } + } +} diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle new file mode 100644 index 00000000000..6417f290e58 --- /dev/null +++ b/gradle/publishing.gradle @@ -0,0 +1,61 @@ +apply plugin: 'maven-publish' + +task sourceJar(type: Jar) { + classifier = 'sources' +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc +} + +publishing { + publications { + mavenJava(MavenPublication) { publication -> + artifactId = project.name + + artifact project.tasks.jar + artifact sourceJar + artifact javadocJar + + pom.withXml { + def rootNode = asNode() + rootNode.children().last() + { + resolveStrategy = Closure.DELEGATE_FIRST + + name project.description + url 'https://testcontainers.org' + issueManagement { + system 'GitHub' + url 'https://github.com/testcontainers/testcontainers-java/issues' + } + licenses { + license { + name 'MIT' + url 'http://opensource.org/licenses/MIT' + } + } + scm { + url 'https://github.com/testcontainers/testcontainers-java/' + connection 'scm:git:git://github.com/testcontainers/testcontainers-java.git' + developerConnection 'scm:git:ssh://git@github.com/testcontainers/testcontainers-java.git' + } + } + + def dependenciesNode = rootNode.appendNode('dependencies') + + def addDependency = { dependency, scope -> + dependenciesNode.appendNode('dependency').with { + appendNode('groupId', dependency.group) + appendNode('artifactId', dependency.name) + appendNode('version', dependency.version) + appendNode('scope', scope) + } + } + + project.configurations.compile.dependencies.each { addDependency(it, 'compile') } + project.configurations.provided.dependencies.each { addDependency(it, 'provided') } + } + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..736fb7d3f94 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..2f6d30c9a6b --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Jan 29 20:32:52 CET 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 00000000000..cccdd3d517f --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000000..f9553162f12 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/database-commons/build.gradle b/modules/database-commons/build.gradle new file mode 100644 index 00000000000..8b9c288b9d4 --- /dev/null +++ b/modules/database-commons/build.gradle @@ -0,0 +1,5 @@ +description = "Testcontainers :: Database-Commons" + +dependencies { + compile project(':testcontainers') +} diff --git a/modules/database-commons/pom.xml b/modules/database-commons/pom.xml deleted file mode 100644 index 3c4ec520a24..00000000000 --- a/modules/database-commons/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - database-commons - Testcontainers :: Database-Commons - - - - ${project.groupId} - testcontainers - ${project.version} - - - - diff --git a/modules/jdbc-test/build.gradle b/modules/jdbc-test/build.gradle new file mode 100644 index 00000000000..262035ce027 --- /dev/null +++ b/modules/jdbc-test/build.gradle @@ -0,0 +1,13 @@ +dependencies { + compile project(':mysql') + compile project(':postgresql') + + testCompile 'com.google.guava:guava:18.0' + testCompile 'org.postgresql:postgresql:42.0.0' + testCompile 'mysql:mysql-connector-java:5.1.45' + testCompile 'org.mariadb.jdbc:mariadb-java-client:1.4.6' + testCompile 'com.zaxxer:HikariCP-java6:2.3.8' + testCompile 'org.apache.tomcat:tomcat-jdbc:8.5.4' + testCompile 'org.vibur:vibur-dbcp:9.0' + testCompile 'commons-dbutils:commons-dbutils:1.6' +} diff --git a/modules/jdbc-test/pom.xml b/modules/jdbc-test/pom.xml deleted file mode 100644 index f7013501e3f..00000000000 --- a/modules/jdbc-test/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - jdbc-test - Testcontainers :: JDBC :: Tests - - - - ${project.groupId} - mysql - ${project.version} - - - ${project.groupId} - postgresql - ${project.version} - - - - com.google.guava - guava - 18.0 - test - - - - - org.postgresql - postgresql - 42.0.0 - test - - - mysql - mysql-connector-java - 5.1.45 - test - - - org.mariadb.jdbc - mariadb-java-client - 1.4.6 - test - - - - - com.zaxxer - HikariCP-java6 - 2.3.8 - test - - - org.apache.tomcat - tomcat-jdbc - 8.5.4 - test - - - org.vibur - vibur-dbcp - 9.0 - test - - - - commons-dbutils - commons-dbutils - 1.6 - test - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.7 - - true - - - - - - - - proprietary-deps - - - ${project.groupId} - oracle-xe - ${project.version} - - - - - com.oracle - ojdbc6 - 11.2.0.4 - provided - - - - - - maven-surefire-plugin - 2.19.1 - - - test-proprietary-deps - - test - - - src/testProprietary/java - - - - - - - - - diff --git a/modules/jdbc/build.gradle b/modules/jdbc/build.gradle new file mode 100644 index 00000000000..2278b14006d --- /dev/null +++ b/modules/jdbc/build.gradle @@ -0,0 +1,5 @@ +description = "Testcontainers :: JDBC" + +dependencies { + compile project(':database-commons') +} diff --git a/modules/jdbc/pom.xml b/modules/jdbc/pom.xml deleted file mode 100644 index a9efce8c04d..00000000000 --- a/modules/jdbc/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - jdbc - Testcontainers :: JDBC - - - - ${project.groupId} - testcontainers - ${project.version} - - - - ${project.groupId} - database-commons - ${project.version} - - - - diff --git a/modules/kafka/build.gradle b/modules/kafka/build.gradle new file mode 100644 index 00000000000..f52248045b1 --- /dev/null +++ b/modules/kafka/build.gradle @@ -0,0 +1,9 @@ +description = "Testcontainers :: Kafka" + +dependencies { + compile project(':testcontainers') + + testCompile 'org.apache.kafka:kafka-clients:1.0.0' + testCompile 'org.assertj:assertj-core:3.8.0' + testCompile 'com.google.guava:guava:23.0' +} diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml deleted file mode 100644 index 8d004cab1f1..00000000000 --- a/modules/kafka/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - kafka - Testcontainers :: Apache Kafka - - - - ${project.groupId} - testcontainers - ${project.version} - - - - org.apache.kafka - kafka-clients - 1.0.0 - test - - - - org.assertj - assertj-core - 3.8.0 - test - - - - com.google.guava - guava - 23.0 - test - - - - \ No newline at end of file diff --git a/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java b/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java index f88cb1703ed..fc36a3f4356 100644 --- a/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java +++ b/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java @@ -113,4 +113,4 @@ protected void testKafkaFunctionality(String bootstrapServers) throws Exception } } -} \ No newline at end of file +} diff --git a/modules/mysql/build.gradle b/modules/mysql/build.gradle new file mode 100644 index 00000000000..ef67e0729d4 --- /dev/null +++ b/modules/mysql/build.gradle @@ -0,0 +1,11 @@ +description = "Testcontainers :: JDBC :: MySQL" + +dependencies { + compile project(':jdbc') + + testCompile 'mysql:mysql-connector-java:5.1.35' + testCompile 'com.zaxxer:HikariCP-java6:2.3.8' + testCompile 'commons-dbutils:commons-dbutils:1.6' + testCompile 'org.apache.tomcat:tomcat-jdbc:8.5.4' + testCompile 'org.vibur:vibur-dbcp:9.0' +} diff --git a/modules/mysql/pom.xml b/modules/mysql/pom.xml deleted file mode 100644 index 712ce9d4980..00000000000 --- a/modules/mysql/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - mysql - Testcontainers :: JDBC :: MySQL - - - - ${project.groupId} - jdbc - ${project.version} - - - - - mysql - mysql-connector-java - 5.1.35 - test - - - - - com.zaxxer - HikariCP-java6 - 2.3.8 - test - - - commons-dbutils - commons-dbutils - 1.6 - test - - - org.apache.tomcat - tomcat-jdbc - 8.5.4 - test - - - org.vibur - vibur-dbcp - 9.0 - test - - - \ No newline at end of file diff --git a/modules/nginx/build.gradle b/modules/nginx/build.gradle new file mode 100644 index 00000000000..e5003b4e103 --- /dev/null +++ b/modules/nginx/build.gradle @@ -0,0 +1,5 @@ +description = "Testcontainers :: Nginx" + +dependencies { + compile project(':testcontainers') +} diff --git a/modules/nginx/pom.xml b/modules/nginx/pom.xml deleted file mode 100644 index 686fc42b842..00000000000 --- a/modules/nginx/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - nginx - Testcontainers :: nginx - - - - ${project.groupId} - testcontainers - ${project.version} - - - \ No newline at end of file diff --git a/modules/postgresql/build.gradle b/modules/postgresql/build.gradle new file mode 100644 index 00000000000..211471f1c34 --- /dev/null +++ b/modules/postgresql/build.gradle @@ -0,0 +1,9 @@ +description = "Testcontainers :: JDBC :: PostgreSQL" + +dependencies { + compile project(':jdbc') + + testCompile 'org.postgresql:postgresql:9.3-1101-jdbc41' + testCompile 'com.zaxxer:HikariCP-java6:2.3.8' + testCompile 'commons-dbutils:commons-dbutils:1.6' +} diff --git a/modules/postgresql/pom.xml b/modules/postgresql/pom.xml deleted file mode 100644 index 8f1b091277e..00000000000 --- a/modules/postgresql/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - postgresql - Testcontainers :: JDBC :: PostgreSQL - - - - ${project.groupId} - jdbc - ${project.version} - - - - - org.postgresql - postgresql - 9.3-1101-jdbc41 - test - - - - - com.zaxxer - HikariCP-java6 - 2.3.8 - test - - - commons-dbutils - commons-dbutils - 1.6 - test - - - \ No newline at end of file diff --git a/modules/selenium/build.gradle b/modules/selenium/build.gradle new file mode 100644 index 00000000000..1a3d33b0258 --- /dev/null +++ b/modules/selenium/build.gradle @@ -0,0 +1,10 @@ +description = "Testcontainers :: Selenium" + +dependencies { + compile project(':testcontainers') + + provided 'org.seleniumhq.selenium:selenium-remote-driver:2.52.0' + + testCompile 'org.mortbay.jetty:jetty:6.1.25' + testCompile project(':nginx') +} diff --git a/modules/selenium/pom.xml b/modules/selenium/pom.xml deleted file mode 100644 index 496445d8eed..00000000000 --- a/modules/selenium/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - selenium - Testcontainers :: Selenium - - - - ${project.groupId} - testcontainers - ${project.version} - - - - - org.seleniumhq.selenium - selenium-remote-driver - 2.52.0 - provided - - - - - org.mortbay.jetty - jetty - 6.1.25 - test - - - - ${project.groupId} - nginx - ${project.version} - test - - - - \ No newline at end of file diff --git a/modules/selenium/src/test/java/org/testcontainers/junit/ChromeRecordingWebDriverContainerTest.java b/modules/selenium/src/test/java/org/testcontainers/junit/ChromeRecordingWebDriverContainerTest.java index 770e8e8bc30..f0f011d5e89 100644 --- a/modules/selenium/src/test/java/org/testcontainers/junit/ChromeRecordingWebDriverContainerTest.java +++ b/modules/selenium/src/test/java/org/testcontainers/junit/ChromeRecordingWebDriverContainerTest.java @@ -20,7 +20,7 @@ public static class ChromeThatRecordsAllTests { @Rule public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer() .withDesiredCapabilities(DesiredCapabilities.chrome()) - .withRecordingMode(RECORD_ALL, new File("./target/")) + .withRecordingMode(RECORD_ALL, new File("./build/")) .withRecordingFileFactory(new DefaultRecordingFileFactory()); @Test diff --git a/modules/selenium/src/test/java/org/testcontainers/junit/FlakyContainerCreationTest.java b/modules/selenium/src/test/java/org/testcontainers/junit/FlakyContainerCreationTest.java index 56eea12a325..20229ea9c8f 100644 --- a/modules/selenium/src/test/java/org/testcontainers/junit/FlakyContainerCreationTest.java +++ b/modules/selenium/src/test/java/org/testcontainers/junit/FlakyContainerCreationTest.java @@ -18,7 +18,7 @@ public void testCreationOfManyContainers() { for (int i = 0; i < 50; i++) { BrowserWebDriverContainer container = new BrowserWebDriverContainer() .withDesiredCapabilities(DesiredCapabilities.chrome()) - .withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.RECORD_FAILING, new File("target")); + .withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.RECORD_FAILING, new File("build")); container.start(); RemoteWebDriver driver = container.getWebDriver(); diff --git a/modules/virtuoso/pom.xml b/modules/virtuoso/pom.xml deleted file mode 100644 index bab0a5dfe1f..00000000000 --- a/modules/virtuoso/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - ../../pom.xml - - - virtuoso - Testcontainers :: JDBC :: Virtuoso - - - - ldstack - http://mvn.linkeddata.org/content/groups/linkeddata.org/ - - - - - - ${project.groupId} - jdbc - ${project.version} - - - - - virtuoso - jdbc-driver - 4.0 - test - - - - - com.zaxxer - HikariCP-java6 - 2.3.8 - test - - - commons-dbutils - commons-dbutils - 1.6 - test - - - - \ No newline at end of file diff --git a/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainer.java b/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainer.java deleted file mode 100644 index 3f601b22812..00000000000 --- a/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainer.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.testcontainers.containers; - -import org.rnorth.ducttape.inconsistents.Inconsistents; -import org.rnorth.ducttape.ratelimits.RateLimiter; -import org.rnorth.ducttape.ratelimits.RateLimiterBuilder; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.concurrent.TimeUnit; - -public class VirtuosoContainer> extends JdbcDatabaseContainer { - - public static final String NAME = "virtuoso"; - public static final String IMAGE = "tenforce/virtuoso"; - public static final Integer JDBC_PORT = 1111; - public static final Integer SPARQL_SERVICE_PORT = 8890; - private static final RateLimiter LIVENESS_RATE_LIMITER = RateLimiterBuilder.newBuilder() - .withConstantThroughput() - .withRate(1, TimeUnit.SECONDS) - .build(); - - public VirtuosoContainer() { - super(IMAGE + ":1.0.0-virtuoso7.2.2"); - } - - public VirtuosoContainer(String dockerImageName) { - super(dockerImageName); - } - - @Override - protected void configure() { - addExposedPort(JDBC_PORT); - addExposedPort(SPARQL_SERVICE_PORT); - addEnv("DBA_PASSWORD", getPassword()); - addEnv("SPARQL_UPDATE", "true"); - addEnv("DEFAULT_GRAPH", "http://localhost:8890/DAV"); - addExposedPorts(JDBC_PORT, SPARQL_SERVICE_PORT); - } - - @Override - protected String getDriverClassName() { - return "virtuoso.jdbc4.Driver"; - } - - @Override - public String getJdbcUrl() { - return "jdbc:virtuoso://" + getContainerIpAddress() + ":" + getMappedPort(JDBC_PORT); - } - - public String getSparqlUrl() { - return "http://" + getContainerIpAddress() + ":" + getMappedPort(SPARQL_SERVICE_PORT) + "/sparql"; - } - - @Override - public String getUsername() { - return "dba"; - } - - @Override - public String getPassword() { - return "myDbaPassword"; - } - - @Override - protected String getTestQueryString() { - return "SELECT 1"; - } - - @Override - protected Integer getLivenessCheckPort() { - return getMappedPort(JDBC_PORT); - } - - @Override - protected void waitUntilContainerStarted() { - // Repeatedly try and open a connection to the DB and execute a test query - - logger().info("Waiting for database connection to become available at {} using query '{}'", getJdbcUrl(), getTestQueryString()); - - // Wait for consecutive JDBC connection successes over a period of time. The Virtuoso container seems - // to initially return a connection that fails on subsequent attempts, so wait for a consistently stable connection - Inconsistents.retryUntilConsistent(5, 120, TimeUnit.SECONDS, () -> { - //noinspection CodeBlock2Expr - return LIVENESS_RATE_LIMITER.getWhenReady(() -> { - if (!isRunning()) { - throw new ContainerLaunchException("Container failed to start"); - } - - try { - Connection connection = createConnection(""); - - boolean success = connection.createStatement().execute(this.getTestQueryString()); - - if (success) { - logger().info("Obtained a connection to container ({})", this.getJdbcUrl()); - return true; - } else { - throw new SQLException("Failed to execute test query"); - } - } catch (SQLException e) { - throw new ContainerLaunchException(e.getMessage()); - } - }); - }); - } -} diff --git a/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainerProvider.java b/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainerProvider.java deleted file mode 100644 index b98f809078f..00000000000 --- a/modules/virtuoso/src/main/java/org/testcontainers/containers/VirtuosoContainerProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.testcontainers.containers; - -import org.testcontainers.containers.JdbcDatabaseContainerProvider; - -public class VirtuosoContainerProvider extends JdbcDatabaseContainerProvider { - - @Override - public boolean supports(String databaseType) { - return databaseType.equals(VirtuosoContainer.NAME); - } - - @Override - public VirtuosoContainer newInstance(String tag) { - return new VirtuosoContainer(VirtuosoContainer.IMAGE + ":" + tag); - } - -} diff --git a/modules/virtuoso/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider b/modules/virtuoso/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider deleted file mode 100644 index c17bf3f8196..00000000000 --- a/modules/virtuoso/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider +++ /dev/null @@ -1 +0,0 @@ -org.testcontainers.containers.VirtuosoContainerProvider \ No newline at end of file diff --git a/modules/virtuoso/src/test/java/org/testcontainers/junit/SimpleVirtuosoTest.java b/modules/virtuoso/src/test/java/org/testcontainers/junit/SimpleVirtuosoTest.java deleted file mode 100644 index c6d6cd1b17f..00000000000 --- a/modules/virtuoso/src/test/java/org/testcontainers/junit/SimpleVirtuosoTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.testcontainers.junit; - -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import org.junit.Rule; -import org.junit.Test; -import org.testcontainers.containers.VirtuosoContainer; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; - -public class SimpleVirtuosoTest { - - @Rule - public VirtuosoContainer virtuoso = new VirtuosoContainer(); - - @Test - public void testSimple() throws SQLException { - HikariConfig hikariConfig = new HikariConfig(); - hikariConfig.setJdbcUrl(virtuoso.getJdbcUrl()); - hikariConfig.setUsername(virtuoso.getUsername()); - hikariConfig.setPassword(virtuoso.getPassword()); - hikariConfig.setConnectionTestQuery("SELECT 1"); - - HikariDataSource ds = new HikariDataSource(hikariConfig); - Statement statement = ds.getConnection().createStatement(); - statement.execute("SELECT 1"); - ResultSet resultSet = statement.getResultSet(); - - resultSet.next(); - int resultSetInt = resultSet.getInt(1); - assertEquals("A basic SELECT query succeeds", 1, resultSetInt); - } -} diff --git a/modules/virtuoso/src/test/resources/logback-test.xml b/modules/virtuoso/src/test/resources/logback-test.xml deleted file mode 100644 index 3160c151056..00000000000 --- a/modules/virtuoso/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} %-5level %logger - %msg%n - - - - - - - - - - - - - - - - - - - - PROFILER - DENY - - \ No newline at end of file diff --git a/mvnw b/mvnw deleted file mode 100755 index 5bf251c0774..00000000000 --- a/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd deleted file mode 100755 index 48c810ef37a..00000000000 --- a/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 1b1d1e7335b..00000000000 --- a/pom.xml +++ /dev/null @@ -1,259 +0,0 @@ - - - 4.0.0 - - org.testcontainers - testcontainers-parent - 0-SNAPSHOT - - pom - - Testcontainers Parent POM - - Isolated container management for Java code testing - - https://github.com/testcontainers/testcontainers-java - - - MIT - http://opensource.org/licenses/MIT - - - - - rnorth - Richard North - rich.north@gmail.com - - - swissarmykirpan - Gurpreet Sohal - gurpreet@gurpreetsohal.com - - - alexboldt - Alex Boldt - boldtalex@gmail.com - - - rpozarickij - Robert Požarickij - robert.pozarickij@gmail.com - - - krystiannowak - Krystian Nowak - krystian.nowak@gmail.com - - - mbaechler - Matthieu Baechler - matthieu.baechler@gmail.com - - - v-schulz - Viktor Schulz - vschulz@mail.uni-mannheim.de - - - pcornish - Pete Cornish - outofcoffee@gmail.com - - - mgonzalez - Miguel Gonzalez Sanchez - miguel-gonzalez@gmx.de - - - - - - - org.projectlombok - lombok - 1.16.20 - provided - - - - ch.qos.logback - logback-classic - 1.2.3 - test - - - - - - - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - - - - maven-release-plugin - 2.5.1 - - false - true - - - - maven-source-plugin - 2.4 - - - attach-sources - - jar - - - - - - maven-javadoc-plugin - 2.10.3 - - - attach-javadocs - - jar - - - - - - maven-scm-plugin - 1.9.4 - - testcontainers-${project.version} - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.6 - true - - ossrh - https://oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - - - - - UTF-8 - 3.0.12 - - - - core - modules/jdbc - modules/mysql - modules/postgresql - modules/selenium - modules/nginx - modules/kafka - modules/jdbc-test - modules/database-commons - - - - - proprietary-deps - - modules/virtuoso - - - - shade - - - test-only - - true - - - modules/jdbc-test - - - - sign - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - - - - build-extras - - true - - - - - org.apache.maven.plugins - maven-source-plugin - 2.4 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - attach-javadocs - - jar - - - - - - - - - - - scm:git:https://github.com/testcontainers/testcontainers-java.git - scm:git:git@github.com:testcontainers/testcontainers-java.git - https://github.com/testcontainers/testcontainers-java - HEAD - - - diff --git a/release/.gitignore b/release/.gitignore deleted file mode 100644 index 1546d6762de..00000000000 --- a/release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -codesigning.asc diff --git a/release/codesigning.asc.enc b/release/codesigning.asc.enc deleted file mode 100644 index 547a33b55e4..00000000000 Binary files a/release/codesigning.asc.enc and /dev/null differ diff --git a/release/deploy.sh b/release/deploy.sh deleted file mode 100755 index c734fb028c6..00000000000 --- a/release/deploy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -openssl aes-256-cbc -K $encrypted_291cb5a97669_key -iv $encrypted_291cb5a97669_iv -in release/codesigning.asc.enc -out release/codesigning.asc -d -gpg --fast-import release/codesigning.asc - -mvn versions:set -DnewVersion=$TRAVIS_TAG -mvn deploy -P sign,build-extras,!test-only -DskipTests --settings release/settings.xml diff --git a/release/settings.xml b/release/settings.xml deleted file mode 100644 index 9c8c472cd6f..00000000000 --- a/release/settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - ossrh - ${env.OSSRH_JIRA_USERNAME} - ${env.OSSRH_JIRA_PASSWORD} - - - - - - ossrh - - true - - - gpg - ${env.GPG_KEY_NAME} - ${env.GPG_PASSPHRASE} - - - - \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000000..301b8eea057 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,38 @@ +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "gradle.plugin.ch.myniva.gradle:s3-build-cache:0.4.1" + } +} + +apply plugin: 'ch.myniva.s3-build-cache' + +ext.isMasterBuild = System.getenv("CIRCLE_BRANCH") == "master" + +buildCache { + local { + enabled = !isMasterBuild + } + + remote(ch.myniva.gradle.caching.s3.AwsS3BuildCache) { + region = 'us-east-1' + bucket = 'testcontainers-build-cache' + push = isMasterBuild + } +} + +rootProject.name = 'testcontainers-java' + +include "bom" + +include "testcontainers" +project(':testcontainers').projectDir = "$rootDir/core" as File + +file('modules').eachDir { dir -> + include dir.name + project(":${dir.name}").projectDir = dir +} \ No newline at end of file diff --git a/shade-test/README.md b/shade-test/README.md deleted file mode 100644 index 1d9f4cd22b9..00000000000 --- a/shade-test/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# shade-test - -This module contains what are effectively 'integration tests' for the shaded testcontainers core JAR. - -These test modules should do things that will break without shading being used - i.e. depend upon incompatible versions - of core's dependencies. \ No newline at end of file diff --git a/shade-test/clashing-deps-jackson/pom.xml b/shade-test/clashing-deps-jackson/pom.xml deleted file mode 100644 index 16812788ff3..00000000000 --- a/shade-test/clashing-deps-jackson/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - shade-test - org.testcontainers - 0-SNAPSHOT - ../pom.xml - - 4.0.0 - - clashing-deps-jackson - - - - org.testcontainers - testcontainers - ${project.version} - - - redis.clients - jedis - 2.8.0 - - - com.fasterxml.jackson.core - jackson-databind - 2.6.3 - - - \ No newline at end of file diff --git a/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/Cache.java b/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/Cache.java deleted file mode 100644 index d1326e7c46d..00000000000 --- a/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/Cache.java +++ /dev/null @@ -1,27 +0,0 @@ -package clashingdeps.jackson.cache; - -import java.util.Optional; - -/** - * Cache, for storing data associated with keys. - */ -public interface Cache { - - /** - * Store a value object in the cache with no specific expiry time. The object may be evicted by the cache any time, - * if necessary. - * - * @param key key that may be used to retrieve the object in the future - * @param value the value object to be stored - */ - void put(String key, Object value); - - /** - * Retrieve a value object from the cache. - * @param key the key that was used to insert the object initially - * @param expectedClass for convenience, a class that the object should be cast to before being returned - * @param the class of the returned object - * @return the object if it was in the cache, or an empty Optional if not found. - */ - Optional get(String key, Class expectedClass); -} \ No newline at end of file diff --git a/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/RedisJacksonBackedCache.java b/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/RedisJacksonBackedCache.java deleted file mode 100644 index 1024eb49517..00000000000 --- a/shade-test/clashing-deps-jackson/src/main/java/clashingdeps/jackson/cache/RedisJacksonBackedCache.java +++ /dev/null @@ -1,54 +0,0 @@ -package clashingdeps.jackson.cache; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import redis.clients.jedis.Jedis; - -import java.io.IOException; -import java.util.Optional; - -/** - * An implementation of {@link Cache} that stores data in Redis. - * - * This implementation uses Jackson for JSON serialization/deserialization. - */ -public class RedisJacksonBackedCache implements Cache { - - private final Jedis jedis; - private final String cacheName; - private final ObjectMapper objectMapper; - - public RedisJacksonBackedCache(Jedis jedis, String cacheName) { - this.jedis = jedis; - this.cacheName = cacheName; - this.objectMapper = new ObjectMapper(); - } - - @Override - public void put(String key, Object value) { - String jsonValue = null; - try { - jsonValue = objectMapper.writeValueAsString(value); - } catch (JsonProcessingException e) { - e.printStackTrace(); - // Do something with this in reality - } - this.jedis.hset(this.cacheName, key, jsonValue); - } - - @Override - public Optional get(String key, Class expectedClass) { - String foundJson = this.jedis.hget(this.cacheName, key); - - if (foundJson == null) { - return Optional.empty(); - } - - try { - return Optional.of(objectMapper.readValue(foundJson, expectedClass)); - } catch (IOException e) { - return Optional.empty(); - // Do something with this in reality - } - } -} diff --git a/shade-test/clashing-deps-jackson/src/test/java/RedisJacksonBackedCacheTest.java b/shade-test/clashing-deps-jackson/src/test/java/RedisJacksonBackedCacheTest.java deleted file mode 100644 index 8271233bb98..00000000000 --- a/shade-test/clashing-deps-jackson/src/test/java/RedisJacksonBackedCacheTest.java +++ /dev/null @@ -1,64 +0,0 @@ -import clashingdeps.jackson.cache.Cache; -import clashingdeps.jackson.cache.RedisJacksonBackedCache; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.rnorth.ducttape.unreliables.Unreliables; -import org.testcontainers.containers.GenericContainer; -import redis.clients.jedis.Jedis; - -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -import static org.rnorth.visibleassertions.VisibleAssertions.*; - -/** - * Integration test for Redis-backed cache implementation. - */ -public class RedisJacksonBackedCacheTest { - - @Rule - public GenericContainer redis = new GenericContainer("redis:3.0.6") - .withExposedPorts(6379) - .waitingFor(new RedisWaitStrategy()); - private Cache cache; - - @Before - public void setUp() throws Exception { - Jedis jedis = new Jedis(redis.getContainerIpAddress(), redis.getMappedPort(6379)); - - cache = new RedisJacksonBackedCache(jedis, "test"); - } - - @Test - public void testFindingAnInsertedValue() { - cache.put("foo", "FOO"); - Optional foundObject = cache.get("foo", String.class); - - assertTrue("When an object in the cache is retrieved, it can be found", - foundObject.isPresent()); - assertEquals("When we put a String in to the cache and retrieve it, the value is the same", - "FOO", - foundObject.get()); - } - - @Test - public void testNotFindingAValueThatWasNotInserted() { - Optional foundObject = cache.get("bar", String.class); - - assertFalse("When an object that's not in the cache is retrieved, nothing is found", - foundObject.isPresent()); - } - - private class RedisWaitStrategy extends GenericContainer.AbstractWaitStrategy { - @Override - protected void waitUntilReady() { - //noinspection LoopStatementThatDoesntLoop - Unreliables.retryUntilSuccess(10, TimeUnit.SECONDS, () -> - { - Jedis jedis = new Jedis(redis.getContainerIpAddress(), redis.getMappedPort(6379)); - return jedis.ping(); - }); - } - } -} diff --git a/shade-test/clashing-deps-jackson/src/test/resources/logback-test.xml b/shade-test/clashing-deps-jackson/src/test/resources/logback-test.xml deleted file mode 100644 index d12e392071a..00000000000 --- a/shade-test/clashing-deps-jackson/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} %-5level %logger - %msg%n - - - - - - - - - - - - - - - - - - - - PROFILER - DENY - - \ No newline at end of file diff --git a/shade-test/clashing-deps-jersey/pom.xml b/shade-test/clashing-deps-jersey/pom.xml deleted file mode 100644 index 639f8965ca4..00000000000 --- a/shade-test/clashing-deps-jersey/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - shade-test - org.testcontainers - 0-SNAPSHOT - ../pom.xml - - 4.0.0 - - clashing-deps-jersey - - - - org.testcontainers - testcontainers - ${project.version} - - - com.sun.jersey - jersey-client - 1.19 - - - \ No newline at end of file diff --git a/shade-test/clashing-deps-jersey/src/test/java/OldJerseyClientTest.java b/shade-test/clashing-deps-jersey/src/test/java/OldJerseyClientTest.java deleted file mode 100644 index cffc275240d..00000000000 --- a/shade-test/clashing-deps-jersey/src/test/java/OldJerseyClientTest.java +++ /dev/null @@ -1,23 +0,0 @@ -import com.sun.jersey.api.client.Client; -import org.junit.Rule; -import org.junit.Test; -import org.testcontainers.containers.GenericContainer; - -import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue; - -/** - * Created by rnorth on 14/01/2016. - */ -public class OldJerseyClientTest { - - @Rule - public GenericContainer httpd = new GenericContainer("httpd:2.4").withExposedPorts(80); - - @Test - public void clientRequestTest() { - Client client = Client.create(); - String s = client.resource("http://" + httpd.getContainerIpAddress() + ":" + httpd.getMappedPort(80)).get(String.class); - - assertTrue("httpd is displaying its default placeholder page", s.contains("It works")); - } -} diff --git a/shade-test/clashing-deps-jersey/src/test/resources/logback-test.xml b/shade-test/clashing-deps-jersey/src/test/resources/logback-test.xml deleted file mode 100644 index d12e392071a..00000000000 --- a/shade-test/clashing-deps-jersey/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} %-5level %logger - %msg%n - - - - - - - - - - - - - - - - - - - - PROFILER - DENY - - \ No newline at end of file diff --git a/shade-test/jar-file/pom.xml b/shade-test/jar-file/pom.xml deleted file mode 100644 index d731ac33642..00000000000 --- a/shade-test/jar-file/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - shade-test - org.testcontainers - 0-SNAPSHOT - ../pom.xml - - 4.0.0 - - jar-file - - - - org.assertj - assertj-core - 3.8.0 - test - - - - org.ow2.asm - asm-debug-all - 5.2 - test - - - - \ No newline at end of file diff --git a/shade-test/pom.xml b/shade-test/pom.xml deleted file mode 100644 index 0e761a940e3..00000000000 --- a/shade-test/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - testcontainers-parent - org.testcontainers - 0-SNAPSHOT - ../pom.xml - - 4.0.0 - - shade-test - pom - - - clashing-deps-jackson - clashing-deps-jersey - service-lookup-dropwizard - jar-file - - - - - junit - junit - 4.12 - test - - - \ No newline at end of file diff --git a/shade-test/service-lookup-dropwizard/pom.xml b/shade-test/service-lookup-dropwizard/pom.xml deleted file mode 100644 index 8fdc7b27192..00000000000 --- a/shade-test/service-lookup-dropwizard/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - shade-test - org.testcontainers - 0-SNAPSHOT - ../pom.xml - - 4.0.0 - - service-lookup-dropwizard - - - org.testcontainers - testcontainers - ${project.version} - - - io.dropwizard - dropwizard-core - 0.9.2 - - - io.dropwizard - dropwizard-testing - 0.9.2 - - - - - \ No newline at end of file diff --git a/shade-test/service-lookup-dropwizard/src/main/java/JerseyResource.java b/shade-test/service-lookup-dropwizard/src/main/java/JerseyResource.java deleted file mode 100644 index 2ddde90110f..00000000000 --- a/shade-test/service-lookup-dropwizard/src/main/java/JerseyResource.java +++ /dev/null @@ -1,14 +0,0 @@ -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -/** - * Created by rnorth on 18/02/2016. - */ -@Path("/foo") -public class JerseyResource { - - @GET - public String getMessage() { - return "bar"; - } -} diff --git a/shade-test/service-lookup-dropwizard/src/test/java/SimpleResourceTest.java b/shade-test/service-lookup-dropwizard/src/test/java/SimpleResourceTest.java deleted file mode 100644 index cfc7af4c364..00000000000 --- a/shade-test/service-lookup-dropwizard/src/test/java/SimpleResourceTest.java +++ /dev/null @@ -1,23 +0,0 @@ -import io.dropwizard.testing.junit.ResourceTestRule; -import org.junit.ClassRule; -import org.junit.Test; - -import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; - -/** - * Created by rnorth on 18/02/2016. - */ -public class SimpleResourceTest { - - @ClassRule - public static final ResourceTestRule resources = ResourceTestRule.builder() - .addResource(new JerseyResource()) - .build(); - - @Test - public void simpleTest() { - assertEquals("the response from the resource", - "bar", - resources.client().target("/foo").request().get(String.class)); - } -} diff --git a/shade-test/service-lookup-dropwizard/src/test/resources/logback-test.xml b/shade-test/service-lookup-dropwizard/src/test/resources/logback-test.xml deleted file mode 100644 index d12e392071a..00000000000 --- a/shade-test/service-lookup-dropwizard/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} %-5level %logger - %msg%n - - - - - - - - - - - - - - - - - - - - PROFILER - DENY - - \ No newline at end of file