chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r929023 - in /incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util: runCreate.bat runcmd.bat runfill.bat src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java
Date Tue, 30 Mar 2010 07:19:58 GMT
Author: jens
Date: Tue Mar 30 07:19:57 2010
New Revision: 929023

URL: http://svn.apache.org/viewvc?rev=929023&view=rev
Log:
CMIS-183
Better usage
Provide sample batch files how to use

Added:
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runCreate.bat
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runcmd.bat
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runfill.bat
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java

Added: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runCreate.bat
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runCreate.bat?rev=929023&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runCreate.bat (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runCreate.bat Tue
Mar 30 07:19:57 2010
@@ -0,0 +1 @@
+call runcmd.bat --Binding=AtomPub --Command=CreateDocument --RepositoryId=A1 --ContentSizeInKB=25
\ No newline at end of file

Added: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runcmd.bat
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runcmd.bat?rev=929023&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runcmd.bat (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runcmd.bat Tue Mar
30 07:19:57 2010
@@ -0,0 +1,31 @@
+set M2_REPO=c:\java\maven-repository
+set JAVA_HOME=C:\Java\jdk.1.6.0_14
+set PATH=%JAVA_HOME%\bin
+
+java -Dopencmis.test.atompub.url=http://localhost:8080/opencmis/atom -cp ^
+./target/classes;^
+%M2_REPO%/javax/activation/activation/1.1/activation-1.1.jar;^
+%M2_REPO%/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar;^
+%M2_REPO%/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar;^
+%M2_REPO%/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar;^
+%M2_REPO%/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar;^
+%M2_REPO%/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar;^
+%M2_REPO%/javax/xml/stream/stax-api/1.0/stax-api-1.0.jar;^
+%M2_REPO%/commons-codec/commons-codec/1.4/commons-codec-1.4.jar;^
+%M2_REPO%/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar;^
+%M2_REPO%/com/sun/xml/bind/jaxb-impl/2.1.11/jaxb-impl-2.1.11.jar;^
+%M2_REPO%/com/sun/xml/ws/jaxws-rt/2.1.7/jaxws-rt-2.1.7.jar;^
+%M2_REPO%/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2.jar;^
+%M2_REPO%/junit/junit/4.8.1/junit-4.8.1.jar;^
+%M2_REPO%/org/jvnet/mimepull/1.3/mimepull-1.3.jar;^
+%M2_REPO%/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar;^
+%M2_REPO%/com/sun/xml/messaging/saaj/saaj-impl/1.3.3/saaj-impl-1.3.3.jar;^
+%M2_REPO%/stax/stax-api/1.0.1/stax-api-1.0.1.jar;^
+%M2_REPO%/org/jvnet/staxex/stax-ex/1.2/stax-ex-1.2.jar;^
+%M2_REPO%/com/sun/xml/stream/buffer/streambuffer/0.9/streambuffer-0.9.jar;^
+%M2_REPO%/org/codehaus/woodstox/wstx-asl/3.2.3/wstx-asl-3.2.3.jar;^
+%M2_REPO%/org/apache/opencmis/opencmis-commons-api/0.1-SNAPSHOT/opencmis-commons-api-0.1-SNAPSHOT.jar;^
+%M2_REPO%/org/apache/opencmis/opencmis-commons-impl/0.1-SNAPSHOT/opencmis-commons-impl-0.1-SNAPSHOT.jar;^
+%M2_REPO%/org/apache/opencmis/opencmis-provider-impl/0.1-SNAPSHOT/opencmis-provider-impl-0.1-SNAPSHOT.jar;^
+%M2_REPO%/org/apache/opencmis/opencmis-test-util/0.1-SNAPSHOT/opencmis-test-util-0.1-SNAPSHOT.jar;
^
+org.apache.opencmis.util.repository.ObjGenApp %*
\ No newline at end of file

Added: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runfill.bat
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runfill.bat?rev=929023&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runfill.bat (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/runfill.bat Tue Mar
30 07:19:57 2010
@@ -0,0 +1,2 @@
+call runcmd.bat --Command=FillRepository --RepositoryId=A1 --Depth=1 --DocsPerFolder=1 ^
+--FoldersPerFolder=0  --ContentSizeInKB=25
\ No newline at end of file

Modified: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java?rev=929023&r1=929022&r2=929023&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-util/src/main/java/org/apache/opencmis/util/repository/ObjGenApp.java
Tue Mar 30 07:19:57 2010
@@ -99,30 +99,34 @@ public class ObjGenApp {
   private void processCmdLine(String[] args) {
 
     OptionParser parser = new OptionParser();
-    fCmd = parser.accepts(CMD).withRequiredArg();
-    fRepoId = parser.accepts(REPOSITORY_ID).withOptionalArg();
+    fCmd = parser.accepts(CMD).withRequiredArg()
+      .describedAs("Command to perform (see below)");
+    fRepoId = parser.accepts(REPOSITORY_ID).withOptionalArg()
+      .describedAs("Repository used");
     fDocType = parser.accepts(FILLER_DOCUMENT_TYPE_ID).withOptionalArg().defaultsTo(
-        BaseObjectTypeIds.CMIS_DOCUMENT.value());
+        BaseObjectTypeIds.CMIS_DOCUMENT.value())
+      .describedAs("Document type created");
     fFolderType = parser.accepts(FILLER_FOLDER_TYPE_ID).withOptionalArg().defaultsTo(
-        BaseObjectTypeIds.CMIS_FOLDER.value());
-    fDocsPerFolder = parser.accepts(FILLER_DOCS_PER_FOLDER).withOptionalArg().ofType(Integer.class);
+        BaseObjectTypeIds.CMIS_FOLDER.value())
+        .describedAs("Folder type created");
+    fDocsPerFolder = parser.accepts(FILLER_DOCS_PER_FOLDER).withOptionalArg().ofType(Integer.class)
+      .describedAs("Documents on each level").defaultsTo(1);
     fFolderPerFolder = parser.accepts(FILLER_FOLDERS_PER_FOLDER).withOptionalArg().ofType(
-        Integer.class);
-    fDepth = parser.accepts(FILLER_DEPTH).withOptionalArg().ofType(Integer.class);
-    fContentSize = parser.accepts(FILLER_CONTENT_SIZE).withOptionalArg().ofType(Integer.class);
-    fCount = parser.accepts(COUNT).withOptionalArg().ofType(Integer.class).defaultsTo(10);
-    fBinding = parser.accepts(BINDING).withOptionalArg().ofType(String.class).defaultsTo(BINDING_ATOM);
+        Integer.class).describedAs(" Folders on each level").defaultsTo(0);
+    fDepth = parser.accepts(FILLER_DEPTH).withOptionalArg().ofType(Integer.class)
+      .describedAs("Levels of folders").defaultsTo(1);
+    fContentSize = parser.accepts(FILLER_CONTENT_SIZE).withOptionalArg().ofType(Integer.class)
+      .describedAs("Content size of each doc").defaultsTo(0);
+    fCount = parser.accepts(COUNT).withOptionalArg().ofType(Integer.class).defaultsTo(1)
+        .describedAs("Repeat a command n times (not yet implemented)");
+    fBinding = parser.accepts(BINDING).withOptionalArg().ofType(String.class).defaultsTo(BINDING_ATOM)
+      .describedAs("Protocol Binding: " + BINDING_ATOM + " or " + BINDING_WS);
 
     OptionSet options = parser.parse(args);
 
-    if (options.has("?"))
-      try {
-        parser.printHelpOn(System.out);
-      }
-      catch (IOException e) {
-        e.printStackTrace();
-      }
-
+    if (options.valueOf(fCmd) == null || options.has("?"))
+      usage(parser);
+    
     if (options.valueOf(fBinding).equals(BINDING_WS)) {
       System.out.println("Using Web Service binding.");
       fUsingAtom = false;
@@ -145,6 +149,7 @@ public class ObjGenApp {
       getUrl(getConfiguredUrl());
     } else {
       System.out.println("Unknown cmd: " + options.valueOf(fCmd));
+      usage(parser);
     }
   }
 
@@ -163,8 +168,28 @@ public class ObjGenApp {
 //    logger.printTimes();    
 //  }
 
+  private void usage(OptionParser parser) {
+    try {
+      System.out.println();
+      System.out.println("ObjGenApp is a command line tool for testing a CMIS repository.");
+      System.out.println("Usage:");
+      parser.printHelpOn(System.out);
+      System.out.println();
+      System.out.println("Command is one of [CreateDocument, FillRepository, RepositoryInfo]");
+      System.out.println("JVM system properties: " + PROP_ATOMPUB_URL + ", " + PROP_WS_URL);
+      System.out.println();
+      System.out.println("Example: ");
+      System.out.println("java -D" + PROP_ATOMPUB_URL + "=http://localhost:8080/opencmis/atom
-cp ... " +
+          "org.apache.opencmis.util.repository.ObjGenApp --Binding=AtomPub --Command=CreateDocument
" +
+          "--RepositoryId=A1 --ContentSizeInKB=25");
+      return;
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+
   private void fillRepository(OptionSet options) {
-    System.out.println();
     if (fUsingAtom)
       System.out.println("Connecting to  " + getAtomPubUrl());
     else
@@ -223,12 +248,10 @@ public class ObjGenApp {
   }
 
   private void createSingleDocument(OptionSet options) {
-    System.out.println();
     System.out.println("Connecting to  " + getAtomPubUrl());
     System.out.println("Creating doc in repository " + options.valueOf(fRepoId));
 
     createSingleDocument(options.valueOf(fRepoId), options.valueOf(fContentSize));
-
   }
 
   private void createSingleDocument(String repoId, int contentSizeInKB) {



Mime
View raw message