Class AoservicesClient
java.lang.Object
org.alfresco.officeservices.testclient.AoservicesClient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumclassclassclassclassstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.http.client.CookieStoreprotected org.apache.http.impl.client.DefaultHttpClientprotected AoserviceClientMessageReceiverprotected static URLEncoder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(org.apache.http.cookie.Cookie cookie) protected static booleanarrayCompare(byte[] a1, byte[] a2) Compares two byte arrays and returns true if and only if both are identicalprotected voidcheckForRequiredHeaders(org.apache.http.HttpResponse serviceResponse, boolean strict) Checks the given HttpResponse for a set of required headers.booleanprotected voidemitMessage(String msg) execute(FPSERequest request) Execute the given FPSE request and return the response.booleanorg.dom4j.DocumentgetFileStatusFromMetaInfo(FPSEResponseElement metaInfo) getFPSECheckinDocument(URI serviceEndpoint, String fileUrl, String comment) getFPSECheckoutDocument(URI serviceEndpoint, String fileUrl, int timeout) getFPSEGetDocsMetaInfo(URI serviceEndpoint, List<String> targets) getFPSEGetDocument(URI serviceEndpoint, String fileUrl) getFPSEOpenService(URI serviceEndpoint) getFPSEUncheckoutDocument(URI serviceEndpoint, String fileUrl, boolean rlsshortterm) getFPSEUrlToWebUrl(URI target) getFPSEVersion(URI target) protected static StringgetHeaderValue(org.apache.http.HttpResponse serviceResponse, String headerName, boolean strict) Tries to get value from the last header with the given name.protected FPSEResponseElementgetMandatoryElement(FPSEResponseElement elem, String name) static byte[]getResourceAsByteArray(String resource) Returns a resource in the java ClassPath as byte array.static InputStreamgetResourceAsStream(String resource) Returns a resource in the java ClassPath as stream.getVtiInformation(URI target) booleangetWebForm(URI serviceEndpoint, String location, AoservicesClient.DialogType type, String filter) booleanoptions(URI target, AoservicesClient.OptionsHeaderValidation headerValidation) Performs a OPTIONS request to the given target and returns true if and only if the resource exists.booleanPerforms a PROPFIND request to the given target and returns true if and only if the resource exists.voidbooleansoapCheckin(URI serviceEndpoint, URI target, String comment) booleansoapCheckout(URI serviceEndpoint, URI target, boolean checkoutToLocal) protected static byte[]Reads the contents in the input stream and returns it as byte array.booleantestWebFormExistence(URI serviceEndpoint, String location, AoservicesClient.DialogType type) void
-
Field Details
-
urlEncoder
-
httpClient
protected org.apache.http.impl.client.DefaultHttpClient httpClient -
cookieStore
protected org.apache.http.client.CookieStore cookieStore -
messageReceiver
-
-
Constructor Details
-
AoservicesClient
-
-
Method Details
-
addCookie
public void addCookie(org.apache.http.cookie.Cookie cookie) -
setMessageReceiver
-
emitMessage
-
getVtiInformation
public AoservicesClient.VTI_INF_VERSION getVtiInformation(URI target) throws ServiceCommunicationException, ServiceResponseException -
options
public boolean options(URI target, AoservicesClient.OptionsHeaderValidation headerValidation) throws ServiceCommunicationException, ServiceResponseException Performs a OPTIONS request to the given target and returns true if and only if the resource exists.- Parameters:
target- the URI to test- Returns:
- true if and only if the resource exists
- Throws:
ServiceCommunicationExceptionServiceResponseException
-
propfind
Performs a PROPFIND request to the given target and returns true if and only if the resource exists.- Parameters:
target- the URI to test- Returns:
- true if and only if the resource exists
- Throws:
ServiceCommunicationExceptionServiceResponseException
-
lock
public String lock(URI target, String currentLockToken) throws ServiceCommunicationException, ServiceResponseException -
unlock
public void unlock(URI target, String currentLockToken) throws ServiceCommunicationException, ServiceResponseException -
execute
public FPSEResponse execute(FPSERequest request) throws ServiceCommunicationException, ServiceResponseException Execute the given FPSE request and return the response.- Parameters:
request- the request to be executed- Returns:
- the FPSE result
- Throws:
ServiceCommunicationExceptionServiceResponseException
-
getFPSEVersion
public AoservicesClient.FPSEVersion getFPSEVersion(URI target) throws ServiceCommunicationException, ServiceResponseException -
getFPSEUrlToWebUrl
public AoservicesClient.FPSEUrlToWebUrl getFPSEUrlToWebUrl(URI target) throws ServiceCommunicationException, ServiceResponseException -
getFPSEOpenService
public FPSEResponseElement getFPSEOpenService(URI serviceEndpoint) throws ServiceCommunicationException, ServiceResponseException -
getFPSEGetDocsMetaInfo
public AoservicesClient.FPSEGetDocsMetaInfo getFPSEGetDocsMetaInfo(URI serviceEndpoint, List<String> targets) throws ServiceCommunicationException, ServiceResponseException -
getFPSEGetDocument
public AoservicesClient.FileStatus getFPSEGetDocument(URI serviceEndpoint, String fileUrl) throws ServiceCommunicationException, ServiceResponseException -
getFPSECheckoutDocument
public AoservicesClient.FileStatus getFPSECheckoutDocument(URI serviceEndpoint, String fileUrl, int timeout) throws ServiceCommunicationException, ServiceResponseException -
getFPSEUncheckoutDocument
public AoservicesClient.FileStatus getFPSEUncheckoutDocument(URI serviceEndpoint, String fileUrl, boolean rlsshortterm) throws ServiceCommunicationException, ServiceResponseException -
getFPSECheckinDocument
public AoservicesClient.FileStatus getFPSECheckinDocument(URI serviceEndpoint, String fileUrl, String comment) throws ServiceCommunicationException, ServiceResponseException -
getFileStatusFromMetaInfo
public AoservicesClient.FileStatus getFileStatusFromMetaInfo(FPSEResponseElement metaInfo) throws ServiceResponseException - Throws:
ServiceResponseException
-
doHead
-
testWebFormExistence
public boolean testWebFormExistence(URI serviceEndpoint, String location, AoservicesClient.DialogType type) throws ServiceCommunicationException, ServiceResponseException -
getWebForm
public boolean getWebForm(URI serviceEndpoint, String location, AoservicesClient.DialogType type, String filter) throws ServiceCommunicationException, ServiceResponseException -
get
-
soapCheckout
public boolean soapCheckout(URI serviceEndpoint, URI target, boolean checkoutToLocal) throws ServiceCommunicationException, ServiceResponseException -
soapCheckin
public boolean soapCheckin(URI serviceEndpoint, URI target, String comment) throws ServiceCommunicationException, ServiceResponseException -
getMandatoryElement
protected FPSEResponseElement getMandatoryElement(FPSEResponseElement elem, String name) throws ServiceResponseException - Throws:
ServiceResponseException
-
checkForRequiredHeaders
protected void checkForRequiredHeaders(org.apache.http.HttpResponse serviceResponse, boolean strict) throws ServiceResponseException Checks the given HttpResponse for a set of required headers. Throws ServiceResponseException if headers are missing or invalid.- Parameters:
serviceResponse- the HttpResponse to test- Throws:
ServiceResponseException- if headers are missing or invalid
-
getHeaderValue
protected static String getHeaderValue(org.apache.http.HttpResponse serviceResponse, String headerName, boolean strict) throws ServiceResponseException Tries to get value from the last header with the given name. Throws ServiceResponseException if header is not present.- Parameters:
serviceResponse- the response to get the header fromheaderName- the name of the header- Returns:
- the value from the last header with the given name
- Throws:
ServiceResponseException- if header is not present
-
arrayCompare
protected static boolean arrayCompare(byte[] a1, byte[] a2) Compares two byte arrays and returns true if and only if both are identical- Parameters:
a1- the first arraya2- the second array- Returns:
- true if and only if both arrays are identical
-
streamToByteArray
Reads the contents in the input stream and returns it as byte array.- Parameters:
in- The input stream containing the data- Returns:
- the data from the input stream as byte array
- Throws:
IOException
-
getResourceAsByteArray
Returns a resource in the java ClassPath as byte array.- Parameters:
resource- name of resource to load- Returns:
- the byte array
-
getResourceAsStream
Returns a resource in the java ClassPath as stream.- Parameters:
resource- name of resource to load- Returns:
- the stream
-
getDocumentFromStream
public org.dom4j.Document getDocumentFromStream(InputStream is) throws IOException, org.dom4j.DocumentException - Throws:
IOExceptionorg.dom4j.DocumentException
-