Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…

<?xml version="1.0" encoding="UTF-8"?> | |
<con:soapui-project id="5aa26c5b-04cf-457f-a718-8a448f99bf0c" activeEnvironment="Default" name="contract" resourceRoot="" soapui-version="5.4.0" abortOnError="false" runType="SEQUENTIAL" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:RestService" id="152ee72a-91c1-4386-9152-fa325b4e4f9c" wadlVersion="http://wadl.dev.java.net/2009/02" name="REST Tests of MockService" type="rest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings/><con:definitionCache type="TEXT" rootPart=""/><con:endpoints><con:endpoint>http://localhost:8080</con:endpoint></con:endpoints><con:resource name="Contracts for client 0" path="/0/contracts" id="cfe24a8b-753d-44db-9cb5-9b3b98b711ba"><con:settings/><con:parameters/><con:method name="Contracts" id="cc058aa9-4e7b-4805-96d2-9264085cc9c1" method="GET"><con:settings/><con:parameters/><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:con1="http://localhost/0/contracts">con1:Response</con:element></con:representation><con:request name="Request 1" id="b3ec8916-3bc0-440a-9329-4e7250ca78e5" mediaType="application/json"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8080</con:endpoint><con:request/><con:originalUri>http://localhost/0/contracts</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request></con:method></con:resource></con:interface><con:restMockService id="326a7da2-0c88-4b34-9e8d-84c74374ecca" port="8080" path="/" host="cailleteau-netbook" name="REST MockService"><con:settings/><con:properties/><con:restMockAction name="/0/contracts" method="GET" resourcePath="/0/contracts" id="8a254914-7aa3-4269-a6fd-1fe1325e9b04"><con:settings/><con:defaultResponse>Response 1</con:defaultResponse><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/* | |
// Script dispatcher is used to select a response based on the incoming request. | |
// Here are few examples showing how to match based on path, query param, header and body | |
// Match based on path | |
def requestPath = mockRequest.getPath() | |
log.info "Path: "+ requestPath | |
if( requestPath.contains("json") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "JSON Response" | |
} | |
// Match based on query parameter | |
def queryString = mockRequest.getRequest().getQueryString() | |
log.info "QueryString: " + queryString | |
if( queryString.contains("stockholm") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response Stockholm" | |
} | |
else if( queryString.contains("london") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response London" | |
} | |
// Match based on header | |
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding") | |
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList | |
if( acceptEncodingHeaderList.contains("gzip,deflate") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "GZiped Response" | |
} | |
// Match based on body | |
def requestBody = mockRequest.getRequestContent() | |
log.info "Request body: " + requestBody | |
if( requestBody.contains("some data") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response N" | |
} | |
*/ | |
</con:dispatchPath><con:response name="Response 1" id="9a1d1c81-50ef-45e1-9114-a68af561303f" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>{ | |
"car-contracts": [ | |
{ | |
"id": 4870, | |
"start-day": 28, | |
"start-month": 11, | |
"start-year": 2011, | |
"model": "renault twingo" | |
} | |
], | |
"home-contracts": [ | |
{ | |
"id": 4871, | |
"start-day": 28, | |
"start-month": 11, | |
"start-year": 2011 | |
} | |
] | |
}</con:responseContent></con:response></con:restMockAction><con:restMockAction name="/1/contracts" method="GET" resourcePath="/1/contracts" id="f7e35e7a-a89c-42ec-8667-7aacc50a443d"><con:settings/><con:defaultResponse>Response 1</con:defaultResponse><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/* | |
// Script dispatcher is used to select a response based on the incoming request. | |
// Here are few examples showing how to match based on path, query param, header and body | |
// Match based on path | |
def requestPath = mockRequest.getPath() | |
log.info "Path: "+ requestPath | |
if( requestPath.contains("json") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "JSON Response" | |
} | |
// Match based on query parameter | |
def queryString = mockRequest.getRequest().getQueryString() | |
log.info "QueryString: " + queryString | |
if( queryString.contains("stockholm") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response Stockholm" | |
} | |
else if( queryString.contains("london") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response London" | |
} | |
// Match based on header | |
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding") | |
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList | |
if( acceptEncodingHeaderList.contains("gzip,deflate") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "GZiped Response" | |
} | |
// Match based on body | |
def requestBody = mockRequest.getRequestContent() | |
log.info "Request body: " + requestBody | |
if( requestBody.contains("some data") ) | |
{ | |
// return the name of the response you want to dispatch | |
return "Response N" | |
} | |
*/ | |
</con:dispatchPath><con:response name="Response 1" id="fad6c6e7-b9d1-4c0a-83a8-12a719fa79c3" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>{ | |
"contracts": [ | |
{ | |
"id": 4872, | |
"type": "car", | |
"start-day": 28, | |
"start-month": 11, | |
"start-year": 2011 | |
}, | |
{ | |
"id": 4873, | |
"type": "home", | |
"start-day": 28, | |
"start-month": 11, | |
"start-year": 2011 | |
} | |
] | |
}</con:responseContent></con:response></con:restMockAction></con:restMockService><con:properties/><con:wssContainer/><con:oAuth2ProfileContainer/><con:oAuth1ProfileContainer/><con:sensitiveInformation/></con:soapui-project> |