This project has retired. For details please refer to its
Attic page.
MoveTest 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.crud;
2021importstatic org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
2223import java.util.Map;
2425import org.apache.chemistry.opencmis.client.api.Document;
26import org.apache.chemistry.opencmis.client.api.Folder;
27import org.apache.chemistry.opencmis.client.api.Session;
28import org.apache.chemistry.opencmis.tck.CmisTestResult;
29import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
3031/**32 * Copy test.33 */34publicclassMoveTestextendsAbstractSessionTest {
3536 @Override
37publicvoid init(Map<String, String> parameters) {
38super.init(parameters);
39 setName("Move Test");
40 setDescription("Creates two folders and a document and moves the document from one folder to the other.");
41 }
4243 @Override
44publicvoid run(Session session) {
45CmisTestResult f;
4647try {
48// create folders49 Folder testFolder = createTestFolder(session);
50 Folder folder1 = createFolder(session, testFolder, "movefolder1");
51 Folder folder2 = createFolder(session, testFolder, "movefolder2");
5253// create document54 Document doc1 = createDocument(session, folder1, "movetestdoc.txt", "move test");
5556// move57 Document doc2 = (Document) doc1.move(folder1, folder2, SELECT_ALL_NO_CACHE_OC);
5859if (doc2 == null) {
60 addResult(createResult(FAILURE, "Moved document is null!"));
61 } else {
62 addResult(checkObject(session, doc2, getAllProperties(doc2),
63"Moved document check. Id: + " + doc2.getName()));
64 }
6566int count1 = countFolderChildren(folder1);
67 f = createResult(FAILURE, "Source folder should be empty after move but has " + count1 + " children!");
68 addResult(assertEquals(0, count1, null, f));
6970int count2 = countFolderChildren(folder2);
71 f = createResult(FAILURE, "Target folder should have exactly one child but has " + count2 + " children!");
72 addResult(assertEquals(1, count2, null, f));
73 } finally {
74// clean up75 deleteTestFolder();
76 }
77 }
78 }