diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a243b89..b0513d52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - build: + build-linux: docker: - image: cimg/openjdk:11.0 working_directory: ~/hoverfly-java @@ -31,6 +31,29 @@ jobs: paths: - hoverfly-java/ +# build-windows: +# machine: +# image: windows-server-2019 +# resource_class: windows.medium +# working_directory: C:/hoverfly-java +# steps: +# - checkout +# - run: +# name: Set up Gradle Wrapper & Java +# command: | +# choco install -y openjdk11 +# set "JAVA_HOME=C:\Program Files\OpenJDK\openjdk-11" +# set "PATH=%JAVA_HOME%\bin;%PATH%" +# echo "JAVA_HOME is set to %JAVA_HOME%" +# - run: +# name: Run Tests +# shell: cmd +# command: ".\\gradlew.bat clean test jacocoTestReport" +# - persist_to_workspace: +# root: C:/hoverfly-java/ +# paths: +# - ./ + deploy: docker: - image: cimg/openjdk:11.0 @@ -58,10 +81,12 @@ workflows: version: 2 build: jobs: - - build + - build-linux +# - build-windows - deploy: requires: - - build + - build-linux +# - build-windows filters: branches: only: master diff --git a/build.gradle b/build.gradle index df5babd9..75c6deed 100644 --- a/build.gradle +++ b/build.gradle @@ -31,30 +31,32 @@ dependencies { jacksonVersion = '2.17.2' } - compile 'com.squareup.okhttp3:okhttp:4.12.0' - compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" - compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion" - compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion" - compile 'org.apache.commons:commons-lang3:3.12.0' - compile 'org.zeroturnaround:zt-exec:1.12' - compile 'org.slf4j:slf4j-api:1.7.36' - compile 'ch.qos.logback:logback-classic:1.5.13' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion" + implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion" + implementation 'org.apache.commons:commons-lang3:3.12.0' + implementation 'org.zeroturnaround:zt-exec:1.12' + implementation 'org.slf4j:slf4j-api:1.7.36' + implementation 'ch.qos.logback:logback-classic:1.5.13' compileOnly 'junit:junit:4.13.2' - testCompile 'com.sun.jersey:jersey-client:1.19.4' - testCompile 'com.google.guava:guava:33.0.0-jre' - testCompile 'org.springframework:spring-web:5.3.20' - testCompile 'org.apache.httpcomponents:httpclient:4.5.13' - testCompile 'org.assertj:assertj-core:3.22.0' - testCompile 'net.javacrumbs.json-unit:json-unit:2.32.0' - testCompile 'net.javacrumbs.json-unit:json-unit-fluent:2.28.0' - testCompile 'org.eclipse.jetty:jetty-server:9.3.11.v20160721' - testCompile 'org.skyscreamer:jsonassert:1.5.0' - testCompile 'org.mockito:mockito-core:4.2.0' - testCompile 'org.powermock:powermock-module-junit4:2.0.9' - testCompile 'com.github.stefanbirkner:system-rules:1.19.0' - testCompile 'io.projectreactor.ipc:reactor-netty:0.7.15.RELEASE' - testCompile 'io.projectreactor:reactor-test:3.2.3.RELEASE' - testCompile 'org.awaitility:awaitility:4.1.1' + + testImplementation 'com.sun.jersey:jersey-client:1.19.4' + testImplementation 'com.google.guava:guava:31.1-jre' + testImplementation 'org.springframework:spring-web:5.3.20' + testImplementation 'org.apache.httpcomponents:httpclient:4.5.13' + testImplementation 'org.assertj:assertj-core:3.22.0' + testImplementation 'net.javacrumbs.json-unit:json-unit:2.32.0' + testImplementation 'net.javacrumbs.json-unit:json-unit-fluent:2.28.0' + testImplementation 'org.eclipse.jetty:jetty-server:9.3.11.v20160721' + testImplementation 'org.skyscreamer:jsonassert:1.5.0' + testImplementation 'org.mockito:mockito-core:4.2.0' + testImplementation 'org.powermock:powermock-module-junit4:2.0.9' + testImplementation 'com.github.stefanbirkner:system-rules:1.19.0' + testImplementation 'io.projectreactor.ipc:reactor-netty:0.7.15.RELEASE' + testImplementation 'io.projectreactor:reactor-test:3.2.3.RELEASE' + testImplementation 'org.awaitility:awaitility:4.1.1' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' } allprojects { subproj -> @@ -167,7 +169,7 @@ jacocoTestReport { } wrapper { - gradleVersion = '5.6.4' + gradleVersion = '6.9.4' } // Tasks for updating Hoverfly binaries diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea1..5c2d1cf0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f..53b9e380 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d5..83f2acfd 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index e95643d6..24467a14 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/junit5/build.gradle b/junit5/build.gradle index d0fcb5c8..a0d23061 100644 --- a/junit5/build.gradle +++ b/junit5/build.gradle @@ -19,25 +19,28 @@ dependencies { ext { junitJupiterVersion = '5.10.2' junitPlatformVersion = '1.10.2' + jacksonVersion = '2.17.2' } compileOnly "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion" compileOnly "org.junit.platform:junit-platform-commons:$junitPlatformVersion" - compile(rootProject) { + implementation(rootProject) { exclude group: 'junit' } - testCompile "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion" - testCompile "org.junit.platform:junit-platform-testkit:$junitPlatformVersion" - testCompile 'org.mockito:mockito-core:4.2.0' - testCompile 'org.assertj:assertj-core:3.21.0' - testCompile 'net.javacrumbs.json-unit:json-unit:2.28.0' - testCompile 'net.javacrumbs.json-unit:json-unit-fluent:2.28.0' + testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion" + testImplementation "org.junit.platform:junit-platform-testkit:$junitPlatformVersion" + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' + testImplementation 'org.mockito:mockito-core:4.2.0' + testImplementation 'org.assertj:assertj-core:3.21.0' + testImplementation 'net.javacrumbs.json-unit:json-unit:2.28.0' + testImplementation 'net.javacrumbs.json-unit:json-unit-fluent:2.28.0' + testImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" // Only needed to run tests in an IntelliJ IDEA that bundles an older version - testRuntime("org.junit.platform:junit-platform-launcher:$junitPlatformVersion") - testRuntime("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion") - testRuntime("org.junit.vintage:junit-vintage-engine:$junitJupiterVersion") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitPlatformVersion") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion") + testRuntimeOnly("org.junit.vintage:junit-vintage-engine:$junitJupiterVersion") } diff --git a/junit5/src/main/java/io/specto/hoverfly/junit5/HoverflyExtensionUtils.java b/junit5/src/main/java/io/specto/hoverfly/junit5/HoverflyExtensionUtils.java index f6ef92f0..e4c0b724 100644 --- a/junit5/src/main/java/io/specto/hoverfly/junit5/HoverflyExtensionUtils.java +++ b/junit5/src/main/java/io/specto/hoverfly/junit5/HoverflyExtensionUtils.java @@ -7,11 +7,11 @@ import io.specto.hoverfly.junit5.api.HoverflyConfig; import io.specto.hoverfly.junit5.api.HoverflySimulate; import io.specto.hoverfly.junit5.api.UnsetSimulationPreprocessor; -import org.apache.commons.lang3.StringUtils; import org.junit.platform.commons.util.ReflectionUtils; import java.nio.file.Path; import java.nio.file.Paths; +import org.junit.platform.commons.util.StringUtils; import static io.specto.hoverfly.junit.core.HoverflyConfig.localConfigs; import static io.specto.hoverfly.junit.core.HoverflyConfig.remoteConfigs; diff --git a/junit5/src/test/java/io/specto/hoverfly/junit5/HoverflyCustomCaptureTest.java b/junit5/src/test/java/io/specto/hoverfly/junit5/HoverflyCustomCaptureTest.java index 38d22c1b..b48792bd 100644 --- a/junit5/src/test/java/io/specto/hoverfly/junit5/HoverflyCustomCaptureTest.java +++ b/junit5/src/test/java/io/specto/hoverfly/junit5/HoverflyCustomCaptureTest.java @@ -1,6 +1,5 @@ package io.specto.hoverfly.junit5; -import com.fasterxml.jackson.databind.ObjectMapper; import io.specto.hoverfly.junit.core.Hoverfly; import io.specto.hoverfly.junit.core.HoverflyMode; import io.specto.hoverfly.junit.core.ObjectMapperFactory; diff --git a/testng/build.gradle b/testng/build.gradle index 1e5069ad..b5f9a8b3 100644 --- a/testng/build.gradle +++ b/testng/build.gradle @@ -17,21 +17,23 @@ repositories { dependencies { ext { testNgVersion = '6.14.3' + jacksonVersion = '2.17.2' } compileOnly "org.testng:testng:$testNgVersion" - compile(rootProject) { + implementation(rootProject) { exclude group: 'junit' } - testCompile files(rootProject.sourceSets.test.output.classesDirs) - testCompile "org.testng:testng:$testNgVersion" - testCompile 'junit:junit:4.12' - testCompile 'org.springframework:spring-web:4.3.20.RELEASE' - testCompile 'org.assertj:assertj-core:3.11.1' - testCompile 'org.skyscreamer:jsonassert:1.5.0' - testCompile 'org.eclipse.jetty:jetty-server:9.3.11.v20160721' - testCompile 'com.google.guava:guava:20.0' - testCompile 'org.mockito:mockito-core:2.23.4' + implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" + testImplementation files(rootProject.sourceSets.test.output.classesDirs) + testImplementation "org.testng:testng:$testNgVersion" + testImplementation 'junit:junit:4.12' + testImplementation 'org.springframework:spring-web:4.3.20.RELEASE' + testImplementation 'org.assertj:assertj-core:3.11.1' + testImplementation 'org.skyscreamer:jsonassert:1.5.0' + testImplementation 'org.eclipse.jetty:jetty-server:9.3.11.v20160721' + testImplementation 'com.google.guava:guava:20.0' + testImplementation 'org.mockito:mockito-core:2.23.4' } compileTestJava.dependsOn tasks.getByPath(':testClasses') diff --git a/testng/src/main/java/io/specto/hoverfly/testng/HoverflyTestNG.java b/testng/src/main/java/io/specto/hoverfly/testng/HoverflyTestNG.java index 78c2b40b..ec9507e9 100644 --- a/testng/src/main/java/io/specto/hoverfly/testng/HoverflyTestNG.java +++ b/testng/src/main/java/io/specto/hoverfly/testng/HoverflyTestNG.java @@ -17,13 +17,13 @@ import io.specto.hoverfly.junit.dsl.RequestMatcherBuilder; import io.specto.hoverfly.junit.dsl.StubServiceBuilder; import io.specto.hoverfly.junit.verification.VerificationCriteria; -import org.apache.commons.lang3.StringUtils; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.function.Predicate; +import org.testng.util.Strings; import static io.specto.hoverfly.junit.core.HoverflyConfig.localConfigs; import static io.specto.hoverfly.junit.core.HoverflyConstants.DEFAULT_HOVERFLY_EXPORT_PATH; @@ -130,7 +130,7 @@ public static HoverflyTestNG inCaptureMode(String outputDir, String outputFilena * @return the rule */ public static HoverflyTestNG inCaptureMode(String outputDir, String outputFilename, HoverflyConfig hoverflyConfig) { - if (StringUtils.isBlank(outputFilename)) { + if (Strings.isNullOrEmpty(outputFilename)) { throw new IllegalArgumentException("Output simulation file name can not be blank."); } Path exportPath = createDirectoryIfNotExist(outputDir);