Extract Method enum to separate file
Change-Id: Ibb35bb26ca94689fc400cd510565c86e3d61087c
This commit is contained in:
parent
7b92da8d48
commit
c12eeb7a07
4 changed files with 21 additions and 19 deletions
|
@ -42,7 +42,7 @@ or via sending POST request to localhost:<PORT>/serverControl
|
||||||
<soap>...</soap>
|
<soap>...</soap>
|
||||||
<statusCode>...</statusCode>
|
<statusCode>...</statusCode>
|
||||||
<method>...</method>
|
<method>...</method>
|
||||||
<responseHeaders>,,,</responseHeaders>
|
<responseHeaders>...</responseHeaders>
|
||||||
</addMock>
|
</addMock>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,5 @@ class AddMockRequestData {
|
||||||
void setResponseHeaders(String responseHeaders) {
|
void setResponseHeaders(String responseHeaders) {
|
||||||
this.responseHeaders = StringEscapeUtils.escapeXml11(responseHeaders)
|
this.responseHeaders = StringEscapeUtils.escapeXml11(responseHeaders)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Method {
|
|
||||||
POST,
|
|
||||||
GET,
|
|
||||||
DELETE,
|
|
||||||
PUT,
|
|
||||||
TRACE,
|
|
||||||
HEAD,
|
|
||||||
OPTIONS,
|
|
||||||
PATCH
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package pl.touk.mockserver.client
|
||||||
|
|
||||||
|
enum Method {
|
||||||
|
POST,
|
||||||
|
GET,
|
||||||
|
DELETE,
|
||||||
|
PUT,
|
||||||
|
TRACE,
|
||||||
|
HEAD,
|
||||||
|
OPTIONS,
|
||||||
|
PATCH
|
||||||
|
}
|
|
@ -298,7 +298,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
path: 'testEndpoint',
|
path: 'testEndpoint',
|
||||||
port: 9999,
|
port: 9999,
|
||||||
response: '''{_ -> "<getResponse/>"}''',
|
response: '''{_ -> "<getResponse/>"}''',
|
||||||
method: AddMockRequestData.Method.GET
|
method: Method.GET
|
||||||
))
|
))
|
||||||
HttpGet restGet = new HttpGet('http://localhost:9999/testEndpoint')
|
HttpGet restGet = new HttpGet('http://localhost:9999/testEndpoint')
|
||||||
when:
|
when:
|
||||||
|
@ -321,7 +321,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
path: 'testEndpoint',
|
path: 'testEndpoint',
|
||||||
port: 9999,
|
port: 9999,
|
||||||
response: '''{_ -> "<traceResponse/>"}''',
|
response: '''{_ -> "<traceResponse/>"}''',
|
||||||
method: AddMockRequestData.Method.TRACE
|
method: Method.TRACE
|
||||||
))
|
))
|
||||||
HttpTrace restTrace = new HttpTrace('http://localhost:9999/testEndpoint')
|
HttpTrace restTrace = new HttpTrace('http://localhost:9999/testEndpoint')
|
||||||
when:
|
when:
|
||||||
|
@ -343,7 +343,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
name: 'testRest2',
|
name: 'testRest2',
|
||||||
path: 'testEndpoint',
|
path: 'testEndpoint',
|
||||||
port: 9999,
|
port: 9999,
|
||||||
method: AddMockRequestData.Method.HEAD
|
method: Method.HEAD
|
||||||
))
|
))
|
||||||
HttpHead restHead = new HttpHead('http://localhost:9999/testEndpoint')
|
HttpHead restHead = new HttpHead('http://localhost:9999/testEndpoint')
|
||||||
when:
|
when:
|
||||||
|
@ -365,7 +365,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
name: 'testRest2',
|
name: 'testRest2',
|
||||||
path: 'testEndpoint',
|
path: 'testEndpoint',
|
||||||
port: 9999,
|
port: 9999,
|
||||||
method: AddMockRequestData.Method.OPTIONS
|
method: Method.OPTIONS
|
||||||
))
|
))
|
||||||
HttpOptions restOptions = new HttpOptions('http://localhost:9999/testEndpoint')
|
HttpOptions restOptions = new HttpOptions('http://localhost:9999/testEndpoint')
|
||||||
when:
|
when:
|
||||||
|
@ -389,7 +389,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
port: 9999,
|
port: 9999,
|
||||||
predicate: '''{req -> req.xml.name() == 'request1'}''',
|
predicate: '''{req -> req.xml.name() == 'request1'}''',
|
||||||
response: '''{_ -> "<goodResponseRest1/>"}''',
|
response: '''{_ -> "<goodResponseRest1/>"}''',
|
||||||
method: AddMockRequestData.Method.PUT
|
method: Method.PUT
|
||||||
))
|
))
|
||||||
HttpPut request = new HttpPut('http://localhost:9999/test1')
|
HttpPut request = new HttpPut('http://localhost:9999/test1')
|
||||||
request.entity = new StringEntity('<request1/>', ContentType.create("text/xml", "UTF-8"))
|
request.entity = new StringEntity('<request1/>', ContentType.create("text/xml", "UTF-8"))
|
||||||
|
@ -413,7 +413,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
path: 'test1',
|
path: 'test1',
|
||||||
port: 9999,
|
port: 9999,
|
||||||
response: '''{_ -> "<goodResponseRest1/>"}''',
|
response: '''{_ -> "<goodResponseRest1/>"}''',
|
||||||
method: AddMockRequestData.Method.DELETE
|
method: Method.DELETE
|
||||||
))
|
))
|
||||||
HttpDelete request = new HttpDelete('http://localhost:9999/test1')
|
HttpDelete request = new HttpDelete('http://localhost:9999/test1')
|
||||||
when:
|
when:
|
||||||
|
@ -437,7 +437,7 @@ class MockServerIntegrationTest extends Specification {
|
||||||
port: 9999,
|
port: 9999,
|
||||||
predicate: '''{req -> req.xml.name() == 'request1'}''',
|
predicate: '''{req -> req.xml.name() == 'request1'}''',
|
||||||
response: '''{_ -> "<goodResponseRest1/>"}''',
|
response: '''{_ -> "<goodResponseRest1/>"}''',
|
||||||
method: AddMockRequestData.Method.PATCH
|
method: Method.PATCH
|
||||||
))
|
))
|
||||||
HttpPatch request = new HttpPatch('http://localhost:9999/test1')
|
HttpPatch request = new HttpPatch('http://localhost:9999/test1')
|
||||||
request.entity = new StringEntity('<request1/>', ContentType.create("text/xml", "UTF-8"))
|
request.entity = new StringEntity('<request1/>', ContentType.create("text/xml", "UTF-8"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue