diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-03-27 16:52:01 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-03-27 16:52:01 +0200 |
commit | c5e22ee5b5d6f1bb6e2ca2d73c0225f9538998c5 (patch) | |
tree | 9c353dac88802bc8d91da88bfe5a5c7494714665 /test | |
parent | 9c05a564a1c994afdfc0eeecdb164feff145db9b (diff) |
cleanup of unoapi test
Diffstat (limited to 'test')
-rw-r--r-- | test/prj/build.lst | 2 | ||||
-rw-r--r-- | test/source/java/org/openoffice/test/OfficeConnection.java | 25 | ||||
-rw-r--r-- | test/source/java/org/openoffice/test/UnoApiTest.java | 52 | ||||
-rw-r--r-- | test/source/java/org/openoffice/test/makefile.mk | 6 |
4 files changed, 81 insertions, 4 deletions
diff --git a/test/prj/build.lst b/test/prj/build.lst index e22199a5c437..bb3d6bedd840 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 084453fdaf35..fcdd2ac4cfa6 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 000000000000..fc5ba5a9c68f --- /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 8340f144aed3..65b54d11da65 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 |