Search in sources :

Example 16 with CmisBaseException

use of org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException in project copper-cms by PogeyanOSS.

the class TextReport method printResult.

private void printResult(int level, CmisTestResult result, Writer writer) throws IOException {
    printIntend(level, writer);
    writer.write(result.getStatus() + ": " + result.getMessage());
    if (result.getStackTrace() != null && result.getStackTrace().length > 0) {
        writer.write(" (" + result.getStackTrace()[0].getFileName() + ":" + result.getStackTrace()[0].getLineNumber() + ")");
    }
    writer.write(NL);
    if (result.getStatus() == CmisTestResultStatus.UNEXPECTED_EXCEPTION && result.getException() != null) {
        writer.write(NL + "Stacktrace:" + NL + NL);
        result.getException().printStackTrace(new PrintWriter(writer));
        if (result.getException() instanceof CmisBaseException) {
            CmisBaseException cbe = (CmisBaseException) result.getException();
            if (cbe.getErrorContent() != null) {
                writer.write(NL + "Error Content:" + NL + NL);
                writer.write(cbe.getErrorContent());
            }
        }
    }
    if (result.getException() != null) {
        printIntend(level, writer);
        writer.write("Exception: " + result.getException().getMessage() + NL);
    }
    if (result.getRequest() != null) {
        printIntend(level, writer);
        writer.write("Request: " + result.getRequest() + NL);
    }
    if (result.getResponse() != null) {
        printIntend(level, writer);
        writer.write("Response: " + result.getResponse() + NL);
    }
    for (CmisTestResult child : result.getChildren()) {
        printResult(level + 1, child, writer);
    }
}
Also used : CmisBaseException(org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException) CmisTestResult(org.apache.chemistry.opencmis.tck.CmisTestResult) PrintWriter(java.io.PrintWriter)

Aggregations

CmisBaseException (org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException)16 CmisTestResult (org.apache.chemistry.opencmis.tck.CmisTestResult)11 Folder (org.apache.chemistry.opencmis.client.api.Folder)8 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)8 HashMap (java.util.HashMap)7 CmisObject (org.apache.chemistry.opencmis.client.api.CmisObject)7 FileableCmisObject (org.apache.chemistry.opencmis.client.api.FileableCmisObject)7 ObjectType (org.apache.chemistry.opencmis.client.api.ObjectType)7 CmisInvalidArgumentException (org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException)4 CmisNotSupportedException (org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException)4 IOException (java.io.IOException)3 Document (org.apache.chemistry.opencmis.client.api.Document)3 ObjectId (org.apache.chemistry.opencmis.client.api.ObjectId)3 DocumentTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 PrintWriter (java.io.PrintWriter)2 Policy (org.apache.chemistry.opencmis.client.api.Policy)2 Relationship (org.apache.chemistry.opencmis.client.api.Relationship)2 ContentStream (org.apache.chemistry.opencmis.commons.data.ContentStream)2 ContentStreamImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl)2