This project has retired. For details please refer to its
Attic page.
RootFolderTest 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.tck.tests.basics;
2021importstatic org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
22importstatic org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
23importstatic org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
2425import java.util.Map;
2627import org.apache.chemistry.opencmis.client.api.Folder;
28import org.apache.chemistry.opencmis.client.api.Session;
29import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
30import org.apache.chemistry.opencmis.commons.enums.Action;
31import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
32import org.apache.chemistry.opencmis.tck.CmisTestResult;
33import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
3435/**36 * Basic root folder tests.37 */38publicclassRootFolderTestextendsAbstractSessionTest {
3940 @Override
41publicvoid init(Map<String, String> parameters) {
42super.init(parameters);
43 setName("Root Folder Test");
44 setDescription("Checks the root folder and its children for specification compliance.");
45 }
4647 @Override
48publicvoid run(Session session) throws Exception {
49CmisTestResult success;
50CmisTestResult failure;
5152// check root folder id53 RepositoryInfo ri = getRepositoryInfo(session);
5455 success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
56 failure = createResult(FAILURE, "Root folder id is not set!");
57 addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
5859// get the root folder60 Folder rootFolder = session.getRootFolder(SELECT_ALL_NO_CACHE_OC);
6162if (rootFolder == null) {
63 addResult(createResult(FAILURE, "Root folder is not available!"));
64return;
65 }
6667 addResult(checkObject(session, rootFolder, getAllProperties(rootFolder), "Root folder object spec compliance"));
6869// folder and path70 failure = createResult(FAILURE,
71"Root folder id in the repository info doesn't match the root folder object id!");
72 addResult(assertEquals(ri.getRootFolderId(), rootFolder.getId(), null, failure));
7374 failure = createResult(FAILURE, "Root folder is not a cmis:folder!");
75 addResult(assertEquals(BaseTypeId.CMIS_FOLDER, rootFolder.getBaseTypeId(), null, failure));
7677 failure = createResult(FAILURE, "Root folder path is not '/'!");
78 addResult(assertEquals("/", rootFolder.getPath(), null, failure));
7980 failure = createResult(FAILURE, "Root folder has parents!");
81 addResult(assertEquals(0, rootFolder.getParents().size(), null, failure));
8283// allowable actions84 failure = createResult(FAILURE, "Root folder has CAN_GET_FOLDER_PARENT allowable action!");
85 addResult(assertNotAllowableAction(rootFolder, Action.CAN_GET_FOLDER_PARENT, null, failure));
8687 failure = createResult(WARNING, "Root folder has no CAN_GET_CHILDREN allowable action!");
88 addResult(assertAllowableAction(rootFolder, Action.CAN_GET_CHILDREN, null, failure));
8990// simple children test91 addResult(checkChildren(session, rootFolder, "Root folder children check"));
92 }
93 }