Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3B7D17A32 for ; Mon, 6 Apr 2015 17:17:05 +0000 (UTC) Received: (qmail 69286 invoked by uid 500); 6 Apr 2015 17:17:05 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 69173 invoked by uid 500); 6 Apr 2015 17:17:05 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 68140 invoked by uid 99); 6 Apr 2015 17:17:04 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 17:17:04 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id C8043AC0E1C for ; Mon, 6 Apr 2015 17:17:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r946539 [17/22] - in /websites/staging/chemistry/trunk/content: ./ java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/ java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/css/ java/0.13.0/maven/chemistry... Date: Mon, 06 Apr 2015 17:17:02 -0000 To: commits@chemistry.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150406171704.C8043AC0E1C@hades.apache.org> Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/FilingTestGroup.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/FilingTestGroup.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/FilingTestGroup.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,53 @@ + + + + +FilingTestGroup xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.filing;
+20  
+21  import java.util.Map;
+22  
+23  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
+24  
+25  /**
+26   * This test group contains multifiling and unfiling tests.
+27   */
+28  public class FilingTestGroup extends AbstractSessionTestGroup {
+29      @Override
+30      public void init(Map<String, String> parameters) throws Exception {
+31          super.init(parameters);
+32  
+33          setName("Filing Test Group");
+34          setDescription("Multifiling anf Unfiling tests.");
+35  
+36          addTest(new MultifilingTest());
+37          addTest(new UnfilingTest());
+38      }
+39  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/MultifilingTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/MultifilingTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/MultifilingTest.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,151 @@ + + + + +MultifilingTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.filing;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+23  
+24  import java.util.Map;
+25  
+26  import org.apache.chemistry.opencmis.client.api.Document;
+27  import org.apache.chemistry.opencmis.client.api.Folder;
+28  import org.apache.chemistry.opencmis.client.api.Session;
+29  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+30  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+31  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+32  
+33  /**
+34   * Multifiling test.
+35   */
+36  public class MultifilingTest extends AbstractSessionTest {
+37  
+38      @Override
+39      public void init(Map<String, String> parameters) {
+40          super.init(parameters);
+41          setName("Multifiling Test");
+42          setDescription("Creates two folders and a document in one of the folders, "
+43                  + "adds the document to the second folder and then removes it again for the second folder.");
+44      }
+45  
+46      @Override
+47      public void run(Session session) {
+48          if (supportsMultifiling(session)) {
+49              CmisTestResult f;
+50  
+51              int count1;
+52              int count2;
+53              int parents;
+54  
+55              try {
+56                  // create folders
+57                  Folder testFolder = createTestFolder(session);
+58                  Folder folder1 = createFolder(session, testFolder, "folder1");
+59                  Folder folder2 = createFolder(session, testFolder, "folder2");
+60  
+61                  // create document
+62                  Document doc1 = createDocument(session, folder1, "testdoc.txt", "multifiling test");
+63  
+64                  addResult(checkChildren(session, folder1, "Folder 1 after createDocument()"));
+65                  addResult(checkChildren(session, folder2, "Folder 2 after createDocument()"));
+66  
+67                  count1 = countFolderChildren(folder1);
+68                  f = createResult(FAILURE, "Folder 1 should have exactly one child but has " + count1 + " children!");
+69                  addResult(assertEquals(1, count1, null, f));
+70  
+71                  count2 = countFolderChildren(folder2);
+72                  f = createResult(FAILURE, "Folder 2 should not have children but has " + count2 + " children!");
+73                  addResult(assertEquals(0, count2, null, f));
+74  
+75                  parents = doc1.getParents().size();
+76                  f = createResult(FAILURE, "Document should have one parent but has " + parents + " parents!");
+77                  addResult(assertEquals(1, parents, null, f));
+78  
+79                  // add to other folder
+80                  doc1.addToFolder(folder2, true);
+81  
+82                  addResult(checkChildren(session, folder1, "Folder 1 after addToFolder()"));
+83                  addResult(checkChildren(session, folder2, "Folder 2 after addToFolder()"));
+84  
+85                  count1 = countFolderChildren(folder1);
+86                  f = createResult(FAILURE, "Folder 1 should have exactly one child but has " + count1 + " children!");
+87                  addResult(assertEquals(1, count1, null, f));
+88  
+89                  count2 = countFolderChildren(folder2);
+90                  f = createResult(FAILURE, "Folder 2 should have exactly one child but has " + count2 + " children!");
+91                  addResult(assertEquals(1, count2, null, f));
+92  
+93                  parents = doc1.getParents().size();
+94                  f = createResult(FAILURE, "Document should have two parents but has " + parents + " parents!");
+95                  addResult(assertEquals(2, parents, null, f));
+96  
+97                  // remove from first folder
+98                  doc1.removeFromFolder(folder2);
+99  
+100                 addResult(checkChildren(session, folder1, "Folder 1 after removeFromFolder()"));
+101                 addResult(checkChildren(session, folder2, "Folder 2 after removeFromFolder()"));
+102 
+103                 count1 = countFolderChildren(folder1);
+104                 f = createResult(FAILURE, "Folder 1 should have exactly one child but has " + count1 + " children!");
+105                 addResult(assertEquals(1, count1, null, f));
+106 
+107                 count2 = countFolderChildren(folder2);
+108                 f = createResult(FAILURE, "Folder 2 should not have children but has " + count2 + " children!");
+109                 addResult(assertEquals(0, count2, null, f));
+110 
+111                 parents = doc1.getParents().size();
+112                 f = createResult(FAILURE, "Document should have one parent but has " + parents + " parents!");
+113                 addResult(assertEquals(1, parents, null, f));
+114 
+115                 // delete everything
+116                 deleteObject(doc1);
+117                 deleteObject(folder2);
+118                 deleteObject(folder1);
+119             } finally {
+120                 // clean up
+121                 deleteTestFolder();
+122             }
+123         } else {
+124             addResult(createResult(SKIPPED, "Multifling not supported. Test Skipped!"));
+125         }
+126     }
+127 
+128     protected boolean supportsMultifiling(Session session) {
+129         RepositoryInfo repository = session.getRepositoryInfo();
+130 
+131         if (repository.getCapabilities().isMultifilingSupported() == null) {
+132             return false;
+133         }
+134 
+135         return repository.getCapabilities().isMultifilingSupported().booleanValue();
+136     }
+137 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/UnfilingTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/UnfilingTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/UnfilingTest.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,132 @@ + + + + +UnfilingTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.filing;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+23  
+24  import java.util.Map;
+25  
+26  import org.apache.chemistry.opencmis.client.api.Document;
+27  import org.apache.chemistry.opencmis.client.api.Folder;
+28  import org.apache.chemistry.opencmis.client.api.Session;
+29  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+30  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+31  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+32  
+33  /**
+34   * Unfiling test.
+35   */
+36  public class UnfilingTest extends AbstractSessionTest {
+37  
+38      @Override
+39      public void init(Map<String, String> parameters) {
+40          super.init(parameters);
+41          setName("Unfiling Test");
+42          setDescription("Creates a folder and a document, removes the document from the folder and then adds it again.");
+43      }
+44  
+45      @Override
+46      public void run(Session session) {
+47          if (supportsUnfiling(session)) {
+48              CmisTestResult f;
+49  
+50              int count;
+51              int parents;
+52  
+53              try {
+54                  // create folders
+55                  Folder testFolder = createTestFolder(session);
+56                  Folder folder1 = createFolder(session, testFolder, "folder1");
+57  
+58                  // create document
+59                  Document doc1 = createDocument(session, folder1, "testdoc.txt", "unfiling test");
+60  
+61                  addResult(checkChildren(session, folder1, "Folder after createDocument()"));
+62  
+63                  count = countFolderChildren(folder1);
+64                  f = createResult(FAILURE, "Folder should have exactly one child but has " + count + " children!");
+65                  addResult(assertEquals(1, count, null, f));
+66  
+67                  parents = doc1.getParents().size();
+68                  f = createResult(FAILURE, "Document should have one parent but has " + parents + " parents!");
+69                  addResult(assertEquals(1, parents, null, f));
+70  
+71                  // remove from folder
+72                  doc1.removeFromFolder(folder1);
+73  
+74                  addResult(checkChildren(session, folder1, "Folder after removeFromFolder()"));
+75  
+76                  count = countFolderChildren(folder1);
+77                  f = createResult(FAILURE, "Folder should have no children but has " + count + " children!");
+78                  addResult(assertEquals(0, count, null, f));
+79  
+80                  parents = doc1.getParents().size();
+81                  f = createResult(FAILURE, "Document should not have no parents but has " + parents + " parents!");
+82                  addResult(assertEquals(0, parents, null, f));
+83  
+84                  // add to folder again
+85                  doc1.addToFolder(folder1, true);
+86  
+87                  addResult(checkChildren(session, folder1, "Folder after addToFolder()"));
+88  
+89                  count = countFolderChildren(folder1);
+90                  f = createResult(FAILURE, "Folder should have exactly one child but has " + count + " children!");
+91                  addResult(assertEquals(1, count, null, f));
+92  
+93                  parents = doc1.getParents().size();
+94                  f = createResult(FAILURE, "Document should have one parent but has " + parents + " parents!");
+95                  addResult(assertEquals(1, parents, null, f));
+96  
+97                  // delete everything
+98                  deleteObject(doc1);
+99                  deleteObject(folder1);
+100             } finally {
+101                 // clean up
+102                 deleteTestFolder();
+103             }
+104         } else {
+105             addResult(createResult(SKIPPED, "Unfiling not supported. Test Skipped!"));
+106         }
+107     }
+108 
+109     protected boolean supportsUnfiling(Session session) {
+110         RepositoryInfo repository = session.getRepositoryInfo();
+111 
+112         if (repository.getCapabilities().isUnfilingSupported() == null) {
+113             return false;
+114         }
+115 
+116         return repository.getCapabilities().isUnfilingSupported().booleanValue();
+117     }
+118 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-frame.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-frame.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-frame.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,30 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.13.0 Reference Package org.apache.chemistry.opencmis.tck.tests.filing + + + + +

+ org.apache.chemistry.opencmis.tck.tests.filing +

+ +

Classes

+ + + + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-summary.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-summary.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/filing/package-summary.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,77 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.13.0 Reference Package org.apache.chemistry.opencmis.tck.tests.filing + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.tck.tests.filing

+ + + + + + + + + + + + + + + + + + +
Class Summary
+ FilingTestGroup +
+ MultifilingTest +
+ UnfilingTest +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/AbstractQueryTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/AbstractQueryTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/AbstractQueryTest.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,61 @@ + + + + +AbstractQueryTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.query;
+20  
+21  import org.apache.chemistry.opencmis.client.api.Session;
+22  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+23  import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
+24  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+25  
+26  public abstract class AbstractQueryTest extends AbstractSessionTest {
+27  
+28      protected boolean supportsQuery(Session session) {
+29          RepositoryInfo repository = session.getRepositoryInfo();
+30  
+31          if (repository.getCapabilities().getQueryCapability() == null) {
+32              return false;
+33          }
+34  
+35          return repository.getCapabilities().getQueryCapability() != CapabilityQuery.NONE;
+36      }
+37  
+38      protected boolean isFulltextOnly(Session session) {
+39          RepositoryInfo repository = session.getRepositoryInfo();
+40  
+41          if (repository.getCapabilities().getQueryCapability() == null) {
+42              return false;
+43          }
+44  
+45          return repository.getCapabilities().getQueryCapability() == CapabilityQuery.FULLTEXTONLY;
+46      }
+47  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/ContentChangesSmokeTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/ContentChangesSmokeTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/query/ContentChangesSmokeTest.html Mon Apr 6 17:17:00 2015 @@ -0,0 +1,150 @@ + + + + +ContentChangesSmokeTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.query;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.INFO;
+23  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+24  
+25  import java.util.Map;
+26  
+27  import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+28  import org.apache.chemistry.opencmis.client.api.ChangeEvents;
+29  import org.apache.chemistry.opencmis.client.api.CmisObject;
+30  import org.apache.chemistry.opencmis.client.api.Session;
+31  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+32  import org.apache.chemistry.opencmis.commons.enums.BindingType;
+33  import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
+34  import org.apache.chemistry.opencmis.commons.enums.ChangeType;
+35  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+36  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+37  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+38  
+39  /**
+40   * Content Changes smoke test.
+41   */
+42  public class ContentChangesSmokeTest extends AbstractSessionTest {
+43  
+44      @Override
+45      public void init(Map<String, String> parameters) {
+46          super.init(parameters);
+47          setName("Content Changes Smoke Test");
+48          setDescription("Calls getContentChanges(). It does not check if the results are correct!");
+49      }
+50  
+51      @Override
+52      public void run(Session session) {
+53          CmisTestResult f;
+54  
+55          if (supportsContentChanges(session)) {
+56              // get a page of 100 entries
+57              ChangeEvents events = session.getContentChanges(null, true, 1000, SELECT_ALL_NO_CACHE_OC);
+58  
+59              f = createResult(FAILURE, "Change events are null!");
+60              addResult(assertNotNull(events, null, f));
+61  
+62              if (events != null && events.getChangeEvents() != null) {
+63  
+64                  if (getBinding() != BindingType.ATOMPUB) {
+65                      // the AtompPub binding does not return a change log token
+66                      f = createResult(FAILURE, "Change log token is null!");
+67                      addResult(assertNotNull(events.getLatestChangeLogToken(), null, f));
+68                  } else {
+69                      // an OpenCMIS based server transports the change log token
+70                      // in proprietary way.
+71                      CmisTestResult ocs = createResult(INFO,
+72                              "Change log token is null. The AtomPub binding does not return it.");
+73                      CmisTestResult nocs = createResult(INFO,
+74                              "Change log token is not null. Probably an OpenCMIS based server.");
+75                      addResult(assertNull(events.getLatestChangeLogToken(), ocs, nocs));
+76                  }
+77  
+78                  for (ChangeEvent event : events.getChangeEvents()) {
+79                      checkChangeEvent(session, event);
+80                  }
+81              }
+82  
+83              // get all entries
+84              for (ChangeEvent event : session.getContentChanges(null, true, SELECT_ALL_NO_CACHE_OC)) {
+85                  checkChangeEvent(session, event);
+86              }
+87          } else {
+88              addResult(createResult(SKIPPED, "Content Changes not supported. Test Skipped!"));
+89          }
+90      }
+91  
+92      protected boolean supportsContentChanges(Session session) {
+93          RepositoryInfo repository = session.getRepositoryInfo();
+94  
+95          if (repository.getCapabilities().getChangesCapability() == null) {
+96              return false;
+97          }
+98  
+99          return repository.getCapabilities().getChangesCapability() != CapabilityChanges.NONE;
+100     }
+101 
+102     protected void checkChangeEvent(Session session, ChangeEvent event) {
+103         CmisTestResult f;
+104 
+105         f = createResult(FAILURE, "Object Id is not set!");
+106         addResult(assertStringNotEmpty(event.getObjectId(), null, f));
+107 
+108         f = createResult(FAILURE, "Change Type is not set! Id: " + event.getObjectId());
+109         addResult(assertNotNull(event.getChangeType(), null, f));
+110 
+111         f = createResult(FAILURE, "Change Time is not set! Id: " + event.getObjectId());
+112         addResult(assertNotNull(event.getChangeTime(), null, f));
+113 
+114         if (event.getObjectId() != null) {
+115             if (event.getChangeType() == ChangeType.DELETED) {
+116                 try {
+117                     session.getObject(event.getObjectId(), SELECT_ALL_NO_CACHE_OC);
+118                     addResult(createResult(
+119                             FAILURE,
+120                             "Change event indicates that an object has been deleted but it still exists. Id: "
+121                                     + event.getObjectId()));
+122                 } catch (CmisObjectNotFoundException e) {
+123                     // expected
+124                 }
+125             } else {
+126                 try {
+127                     CmisObject object = session.getObject(event.getObjectId(), SELECT_ALL_NO_CACHE_OC);
+128                     addResult(checkObject(session, object, getAllProperties(object),
+129                             "Object check. Id: " + event.getObjectId()));
+130                 } catch (CmisObjectNotFoundException e) {
+131                     // object might have been deleted later
+132                 }
+133             }
+134         }
+135     }
+136 }
+
+
+ +