Merge branch '3.1.x'

This commit is contained in:
Marcin Grzejszczak
2022-05-23 11:58:01 +02:00
14 changed files with 97 additions and 9 deletions

6
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

44
.github/workflows/codeql.yaml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: "Code Scanning - Action"
on:
pull_request:
push:
jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ✏️ If the Autobuild fails above, remove it and uncomment the following
# three lines and modify them (or add more) to build your code if your
# project uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@@ -21,7 +21,7 @@ jobs:
with:
java-version: 17
- name: Cache local Maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

View File

@@ -16,7 +16,7 @@
<description>Spring Cloud Contract Dependencies</description>
<properties>
<wiremock.version>2.33.2</wiremock.version>
<jsonassert.version>0.6.1</jsonassert.version>
<jsonassert.version>0.6.2</jsonassert.version>
</properties>
<dependencyManagement>
<dependencies>

View File

@@ -14,6 +14,6 @@
# limitations under the License.
#
wiremockVersion=2.30.1
jsonAssertVersion=0.6.1
jsonAssertVersion=0.6.2
verifierVersion=4.0.0-SNAPSHOT
groovyVersion=2.4.17

View File

@@ -14,7 +14,7 @@
# limitations under the License.
#
wiremockVersion=2.30.1
jsonAssertVersion=0.6.1
jsonAssertVersion=0.6.2
verifierVersion=4.0.0-SNAPSHOT
bootVersion=3.0.0-SNAPSHOT
groovyVersion=2.4.17

View File

@@ -14,7 +14,7 @@
# limitations under the License.
#
wiremockVersion=2.30.1
jsonAssertVersion=0.6.1
jsonAssertVersion=0.6.2
verifierVersion=4.0.0-SNAPSHOT
bootVersion=3.0.0-SNAPSHOT
groovyVersion=2.4.17

View File

@@ -64,7 +64,7 @@
<dependency>
<groupId>com.toomuchcoding.jsonassert</groupId>
<artifactId>jsonassert</artifactId>
<version>0.6.1</version>
<version>0.6.2</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -63,7 +63,7 @@
<dependency>
<groupId>com.toomuchcoding.jsonassert</groupId>
<artifactId>jsonassert</artifactId>
<version>0.6.1</version>
<version>0.6.2</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -277,7 +277,7 @@ public final class WireMockRestServiceServer {
if (indexOfBaseUrl == -1) {
return url;
}
return url.substring(indexOfBaseUrl + this.baseUrl.length() + 1);
return url.substring(indexOfBaseUrl + this.baseUrl.length());
}
private Matcher<String> requestMatcher(RequestPattern request) {

View File

@@ -411,6 +411,24 @@ public class WiremockMockServerApplicationTests {
server.verify();
}
@Test
public void getWithSimpleUrlPathMatchingWithTrailingSlashInBaseUrl() throws Exception {
MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate).baseUrl("https://example.org/")
.stubs("classpath:/mappings/url-simple-path-pattern-without-leading-slash.json").build();
assertThat(this.restTemplate.getForObject("https://example.org/my/api", String.class))
.isEqualTo("Hello Url Path Matcher");
server.verify();
}
@Test
public void getWithSimpleUrlPathMatchingWithLeadingSlashInPattern() throws Exception {
MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate).baseUrl("https://example.org")
.stubs("classpath:/mappings/url-simple-path-pattern-with-leading-slash.json").build();
assertThat(this.restTemplate.getForObject("https://example.org/my/api", String.class))
.isEqualTo("Hello Url Path Matcher");
server.verify();
}
@Test
public void getWithUrlMatching() throws Exception {
MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate) //

View File

@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
"urlPathPattern": "([a-zA-Z0-9/-]*)/url-path-pattern/"
"urlPathPattern": "/([0-9]+)/url-path-pattern/"
},
"response": {
"status": 200,

View File

@@ -0,0 +1,10 @@
{
"request": {
"method": "GET",
"urlPathPattern": "/my/api"
},
"response": {
"status": 200,
"body": "Hello Url Path Matcher"
}
}

View File

@@ -0,0 +1,10 @@
{
"request": {
"method": "GET",
"urlPathPattern": "my/api"
},
"response": {
"status": 200,
"body": "Hello Url Path Matcher"
}
}