diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-10-14 16:40:31 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-10-14 16:40:31 +0200 |
commit | eed23e3d2da3fe09c121723b07e089c680caffaa (patch) | |
tree | b85575ca23f1cd69fa2267edf9848f77e5bb8649 /sfx2/qa/complex | |
parent | 420160a0b65ce72a2e1a6d88599a48f91c2ac6c2 (diff) |
undoapi: sfx2/qa: fixed some NetBeans 6.9 warnings, removed some dead files, refactored for easier usage
Diffstat (limited to 'sfx2/qa/complex')
-rw-r--r-- | sfx2/qa/complex/docinfo/makefile.mk | 63 | ||||
-rw-r--r-- | sfx2/qa/complex/framework/makefile.mk | 65 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/DocumentInfo.java (renamed from sfx2/qa/complex/docinfo/DocumentProperties.java) | 19 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/DocumentMetadataAccess.java (renamed from sfx2/qa/complex/framework/DocumentMetadataAccessTest.java) | 201 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/DocumentProperties.java (renamed from sfx2/qa/complex/framework/DocumentPropertiesTest.java) | 34 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java (renamed from sfx2/qa/complex/framework/CheckGlobalEventBroadcaster_writer1.java) | 14 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java (renamed from sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoUnitTest.java) | 26 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/makefile.mk (renamed from sfx2/qa/complex/framework/DocHelper/makefile.mk) | 54 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java (renamed from sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoTest.java) | 2 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java (renamed from sfx2/qa/complex/standalonedocumentinfo/Test01.java) | 4 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java (renamed from sfx2/qa/complex/standalonedocumentinfo/TestHelper.java) | 2 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/testdocuments/CUSTOM.odt (renamed from sfx2/qa/complex/framework/testdocuments/CUSTOM.odt) | bin | 1021 -> 1021 bytes | |||
-rw-r--r-- | sfx2/qa/complex/sfx2/testdocuments/TEST.odt (renamed from sfx2/qa/complex/framework/testdocuments/TEST.odt) | bin | 13803 -> 13803 bytes | |||
-rw-r--r-- | sfx2/qa/complex/sfx2/testdocuments/TESTRDFA.odt (renamed from sfx2/qa/complex/framework/testdocuments/TESTRDFA.odt) | bin | 7540 -> 7540 bytes | |||
-rw-r--r-- | sfx2/qa/complex/sfx2/testdocuments/empty.rdf (renamed from sfx2/qa/complex/framework/testdocuments/empty.rdf) | 0 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/tools/DialogThread.java (renamed from sfx2/qa/complex/framework/DialogThread.java) | 19 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/tools/TestDocument.java (renamed from sfx2/qa/complex/framework/TestDocument.java) | 4 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/tools/WriterHelper.java (renamed from sfx2/qa/complex/framework/WriterHelper.java) | 34 | ||||
-rw-r--r-- | sfx2/qa/complex/standalonedocumentinfo/makefile.mk | 56 | ||||
-rw-r--r-- | sfx2/qa/complex/tests.sce | 3 |
20 files changed, 221 insertions, 379 deletions
diff --git a/sfx2/qa/complex/docinfo/makefile.mk b/sfx2/qa/complex/docinfo/makefile.mk deleted file mode 100644 index 626b648a6d06..000000000000 --- a/sfx2/qa/complex/docinfo/makefile.mk +++ /dev/null @@ -1,63 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = sfx2 -TARGET = qa_complex_docinfo - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/docinfo -JAVATESTFILES = \ - DocumentProperties.java - -JAVAFILES = $(JAVATESTFILES) - - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - -# Sample how to debug -# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y - -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END - - - - - diff --git a/sfx2/qa/complex/framework/makefile.mk b/sfx2/qa/complex/framework/makefile.mk deleted file mode 100644 index 325135b9133c..000000000000 --- a/sfx2/qa/complex/framework/makefile.mk +++ /dev/null @@ -1,65 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = sfx2 -TARGET = qa_complex_framework - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/framework -JAVATESTFILES = \ - DocumentPropertiesTest.java \ - DocumentMetadataAccessTest.java \ - CheckGlobalEventBroadcaster_writer1.java - -JAVAFILES = $(JAVATESTFILES) \ - TestDocument.java \ - WriterHelper.java \ - DialogThread.java - - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - -# Sample how to debug -# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y - -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END - - diff --git a/sfx2/qa/complex/docinfo/DocumentProperties.java b/sfx2/qa/complex/sfx2/DocumentInfo.java index 0c4eb44c4a35..ca7ae8b1dda0 100644 --- a/sfx2/qa/complex/docinfo/DocumentProperties.java +++ b/sfx2/qa/complex/sfx2/DocumentInfo.java @@ -24,9 +24,9 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.docinfo; +package complex.sfx2; -import com.sun.star.beans.*; +import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertyContainer; @@ -49,22 +49,17 @@ import util.WriterTools; 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 DocumentProperties +public class DocumentInfo { - XMultiServiceFactory m_xMSF = null; XTextDocument xTextDoc = null; XTextDocument xTextDocSecond = null; -// public String[] getTestMethodNames() { -// return new String[] {"checkDocInfo", "cleanup"}; -// } @Test public void checkDocInfo() { m_xMSF = getMSF(); @@ -349,14 +344,18 @@ public class DocumentProperties // setup and close connections @BeforeClass public static void setUpConnection() throws Exception { - System.out.println("setUpConnection()"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "starting class: " + DocumentInfo.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.setUp(); } @AfterClass public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection()"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "finishing class: " + DocumentInfo.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.tearDown(); } private static final OfficeConnection connection = new OfficeConnection(); diff --git a/sfx2/qa/complex/framework/DocumentMetadataAccessTest.java b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java index 3f61cb21b3dd..d145b9028473 100644 --- a/sfx2/qa/complex/framework/DocumentMetadataAccessTest.java +++ b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java @@ -25,9 +25,27 @@ * ************************************************************************/ -package complex.framework; +package complex.sfx2; // import complexlib.ComplexTestCase; +import com.sun.star.beans.Pair; +import com.sun.star.rdf.Literal; +import com.sun.star.rdf.XLiteral; +import com.sun.star.rdf.XNamedGraph; +import com.sun.star.rdf.BlankNode; +import com.sun.star.rdf.XQuerySelectResult; +import com.sun.star.rdf.XNode; +import com.sun.star.rdf.XDocumentRepository; +import com.sun.star.rdf.XMetadatable; +import com.sun.star.rdf.Statement; +import com.sun.star.rdf.FileFormat; +import com.sun.star.rdf.URIs; +import com.sun.star.rdf.URI; +import com.sun.star.rdf.XDocumentMetadataAccess; +import com.sun.star.rdf.XRepositorySupplier; +import com.sun.star.rdf.XRepository; +import com.sun.star.rdf.XBlankNode; +import com.sun.star.rdf.XURI; import helper.StreamSimulator; import com.sun.star.uno.UnoRuntime; @@ -41,7 +59,6 @@ import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.WrappedTargetRuntimeException; import com.sun.star.beans.XPropertySet; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.Pair; import com.sun.star.beans.StringPair; import com.sun.star.container.XEnumerationAccess; import com.sun.star.container.XEnumeration; @@ -51,7 +68,7 @@ import com.sun.star.frame.XStorable; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextRange; import com.sun.star.text.XText; -import com.sun.star.rdf.*; +import complex.sfx2.tools.TestDocument; import lib.TestParameters; @@ -73,7 +90,7 @@ import static org.junit.Assert.*; * * @author mst */ -public class DocumentMetadataAccessTest +public class DocumentMetadataAccess { XMultiServiceFactory xMSF; XComponentContext xContext; @@ -196,22 +213,22 @@ public class DocumentMetadataAccessTest PropertyValue[] loadProps = new PropertyValue[1]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "Hidden"; - loadProps[0].Value = new Boolean(true); + loadProps[0].Value = true; xComp = util.DesktopTools.openNewDoc(xMSF, "swriter", loadProps); XTextDocument xText = UnoRuntime.queryInterface(XTextDocument.class, xComp); - XRepositorySupplier xRS = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); - assertNotNull("xRS null", xRS); - XDocumentMetadataAccess xDMA = UnoRuntime.queryInterface(XDocumentMetadataAccess.class, xRS); - assertNotNull("xDMA null", xDMA); - xRep = xRS.getRDFRepository(); + XRepositorySupplier xRepoSupplier = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); + assertNotNull("xRS null", xRepoSupplier); + XDocumentMetadataAccess xDocMDAccess = UnoRuntime.queryInterface(XDocumentMetadataAccess.class, xRepoSupplier); + assertNotNull("xDMA null", xDocMDAccess); + xRep = xRepoSupplier.getRDFRepository(); assertNotNull("xRep null", xRep); System.out.println("...done"); System.out.println("Checking that new repository is initialized..."); - XURI xBaseURI = (XURI) xDMA; + XURI xBaseURI = (XURI) xDocMDAccess; String baseURI = xBaseURI.getStringValue(); assertNotNull("new: baseURI", xBaseURI ); assertTrue("new: baseURI", !xBaseURI.getStringValue().equals("")); @@ -235,79 +252,79 @@ public class DocumentMetadataAccessTest XMetadatable xM = (XMetadatable) xTR; try { - xDMA.getElementByURI(null); + xDocMDAccess.getElementByURI(null); fail("getElementByURI: null allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.getMetadataGraphsWithType(null); + xDocMDAccess.getMetadataGraphsWithType(null); fail("getMetadataGraphsWithType: null URI allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("", new XURI[0]); + xDocMDAccess.addMetadataFile("", new XURI[0]); fail("addMetadataFile: empty filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("/foo", new XURI[0]); + xDocMDAccess.addMetadataFile("/foo", new XURI[0]); fail("addMetadataFile: absolute filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("fo\"o", new XURI[0]); + xDocMDAccess.addMetadataFile("fo\"o", new XURI[0]); fail("addMetadataFile: invalid filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("../foo", new XURI[0]); + xDocMDAccess.addMetadataFile("../foo", new XURI[0]); fail("addMetadataFile: filename with .. allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("foo/../../bar", new XURI[0]); + xDocMDAccess.addMetadataFile("foo/../../bar", new XURI[0]); fail("addMetadataFile: filename with nest .. allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("foo/././bar", new XURI[0]); + xDocMDAccess.addMetadataFile("foo/././bar", new XURI[0]); fail("addMetadataFile: filename with nest . allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("content.xml", new XURI[0]); + xDocMDAccess.addMetadataFile("content.xml", new XURI[0]); fail("addMetadataFile: content.xml allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("styles.xml", new XURI[0]); + xDocMDAccess.addMetadataFile("styles.xml", new XURI[0]); fail("addMetadataFile: styles.xml allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("meta.xml", new XURI[0]); + xDocMDAccess.addMetadataFile("meta.xml", new XURI[0]); fail("addMetadataFile: meta.xml allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addMetadataFile("settings.xml", new XURI[0]); + xDocMDAccess.addMetadataFile("settings.xml", new XURI[0]); fail("addMetadataFile: settings.xml allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.importMetadataFile(FileFormat.RDF_XML, null, "foo", + xDocMDAccess.importMetadataFile(FileFormat.RDF_XML, null, "foo", foo, new XURI[0]); fail("importMetadataFile: null stream allowed"); } catch (IllegalArgumentException e) { @@ -317,7 +334,7 @@ public class DocumentMetadataAccessTest final String sEmptyRDF = TestDocument.getUrl("empty.rdf"); try { XInputStream xFooIn = new StreamSimulator(sEmptyRDF, true, param); - xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "", + xDocMDAccess.importMetadataFile(FileFormat.RDF_XML, xFooIn, "", foo, new XURI[0]); fail("importMetadataFile: empty filename allowed"); } catch (IllegalArgumentException e) { @@ -326,7 +343,7 @@ public class DocumentMetadataAccessTest try { XInputStream xFooIn = new StreamSimulator(sEmptyRDF, true, param); - xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "meta.xml", + xDocMDAccess.importMetadataFile(FileFormat.RDF_XML, xFooIn, "meta.xml", foo, new XURI[0]); fail("importMetadataFile: meta.xml filename allowed"); } catch (IllegalArgumentException e) { @@ -335,7 +352,7 @@ public class DocumentMetadataAccessTest try { XInputStream xFooIn = new StreamSimulator(sEmptyRDF, true, param); - xDMA.importMetadataFile(FileFormat.RDF_XML, + xDocMDAccess.importMetadataFile(FileFormat.RDF_XML, xFooIn, "foo", null, new XURI[0]); fail("importMetadataFile: null base URI allowed"); } catch (IllegalArgumentException e) { @@ -344,62 +361,62 @@ public class DocumentMetadataAccessTest try { XInputStream xFooIn = new StreamSimulator(sEmptyRDF, true, param); - xDMA.importMetadataFile(FileFormat.RDF_XML, + xDocMDAccess.importMetadataFile(FileFormat.RDF_XML, xFooIn, "foo", rdf_type, new XURI[0]); fail("importMetadataFile: non-absolute base URI allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.removeMetadataFile(null); + xDocMDAccess.removeMetadataFile(null); fail("removeMetadataFile: null URI allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addContentOrStylesFile(""); + xDocMDAccess.addContentOrStylesFile(""); fail("addContentOrStylesFile: empty filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addContentOrStylesFile("/content.xml"); + xDocMDAccess.addContentOrStylesFile("/content.xml"); fail("addContentOrStylesFile: absolute filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.addContentOrStylesFile("foo.rdf"); + xDocMDAccess.addContentOrStylesFile("foo.rdf"); fail("addContentOrStylesFile: invalid filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.removeContentOrStylesFile(""); + xDocMDAccess.removeContentOrStylesFile(""); fail("removeContentOrStylesFile: empty filename allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.loadMetadataFromStorage(null, foo, null); + xDocMDAccess.loadMetadataFromStorage(null, foo, null); fail("loadMetadataFromStorage: null storage allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.storeMetadataToStorage(null/*, base*/); + xDocMDAccess.storeMetadataToStorage(null/*, base*/); fail("storeMetadataToStorage: null storage allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.loadMetadataFromMedium(new PropertyValue[0]); + xDocMDAccess.loadMetadataFromMedium(new PropertyValue[0]); fail("loadMetadataFromMedium: empty medium allowed"); } catch (IllegalArgumentException e) { // ignore } try { - xDMA.storeMetadataToMedium(new PropertyValue[0]); + xDocMDAccess.storeMetadataToMedium(new PropertyValue[0]); fail("storeMetadataToMedium: empty medium allowed"); } catch (IllegalArgumentException e) { // ignore @@ -409,26 +426,26 @@ public class DocumentMetadataAccessTest System.out.println("Checking file addition/removal..."); - xDMA.removeContentOrStylesFile(contentPath); + xDocMDAccess.removeContentOrStylesFile(contentPath); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("removeContentOrStylesFile (content)", eq(xStmtsEnum, new Statement[] { manifestStmts[0], manifestStmts[2], manifestStmts[4] })); - xDMA.addContentOrStylesFile(contentPath); + xDocMDAccess.addContentOrStylesFile(contentPath); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("addContentOrStylesFile (content)", eq(xStmtsEnum, manifestStmts)); - xDMA.removeContentOrStylesFile(stylesPath); + xDocMDAccess.removeContentOrStylesFile(stylesPath); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("removeContentOrStylesFile (styles)", eq(xStmtsEnum, new Statement[] { manifestStmts[0], manifestStmts[1], manifestStmts[3] })); - xDMA.addContentOrStylesFile(stylesPath); + xDocMDAccess.addContentOrStylesFile(stylesPath); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("addContentOrStylesFile (styles)", eq(xStmtsEnum, manifestStmts)); @@ -441,19 +458,19 @@ public class DocumentMetadataAccessTest new Statement(xFoo, rdf_type, pkg_MetadataFile, manifest); Statement xM_FooTypeBar = new Statement(xFoo, rdf_type, bar, manifest); - xDMA.addMetadataFile(fooPath, new XURI[] { bar }); + xDocMDAccess.addMetadataFile(fooPath, new XURI[] { bar }); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("addMetadataFile", eq(xStmtsEnum, merge(manifestStmts, new Statement[] { xM_BaseHaspartFoo, xM_FooTypeMetadata, xM_FooTypeBar }))); - XURI[] graphsBar = xDMA.getMetadataGraphsWithType(bar); + XURI[] graphsBar = xDocMDAccess.getMetadataGraphsWithType(bar); assertTrue("getMetadataGraphsWithType", graphsBar.length == 1 && eq(graphsBar[0], xFoo)); - xDMA.removeMetadataFile(xFoo); + xDocMDAccess.removeMetadataFile(xFoo); xStmtsEnum = xManifest.getStatements(null, null, null); assertTrue("removeMetadataFile", eq(xStmtsEnum, manifestStmts)); @@ -468,7 +485,7 @@ public class DocumentMetadataAccessTest XURI uri; XMetadatable xMeta; - xMeta = xDMA.getElementByURI(xMeta1); + xMeta = xDocMDAccess.getElementByURI(xMeta1); assertTrue("getElementByURI: null", null != xMeta); String XmlId = xMeta.getMetadataReference().Second; String XmlId1 = xMeta1.getMetadataReference().Second; @@ -483,7 +500,7 @@ public class DocumentMetadataAccessTest fooBarPath); Statement[] metadataStmts = getMetadataFileStmts(xBaseURI, fooBarPath); - xDMA.addMetadataFile(fooBarPath, new XURI[0]); + xDocMDAccess.addMetadataFile(fooBarPath, new XURI[0]); xStmtsEnum = xRep.getStatements(null, null, null); assertTrue("addMetadataFile", eq(xStmtsEnum, merge(manifestStmts, metadataStmts ))); @@ -520,15 +537,15 @@ public class DocumentMetadataAccessTest xStmtsEnum = xRep.getStatements(null, null, null); XURI[] graphs = xRep.getGraphNames(); - xDMA.storeMetadataToMedium(args); + xDocMDAccess.storeMetadataToMedium(args); // this should re-init - xDMA.loadMetadataFromMedium(argsEmptyNoContent); - xRep = xRS.getRDFRepository(); + xDocMDAccess.loadMetadataFromMedium(argsEmptyNoContent); + xRep = xRepoSupplier.getRDFRepository(); assertTrue("xRep null", null != xRep); assertTrue("baseURI still tdoc?", - !baseURI.equals(xDMA.getStringValue())); - Statement[] manifestStmts2 = getManifestStmts((XURI) xDMA); + !baseURI.equals(xDocMDAccess.getStringValue())); + Statement[] manifestStmts2 = getManifestStmts((XURI) xDocMDAccess); xStmtsEnum = xRep.getStatements(null, null, null); // there is no content or styles file in here, so we have just // the package stmt @@ -536,29 +553,29 @@ public class DocumentMetadataAccessTest eq(xStmtsEnum, new Statement[] { manifestStmts2[0] })); // this should re-init - xDMA.loadMetadataFromMedium(argsEmpty); - xRep = xRS.getRDFRepository(); + xDocMDAccess.loadMetadataFromMedium(argsEmpty); + xRep = xRepoSupplier.getRDFRepository(); assertTrue("xRep null", null != xRep); assertTrue("baseURI still tdoc?", - !baseURI.equals(xDMA.getStringValue())); - Statement[] manifestStmts3 = getManifestStmts((XURI) xDMA); + !baseURI.equals(xDocMDAccess.getStringValue())); + Statement[] manifestStmts3 = getManifestStmts((XURI) xDocMDAccess); xStmtsEnum = xRep.getStatements(null, null, null); assertTrue("loadMetadataFromMedium (no metadata)", eq(xStmtsEnum, manifestStmts3)); - xDMA.loadMetadataFromMedium(args); - xRep = xRS.getRDFRepository(); + xDocMDAccess.loadMetadataFromMedium(args); + xRep = xRepoSupplier.getRDFRepository(); assertTrue("xRep null", null != xRep); - Statement[] manifestStmts4 = getManifestStmts((XURI) xDMA); - Statement[] metadataStmts4 = getMetadataFileStmts((XURI) xDMA, + Statement[] manifestStmts4 = getManifestStmts((XURI) xDocMDAccess); + Statement[] metadataStmts4 = getMetadataFileStmts((XURI) xDocMDAccess, fooBarPath); xStmtsEnum = xRep.getStatements(null, null, null); assertTrue("some graph(s) not reloaded", graphs.length == xRep.getGraphNames().length); - XURI xFoobar4 = URI.createNS(xContext, xDMA.getStringValue(), + XURI xFoobar4 = URI.createNS(xContext, xDocMDAccess.getStringValue(), fooBarPath); Statement xFoobar_FooBarFoo4 = new Statement(foo, bar, foo, xFoobar4); @@ -572,7 +589,7 @@ public class DocumentMetadataAccessTest String f = tempDir + "TESTPARA.odt"; - XStorable xStor = UnoRuntime.queryInterface(XStorable.class, xRS); + XStorable xStor = UnoRuntime.queryInterface(XStorable.class, xRepoSupplier); xStor.storeToURL(f, new PropertyValue[0]); @@ -656,17 +673,17 @@ public class DocumentMetadataAccessTest PropertyValue[] loadProps = new PropertyValue[1]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "Hidden"; - loadProps[0].Value = new Boolean(true); + loadProps[0].Value = true; xComp = util.DesktopTools.loadDoc(xMSF, file, loadProps); - XRepositorySupplier xRS = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); - assertTrue("xRS null", null != xRS); + XRepositorySupplier xRepoSupplier = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); + assertTrue("xRS null", null != xRepoSupplier); - XDocumentRepository xRep = UnoRuntime.queryInterface(XDocumentRepository.class, xRS.getRDFRepository()); - assertTrue("xRep null", null != xRep); + XDocumentRepository xDocRepository = UnoRuntime.queryInterface(XDocumentRepository.class, xRepoSupplier.getRDFRepository()); + assertTrue("xRep null", null != xDocRepository); XTextDocument xTextDoc = UnoRuntime.queryInterface(XTextDocument.class, xComp); @@ -684,7 +701,7 @@ public class DocumentMetadataAccessTest Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 1", !result.Second && eq(result.First, new Statement[] { @@ -693,7 +710,7 @@ public class DocumentMetadataAccessTest Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 2", !result.Second && eq(result.First, new Statement[] { @@ -703,7 +720,7 @@ public class DocumentMetadataAccessTest Statement x_BlankBarLit3 = new Statement(blank1, bar, mkLit("3"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 3", !result.Second && eq(result.First, new Statement[] { @@ -714,7 +731,7 @@ public class DocumentMetadataAccessTest Statement x_BlankBarLit4 = new Statement(blank2, bar, mkLit("4"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 4", !result.Second && eq(result.First, new Statement[] { @@ -725,7 +742,7 @@ public class DocumentMetadataAccessTest Statement x_BlankBarLit5 = new Statement(blank1, bar, mkLit("5"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 5", !result.Second && eq(result.First, new Statement[] { @@ -741,7 +758,7 @@ public class DocumentMetadataAccessTest Statement x_FooBarLit6 = new Statement(foo, bar, mkLit("6"), null); Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 6", !result.Second && eq(result.First, new Statement[] { @@ -752,7 +769,7 @@ public class DocumentMetadataAccessTest Statement x_FooBazLit7 = new Statement(foo, baz, mkLit("7"), null); Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 7", !result.Second && eq(result.First, new Statement[] { @@ -765,7 +782,7 @@ public class DocumentMetadataAccessTest Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 8", result.Second && eq(result.First, new Statement[] { @@ -773,7 +790,7 @@ public class DocumentMetadataAccessTest })); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 9", result.Second && eq(result.First, new Statement[] { @@ -781,7 +798,7 @@ public class DocumentMetadataAccessTest })); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 10", result.Second && eq(result.First, new Statement[] { @@ -791,7 +808,7 @@ public class DocumentMetadataAccessTest Statement x_FooBarLit11 = new Statement(foo, bar, mkLit("11", bar), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 11", !result.Second && eq(result.First, new Statement[] { @@ -802,7 +819,7 @@ public class DocumentMetadataAccessTest Statement x_FileBarLit12 = new Statement(xFile, bar, mkLit("12"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 12", !result.Second && eq(result.First, new Statement[] { @@ -810,7 +827,7 @@ public class DocumentMetadataAccessTest })); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 13", result.Second && eq(result.First, new Statement[] { @@ -820,7 +837,7 @@ public class DocumentMetadataAccessTest Statement x_FooLabelLit14 = new Statement(foo, rdfs_label, mkLit("14"), null); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 14", result.Second && eq(result.First, new Statement[] { @@ -828,33 +845,33 @@ public class DocumentMetadataAccessTest })); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 15", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 16", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 17", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 18", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 19", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 20", eq(result.First, new Statement[] { } )); xPara = UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - result = xRep.getStatementRDFa(xPara); + result = xDocRepository.getStatementRDFa(xPara); assertTrue("RDFa: 21", eq(result.First, new Statement[] { } )); System.out.println("...done"); @@ -889,7 +906,7 @@ public class DocumentMetadataAccessTest public void report(Exception e) { System.out.println("Exception occurred:"); - e.printStackTrace(); + e.printStackTrace(System.out); report2(e); fail(); } @@ -1275,14 +1292,18 @@ public class DocumentMetadataAccessTest // setup and close connections @BeforeClass public static void setUpConnection() throws Exception { - System.out.println("setUpConnection()"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "starting class: " + DocumentMetadataAccess.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.setUp(); } @AfterClass public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection() DocumentMetadataAccessTest"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "finishing class: " + DocumentMetadataAccess.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.tearDown(); } diff --git a/sfx2/qa/complex/framework/DocumentPropertiesTest.java b/sfx2/qa/complex/sfx2/DocumentProperties.java index 20a0746c8322..01ccaa21619b 100644 --- a/sfx2/qa/complex/framework/DocumentPropertiesTest.java +++ b/sfx2/qa/complex/sfx2/DocumentProperties.java @@ -25,9 +25,10 @@ * ************************************************************************/ -package complex.framework; +package complex.sfx2; +import complex.sfx2.tools.TestDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XInitialization; @@ -53,7 +54,6 @@ import com.sun.star.document.XDocumentProperties; 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; @@ -66,12 +66,8 @@ import static org.junit.Assert.*; * * @author mst */ -public class DocumentPropertiesTest +public class DocumentProperties { -// public String[] getTestMethodNames () { -// return new String[] { "check", "cleanup" }; -// } - @After public void cleanup() { // nothing to do } @@ -80,7 +76,7 @@ public class DocumentPropertiesTest class Listener implements XModifyListener { private boolean m_Called; - public Listener() { + Listener() { m_Called = false; } @@ -235,8 +231,7 @@ public class DocumentPropertiesTest new NamedValue("PageCount", new Integer(1)))); XPropertyContainer udpc = xDP.getUserDefinedProperties(); - XPropertySet udps = (XPropertySet) UnoRuntime.queryInterface( - XPropertySet.class, udpc); + XPropertySet udps = UnoRuntime.queryInterface( XPropertySet.class, udpc ); assertTrue("UserDefined 1", "Dies ist ein wichtiger Hinweis" .equals(udps.getPropertyValue("Hinweis"))); assertTrue("UserDefined 2", ("Kann Spuren von N" @@ -366,8 +361,7 @@ public class DocumentPropertiesTest dur.Seconds = 555; dur.MilliSeconds = 444; - udpc.addProperty("Frobnicate", PropertyAttribute.REMOVEABLE, - new Boolean(b)); + udpc.addProperty("Frobnicate", PropertyAttribute.REMOVEABLE, b); udpc.addProperty("FrobDuration", PropertyAttribute.REMOVEABLE, dur); udpc.addProperty("FrobDuration2", PropertyAttribute.REMOVEABLE, t); udpc.addProperty("FrobEndDate", PropertyAttribute.REMOVEABLE, date); @@ -433,8 +427,7 @@ public class DocumentPropertiesTest System.out.println("Checking user-defined meta-data from stored file..."); udpc = xDP.getUserDefinedProperties(); - udps = (XPropertySet) UnoRuntime.queryInterface( - XPropertySet.class, udpc); + udps = UnoRuntime.queryInterface( XPropertySet.class, udpc ); assertTrue("UserDefined bool", new Boolean(b).equals( udps.getPropertyValue("Frobnicate"))); @@ -467,8 +460,7 @@ public class DocumentPropertiesTest System.out.println("Checking notification listener interface..."); Listener listener = new Listener(); - XModifyBroadcaster xMB = (XModifyBroadcaster) - UnoRuntime.queryInterface(XModifyBroadcaster.class, xDP); + XModifyBroadcaster xMB = UnoRuntime.queryInterface( XModifyBroadcaster.class, xDP ); xMB.addModifyListener(listener); xDP.setAuthor("not me"); assertTrue("Listener Author", listener.reset()); @@ -542,20 +534,24 @@ public class DocumentPropertiesTest private XMultiServiceFactory getMSF() { - final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + 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()"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "starting class: " + DocumentProperties.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.setUp(); } @AfterClass public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection() DocumentPropertiesTest"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "finishing class: " + DocumentProperties.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.tearDown(); } diff --git a/sfx2/qa/complex/framework/CheckGlobalEventBroadcaster_writer1.java b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java index c6dc073095b1..41bd66ccb5b9 100644 --- a/sfx2/qa/complex/framework/CheckGlobalEventBroadcaster_writer1.java +++ b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.framework; +package complex.sfx2; import com.sun.star.awt.XWindow; import com.sun.star.document.XEventBroadcaster; @@ -33,7 +33,7 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; -import complex.framework.DocHelper.WriterHelper; +import complex.sfx2.tools.WriterHelper; import java.util.ArrayList; @@ -53,7 +53,7 @@ import static org.junit.Assert.*; * it will add an XEventListener and verify the Events * raised when opening/changing and closing Office Documents */ -public class CheckGlobalEventBroadcaster_writer1 { +public class GlobalEventBroadcaster { XMultiServiceFactory m_xMSF = null; XEventBroadcaster m_xEventBroadcaster = null; ArrayList notifyEvents = new ArrayList(); @@ -61,12 +61,6 @@ public class CheckGlobalEventBroadcaster_writer1 { XSpreadsheetDocument xSheetDoc; XEventListener m_xEventListener = new EventListenerImpl(); -// public String[] getTestMethodNames() { -// return new String[] { -// "initialize", "checkWriter", "cleanup" -// }; -// } - @Before public void initialize() { m_xMSF = getMSF(); System.out.println("check wether there is a valid MultiServiceFactory"); @@ -79,7 +73,6 @@ public class CheckGlobalEventBroadcaster_writer1 { "Create an instance of com.sun.star.frame.GlobalEventBroadcaster"); Object GlobalEventBroadcaster = null; - Object dispatcher = null; try { GlobalEventBroadcaster = m_xMSF.createInstance( @@ -116,7 +109,6 @@ public class CheckGlobalEventBroadcaster_writer1 { WriterHelper wHelper = new WriterHelper(m_xMSF); String[] expected; - boolean locRes = true; System.out.println("opening an empty writer doc"); notifyEvents.clear(); { diff --git a/sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoUnitTest.java b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java index 29fcaba8cb7a..1e9cbb1f4738 100644 --- a/sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoUnitTest.java +++ b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java @@ -24,10 +24,12 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.standalonedocumentinfo; +package complex.sfx2; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; +import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest; +import complex.sfx2.standalonedocinfo.Test01; import org.junit.After; import org.junit.AfterClass; @@ -40,18 +42,9 @@ import static org.junit.Assert.*; /* Document here */ -public class StandaloneDocumentInfoUnitTest { +public class StandaloneDocumentInfo { private XMultiServiceFactory m_xMSF = null; -// public String[] getTestMethodNames() { -// return new String[] { -// "ExecuteTest01"}; -// } - -// public String[] getTestObjectNames() { -// return new String[] {"StandaloneDocumentInfoUnitTest"}; -// } - @Before public void before() { try { m_xMSF = getMSF(); @@ -82,15 +75,20 @@ public class StandaloneDocumentInfoUnitTest { } // setup and close connections - @BeforeClass public static void setUpConnection() throws Exception { - System.out.println("setUpConnection()"); + @BeforeClass public static void setUpConnection() throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( "starting class: " + StandaloneDocumentInfo.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.setUp(); } @AfterClass public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection()"); + System.out.println( "------------------------------------------------------------" ); + System.out.println( "finishing class: " + StandaloneDocumentInfo.class.getName() ); + System.out.println( "------------------------------------------------------------" ); connection.tearDown(); } diff --git a/sfx2/qa/complex/framework/DocHelper/makefile.mk b/sfx2/qa/complex/sfx2/makefile.mk index ad614cfca3f8..c35f1380b6a4 100644 --- a/sfx2/qa/complex/framework/DocHelper/makefile.mk +++ b/sfx2/qa/complex/sfx2/makefile.mk @@ -25,25 +25,57 @@ # #************************************************************************* -PRJ = ../../../.. -TARGET = DocHelper -PRJNAME = $(TARGET) -PACKAGE = complex/framework/dochelper +.IF "$(OOO_JUNIT_JAR)" == "" +nothing .PHONY: + @echo ----------------------------------------------------- + @echo - JUnit not available, not building anything + @echo ----------------------------------------------------- +.ELSE # IF "$(OOO_JUNIT_JAR)" != "" + +PRJ = ../../.. +PRJNAME = sfx2 +TARGET = qa_complex +PACKAGE = complex/sfx2 # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk - #----- compile .java files ----------------------------------------- -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = \ - DialogThread.java \ - WriterHelper.java +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +JAVAFILES = $(shell @$(FIND) . -name "*.java") \ + +#----- create a jar from compiled files ---------------------------- -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) +JARTARGET = $(TARGET).jar + +#----- JUnit tests class ------------------------------------------- + +JAVATESTFILES = \ + DocumentInfo.java \ + DocumentProperties.java \ + StandaloneDocumentInfo.java \ + DocumentMetadataAccess.java \ + GlobalEventBroadcaster.java \ # --- Targets ------------------------------------------------------ -.INCLUDE : target.mk +.INCLUDE: target.mk + +ALL : ALLTAR + +# --- subsequent tests --------------------------------------------- + +.IF "$(OOO_SUBSEQUENT_TESTS)" != "" + +.INCLUDE: installationtest.mk + +ALLTAR : javatest + + # Sample how to debug + # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y + +.END # "$(OOO_SUBSEQUENT_TESTS)" == "" +.END # ELSE "$(OOO_JUNIT_JAR)" != "" diff --git a/sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoTest.java b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java index f5512bf9723b..d255f3d16822 100644 --- a/sfx2/qa/complex/standalonedocumentinfo/StandaloneDocumentInfoTest.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.standalonedocumentinfo; +package complex.sfx2.standalonedocinfo; public interface StandaloneDocumentInfoTest { boolean test(); diff --git a/sfx2/qa/complex/standalonedocumentinfo/Test01.java b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java index 2f9a6266b4e2..bf54bb4ca90b 100644 --- a/sfx2/qa/complex/standalonedocumentinfo/Test01.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java @@ -24,8 +24,10 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.standalonedocumentinfo; +package complex.sfx2.standalonedocinfo; +import complex.sfx2.standalonedocinfo.TestHelper; +import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.document.XStandaloneDocumentInfo; import com.sun.star.io.XTempFile; diff --git a/sfx2/qa/complex/standalonedocumentinfo/TestHelper.java b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java index f6d63e1b7793..a650ce9bb2e4 100644 --- a/sfx2/qa/complex/standalonedocumentinfo/TestHelper.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.standalonedocumentinfo; +package complex.sfx2.standalonedocinfo; public class TestHelper { diff --git a/sfx2/qa/complex/framework/testdocuments/CUSTOM.odt b/sfx2/qa/complex/sfx2/testdocuments/CUSTOM.odt Binary files differindex 831a8f451dfd..831a8f451dfd 100644 --- a/sfx2/qa/complex/framework/testdocuments/CUSTOM.odt +++ b/sfx2/qa/complex/sfx2/testdocuments/CUSTOM.odt diff --git a/sfx2/qa/complex/framework/testdocuments/TEST.odt b/sfx2/qa/complex/sfx2/testdocuments/TEST.odt Binary files differindex 7c6f0b60f7b0..7c6f0b60f7b0 100644 --- a/sfx2/qa/complex/framework/testdocuments/TEST.odt +++ b/sfx2/qa/complex/sfx2/testdocuments/TEST.odt diff --git a/sfx2/qa/complex/framework/testdocuments/TESTRDFA.odt b/sfx2/qa/complex/sfx2/testdocuments/TESTRDFA.odt Binary files differindex d59739142df6..d59739142df6 100644 --- a/sfx2/qa/complex/framework/testdocuments/TESTRDFA.odt +++ b/sfx2/qa/complex/sfx2/testdocuments/TESTRDFA.odt diff --git a/sfx2/qa/complex/framework/testdocuments/empty.rdf b/sfx2/qa/complex/sfx2/testdocuments/empty.rdf index af62bab39dfa..af62bab39dfa 100644 --- a/sfx2/qa/complex/framework/testdocuments/empty.rdf +++ b/sfx2/qa/complex/sfx2/testdocuments/empty.rdf diff --git a/sfx2/qa/complex/framework/DialogThread.java b/sfx2/qa/complex/sfx2/tools/DialogThread.java index 7151ccbb292d..e67e65f218db 100644 --- a/sfx2/qa/complex/framework/DialogThread.java +++ b/sfx2/qa/complex/sfx2/tools/DialogThread.java @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.framework.DocHelper; +package complex.sfx2.tools; import com.sun.star.beans.PropertyValue; import com.sun.star.frame.XController; @@ -37,9 +37,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.URL; import com.sun.star.util.XURLTransformer; -import java.lang.Thread; - - /** * This class opens a given dialog in a separate Thread by dispatching an url * @@ -55,21 +52,17 @@ public class DialogThread extends Thread { this.m_url = url; } + @Override public void run() { - XModel aModel = (XModel) UnoRuntime.queryInterface(XModel.class, - m_xDoc); + XModel aModel = UnoRuntime.queryInterface( XModel.class, m_xDoc ); XController xController = aModel.getCurrentController(); //Opening Dialog try { - XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface( - XDispatchProvider.class, - xController.getFrame()); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( - XURLTransformer.class, - m_xMSF.createInstance( - "com.sun.star.util.URLTransformer")); + XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, xController.getFrame() ); + XURLTransformer xParser = UnoRuntime.queryInterface( XURLTransformer.class, + m_xMSF.createInstance( "com.sun.star.util.URLTransformer" ) ); // Because it's an in/out parameter // we must use an array of URL objects. diff --git a/sfx2/qa/complex/framework/TestDocument.java b/sfx2/qa/complex/sfx2/tools/TestDocument.java index 8cc6ef7756b1..120dca978bba 100644 --- a/sfx2/qa/complex/framework/TestDocument.java +++ b/sfx2/qa/complex/sfx2/tools/TestDocument.java @@ -25,12 +25,12 @@ * ************************************************************************/ -package complex.framework; +package complex.sfx2.tools; import java.io.File; import org.openoffice.test.OfficeFileUrl; -final class TestDocument { +public final class TestDocument { public static String getUrl(String name) { return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); } diff --git a/sfx2/qa/complex/framework/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java index d3f19703bb9d..4767028572bb 100644 --- a/sfx2/qa/complex/framework/WriterHelper.java +++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex.framework.DocHelper; +package complex.sfx2.tools; import com.sun.star.accessibility.AccessibleRole; import com.sun.star.accessibility.XAccessible; @@ -40,7 +40,6 @@ import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XCloseable; -import complex.framework.DocHelper.DialogThread; import java.io.PrintWriter; import util.AccessibilityTools; @@ -104,13 +103,12 @@ public class WriterHelper { if (createButton.length() > 1) { XExtendedToolkit tk = getToolkit(); - AccessibilityTools at = new AccessibilityTools(); Object atw = tk.getActiveTopWindow(); XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - XAccessible xRoot = at.getAccessibleObject(xWindow); - XAccessibleContext buttonContext = at.getAccessibleObjectForRole( + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + XAccessibleContext buttonContext = AccessibilityTools.getAccessibleObjectForRole( xRoot, AccessibleRole.PUSH_BUTTON, createButton); @@ -154,28 +152,26 @@ public class WriterHelper { public XTextDocument DocByAutopilot(XMultiServiceFactory msf, int[] indexes, boolean destroyLocal, String bName) { - XTextDocument xLocalDoc = WriterTools.createTextDoc(m_xMSF); + XTextDocument xTextDoc = WriterTools.createTextDoc(m_xMSF); Object toolkit = null; try { toolkit = msf.createInstance("com.sun.star.awt.Toolkit"); } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); + e.printStackTrace( System.err ); } XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, toolkit); shortWait(); - AccessibilityTools at = new AccessibilityTools(); - Object atw = tk.getActiveTopWindow(); XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - XAccessible xRoot = at.getAccessibleObject(xWindow); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - XAccessibleContext ARoot = at.getAccessibleObjectForRole(xRoot, + XAccessibleContext ARoot = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.MENU_BAR); XAccessibleSelection sel = UnoRuntime.queryInterface(XAccessibleSelection.class, ARoot); @@ -196,11 +192,11 @@ public class WriterHelper { xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - xRoot = at.getAccessibleObject(xWindow); + xRoot = AccessibilityTools.getAccessibleObject(xWindow); //at.printAccessibleTree(new PrintWriter(System.out),xRoot); - XAccessibleAction action = UnoRuntime.queryInterface(XAccessibleAction.class, at.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, bName)); + XAccessibleAction action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, bName)); try { action.doAccessibleAction(0); @@ -213,11 +209,11 @@ public class WriterHelper { xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - xRoot = at.getAccessibleObject(xWindow); + xRoot = AccessibilityTools.getAccessibleObject(xWindow); - at.printAccessibleTree(new PrintWriter(System.out),xRoot); + AccessibilityTools.printAccessibleTree(new PrintWriter(System.out),xRoot); - action = UnoRuntime.queryInterface(XAccessibleAction.class, at.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, "Yes")); + action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, "Yes")); try { if (action != null) action.doAccessibleAction(0); @@ -231,7 +227,7 @@ public class WriterHelper { XTextDocument returnDoc = UnoRuntime.queryInterface(XTextDocument.class, xDesktop.getCurrentComponent()); if (destroyLocal) { - closeDoc(xLocalDoc); + closeDoc(xTextDoc); } return returnDoc; @@ -259,7 +255,7 @@ public class WriterHelper { toolkit = m_xMSF.createInstance("com.sun.star.awt.Toolkit"); } catch (com.sun.star.uno.Exception e) { System.out.println("Couldn't get toolkit"); - e.printStackTrace(); + e.printStackTrace( System.err ); } XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, toolkit); @@ -277,7 +273,7 @@ public class WriterHelper { desk = m_xMSF.createInstance("com.sun.star.frame.Desktop"); } catch (com.sun.star.uno.Exception e) { System.out.println("Couldn't get desktop"); - e.printStackTrace(); + e.printStackTrace( System.err ); } XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, desk); diff --git a/sfx2/qa/complex/standalonedocumentinfo/makefile.mk b/sfx2/qa/complex/standalonedocumentinfo/makefile.mk deleted file mode 100644 index aade48dbd789..000000000000 --- a/sfx2/qa/complex/standalonedocumentinfo/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = sfx2 -TARGET = qa_complex_standalonedocumentinfo - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/standalonedocumentinfo -JAVATESTFILES = \ - StandaloneDocumentInfoUnitTest.java - -JAVAFILES = $(JAVATESTFILES) \ - StandaloneDocumentInfoTest.java \ - Test01.java \ - TestHelper.java - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END diff --git a/sfx2/qa/complex/tests.sce b/sfx2/qa/complex/tests.sce deleted file mode 100644 index c38852927ede..000000000000 --- a/sfx2/qa/complex/tests.sce +++ /dev/null @@ -1,3 +0,0 @@ --o complex.framework.DocumentMetaData --o complex.framework.DocumentMetadataAccessTest -#-o complex.framework.CheckGlobalEventBroadcaster_writer1 |