Refactort server and client
This commit is contained in:
parent
f72e510fea
commit
fda5b6ca5c
13 changed files with 188 additions and 96 deletions
|
@ -1,6 +1,11 @@
|
|||
package pl.touk.mockserver.client
|
||||
|
||||
class InvalidMockDefinitionException extends RuntimeException{
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
@CompileStatic
|
||||
@TypeChecked
|
||||
class InvalidMockDefinitionException extends RuntimeException {
|
||||
InvalidMockDefinitionException(String s) {
|
||||
super(s)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
package pl.touk.mockserver.client
|
||||
|
||||
class MockAlreadyExists extends RuntimeException{}
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
@CompileStatic
|
||||
@TypeChecked
|
||||
class MockAlreadyExists extends RuntimeException {}
|
|
@ -1,4 +1,9 @@
|
|||
package pl.touk.mockserver.client
|
||||
|
||||
class MockDoesNotExist extends RuntimeException{
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
@CompileStatic
|
||||
@TypeChecked
|
||||
class MockDoesNotExist extends RuntimeException {
|
||||
}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package pl.touk.mockserver.client
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
@CompileStatic
|
||||
@TypeChecked
|
||||
class RemoveMockRequestData {
|
||||
String name
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package pl.touk.mockserver.client
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
import groovy.transform.PackageScope
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TypeChecked
|
||||
import groovy.util.slurpersupport.GPathResult
|
||||
import org.apache.http.HttpEntity
|
||||
import org.apache.http.client.methods.CloseableHttpResponse
|
||||
import org.apache.http.util.EntityUtils
|
||||
|
||||
@CompileStatic
|
||||
@TypeChecked
|
||||
class Util {
|
||||
static GPathResult extractXmlResponse(CloseableHttpResponse response){
|
||||
static GPathResult extractXmlResponse(CloseableHttpResponse response) {
|
||||
HttpEntity entity = response.entity
|
||||
GPathResult xml = new XmlSlurper().parseText(EntityUtils.toString(entity))
|
||||
EntityUtils.consumeQuietly(entity)
|
||||
|
|
|
@ -334,8 +334,8 @@ class MockServerIntegrationTest extends Specification {
|
|||
when:
|
||||
CloseableHttpResponse response = client.execute(restHead)
|
||||
then:
|
||||
response.statusLine.statusCode == 200
|
||||
EntityUtils.consumeQuietly(response.entity)
|
||||
response.statusLine.statusCode == 200
|
||||
}
|
||||
|
||||
def "should dispatch rest mock with options method"() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue