From b0a3032631003bfe5cf5e7c39773105fc50151cd Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Tue, 8 Jun 2010 08:35:09 +0200 Subject: sb123:#i111449# cleanups in ucb qa/complex tests --- ucb/qa/complex/tdoc/CheckContentProvider.java | 237 ++++++++++++--------- .../tdoc/CheckTransientDocumentsContent.java | 80 ++++--- .../CheckTransientDocumentsContentProvider.java | 80 ++++--- .../CheckTransientDocumentsDocumentContent.java | 93 ++++---- ucb/qa/complex/tdoc/TestDocument.java | 39 ++++ ucb/qa/complex/tdoc/interfaces/makefile.mk | 4 +- ucb/qa/complex/tdoc/makefile.mk | 73 +++---- ucb/qa/complex/tdoc/test_documents/Iterator.sxw | Bin 0 -> 5627 bytes ucb/qa/complex/tdoc/test_documents/chinese.sxw | Bin 0 -> 5757 bytes ucb/qa/complex/tdoc/test_documents/filter.sxw | Bin 0 -> 14359 bytes ucb/qa/complex/test_documents/Iterator.sxw | Bin 5627 -> 0 bytes ucb/qa/complex/test_documents/chinese.sxw | Bin 5757 -> 0 bytes ucb/qa/complex/test_documents/filter.sxw | Bin 14359 -> 0 bytes ucb/qa/complex/ucb/UCB.java | 169 +++++++++------ ucb/qa/complex/ucb/makefile.mk | 58 ++--- 15 files changed, 486 insertions(+), 347 deletions(-) create mode 100644 ucb/qa/complex/tdoc/TestDocument.java create mode 100644 ucb/qa/complex/tdoc/test_documents/Iterator.sxw create mode 100644 ucb/qa/complex/tdoc/test_documents/chinese.sxw create mode 100644 ucb/qa/complex/tdoc/test_documents/filter.sxw delete mode 100644 ucb/qa/complex/test_documents/Iterator.sxw delete mode 100644 ucb/qa/complex/test_documents/chinese.sxw delete mode 100644 ucb/qa/complex/test_documents/filter.sxw (limited to 'ucb/qa') diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java index a20a96829e0b..d3dfd120611e 100755 --- a/ucb/qa/complex/tdoc/CheckContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckContentProvider.java @@ -42,7 +42,6 @@ import com.sun.star.ucb.XContentIdentifier; import com.sun.star.ucb.XContentIdentifierFactory; import com.sun.star.ucb.XContentProvider; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; import complex.tdoc.interfaces._XChild; import complex.tdoc.interfaces._XCommandInfoChangeNotifier; import complex.tdoc.interfaces._XComponent; @@ -53,9 +52,15 @@ import complex.tdoc.interfaces._XContent; import complex.tdoc.interfaces._XPropertiesChangeNotifier; import complex.tdoc.interfaces._XPropertyContainer; import complex.tdoc.interfaces._XPropertySetInfoChangeNotifier; -import lib.TestEnvironment; import util.WriterTools; -import util.utils; + +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.*; /** * Check the TransientDocumentsContentProvider (TDOC). Three documents are @@ -66,7 +71,7 @@ import util.utils; * with an accept parameter (writer is initially opened). Otherwise loaded * documents are not found. */ -public class CheckContentProvider extends ComplexTestCase { +public class CheckContentProvider { private final String testDocuments[] = new String[]{"filter.sxw", "chinese.sxw", "Iterator.sxw"}; private final int countDocs = testDocuments.length; private XMultiServiceFactory xMSF = null; @@ -89,37 +94,38 @@ public class CheckContentProvider extends ComplexTestCase { * Important is, that the test of the element comes first, then the test of * its interfaces. **/ - public String[] getTestMethodNames() { - return new String[]{"checkTDOCRoot", - "checkTDOCRootInterfaces", - "checkTDOCDocument", - "checkTDOCDocumentInterfaces", - "checkTDOCFolder", - "checkTDOCFolderInterfaces", - "checkTDOCStream", - "checkTDOCStreamInterfaces", - }; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkTDOCRoot", +// "checkTDOCRootInterfaces", +// "checkTDOCDocument", +// "checkTDOCDocumentInterfaces", +// "checkTDOCFolder", +// "checkTDOCFolderInterfaces", +// "checkTDOCStream", +// "checkTDOCStreamInterfaces", +// }; +// } /** * Open some documents before the test */ - public void before() { - xMSF = (XMultiServiceFactory)param.getMSF(); + @Before public void before() { + xMSF = getMSF(); xTextDoc = new XTextDocument[countDocs]; - log.println("Open some new documents."); + System.out.println("Open some new documents."); for (int i=0; i 1) - failed("Implementation has been changed. Check this test!"); - assure("The service name '" + serviceName + "' is not valid.", !serviceName.equals("com.sun.star.ucb.DynamicContentResultSet"), true); + { + fail("Implementation has been changed. Check this test!"); + } + assertTrue("The service name '" + serviceName + "' is not valid.", !serviceName.equals("com.sun.star.ucb.DynamicContentResultSet")); XResultSet xResultSet = xDynamicResultSet.getStaticResultSet(); - XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface(XContentAccess.class, xResultSet); + XContentAccess xContentAccess = UnoRuntime.queryInterface(XContentAccess.class, xResultSet); // iterate over the result: three docs were opened, we should have at least three content identifier strings int countContentIdentifiers = 0; while(xResultSet.next()) { countContentIdentifiers++; String identifier = xContentAccess.queryContentIdentifierString(); - log.println("Identifier of row " + xResultSet.getRow() + ": " + identifier); + System.out.println("Identifier of row " + xResultSet.getRow() + ": " + identifier); } // some feeble test: if the amount >2, we're ok. // 2do: check better - assure("Did only find " + countContentIdentifiers + " open documents." + + assertTrue("Did only find " + countContentIdentifiers + " open documents." + " Should have been at least 3.", countContentIdentifiers>2); } catch (com.sun.star.uno.Exception e) { - e.printStackTrace((java.io.PrintWriter)log); - failed("Could not create test objects."); + e.printStackTrace(); + fail("Could not create test objects."); } } + + 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()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java index 229f5d388697..ad0001161c49 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java @@ -34,49 +34,49 @@ import com.sun.star.embed.XStorage; import com.sun.star.frame.XModel; import com.sun.star.frame.XTransientDocumentsDocumentContentFactory; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; import com.sun.star.text.XTextDocument; import com.sun.star.ucb.Command; import com.sun.star.ucb.ContentInfo; -import com.sun.star.ucb.InsertCommandArgument; import com.sun.star.ucb.OpenCommandArgument2; import com.sun.star.ucb.OpenMode; import com.sun.star.ucb.XCommandProcessor; import com.sun.star.ucb.XContent; -import com.sun.star.ucb.XContentAccess; -import com.sun.star.ucb.XContentIdentifier; -import com.sun.star.ucb.XContentIdentifierFactory; -import com.sun.star.ucb.XContentProvider; import com.sun.star.ucb.XDynamicResultSet; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; import util.WriterTools; import util.utils; - +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.*; /** * */ -public class CheckTransientDocumentsDocumentContent extends ComplexTestCase { +public class CheckTransientDocumentsDocumentContent { private final String testDocuments = "sForm.sxw"; private final String folderName = "TestFolder"; private XMultiServiceFactory xMSF = null; private XTextDocument xTextDoc = null; - public String[] getTestMethodNames() { - return new String[]{"checkTransientDocumentsDocumentContent"}; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkTransientDocumentsDocumentContent"}; +// } - public void before() { - xMSF = (XMultiServiceFactory)param.getMSF(); - log.println("Open a document."); - String fileName = utils.getFullTestURL(testDocuments); + @Before public void before() { + xMSF = getMSF(); + System.out.println("Open a document."); + String fileName = TestDocument.getUrl(testDocuments); xTextDoc = WriterTools.loadTextDoc(xMSF, fileName); + assertNotNull(xTextDoc); } - public void after() { - log.println("Close all documents."); + @After public void after() { + System.out.println("Close all documents."); xTextDoc.dispose(); } @@ -84,30 +84,28 @@ public class CheckTransientDocumentsDocumentContent extends ComplexTestCase { * Check the provider of document content: open some documents * and look if they are accessible. */ - public void checkTransientDocumentsDocumentContent() { + @Test public void checkTransientDocumentsDocumentContent() { try { // create a content provider Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"); XTransientDocumentsDocumentContentFactory xTransientDocumentsDocumentContentFactory = - (XTransientDocumentsDocumentContentFactory)UnoRuntime.queryInterface( - XTransientDocumentsDocumentContentFactory.class, o); + UnoRuntime.queryInterface(XTransientDocumentsDocumentContentFactory.class, o); // get the model from the opened document XModel xModel = xTextDoc.getCurrentController().getModel(); // a little additional check for 114733 - XDocumentSubStorageSupplier xDocumentSubStorageSupplier = (XDocumentSubStorageSupplier) - UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class, xModel); + XDocumentSubStorageSupplier xDocumentSubStorageSupplier = UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class, xModel); String[]names = xDocumentSubStorageSupplier.getDocumentSubStoragesNames(); for (int i=0; i +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +package complex.tdoc; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument { + public static String getUrl(String name) { + return OfficeFileUrl.getAbsolute(new File("test_documents", name)); + } + + private TestDocument() {} +} diff --git a/ucb/qa/complex/tdoc/interfaces/makefile.mk b/ucb/qa/complex/tdoc/interfaces/makefile.mk index 3a57d1501ca4..5399383f19e6 100755 --- a/ucb/qa/complex/tdoc/interfaces/makefile.mk +++ b/ucb/qa/complex/tdoc/interfaces/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/.. +PRJ = ../../../.. TARGET = TransientDocument PRJNAME = $(TARGET) -PACKAGE = complex$/tdoc$/interfaces +PACKAGE = complex/tdoc/interfaces # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk diff --git a/ucb/qa/complex/tdoc/makefile.mk b/ucb/qa/complex/tdoc/makefile.mk index 175184de0f27..f5f2629f5592 100755 --- a/ucb/qa/complex/tdoc/makefile.mk +++ b/ucb/qa/complex/tdoc/makefile.mk @@ -25,62 +25,43 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = TransientDocument -PRJNAME = $(TARGET) -PACKAGE = complex.tdoc - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CheckContentProvider.java \ - CheckTransientDocumentsContent.java \ - CheckTransientDocumentsContentProvider.java \ - CheckTransientDocumentsDocumentContent.java +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -# CheckSimpleFileAccess.java \ -#----- make a jar from compiled files ------------------------------ +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_tdoc -MAXLINELENGTH = 100000 +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/tdoc -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +JAVATESTFILES = \ + CheckContentProvider.java \ + CheckTransientDocumentsContent.java \ + CheckTransientDocumentsContentProvider.java \ + CheckTransientDocumentsDocumentContent.java -# --- Parameters for the test -------------------------------------- +JAVAFILES = $(JAVATESTFILES) \ + TestDocument.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 +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test base is java complex -CT_TESTBASE = -TestBase java_complex -# replace $/ with . in package name -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +SUBDIRS = interfaces -# start the runner application -CT_APP = org.openoffice.Runner +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# test document path -CT_TESTDOCS = -tdoc $(PWD)$/..$/test_documents +.END -# --- Targets ------------------------------------------------------ +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: ALLTAR - @echo . - @echo "The followig tests are available:" - @echo $(foreach,i,$(JAVAFILES) "dmake $(i:b) ") +ALLTAR : javatest -.INCLUDE : target.mk +.END -Check%: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_TESTDOCS) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).$@ diff --git a/ucb/qa/complex/tdoc/test_documents/Iterator.sxw b/ucb/qa/complex/tdoc/test_documents/Iterator.sxw new file mode 100644 index 000000000000..9a7f8961bb47 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/Iterator.sxw differ diff --git a/ucb/qa/complex/tdoc/test_documents/chinese.sxw b/ucb/qa/complex/tdoc/test_documents/chinese.sxw new file mode 100644 index 000000000000..53b242a292c3 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/chinese.sxw differ diff --git a/ucb/qa/complex/tdoc/test_documents/filter.sxw b/ucb/qa/complex/tdoc/test_documents/filter.sxw new file mode 100644 index 000000000000..e4b077c65f11 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/filter.sxw differ diff --git a/ucb/qa/complex/test_documents/Iterator.sxw b/ucb/qa/complex/test_documents/Iterator.sxw deleted file mode 100644 index 9a7f8961bb47..000000000000 Binary files a/ucb/qa/complex/test_documents/Iterator.sxw and /dev/null differ diff --git a/ucb/qa/complex/test_documents/chinese.sxw b/ucb/qa/complex/test_documents/chinese.sxw deleted file mode 100644 index 53b242a292c3..000000000000 Binary files a/ucb/qa/complex/test_documents/chinese.sxw and /dev/null differ diff --git a/ucb/qa/complex/test_documents/filter.sxw b/ucb/qa/complex/test_documents/filter.sxw deleted file mode 100644 index e4b077c65f11..000000000000 Binary files a/ucb/qa/complex/test_documents/filter.sxw and /dev/null differ diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java index f7b1d2a8e918..c027dd95bb37 100755 --- a/ucb/qa/complex/ucb/UCB.java +++ b/ucb/qa/complex/ucb/UCB.java @@ -34,7 +34,6 @@ package complex.ucb; * Window>Preferences>Java>Code Generation>Code and Comments */ -import complexlib.ComplexTestCase; import java.util.List; import java.util.Vector; @@ -42,13 +41,22 @@ import com.sun.star.beans.Property; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; -import com.sun.star.uno.XComponentContext; +// import com.sun.star.uno.XComponentContext; import com.sun.star.ucb.*; -import com.sun.star.bridge.XUnoUrlResolver; +// import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.beans.XPropertySet; +// import com.sun.star.uno.XComponentContext; +// import com.sun.star.lang.XMultiComponentFactory; +// import com.sun.star.beans.XPropertySet; + +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.*; + /** * @author rpiterman * This class is used to copy the content of a folder to @@ -56,12 +64,12 @@ import com.sun.star.beans.XPropertySet; * There is an incosistency with argument order. * It should be always: dir,filename. */ -public class UCB extends ComplexTestCase { +public class UCB { private Object ucb; - public String[] getTestMethodNames() { - return new String[] {"checkWrongFtpConnection"}; - } +// public String[] getTestMethodNames() { +// return new String[] {"checkWrongFtpConnection"}; +// } public void init(XMultiServiceFactory xmsf) throws Exception { String[] keys = new String[2]; @@ -79,11 +87,13 @@ public class UCB extends ComplexTestCase { /** * target name can be "", in which case the name stays lige the source name - * @param sourceDir - * @param filename - * @param targetDir - * @param targetName - * @return + + * @param xContent + * @param aCommandName + * @param aArgument + * @return + * @throws com.sun.star.ucb.CommandAbortedException + * @throws com.sun.star.uno.Exception */ public Object executeCommand( @@ -92,9 +102,7 @@ public class UCB extends ComplexTestCase { Object aArgument) throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { XCommandProcessor xCmdProcessor = - (XCommandProcessor) UnoRuntime.queryInterface( - XCommandProcessor.class, - xContent); + UnoRuntime.queryInterface(XCommandProcessor.class, xContent); Command aCommand = new Command(); aCommand.Name = aCommandName; aCommand.Handle = -1; // not available @@ -118,39 +126,44 @@ public class UCB extends ComplexTestCase { XDynamicResultSet xSet; xSet = - (XDynamicResultSet) UnoRuntime.queryInterface( - XDynamicResultSet.class, - executeCommand(xContent, "open", aArg)); + UnoRuntime.queryInterface(XDynamicResultSet.class, executeCommand(xContent, "open", aArg)); XResultSet xResultSet = xSet.getStaticResultSet(); List files = new Vector(); - if (xResultSet.first()) { + if (xResultSet.first()) + { // obtain XContentAccess interface for child content access and XRow for properties - XContentAccess xContentAccess = - (XContentAccess) UnoRuntime.queryInterface( - XContentAccess.class, - xResultSet); - XRow xRow = - (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); - do { + XContentAccess xContentAccess = UnoRuntime.queryInterface(XContentAccess.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); + do + { // Obtain URL of child. String aId = xContentAccess.queryContentIdentifierString(); // First column: Title (column numbers are 1-based!) String aTitle = xRow.getString(1); - if (aTitle.length() == 0 && xRow.wasNull()); - //ignore + if (aTitle.length() == 0 && xRow.wasNull()) + { + //ignore + } else - files.add(aTitle); + { + files.add(aTitle); + } } while (xResultSet.next()); // next child } if (verifier != null) - for (int i = 0; i < files.size(); i++) - if (!verifier.verify(files.get(i))) - files.remove(i--); - + { + for (int i = 0; i < files.size(); i++) + { + if (!verifier.verify(files.get(i))) + { + files.remove(i--); + } + } + } return files; } @@ -165,45 +178,46 @@ public class UCB extends ComplexTestCase { pv[0].Handle = -1; Object row = executeCommand(content, "getPropertyValues", pv); - XRow xrow = (XRow) UnoRuntime.queryInterface(XRow.class, row); + XRow xrow = UnoRuntime.queryInterface(XRow.class, row); if (type.equals(String.class)) - return xrow.getString(1); + { + return xrow.getString(1); + } else if (type.equals(Boolean.class)) - return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + { + return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + } else if (type.equals(Integer.class)) - return new Integer(xrow.getInt(1)); + { + return new Integer(xrow.getInt(1)); + } else if (type.equals(Short.class)) - return new Short(xrow.getShort(1)); + { + return new Short(xrow.getShort(1)); + } else - return null; + { + return null; + } } - public Object getContent(String path) throws Exception { - XContentIdentifier id = - ( - (XContentIdentifierFactory) UnoRuntime.queryInterface( - XContentIdentifierFactory.class, - ucb)).createContentIdentifier( - path); - - return ( - (XContentProvider) UnoRuntime.queryInterface( - XContentProvider.class, - ucb)).queryContent( - id); + public Object getContent(String path) throws Exception + { + XContentIdentifier id = (UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path); + return (UnoRuntime.queryInterface(XContentProvider.class, ucb)).queryContent(id); } public static interface Verifier { public boolean verify(Object object); } - public void checkWrongFtpConnection() { + @Test public void checkWrongFtpConnection() { //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 try { - XMultiServiceFactory xLocMSF = (XMultiServiceFactory)param.getMSF(); + XMultiServiceFactory xLocMSF = getMSF(); String acountUrl = "ftp://noname:nopasswd@nohost"; - log.println(acountUrl); + System.out.println(acountUrl); init(xLocMSF); Object content = getContent(acountUrl); @@ -211,22 +225,45 @@ public class UCB extends ComplexTestCase { aArg.Mode = OpenMode.ALL; // FOLDER, DOCUMENTS -> simple filter aArg.Priority = 32768; // Ignored by most implementations - log.println("now executing open"); + System.out.println("now executing open"); executeCommand(content, "open", aArg); - failed("Expected 'IllegalArgumentException' was not thrown."); + fail("Expected 'IllegalArgumentException' was not thrown."); } catch (com.sun.star.lang.IllegalArgumentException ex) { //TODO error message; - log.println("Correct exception thrown: " + ex.getClass().toString()); + System.out.println("Correct exception thrown: " + ex.getClass().toString()); } catch(com.sun.star.ucb.InteractiveNetworkResolveNameException ex) { - log.println("This Exception is correctly thrown when no Proxy in StarOffice is used."); - log.println("To reproduce the bug behaviour, use a Proxy and try again."); + System.out.println("This Exception is correctly thrown when no Proxy in StarOffice is used."); + System.out.println("To reproduce the bug behaviour, use a Proxy and try again."); } catch (Exception ex) { - ex.printStackTrace((java.io.PrintWriter)log); + ex.printStackTrace(); String exceptionName = ex.toString(); - log.println("ExName: '"+exceptionName+"'"); - failed("Wrong exception thrown: " + exceptionName); + System.out.println("ExName: '"+exceptionName+"'"); + fail("Wrong exception thrown: " + exceptionName); } // System.exit(0); } + + + 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()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/ucb/qa/complex/ucb/makefile.mk b/ucb/qa/complex/ucb/makefile.mk index 4664bd3cfae7..4ac3928c9e5e 100755 --- a/ucb/qa/complex/ucb/makefile.mk +++ b/ucb/qa/complex/ucb/makefile.mk @@ -25,54 +25,38 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = UCB -PRJNAME = $(TARGET) -PACKAGE = complex$/ucb - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = UCB.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -#----- make a jar from compiled files ------------------------------ +PRJ = ../../.. +PRJNAME = UCB +TARGET = qa_complex_ucb -MAXLINELENGTH = 100000 +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/ucb +JAVATESTFILES = \ + UCB.java -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +JAVAFILES = $(JAVATESTFILES) -# --- Parameters for the test -------------------------------------- +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# 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 +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y +.END -# test base is java complex -CT_TESTBASE = -TestBase java_complex +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +ALLTAR : javatest -# start the runner application -CT_APP = org.openoffice.Runner +.END -# --- Targets ------------------------------------------------------ -.INCLUDE : target.mk -RUN: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST) -run: RUN -- cgit