diff options
Diffstat (limited to 'framework/qa/complex/disposing')
-rwxr-xr-x | framework/qa/complex/disposing/GetServiceWhileDisposingOffice.java | 86 | ||||
-rwxr-xr-x | framework/qa/complex/disposing/makefile.mk | 61 |
2 files changed, 88 insertions, 59 deletions
diff --git a/framework/qa/complex/disposing/GetServiceWhileDisposingOffice.java b/framework/qa/complex/disposing/GetServiceWhileDisposingOffice.java index ec7a36d3ba..80d08b4126 100755 --- a/framework/qa/complex/disposing/GetServiceWhileDisposingOffice.java +++ b/framework/qa/complex/disposing/GetServiceWhileDisposingOffice.java @@ -28,47 +28,91 @@ package complex.disposing; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; import com.sun.star.frame.XDesktop; +// ---------- junit imports ----------------- +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; +// ------------------------------------------ + /** * This test is for bug110698. The Office is closed and is continually connected * while it closes. This did let the Office freeze. Now when the Office is * closed, the connection is refused. */ -public class GetServiceWhileDisposingOffice extends ComplexTestCase { +public class GetServiceWhileDisposingOffice +{ - public String[] getTestMethodNames() { - return new String[]{"checkServiceWhileDisposing"}; - } +// public String[] getTestMethodNames() +// { +// return new String[] +// { +// "checkServiceWhileDisposing" +// }; +// } - public void checkServiceWhileDisposing() { - XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF(); + @Test public void checkServiceWhileDisposing() + { + XMultiServiceFactory xMSF = getMSF(); XDesktop xDesktop = null; - try { - xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, - xMSF.createInstance("com.sun.star.frame.Desktop")); + try + { + xDesktop = UnoRuntime.queryInterface(XDesktop.class, xMSF.createInstance("com.sun.star.frame.Desktop")); } - catch(com.sun.star.uno.Exception e) { - failed("Could not create a desktop instance."); + catch (com.sun.star.uno.Exception e) + { + fail("Could not create a desktop instance."); } int step = 0; - try { - log.println("Start the termination of the Office."); + try + { + System.out.println("Start the termination of the Office."); xDesktop.terminate(); - for ( ; step<10000; step++ ) { + for (; step < 10000; step++) + { Object o = xMSF.createInstance("com.sun.star.frame.Desktop"); } } - catch(com.sun.star.lang.DisposedException e) { - log.println("DisposedException in step: " + step); - e.printStackTrace(); + catch (com.sun.star.lang.DisposedException e) + { + System.out.println("DisposedException in step: " + step); } - catch(Exception e) { - e.printStackTrace(); - failed(e.getMessage()); + catch (Exception e) + { + fail(e.getMessage()); } } + + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass + public static void setUpConnection() throws Exception + { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + // Office is already terminated. + // connection.tearDown(); + } + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/framework/qa/complex/disposing/makefile.mk b/framework/qa/complex/disposing/makefile.mk index dac80c08af..f24960421f 100755 --- a/framework/qa/complex/disposing/makefile.mk +++ b/framework/qa/complex/disposing/makefile.mk @@ -25,52 +25,37 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = GetServiceWhileDisposingOffice -PRJNAME = $(TARGET) -PACKAGE = complex$/disposing - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = $(TARGET).java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -MAXLINELENGTH = 100000 +PRJ = ../../.. +PRJNAME = framework +TARGET = qa_complex_disposing -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/disposing -# --- Parameters for the test -------------------------------------- +# here store only Files which contain a @Test +JAVATESTFILES = \ + GetServiceWhileDisposingOffice.java -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +# put here all other files +JAVAFILES = $(JAVATESTFILES) -# test base is java complex -CT_TESTBASE = -TestBase java_complex +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# start the runner application -CT_APP = org.openoffice.Runner +.END -# --- Targets ------------------------------------------------------ +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -.INCLUDE : target.mk +ALLTAR : javatest -RUN: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST) +.END -run: RUN |