added pact publish task
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@@ -10,6 +8,13 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "au.com.dius.pact" version "3.5.13"
|
||||
}
|
||||
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
version '1.0.0.SNAPSHOT'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@@ -25,3 +30,12 @@ dependencies {
|
||||
testCompile("au.com.dius:pact-jvm-consumer-junit_2.11:3.5.2")
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test:${springboot_version}")
|
||||
}
|
||||
|
||||
pact {
|
||||
publish {
|
||||
pactDirectory = 'target/pacts'
|
||||
pactBrokerUrl = 'URL'
|
||||
pactBrokerUsername = 'USERNAME'
|
||||
pactBrokerPassword = 'PASSWORD'
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class UserServiceConsumerTest {
|
||||
@Autowired
|
||||
private UserClient userClient;
|
||||
|
||||
@Pact(state = "provider accepts a new person", provider = "userservice", consumer = "userclient")
|
||||
@Pact(provider = "userservice", consumer = "userclient")
|
||||
public RequestResponsePact createPersonPact(PactDslWithProvider builder) {
|
||||
return builder
|
||||
.given("provider accepts a new person")
|
||||
@@ -42,19 +42,19 @@ public class UserServiceConsumerTest {
|
||||
.toPact();
|
||||
}
|
||||
|
||||
@Pact(state = "person 42 exists", provider = "userservice", consumer = "userclient")
|
||||
@Pact(provider = "userservice", consumer = "userclient")
|
||||
public RequestResponsePact updatePersonPact(PactDslWithProvider builder) {
|
||||
return builder
|
||||
.given("person 42 exists")
|
||||
.uponReceiving("a request to PUT a person")
|
||||
.path("/user-service/users/42")
|
||||
.method("PUT")
|
||||
.path("/user-service/users/42")
|
||||
.method("PUT")
|
||||
.willRespondWith()
|
||||
.status(200)
|
||||
.matchHeader("Content-Type", "application/json")
|
||||
.body(new PactDslJsonBody()
|
||||
.stringType("firstName", "Zaphod")
|
||||
.stringType("lastName", "Beeblebrox"))
|
||||
.status(200)
|
||||
.matchHeader("Content-Type", "application/json")
|
||||
.body(new PactDslJsonBody()
|
||||
.stringType("firstName", "Zaphod")
|
||||
.stringType("lastName", "Beeblebrox"))
|
||||
.toPact();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user