Search in sources :

Example 1 with CmisTestResultStatus

use of org.apache.chemistry.opencmis.tck.CmisTestResultStatus in project copper-cms by PogeyanOSS.

the class AbstractSessionTest method checkACL.

protected CmisTestResult checkACL(Session session, Acl acl, boolean checkExact, String message) {
    List<CmisTestResult> results = new ArrayList<CmisTestResult>();
    CmisTestResult f;
    f = createResult(FAILURE, "ACL is null!");
    addResult(results, assertNotNull(acl, null, f));
    if (acl != null) {
        f = createResult(FAILURE, "List of ACEs is null!");
        addResult(results, assertNotNull(acl.getAces(), null, f));
        if (acl.getAces() != null) {
            for (Ace ace : acl.getAces()) {
                f = createResult(FAILURE, "ACE with empty principal ID!");
                addResult(results, assertStringNotEmpty(ace.getPrincipalId(), null, f));
                f = createResult(FAILURE, "ACE with empty permission list!");
                addResult(results, assertListNotEmpty(ace.getPermissions(), null, f));
                if (ace.getPermissions() != null) {
                    for (String permission : ace.getPermissions()) {
                        f = createResult(FAILURE, "ACE with empty permission entry!");
                        addResult(results, assertStringNotEmpty(permission, null, f));
                    }
                }
            }
        }
        CmisTestResultStatus status = checkExact ? WARNING : INFO;
        f = createResult(status, "ACL is provided but the isExact flag is not set!");
        addResult(results, assertNotNull(acl.isExact(), null, f));
    }
    CmisTestResultImpl result = createResult(getWorst(results), message);
    result.getChildren().addAll(results);
    return result.getStatus().getLevel() <= OK.getLevel() ? null : result;
}
Also used : Ace(org.apache.chemistry.opencmis.commons.data.Ace) CmisTestResultStatus(org.apache.chemistry.opencmis.tck.CmisTestResultStatus) CmisTestResult(org.apache.chemistry.opencmis.tck.CmisTestResult) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 Ace (org.apache.chemistry.opencmis.commons.data.Ace)1 CmisTestResult (org.apache.chemistry.opencmis.tck.CmisTestResult)1 CmisTestResultStatus (org.apache.chemistry.opencmis.tck.CmisTestResultStatus)1