Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: publish_package
uses: gradle/[email protected]
with:
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository -x publishStandaloneJarPublicationToGitHubPackagesRepository -x publishStandaloneJarPublicationToSonatypeRepository
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ vars.MAVEN_CENTRAL_USERNAME }}
Expand Down
117 changes: 71 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,58 +1,83 @@
plugins {
id "se.bjurr.gradle.java-convention" version "0.+"
id "org.wiremock.tools.gradle.publishing" version "0.5.1"
id "org.wiremock.tools.gradle.java" version "0.5.1"
id "project-report"
id "se.bjurr.gradle.bundle-jar" version "1.4.4"
}

sourceCompatibility = 17
targetCompatibility = 17

group 'org.wiremock.integrations'
allprojects {
javaExtension {
javaVersion = 17
}

jar {
manifest {
attributes 'name': project.name
attributes 'Automatic-Module-Name': project.group + "." + project.name
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
}

// Because older version is set in wiremock-extension-convention
def wiremockVersion = "3.13.1"
releaseExtension {
nexusUsernameEnvOrProp = "OSSRH_USERNAME"
nexusPasswordEnvOrProp = "OSSRH_TOKEN"
}

configurations {
all*.exclude group: 'org.eclipse.jetty', module: 'jetty-servlet'
all*.exclude group: 'org.eclipse.jetty', module: 'jetty-servlets'
all*.exclude group: 'org.eclipse.jetty', module: 'jetty-webapp'
all*.exclude group: 'org.eclipse.jetty.http2', module: 'http2-server'
signExtension {
signingKeyEnvOrProp = "OSSRH_GPG_SECRET_KEY"
signingPasswordEnvOrProp = "OSSRH_GPG_SECRET_KEY_PASSWORD"
}

dependencies {
implementation platform("org.eclipse.jetty:jetty-bom:12.0.15")
api "org.wiremock:wiremock-jetty12:${wiremockVersion}"
api "org.springframework.boot:spring-boot-test:3.4.1"
api "org.springframework:spring-test:6.1.13"
api "org.slf4j:slf4j-api:2.0.16"
api 'org.junit.jupiter:junit-jupiter-api:5.11.2'

testImplementation "org.wiremock:wiremock-jetty12:${wiremockVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test:3.4.1"
testImplementation 'org.assertj:assertj-core:3.27.4'
testImplementation platform('org.junit:junit-bom:5.11.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.junit.platform:junit-platform-launcher'
testImplementation 'io.rest-assured:rest-assured:5.5.0'
testImplementation 'io.rest-assured:rest-assured:5.5.0'
testImplementation "org.springframework.boot:spring-boot-starter-web:3.4.1"
testImplementation 'io.cucumber:cucumber-java:7.20.1'
testImplementation 'io.cucumber:cucumber-spring:7.20.1'
testImplementation 'io.cucumber:cucumber-junit-platform-engine:7.20.1'
testImplementation 'org.junit.platform:junit-platform-suite:1.11.4'
testImplementation 'org.assertj:assertj-core:3.27.4'

constraints {
implementation('org.apache.commons:commons-compress:1.26.0') {
because 'version 1.24.0 has a vulnerability'
project("wiremock-spring-boot", {
dependencies {
implementation platform("org.eclipse.jetty:jetty-bom:12.1.3")
implementation "org.eclipse.jetty.ee10:jetty-ee10-bom:12.1.3"
api "org.wiremock:wiremock-jetty12:3.13.1"
api "org.springframework.boot:spring-boot-test:3.5.7"
api "org.springframework:spring-test:6.2.12"
api "org.slf4j:slf4j-api:2.0.17"
api "org.junit.jupiter:junit-jupiter-api:6.0.1"

testImplementation "org.wiremock:wiremock-jetty12:3.13.1"
testImplementation "org.springframework.boot:spring-boot-starter-test:3.5.7"
testImplementation "org.assertj:assertj-core:3.27.6"
testImplementation platform("org.junit:junit-bom:6.0.1")
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.junit.platform:junit-platform-launcher'
testImplementation "io.rest-assured:rest-assured:5.5.6"
testImplementation "io.rest-assured:rest-assured:5.5.6"
testImplementation "org.springframework.boot:spring-boot-starter-web:3.5.7"
testImplementation "io.cucumber:cucumber-java:7.31.0"
testImplementation "io.cucumber:cucumber-spring:7.31.0"
testImplementation "io.cucumber:cucumber-junit-platform-engine:7.31.0"
testImplementation "org.junit.platform:junit-platform-suite:6.0.1"
testImplementation "org.assertj:assertj-core:3.27.6"

constraints {
implementation('org.apache.commons:commons-compress:1.26.0') {
because 'version 1.24.0 has a vulnerability'
}
}
}
}
})

project("wiremock-spring-boot-standalone", {
apply plugin: 'se.bjurr.gradle.shadow'

shadowJar {
relocate "org.wiremock", 'wiremock.org.wiremock'
relocate "org", 'wiremock.org'
relocate "com.google", 'wiremock.com'
relocate "net.minidev", 'wiremock.net'
relocate "jakarta.servlet", "wiremock.jakarta"
relocate "joptsimple", "wiremock.joptsimple"
exclude 'joptsimple/HelpFormatterMessages.properties'

mergeServiceFiles()

exclude 'META-INF/maven/**'
exclude 'META-INF/versions/17/**'
exclude 'META-INF/versions/21/**'
exclude 'META-INF/versions/22/**'
exclude 'module-info.class'
exclude 'handlebars-*.js'
}

dependencies {
implementation project(":wiremock-spring-boot")
}
})
9 changes: 1 addition & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#Sun Oct 06 08:21:20 CEST 2024
description=WireMock integration for Spring Boot.
sourceCompatibility=17
targetCompatibility=17
group=org.wiremock.integrations
version=3.0.0
baseArtifact=wiremock-spring-boot
githubRepo=wiremock-spring-boot
developer.id=tomasbjerre
developer.name=Tomas Bjerre
[email protected]
useShadowJar=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
15 changes: 7 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -112,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -170,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

Expand Down Expand Up @@ -203,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
5 changes: 3 additions & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -68,11 +70,10 @@ goto fail
: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 %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
8 changes: 7 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ pluginManagement {
}
}

rootProject.name = 'wiremock-spring-boot'
plugins {
id "se.bjurr.gradle.include-virtual" version "1.0.0"
}

rootProject.name = 'wiremock-spring-boot-base'

includeVirtual "wiremock-spring-boot", "wiremock-spring-boot-standalone"
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void usesStubFiles() {
.asPrettyString();
assertThat(actual)
.isEqualToIgnoringWhitespace(
"""
"""
[
{
"id": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void usesStubFiles() {
.asPrettyString();
assertThat(actual)
.isEqualToIgnoringWhitespace(
"""
"""
[
{
"id": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ void test() {
.extract()
.asPrettyString();

assertThat(actual).isEqualToIgnoringWhitespace("""
assertThat(actual)
.isEqualToIgnoringWhitespace(
"""
{"wiremockmappingsmock":"yes"}
""");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void returnsTodos() {
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
.withBody("""
.withBody(
"""
{ "id": 1, "name": "Amy" }
""")));

Expand All @@ -54,7 +55,8 @@ void returnsTodos() {
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
.withBody("""
.withBody(
"""
{ "id": 2, "name": "John" }
""")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void testLocal() {
final String actual =
RestAssured.when().get("/local-templating").then().extract().asPrettyString();
assertThat(actual)
.isEqualToIgnoringWhitespace("""
.isEqualToIgnoringWhitespace(
"""
{
"name": "Resolved: local-templating"
}
Expand All @@ -37,7 +38,8 @@ void testGlobal() {
final String actual =
RestAssured.when().get("/global-templating").then().extract().asPrettyString();
assertThat(actual)
.isEqualToIgnoringWhitespace("""
.isEqualToIgnoringWhitespace(
"""
{
"name": "Resolved: {{request.path.[0]}}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ void usesJavaStubbing() {
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
.withBody("""
.withBody(
"""
{ "id": 2, "name": "Amy" }
""")));

Expand Down
Loading