Changed client / server to consumer / producer
This commit is contained in:
@@ -118,18 +118,38 @@ class Common {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the consumer side
|
||||
*/
|
||||
ClientDslProperty stub(Object clientValue) {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the consumer side
|
||||
*/
|
||||
ClientDslProperty consumer(Object clientValue) {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
ServerDslProperty server(Object serverValue) {
|
||||
return new ServerDslProperty(serverValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the producer side
|
||||
*/
|
||||
ServerDslProperty test(Object serverValue) {
|
||||
return new ServerDslProperty(serverValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the producer side
|
||||
*/
|
||||
ServerDslProperty producer(Object clientValue) {
|
||||
return new ServerDslProperty(clientValue)
|
||||
}
|
||||
|
||||
void assertThatSidesMatch(OptionalProperty stubSide, Object testSide) {
|
||||
assert testSide ==~ Pattern.compile(stubSide.optionalPattern())
|
||||
}
|
||||
|
||||
@@ -46,20 +46,6 @@ class Input extends Common {
|
||||
this.messageBody = input.messageBody
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the producer side
|
||||
*/
|
||||
ServerDslProperty producer(Object clientValue) {
|
||||
return new ServerDslProperty(clientValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the consumer side
|
||||
*/
|
||||
ClientDslProperty consumer(Object clientValue) {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of a destination from which message would come to trigger action in the system
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.regex.Pattern
|
||||
@CompileStatic
|
||||
class RegexPatterns {
|
||||
|
||||
// tag::regexps[]
|
||||
private static final Pattern TRUE_OR_FALSE = Pattern.compile(/(true|false)/)
|
||||
private static final Pattern ONLY_ALPHA_UNICODE = Pattern.compile(/[\p{L}]*/)
|
||||
private static final Pattern NUMBER = Pattern.compile('-?\\d*(\\.\\d+)?')
|
||||
@@ -63,6 +64,7 @@ class RegexPatterns {
|
||||
String url() {
|
||||
return URL.pattern()
|
||||
}
|
||||
// end::regexps[]
|
||||
|
||||
static String multipartParam(Object name, Object value) {
|
||||
return ".*--(.*)\r\nContent-Disposition: form-data; name=\"$name\"\r\n(Content-Type: .*\r\n)?(Content-Length: \\d+\r\n)?\r\n$value\r\n--\\1.*"
|
||||
|
||||
@@ -11,13 +11,13 @@ class RequestSpec extends Specification {
|
||||
Request request = new Request()
|
||||
when:
|
||||
request.with {
|
||||
value(client("foo"), server(regex("foo")))
|
||||
value(consumer("foo"), producer(regex("foo")))
|
||||
}
|
||||
then:
|
||||
thrown(IllegalStateException)
|
||||
when:
|
||||
request.with {
|
||||
value(server(regex("foo")), client("foo"))
|
||||
value(producer(regex("foo")), consumer("foo"))
|
||||
}
|
||||
then:
|
||||
thrown(IllegalStateException)
|
||||
@@ -29,7 +29,7 @@ class RequestSpec extends Specification {
|
||||
DslProperty property
|
||||
when:
|
||||
request.with {
|
||||
property = value(client(regex("[0-9]{5}")))
|
||||
property = value(consumer(regex("[0-9]{5}")))
|
||||
}
|
||||
then:
|
||||
(property.serverValue as String).matches(/[0-9]{5}/)
|
||||
|
||||
@@ -11,13 +11,13 @@ class ResponseSpec extends Specification {
|
||||
Response response = new Response()
|
||||
when:
|
||||
response.with {
|
||||
value(server("foo"), client(regex("foo")))
|
||||
value(producer("foo"), consumer(regex("foo")))
|
||||
}
|
||||
then:
|
||||
thrown(IllegalStateException)
|
||||
when:
|
||||
response.with {
|
||||
value(client(regex("foo")), server("foo"))
|
||||
value(consumer(regex("foo")), producer("foo"))
|
||||
}
|
||||
then:
|
||||
thrown(IllegalStateException)
|
||||
@@ -29,7 +29,7 @@ class ResponseSpec extends Specification {
|
||||
DslProperty property
|
||||
when:
|
||||
request.with {
|
||||
property = value(server(regex("[0-9]{5}")))
|
||||
property = value(producer(regex("[0-9]{5}")))
|
||||
}
|
||||
then:
|
||||
(property.serverValue as String).matches(/[0-9]{5}/)
|
||||
|
||||
Reference in New Issue
Block a user