public final class SoroushService extends Object
| Modifier and Type | Method and Description |
|---|---|
<T> T |
assertSuccessful(javax.ws.rs.core.Response response,
Class<T> responseType,
SoroushMessage soroushMessage)
throw IOException if the exception is instance of SoroushException it indicates that the soroush does not accept
the message and therefore resending the request will never be succeed
|
SoroushResponse |
assertSuccessful(javax.ws.rs.core.Response response,
SoroushMessage soroushMessage)
check if the response is successfully sent to soroush, by default it assumes that the response type is
SoroushResponse
|
javax.ws.rs.client.WebTarget |
createDownloadFileTarget(String token,
String fileId,
Integer timeOut)
create
WebTarget for downloading file from server |
javax.ws.rs.client.WebTarget |
createSendMessageTarget(String token,
Integer timeOut)
create
WebTarget for sending message to server |
javax.ws.rs.client.WebTarget |
createUploadFileTarget(String token,
Integer timeOut)
create
WebTarget for uploading file to server |
String |
generateUrl(String token,
SoroushAction type,
String fileId)
create fully qualified URL, given the token, endpoint and fileId if needed.
|
static SoroushService |
get() |
void |
setAlternativeUrl(String alternativeUrl)
set
alternativeUrl that should be used for testing |
public static SoroushService get()
public String generateUrl(String token, SoroushAction type, String fileId)
token - type - fileId - public javax.ws.rs.client.WebTarget createUploadFileTarget(String token, Integer timeOut)
WebTarget for uploading file to servertoken - timeOut - public javax.ws.rs.client.WebTarget createSendMessageTarget(String token, Integer timeOut)
WebTarget for sending message to servertoken - timeOut - public javax.ws.rs.client.WebTarget createDownloadFileTarget(String token, String fileId, Integer timeOut)
WebTarget for downloading file from servertoken - fileId - timeOut - public SoroushResponse assertSuccessful(javax.ws.rs.core.Response response, SoroushMessage soroushMessage) throws IOException, SoroushException
response - the responsesoroushMessage - the message that we are checking its success, only for logging purposeIOException - if can not connect to soroush serverSoroushException - if soroush reject the responsepublic <T> T assertSuccessful(javax.ws.rs.core.Response response,
Class<T> responseType,
SoroushMessage soroushMessage)
throws IOException,
SoroushException
T - the class that we expect the response should be of this typeresponse - the responseresponseType - expecting response type from soroushsoroushMessage - the message that we are checking its success, only for logging purposeIOException - if sending message to soroush server is not successfulSoroushException - if soroush reject the response with an error codepublic void setAlternativeUrl(String alternativeUrl)
alternativeUrl that should be used for testingalternativeUrl - Apache Camel