Changed client / server to consumer / producer
This commit is contained in:
@@ -59,8 +59,8 @@ class WireMockToDslConverter {
|
||||
request {
|
||||
${request.method ? "method \"\"\"$request.method\"\"\"" : ""}
|
||||
${request.url ? "url \"\"\"$request.url\"\"\"" : ""}
|
||||
${urlPattern ? "url \$(client(regex('${escapeJava(urlPattern)}')), server('${new Xeger(escapeJava(urlPattern)).generate()}'))" : ""}
|
||||
${urlPathPattern ? "urlPath \$(client(regex('${escapeJava(urlPattern)}')), server('${new Xeger(escapeJava(urlPattern)).generate()}'))" : ""}
|
||||
${urlPattern ? "url \$(consumer(regex('${escapeJava(urlPattern)}')), producer('${new Xeger(escapeJava(urlPattern)).generate()}'))" : ""}
|
||||
${urlPathPattern ? "urlPath \$(consumer(regex('${escapeJava(urlPattern)}')), producer('${new Xeger(escapeJava(urlPattern)).generate()}'))" : ""}
|
||||
${request.urlPath ? "url \"\"\"$request.urlPath\"\"\"" : ""}
|
||||
${
|
||||
request.headers ? """headers {
|
||||
@@ -77,7 +77,7 @@ class WireMockToDslConverter {
|
||||
}
|
||||
${bodyPatterns?.equalTo?.every { it } ? "body('''${bodyPatterns.equalTo[0]}''')" : ''}
|
||||
${bodyPatterns?.equalToJson?.every { it } ? "body('''${bodyPatterns.equalToJson[0]}''')" : ''}
|
||||
${bodyPatterns?.matches?.every { it } ? "body \$(client(regex('${escapeJava(bodyPatterns.matches[0])}')), server('${new Xeger(escapeJava(bodyPatterns.matches[0])).generate()}'))" : ""}
|
||||
${bodyPatterns?.matches?.every { it } ? "body \$(consumer(regex('${escapeJava(bodyPatterns.matches[0])}')), producer('${new Xeger(escapeJava(bodyPatterns.matches[0])).generate()}'))" : ""}
|
||||
}
|
||||
response {
|
||||
${response.status ? "status $response.status" : ""}
|
||||
|
||||
@@ -37,7 +37,7 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
method('PUT')
|
||||
url \$(client(~/\\/[0-9]{2}/), server('/12'))
|
||||
url \$(consumer(~/\\/[0-9]{2}/), producer('/12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
@@ -203,11 +203,11 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
response {
|
||||
status 200
|
||||
body([[id: value(
|
||||
client('123'),
|
||||
server(regex('[0-9]+'))
|
||||
consumer('123'),
|
||||
producer(regex('[0-9]+'))
|
||||
)], [id: value(
|
||||
client('567'),
|
||||
server(regex('[0-9]+'))
|
||||
consumer('567'),
|
||||
producer(regex('[0-9]+'))
|
||||
)]])
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
@@ -238,8 +238,8 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
body(
|
||||
email: $(stub(optional(regex(email()))), test('abc@abc.com')),
|
||||
callback_url: $(stub(regex(hostname())), test('http://partners.com'))
|
||||
email: $(consumer(optional(regex(email()))), producer('abc@abc.com')),
|
||||
callback_url: $(consumer(regex(hostname())), producer('http://partners.com'))
|
||||
)
|
||||
}
|
||||
response {
|
||||
@@ -248,8 +248,8 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
body(
|
||||
code: value(stub("123123"), test(optional("123123"))),
|
||||
message: "User not found by email == [${value(test(regex(email())), stub('not.existing@user.com'))}]"
|
||||
code: value(consumer("123123"), producer(optional("123123"))),
|
||||
message: "User not found by email == [${value(producer(regex(email())), consumer('not.existing@user.com'))}]"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ class WireMockToDslConverterSpec extends Specification {
|
||||
url '/path'
|
||||
headers {
|
||||
header('Accept': $(
|
||||
client(regex('text/.*')),
|
||||
server('text/plain')
|
||||
consumer(regex('text/.*')),
|
||||
producer('text/plain')
|
||||
))
|
||||
header('X-Custom-Header': $(
|
||||
client(regex('^.*2134.*$')),
|
||||
server('121345')
|
||||
consumer(regex('^.*2134.*$')),
|
||||
producer('121345')
|
||||
))
|
||||
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class WireMockToDslConverterSpec extends Specification {
|
||||
Contract expectedGroovyDsl = Contract.make {
|
||||
request {
|
||||
method 'DELETE'
|
||||
url $(client(~/\/credit-card-verification-data\/[0-9]+/), server('/credit-card-verification-data/1'))
|
||||
url $(consumer(~/\/credit-card-verification-data\/[0-9]+/), producer('/credit-card-verification-data/1'))
|
||||
headers {
|
||||
header('Content-Type': 'application/vnd.mymoid-adapter.v2+json; charset=UTF-8')
|
||||
}
|
||||
@@ -377,7 +377,7 @@ class WireMockToDslConverterSpec extends Specification {
|
||||
request {
|
||||
method 'POST'
|
||||
url '/test'
|
||||
body $(client(~/[0-9]{5}/), server('12345'))
|
||||
body $(consumer(~/[0-9]{5}/), producer('12345'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
@@ -498,7 +498,7 @@ class WireMockToDslConverterSpec extends Specification {
|
||||
request {
|
||||
method 'POST'
|
||||
url '/test'
|
||||
body $(client(~/[0-9]{2}/), server('12'))
|
||||
body $(consumer(~/[0-9]{2}/), producer('12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
|
||||
@@ -22,7 +22,7 @@ Contract.make {
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
url $(client('/[0-9]{2}'), server('/12'))
|
||||
url $(consumer('/[0-9]{2}'), producer('/12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
|
||||
@@ -22,7 +22,7 @@ Contract.make {
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
urlPattern $(client('/[0-9]{2}'), server('/12'))
|
||||
urlPattern $(consumer('/[0-9]{2}'), producer('/12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
|
||||
@@ -22,7 +22,7 @@ Contract.make {
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
url $(client('/[0-9]{2}'), server('/12'))
|
||||
url $(consumer('/[0-9]{2}'), producer('/12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
|
||||
@@ -22,7 +22,7 @@ Contract.make {
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
url $(client('/[0-9]{2}'), server('/12'))
|
||||
url $(consumer('/[0-9]{2}'), producer('/12'))
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
|
||||
Reference in New Issue
Block a user