chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1028083 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck: ./ src/main/java/org/apache/chemistry/opencmis/tck/impl/ src/main/java/org/apache/chemistry/opencmis/tck/runner/
Date Wed, 27 Oct 2010 20:14:17 GMT
Author: fmui
Date: Wed Oct 27 20:14:16 2010
New Revision: 1028083

URL: http://svn.apache.org/viewvc?rev=1028083&view=rev
Log:
- junitified the TCK

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/pom.xml
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTestGroup.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/pom.xml?rev=1028083&r1=1028082&r2=1028083&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/pom.xml
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/pom.xml
Wed Oct 27 20:14:16 2010
@@ -37,5 +37,11 @@
             <artifactId>ant</artifactId>
             <version>1.8.1</version>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <type>jar</type>
+        </dependency>
     </dependencies>
 </project>

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java?rev=1028083&r1=1028082&r2=1028083&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
Wed Oct 27 20:14:16 2010
@@ -26,6 +26,7 @@ import java.util.Map;
 import org.apache.chemistry.opencmis.tck.CmisTest;
 import org.apache.chemistry.opencmis.tck.CmisTestResult;
 import org.apache.chemistry.opencmis.tck.CmisTestResultStatus;
+import org.junit.Test;
 
 /**
  * Base class for tests.
@@ -65,6 +66,11 @@ public abstract class AbstractCmisTest i
 
     public abstract void run() throws Exception;
 
+    @Test
+    public void junit() {
+        JUnitHelper.run(this);
+    }
+
     public List<CmisTestResult> getResults() {
         return results;
     }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTestGroup.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTestGroup.java?rev=1028083&r1=1028082&r2=1028083&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTestGroup.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTestGroup.java
Wed Oct 27 20:14:16 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.chemistry.opencmis.tck.CmisTest;
 import org.apache.chemistry.opencmis.tck.CmisTestGroup;
 import org.apache.chemistry.opencmis.tck.CmisTestProgressMonitor;
+import org.junit.Test;
 
 /**
  * Base class for test groups.
@@ -122,6 +123,11 @@ public abstract class AbstractCmisTestGr
         }
     }
 
+    @Test
+    public void junit() {
+        JUnitHelper.run(this);
+    }
+
     protected void preRun() {
     }
 

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java?rev=1028083&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java
Wed Oct 27 20:14:16 2010
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package org.apache.chemistry.opencmis.tck.impl;
+
+import java.io.File;
+import java.io.PrintWriter;
+
+import org.apache.chemistry.opencmis.tck.CmisTest;
+import org.apache.chemistry.opencmis.tck.CmisTestGroup;
+import org.apache.chemistry.opencmis.tck.CmisTestProgressMonitor;
+import org.apache.chemistry.opencmis.tck.CmisTestReport;
+import org.apache.chemistry.opencmis.tck.report.TextReport;
+import org.apache.chemistry.opencmis.tck.runner.AbstractRunner;
+import org.junit.Assert;
+
+public class JUnitHelper {
+
+    public static final String JUNIT_PARAMETERS = "org.apache.chemistry.tck.junit.parameters";
+
+    private JUnitHelper() {
+    }
+
+    public static void run(CmisTest test) {
+        try {
+            run(new WrapperCmisTestGroup(test));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    public static void run(CmisTestGroup group) {
+        try {
+            JUnitRunner runner = new JUnitRunner();
+
+            String parametersFile = System.getProperty(JUNIT_PARAMETERS);
+            if (parametersFile == null) {
+                runner.setParameters(null);
+            } else {
+                runner.loadParameters(new File(parametersFile));
+            }
+
+            runner.addGroup(group);
+            runner.run(new JUnitProgressMonitor());
+
+            CmisTestReport report = new TextReport();
+            report.createReport(runner.getParameters(), runner.getGroups(), new PrintWriter(System.out));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private static class JUnitRunner extends AbstractRunner {
+    }
+
+    private static class JUnitProgressMonitor implements CmisTestProgressMonitor {
+        public void startGroup(CmisTestGroup group) {
+            System.out.println(group.getName() + " (" + group.getTests().size() + " tests)");
+        }
+
+        public void endGroup(CmisTestGroup group) {
+        }
+
+        public void startTest(CmisTest test) {
+            System.out.println("  " + test.getName());
+        }
+
+        public void endTest(CmisTest test) {
+        }
+
+        public void message(String msg) {
+            System.out.println(msg);
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/JUnitHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java?rev=1028083&r1=1028082&r2=1028083&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java
Wed Oct 27 20:14:16 2010
@@ -40,7 +40,7 @@ public class WrapperCmisTestGroup extend
     public void init(Map<String, String> parameters) throws Exception {
         super.init(parameters);
 
-        setName("Wrapper Group: " + test.getName());
         addTest(test);
+        setName("Wrapper Group: " + test.getName());
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java?rev=1028083&r1=1028082&r2=1028083&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
Wed Oct 27 20:14:16 2010
@@ -186,12 +186,12 @@ public abstract class AbstractRunner {
             throw new Exception("Not a CmisTestGroup or CmisTest class!");
         }
 
-        group.init(parameters);
         addGroup(group);
     }
 
-    public void addGroup(CmisTestGroup group) {
+    public void addGroup(CmisTestGroup group) throws Exception {
         if (group != null) {
+            group.init(parameters);
             groups.add(group);
         }
     }



Mime
View raw message