Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps/pact jvm 4.1.43 #77

Merged
merged 2 commits into from
Oct 9, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on:
push:
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'

- name: Test consumer tests
run: ./gradlew consumer:test
- name: Test provider pact tests
run: ./gradlew provider:test
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8
2 changes: 1 addition & 1 deletion consumer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.1'
testImplementation 'au.com.dius:pact-jvm-consumer-junit5:4.0.0-beta.5'
testImplementation 'au.com.dius.pact.consumer:junit5:4.1.43'
testImplementation 'ch.qos.logback:logback-core:1.2.3'
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ class TransactionPactTest {
.integerType("version", 0)
.stringType("name", "Test")
.stringValue("accountRef", "Test001")
.timestamp("createdDate", "yyyy-MM-dd'T'HH:mm:ss.SZ")
.timestamp("lastModifiedDate", "yyyy-MM-dd'T'HH:mm:ss.SZ")
.datetime("createdDate", "yyyy-MM-dd'T'HH:mm:ss.SZ")
.datetime("lastModifiedDate", "yyyy-MM-dd'T'HH:mm:ss.SZ")
.`object`("accountNumber")
.valueFromProviderState("id", "\${accountNumber}", 100)
.closeObject()
.`object`("_links")
.closeObject()!!
.`object`("_links")
.`object`("self")
.matchUrl("href", "http://localhost:8080", "/accounts", RegexMatcher("\\d+", "100"))
.closeObject()
.matchUrl("href", "http://localhost:8080" as String?, "/accounts" as Any, RegexMatcher("\\d+", "100") as Any)
.closeObject()!!
.`object`("account")
.matchUrl("href", "http://localhost:8080", "/accounts", RegexMatcher("\\d+", "200"))
.closeObject()
.matchUrl("href", "http://localhost:8080" as String?, "/accounts" as Any, RegexMatcher("\\d+", "200") as Any)
.closeObject()!!
.closeObject()
).toPact()

Expand Down
2 changes: 1 addition & 1 deletion provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {

testCompile('org.springframework.boot:spring-boot-starter-test')
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.1'
testImplementation 'au.com.dius:pact-jvm-provider-junit5:4.0.0-beta.5'
testImplementation 'au.com.dius.pact.provider:junit5:4.1.43'
}

bootJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.pactflow.providerstatesexample.provider

import au.com.dius.pact.provider.junit.Provider
import au.com.dius.pact.provider.junit.State
import au.com.dius.pact.provider.junit.loader.PactFolder
import au.com.dius.pact.provider.junitsupport.Provider
import au.com.dius.pact.provider.junitsupport.State
import au.com.dius.pact.provider.junitsupport.loader.PactFolder
import au.com.dius.pact.provider.junit5.PactVerificationContext
import au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider
import org.junit.jupiter.api.TestTemplate
Expand All @@ -12,7 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest

@Provider("AccountService")
@PactFolder("pacts")
@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
class PactVerificationTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,159 +1,161 @@
{
"provider": {
"name": "AccountService"
},
"consumer": {
"name": "TransactionService"
},
"interactions": [
{
"description": "a request to get the account details",
"providerStates": [
{
"name": "Account Test001 exists",
"params": {
"accountRef": "Test001"
}
}
],
"request": {
"generators": {
"query": {
"accountNumber": {
"dataType": "STRING",
"expression": "${accountNumber}",
"type": "ProviderState"
}
}
},
"method": "GET",
"path": "/accounts/search/findOneByAccountNumberId",
"query": {
"accountNumber": [
"100"
]
},
"generators": {
"query": {
"accountNumber": {
"type": "ProviderState",
"expression": "${accountNumber}"
}
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/hal+json"
},
"body": {
"createdDate": "2000-02-01T00:00:00.0+1100",
"lastModifiedDate": "2000-02-01T00:00:00.0+1100",
"_links": {
"self": {
"href": "http://localhost:8080//accounts/100"
},
"account": {
"href": "http://localhost:8080//accounts/200"
},
"self": {
"href": "http://localhost:8080//accounts/100"
}
},
"name": "Test",
"id": 1,
"accountRef": "Test001",
"accountNumber": {
"id": 100
},
"accountRef": "Test001",
"createdDate": "2000-01-31T13:00:00.0+0000",
"id": 1,
"lastModifiedDate": "2000-01-31T13:00:00.0+0000",
"name": "Test",
"version": 0
},
"generators": {
"body": {
"$.accountNumber.id": {
"dataType": "INTEGER",
"expression": "${accountNumber}",
"type": "ProviderState"
},
"$.createdDate": {
"format": "yyyy-MM-dd'T'HH:mm:ss.SZ",
"type": "DateTime"
},
"$.lastModifiedDate": {
"format": "yyyy-MM-dd'T'HH:mm:ss.SZ",
"type": "DateTime"
}
}
},
"headers": {
"Content-Type": "application/hal+json"
},
"matchingRules": {
"body": {
"$.id": {
"$._links.account.href": {
"combine": "AND",
"matchers": [
{
"match": "integer"
"match": "regex",
"regex": ".*\\Q/accounts\\E\\/\\d+$"
}
],
"combine": "AND"
]
},
"$.version": {
"$._links.self.href": {
"combine": "AND",
"matchers": [
{
"match": "integer"
"match": "regex",
"regex": ".*\\Q/accounts\\E\\/\\d+$"
}
],
"combine": "AND"
]
},
"$.name": {
"$.accountNumber.id": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
]
},
"$.createdDate": {
"combine": "AND",
"matchers": [
{
"match": "timestamp",
"timestamp": "yyyy-MM-dd\u0027T\u0027HH:mm:ss.SZ"
"format": "yyyy-MM-dd'T'HH:mm:ss.SZ",
"match": "timestamp"
}
],
"combine": "AND"
]
},
"$.lastModifiedDate": {
"$.id": {
"combine": "AND",
"matchers": [
{
"match": "timestamp",
"timestamp": "yyyy-MM-dd\u0027T\u0027HH:mm:ss.SZ"
"match": "integer"
}
],
"combine": "AND"
]
},
"$.accountNumber.id": {
"$.lastModifiedDate": {
"combine": "AND",
"matchers": [
{
"match": "type"
"format": "yyyy-MM-dd'T'HH:mm:ss.SZ",
"match": "timestamp"
}
],
"combine": "AND"
]
},
"$._links.self.href": {
"$.name": {
"combine": "AND",
"matchers": [
{
"match": "regex",
"regex": ".*\\Q/accounts\\E\\/\\d+$"
"match": "type"
}
],
"combine": "AND"
]
},
"$._links.account.href": {
"$.version": {
"combine": "AND",
"matchers": [
{
"match": "regex",
"regex": ".*\\Q/accounts\\E\\/\\d+$"
"match": "integer"
}
],
"combine": "AND"
]
}
}
},
"generators": {
"body": {
"$.createdDate": {
"type": "DateTime",
"format": "yyyy-MM-dd\u0027T\u0027HH:mm:ss.SZ"
},
"$.lastModifiedDate": {
"type": "DateTime",
"format": "yyyy-MM-dd\u0027T\u0027HH:mm:ss.SZ"
},
"$.accountNumber.id": {
"type": "ProviderState",
"expression": "${accountNumber}"
}
}
}
},
"providerStates": [
{
"name": "Account Test001 exists",
"params": {
"accountRef": "Test001"
}
}
]
"status": 200
}
}
],
"metadata": {
"pact-jvm": {
"version": "4.1.43"
},
"pactSpecification": {
"version": "3.0.0"
},
"pact-jvm": {
"version": "4.0.0-beta.5"
}
},
"provider": {
"name": "AccountService"
}
}
}