This project has retired. For details please refer to its
Attic page.
ObjectComplianceCheck xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.workbench.checks;
2021import java.util.Map;
2223import org.apache.chemistry.opencmis.client.api.CmisObject;
24import org.apache.chemistry.opencmis.client.api.Document;
25import org.apache.chemistry.opencmis.client.api.Folder;
26import org.apache.chemistry.opencmis.client.api.Session;
27import org.apache.chemistry.opencmis.tck.CmisTestResultStatus;
28import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
2930/**31 * This class checks an object for CMIS specification compliance.32 */33publicclassObjectComplianceCheckextends AbstractSessionTest {
3435private String objectId;
3637publicObjectComplianceCheck(String objectId) throws Exception {
38this.objectId = objectId;
39 }
4041 @Override
42publicvoid init(Map<String, String> parameters) {
43super.init(parameters);
44 setName("Object Compliance Check");
45 }
4647 @Override
48publicvoid run(Session session) throws Exception {
49 CmisObject object = session.getObject(objectId, SELECT_ALL_NO_CACHE_OC);
50 String[] propertiesToCheck = getAllProperties(object);
5152 addResult(checkObject(session, object, propertiesToCheck, "Object check: " + object.getId()));
5354if (object instanceof Document) {
55 addResult(checkVersionHistory(session, object, propertiesToCheck,
56"Version history check: " + object.getId()));
57 } elseif (object instanceof Folder) {
58 addResult(checkChildren(session, (Folder) object, "Folder children check: " + object.getId()));
59 }
6061if (getResults().isEmpty()) {
62 addResult(createResult(CmisTestResultStatus.OK, "Object seems to be compliant! Id: " + object.getId()));
63 }
64 }
65 }