summaryrefslogtreecommitdiff
path: root/ucb/qa/complex
diff options
context:
space:
mode:
Diffstat (limited to 'ucb/qa/complex')
-rwxr-xr-xucb/qa/complex/tdoc/CheckContentProvider.java398
-rwxr-xr-xucb/qa/complex/tdoc/CheckTransientDocumentsContent.java145
-rwxr-xr-xucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java143
-rwxr-xr-xucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java179
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XChild.java104
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java64
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java286
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XComponent.java171
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XContent.java86
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java67
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java102
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java67
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XServiceInfo.java99
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/_XTypeProvider.java95
-rwxr-xr-xucb/qa/complex/tdoc/interfaces/makefile.mk63
-rwxr-xr-xucb/qa/complex/tdoc/makefile.mk86
-rw-r--r--ucb/qa/complex/test_documents/Iterator.sxwbin0 -> 5627 bytes
-rw-r--r--ucb/qa/complex/test_documents/chinese.sxwbin0 -> 5757 bytes
-rw-r--r--ucb/qa/complex/test_documents/filter.sxwbin0 -> 14359 bytes
-rwxr-xr-xucb/qa/complex/ucb/UCB.java232
-rwxr-xr-xucb/qa/complex/ucb/makefile.mk78
21 files changed, 2465 insertions, 0 deletions
diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java
new file mode 100755
index 000000000000..a20a96829e0b
--- /dev/null
+++ b/ucb/qa/complex/tdoc/CheckContentProvider.java
@@ -0,0 +1,398 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc;
+
+import com.sun.star.beans.XPropertiesChangeNotifier;
+import com.sun.star.beans.XPropertyContainer;
+import com.sun.star.beans.XPropertySetInfoChangeNotifier;
+import com.sun.star.container.XChild;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.ucb.XCommandInfoChangeNotifier;
+import com.sun.star.ucb.XCommandProcessor;
+import com.sun.star.ucb.XContent;
+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;
+import complex.tdoc.interfaces._XServiceInfo;
+import complex.tdoc.interfaces._XTypeProvider;
+import complex.tdoc.interfaces._XCommandProcessor;
+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;
+
+/**
+ * Check the TransientDocumentsContentProvider (TDOC). Three documents are
+ * loaded. Then every possible TDCP content type is instantiated and its
+ * interfaces are tested.<br>
+ * Important: opened documents are numbered in the order they are opened and
+ * numbers are not reused. This test will work only, if you start a new office
+ * with an accept parameter (writer is initially opened). Otherwise loaded
+ * documents are not found.
+ */
+public class CheckContentProvider extends ComplexTestCase {
+ private final String testDocuments[] = new String[]{"filter.sxw", "chinese.sxw", "Iterator.sxw"};
+ private final int countDocs = testDocuments.length;
+ private XMultiServiceFactory xMSF = null;
+ private XTextDocument[] xTextDoc = null;
+ private XContent xContent = null;
+
+ /**
+ * The test methods: the test methods have to be executed in a specified
+ * order. This order is:
+ * <ol>
+ * <li>"checkTDOCRoot"</li>
+ * <li>"checkTDOCRootInterfaces"</li>
+ * <li>"checkTDOCDocument"</li>
+ * <li>"checkTDOCDocumentInterfaces"</li>
+ * <li>"checkTDOCFolder"</li>
+ * <li>"checkTDOCFolderInterfaces"</li>
+ * <li>"checkTDOCStream"</li>
+ * <li>"checkTDOCStreamInterfaces"</li>
+ * </ol>
+ * 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",
+ };
+ }
+
+ /**
+ * Open some documents before the test
+ */
+ public void before() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ xTextDoc = new XTextDocument[countDocs];
+ log.println("Open some new documents.");
+ for (int i=0; i<countDocs; i++) {
+ String fileName = utils.getFullTestURL(testDocuments[i]);
+ System.out.println("Doc " + i + ": " + fileName);
+ xTextDoc[i] = WriterTools.loadTextDoc(xMSF, fileName);
+ }
+ }
+
+ /**
+ * Close the documents
+ */
+ public void after() {
+ log.println("Close all documents.");
+ for (int i=0; i<countDocs; i++) {
+ xTextDoc[i].dispose();
+ }
+ }
+
+ /**
+ * Check the tdcp root.
+ */
+ public void checkTDOCRoot() {
+ try {
+ // create a content provider
+ Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
+
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/");
+ // get content
+ xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ String content = xContent.getContentType();
+ log.println("#### Content root: " + content);
+
+ // try to get some documents: should be "countDocs" at least.
+ XContentIdentifier[] xContentId = new XContentIdentifier[countDocs+5];
+ XContent[] xCont = new XContent[countDocs+5];
+
+ for (int i=0; i<countDocs+5; i++) {
+ xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i);
+ // get content
+ xCont[i] = xContentProvider.queryContent(xContentId[i]);
+ int returnVal = xContentProvider.compareContentIds(xContentId[i], xContentIdentifier);
+ String cont = null;
+ if (xCont[i] != null)
+ cont = xCont[i].getContentType();
+ log.println("Document Content " + i + ": " + cont + " compare with root: " + returnVal);
+
+ xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i + "/content.xml");
+ // get content
+ xCont[i] = xContentProvider.queryContent(xContentId[i]);
+ cont = null;
+ if (xCont[i] != null)
+ cont = xCont[i].getContentType();
+ log.println("\tContent.xml Content " + i + ": " + cont);
+ }
+
+ util.dbg.printInterfaces(xContent);
+ }
+ catch(Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Unexpected Exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Check the interfaces of the root.
+ */
+ public void checkTDOCRootInterfaces() {
+ checkInterfaces(false);
+ }
+
+ /**
+ * Check the tdcp document: document 3 is used.
+ */
+ public void checkTDOCDocument() {
+ try {
+ xContent = null;
+ Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/3");
+ // get content
+ xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ String content = xContent.getContentType();
+ log.println("#### Document root: " + content);
+ }
+ catch(Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Unexpected Exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Check the interfaces on the document.
+ */
+ public void checkTDOCDocumentInterfaces() {
+ checkInterfaces(true);
+ }
+
+ /**
+ * Check a folder on document 2 (document 2 contains an embedded picture and
+ * therefore contans a subfolder "Pictures"
+ */
+ public void checkTDOCFolder() {
+ try {
+ xContent = null;
+ Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/2/Pictures");
+ // get content
+ xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ String content = xContent.getContentType();
+ log.println("#### Folder type: " + content);
+ }
+ catch(Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Unexpected Exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Check the interfaces on the folder.
+ */
+ public void checkTDOCFolderInterfaces() {
+ checkInterfaces(true);
+ }
+
+ /**
+ * Open a stream to the embedded picture of document 1.
+ */
+ public void checkTDOCStream() {
+ try {
+ xContent = null;
+ Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
+
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/1/Pictures/10000000000000640000004B9C743800.gif");
+ // get content
+ xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ String content = xContent.getContentType();
+ log.println("#### Folder type: " + content);
+ }
+ catch(Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Unexpected Exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Check the interfaces on the stream.
+ */
+ public void checkTDOCStreamInterfaces() {
+ checkInterfaces(true);
+ }
+
+ /**
+ * Since all tdcp content types implement (nearly) the same interfaces, they
+ * are called here.
+ * Executed interface tests are (in this order):
+ * <ol>
+ * <li>XTypeProvider</li>
+ * <li>XServiceInfo</li>
+ * <li>XCommandProcessor</li>
+ * <li>XChild</li>
+ * <li>XPropertiesChangeNotifier</li>
+ * <li>XPropertySetInfoChangeNotifier</li>
+ * <li>XCommandInfoChangeNotifier</li>
+ * <li>XContent</li>
+ * <li>XPropertyContainer</li>
+ * <li>XComponent</li>
+ * </ol>
+ * @param hasParent True, if the tested content type does have a parent:
+ * only the root has not. Used in the XChild interface test.
+ */
+ private void checkInterfaces(boolean hasParent) {
+ // check the XTypeProvider interface
+ _XTypeProvider xTypeProvider = new _XTypeProvider();
+ xTypeProvider.oObj = (XTypeProvider)UnoRuntime.queryInterface(XTypeProvider.class, xContent);
+ xTypeProvider.log = log;
+ assure("getImplementationId()", xTypeProvider._getImplementationId());
+ assure("getTypes()", xTypeProvider._getTypes());
+
+ // check the XSewrviceInfo interface
+ _XServiceInfo xServiceInfo = new _XServiceInfo();
+ xServiceInfo.oObj = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, xContent);
+ xServiceInfo.log = log;
+ assure("getImplementationName()", xServiceInfo._getImplementationName());
+ assure("getSupportedServiceNames()", xServiceInfo._getSupportedServiceNames());
+ assure("supportsService()", xServiceInfo._supportsService());
+
+ // check the XCommandProcessor interface
+ _XCommandProcessor xCommandProcessor = new _XCommandProcessor();
+ xCommandProcessor.oObj = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+ xCommandProcessor.log = log;
+ xCommandProcessor.before((XMultiServiceFactory)param.getMSF());
+ assure("createCommandIdentifier()", xCommandProcessor._createCommandIdentifier());
+ assure("execute()", xCommandProcessor._execute());
+ assure("abort()", xCommandProcessor._abort());
+
+ // check the XChild interface
+ _XChild xChild = new _XChild();
+ xChild.oObj = (XChild)UnoRuntime.queryInterface(XChild.class, xContent);
+ xChild.log = log;
+ // hasParent dermines, if this content has a parent
+ assure("getParent()", xChild._getParent(hasParent));
+ // parameter does dermine, if this funczion is supported: generally not supported with tdcp content
+ assure("setParent()", xChild._setParent(false));
+
+ // check the XPropertyChangeNotifier interface
+ _XPropertiesChangeNotifier xPropChange = new _XPropertiesChangeNotifier();
+ xPropChange.oObj = (XPropertiesChangeNotifier)UnoRuntime.queryInterface(XPropertiesChangeNotifier.class, xContent);
+ xPropChange.log = log;
+ assure("addPropertiesChangeListener()", xPropChange._addPropertiesChangeListener());
+ assure("removePropertiesChangeListener()", xPropChange._removePropertiesChangeListener());
+
+ // check the XPropertySetInfoChangeNotifier interface
+ _XPropertySetInfoChangeNotifier xPropSetInfo = new _XPropertySetInfoChangeNotifier();
+ xPropSetInfo.oObj = (XPropertySetInfoChangeNotifier)UnoRuntime.queryInterface(XPropertySetInfoChangeNotifier.class, xContent);
+ xPropSetInfo.log = log;
+ assure("addPropertiesChangeListener()", xPropSetInfo._addPropertiesChangeListener());
+ assure("removePropertiesChangeListener()", xPropSetInfo._removePropertiesChangeListener());
+
+ // check the XCommandInfoChangeNotifier interface
+ _XCommandInfoChangeNotifier xCommandChange = new _XCommandInfoChangeNotifier();
+ xCommandChange.oObj = (XCommandInfoChangeNotifier)UnoRuntime.queryInterface(XCommandInfoChangeNotifier.class, xContent);
+ xCommandChange.log = log;
+ assure("addCommandInfoChangeListener()", xCommandChange._addCommandInfoChangeListener());
+ assure("removeCommandInfoChangeListener()", xCommandChange._removeCommandInfoChangeListener());
+
+ // check the XContent interface
+ _XContent xCont = new _XContent();
+ xCont.oObj = (XContent)UnoRuntime.queryInterface(XContent.class, xContent);
+ xCont.log = log;
+ assure("addContentEventListener()", xCont._addContentEventListener());
+ assure("getContentType()", xCont._getContentType());
+ assure("getIdentifier()", xCont._getIdentifier());
+ assure("removeContentEventListener()", xCont._removeContentEventListener());
+
+ // check the XPropertyContainer interface
+ _XPropertyContainer xPropCont = new _XPropertyContainer();
+ xPropCont.oObj = (XPropertyContainer)UnoRuntime.queryInterface(XPropertyContainer.class, xContent);
+ xPropCont.log = log;
+ assure("addProperty()", xPropCont._addProperty());
+ assure("removeProperty()", xPropCont._removeProperty());
+
+ // check the XComponent interface
+ _XComponent xComponent = new _XComponent();
+ xComponent.oObj = (XComponent)UnoRuntime.queryInterface(XComponent.class, xContent);
+ xComponent.log = log;
+ assure("addEventListener()", xComponent._addEventListener());
+ assure("removeEventListener()", xComponent._removeEventListener());
+// assure("dispose()", xComponent._dispose());
+ }
+}
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java
new file mode 100755
index 000000000000..b492fd219119
--- /dev/null
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.ucb.Command;
+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;
+
+/**
+ *
+ */
+public class CheckTransientDocumentsContent extends ComplexTestCase{
+ private final String testDocuments[] = new String[]{"sForm.sxw"};//, "chinese.sxw", "Iterator.sxw"};
+ private final int countDocs = testDocuments.length;
+ private XMultiServiceFactory xMSF = null;
+ private XTextDocument[] xTextDoc = null;
+
+ public String[] getTestMethodNames() {
+ return new String[] {"checkTransientDocumentsContent"};
+ }
+
+ public void before() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ xTextDoc = new XTextDocument[countDocs];
+ log.println("Open some documents.");
+ for (int i=0; i<countDocs; i++) {
+ String fileName = utils.getFullTestURL(testDocuments[i]);
+ xTextDoc[i] = WriterTools.loadTextDoc(xMSF, fileName);
+ }
+ }
+ public void after() {
+ log.println("Close all documents.");
+ for (int i=0; i<countDocs; i++) {
+ xTextDoc[i].dispose();
+ }
+ }
+
+ /**
+ * Check the content of one document
+ */
+ public void checkTransientDocumentsContent() {
+ try {
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, xContentIdentifierFactory);
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/1");
+ // get content
+ XContent xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ // actual test: commands to get some properties
+ XCommandProcessor xCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+ // build up the command
+ Command command = new Command();
+ command.Name = "getPropertySetInfo";
+ command.Handle = -1;
+
+ // execute the command
+ Object result = xCommandProcessor.execute(command, 0, null);
+
+ // check the result
+ log.println("Result: "+ result.getClass().toString());
+ XPropertySetInfo xPropertySetInfo = (XPropertySetInfo)UnoRuntime.queryInterface(XPropertySetInfo.class, result);
+ Property[] props = xPropertySetInfo.getProperties();
+ boolean res = false;
+ for(int i=0; i<props.length; i++) {
+ String propName = props[i].Name;
+ res |= propName.equals("DocumentModel");
+ log.println("Found property: " + propName + " type: " + props[i].Type.getTypeName());
+ }
+ assure("Did not find property 'DocumentModel' in the Property array.", res);
+
+ // get on property
+ command.Name = "getPropertyValues";
+ command.Handle = -1;
+ Property[] prop = new Property[1];
+ prop[0] = new Property();
+ prop[0].Name = "DocumentModel";
+ prop[0].Handle = -1;
+ command.Argument = prop;
+
+ // execute the command
+ result = xCommandProcessor.execute(command, 0, null);
+
+ // check the result
+ log.println("Result: "+ result.getClass().toString());
+
+ XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, result);
+ assure("Did not get property 'DocumentModel'.", xModel == null);
+ }
+ catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Could not create test objects.");
+ }
+
+ }
+
+}
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java
new file mode 100755
index 000000000000..ddac0cbb2d47
--- /dev/null
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.ucb.Command;
+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;
+
+/**
+ *
+ */
+public class CheckTransientDocumentsContentProvider extends ComplexTestCase {
+ private final String testDocuments[] = new String[]{"sForm.sxw", "chinese.sxw", "Iterator.sxw"};
+ private final int countDocs = testDocuments.length;
+ private XMultiServiceFactory xMSF = null;
+ private XTextDocument[] xTextDoc = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkTransientDocumentsContentProvider"};
+ }
+
+ public void before() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ xTextDoc = new XTextDocument[countDocs];
+ log.println("Open some documents.");
+ for (int i=0; i<countDocs; i++) {
+ String fileName = utils.getFullTestURL(testDocuments[i]);
+ xTextDoc[i] = WriterTools.loadTextDoc(xMSF, fileName);
+ }
+ }
+ public void after() {
+ log.println("Close all documents.");
+ for (int i=0; i<countDocs; i++) {
+ xTextDoc[i].dispose();
+ }
+ }
+
+ /**
+ * Check the provider of document content: open some documents
+ * and look if they are accessible.
+ */
+ public void checkTransientDocumentsContentProvider() {
+ try {
+ // create a content provider
+ Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider");
+ XContentProvider xContentProvider =
+ (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, o);
+
+ // create the ucb
+ XContentIdentifierFactory xContentIdentifierFactory =
+ (XContentIdentifierFactory)UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, xMSF.createInstance(
+ "com.sun.star.ucb.UniversalContentBroker"));
+ // create a content identifier from the ucb for tdoc
+ XContentIdentifier xContentIdentifier =
+ xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/");
+ // get content
+ XContent xContent = xContentProvider.queryContent(xContentIdentifier);
+
+ // actual test: execute an "open" command with the content
+ XCommandProcessor xCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+ // build up the command
+ Command command = new Command();
+ OpenCommandArgument2 commandarg2 = new OpenCommandArgument2();
+ commandarg2.Mode = OpenMode.ALL;
+ command.Name = "open";
+ command.Argument = commandarg2;
+
+ // execute the command
+ Object result = xCommandProcessor.execute(command, 0, null);
+
+ // check the result
+ log.println("Result: "+ result.getClass().toString());
+ XDynamicResultSet xDynamicResultSet = (XDynamicResultSet)UnoRuntime.queryInterface(XDynamicResultSet.class, result);
+
+ // check bug of wrong returned service name.
+ XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, xDynamicResultSet);
+ String[] sNames = xServiceInfo.getSupportedServiceNames();
+ String serviceName = sNames[0];
+ if (sNames.length > 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);
+
+ XResultSet xResultSet = xDynamicResultSet.getStaticResultSet();
+ XContentAccess 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);
+ }
+ // some feeble test: if the amount >2, we're ok.
+ // 2do: check better
+ assure("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.");
+ }
+
+ }
+}
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
new file mode 100755
index 000000000000..229f5d388697
--- /dev/null
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.document.XDocumentSubStorageSupplier;
+import com.sun.star.embed.ElementModes;
+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;
+
+
+/**
+ *
+ */
+public class CheckTransientDocumentsDocumentContent extends ComplexTestCase {
+ 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 void before() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ log.println("Open a document.");
+ String fileName = utils.getFullTestURL(testDocuments);
+ xTextDoc = WriterTools.loadTextDoc(xMSF, fileName);
+ }
+ public void after() {
+ log.println("Close all documents.");
+ xTextDoc.dispose();
+ }
+
+ /**
+ * Check the provider of document content: open some documents
+ * and look if they are accessible.
+ */
+ 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);
+ // 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);
+ String[]names = xDocumentSubStorageSupplier.getDocumentSubStoragesNames();
+ for (int i=0; i<names.length; i++) {
+ log.println("SubStorage names " + i + ": " +names[i]);
+ }
+ XStorage xStorage = xDocumentSubStorageSupplier.getDocumentSubStorage(names[0], ElementModes.READWRITE);
+ assure("Could not get a storage from the XDocumentStorageSupplier.", xStorage != null);
+ // get content
+ XContent xContent = xTransientDocumentsDocumentContentFactory.createDocumentContent(xModel);
+ // actual test: execute some commands
+ XCommandProcessor xCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+
+ // create the command and arguments
+ Command command = new Command();
+ OpenCommandArgument2 cmargs2 = new OpenCommandArgument2();
+ Property[]props = new Property[1];
+ props[0] = new Property();
+ props[0].Name = "Title";
+ props[0].Handle = -1;
+ cmargs2.Mode = OpenMode.ALL;
+ cmargs2.Properties = props;
+
+ command.Name = "open";
+ command.Argument = cmargs2;
+
+ Object result = xCommandProcessor.execute(command, 0, null);
+ XDynamicResultSet xDynamicResultSet = (XDynamicResultSet)UnoRuntime.queryInterface(XDynamicResultSet.class, result);
+ XResultSet xResultSet = xDynamicResultSet.getStaticResultSet();
+ XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet);
+ // create the new folder 'folderName': first, check if it's already there
+ while(xResultSet.next()) {
+ String existingFolderName = xRow.getString(1);
+ log.println("Found existing folder: '" + existingFolderName + "'");
+ if (folderName.equals(existingFolderName)) {
+ failed("Cannot create a new folder: folder already exists: adapt test or choose a different document.");
+ }
+ }
+ // create a folder
+ log.println("Create new folder "+ folderName);
+ ContentInfo contentInfo = new ContentInfo();
+ contentInfo.Type = "application/vnd.sun.star.tdoc-folder";
+
+ command.Name = "createNewContent";
+ command.Argument = contentInfo;
+
+ result = xCommandProcessor.execute(command, 0, null);
+ XContent xNewFolder = (XContent)UnoRuntime.queryInterface(XContent.class, result);
+
+ XCommandProcessor xFolderCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xNewFolder);
+ log.println("Got the new folder: " + utils.getImplName(xNewFolder));
+
+ // name the new folder
+ PropertyValue[] titleProp = new PropertyValue[1];
+ titleProp[0] = new PropertyValue();
+ titleProp[0].Name = "Title";
+ titleProp[0].Handle = -1;
+ titleProp[0].Value = folderName;
+ Command titleSetCommand = new Command();
+ titleSetCommand.Name = "setPropertyValues";
+ titleSetCommand.Argument = titleProp;
+ xFolderCommandProcessor.execute(titleSetCommand, 0, null);
+
+ // 2do: check all this stuff!
+ // commit changes
+/* InsertCommandArgument insertArgs = new InsertCommandArgument();
+ insertArgs.Data = null;
+ insertArgs.ReplaceExisting = true;
+ Command commitCommand = new Command();
+ commitCommand.Name = "insert";
+ commitCommand.Argument = insertArgs;
+ xFolderCommandProcessor.execute(commitCommand, 0, null); */
+ }
+ catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ failed("Could not create test objects.");
+ }
+
+ }
+
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XChild.java b/ucb/qa/complex/tdoc/interfaces/_XChild.java
new file mode 100755
index 000000000000..351fc6f84aa1
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XChild.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import lib.MultiMethodTest;
+import lib.Status;
+
+import com.sun.star.container.XChild;
+import com.sun.star.container.XNamed;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/*
+* Testing <code>com.sun.star.container.XChild</code>
+* interface methods :
+* <ul>
+* <li><code> getParent()</code></li>
+* <li><code> setParent()</code></li>
+* </ul>
+* @see com.sun.star.container.XChild
+*/
+public class _XChild {
+
+ public XChild oObj = null;
+ public Object gotten = null;
+ public LogWriter log = null;
+
+
+ /**
+ * Test calls the method and checks return value and that
+ * no exceptions were thrown. Parent returned is stored.<p>
+ * Has <b> OK </b> status if the method returns not null value
+ * and no exceptions were thrown. <p>
+ */
+ public boolean _getParent(boolean hasParent) {
+ gotten = oObj.getParent();
+ if (!hasParent)
+ return gotten == null;
+ XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class,gotten);
+ if (the_name != null)
+ log.println("Parent:"+the_name.getName());
+ return gotten != null;
+ }
+
+ /**
+ * Sets existing parent and checks that
+ * no exceptions were thrown. <p>
+ * Has <b> OK </b> status if no exceptions were thrown. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getParent() </code> : to get the parent. </li>
+ * </ul>
+ */
+ public boolean _setParent(boolean supported) {
+// requiredMethod("getParent()") ;
+
+ String parentComment = null;//String) tEnv.getObjRelation("cannotSwitchParent");
+
+ if (parentComment != null) {
+ log.println(parentComment);
+ return true;
+ }
+
+ try {
+ oObj.setParent(gotten);
+ }
+ catch (com.sun.star.lang.NoSupportException ex) {
+ log.println("Exception occured during setParent() - " + (supported?"FAILED":"OK"));
+ if (supported) {
+ ex.printStackTrace((java.io.PrintWriter)log);
+ return false;
+ }
+ }
+ return true;
+ }
+
+} // finish class _XChild
+
+
diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java
new file mode 100755
index 000000000000..9800c5c0a398
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.ucb.XCommandInfoChangeListener;
+import com.sun.star.ucb.XCommandInfoChangeNotifier;
+import share.LogWriter;
+
+/**
+ *
+ */
+public class _XCommandInfoChangeNotifier {
+ public XCommandInfoChangeNotifier oObj = null;
+ public LogWriter log = null;
+ private CommandInfoChangeListener listener = new CommandInfoChangeListener();
+
+ public boolean _addCommandInfoChangeListener() {
+ oObj.addCommandInfoChangeListener(listener);
+ return true;
+ }
+
+ public boolean _removeCommandInfoChangeListener() {
+ oObj.removeCommandInfoChangeListener(listener);
+ return true;
+ }
+
+ private class CommandInfoChangeListener implements XCommandInfoChangeListener {
+ boolean disposing = false;
+ boolean infoChanged = false;
+
+ public void commandInfoChange(com.sun.star.ucb.CommandInfoChangeEvent commandInfoChangeEvent) {
+ infoChanged = true;
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposing = true;
+ }
+
+ }
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java b/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java
new file mode 100755
index 000000000000..2fc31a4bd586
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java
@@ -0,0 +1,286 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.XPropertySetInfo;
+import lib.MultiMethodTest;
+import lib.StatusException;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.Command;
+import com.sun.star.ucb.CommandAbortedException;
+import com.sun.star.ucb.CommandInfo;
+import com.sun.star.ucb.GlobalTransferCommandArgument;
+import com.sun.star.ucb.NameClash;
+import com.sun.star.ucb.TransferCommandOperation;
+import com.sun.star.ucb.UnsupportedCommandException;
+import com.sun.star.ucb.XCommandInfo;
+import com.sun.star.ucb.XCommandProcessor;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+* Tests <code>XCommandProcessor</code>. The TestCase can pass (but doesn't have
+* to) "XCommandProcessor.AbortCommand" relation, to specify command to abort in
+* <code>abort()</code> test.
+*
+* Testing <code>com.sun.star.ucb.XCommandProcessor</code>
+* interface methods :
+* <ul>
+* <li><code> createCommandIdentifier()</code></li>
+* <li><code> execute()</code></li>
+* <li><code> abort()</code></li>
+* </ul> <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'XCommandProcessor.AbortCommand'</code> <b>optional</b>
+* (of type <code>com.sun.star.ucb.Command</code>):
+* specify command to abort in <code>abort()</code> test.
+* If the relation is not specified the 'GlobalTransfer'
+* command is used.</li>
+* <ul> <p>
+* The following predefined files needed to complete the test:
+* <ul>
+* <li> <code>poliball.gif</code> : this file is required in case
+* if the relation <code>'XCommandProcessor.AbortCommand'</code>
+* is not specified. This file is used by 'GlobalTransfer'
+* command as a source file for copying.</li>
+* <ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.ucb.XCommandProcessor
+*/
+public class _XCommandProcessor {
+
+ /**
+ * Conatins the tested object.
+ */
+ public XCommandProcessor oObj;
+ public LogWriter log = null;
+ private XMultiServiceFactory xMSF = null;
+
+ /**
+ * Contains the command id returned by <code>createCommandIdentifier()
+ * </code>. It is used in <code>abort()</code> test.
+ */
+ int cmdId;
+
+ public void before(XMultiServiceFactory _xMSF) {
+ xMSF = _xMSF;
+ }
+
+ /**
+ * Tests <code>createCommandIdentifier()</code>. Calls it for two times
+ * and checks returned values. <p>
+ * Has <b>OK</b> status if values are unique correct idenifiers: not 0.
+ */
+ public boolean _createCommandIdentifier() {
+ log.println("creating a command line identifier");
+
+ int testCmdId = oObj.createCommandIdentifier();
+ cmdId = oObj.createCommandIdentifier();
+
+ if (cmdId == 0 || testCmdId == 0) {
+ log.println("createCommandLineIdentifier() returned 0 - FAILED");
+ }
+
+ if (cmdId == testCmdId) {
+ log.println("the command identifier is not unique");
+ }
+
+ return testCmdId != 0 && cmdId != 0 && cmdId != testCmdId;
+ }
+
+ /**
+ * First executes 'geCommandInfo' command and examines returned
+ * command info information. Second tries to execute inproper
+ * command. <p>
+ * Has <b> OK </b> status if in the first case returned information
+ * contains info about 'getCommandInfo' command and in the second
+ * case an exception is thrown. <p>
+ */
+ public boolean _execute() {
+ String[]commands = new String[] {"getCommandInfo", "getPropertySetInfo"};
+ boolean returnVal = true;
+ for (int j=0; j<commands.length; j++) {
+ String commandName = commands[j];
+ Command command = new Command(commandName, -1, null);
+
+ Object result;
+
+ log.println("executing command " + commandName);
+ try {
+ result = oObj.execute(command, 0, null);
+ } catch (CommandAbortedException e) {
+ log.println("The command aborted " + e.getMessage());
+ e.printStackTrace((java.io.PrintWriter)log);
+ throw new StatusException("Unexpected exception", e);
+ } catch (Exception e) {
+ log.println("Unexpected exception " + e.getMessage());
+ e.printStackTrace((java.io.PrintWriter)log);
+ throw new StatusException("Unexpected exception", e);
+ }
+
+ boolean found = false;
+
+ XCommandInfo xCmdInfo = (XCommandInfo)UnoRuntime.queryInterface(
+ XCommandInfo.class, result);
+ if (xCmdInfo != null) {
+ CommandInfo[] cmdInfo = xCmdInfo.getCommands();
+ for (int i = 0; i < cmdInfo.length; i++) {
+ log.println("\t##### " + cmdInfo[i].Name + " - " + cmdInfo[i].Handle + " - " + cmdInfo[i].ArgType.getTypeName());
+ if (cmdInfo[i].Name.equals(commandName)) {
+ found = true;
+// break;
+ }
+ }
+ }
+
+ XPropertySetInfo xPropInfo = (XPropertySetInfo)UnoRuntime.queryInterface(
+ XPropertySetInfo.class, result);
+ if (xPropInfo != null) {
+ Property[] props = xPropInfo.getProperties();
+ String[] defProps = new String[] {"ContentType", "IsDocument", "IsFolder", "Title"};
+ int propCount = defProps.length;
+ for (int i = 0; i < props.length; i++) {
+ for (int k=0; k<defProps.length; k++) {
+ if (props[i].Name.equals(defProps[k])) {
+ propCount--;
+ log.println("Property '" + defProps[k] + "' has been found.");
+ }
+ }
+ }
+ found = propCount == 0;
+ }
+
+ returnVal &= found;
+
+ if (!found) {
+ log.println("Command '" + commandName + "' was not executed correctly.");
+ }
+ }
+/* log.println("testing execute with wrong command");
+
+ Command badCommand = new Command("bad command", -1, null);
+
+ try {
+ oObj.execute(badCommand, 0, null);
+ } catch (CommandAbortedException e) {
+ log.println("CommandAbortedException thrown - OK");
+ } catch (UnsupportedCommandException e) {
+ log.println("UnsupportedCommandException thrown - OK");
+ } catch (Exception e) {
+ log.println("Wrong exception thrown " + e.getMessage());
+ e.printStackTrace((java.io.PrintWriter)log);
+ throw new StatusException("Unexpected exception", e);
+ }
+*/
+ return returnVal;
+ }
+
+ /**
+ * First a separate thread where <code>abort</code> method
+ * is called permanently. Then a "long" command (for example,
+ * "transfer") is started. I case if relation is not
+ * specified 'GlobalTransfer' command starts to
+ * copy a file to temporary directory (if the relation is present
+ * then the its command starts to work). <p>
+ * Has <b> OK </b> status if the command execution is aborted, i.e.
+ * <code>CommandAbortedException</code> is thrown. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> createCommandIdentifier() </code> : to have a unique
+ * identifier which is used to abourt started command. </li>
+ * </ul>
+ */
+ public boolean _abort() {
+ //executeMethod("createCommandIdentifier()");
+
+// Command command = null;//(Command)tEnv.getObjRelation(
+ //"XCommandProcessor.AbortCommand");
+ Command command = new Command("getCommandInfo", -1, null);
+
+ if (command == null) {
+ String commandName = "globalTransfer";
+
+ String srcURL = util.utils.getFullTestURL("solibrary.jar") ;
+ String tmpURL = util.utils.getOfficeTemp(xMSF) ;
+ log.println("Copying '" + srcURL + "' to '" + tmpURL) ;
+
+ GlobalTransferCommandArgument arg = new
+ GlobalTransferCommandArgument(
+ TransferCommandOperation.COPY, srcURL,
+ tmpURL, "", NameClash.OVERWRITE);
+
+ command = new Command(commandName, -1, arg);
+ }
+
+ Thread aborter = new Thread() {
+ public void run() {
+ for (int i = 0; i < 10; i++) {
+ log.println("try to abort command");
+ oObj.abort(cmdId);
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ };
+
+ aborter.start();
+
+ try {
+ Thread.sleep(15);
+ } catch (InterruptedException e) {
+ }
+
+ log.println("executing command");
+ try {
+ oObj.execute(command, cmdId, null);
+ log.println("Command execution completed");
+ log.println("CommandAbortedException is not thrown");
+ log.println("This is OK since there is no command implemented "+
+ "that can be aborted");
+ } catch (CommandAbortedException e) {
+ return true;
+ } catch (Exception e) {
+ log.println("Unexpected exception " + e.getMessage());
+ e.printStackTrace((java.io.PrintWriter)log);
+ return false;
+ }
+
+ try {
+ aborter.join(5000);
+ aborter.interrupt();
+ } catch(java.lang.InterruptedException e) {
+ }
+ return true;
+ }
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XComponent.java b/ucb/qa/complex/tdoc/interfaces/_XComponent.java
new file mode 100755
index 000000000000..1716e51d1358
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XComponent.java
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.container.XNameContainer;
+import lib.MultiMethodTest;
+
+import com.sun.star.frame.XDesktop;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import share.LogWriter;
+
+/**
+* Testing <code>com.sun.star.lang.XComponent</code>
+* interface methods :
+* <ul>
+* <li><code> dispose()</code></li>
+* <li><code> addEventListener()</code></li>
+* <li><code> removeEventListener()</code></li>
+* </ul>
+* After this interface test object <b>must be recreated</b>. <p>
+* Multithreaded test ability <b>not implemented</b> yet.
+* @see com.sun.star.lang.XComponent
+*/
+public class _XComponent {
+
+ public static XComponent oObj = null;
+ private XNameContainer xContainer = null;
+ private XComponent altDispose = null;
+ public LogWriter log = null;
+
+ boolean listenerDisposed[] = new boolean[2];
+ String[] Loutput = new String[2];
+
+ /**
+ * Listener which added but not removed, and its method must be called
+ * on <code>dispose</code> call.
+ */
+ public class MyEventListener implements XEventListener {
+ public void disposing ( EventObject oEvent ) {
+ Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this;
+ listenerDisposed[0] = true;
+ }
+ };
+
+ /**
+ * Listener which added and then removed, and its method must <b>not</b>
+ * be called on <code>dispose</code> call.
+ */
+ public class MyEventListener2 implements XEventListener {
+ public void disposing ( EventObject oEvent ) {
+ Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this;
+ listenerDisposed[1] = true;
+ }
+ };
+
+ XEventListener listener1 = new MyEventListener();
+ XEventListener listener2 = new MyEventListener2();
+
+ /**
+ * For the cfgmgr2.OSetElement tests: dispose the owner element.
+ */
+ protected void before() {
+ // do not dispose this component, but parent instead
+// altDispose = (XComponent)tEnv.getObjRelation("XComponent.DisposeThis");
+
+ }
+
+ /**
+ * Adds two listeners. <p>
+ * Has OK status if then the first listener will receive an event
+ * on <code>dispose</code> method call.
+ */
+ public boolean _addEventListener() {
+
+ listenerDisposed[0] = false;
+ listenerDisposed[1] = false;
+
+ oObj.addEventListener( listener1 );
+ oObj.addEventListener( listener2 );
+
+ return true;
+ } // finished _addEventListener()
+
+ /**
+ * Removes the second of two added listeners. <p>
+ * Method tests to be completed successfully :
+ * <ul>
+ * <li> <code>addEventListener</code> : method must add two listeners. </li>
+ * </ul> <p>
+ * Has OK status if no events will be sent to the second listener on
+ * <code>dispose</code> method call.
+ */
+ public boolean _removeEventListener() {
+// executeMethod("addEventListener()");
+ if (disposed) return true;
+ // the second listener should not be called
+ oObj.removeEventListener( listener2 );
+ log.println(Thread.currentThread() + " is removing EL " + listener2);
+ return true;
+ } // finished _removeEventListener()
+
+ static boolean disposed = false;
+
+ /**
+ * Disposes the object and then check appropriate listeners were
+ * called or not. <p>
+ * Method tests to be completed successfully :
+ * <ul>
+ * <li> <code>removeEventListener</code> : method must remove one of two
+ * listeners. </li>
+ * </ul> <p>
+ * Has OK status if liseter removed wasn't called and other listener
+ * was.
+ */
+ public boolean _dispose() {
+ disposed = false;
+// executeMethod("removeEventListener()");
+
+ log.println( "begin dispose" + Thread.currentThread());
+ oObj.dispose();
+
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {}
+ if (Loutput[0]!=null) log.println(Loutput[0]);
+ if (Loutput[1]!=null) log.println(Loutput[1]);
+ log.println( "end dispose" + Thread.currentThread());
+ disposed = true;
+
+ // check that dispose() works OK.
+ return listenerDisposed[0] && !listenerDisposed[1];
+
+ } // finished _dispose()
+
+ /**
+ * Forces object recreation.
+ */
+ protected void after() {
+// disposeEnvironment();
+ }
+
+} // finished class _XComponent
+
+
diff --git a/ucb/qa/complex/tdoc/interfaces/_XContent.java b/ucb/qa/complex/tdoc/interfaces/_XContent.java
new file mode 100755
index 000000000000..4c84ecc1d8df
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XContent.java
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.ucb.XContent;
+import com.sun.star.ucb.XContentEventListener;
+import com.sun.star.ucb.XContentIdentifier;
+import share.LogWriter;
+
+/**
+ *
+ * @author sg128468
+ */
+public class _XContent {
+ public XContent oObj = null;
+ public LogWriter log = null;
+ private ContentListener listener = null;
+
+ public boolean _addContentEventListener() {
+ listener = new ContentListener();
+ oObj.addContentEventListener(listener);
+ return true;
+ }
+ public boolean _getContentType() {
+ String type = oObj.getContentType();
+ log.println("Type: " + type);
+ return type != null && type.indexOf("vnd.sun.star.tdoc") != -1;
+ }
+ public boolean _getIdentifier() {
+ XContentIdentifier xIdent = oObj.getIdentifier();
+ String id = xIdent.getContentIdentifier();
+ String scheme = xIdent.getContentProviderScheme();
+ log.println("Id: " + id);
+ log.println("Scheme: " + scheme);
+ return id != null && scheme != null && id.indexOf("vnd.sun.star.tdoc") != -1 && scheme.indexOf("vnd.sun.star.tdoc") != -1;
+ }
+ public boolean _removeContentEventListener() {
+ System.out.println("Event: " + (listener.disposed || listener.firedEvent));
+ oObj.removeContentEventListener(listener);
+ return true;
+ }
+
+
+ private class ContentListener implements XContentEventListener {
+ private boolean disposed = false;
+ private boolean firedEvent = false;
+
+ public void reset() {
+ disposed = false;
+ firedEvent = false;
+ }
+
+ public void contentEvent(com.sun.star.ucb.ContentEvent contentEvent) {
+ firedEvent = true;
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposed = true;
+ }
+
+ }
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java
new file mode 100755
index 000000000000..790f295c7be5
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.beans.XPropertiesChangeListener;
+import com.sun.star.beans.XPropertiesChangeNotifier;
+import share.LogWriter;
+
+/**
+ * Check the XPropertiesChangeNotifier
+ */
+public class _XPropertiesChangeNotifier {
+ public XPropertiesChangeNotifier oObj = null;
+ public LogWriter log = null;
+
+ PropertiesChangeListener listener = new PropertiesChangeListener();
+ String[] args = null;
+
+
+ public boolean _addPropertiesChangeListener() {
+ oObj.addPropertiesChangeListener(args, listener);
+ return true;
+ }
+
+ public boolean _removePropertiesChangeListener() {
+ oObj.removePropertiesChangeListener(args, listener);
+ return true;
+ }
+
+ private class PropertiesChangeListener implements XPropertiesChangeListener {
+ public boolean disposed = false;
+ public boolean propChanged = false;
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposed = true;
+ }
+
+ public void propertiesChange(com.sun.star.beans.PropertyChangeEvent[] propertyChangeEvent) {
+ propChanged = true;
+ }
+
+ }
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java b/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java
new file mode 100755
index 000000000000..fd7ff94c8f8f
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.beans.XPropertyContainer;
+import share.LogWriter;
+
+/**
+ *
+ * @author sg128468
+ */
+public class _XPropertyContainer {
+ public XPropertyContainer oObj = null;
+ public LogWriter log = null;
+
+ public boolean _addProperty() {
+ boolean result = true;
+ // add illegal property
+ try {
+ oObj.addProperty("MyIllegalProperty", (short)0, null);
+ }
+ catch(com.sun.star.beans.PropertyExistException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ log.println("'IllegalArgument' Unexpected but correct.");
+ }
+ catch(com.sun.star.beans.IllegalTypeException e) {
+ log.println("'IllegalType' Correctly thrown");
+ }
+ // add valid property
+ try {
+ oObj.addProperty("MyLegalProperty", (short)0, "Just a value");
+ }
+ catch(com.sun.star.beans.PropertyExistException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ catch(com.sun.star.beans.IllegalTypeException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ return result;
+ }
+
+ public boolean _removeProperty() {
+ boolean result = true;
+ try {
+ oObj.removeProperty("MyIllegalProperty");
+ }
+ catch(com.sun.star.beans.UnknownPropertyException e) {
+ log.println("'UnknownProperty' Correctly thrown");
+ }
+ catch(com.sun.star.beans.NotRemoveableException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ try {
+ oObj.removeProperty("MyLegalProperty");
+ }
+ catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ catch(com.sun.star.beans.NotRemoveableException e) {
+ e.printStackTrace((java.io.PrintWriter)log);
+ result = false;
+ }
+ return result;
+ }
+
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java
new file mode 100755
index 000000000000..ec1d7d64ada5
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import com.sun.star.beans.XPropertySetInfoChangeListener;
+import com.sun.star.beans.XPropertySetInfoChangeNotifier;
+import share.LogWriter;
+
+/**
+ *
+ */
+public class _XPropertySetInfoChangeNotifier {
+ public XPropertySetInfoChangeNotifier oObj = null;
+ public LogWriter log = null;
+
+ PropertySetInfoChangeListener listener = new PropertySetInfoChangeListener();
+ String[] args = null;
+
+
+ public boolean _addPropertiesChangeListener() {
+ oObj.addPropertySetInfoChangeListener(listener);
+ return true;
+ }
+
+ public boolean _removePropertiesChangeListener() {
+ oObj.removePropertySetInfoChangeListener(listener);
+ return true;
+ }
+
+ private class PropertySetInfoChangeListener implements XPropertySetInfoChangeListener {
+ public boolean disposed = false;
+ public boolean propChanged = false;
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposed = true;
+ }
+
+ public void propertySetInfoChange(com.sun.star.beans.PropertySetInfoChangeEvent propertySetInfoChangeEvent) {
+ }
+
+ }
+
+}
diff --git a/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java b/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java
new file mode 100755
index 000000000000..761cca87998a
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XServiceInfo;
+import share.LogWriter;
+
+/**
+* Testing <code>com.sun.star.lang.XServiceInfo</code>
+* interface methods :
+* <ul>
+* <li><code> getImplementationName()</code></li>
+* <li><code> supportsService()</code></li>
+* <li><code> getSupportedServiceNames()</code></li>
+* </ul> <p>
+* Test is multithread compilant. <p>
+* @see com.sun.star.lang.XServiceInfo
+*/
+public class _XServiceInfo {
+ public static XServiceInfo oObj = null;
+ public static String[] names = null;
+ public LogWriter log = null;
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occured.
+ */
+ public boolean _getImplementationName() {
+ boolean result = true;
+ log.println("testing getImplementationName() ... ");
+
+ log.println("The ImplementationName ist "+oObj.getImplementationName());
+ result=true;
+
+ return result;
+
+ } // end getImplementationName()
+
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occured.
+ */
+ public boolean _getSupportedServiceNames() {
+ boolean result = true;
+ log.println("getting supported Services...");
+ names = oObj.getSupportedServiceNames();
+ for (int i=0;i<names.length;i++) {
+ int k = i+1;
+ log.println(k+". Supported Service is "+names[i]);
+ }
+ result=true;
+
+ return result;
+
+ } // end getSupportedServiceNames()
+
+ /**
+ * Gets one of the service names returned by
+ * <code>getSupportedServiceNames</code> method and
+ * calls the <code>supportsService</code> methos with this
+ * name. <p>
+ * Has <b>OK</b> status if <code>true</code> value is
+ * returned.
+ */
+ public boolean _supportsService() {
+ log.println("testing supportsService");
+ names = oObj.getSupportedServiceNames();
+ return oObj.supportsService(names[0]);
+ } // end supportsService()
+}
+
diff --git a/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java b/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java
new file mode 100755
index 000000000000..aef931bdeef1
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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 complex.tdoc.interfaces;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import share.LogWriter;
+
+/**
+* Testing <code>com.sun.star.lang.XTypeProvider</code>
+* interface methods :
+* <ul>
+* <li><code> getTypes()</code></li>
+* <li><code> getImplementationId()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.lang.XTypeProvider
+*/
+public class _XTypeProvider {
+
+ public static XTypeProvider oObj = null;
+ public static Type[] types = null;
+ public LogWriter log = null;
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occured.
+ */
+ public boolean _getImplementationId() {
+ boolean result = true;
+ log.println("testing getImplementationId() ... ");
+
+ log.println("The ImplementationId is "+oObj.getImplementationId());
+ result = true;
+
+ return result;
+
+ } // end getImplementationId()
+
+
+ /**
+ * ?alls the method and checks the return value.<p>
+ * Has <b>OK</b> status if one of the return value equals to the
+ * type <code>com.sun.star.lang.XTypeProvider</code>.
+ */
+ public boolean _getTypes() {
+ boolean result = false;
+ log.println("getting Types...");
+ types = oObj.getTypes();
+ for (int i=0;i<types.length;i++) {
+ int k = i+1;
+ log.println(k+". Type is "+types[i].toString());
+ if (types[i].toString().equals
+ ("Type[com.sun.star.lang.XTypeProvider]")) {
+ result = true;
+ }
+ }
+ if (!result) {
+ log.println("Component must provide Type "
+ +"<com.sun.star.lang.XTypeProvider>");
+ }
+
+ return result;
+
+ } // end getTypes()
+
+}
+
diff --git a/ucb/qa/complex/tdoc/interfaces/makefile.mk b/ucb/qa/complex/tdoc/interfaces/makefile.mk
new file mode 100755
index 000000000000..3a57d1501ca4
--- /dev/null
+++ b/ucb/qa/complex/tdoc/interfaces/makefile.mk
@@ -0,0 +1,63 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+TARGET = TransientDocument
+PRJNAME = $(TARGET)
+PACKAGE = complex$/tdoc$/interfaces
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = _XChild.java \
+ _XCommandInfoChangeNotifier.java \
+ _XCommandProcessor.java \
+ _XComponent.java \
+ _XContent.java \
+ _XPropertiesChangeNotifier.java \
+ _XPropertyContainer.java \
+ _XPropertySetInfoChangeNotifier.java \
+ _XServiceInfo.java \
+ _XTypeProvider.java
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
diff --git a/ucb/qa/complex/tdoc/makefile.mk b/ucb/qa/complex/tdoc/makefile.mk
new file mode 100755
index 000000000000..175184de0f27
--- /dev/null
+++ b/ucb/qa/complex/tdoc/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+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
+
+# CheckSimpleFileAccess.java \
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# 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
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# replace $/ with . in package name
+CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# test document path
+CT_TESTDOCS = -tdoc $(PWD)$/..$/test_documents
+
+# --- Targets ------------------------------------------------------
+
+run: ALLTAR
+ @echo .
+ @echo "The followig tests are available:"
+ @echo $(foreach,i,$(JAVAFILES) "dmake $(i:b) ")
+
+.INCLUDE : target.mk
+
+Check%:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_TESTDOCS) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).$@
diff --git a/ucb/qa/complex/test_documents/Iterator.sxw b/ucb/qa/complex/test_documents/Iterator.sxw
new file mode 100644
index 000000000000..9a7f8961bb47
--- /dev/null
+++ b/ucb/qa/complex/test_documents/Iterator.sxw
Binary files differ
diff --git a/ucb/qa/complex/test_documents/chinese.sxw b/ucb/qa/complex/test_documents/chinese.sxw
new file mode 100644
index 000000000000..53b242a292c3
--- /dev/null
+++ b/ucb/qa/complex/test_documents/chinese.sxw
Binary files differ
diff --git a/ucb/qa/complex/test_documents/filter.sxw b/ucb/qa/complex/test_documents/filter.sxw
new file mode 100644
index 000000000000..e4b077c65f11
--- /dev/null
+++ b/ucb/qa/complex/test_documents/filter.sxw
Binary files differ
diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java
new file mode 100755
index 000000000000..f7b1d2a8e918
--- /dev/null
+++ b/ucb/qa/complex/ucb/UCB.java
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * 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 complex.ucb;
+
+/**
+ * @author ab106281
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+
+import complexlib.ComplexTestCase;
+import java.util.List;
+import java.util.Vector;
+
+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.ucb.*;
+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;
+/**
+ * @author rpiterman
+ * This class is used to copy the content of a folder to
+ * another folder.
+ * There is an incosistency with argument order.
+ * It should be always: dir,filename.
+ */
+public class UCB extends ComplexTestCase {
+ private Object ucb;
+
+ public String[] getTestMethodNames() {
+ return new String[] {"checkWrongFtpConnection"};
+ }
+
+ public void init(XMultiServiceFactory xmsf) throws Exception {
+ String[] keys = new String[2];
+ keys[0] = "Local";
+ keys[1] = "Office";
+ ucb =
+ xmsf.createInstanceWithArguments(
+ "com.sun.star.ucb.UniversalContentBroker",
+ keys);
+ }
+
+ public void delete(String filename) throws Exception {
+ executeCommand(getContent(filename), "delete", Boolean.TRUE);
+ }
+
+ /**
+ * target name can be "", in which case the name stays lige the source name
+ * @param sourceDir
+ * @param filename
+ * @param targetDir
+ * @param targetName
+ * @return
+ */
+
+ public Object executeCommand(
+ Object xContent,
+ String aCommandName,
+ Object aArgument)
+ throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
+ XCommandProcessor xCmdProcessor =
+ (XCommandProcessor) UnoRuntime.queryInterface(
+ XCommandProcessor.class,
+ xContent);
+ Command aCommand = new Command();
+ aCommand.Name = aCommandName;
+ aCommand.Handle = -1; // not available
+ aCommand.Argument = aArgument;
+ return xCmdProcessor.execute(aCommand, 0, null);
+ }
+
+ private List listFiles(String path, Verifier verifier) throws Exception {
+ Object xContent = getContent(path);
+
+ OpenCommandArgument2 aArg = new OpenCommandArgument2();
+ aArg.Mode = OpenMode.ALL;
+ aArg.Priority = 32768;
+
+ // Fill info for the properties wanted.
+ aArg.Properties = new Property[] { new Property()};
+
+ aArg.Properties[0].Name = "Title";
+ aArg.Properties[0].Handle = -1;
+
+ XDynamicResultSet xSet;
+
+ xSet =
+ (XDynamicResultSet) UnoRuntime.queryInterface(
+ XDynamicResultSet.class,
+ executeCommand(xContent, "open", aArg));
+
+ XResultSet xResultSet = xSet.getStaticResultSet();
+
+ List files = new Vector();
+
+ 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 {
+ // 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
+ else
+ 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--);
+
+ return files;
+ }
+
+ public Object getContentProperty(
+ Object content,
+ String propName,
+ Class type)
+ throws Exception {
+ Property[] pv = new Property[1];
+ pv[0] = new Property();
+ pv[0].Name = propName;
+ pv[0].Handle = -1;
+
+ Object row = executeCommand(content, "getPropertyValues", pv);
+ XRow xrow = (XRow) UnoRuntime.queryInterface(XRow.class, row);
+ if (type.equals(String.class))
+ return xrow.getString(1);
+ else if (type.equals(Boolean.class))
+ return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE;
+ else if (type.equals(Integer.class))
+ return new Integer(xrow.getInt(1));
+ else if (type.equals(Short.class))
+ return new Short(xrow.getShort(1));
+ else
+ 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 static interface Verifier {
+ public boolean verify(Object object);
+ }
+
+ public void checkWrongFtpConnection() {
+ //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
+ try {
+ XMultiServiceFactory xLocMSF = (XMultiServiceFactory)param.getMSF();
+ String acountUrl = "ftp://noname:nopasswd@nohost";
+ log.println(acountUrl);
+ init(xLocMSF);
+ Object content = getContent(acountUrl);
+
+ OpenCommandArgument2 aArg = new OpenCommandArgument2();
+ aArg.Mode = OpenMode.ALL; // FOLDER, DOCUMENTS -> simple filter
+ aArg.Priority = 32768; // Ignored by most implementations
+
+ log.println("now executing open");
+ executeCommand(content, "open", aArg);
+ failed("Expected 'IllegalArgumentException' was not thrown.");
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ //TODO error message;
+ log.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.");
+ } catch (Exception ex) {
+ ex.printStackTrace((java.io.PrintWriter)log);
+ String exceptionName = ex.toString();
+ log.println("ExName: '"+exceptionName+"'");
+ failed("Wrong exception thrown: " + exceptionName);
+ }
+// System.exit(0);
+ }
+
+}
diff --git a/ucb/qa/complex/ucb/makefile.mk b/ucb/qa/complex/ucb/makefile.mk
new file mode 100755
index 000000000000..4664bd3cfae7
--- /dev/null
+++ b/ucb/qa/complex/ucb/makefile.mk
@@ -0,0 +1,78 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+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)
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# 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
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# test looks something like the.full.package.TestName
+CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+RUN:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST)
+
+run: RUN
+
+