com.atlassian.sal.testresources.net
Class MockRequest
java.lang.Object
com.atlassian.sal.testresources.net.MockRequest
- All Implemented Interfaces:
- Request<MockRequest,MockResponse>
public class MockRequest
- extends Object
- implements Request<MockRequest,MockResponse>
Mock request that provides getters to all the information that is passed in, and also setters for the
response body that should be returned for execute(), or the response that should be passed to the
response handler.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MockRequest
public MockRequest(Request.MethodType methodType,
String url)
setConnectionTimeout
public MockRequest setConnectionTimeout(int connectionTimeout)
- Specified by:
setConnectionTimeout in interface Request<MockRequest,MockResponse>
setSoTimeout
public MockRequest setSoTimeout(int soTimeout)
- Specified by:
setSoTimeout in interface Request<MockRequest,MockResponse>
setUrl
public MockRequest setUrl(String url)
- Specified by:
setUrl in interface Request<MockRequest,MockResponse>
setRequestBody
public MockRequest setRequestBody(String requestBody)
- Specified by:
setRequestBody in interface Request<MockRequest,MockResponse>
setFiles
public MockRequest setFiles(List<RequestFilePart> files)
- Specified by:
setFiles in interface Request<MockRequest,MockResponse>
setEntity
public MockRequest setEntity(Object entity)
- Specified by:
setEntity in interface Request<MockRequest,MockResponse>
setRequestContentType
public MockRequest setRequestContentType(String contentType)
- Specified by:
setRequestContentType in interface Request<MockRequest,MockResponse>
addRequestParameters
public MockRequest addRequestParameters(String... params)
- Specified by:
addRequestParameters in interface Request<MockRequest,MockResponse>
addHeader
public MockRequest addHeader(String headerName,
String headerValue)
- Specified by:
addHeader in interface Request<MockRequest,MockResponse>
setHeader
public MockRequest setHeader(String headerName,
String headerValue)
- Specified by:
setHeader in interface Request<MockRequest,MockResponse>
setFollowRedirects
public MockRequest setFollowRedirects(boolean follow)
- Specified by:
setFollowRedirects in interface Request<MockRequest,MockResponse>
addAuthentication
public MockRequest addAuthentication(Authenticator authenticator)
- Specified by:
addAuthentication in interface Request<MockRequest,MockResponse>
addTrustedTokenAuthentication
public MockRequest addTrustedTokenAuthentication()
- Specified by:
addTrustedTokenAuthentication in interface Request<MockRequest,MockResponse>
addTrustedTokenAuthentication
public MockRequest addTrustedTokenAuthentication(String username)
- Specified by:
addTrustedTokenAuthentication in interface Request<MockRequest,MockResponse>
addBasicAuthentication
public MockRequest addBasicAuthentication(String username,
String password)
- Specified by:
addBasicAuthentication in interface Request<MockRequest,MockResponse>
addSeraphAuthentication
public MockRequest addSeraphAuthentication(String username,
String password)
- Specified by:
addSeraphAuthentication in interface Request<MockRequest,MockResponse>
executeAndReturn
public <RET> RET executeAndReturn(ReturningResponseHandler<MockResponse,RET> responseHandler)
throws ResponseException
- Specified by:
executeAndReturn in interface Request<MockRequest,MockResponse>
- Throws:
ResponseException
execute
public void execute(ResponseHandler responseHandler)
throws ResponseException
- Specified by:
execute in interface Request<MockRequest,MockResponse>
- Throws:
ResponseException
execute
public String execute()
throws ResponseException
- Specified by:
execute in interface Request<MockRequest,MockResponse>
- Throws:
ResponseException
getMethodType
public Request.MethodType getMethodType()
getUrl
public String getUrl()
getConnectionTimeout
public int getConnectionTimeout()
getSoTimeout
public int getSoTimeout()
getRequestBody
public String getRequestBody()
getRequestContentType
public String getRequestContentType()
getRequestParameters
public List<String> getRequestParameters()
getHeaders
public Map<String,List<String>> getHeaders()
- Specified by:
getHeaders in interface Request<MockRequest,MockResponse>
getHeader
public List<String> getHeader(String headerName)
getAuthenticators
public List<Authenticator> getAuthenticators()
isTrustedTokenAuthentication
public boolean isTrustedTokenAuthentication()
getTrustedTokenUser
public String getTrustedTokenUser()
getBasicUser
public String getBasicUser()
getBasicPassword
public String getBasicPassword()
getSeraphUser
public String getSeraphUser()
getSeraphPassword
public String getSeraphPassword()
getResponse
public Response getResponse()
setResponse
public void setResponse(MockResponse response)
setResponseBody
public void setResponseBody(String responseBody)
Copyright © 2013 Atlassian. All Rights Reserved.