Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.html?rev=1671596&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.html Mon Apr 6 17:10:50 2015 @@ -0,0 +1,451 @@ + + + + +AbstractSimpleReadWriteTests xref + + + +
View Javadoc
+
+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.client.bindings.framework;
+20  
+21  import java.util.ArrayList;
+22  import java.util.Collections;
+23  import java.util.List;
+24  
+25  import org.apache.chemistry.opencmis.commons.PropertyIds;
+26  import org.apache.chemistry.opencmis.commons.data.Ace;
+27  import org.apache.chemistry.opencmis.commons.data.Acl;
+28  import org.apache.chemistry.opencmis.commons.data.ContentStream;
+29  import org.apache.chemistry.opencmis.commons.data.ObjectData;
+30  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderData;
+31  import org.apache.chemistry.opencmis.commons.data.Properties;
+32  import org.apache.chemistry.opencmis.commons.data.PropertyData;
+33  import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
+34  import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
+35  import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+36  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+37  import org.apache.chemistry.opencmis.commons.spi.Holder;
+38  
+39  /**
+40   * Simple read-write test.
+41   */
+42  public abstract class AbstractSimpleReadWriteTests extends AbstractCmisTestCase {
+43  
+44      public static final String TEST_CREATE_FOLDER = "createFolder";
+45      public static final String TEST_CREATE_DOCUMENT = "createDocument";
+46      public static final String TEST_CREATE_FROM_SOURCE = "createDocumentFromSource";
+47      public static final String TEST_SET_AND_DELETE_CONTENT = "setAndDeleteContent";
+48      public static final String TEST_UPDATE_PROPERTIES = "updateProperties";
+49      public static final String TEST_DELETE_TREE = "deleteTree";
+50      public static final String TEST_MOVE_OBJECT = "moveObject";
+51      public static final String TEST_COPY_OBJECT = "copyObject";
+52      public static final String TEST_VERSIONING = "versioning";
+53  
+54      private static final byte[] CONTENT = "My document test content!".getBytes();
+55      private static final byte[] CONTENT2 = "Another test content!".getBytes();
+56      private static final String CONTENT_TYPE = "text/plain";
+57  
+58      /**
+59       * Tests folder creation.
+60       */
+61      public void testCreateFolder() {
+62          if (!isEnabled(TEST_CREATE_FOLDER)) {
+63              return;
+64          }
+65  
+66          // create folder
+67          List<PropertyData<?>> propList = new ArrayList<PropertyData<?>>();
+68          propList.add(getObjectFactory().createPropertyStringData(PropertyIds.NAME, "testfolder"));
+69          propList.add(getObjectFactory().createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, getDefaultFolderType()));
+70  
+71          Properties properties = getObjectFactory().createPropertiesData(propList);
+72  
+73          String folderId = createFolder(properties, getTestRootFolder(), null, null, null);
+74  
+75          // delete folder
+76          delete(folderId, true);
+77      }
+78  
+79      /**
+80       * Tests document creation.
+81       */
+82      public void testCreateDocument() throws Exception {
+83          if (!isEnabled(TEST_CREATE_DOCUMENT)) {
+84              return;
+85          }
+86  
+87          VersioningState vs = (isVersionable(getDefaultDocumentType()) ? VersioningState.MAJOR : VersioningState.NONE);
+88  
+89          // create document
+90          List<PropertyData<?>> propList = new ArrayList<PropertyData<?>>();
+91          propList.add(getObjectFactory().createPropertyStringData(PropertyIds.NAME, "testdoc.txt"));
+92          propList.add(getObjectFactory().createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, getDefaultDocumentType()));
+93  
+94          Properties properties = getObjectFactory().createPropertiesData(propList);
+95  
+96          ContentStream contentStream = createContentStreamData(CONTENT_TYPE, CONTENT);
+97  
+98          String docId = createDocument(properties, getTestRootFolder(), contentStream, vs, null, null, null);
+99  
+100         // read and assert content
+101         ContentStream contentStream2 = getContent(docId, null);
+102         assertMimeType(CONTENT_TYPE, contentStream2.getMimeType());
+103         if (contentStream2.getBigLength() != null) {
+104             assertEquals(CONTENT.length, contentStream2.getBigLength().intValue());
+105         }
+106 
+107         byte[] content = readContent(contentStream2);
+108         assertContent(CONTENT, content);
+109 
+110         // apply an ACL
+111         if (supportsManageACLs()) {
+112             Ace ace = getObjectFactory()
+113                     .createAccessControlEntry(getUsername(), Collections.singletonList("cmis:read"));
+114             Acl acl = getObjectFactory().createAccessControlList(Collections.singletonList(ace));
+115 
+116             Acl newAcl = getBinding().getAclService().applyAcl(getTestRepositoryId(), docId, acl, null,
+117                     getAclPropagation(), null);
+118             assertNotNull(newAcl);
+119 
+120             Acl readAcl = getBinding().getAclService().getAcl(getTestRepositoryId(), docId, Boolean.FALSE, null);
+121             assertNotNull(readAcl);
+122 
+123             assertEquals(newAcl, readAcl);
+124         } else {
+125             warning("ACLs management not supported!");
+126         }
+127 
+128         // delete document
+129         delete(docId, true);
+130     }
+131 
+132     /**
+133      * Tests document creation from source.
+134      */
+135     public void testCreateDocumentFromSource() throws Exception {
+136         if (!isEnabled(TEST_CREATE_FROM_SOURCE)) {
+137             return;
+138         }
+139 
+140         VersioningState vs = (isVersionable(getDefaultDocumentType()) ? VersioningState.MAJOR : VersioningState.NONE);
+141 
+142         String docId = createDefaultDocument(getTestRootFolder(), "testdoc.org.txt", CONTENT_TYPE, CONTENT);
+143 
+144         // create a copy
+145         List<PropertyData<?>> propList2 = new ArrayList<PropertyData<?>>();
+146         propList2.add(getObjectFactory().createPropertyStringData(PropertyIds.NAME, "testdoc.copy.txt"));
+147 
+148         Properties properties2 = getObjectFactory().createPropertiesData(propList2);
+149 
+150         String docId2 = createDocumentFromSource(docId, properties2, getTestRootFolder(), vs, null, null, null);
+151 
+152         // get objects
+153         getObject(docId);
+154         getObject(docId2);
+155 
+156         // read and assert content
+157         ContentStream contentStream2 = getContent(docId, null);
+158         ContentStream contentStream3 = getContent(docId2, null);
+159 
+160         assertEquals(contentStream2.getMimeType(), contentStream3.getMimeType());
+161         assertEquals(contentStream2.getBigLength(), contentStream3.getBigLength());
+162 
+163         byte[] content2 = readContent(contentStream2);
+164         byte[] content3 = readContent(contentStream3);
+165         assertContent(content2, content3);
+166 
+167         // delete documents
+168         delete(docId, true);
+169         delete(docId2, true);
+170     }
+171 
+172     /**
+173      * Tests setting and deleting content stream.
+174      */
+175     public void testSetAndDeleteContent() throws Exception {
+176         if (!isEnabled(TEST_SET_AND_DELETE_CONTENT)) {
+177             return;
+178         }
+179 
+180         boolean requiresCheckOut = getRepositoryInfo().getCapabilities().getContentStreamUpdatesCapability() == CapabilityContentStreamUpdates.PWCONLY;
+181 
+182         boolean isVersionable = isVersionable(getDefaultDocumentType());
+183 
+184         String docId = createDefaultDocument(getTestRootFolder(), "testcontent.txt", CONTENT_TYPE, CONTENT);
+185 
+186         // if a check out is required, do it
+187         Holder<String> docIdHolder = new Holder<String>(docId);
+188         if (requiresCheckOut) {
+189             if (isVersionable) {
+190                 getBinding().getVersioningService().checkOut(getTestRepositoryId(), docIdHolder, null, null);
+191             } else {
+192                 warning("Default document type is not versionable!");
+193                 delete(docId, true);
+194                 return;
+195             }
+196         }
+197 
+198         String docIdWorkingCopy = docIdHolder.getValue();
+199 
+200         // delete content
+201         try {
+202             getBinding().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null, null);
+203         } catch (CmisNotSupportedException e) {
+204             warning("deleteContentStream not supported!");
+205         }
+206 
+207         // set content
+208         ContentStream contentStream2 = createContentStreamData(CONTENT_TYPE, CONTENT2);
+209 
+210         docIdHolder = new Holder<String>(docIdWorkingCopy);
+211         getBinding().getObjectService().setContentStream(getTestRepositoryId(), docIdHolder, true, null,
+212                 contentStream2, null);
+213 
+214         // read and assert content
+215         String newVersionDocId = (docIdHolder.getValue() == null ? docIdWorkingCopy : docIdHolder.getValue());
+216         ContentStream contentStream3 = getContent(newVersionDocId, null);
+217         assertMimeType(CONTENT_TYPE, contentStream3.getMimeType());
+218         if (contentStream3.getBigLength() != null) {
+219             assertEquals(CONTENT2.length, contentStream3.getBigLength().intValue());
+220         }
+221 
+222         byte[] content = readContent(contentStream3);
+223         assertContent(CONTENT2, content);
+224 
+225         // if it has been checked out, cancel that
+226         if (requiresCheckOut) {
+227             getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), docIdWorkingCopy, null);
+228         }
+229 
+230         // delete document
+231         delete(docId, true);
+232     }
+233 
+234     /**
+235      * Tests property updates.
+236      */
+237     public void testUpdateProperties() {
+238         if (!isEnabled(TEST_UPDATE_PROPERTIES)) {
+239             return;
+240         }
+241 
+242         String name1 = "updateTest1.txt";
+243         String name2 = "updateTest2.txt";
+244 
+245         // create document
+246         String docId = createDefaultDocument(getTestRootFolder(), name1, CONTENT_TYPE, CONTENT);
+247 
+248         // update
+249         List<PropertyData<?>> updatePropList = new ArrayList<PropertyData<?>>();
+250         updatePropList.add(getObjectFactory().createPropertyStringData(PropertyIds.NAME, name2));
+251 
+252         Properties updateProperties = getObjectFactory().createPropertiesData(updatePropList);
+253 
+254         Holder<String> docIdHolder = new Holder<String>(docId);
+255         getBinding().getObjectService().updateProperties(getTestRepositoryId(), docIdHolder, null, updateProperties,
+256                 null);
+257 
+258         // get new id and check name property
+259         docId = docIdHolder.getValue();
+260 
+261         ObjectData updatedObject = getObject(docId);
+262         String updatedName = (String) updatedObject.getProperties().getProperties().get(PropertyIds.NAME)
+263                 .getFirstValue();
+264         assertNotNull(updatedName);
+265         assertEquals(name2, updatedName);
+266 
+267         // delete document
+268         delete(docId, true);
+269     }
+270 
+271     /**
+272      * Tests delete tree.
+273      */
+274     public void testDeleteTree() {
+275         if (!isEnabled(TEST_DELETE_TREE)) {
+276             return;
+277         }
+278 
+279         // create a folder tree
+280         String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+281         String folder11 = createDefaultFolder(folder1, "folder11");
+282         String folder12 = createDefaultFolder(folder1, "folder12");
+283         String folder121 = createDefaultFolder(folder12, "folder121");
+284         String folder122 = createDefaultFolder(folder12, "folder122");
+285 
+286         // create a few documents
+287         String doc111 = createDefaultDocument(folder11, "doc111.txt", CONTENT_TYPE, CONTENT);
+288         String doc1221 = createDefaultDocument(folder122, "doc1221.txt", CONTENT_TYPE, CONTENT2);
+289 
+290         // delete the tree
+291         getBinding().getObjectService().deleteTree(getTestRepositoryId(), folder1, Boolean.TRUE, UnfileObject.DELETE,
+292                 Boolean.TRUE, null);
+293 
+294         assertFalse(existsObject(folder1));
+295         assertFalse(existsObject(folder11));
+296         assertFalse(existsObject(folder12));
+297         assertFalse(existsObject(folder121));
+298         assertFalse(existsObject(folder122));
+299         assertFalse(existsObject(doc111));
+300         assertFalse(existsObject(doc1221));
+301     }
+302 
+303     /**
+304      * Tests move object.
+305      */
+306     public void testMoveObject() {
+307         if (!isEnabled(TEST_MOVE_OBJECT)) {
+308             return;
+309         }
+310 
+311         // create folders
+312         String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+313         String folder2 = createDefaultFolder(getTestRootFolder(), "folder2");
+314 
+315         // create document
+316         String docId = createDefaultDocument(folder1, "testdoc.txt", CONTENT_TYPE, CONTENT);
+317 
+318         // move it
+319         Holder<String> docIdHolder = new Holder<String>(docId);
+320         getBinding().getObjectService().moveObject(getTestRepositoryId(), docIdHolder, folder2, folder1, null);
+321         assertNotNull(docIdHolder.getValue());
+322 
+323         assertTrue(existsObject(docIdHolder.getValue()));
+324         getChild(folder2, docIdHolder.getValue());
+325 
+326         deleteTree(folder1);
+327         deleteTree(folder2);
+328     }
+329 
+330     /**
+331      * Tests copy object.
+332      */
+333     public void testCopyObject() {
+334         if (!isEnabled(TEST_COPY_OBJECT)) {
+335             return;
+336         }
+337 
+338         // create folders
+339         String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+340         String folder2 = createDefaultFolder(getTestRootFolder(), "folder2");
+341 
+342         // create document
+343         String docId = createDefaultDocument(folder1, "testdoc.txt", CONTENT_TYPE, CONTENT);
+344 
+345         // copy it with new properties
+346         List<PropertyData<?>> updatePropList = new ArrayList<PropertyData<?>>();
+347         updatePropList.add(getObjectFactory().createPropertyStringData(PropertyIds.NAME, "newdocname"));
+348         Properties updateProperties = getObjectFactory().createPropertiesData(updatePropList);
+349 
+350         String copyId = getBinding().getObjectService().createDocumentFromSource(getTestRepositoryId(), docId,
+351                 updateProperties, folder2, null, null, null, null, null);
+352         assertNotNull(copyId);
+353 
+354         assertTrue(existsObject(copyId));
+355         ObjectInFolderData copy = getChild(folder2, copyId);
+356         String updatedName = (String) copy.getObject().getProperties().getProperties().get(PropertyIds.NAME)
+357                 .getFirstValue();
+358         assertEquals("newdocname", updatedName);
+359 
+360         deleteTree(folder1);
+361         deleteTree(folder2);
+362     }
+363 
+364     /**
+365      * Test check-in/check-out.
+366      */
+367     public void testVersioning() {
+368         if (!isEnabled(TEST_VERSIONING)) {
+369             return;
+370         }
+371 
+372         if (!isVersionable(getDefaultDocumentType())) {
+373             warning("Default document type is not versionable!");
+374             return;
+375         }
+376 
+377         // create document
+378         String docId = createDefaultDocument(getTestRootFolder(), "versionTest.txt", CONTENT_TYPE, CONTENT);
+379 
+380         // there must be only one version in the version series
+381         List<ObjectData> allVersions = getBinding().getVersioningService().getAllVersions(getTestRepositoryId(), docId,
+382                 getVersionSeriesId(docId), "*", Boolean.FALSE, null);
+383         assertNotNull(allVersions);
+384         assertEquals(1, allVersions.size());
+385 
+386         assertEquals(docId, allVersions.get(0).getId());
+387 
+388         // check out
+389         Holder<String> versionIdHolder = new Holder<String>(docId);
+390         getBinding().getVersioningService().checkOut(getTestRepositoryId(), versionIdHolder, null, null);
+391         String versionId = versionIdHolder.getValue();
+392 
+393         // object must be marked as checked out
+394         assertTrue(isCheckedOut(docId));
+395 
+396         // cancel check out
+397         getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), versionId, null);
+398 
+399         // object must NOT be marked as checked out
+400         assertFalse(isCheckedOut(docId));
+401 
+402         // check out again
+403         versionIdHolder.setValue(docId);
+404         getBinding().getVersioningService().checkOut(getTestRepositoryId(), versionIdHolder, null, null);
+405         versionId = versionIdHolder.getValue();
+406 
+407         // object must be marked as checked out
+408         assertTrue(isCheckedOut(docId));
+409 
+410         versionIdHolder.setValue(versionId);
+411         getBinding().getVersioningService().checkIn(getTestRepositoryId(), versionIdHolder, Boolean.TRUE, null, null,
+412                 "Test Version 2", null, null, null, null);
+413         docId = versionIdHolder.getValue();
+414 
+415         // object must NOT be marked as checked out
+416         assertFalse(isCheckedOut(docId));
+417 
+418         // there must be exactly two versions in the version series
+419         allVersions = getBinding().getVersioningService().getAllVersions(getTestRepositoryId(), docId,
+420                 getVersionSeriesId(docId), "*", Boolean.FALSE, null);
+421         assertNotNull(allVersions);
+422         assertEquals(2, allVersions.size());
+423 
+424         // delete document
+425         delete(docId, true);
+426     }
+427 
+428     private boolean isCheckedOut(String docId) {
+429         ObjectData object = getObject(docId);
+430         PropertyData<?> isCheckedOut = object.getProperties().getProperties()
+431                 .get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
+432         assertNotNull(isCheckedOut);
+433         assertTrue(isCheckedOut.getFirstValue() instanceof Boolean);
+434 
+435         return ((Boolean) isCheckedOut.getFirstValue()).booleanValue();
+436     }
+437 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/Tools.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/Tools.html?rev=1671596&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/Tools.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/Tools.html Mon Apr 6 17:10:50 2015 @@ -0,0 +1,119 @@ + + + + +Tools xref + + + +
View Javadoc
+
+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.client.bindings.framework;
+20  
+21  import java.util.List;
+22  
+23  import org.apache.chemistry.opencmis.commons.PropertyIds;
+24  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
+25  import org.apache.chemistry.opencmis.commons.data.Properties;
+26  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+27  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
+28  
+29  /**
+30   * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+31   * 
+32   */
+33  public class Tools {
+34      
+35      private Tools() {
+36      }
+37  
+38      public static void print(RepositoryInfo repositoryInfo) {
+39          if (repositoryInfo == null) {
+40              return;
+41          }
+42  
+43          System.out.println("-------------");
+44          System.out.println("Id:               " + repositoryInfo.getId());
+45          System.out.println("Name:             " + repositoryInfo.getName());
+46          System.out.println("CMIS Version:     " + repositoryInfo.getCmisVersionSupported());
+47          System.out.println("Product:          " + repositoryInfo.getVendorName() + " / "
+48                  + repositoryInfo.getProductName() + " " + repositoryInfo.getProductVersion());
+49          System.out.println("Root Folder:      " + repositoryInfo.getRootFolderId());
+50          System.out.println("Capabilities:     " + repositoryInfo.getCapabilities());
+51          System.out.println("ACL Capabilities: " + repositoryInfo.getAclCapabilities());
+52          System.out.println("-------------");
+53      }
+54  
+55      public static void printTypes(String title, List<TypeDefinitionContainer> typeContainerList) {
+56          System.out.println("-------------");
+57          System.out.println(title);
+58          System.out.println("-------------");
+59  
+60          printTypes(typeContainerList, 0);
+61      }
+62  
+63      private static void printTypes(List<TypeDefinitionContainer> typeContainerList, int level) {
+64          if (typeContainerList == null) {
+65              return;
+66          }
+67  
+68          for (TypeDefinitionContainer container : typeContainerList) {
+69              for (int i = 0; i < level; i++) {
+70                  System.out.print("  ");
+71              }
+72  
+73              container.getTypeDefinition().getId();
+74              System.out.println(container.getTypeDefinition().getId());
+75  
+76              printTypes(container.getChildren(), level + 1);
+77          }
+78      }
+79  
+80      public static void print(String title, List<ObjectInFolderContainer> containerList) {
+81          System.out.println("-------------");
+82          System.out.println(title);
+83          System.out.println("-------------");
+84  
+85          print(containerList, 0);
+86      }
+87  
+88      private static void print(List<ObjectInFolderContainer> containerList, int level) {
+89          if (containerList == null) {
+90              return;
+91          }
+92  
+93          for (ObjectInFolderContainer container : containerList) {
+94              for (int i = 0; i < level; i++) {
+95                  System.out.print("  ");
+96              }
+97  
+98              Properties properties = container.getObject().getObject().getProperties();
+99              System.out.println(properties.getProperties().get(PropertyIds.NAME).getFirstValue() + " ("
+100                     + properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue() + ")");
+101 
+102             print(container.getChildren(), level + 1);
+103         }
+104     }
+105 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-frame.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-frame.html?rev=1671596&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-frame.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-frame.html Mon Apr 6 17:10:50 2015 @@ -0,0 +1,33 @@ + + + + + + OpenCMIS Client Bindings Implementation 0.13.0 Reference Package org.apache.chemistry.opencmis.client.bindings.framework + + + + +

+ org.apache.chemistry.opencmis.client.bindings.framework +

+ +

Classes

+ + + + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-summary.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-summary.html?rev=1671596&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-summary.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/framework/package-summary.html Mon Apr 6 17:10:50 2015 @@ -0,0 +1,82 @@ + + + + + + OpenCMIS Client Bindings Implementation 0.13.0 Reference Package org.apache.chemistry.opencmis.client.bindings.framework + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.client.bindings.framework

+ + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ AbstractCmisTestCase +
+ AbstractSimpleReadOnlyTests +
+ AbstractSimpleReadWriteTests +
+ Tools +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/misc/CookiesTest.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/misc/CookiesTest.html?rev=1671596&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/misc/CookiesTest.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref-test/org/apache/chemistry/opencmis/client/bindings/misc/CookiesTest.html Mon Apr 6 17:10:50 2015 @@ -0,0 +1,93 @@ + + + + +CookiesTest xref + + + +
View Javadoc
+
+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.client.bindings.misc;
+20  
+21  import java.util.Collections;
+22  import java.util.HashMap;
+23  import java.util.List;
+24  import java.util.Map;
+25  
+26  import junit.framework.TestCase;
+27  
+28  import org.apache.chemistry.opencmis.client.bindings.spi.cookies.CmisCookieManager;
+29  
+30  public class CookiesTest extends TestCase {
+31  
+32      public void testCookies() {
+33          CmisCookieManager manager = new CmisCookieManager();
+34          String url;
+35  
+36          url = "https://www.example.com/s/test/abc?xyz";
+37          addCookie(manager, url, "cookie1", "c1-1111", "/s/");
+38  
+39          url = "https://www.example.com/s/test/abc?xyz";
+40          addCookie(manager, url, "cookie2", "c2-1111", "/s/");
+41          deleteCookie(manager, url, "cookie2", "/s/");
+42  
+43          url = "https://www.example.com/s/test/abc";
+44          addCookie(manager, url, "cookie1", "c1-2222", "/s/");
+45  
+46          url = "https://www.example.com/s/test/abc";
+47          addCookie(manager, url, "cookie1", "c1-3333", "/s/t");
+48  
+49          url = "https://www.example.com/s/test/abc?abc";
+50          addCookie(manager, url, "cookie1", "c1-4444", "/s/x");
+51  
+52          List<String> cookies = manager.get("https://www.example.com/s/test/abc/s", new HashMap<String, List<String>>())
+53                  .get("Cookie");
+54  
+55          assertEquals(1, cookies.size());
+56          assertEquals(cookies.get(0), "cookie1=c1-3333; cookie1=c1-2222");
+57          //assertEquals(cookies.get(1), "cookie1=c1-2222");
+58      }
+59  
+60      private void addCookie(CmisCookieManager manager, String url, String name, String value, String path) {
+61          Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
+62  
+63          responseHeaders.put(null, Collections.singletonList("HTTP/1.1 200 OK"));
+64          responseHeaders
+65                  .put("Set-Cookie", Collections.singletonList(name + "=" + value + "; Path=" + path + "; Secure"));
+66  
+67          manager.put(url, responseHeaders);
+68      }
+69  
+70      private void deleteCookie(CmisCookieManager manager, String url, String name, String path) {
+71          Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
+72  
+73          responseHeaders.put(null, Collections.singletonList("HTTP/1.1 200 OK"));
+74          responseHeaders.put("Set-Cookie",
+75                  Collections.singletonList(name + "=delete; Path=" + path + "; Secure; Max-Age=0"));
+76  
+77          manager.put(url, responseHeaders);
+78      }
+79  }
+
+
+ +