summaryrefslogtreecommitdiff
path: root/qadevOOo/runner
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r--qadevOOo/runner/base/java_fat.java13
-rw-r--r--qadevOOo/runner/basicrunner/BasicTestCase.java5
-rw-r--r--qadevOOo/runner/helper/ClParser.java4
-rw-r--r--qadevOOo/runner/lib/TestCase.java20
-rw-r--r--qadevOOo/runner/lib/TestEnvironment.java8
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java11
-rw-r--r--qadevOOo/runner/util/AccessibilityTools.java13
-rw-r--r--qadevOOo/runner/util/UITools.java20
-rw-r--r--qadevOOo/runner/util/utils.java17
9 files changed, 31 insertions, 80 deletions
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java
index 1d75c48ed43e..4dd3ad51a817 100644
--- a/qadevOOo/runner/base/java_fat.java
+++ b/qadevOOo/runner/base/java_fat.java
@@ -219,6 +219,7 @@ public class java_fat implements TestBase
{
closeExistingOffice();
tEnv = getEnv(entry, m_aParams);
+ tCase = tEnv.getTestCase();
}
// MultiMethodTest ifc = null;
@@ -251,6 +252,7 @@ public class java_fat implements TestBase
{
closeExistingOffice();
tEnv = getEnv(entry, m_aParams);
+ tCase = tEnv.getTestCase();
if (countInterfaceTestRun < 2)
{
finished = false;
@@ -313,6 +315,9 @@ public class java_fat implements TestBase
}
System.out.println(counter + " of " + entries.length + " tests failed");
+ if (counter != 0) {
+ retValue = false;
+ }
}
closeExistingOffice();
@@ -455,17 +460,16 @@ public class java_fat implements TestBase
log.initialize(entry, logging);
tCase.setLogWriter((PrintWriter) log);
- TestEnvironment tEnv = null;
-
try
{
tCase.initializeTestCase(param);
- tEnv = tCase.getTestEnvironment(param);
+ return tCase.getTestEnvironment(param);
}
catch (com.sun.star.lang.DisposedException de)
{
System.out.println("Office disposed");
closeExistingOffice();
+ throw de;
}
catch (lib.StatusException e)
{
@@ -475,9 +479,8 @@ public class java_fat implements TestBase
entry.ErrorMsg = e.getMessage();
entry.hasErrorMsg = true;
+ throw e;
}
-
- return tEnv;
}
private void closeExistingOffice()
diff --git a/qadevOOo/runner/basicrunner/BasicTestCase.java b/qadevOOo/runner/basicrunner/BasicTestCase.java
index a84e996cc09e..1356badc12d7 100644
--- a/qadevOOo/runner/basicrunner/BasicTestCase.java
+++ b/qadevOOo/runner/basicrunner/BasicTestCase.java
@@ -159,11 +159,6 @@ public class BasicTestCase extends TestCase {
return tEnv;
}
-
- protected void cleanupTestEnvironment(TestParameters tParam,
- TestEnvironment tEnv, LogWriter log) {
- }
-
/**
* BASIC is told to dispose the test object.
* @param tParam The test parameters.
diff --git a/qadevOOo/runner/helper/ClParser.java b/qadevOOo/runner/helper/ClParser.java
index 7e54bccb174e..583aea56f977 100644
--- a/qadevOOo/runner/helper/ClParser.java
+++ b/qadevOOo/runner/helper/ClParser.java
@@ -26,6 +26,7 @@
************************************************************************/
package helper;
+import java.io.File;
import java.util.Properties;
import lib.TestParameters;
@@ -94,7 +95,8 @@ public class ClParser
if (pName.equals("TestDocumentPath"))
{
- System.setProperty("DOCPTH", pValue);
+ System.setProperty(
+ "DOCPTH", new File(pValue).getAbsolutePath());
}
else if (pName.equals(PropertyName.SRC_ROOT))
{
diff --git a/qadevOOo/runner/lib/TestCase.java b/qadevOOo/runner/lib/TestCase.java
index e5214f2edb40..6b8b960c3014 100644
--- a/qadevOOo/runner/lib/TestCase.java
+++ b/qadevOOo/runner/lib/TestCase.java
@@ -140,18 +140,16 @@ public abstract class TestCase {
message = e.toString();
System.out.println("Exception while getting Environment "+message);
e.printStackTrace();
+ cleanup(tParam, log);
}
return tEnv;
}
/**
* Disposes the <code>TestEnvironment</code> when it is not needed anymore.
- * The method calls <code>cleanupTestEnvironment()</code>.
*
* @param tEnv the environment to dispose
* @param tParam test parameters
- *
- * @see #cleanupTestEnvironment()
*/
public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
TestParameters tParam ) {
@@ -174,22 +172,6 @@ public abstract class TestCase {
TestParameters tParam, PrintWriter log );
/**
- * Called while disposing a <code>TestEnvironment</code>. In the
- * implementation does nothing. Subclasses can override to clean up
- * the environments created by them.
- *
- * @param tParam test parameters
- * @param tEnv the environment to cleanup
- * @param log writer to log information while testing
- *
- * @see TestEnvironment
- * @see #disposeTestEnvironment()
- */
- protected void cleanupTestEnvironment( TestParameters Param,
- TestEnvironment tEnv, PrintWriter log ) {
- }
-
- /**
* @return the name of the object
*/
public String getObjectName() {
diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java
index 877f681e3b3c..9848a5b2b633 100644
--- a/qadevOOo/runner/lib/TestEnvironment.java
+++ b/qadevOOo/runner/lib/TestEnvironment.java
@@ -38,23 +38,23 @@ import java.util.Hashtable;
* @see TestCase
*/
-public class TestEnvironment {
+public final class TestEnvironment {
/**
* Contains object relations - auxiliary objects associated with the
* tested object and required for testing.
*/
- protected Hashtable relations = new Hashtable(10);
+ private final Hashtable relations = new Hashtable(10);
/**
* An instance of the tested implementation object.
*/
- protected XInterface testObject;
+ private final XInterface testObject;
/**
* Indicates that the testObject is in invalid state and should notbe
* used for testing anymore.
*/
- protected boolean disposed = false;
+ private boolean disposed = false;
/**
* A reference to TestCase which has created the test environment.
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index 979fc527f775..63486ca9d3f3 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -182,8 +182,7 @@ public class Runner
}
}
- public static void main(String[] args)
- {
+ public static boolean run(String... args) {
System.out.println("OOoRunner Main() version from 20100125 (yyyymmdd)");
setStartTime(getTime());
@@ -246,12 +245,16 @@ public class Runner
if (!worked)
{
System.out.println("Job " + param.get("TestJob") + " failed");
- System.exit(-1);
}
else
{
System.out.println("Job " + param.get("TestJob") + " done");
- System.exit(0);
}
+ return worked;
+ }
+
+ public static void main(String[] args)
+ {
+ System.exit(run(args) ? 0 : -1);
}
}
diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java
index c698839f3149..3fb964a2362b 100644
--- a/qadevOOo/runner/util/AccessibilityTools.java
+++ b/qadevOOo/runner/util/AccessibilityTools.java
@@ -51,18 +51,7 @@ public class AccessibilityTools {
}
public static XAccessible getAccessibleObject(XInterface xObject) {
- XAccessible xAccessible = null;
-
- try {
- xAccessible = (XAccessible) UnoRuntime.queryInterface(
- XAccessible.class, xObject);
- } catch (Exception e) {
- System.out.println(
- "caught exception while getting accessible object" + e);
- e.printStackTrace();
- }
-
- return xAccessible;
+ return UnoRuntime.queryInterface(XAccessible.class, xObject);
}
public static XWindow getCurrentContainerWindow(XMultiServiceFactory msf,
diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java
index 1a639d18b252..c9562949632f 100644
--- a/qadevOOo/runner/util/UITools.java
+++ b/qadevOOo/runner/util/UITools.java
@@ -674,26 +674,6 @@ public class UITools {
}
}
-
- /**
- * fetch the active window which is on the top of the X-desktop
- * @return the active window
- * @throws java.lang.Exception if something fail
- */
- public XWindow getActiveTopWindow() throws java.lang.Exception
- {
- XInterface xToolKit = null;
- try {
- xToolKit = (XInterface) mMSF.createInstance("com.sun.star.awt.Toolkit") ;
- } catch (com.sun.star.uno.Exception e) {
- throw new Exception("Could not toolkit: " + e.toString());
- }
- XExtendedToolkit tk = (XExtendedToolkit)
- UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit);
- Object atw = tk.getActiveTopWindow();
- return (XWindow) UnoRuntime.queryInterface(XWindow.class, atw);
- }
-
/**
* fetch the window which is equal to the given <CODE>WindowName</CODE>
* @return the named window
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 1467edf05375..1091824480a6 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -38,6 +38,8 @@ import java.util.ArrayList;
import java.io.RandomAccessFile;
import java.net.Socket;
import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URISyntaxException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.Property;
@@ -364,18 +366,13 @@ public class utils {
*
*/
public static String getOfficeTemp(XMultiServiceFactory msf) {
- String tmpDir = util.utils.getUsersTempDir();
+ String url = getOfficeUserPath(msf) + "/test-temp/";
try {
- String tmp = (String) getOfficeSettingsValue(msf, "Temp");
- if (!tmp.endsWith(System.getProperty("file.separator"))) {
- tmp += System.getProperty("file.separator");
- }
- tmpDir = getFullURL(tmp);
- } catch (Exception e) {
- System.out.println("Couldn't get Office TEMP");
- e.printStackTrace();
+ new File(new URI(url)).mkdir();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
}
- return tmpDir;
+ return url;
}
/**