chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r926472 - /incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java
Date Tue, 23 Mar 2010 06:24:52 GMT
Author: jens
Date: Tue Mar 23 06:24:52 2010
New Revision: 926472

URL: http://svn.apache.org/viewvc?rev=926472&view=rev
Log:
Extend object generator to count created objects

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java?rev=926472&r1=926471&r2=926472&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjectGenerator.java
Tue Mar 23 06:24:52 2010
@@ -92,11 +92,16 @@ public class ObjectGenerator {
   private List<String> fStringPropertyIdsToSetForFolder;
   
   /**
-   * number of objects created in total
+   * number of documents created in total
    */
-  private int fObjectsInTotalCount = 0;
+  private int fDocumentsInTotalCount = 0;
   
   /**
+   * number of folders created in total
+   */
+  private int fFoldersInTotalCount = 0;
+
+  /**
    * size of content in KB, if 0 create documents without content 
    */
   private int fContentSizeInK = 0;
@@ -152,6 +157,7 @@ public class ObjectGenerator {
   }
   
   public void createFolderHierachy(int levels, int childrenPerLevel, String rootFolderId)
{
+    resetCounters();
     createFolderHierachy(rootFolderId, 0, levels, childrenPerLevel);
   }
   
@@ -216,17 +222,37 @@ public class ObjectGenerator {
   }
   
   /**
+   * return the total number of documents created
+   * @return
+   */
+  public int getDocumentsInTotal() {
+    return fDocumentsInTotalCount;
+  }
+
+  /**
+   * return the total number of folders created
+   * @return
+   */
+  public int getFoldersInTotal() {
+    return fFoldersInTotalCount;
+  }
+
+  /**
    * return the total number of objects created
    * @return
    */
   public int getObjectsInTotal() {
-    return fObjectsInTotalCount;
+    return fDocumentsInTotalCount + fFoldersInTotalCount;
   }
 
   public void createSingleDocument(String folderId) {
 	  createDocument(folderId, 0, 0);      
   }
 	  
+  public void resetCounters() {
+    fDocumentsInTotalCount = fFoldersInTotalCount = 0;
+  }
+  
   private void createFolderHierachy(String parentId, int level, int levels, int childrenPerLevel)
{
     
     if (level>=levels)
@@ -238,7 +264,7 @@ public class ObjectGenerator {
       PropertiesData props = createFolderProperties(i, level);      
       String id = fObjSvc.createFolder(fRepositoryId, props, parentId, null, null, null,
null);
       if (id != null) {
-        ++fObjectsInTotalCount;
+        ++fFoldersInTotalCount;
         createFolderHierachy(id, level+1, levels, childrenPerLevel);
       }
     }
@@ -264,7 +290,7 @@ public class ObjectGenerator {
         policies, addACEs, removeACEs, extension);
     if (null == id)
       throw new RuntimeException("createDocument failed.");
-    ++fObjectsInTotalCount;
+    ++fDocumentsInTotalCount;
     return id;
   }
   



Mime
View raw message