tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r513728 - /incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java
Date Fri, 02 Mar 2007 12:22:41 GMT
Author: antelder
Date: Fri Mar  2 04:22:40 2007
New Revision: 513728

URL: http://svn.apache.org/viewvc?view=rev&rev=513728
Log:
Enable passing in server composite name on SCATestCaseRunner

Modified:
    incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java?view=diff&rev=513728&r1=513727&r2=513728
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCaseRunner.java
Fri Mar  2 04:22:40 2007
@@ -78,6 +78,43 @@
     }
 
     /**
+     * Constructs a new TestCase runner passing in the composite name.
+     * 
+     * @param testClass
+     */
+    public SCATestCaseRunner(Class testClass, String compositeName) {
+        try {
+            classLoader = (URLClassLoader)testClass.getClassLoader();
+            if (classLoader instanceof URLClassLoader) {
+                URL[] urls = ((URLClassLoader)classLoader).getURLs();
+                classLoader = new URLClassLoader(urls, classLoader.getParent());
+            } else {
+                classLoader = new URLClassLoader(new URL[0], classLoader);
+            }
+
+            ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(classLoader);
+
+                testCaseClass = Class.forName(testClass.getName(), true, classLoader);
+                Constructor constructor = testCaseClass.getConstructor(new Class[] {String.class});
+                testCase = constructor.newInstance(new Object[] {compositeName});
+
+                testSuiteClass = Class.forName(TestSuite.class.getName(), true, classLoader);
+                Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
+                testSuite = testSuiteConstructor.newInstance(testCaseClass);
+
+                testResultClass = Class.forName(TestResult.class.getName(), true, classLoader);
+
+            } finally {
+                Thread.currentThread().setContextClassLoader(tccl);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
      * Run the test case
      */
     public void run() {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message