chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r915419 - in /incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src: site/apt/index.apt test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java
Date Tue, 23 Feb 2010 16:38:24 GMT
Author: fmui
Date: Tue Feb 23 16:38:23 2010
New Revision: 915419

URL: http://svn.apache.org/viewvc?rev=915419&view=rev
Log:
added code to read the test configuration from a file

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/site/apt/index.apt
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/site/apt/index.apt?rev=915419&r1=915418&r2=915419&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/site/apt/index.apt
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/site/apt/index.apt
Tue Feb 23 16:38:23 2010
@@ -28,3 +28,5 @@
 *-------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------+
 | opencmis.test.webservices.url       | URL prefix of the CMIS Web Services WSDLs | http://localhost:8080/cmis/services/
                                         |
 *-------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------+
+| opencmis.test.config                | Absolute path to a properties file that can contain
all the parameters above | <none>                                     |
+*-------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------+
\ No newline at end of file

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java?rev=915419&r1=915418&r2=915419&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractCmisTestCase.java
Tue Feb 23 16:38:23 2010
@@ -20,10 +20,17 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import junit.framework.TestCase;
@@ -84,6 +91,7 @@
   public static final String PROP_TESTFOLDER = "opencmis.test.testfolder";
   public static final String PROP_DOCTYPE = "opencmis.test.documenttype";
   public static final String PROP_FOLDERTYPE = "opencmis.test.foldertype";
+  public static final String PROP_CONFIG_FILE = "opencmis.test.config";
 
   public static final String PROP_ATOMPUB_URL = "opencmis.test.atompub.url";
   public static final String PROP_WEBSERVICES_URLPREFIX = "opencmis.test.webservices.url";
@@ -95,6 +103,29 @@
   private static Log log = LogFactory.getLog(AbstractCmisTestCase.class);
 
   /**
+   * Read configuration file.
+   */
+  static {
+    String configFileName = System.getProperty(PROP_CONFIG_FILE);
+    if (configFileName != null) {
+
+      try {
+        Properties properties = new Properties();
+        properties.load(new FileInputStream(configFileName));
+
+        for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
+          String key = (String) e.nextElement();
+          String value = properties.getProperty(key);
+          System.setProperty(key, value);
+        }
+      }
+      catch (Exception e) {
+        System.err.println("Could not load test properties: " + e.toString());
+      }
+    }
+  }
+
+  /**
    * Returns the provider object or creates one if does not exist.
    */
   protected CmisProvider getProvider() {



Mime
View raw message