[Libreoffice-commits] .: 2 commits - test/prj test/source

Bjoern Michaelsen bmichaelsen at kemper.freedesktop.org
Sun Mar 27 09:26:14 PDT 2011


 test/prj/build.lst                                         |    2 
 test/source/java/org/openoffice/test/OfficeConnection.java |    1 
 test/source/java/org/openoffice/test/UnoApiTest.java       |   52 +++++++++++++
 test/source/java/org/openoffice/test/makefile.mk           |    6 +
 4 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit 7e5431df55df79a403046cf056d610861eab1fcd
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 27 18:25:55 2011 +0200

    revert accidentally commited changes

diff --git a/test/source/java/org/openoffice/test/OfficeConnection.java b/test/source/java/org/openoffice/test/OfficeConnection.java
index fcdd2ac..d097668 100644
--- a/test/source/java/org/openoffice/test/OfficeConnection.java
+++ b/test/source/java/org/openoffice/test/OfficeConnection.java
@@ -46,20 +46,6 @@ import static org.junit.Assert.*;
     Details about the OOo instance are tunneled in via
     org.openoffice.test.arg.... system properties.
 */
-final class ShutdownKiller implements java.lang.Runnable {
-    private java.lang.Thread m_watchedThread;
-    ShutdownKiller(java.lang.Thread watchedThread) {
-        m_watchedThread = watchedThread;
-    }
-    public void run() {
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-            return;
-        };
-        m_watchedThread.interrupt();
-    }
-}
 
 public final class OfficeConnection {
     /** Start up an OOo instance.
@@ -96,7 +82,6 @@ public final class OfficeConnection {
                 "\"soffice\" argument \"" + sofficeArg +
                 " starts with neither \"path:\" nor \"connect:\"");
         }
-        Thread.sleep(2000);
         XUnoUrlResolver resolver = UnoUrlResolver.create(
             Bootstrap.createInitialComponentContext(null));
         for (;;) {
@@ -141,14 +126,7 @@ public final class OfficeConnection {
         }
         int code = 0;
         if (process != null) {
-            Thread watcher = new Thread(new ShutdownKiller(Thread.currentThread()));
-            watcher.run();
-            try {
-                code = process.waitFor();
-            } catch (InterruptedException e) {
-                assertTrue(false);
-            };
-            watcher.interrupt();
+            code = process.waitFor();
         }
         boolean outTerminated = outForward == null || outForward.terminated();
         boolean errTerminated = errForward == null || errForward.terminated();
commit 309e984639fc416db60926c3e05d282544ccbbf2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 27 16:52:01 2011 +0200

    cleanup of unoapi test

diff --git a/test/prj/build.lst b/test/prj/build.lst
index e22199a..bb3d6be 100644
--- a/test/prj/build.lst
+++ b/test/prj/build.lst
@@ -1,4 +1,4 @@
-te test : BOOST:boost cppu cppuhelper CPPUNIT:cppunit javaunohelper offuh ridljar sal solenv stlport unoil NULL
+te test : BOOST:boost cppu cppuhelper CPPUNIT:cppunit javaunohelper offuh ridljar sal solenv stlport unoil qadevOOo NULL
 te test\inc nmake - all inc NULL
 te test\source\cpp nmake - all source_cpp inc NULL
 te test\source\cpp\unoexceptionprotector nmake - all source_cpp_unoexceptionprotector inc NULL
diff --git a/test/source/java/org/openoffice/test/OfficeConnection.java b/test/source/java/org/openoffice/test/OfficeConnection.java
index 084453f..fcdd2ac 100644
--- a/test/source/java/org/openoffice/test/OfficeConnection.java
+++ b/test/source/java/org/openoffice/test/OfficeConnection.java
@@ -46,6 +46,21 @@ import static org.junit.Assert.*;
     Details about the OOo instance are tunneled in via
     org.openoffice.test.arg.... system properties.
 */
+final class ShutdownKiller implements java.lang.Runnable {
+    private java.lang.Thread m_watchedThread;
+    ShutdownKiller(java.lang.Thread watchedThread) {
+        m_watchedThread = watchedThread;
+    }
+    public void run() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException e) {
+            return;
+        };
+        m_watchedThread.interrupt();
+    }
+}
+
 public final class OfficeConnection {
     /** Start up an OOo instance.
     */
@@ -81,6 +96,7 @@ public final class OfficeConnection {
                 "\"soffice\" argument \"" + sofficeArg +
                 " starts with neither \"path:\" nor \"connect:\"");
         }
+        Thread.sleep(2000);
         XUnoUrlResolver resolver = UnoUrlResolver.create(
             Bootstrap.createInitialComponentContext(null));
         for (;;) {
@@ -125,7 +141,14 @@ public final class OfficeConnection {
         }
         int code = 0;
         if (process != null) {
-            code = process.waitFor();
+            Thread watcher = new Thread(new ShutdownKiller(Thread.currentThread()));
+            watcher.run();
+            try {
+                code = process.waitFor();
+            } catch (InterruptedException e) {
+                assertTrue(false);
+            };
+            watcher.interrupt();
         }
         boolean outTerminated = outForward == null || outForward.terminated();
         boolean errTerminated = errForward == null || errForward.terminated();
diff --git a/test/source/java/org/openoffice/test/UnoApiTest.java b/test/source/java/org/openoffice/test/UnoApiTest.java
new file mode 100644
index 0000000..fc5ba5a
--- /dev/null
+++ b/test/source/java/org/openoffice/test/UnoApiTest.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org.  If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+package org.openoffice.test;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import org.openoffice.test.Argument;
+import static org.junit.Assert.*;
+
+public final class UnoApiTest {
+    @org.junit.Before public void setUp() throws Exception {
+        connection.setUp();
+    }
+
+    @org.junit.After public void tearDown()
+        throws InterruptedException, com.sun.star.uno.Exception
+    {
+        connection.tearDown();
+    }
+
+    @org.junit.Test public void test() {
+        assertTrue(
+            Runner.run(
+                "-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc",
+                Argument.get("tdoc"), "-cs", connection.getDescription()));
+    }
+
+    private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/test/source/java/org/openoffice/test/makefile.mk b/test/source/java/org/openoffice/test/makefile.mk
index 8340f14..65b54d1 100644
--- a/test/source/java/org/openoffice/test/makefile.mk
+++ b/test/source/java/org/openoffice/test/makefile.mk
@@ -35,8 +35,10 @@ JAVAFILES = \
     FileHelper.java \
     OfficeConnection.java \
     OfficeFileUrl.java \
-    TestArgument.java
-JARFILES = juh.jar ridl.jar unoil.jar
+    TestArgument.java \
+    UnoApiTest.java \
+
+JARFILES = juh.jar ridl.jar unoil.jar OOoRunner.jar
 EXTRAJARFILES = $(OOO_JUNIT_JAR)
 
 JARTARGET        = $(TARGET).jar


More information about the Libreoffice-commits mailing list