You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/02/02 22:57:53 UTC
svn commit: r1239874 - in
/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts:
ping.groovy script-library.properties
Author: fmui
Date: Thu Feb 2 21:57:52 2012
New Revision: 1239874
URL: http://svn.apache.org/viewvc?rev=1239874&view=rev
Log:
Workbench: added ping script
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy?rev=1239874&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy Thu Feb 2 21:57:52 2012
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.client.api.*
+
+CmisObject root = session.getRootFolder();
+
+ping({
+ root.refresh();
+});
+
+
+
+
+def ping(func, int sleep = 2, int turns = 1000) {
+ func();
+
+ int i = 0;
+ long total = 0;
+ long max = 0;
+ long min = Long.MAX_VALUE;
+
+ while(i <= turns) {
+ i++;
+
+ long start = System.currentTimeMillis();
+ func();
+ long end = System.currentTimeMillis();
+
+ long time = end - start;
+ total += time;
+ if(max < time) { max = time; }
+ if(min > time) { min = time; }
+
+ println String.format('[%1s] %2$5d: %3$5d ms (min: %4$5d ms, max: %5$5d ms, avg: %6$7.1f ms)',
+ (new Date(start)).format('yyyy-MM-dd hh:mm:ss'),
+ i,
+ time,
+ min,
+ max,
+ total / i);
+
+ Thread.sleep(sleep * 1000);
+ }
+}
\ No newline at end of file
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties?rev=1239874&r1=1239873&r2=1239874&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties Thu Feb 2 21:57:52 2012
@@ -31,3 +31,4 @@ getdescendants.groovy = Print descendant
query.groovy = Execute a query
counttypes.groovy = Count types and sub types
upload.groovy = Upload a local folder to the repository
+ping.groovy = Ping the repository