summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/ifc/util
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/util')
-rw-r--r--qadevOOo/tests/java/ifc/util/_PathSettings.java89
-rw-r--r--qadevOOo/tests/java/ifc/util/_SearchDescriptor.java53
-rw-r--r--qadevOOo/tests/java/ifc/util/_XCancellable.java65
-rw-r--r--qadevOOo/tests/java/ifc/util/_XChangesBatch.java172
-rw-r--r--qadevOOo/tests/java/ifc/util/_XChangesNotifier.java222
-rw-r--r--qadevOOo/tests/java/ifc/util/_XCloneable.java112
-rw-r--r--qadevOOo/tests/java/ifc/util/_XFlushable.java111
-rw-r--r--qadevOOo/tests/java/ifc/util/_XImportable.java202
-rw-r--r--qadevOOo/tests/java/ifc/util/_XIndent.java98
-rw-r--r--qadevOOo/tests/java/ifc/util/_XMergeable.java74
-rw-r--r--qadevOOo/tests/java/ifc/util/_XModeSelector.java104
-rw-r--r--qadevOOo/tests/java/ifc/util/_XModifiable.java57
-rw-r--r--qadevOOo/tests/java/ifc/util/_XModifyBroadcaster.java86
-rw-r--r--qadevOOo/tests/java/ifc/util/_XNumberFormatsSupplier.java98
-rw-r--r--qadevOOo/tests/java/ifc/util/_XNumberFormatter.java128
-rw-r--r--qadevOOo/tests/java/ifc/util/_XProtectable.java84
-rw-r--r--qadevOOo/tests/java/ifc/util/_XRefreshable.java119
-rw-r--r--qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java75
-rw-r--r--qadevOOo/tests/java/ifc/util/_XReplaceable.java147
-rw-r--r--qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java87
-rw-r--r--qadevOOo/tests/java/ifc/util/_XSearchable.java185
-rw-r--r--qadevOOo/tests/java/ifc/util/_XSortable.java238
-rw-r--r--qadevOOo/tests/java/ifc/util/_XStringEscape.java64
-rw-r--r--qadevOOo/tests/java/ifc/util/_XStringSubstitution.java101
-rw-r--r--qadevOOo/tests/java/ifc/util/_XTextSearch.java119
-rw-r--r--qadevOOo/tests/java/ifc/util/_XURLTransformer.java471
26 files changed, 3361 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/util/_PathSettings.java b/qadevOOo/tests/java/ifc/util/_PathSettings.java
new file mode 100644
index 000000000000..b9411a2ccfb3
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_PathSettings.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiPropertyTest;
+import util.utils;
+
+import com.sun.star.lang.XMultiServiceFactory;
+
+/**
+ * Testing <code>com.sun.star.util.PathSettings</code>
+ * service properties :
+ * <ul>
+ * <li><code> Addin </code></li>
+ * <li><code> AutoCorrect </code></li>
+ * <li><code> AutoText </code></li>
+ * <li><code> Backup </code></li>
+ * <li><code> Basic </code></li>
+ * <li><code> Bitmap </code></li>
+ * <li><code> Config </code></li>
+ * <li><code> Dictionary </code></li>
+ * <li><code> Favorites </code></li>
+ * <li><code> Filter </code></li>
+ * <li><code> Gallery </code></li>
+ * <li><code> Graphic </code></li>
+ * <li><code> Help </code></li>
+ * <li><code> Linguistic </code></li>
+ * <li><code> Module </code></li>
+ * <li><code> Palette </code></li>
+ * <li><code> Plugin </code></li>
+ * <li><code> Storage </code></li>
+ * <li><code> Temp </code></li>
+ * <li><code> Template </code></li>
+ * <li><code> UIConfig </code></li>
+ * <li><code> UserConfig </code></li>
+ * <li><code> UserDictionary</code></li>
+ * <li><code> Work </code></li>
+ * </ul> <p>
+ *
+ * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+ * @see com.sun.star.util.PathSettings
+ */
+public class _PathSettings extends MultiPropertyTest {
+
+ /**
+ * This path list could be empty after SO installation.
+ * And the URL is validated to match the pattern 'file:///*'
+ * thats why the custom changing of this property required.
+ */
+ public void _UIConfig() {
+ testProperty("UIConfig", new PropertyTester() {
+ public Object getNewValue(String propName, Object oldVal) {
+ String path = (String) oldVal;
+ if (path == null) path = "";
+ if (path.length() > 0 && !path.endsWith(";")) {
+ path += ";";
+ }
+ path += utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF());
+ return path;
+ }
+ });
+ }
+}
+
diff --git a/qadevOOo/tests/java/ifc/util/_SearchDescriptor.java b/qadevOOo/tests/java/ifc/util/_SearchDescriptor.java
new file mode 100644
index 000000000000..e24913e933bd
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_SearchDescriptor.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiPropertyTest;
+
+/**
+ * Testing <code>com.sun.star.util.SearchDescriptor</code>
+ * service properties :
+ * <ul>
+ * <li><code> SearchBackwards</code></li>
+ * <li><code> SearchCaseSensitive</code></li>
+ * <li><code> SearchWords</code></li>
+ * <li><code> SearchRegularExpression</code></li>
+ * <li><code> SearchStyles</code></li>
+ * <li><code> SearchSimilarity</code></li>
+ * <li><code> SearchSimilarityRelax</code></li>
+ * <li><code> SearchSimilarityRemove</code></li>
+ * <li><code> SearchSimilarityAdd</code></li>
+ * <li><code> SearchSimilarityExchange</code></li>
+ * </ul> <p>
+ * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+ * @see com.sun.star.util.SearchDescriptor
+ */
+public class _SearchDescriptor extends MultiPropertyTest {
+
+} //finish class _SearchDescriptor
+
diff --git a/qadevOOo/tests/java/ifc/util/_XCancellable.java b/qadevOOo/tests/java/ifc/util/_XCancellable.java
new file mode 100644
index 000000000000..cd7ffc0840b5
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XCancellable.java
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XCancellable;
+
+/**
+* Testing <code>com.sun.star.util.XCancellable</code>
+* interface methods :
+* <ul>
+* <li><code> cancel()</code></li>
+* </ul> <p>
+* @see com.sun.star.util.XCancellable
+*/
+public class _XCancellable extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XCancellable oObj = null ;
+
+ /**
+ * Just calls the method. <p>
+ * Has <b>OK</b> status if no exception has occured. <p>
+ */
+ public void _cancel() {
+ oObj.cancel() ;
+
+ tRes.tested("cancel()", true) ;
+ }
+
+ /**
+ * Forces object recreation.
+ */
+ public void after() {
+ disposeEnvironment() ;
+ }
+
+} // finish class _XCancellable
+
diff --git a/qadevOOo/tests/java/ifc/util/_XChangesBatch.java b/qadevOOo/tests/java/ifc/util/_XChangesBatch.java
new file mode 100644
index 000000000000..397ac79e3922
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XChangesBatch.java
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameReplace;
+import com.sun.star.util.ElementChange;
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XChangesBatch;
+import lib.Status;
+import lib.StatusException;
+
+public class _XChangesBatch extends MultiMethodTest {
+
+ public XChangesBatch oObj;
+ private Object changeElement = null;
+ private Object originalElement = null;
+ private String elementName = null;
+ private XPropertySet xProp = null;
+ private XNameReplace xNameReplace = null;
+
+ /**
+ * add a change that can be committed
+ */
+ protected void before() {
+ changeElement = tEnv.getObjRelation("XChangesBatch.ChangeElement");
+ originalElement = tEnv.getObjRelation("XChangesBatch.OriginalElement");
+ elementName = (String)tEnv.getObjRelation("XChangesBatch.PropertyName");
+
+ // to do a change, get an XPropertySet
+ xProp = (XPropertySet)tEnv.getObjRelation("XChangesBatch.PropertySet");
+ try {
+ if (originalElement == null && xProp != null)
+ originalElement = xProp.getPropertyValue(elementName);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not get property '" + elementName + "'.", e);
+ }
+
+ // or get an XNameReplace
+ xNameReplace = (XNameReplace)tEnv.getObjRelation("XChangesBatch.NameReplace");
+ try {
+ if (originalElement == null && xNameReplace != null)
+ originalElement = xNameReplace.getByName(elementName);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not get element by name '" + elementName + "'.", e);
+ }
+
+ if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null)) {
+ log.println(
+ changeElement == null?"Missing property 'XChangesBatch.ChangeElement'\n":"" +
+ originalElement == null?"Missing property 'XChangesBatch.OriginalElement'\n":"" +
+ elementName == null?"Missing property 'XChangesBatch.PropertyName'\n":"" +
+ xProp == null?"Missing property 'XChangesBatch.PropertySet'":"" +
+ xNameReplace == null?"Missing property 'XChangesBatch.NameReplace'":""
+ );
+ throw new StatusException("Some needed object relations are missing.", new Exception());
+ }
+ }
+
+ public void _commitChanges() {
+ requiredMethod("getPendingChanges()");
+ try {
+ log.println("Committing changes.");
+ oObj.commitChanges();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ tRes.tested("commitChanges()", Status.exception(e));
+ return;
+ }
+ try {
+ executeChange(originalElement);
+ }
+ catch(StatusException e) {
+ tRes.tested("hasPendingChanges()", Status.exception(e));
+ return;
+ }
+
+ try {
+ log.println("Commit changes back.");
+ oObj.commitChanges();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ tRes.tested("commitChanges()", Status.exception(e));
+ return;
+ }
+ tRes.tested("commitChanges()", true);
+ }
+
+ public void _getPendingChanges() {
+ requiredMethod("hasPendingChanges()");
+ ElementChange[]changes = oObj.getPendingChanges();
+ if (changes == null) {
+ log.println("Returned changes was 'null'");
+ log.println("It should have been 1 change.");
+ tRes.tested("getPendingChanges()", false);
+ } else if (changes.length != 1) {
+ int amount = changes.length;
+ log.println("Found not the right number of changes: " + amount);
+ log.println("It should have been 1 change.");
+ for (int i=0; i<amount; i++) {
+ System.out.println("Detailed Change " + i + " -> new Element: '" +
+ changes[i].Element.toString() + "' ReplacedElement: '" +
+ changes[i].ReplacedElement.toString() + "'");
+ }
+ tRes.tested("getPendingChanges()", false);
+ }
+ else {
+ boolean result = changes[0].ReplacedElement.equals(originalElement);
+ result &= changes[0].Element.equals(changeElement);
+ tRes.tested("getPendingChanges()", result);
+ }
+ }
+
+ public void _hasPendingChanges() {
+ try {
+ executeChange(changeElement);
+ }
+ catch(StatusException e) {
+ tRes.tested("hasPendingChanges()", Status.exception(e));
+ return;
+ }
+ boolean hasPendingChanges = oObj.hasPendingChanges();
+ tRes.tested("hasPendingChanges()", hasPendingChanges);
+ }
+
+ private void executeChange(Object element) throws StatusException {
+ if (xProp != null) {
+ try {
+ xProp.setPropertyValue(elementName, element);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not set property '" + elementName + "'.", e);
+ }
+ }
+ else if (xNameReplace != null) {
+ try {
+ xNameReplace.replaceByName(elementName, element);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not replace '" + elementName + "' by name.", e);
+ }
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/ifc/util/_XChangesNotifier.java b/qadevOOo/tests/java/ifc/util/_XChangesNotifier.java
new file mode 100644
index 000000000000..6899f13d8ae2
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XChangesNotifier.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameReplace;
+import com.sun.star.util.XChangesBatch;
+import com.sun.star.util.XChangesListener;
+import com.sun.star.util.XChangesNotifier;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.MultiMethodTest;
+
+/**
+ * Test the XChangesNotifier interface. To produce some changes,
+ * XChangesBatch is used.
+ * @see com.sun.star.util.XChangesNotifier
+ * @see com.sun.star.util.XChangesBatch
+ */
+public class _XChangesNotifier extends MultiMethodTest {
+
+ public XChangesNotifier oObj = null;
+ private XChangesBatch xBatch = null;
+ private Object changeElement = null;
+ private Object originalElement = null;
+ private String elementName = null;
+ private XPropertySet xProp = null;
+ private XNameReplace xNameReplace = null;
+ private _XChangesNotifier.MyChangesListener xListener = null;
+
+ /**
+ * Own implementation of the XChangesListener interface
+ * @see com.sun.star.util.XChangesListener
+ */
+ private static class MyChangesListener implements XChangesListener {
+ /** Just lo a call of the listener **/
+ boolean bChangesOccured = false;
+
+ /** A change did occur
+ * @param changesEvent The event.
+ **/
+ public void changesOccurred(com.sun.star.util.ChangesEvent changesEvent) {
+ bChangesOccured = true;
+ }
+
+ /** Disposing of the listener
+ * @param eventObject The event.
+ **/
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ bChangesOccured = true;
+ }
+
+ /**
+ * Reset the listener
+ */
+ public void reset() {
+ bChangesOccured = false;
+ }
+
+ /**
+ * Has the listener been called?
+ * @return True, if the listener has been called.
+ */
+ public boolean didChangesOccur() {
+ return bChangesOccured;
+ }
+ }
+
+ /**
+ * Before the test: get the 'XChangesNotifier.ChangesBatch' object relation
+ * and create the listener.
+ */
+ protected void before() {
+ xBatch = (XChangesBatch)tEnv.getObjRelation("XChangesNotifier.ChangesBatch");
+ changeElement = tEnv.getObjRelation("XChangesNotifier.ChangeElement");
+ originalElement = tEnv.getObjRelation("XChangesNotifier.OriginalElement");
+ elementName = (String)tEnv.getObjRelation("XChangesNotifier.PropertyName");
+
+ xProp = (XPropertySet)tEnv.getObjRelation("XChangesNotifier.PropertySet");
+ try {
+ if (originalElement == null && xProp != null)
+ originalElement = xProp.getPropertyValue(elementName);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not get property '" + elementName + "'.", e);
+ }
+
+ // or get an XNameReplace
+ xNameReplace = (XNameReplace)tEnv.getObjRelation("XChangesNotifier.NameReplace");
+ try {
+ if (originalElement == null && xNameReplace != null)
+ originalElement = xNameReplace.getByName(elementName);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ throw new StatusException("Could not get element by name '" + elementName + "'.", e);
+ }
+
+ if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null) || xBatch == null) {
+ log.println(
+ changeElement == null?"Missing property 'XChangesNotifier.ChangeElement'\n":"" +
+ originalElement == null?"Missing property 'XChangesNotifier.OriginalElement'\n":"" +
+ elementName == null?"Missing property 'XChangesNotifier.PropertyName'\n":"" +
+ xProp == null?"Missing property 'XChangesNotifier.PropertySet'":"" +
+ xNameReplace == null?"Missing property 'XChangesNotifier.NameReplace'":"" +
+ xBatch == null?"Missing property 'XChangesNotifier.ChangesBatch'":""
+ );
+ throw new StatusException("Some needed object relations are missing.", new Exception());
+ }
+
+ xListener = new _XChangesNotifier.MyChangesListener();
+ }
+
+ /** test addChangesListener **/
+ public void _addChangesListener() {
+ oObj.addChangesListener(xListener);
+ tRes.tested("addChangesListener()", true);
+ }
+
+ /** test removeChangesListener **/
+ public void _removeChangesListener() {
+ requiredMethod("addChangesListener()");
+ boolean result = true;
+ result &= commitChanges();
+ result &= xListener.didChangesOccur();
+ if (!result)
+ log.println("Listener has not been called.");
+ oObj.removeChangesListener(xListener);
+ xListener.reset();
+ result &= redoChanges();
+ boolean result2 = xListener.didChangesOccur();
+ if (result2)
+ log.println("Removed listener has been called.");
+
+ tRes.tested("removeChangesListener()", result && !result2);
+ }
+
+ /**
+ * Commit a change, using an implementation of the XChangesBatch interface.
+ * @return true, if changing worked.
+ */
+ private boolean commitChanges() {
+ if (!executeChange(changeElement)) return false;
+ if (!xBatch.hasPendingChanges()) return false;
+ try {
+ xBatch.commitChanges();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace((PrintWriter)log);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Redo the change, using an implementation of the XChangesBatch interface.
+ * @return true, if changing worked.
+ */
+ private boolean redoChanges() {
+ if (!executeChange(originalElement)) return false;
+ if (!xBatch.hasPendingChanges()) return false;
+ try {
+ xBatch.commitChanges();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace((PrintWriter)log);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Execute the change, use XPropertySet or XNameReplace
+ * @return False, if changing did throw an exception.
+ */
+ private boolean executeChange(Object element) throws StatusException {
+ if (xProp != null) {
+ try {
+ xProp.setPropertyValue(elementName, element);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace((PrintWriter)log);
+ return false;
+ }
+ }
+ else if (xNameReplace != null) {
+ try {
+ xNameReplace.replaceByName(elementName, element);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace((PrintWriter)log);
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/util/_XCloneable.java b/qadevOOo/tests/java/ifc/util/_XCloneable.java
new file mode 100644
index 000000000000..4591be5cfc2e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XCloneable.java
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloneable;
+
+/**
+* Testing <code>com.sun.star.util.XCloneable</code>
+* interface methods :
+* <ul>
+* <li><code> createClone()</code></li>
+* </ul> <p>
+* @see com.sun.star.util.XCloneable
+*/
+public class _XCloneable extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XCloneable oObj = null ;
+ protected XCloneable clone = null;
+
+ /**
+ * calls the method. <p>
+ * Has <b>OK</b> status if no exception has occured. <p>
+ */
+ public void _createClone() {
+ boolean result = true;
+ clone = oObj.createClone();
+
+ //check if the implementaionname equals
+ result &= checkImplementationName(oObj,clone);
+
+ //check ImplementationID
+ result &= checkImplementationID(oObj, clone);
+
+ tRes.tested("createClone()", result) ;
+ }
+
+ protected byte[] getImplementationID(XInterface ifc) {
+ byte[] res = new byte[0];
+ XTypeProvider provider = (XTypeProvider)
+ UnoRuntime.queryInterface(XTypeProvider.class, ifc);
+ if (provider != null) {
+ res = provider.getImplementationId();
+ }
+ return res;
+ }
+
+ protected boolean checkImplementationID(XInterface org, XInterface clone) {
+ boolean res = getImplementationID(org).equals(
+ getImplementationID(clone));
+ if (res && getImplementationID(org).length > 0) {
+ log.println("ImplementationID equals the clone has the same id as the original Object");
+ log.println("------------------------------------------------------------------------");
+ }
+ return !res;
+ }
+
+ protected String getImplementationName(XInterface ifc) {
+ String res = "";
+ XServiceInfo info = (XServiceInfo)
+ UnoRuntime.queryInterface(XServiceInfo.class, ifc);
+ if (info != null) {
+ res = info.getImplementationName();
+ }
+ return res;
+ }
+
+ protected boolean checkImplementationName(XInterface org, XInterface clone) {
+ boolean res = getImplementationName(org).equals(
+ getImplementationName(clone));
+ if (!res) {
+ log.println("ImplementationName differs: ");
+ log.println("Expected: "+getImplementationName(org));
+ log.println("Gained: "+getImplementationName(clone));
+ log.println("----------------------------------------");
+ }
+ return res;
+ }
+
+} // finish class _XCloneable
+
diff --git a/qadevOOo/tests/java/ifc/util/_XFlushable.java b/qadevOOo/tests/java/ifc/util/_XFlushable.java
new file mode 100644
index 000000000000..c18d84e5d5f6
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XFlushable.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XFlushListener;
+import com.sun.star.util.XFlushable;
+
+/**
+ * Testing <code>com.sun.star.util.XFlushable</code>
+ * interface methods :
+ * <ul>
+ * <li><code> flush()</code></li>
+ * <li><code> addFlushListener()</code></li>
+ * <li><code> removeFlushListener()</code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XFlushable
+ */
+public class _XFlushable extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XFlushable oObj = null ;
+
+ /**
+ * Simple <code>XFlushListener</code> implementation which
+ * just registers if any calls to its methods were made.
+ */
+ private class MyFlushListener implements XFlushListener{
+ boolean called = false ;
+ public void flushed(com.sun.star.lang.EventObject e) {
+ called = true ;
+ }
+ public void disposing(com.sun.star.lang.EventObject e) {}
+ public void reset() { called = false; }
+ public boolean wasFlushed() { return called; }
+ }
+
+ private MyFlushListener listener1 = new MyFlushListener(),
+ listener2 = new MyFlushListener() ;
+
+ /**
+ * Test call method <code>flush</code> and checks if added listener
+ * was called and removed one wasn't. <p>
+ * Has OK status if no exception has occured. <p>
+ * Methods to be executed before :
+ * {@link #_addFlushListener},
+ * {@link #_removeFlushListener}
+ */
+ public void _flush() {
+ executeMethod("addFlushListener()") ;
+ executeMethod("removeFlushListener()") ;
+
+ oObj.flush() ;
+
+ tRes.tested("flush()", true) ;
+ tRes.tested("addFlushListener()", listener2.wasFlushed()) ;
+ tRes.tested("removeFlushListener()", !listener1.wasFlushed()) ;
+ }
+
+ /**
+ * Test adds two listeners, one of which will be removed then.<p>
+ * Has OK status if the listener was called on <code>flush()</code>
+ * method call.
+ */
+ public void _addFlushListener() {
+ oObj.addFlushListener(listener1) ;
+ oObj.addFlushListener(listener2) ;
+ }
+
+ /**
+ * Test removes one of two listeners added before. <p>
+ * Has OK status if the listener removed wasn't called on
+ * <code>flush()</code> method call.
+ * Methods to be executed before :
+ * {@link #_addFlushListener},
+ */
+ public void _removeFlushListener() {
+ executeMethod("addFlushListener()") ;
+
+ oObj.removeFlushListener(listener1) ;
+ }
+
+} // finish class _XFlushable
+
diff --git a/qadevOOo/tests/java/ifc/util/_XImportable.java b/qadevOOo/tests/java/ifc/util/_XImportable.java
new file mode 100644
index 000000000000..164f8e4aaa3e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XImportable.java
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XImportable;
+
+
+/**
+ * checks the Interface XImportable
+ */
+public class _XImportable extends MultiMethodTest {
+ public XImportable oObj;
+ protected PropertyValue[] descriptor = null;
+ protected String[] names = new String[] {
+ "DatabaseName", "SourceType", "SourceObject", "IsNative"
+ };
+ protected Type[] types = new Type[] {
+ new Type(String.class), new Type(com.sun.star.sheet.DataImportMode.class),
+ new Type(String.class), new Type(Boolean.class)
+ };
+
+ /**
+ * creates an ImportDescriptor, the gained PropertyValues can be found
+ * in com.sun.star.sheet.DatabaseImportDescriptor.<br>
+ * Returns OK state is all propertynames and types are the specified.
+ */
+
+ public void _createImportDescriptor() {
+ boolean res = true;
+ boolean locResult = false;
+
+ descriptor = oObj.createImportDescriptor(true);
+ log.print("Getting when calling createImportDescriptor(true) --");
+
+
+ //printPropertyValue(descriptor);
+ log.println("done");
+
+ log.print("Checking PropertyNames -- ");
+ locResult = checkPropertyNames(descriptor, names);
+ log.println("Worked: " + locResult);
+ res &= locResult;
+
+ log.print("Checking PropertyTypes -- ");
+ locResult = checkPropertyTypes(descriptor, types);
+ log.println("Worked: " + locResult);
+ res &= locResult;
+
+ descriptor = oObj.createImportDescriptor(false);
+ log.print("Getting when calling createImportDescriptor(false) -- ");
+
+
+ //printPropertyValue(descriptor);
+ log.println("done");
+
+ log.print("Checking PropertyNames -- ");
+ locResult = checkPropertyNames(descriptor, names);
+ log.println("Worked: " + locResult);
+ res &= locResult;
+
+ log.print("Checking PropertyTypes -- ");
+ locResult = checkPropertyTypes(descriptor, types);
+ log.println("Worked - " + locResult);
+ res &= locResult;
+
+ tRes.tested("createImportDescriptor()", res);
+ }
+
+ public void _doImport() {
+ requiredMethod("createImportDescriptor()");
+ boolean res = true;
+
+ log.print("Setting the ImportDescriptor (Bibliograpy, Table, biblio) -- ");
+ descriptor[0].Value = "Bibliography";
+ descriptor[1].Value = com.sun.star.sheet.DataImportMode.TABLE;
+ descriptor[2].Value = "biblio";
+ log.println("done");
+
+ log.print("Importing data (Bibliograpy, Table, biblio) -- ");
+ oObj.doImport(descriptor);
+ log.println("done");
+
+ log.println("Checking data");
+ res &= checkA1("Identifier");
+
+ log.print("Setting the ImportDescriptor (Bibliograpy, SQL, select Author from biblio) -- ");
+ descriptor[0].Value = "Bibliography";
+ descriptor[1].Value = com.sun.star.sheet.DataImportMode.SQL;
+ descriptor[2].Value = "select Author from biblio";
+ log.println("done");
+
+ log.print("Importing data (Bibliograpy, SQL, select Author from biblio) -- ");
+ oObj.doImport(descriptor);
+ log.println("done");
+
+ log.println("Checking data");
+ res &= checkA1("Author");
+
+ tRes.tested("doImport()",res);
+ }
+
+ protected void printPropertyValue(PropertyValue[] props) {
+ for (int i = 0; i < props.length; i++) {
+ log.println("\tName: " + props[i].Name);
+ log.println("\tValue: " + props[i].Value);
+ }
+ }
+
+ protected boolean checkPropertyNames(PropertyValue[] props, String[] names) {
+ boolean res = true;
+
+ for (int i = 0; i < props.length; i++) {
+ boolean locResult = props[i].Name.equals(names[i]);
+
+ if (!locResult) {
+ log.println("PropertyName differs for index " + i);
+ log.println("\tGetting: " + props[i].Name);
+ log.println("\tExpected: " + names[i]);
+ }
+
+ res &= locResult;
+ }
+
+ return res;
+ }
+
+ protected boolean checkPropertyTypes(PropertyValue[] props, Type[] types) {
+ boolean res = true;
+
+ for (int i = 0; i < props.length; i++) {
+ Type ValueType = new Type(props[i].Value.getClass());
+ boolean locResult = ValueType.equals(types[i]);
+
+ if (!locResult) {
+ log.println("PropertyType differs for " + props[i].Name);
+ log.println("\tGetting: " + ValueType.getTypeName());
+ log.println("\tExpected: " + types[i].getTypeName());
+ }
+
+ res &= locResult;
+ }
+
+ return res;
+ }
+
+ protected boolean checkA1(String expected) {
+ XCellRange range = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, tEnv.getTestObject());
+ boolean res = false;
+ try{
+ String a1 = range.getCellByPosition(0,0).getFormula();
+ res = a1.equals(expected);
+ if (!res) {
+ log.println("\tResult differs from expectation");
+ log.println("\tGetting: "+a1);
+ log.println("\tExpected: "+expected);
+ } else {
+ log.println("successful");
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't get Cell to check");
+ }
+ return res;
+ }
+
+ /**
+ * Dispose environment.
+ */
+ protected void after() {
+ disposeEnvironment();
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/util/_XIndent.java b/qadevOOo/tests/java/ifc/util/_XIndent.java
new file mode 100644
index 000000000000..a02897b0e3c1
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XIndent.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+import lib.Status;
+import lib.StatusException;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.util.XIndent;
+
+/**
+* Testing <code>com.sun.star.util.XCancellable</code>
+* interface methods :
+* <ul>
+* <li><code> decrementIndent()</code></li>
+* <li><code> incrementIndent()</code></li>
+* </ul> <p>
+* @see com.sun.star.util.XIndent
+*/
+public class _XIndent extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XIndent oObj = null ;
+
+ protected XPropertySet PropSet = null;
+
+ /**
+ * Ensures that the ObjRelation PropSet is given.
+ */
+ public void before() {
+ PropSet = (XPropertySet) tEnv.getObjRelation("PropSet");
+ if (PropSet == null) {
+ throw new StatusException(Status.failed("No PropertySet given"));
+ }
+ }
+
+ /**
+ * Calls the method. <p>
+ * Has <b>OK</b> status if the property 'ParaIndent' is incremented afterwards<p>
+ */
+ public void _incrementIndent() {
+ int oldValue = getIndent();
+ oObj.incrementIndent();
+ int newValue = getIndent();
+ tRes.tested("incrementIndent()", oldValue < newValue) ;
+ }
+
+ /**
+ * Calls the method. <p>
+ * Has <b>OK</b> status if the property 'ParaIndent' is decremented afterwards<p>
+ * requires 'incrementIndent()' to be executed first.
+ */
+ public void _decrementIndent() {
+ requiredMethod("incrementIndent()");
+ int oldValue = getIndent();
+ oObj.decrementIndent();
+ int newValue = getIndent();
+ tRes.tested("decrementIndent()", oldValue > newValue) ;
+ }
+
+ public short getIndent() {
+ short ret = 0;
+ try {
+ ret = ((Short) PropSet.getPropertyValue("ParaIndent")).shortValue();
+ } catch (com.sun.star.beans.UnknownPropertyException upe) {
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ }
+ return ret;
+ }
+
+} // finish class _XCancellable
+
diff --git a/qadevOOo/tests/java/ifc/util/_XMergeable.java b/qadevOOo/tests/java/ifc/util/_XMergeable.java
new file mode 100644
index 000000000000..860811246727
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XMergeable.java
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XMergeable;
+
+
+/**
+ * Testing <code>com.sun.star.util.XMergeable</code>
+ * interface methods :
+ * <ul>
+ * <li><code> merge()</code></li>
+ * <li><code> getIsMerged()</code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XMergeable
+ */
+public class _XMergeable extends MultiMethodTest {
+
+ public XMergeable oObj = null; // oObj filled by MultiMethodTest
+
+ /**
+ * Checks the property <code>IsMerged</code> and sets it
+ * to the opposite value. <p>
+ * Has <b> OK </b> status if the property value has changed. <p>
+ */
+ public void _getIsMerged () {
+
+ boolean isMerged = oObj.getIsMerged();
+ oObj.merge(!isMerged);
+ tRes.tested("getIsMerged()", isMerged != oObj.getIsMerged());
+ }
+
+ /**
+ * Checks the property <code>IsMerged</code> and sets it
+ * to the opposite value. <p>
+ * Has <b> OK </b> status if the property value has changed. <p>
+ */
+ public void _merge () {
+
+ boolean isMerged = oObj.getIsMerged();
+ oObj.merge(!isMerged);
+ tRes.tested("merge()", isMerged != oObj.getIsMerged());
+ }
+} // finisch class _XMergeable
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XModeSelector.java b/qadevOOo/tests/java/ifc/util/_XModeSelector.java
new file mode 100644
index 000000000000..fddf9850ca02
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XModeSelector.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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XModeSelector;
+
+/**
+* Testing <code>com.sun.star.util.XModeSelector</code>
+* interface methods :
+* <ul>
+* <li><code>setMode()</code></li>
+* <li><code>getMode()</code></li>
+* <li><code>getSupportedModes()</code></li>
+* <li><code>supportsMode()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.util.XModeSelector
+*/
+public class _XModeSelector extends MultiMethodTest {
+ public XModeSelector oObj = null;
+
+ String[] supportedModes;
+ /**
+ * Calls the method and as argument pass one of the supported modes
+ * that was returned by method getSupportedMode.<p>
+ * Has <b> OK </b> status if no runtime exceptions occured.
+ */
+ public void _setMode() {
+ requiredMethod("getSupportedModes()");
+ try {
+ oObj.setMode(supportedModes[0]);
+ } catch(com.sun.star.lang.NoSupportException e) {
+ log.println("Method setMode() doesn't support mode '"
+ + supportedModes[0] + "'");
+ tRes.tested("setMode()", false);
+ return ;
+ }
+ tRes.tested("setMode()", true);
+ }
+
+ /**
+ * Calls the method and check returned value.<p>
+ * Has <b> OK </b> status if no runtime exceptions occured
+ * and returned value is equal to value that was set by method setMode.
+ */
+ public void _getMode() {
+ requiredMethod("setMode()");
+ String curMode = oObj.getMode();
+ tRes.tested("getMode()", curMode.equals(supportedModes[0]));
+ }
+
+ /**
+ * Calls the method and checks value returned by method.<p>
+ * Has <b> OK </b> status if no runtime exceptions occured
+ * and returned value is not null.
+ */
+ public void _getSupportedModes() {
+ supportedModes = oObj.getSupportedModes();
+ tRes.tested("getSupportedModes()", supportedModes != null);
+ }
+
+ /**
+ * Calls the method. First one of the supported modes that was returned
+ * by method getSupportedMode is passed as argument.
+ * Then the method is called again and the mode that is certainly not supported
+ * is passed. Checks up returned values in both cases.<p>
+ * Has <b> OK </b> status if no runtime exceptions occured,
+ * returned value is true in first call and is false in second call.
+ */
+ public void _supportsMode() {
+ requiredMethod("getSupportedModes()");
+ boolean result = oObj.supportsMode(supportedModes[0]) &&
+ ! oObj.supportsMode(supportedModes[0] + "_ForTest");
+ tRes.tested("supportsMode()", result);
+ }
+}// finish class _XModeSelector
+
diff --git a/qadevOOo/tests/java/ifc/util/_XModifiable.java b/qadevOOo/tests/java/ifc/util/_XModifiable.java
new file mode 100644
index 000000000000..86f8f8d4b086
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XModifiable.java
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XModifiable;
+
+
+public class _XModifiable extends MultiMethodTest {
+ public XModifiable oObj;
+
+ public void _isModified() {
+ requiredMethod("setModified()");
+ tRes.tested("isModified()", true);
+ }
+
+ public void _setModified() {
+ boolean res = true;
+
+ try {
+ oObj.setModified(true);
+ res = oObj.isModified();
+ oObj.setModified(false);
+ res &= !oObj.isModified();
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ log.println("Exception while using method " + e.getMessage());
+ res = false;
+ }
+
+ tRes.tested("setModified()", res);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/util/_XModifyBroadcaster.java b/qadevOOo/tests/java/ifc/util/_XModifyBroadcaster.java
new file mode 100644
index 000000000000..34ca57c63cfe
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XModifyBroadcaster.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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.util.XModifyBroadcaster;
+import com.sun.star.util.XModifyListener;
+
+/**
+* Testing <code>com.sun.star.util.XModifyBroadcaster</code>
+* interface methods :
+* <ul>
+* <li><code>addModifyListener()</code></li>
+* <li><code>removeModifyListener()</code></li>
+* </ul> <p>
+*
+* Result checking is not performed. Modify
+* listeners are called only in case of
+* interaction with UI. <p>
+*
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.util.XModifyBroadcaster
+*/
+public class _XModifyBroadcaster extends MultiMethodTest {
+ public XModifyBroadcaster oObj = null;
+
+ boolean modified = false;
+
+ protected class TestModifyListener implements XModifyListener {
+ public void disposing ( EventObject oEvent ) {}
+ public void modified (EventObject aEvent ) {
+ modified = true;
+ }
+ }
+
+ private TestModifyListener listener = new TestModifyListener();
+
+ /**
+ * Just calls the method. <p>
+ * Has <b> OK </b> status if no runtime exceptions occured
+ */
+ public void _addModifyListener() {
+ log.println("'Modified' events are called only in case"+
+ " of user interaction.");
+ oObj.addModifyListener(listener);
+ tRes.tested("addModifyListener()", true);
+ }
+
+ /**
+ * Just calls the method. <p>
+ * Has <b> OK </b> status if no runtime exceptions occured
+ */
+ public void _removeModifyListener() {
+ requiredMethod("addModifyListener()");
+ oObj.removeModifyListener(listener);
+ tRes.tested("removeModifyListener()", true);
+ }
+}// finish class _XModifyBroadcaster
+
diff --git a/qadevOOo/tests/java/ifc/util/_XNumberFormatsSupplier.java b/qadevOOo/tests/java/ifc/util/_XNumberFormatsSupplier.java
new file mode 100644
index 000000000000..02595f886b8e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XNumberFormatsSupplier.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.util.XNumberFormats;
+import com.sun.star.util.XNumberFormatsSupplier;
+
+/**
+ * Testing <code>com.sun.star.util.XNumberFormatsSupplier</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getNumberFormatSettings()</code></li>
+ * <li><code> getNumberFormats()</code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XNumberFormatsSupplier
+ */
+public class _XNumberFormatsSupplier extends MultiMethodTest {
+
+ public XNumberFormatsSupplier oObj = null;
+
+ /**
+ * Get format settings and checks some properties for existence. <p>
+ *
+ * Has <b> OK </b> status if a number properties inherent to
+ * <code>NumberFormatSettings</code> service exist in the
+ * returned <code>XPropertySet</code>. <p>
+ *
+ * @see com.sun.star.util.NumberFormatSettings
+ */
+ public void _getNumberFormatSettings() {
+ boolean result = true ;
+ XPropertySet props = oObj.getNumberFormatSettings();
+
+ if (props != null) {
+ try {
+ result &= props.getPropertyValue("NullDate") != null &&
+ props.getPropertyValue("StandardDecimals") != null &&
+ props.getPropertyValue("NoZero") != null &&
+ props.getPropertyValue("TwoDigitDateStart") != null ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Some property doesn't exist") ;
+ e.printStackTrace(log) ;
+ result = false ;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ result = false ;
+ }
+ } else {
+ log.println("Method returns null") ;
+ result = false ;
+ }
+
+ tRes.tested("getNumberFormatSettings()", result) ;
+ }
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _getNumberFormats() {
+ XNumberFormats formats = oObj.getNumberFormats();
+
+ tRes.tested("getNumberFormats()", formats != null) ;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XNumberFormatter.java b/qadevOOo/tests/java/ifc/util/_XNumberFormatter.java
new file mode 100644
index 000000000000..4dab4f5c5b2b
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XNumberFormatter.java
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XNumberFormatter;
+
+
+/**
+ * Testing <code>com.sun.star.util.XNumberFormatter</code>
+ * interface methods :
+ * <ul>
+ * <li><code> attachNumberFormatsSupplier()</code></li>
+ * <li><code> convertNumberToString() </code></li>
+ * <li><code> convertStringToNumber() </code></li>
+ * <li><code> detectNumberFormat() </code></li>
+ * <li><code> formatString() </code></li>
+ * <li><code> getInputString() </code></li>
+ * <li><code> getNumberFormatsSupplier() </code></li>
+ * <li><code> queryColorForNumber() </code></li>
+ * <li><code> queryColorForString() </code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XNumberFormatter
+ */
+public class _XNumberFormatter extends MultiMethodTest {
+
+ public XNumberFormatter oObj = null;
+
+ /**
+ * Not implemented yet.
+ */
+ public void _attachNumberFormatsSupplier() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Tries to convert a number to a string. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _convertNumberToString() {
+ double dValue = 1.56;
+ int key = 15;
+
+ String gString = oObj.convertNumberToString(key,dValue);
+
+ log.println("Getting: "+gString);
+ tRes.tested("convertNumberToString",gString!=null);
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _convertStringToNumber() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _detectNumberFormat() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _formatString() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _getInputString() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _getNumberFormatsSupplier() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _queryColorForNumber() {
+ log.println("Not yet implemented");
+ }
+
+ /**
+ * Not implemented yet.
+ */
+ public void _queryColorForString() {
+ log.println("Not yet implemented");
+ }
+} // finish class _XNumberFormatter
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XProtectable.java b/qadevOOo/tests/java/ifc/util/_XProtectable.java
new file mode 100644
index 000000000000..1e61ee4fa840
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XProtectable.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.util.XProtectable;
+import lib.MultiMethodTest;
+
+/**
+ * Check the XProtectable interface.
+ */
+public class _XProtectable extends MultiMethodTest {
+ public XProtectable oObj = null;
+ String sPassWord = "TopSecret";
+
+ /**
+ * Check, if the sheet is protected.
+ * Has OK status, if this is the case.
+ */
+ public void _isProtected() {
+ requiredMethod("protect()");
+ boolean result = oObj.isProtected();
+ tRes.tested("isProtected()", result);
+ }
+
+ /**
+ * Protect the sheet
+ */
+ public void _protect() {
+ oObj.protect(sPassWord);
+ tRes.tested("protect()", true);
+ }
+
+ /**
+ * Unprotect with wrong password, see if it's still protected.
+ * Unprotect with correct password, see if it's unprotected.
+ */
+ public void _unprotect() {
+ requiredMethod("isProtected()");
+ boolean result = true;
+ try {
+ oObj.unprotect("WrongPassword");
+// result = false;
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Correct Exception thrown.");
+ }
+ // just check if it's still protected
+ result &= oObj.isProtected();
+ try {
+ oObj.unprotect(sPassWord);
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Wrong Exception thrown: password is correct.");
+ result = false;
+ }
+ result &= !oObj.isProtected();
+ tRes.tested("unprotect()", result);
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/util/_XRefreshable.java b/qadevOOo/tests/java/ifc/util/_XRefreshable.java
new file mode 100644
index 000000000000..7b1eb0ad0db5
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XRefreshable.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XRefreshListener;
+import com.sun.star.util.XRefreshable;
+
+/**
+* Testing <code>com.sun.star.util.XRefreshable</code>
+* interface methods :
+* <ul>
+* <li><code> refresh()</code></li>
+* <li><code> addRefreshListener()</code></li>
+* <li><code> removeRefreshListener()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.util.XRefreshable
+*/
+public class _XRefreshable extends MultiMethodTest {
+
+ public XRefreshable oObj = null;
+
+ final boolean listenerCalled[] = new boolean[1];
+
+
+ /**
+ * <code>XRefreshListener</code> implementation which
+ * sets a flag when <code>refreshed</code> method is
+ * called.
+ */
+ public class MyRefreshListener implements XRefreshListener {
+ public void refreshed (com.sun.star.lang.EventObject e) {
+ listenerCalled[0] = true;
+ }
+
+ public void disposing (com.sun.star.lang.EventObject obj) {}
+ }
+
+ XRefreshListener listener = new MyRefreshListener();
+
+ /**
+ * Just adds a listener. <p>
+ * Always has <b>OK</b> status.
+ */
+ public void _addRefreshListener() {
+
+ oObj.addRefreshListener(listener) ;
+ tRes.tested("addRefreshListener()", true);
+ }
+
+ /**
+ * Calls the method and checks if the listener was called. <p>
+ * Has <b>OK</b> status if listener's flag is set after call.
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> addRefreshListener </code> : to have a listener added.</li>
+ * </ul>
+ */
+ public void _refresh() {
+
+ requiredMethod("addRefreshListener()");
+
+ oObj.refresh();
+
+ tRes.tested("refresh()", listenerCalled[0]);
+ if (!listenerCalled[0])
+ log.println("RefreshListener wasn't called after refresh");
+
+ }
+
+ /**
+ * Removes the listener added before and calls <code>refresh</code>
+ * method. Listener must not be called. <p>
+ * Has <b>OK</b> status if listener's flag isn't changed.
+ * <ul>
+ * <li> <code> refresh </code> : listener added must be already
+ * tested.</li>
+ * </ul>
+ */
+ public void _removeRefreshListener() {
+ requiredMethod("refresh()");
+ listenerCalled[0] = false;
+
+ oObj.removeRefreshListener(listener) ;
+ oObj.refresh();
+
+ tRes.tested("removeRefreshListener()", !listenerCalled[0]);
+ if (listenerCalled[0])
+ log.println("RefreshListener was called after removing");
+ }
+} // finish class _XRefreshable
+
diff --git a/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java b/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java
new file mode 100644
index 000000000000..e4a3a5c2ba56
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XReplaceDescriptor;
+
+/**
+ * Testing <code>com.sun.star.util.XReplaceDescriptor</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getReplaceString()</code></li>
+ * <li><code> setReplaceString()</code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XReplaceDescriptor
+ */
+public class _XReplaceDescriptor extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XReplaceDescriptor oObj = null;
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _getReplaceString(){
+ log.println("test for getReplaceString() ");
+ tRes.tested("getReplaceString()", oObj.getReplaceString()!=null);
+ }
+
+ /**
+ * Set a new string and checks the result. <p>
+ * Has <b> OK </b> status if the string before setting differs
+ * from string after setting. <p>
+ */
+ public void _setReplaceString(){
+ log.println("test for setReplaceString() ");
+ String oldReplaceStr = oObj.getReplaceString();
+ oObj.setReplaceString("XReplaceDescriptor");
+ String cmpReplaceStr = oObj.getReplaceString();
+ tRes.tested("setReplaceString()", !(cmpReplaceStr.equals(oldReplaceStr)));
+ return;
+ }
+
+} // finish class _XReplaceDescriptor
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XReplaceable.java b/qadevOOo/tests/java/ifc/util/_XReplaceable.java
new file mode 100644
index 000000000000..9f2a801cfcbf
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XReplaceable.java
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.table.XCell;
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XReplaceDescriptor;
+import com.sun.star.util.XReplaceable;
+import com.sun.star.util.XSearchDescriptor;
+
+/**
+ * Testing <code>com.sun.star.util.XReplaceable</code>
+ * interface methods :
+ * <ul>
+ * <li><code> createReplaceDescriptor()</code></li>
+ * <li><code> replaceAll()</code></li>
+ * </ul> <p>
+ *
+ * The requipment for the tested object is that it
+ * <b>must containt</b> string 'xTextDoc'. Only
+ * in that case this interface is tested correctly. <p>
+ *
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XReplaceable
+ */
+public class _XReplaceable extends MultiMethodTest {
+
+ public XReplaceable oObj = null;
+ public XReplaceDescriptor Rdesc = null;
+ private String mSearchString = "xTextDoc";
+ private String mReplaceString = "** xTextDoc";
+ private boolean mDispose = false;
+
+ /**
+ * Creates an entry to search for, if the current object does not provide
+ * one. In this case, the environment is disposed after the test, since
+ * the inserted object may influence following tests.
+ *
+ */
+ protected void before() {
+ Object o = tEnv.getObjRelation("SEARCHSTRING");
+ if (o != null) {
+ mSearchString = (String)o;
+ }
+ // use object relation for XSearchable
+ o = tEnv.getObjRelation("XSearchable.MAKEENTRYINCELL");
+ if (o != null) {
+ XCell[] cells = new XCell[0];
+ if (o instanceof XCell) {
+ cells = new XCell[]{(XCell)o};
+ }
+ else if (o instanceof XCell[]) {
+ cells = (XCell[])o;
+ }
+ else {
+ log.println("Needed object relation 'XSearchable.MAKEENTRYINCELL' is there, but is of type '"
+ + o.getClass().getName() + "'. Should be 'XCell' or 'XCell[]' instead.");
+ }
+ for (int i=0; i<cells.length; i++) {
+ cells[i].setFormula(mSearchString);
+ }
+ mDispose = true;
+ }
+ }
+
+ /**
+ * Creates the descriptor for replacing string 'xTextDoc'
+ * with string '** xTextDoc'. <p>
+ * Has <b> OK </b> status if the returned descriptor is not
+ * <code>null</code>. <p>
+ */
+ public void _createReplaceDescriptor() {
+
+ log.println("testing createReplaceDescriptor() ... ");
+
+ Rdesc = oObj.createReplaceDescriptor();
+ Rdesc.setSearchString(mSearchString);
+ Rdesc.setReplaceString(mReplaceString);
+ tRes.tested("createReplaceDescriptor()", Rdesc != null);
+
+ }
+
+ /**
+ * Replaces the text using descriptor created before. Then
+ * search is performed in the target text. <p>
+ *
+ * Has <b> OK </b> status if the string '**' is found in
+ * the text. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> createReplaceDescriptor() </code> : replace
+ * descriptor is created. </li>
+ * </ul>
+ */
+ public void _replaceAll() {
+ requiredMethod("createReplaceDescriptor()");
+ oObj.replaceAll(Rdesc);
+ XSearchDescriptor SDesc = oObj.createSearchDescriptor();
+ SDesc.setSearchString("**");
+ boolean res = (oObj.findFirst(SDesc) != null);
+ // redo replacement
+ Rdesc.setSearchString(mReplaceString);
+ Rdesc.setReplaceString(mSearchString);
+ oObj.replaceAll(Rdesc);
+ res &= (oObj.findFirst(SDesc) == null);
+
+ tRes.tested("replaceAll()",res);
+ }
+
+ /**
+ * In case the interface itself made the entry to search for, the environment
+ * must be disposed
+ */
+ protected void after() {
+ if(mDispose) {
+ disposeEnvironment();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java b/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java
new file mode 100644
index 000000000000..4b9b8e14abee
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XSearchDescriptor;
+
+/**
+ * Testing <code>com.sun.star.util.XSearchDescriptor</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getSearchString()</code></li>
+ * <li><code> setSearchString()</code></li>
+ * </ul> <p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XSearchDescriptor
+ */
+public class _XSearchDescriptor extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XSearchDescriptor oObj = null;
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _getSearchString(){
+ boolean bResult = false;
+ String searchStr = null;
+
+ log.println("test for getSearchString() ");
+ searchStr = oObj.getSearchString();
+
+ if (!(searchStr == null)){ bResult = true; }
+ tRes.tested("getSearchString()", bResult);
+ }
+
+ /**
+ * Set a new string and checks the result. <p>
+ * Has <b> OK </b> status if the string before setting differs
+ * from string after setting. <p>
+ */
+ public void _setSearchString(){
+ boolean bResult = false;
+ String oldSearchStr = null;
+ String cmpSearchStr = null;
+ String newSearchStr = "_XSearchDescriptor";
+ log.println("test for setSearchString() ");
+
+ oldSearchStr = oObj.getSearchString();
+ oObj.setSearchString(newSearchStr);
+ cmpSearchStr = oObj.getSearchString();
+
+ if(!(cmpSearchStr.equals(oldSearchStr))){ bResult = true; }
+ //oObj.setSearchString(oldSearchStr);
+ tRes.tested("setSearchString()", bResult);
+ }
+
+} // finish class _XSearchDescriptor
+
diff --git a/qadevOOo/tests/java/ifc/util/_XSearchable.java b/qadevOOo/tests/java/ifc/util/_XSearchable.java
new file mode 100644
index 000000000000..91c3014387df
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XSearchable.java
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.table.XCell;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.util.XSearchable;
+
+/**
+ * Testing <code>com.sun.star.util.XSearchable</code>
+ * interface methods :
+ * <ul>
+ * <li><code> createSearchDescriptor()</code></li>
+ * <li><code> findAll()</code></li>
+ * <li><code> findFirst()</code></li>
+ * <li><code> findNext()</code></li>
+ * </ul> <p>
+ *
+ * The requipment for the tested object is that it
+ * <b>must containt</b> string 'xTextDoc'. Only
+ * in that case this interface is tested correctly. <p>
+ *
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XSearchable
+ */
+public class _XSearchable extends MultiMethodTest {
+
+ public XSearchable oObj = null; // oObj filled by MultiMethodTest
+ public XSearchDescriptor Sdesc = null;
+ public Object start = null;
+ private String mSearchString = "xTextDoc";
+ private boolean mDispose = false;
+ private boolean mExcludeFindNext = false;
+
+ /**
+ * Creates an entry to search for, if the current object does not provide
+ * one. In this case, the environment is disposed after the test, since
+ * the inserted object may influence following tests.
+ *
+ */
+ protected void before() {
+ Object o = tEnv.getObjRelation("SEARCHSTRING");
+ if (o != null) {
+ mSearchString = (String)o;
+ }
+ o = tEnv.getObjRelation("XSearchable.MAKEENTRYINCELL");
+ if (o != null) {
+ XCell[] cells = new XCell[0];
+ if (o instanceof XCell) {
+ cells = new XCell[]{(XCell)o};
+ }
+ else if (o instanceof XCell[]) {
+ cells = (XCell[])o;
+ }
+ else {
+ log.println("Needed object relation 'XSearchable.MAKEENTRYINCELL' is there, but is of type '"
+ + o.getClass().getName() + "'. Should be 'XCell' or 'XCell[]' instead.");
+ }
+ for (int i=0; i<cells.length; i++) {
+ cells[i].setFormula(mSearchString);
+ }
+ mDispose = true;
+ }
+ mExcludeFindNext = (tEnv.getObjRelation("EXCLUDEFINDNEXT")==null)?false:true;
+ }
+
+ /**
+ * Creates the search descriptor which searches for
+ * 'xTextDoc' string. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _createSearchDescriptor() {
+
+ log.println("testing createSearchDescriptor() ... ");
+
+ Sdesc = oObj.createSearchDescriptor();
+ Sdesc.setSearchString(mSearchString);
+ tRes.tested("createSearchDescriptor()", Sdesc != null);
+
+ }
+
+ /**
+ * Performs search using descriptor created before. <p>
+ * Has <b> OK </b> status if the method not <code>null</code>
+ * collections. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> createSearchDescriptor() </code> : creates the descriptor
+ * required for search. </li>
+ * </ul>
+ */
+ public void _findAll() {
+
+ requiredMethod("createSearchDescriptor()");
+ log.println("testing findAll()");
+
+ XIndexAccess IA = oObj.findAll(Sdesc);
+ tRes.tested("findAll()", IA != null);
+ }
+
+ /**
+ * Performs search using descriptor created before. Storing the
+ * first occurence result. <p>
+ * Has <b> OK </b> status if the method not <code>null</code>
+ * value. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> createSearchDescriptor() </code> : creates the descriptor
+ * required for search. </li>
+ * </ul>
+ */
+ public void _findFirst() {
+
+ requiredMethod("createSearchDescriptor()");
+ log.println("testing findFirst()");
+ start = oObj.findFirst(Sdesc);
+ tRes.tested("findFirst()", start != null);
+ }
+
+ /**
+ * Performs search using descriptor and first search result
+ * created before. <p>
+ * Has <b> OK </b> status if the method not <code>null</code>
+ * value. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> findFirst() </code> : to have first search result. </li>
+ * </ul>
+ */
+ public void _findNext() {
+ if (mExcludeFindNext) {
+ log.println("Testing findNext() excluded, because only one" +
+ " search result is available.");
+ tRes.tested("findNext()", true);
+ }
+ else{
+ requiredMethod("findFirst()");
+
+ log.println("testing findNext()");
+ Object xI = oObj.findNext(start,Sdesc);
+ tRes.tested("findNext()", xI != null);
+ }
+ }
+
+ /**
+ * In case the interface itself made the entry to search for, the environment
+ * must be disposed
+ */
+ protected void after() {
+ if(mDispose) {
+ disposeEnvironment();
+ }
+ }
+}
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XSortable.java b/qadevOOo/tests/java/ifc/util/_XSortable.java
new file mode 100644
index 000000000000..f0d78305420d
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XSortable.java
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import java.io.PrintWriter;
+
+import lib.MultiMethodTest;
+import lib.Status;
+import lib.StatusException;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.table.TableSortField;
+import com.sun.star.util.XSortable;
+
+
+/**
+ * Testing <code>com.sun.star.util.XSortable</code>
+ * interface methods :
+ * <ul>
+ * <li><code> createSortDescriptor()</code></li>
+ * <li><code> sort()</code></li>
+ * </ul> <p>
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'SORTCHECKER'</code> : <code>
+* _XSortable.XSortChecker</code> interface implementation
+ * </li>
+ * <ul><p>
+ * Test is <b> NOT </b> multithread compilant. <p>
+ * @see com.sun.star.util.XSortable
+ */
+public class _XSortable extends MultiMethodTest {
+ // oObj filled by MultiMethodTest
+ public XSortable oObj = null;
+ XSortChecker checker = null;
+ PropertyValue[] oPV = null;
+
+ protected void before() {
+ checker = (XSortChecker) tEnv.getObjRelation("SORTCHECKER");
+
+ if (checker == null) {
+ throw new StatusException(Status.failed(
+ "Couldn't get relation 'SORTCHECKER'"));
+ }
+
+ checker.setPrintWriter(log);
+ }
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the length of the returned array
+ * is greater than zero. <p>
+ */
+ public void _createSortDescriptor() {
+ boolean bResult = false;
+
+ log.println("test for createSortDescriptor() ");
+ oPV = oObj.createSortDescriptor();
+
+ if (oPV.length > 0) {
+ bResult = true;
+
+ for (int k = 0; k < oPV.length; k++) {
+ log.println("DescriptorProperty " + k + ": Name=" +
+ oPV[k].Name + "; Value=" + oPV[k].Value);
+
+ if (oPV[k].Name.equals("SortFields")) {
+ TableSortField[] tsf = (TableSortField[]) oPV[k].Value;
+
+ for (int l = 0; l < tsf.length; l++) {
+ log.println("\t isAscending: " +
+ tsf[l].IsAscending);
+ log.println("\t IsCaseSensitive: " +
+ tsf[l].IsCaseSensitive);
+ log.println("\t CollatorAlgorithm: " +
+ tsf[l].CollatorAlgorithm);
+ }
+ }
+ }
+ }
+
+ log.println("Found " + oPV.length + " PropertyValues");
+ tRes.tested("createSortDescriptor()", bResult);
+ }
+
+ /**
+ * Test calls the method using descriptor created before as
+ * parameter. <p>
+ * Has <b> OK </b> status if the method successfully returns
+ * and no exceptions were thrown. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> createSortDescriptor() </code> : to have a descriptor
+ * for sort. </li>
+ * </ul>
+ */
+ public void _sort() {
+
+ checker.prepareToSort();
+
+ log.println(
+ "############## Sort algorithm: Alphanumeric Order: Ascending");
+ modifyDescriptor(false, true);
+ oObj.sort(oPV);
+
+ boolean res = checker.checkSort(false, true);
+ log.println(
+ "############################################################");
+
+ log.println(
+ "############# Sort algorithm: Alphanumeric Order: Descending");
+ modifyDescriptor(false, false);
+ oObj.sort(oPV);
+ res = checker.checkSort(false, false);
+ log.println(
+ "############################################################");
+
+ log.println(
+ "################# Sort algorithm: Numeric Order: Ascending");
+ modifyDescriptor(true, true);
+ oObj.sort(oPV);
+ res = checker.checkSort(true, true);
+ log.println(
+ "############################################################");
+
+ log.println(
+ "################## Sort algorithm: Numeric Order: Descending");
+ modifyDescriptor(true, false);
+ oObj.sort(oPV);
+ res = checker.checkSort(true, false);
+ log.println(
+ "############################################################");
+
+ tRes.tested("sort()", res);
+ }
+
+ protected void modifyDescriptor(boolean isSortNumeric,
+ boolean isSortAscending) {
+ for (int i = 0; i < oPV.length; i++) {
+ if (oPV[i].Name.equals("SortFields")) {
+ TableSortField[] TableFields = (TableSortField[]) oPV[i].Value;
+
+ if (TableFields.length == 0) {
+ TableFields = new TableSortField[1];
+ TableFields[0] = new TableSortField();
+ }
+
+ for (int k = 0; k < TableFields.length; k++) {
+ TableFields[k].IsAscending = isSortAscending;
+
+ if (isSortNumeric) {
+ TableFields[k].FieldType = com.sun.star.table.TableSortFieldType.NUMERIC;
+ TableFields[k].CollatorAlgorithm = "numeric";
+ } else {
+ TableFields[k].FieldType = com.sun.star.table.TableSortFieldType.ALPHANUMERIC;
+ TableFields[k].CollatorAlgorithm = "alphanumeric";
+ }
+ }
+
+ oPV[i].Value = TableFields;
+ }
+
+ if (oPV[i].Name.equals("isSortInTable")) {
+ oPV[i].Value = new Boolean(true);
+ }
+
+ if (oPV[i].Name.equals("IsSortColumns")) {
+ oPV[i].Value = new Boolean(false);
+ }
+ }
+
+ log.println("Modified sort descriptor: ");
+
+ if (oPV.length > 0) {
+ for (int k = 0; k < oPV.length; k++) {
+ log.println("DescriptorProperty " + k + ": Name=" +
+ oPV[k].Name + "; Value=" + oPV[k].Value);
+
+ if (oPV[k].Name.equals("SortFields")) {
+ TableSortField[] tsf = (TableSortField[]) oPV[k].Value;
+
+ for (int l = 0; l < tsf.length; l++) {
+ log.println("\t isAscending: " +
+ tsf[l].IsAscending);
+ log.println("\t IsCaseSensitive: " +
+ tsf[l].IsCaseSensitive);
+ log.println("\t CollatorAlgorithm: " +
+ tsf[l].CollatorAlgorithm);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * The interface for sort checking.
+ */
+ public static interface XSortChecker {
+ public void prepareToSort();
+
+ public boolean checkSort(boolean isSortNumbering,
+ boolean isSortAscending);
+
+ public void setPrintWriter(PrintWriter log);
+ }
+
+ /**
+ * Forces environment recreation.
+ */
+ protected void after() {
+ disposeEnvironment();
+ }
+
+} // finish class _XSortable
diff --git a/qadevOOo/tests/java/ifc/util/_XStringEscape.java b/qadevOOo/tests/java/ifc/util/_XStringEscape.java
new file mode 100644
index 000000000000..4673526fc243
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XStringEscape.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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.XStringEscape;
+
+public class _XStringEscape extends MultiMethodTest {
+
+ public XStringEscape oObj;
+
+ public void _escapeString() {
+ log.println("The Implementation of this Interface doesn't really do anything");
+ boolean res = true;
+ try {
+ String toCheck = ";:<>/*";
+ String eString = oObj.escapeString(toCheck);
+ res = toCheck.equals(eString);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("IllegalArgument");
+ }
+ tRes.tested("escapeString()",res);
+ }
+
+ public void _unescapeString() {
+ log.println("The Implementation of this Interface doesn't really do anything");
+ boolean res = true;
+ try {
+ String toCheck = ";:<>/*";
+ String ueString = oObj.unescapeString(toCheck);
+ res = toCheck.equals(ueString);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("IllegalArgument");
+ }
+ tRes.tested("unescapeString()",res);
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/util/_XStringSubstitution.java b/qadevOOo/tests/java/ifc/util/_XStringSubstitution.java
new file mode 100644
index 000000000000..aed62619f41e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XStringSubstitution.java
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.util.XStringSubstitution;
+import lib.MultiMethodTest;
+
+public class _XStringSubstitution extends MultiMethodTest {
+
+ public XStringSubstitution oObj;
+
+ public void _getSubstituteVariableValue() {
+ boolean res = true;
+ try {
+ log.println("try to get the valid variable $(user) ...");
+ String toCheck = "$(user)";
+ String eString = oObj.getSubstituteVariableValue(toCheck);
+ res = eString.startsWith("file:///");
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("$(user) does not exist");
+ tRes.tested("getSubstituteVariableValue()",false);
+ }
+ try {
+ log.println("try to get a invalid variable...");
+ String toCheck = "$(ThisVariableShouldNoExist)";
+ String eString = oObj.getSubstituteVariableValue(toCheck);
+ log.println("$(ThisVariableShouldNoExist) should not exist");
+ tRes.tested("getSubstituteVariableValue()",false);
+
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("expected exception was thrown.");
+ res &= true;
+ }
+
+ tRes.tested("getSubstituteVariableValue()",res);
+ }
+
+ public void _substituteVariables() {
+ boolean res = true;
+ try {
+ log.println("try to get a valid variable...");
+ String toCheck = "$(user)";
+ String eString = oObj.substituteVariables(toCheck, false);
+ log.println(eString);
+ res = eString.startsWith("file:///");
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("$(user) does not exist");
+ tRes.tested("substituteVariables()",false);
+ }
+ try {
+ log.println("try to get a invalid variable...");
+ String toCheck = "$(ThisVariableShouldNoExist)";
+ String eString = oObj.substituteVariables(toCheck,true);
+ log.println("$(ThisVariableShouldNoExist) should not exist");
+ tRes.tested("substituteVariables()",false);
+
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("expected exception was thrown.");
+ res &= true;
+ }
+
+ tRes.tested("substituteVariables()",res);
+ }
+
+ public void _reSubstituteVariables() {
+ boolean res = true;
+ log.println("try to get a valid variable...");
+ String toCheck = "file:///";
+ String eString = oObj.reSubstituteVariables(toCheck);
+ log.println(eString);
+ res = eString.startsWith("file:///");
+
+ tRes.tested("reSubstituteVariables()",res);
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/util/_XTextSearch.java b/qadevOOo/tests/java/ifc/util/_XTextSearch.java
new file mode 100644
index 000000000000..4f701c087f71
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XTextSearch.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.util.SearchAlgorithms;
+import com.sun.star.util.SearchFlags;
+import com.sun.star.util.SearchOptions;
+import com.sun.star.util.SearchResult;
+import com.sun.star.util.XTextSearch;
+
+/**
+* Testing <code>com.sun.star.util.XTextSearch</code>
+* interface methods :
+* <ul>
+* <li><code> setOptions()</code></li>
+* <li><code> searchForward()</code></li>
+* <li><code> searchBackward()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.util.XTextSearch
+*/
+public class _XTextSearch extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XTextSearch oObj = null ;
+
+ protected final String str = "acababaabcababadcdaa" ;
+ protected final int startPos = 2 , endPos = 20 ;
+ protected final String searchStr = "(ab)*a(c|d)+" ;
+ protected final int fStartRes = 10, fEndRes = 18 ;
+ protected final int bStartRes = 18, bEndRes = 14 ;
+
+ /**
+ * Sets options for searching regular expression in a string,
+ * ignoring case. <p>
+ * Has <b>OK</b> status if no runtime exceptions occured.
+ */
+ public void _setOptions() {
+
+ SearchOptions opt = new SearchOptions() ;
+ opt.algorithmType = SearchAlgorithms.REGEXP ;
+ opt.searchFlag = SearchFlags.ALL_IGNORE_CASE ;
+ opt.searchString = searchStr ;
+
+ oObj.setOptions(opt) ;
+
+ tRes.tested("setOptions()", true) ;
+ }
+
+
+ /**
+ * Tries to find a substring matching regular expression. <p>
+ * Has <b>OK</b> if the correct substring position returned.
+ */
+ public void _searchForward() {
+ requiredMethod("setOptions()") ;
+
+ SearchResult res = oObj.searchForward(str, startPos, endPos) ;
+
+ log.println("Result of searching '" + searchStr + "' substring in \n'" +
+ str + "' string (" + res.subRegExpressions + " matches):") ;
+
+ for (int i = 0; i < res.subRegExpressions; i++)
+ log.println(" (" + res.startOffset[i] + ", " + res.endOffset[i] + ")") ;
+
+ tRes.tested("searchForward()", res.subRegExpressions > 0 &&
+ res.startOffset[0] == fStartRes && res.endOffset[0] == fEndRes) ;
+ }
+
+ /**
+ * Tries to find a substring matching regular expression walking
+ * backward. <p>
+ * Has <b>OK</b> if the correct substring position returned.
+ */
+ public void _searchBackward() {
+ requiredMethod("setOptions()") ;
+
+ SearchResult res = oObj.searchBackward(str, endPos, startPos) ;
+
+ log.println("Result of searching '" + searchStr + "' substring in \n'" +
+ str + "' string (" + res.subRegExpressions + " matches):") ;
+
+ for (int i = 0; i < res.subRegExpressions; i++)
+ log.println(" (" + res.startOffset[i] + ", " + res.endOffset[i] + ")") ;
+
+ tRes.tested("searchBackward()", res.subRegExpressions > 0 &&
+ res.startOffset[0] == bStartRes && res.endOffset[0] == bEndRes) ;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/ifc/util/_XURLTransformer.java b/qadevOOo/tests/java/ifc/util/_XURLTransformer.java
new file mode 100644
index 000000000000..e847a9d3132c
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/util/_XURLTransformer.java
@@ -0,0 +1,471 @@
+/*************************************************************************
+ *
+ * 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 ifc.util;
+
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+import lib.MultiMethodTest;
+
+/**
+* Testing <code>com.sun.star.util.XURLTransformer</code>
+* interface methods :
+* <ul>
+* <li><code> assemble() </code></li>
+* <li><code> parseStrict() </code></li>
+* <li><code> parseSmart() </code></li>
+* <li><code> getPresentation() </code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.util.XURLTransformer
+*/
+public class _XURLTransformer extends MultiMethodTest {
+
+ public XURLTransformer oObj = null;
+
+ URL url;
+
+ final static String user = "user";
+ final static String invalidUserPrefix = "1";
+ final static String password = "password";
+ final static String server = "server";
+ final static String invalidServerPrefix = "1";
+ final static String port = "8080";
+ final static String path = "/pub/path";
+ final static String name = "file.txt";
+ final static String arguments = "a=b";
+ final static String mark = "mark";
+
+ final static String expectedCompleteHTTP = "http://"
+ + server + ":" + port + path
+ + "/" + name + "?" + arguments + "#" + mark;
+ final static String expectedCompleteFTP = "ftp://"
+ + user + ":" + password + "@" + server + ":" + port + path
+ + "/" + name;
+
+ /**
+ * First the complete URL (all URL fields are filled) is
+ * passed and assembled. Then incomplete URL (only
+ * <code>Server</code> field is set) is passed. <p>
+ * Has <b> OK </b> status if in the first case <code>true</code>
+ * retruned and <code>Complete</code> field is set and in the
+ * second case <code>false</code> is returned. <p>
+ */
+ public void _assemble(){
+ URL[] url = new URL[1];
+ url[0] = new URL();
+
+ url[0].Protocol = "http://";
+ url[0].Server = server;
+ url[0].Port = new Integer(port).shortValue();
+ url[0].Path = path;
+ url[0].Name = name;
+ url[0].Arguments = arguments;
+ url[0].Mark = mark;
+ url[0].Main = "http://" + server + ":" +
+ port + path + "/" + name;
+
+ boolean res = true;
+
+ log.print("assemble http-URL: ");
+ boolean complete = oObj.assemble(url);
+ log.println(complete);
+ res &= complete;
+
+ if (!expectedCompleteHTTP.equals(url[0].Complete)) {
+ log.println("assemble works wrong");
+ log.println("complete field : " + url[0].Complete);
+ log.println("expected : " + expectedCompleteHTTP);
+ res = false;
+ }
+
+ url[0] = new URL();
+ url[0].Protocol = "ftp://";
+ url[0].User = user;
+ url[0].Password = password;
+ url[0].Server = server;
+ url[0].Port = new Integer(port).shortValue();
+ url[0].Path = path;
+ url[0].Name = name;
+ url[0].Main = "ftp://" + user + ":" + password + "@" + server + ":" +
+ port + path + "/" + name;
+
+ log.print("assemble ftp-URL: ");
+ complete = oObj.assemble(url);
+ log.println(complete);
+ res &= complete;
+
+ if (!expectedCompleteFTP.equals(url[0].Complete)) {
+ log.println("assemble works wrong");
+ log.println("complete field : " + url[0].Complete);
+ log.println("expected : " + expectedCompleteFTP);
+ res = false;
+ }
+
+ URL[] incompleteUrl = new URL[1];
+ incompleteUrl[0] = new URL();
+ incompleteUrl[0].Server = server;
+
+ log.print("assemble incomplete URL: ");
+ complete = oObj.assemble(incompleteUrl);
+ log.println(complete);
+ res &= !complete;
+
+ // should be incomplete
+ tRes.tested("assemble()", res);
+ }
+
+ /**
+ * First the complete URL (<code>Complete</code> field is set
+ * to proper URL) is passed and parsed. Then incomplete URL (only
+ * <code>Server</code> field is set) is passed. <p>
+ * Has <b> OK </b> status if in the first case <code>true</code>
+ * retruned and all URL fields are set to proper values and in the
+ * second case <code>false</code> is returned. <p>
+ */
+ public void _parseStrict() {
+ URL[] url = new URL[1];
+
+ url[0] = new URL();
+ url[0].Complete = expectedCompleteHTTP;
+
+ boolean res = true;
+ log.print("parseStrict(" + expectedCompleteHTTP + "): ");
+ boolean complete = oObj.parseStrict(url);
+ log.println(complete);
+ res &= complete;
+
+ if (!url[0].Protocol.equals("http://")) {
+ log.println("parseStrict works wrong");
+ log.println("protocol field : " + url[0].Protocol);
+ log.println("expected : http://");
+ res = false;
+ }
+
+ if (!url[0].Server.equals(server)) {
+ log.println("parseStrict works wrong");
+ log.println("server field : " + url[0].Server);
+ log.println("expected : " + server);
+ res = false;
+ }
+
+ if (url[0].Port != new Integer(port).shortValue()) {
+ log.println("parseStrict works wrong");
+ log.println("port field : " + url[0].Port);
+ log.println("expected : " + port);
+ res = false;
+ }
+
+ if ((!url[0].Path.equals(path)) && (!url[0].Path.equals(path + "/"))) {
+ log.println("parseStrict works wrong");
+ log.println("path field : " + url[0].Path);
+ log.println("expected : " + path);
+ res = false;
+ }
+
+ if (!url[0].Name.equals(name)) {
+ log.println("parseStrict works wrong");
+ log.println("name field : " + url[0].Name);
+ log.println("expected : " + name);
+ res = false;
+ }
+
+ if (!url[0].Arguments.equals(arguments)) {
+ log.println("parseStrict works wrong");
+ log.println("arguments field : " + url[0].Arguments);
+ log.println("expected : " + arguments);
+ res = false;
+ }
+
+ if (!url[0].Mark.equals(mark)) {
+ log.println("parseStrict works wrong");
+ log.println("mark field : " + url[0].Mark);
+ log.println("expected : " + mark);
+ res = false;
+ }
+
+ url[0] = new URL();
+ url[0].Complete = expectedCompleteFTP;
+
+ log.print("parseStrict(" + expectedCompleteFTP + "): ");
+ complete = oObj.parseStrict(url);
+ log.println(complete);
+ res &= complete;
+
+ if (!url[0].Protocol.equals("ftp://")) {
+ log.println("parseStrict works wrong");
+ log.println("protocol field : " + url[0].Protocol);
+ log.println("expected : ftp://");
+ res = false;
+ }
+
+ if (!url[0].User.equals(user)) {
+ log.println("parseStrict works wrong");
+ log.println("user field : " + url[0].User);
+ log.println("expected : " + user);
+ res = false;
+ }
+
+ if (!url[0].Password.equals(password)) {
+ log.println("parseStrict works wrong");
+ log.println("password field : " + url[0].Password);
+ log.println("expected : " + password);
+ res = false;
+ }
+
+ if (!url[0].Server.equals(server)) {
+ log.println("parseStrict works wrong");
+ log.println("server field : " + url[0].Server);
+ log.println("expected : " + server);
+ res = false;
+ }
+
+ if (url[0].Port != new Integer(port).shortValue()) {
+ log.println("parseStrict works wrong");
+ log.println("port field : " + url[0].Port);
+ log.println("expected : " + port);
+ res = false;
+ }
+
+ if ((!url[0].Path.equals(path)) && (!url[0].Path.equals(path + "/"))) {
+ log.println("parseStrict works wrong");
+ log.println("path field : " + url[0].Path);
+ log.println("expected : " + path);
+ res = false;
+ }
+
+ if (!url[0].Name.equals(name)) {
+ log.println("parseStrict works wrong");
+ log.println("name field : " + url[0].Name);
+ log.println("expected : " + name);
+ res = false;
+ }
+
+ URL[] incompleteUrl = new URL[1];
+ incompleteUrl[0] = new URL();
+ incompleteUrl[0].Complete = server;
+
+ log.print("parseStrict(" + server + "): ");
+ complete = oObj.parseStrict(incompleteUrl);
+ log.println(complete);
+ // should be incomplete
+ res &= !complete;
+
+ tRes.tested("parseStrict()", res);
+ }
+
+ /**
+ * Tries to parse WWW server name. <p>
+ * Has <b> OK </b> status if the method return <code>true</code>
+ * value and <code>Protocol, Server, Port</code> URL fields are
+ * set properly.
+ */
+ public void _parseSmart() {
+ URL[] url = new URL[1];
+
+ String httpURL = invalidServerPrefix + server + ":" + port + path + "/" + name + "?" +
+ arguments + "#" + mark;
+
+ url[0] = new URL();
+ url[0].Complete = httpURL;
+
+ boolean res = true;
+ log.print("parseSmart('" + httpURL + "', 'http://'): ");
+ boolean complete = oObj.parseSmart(url, "http://");
+ log.println(complete);
+ res &= complete;
+
+ if (!url[0].Protocol.equals("http://")) {
+ log.println("parseSmart works wrong");
+ log.println("protocol field : " + url[0].Protocol);
+ log.println("expected : http://");
+ res = false;
+ }
+
+ if (!url[0].Server.equals(invalidServerPrefix+server)) {
+ log.println("parseSmart works wrong");
+ log.println("server field : " + url[0].Server);
+ log.println("expected : " + server);
+ res = false;
+ }
+
+ if (url[0].Port != new Integer(port).shortValue()) {
+ log.println("parseSmart works wrong");
+ log.println("port field : " + url[0].Port);
+ log.println("expected : " + port);
+ res = false;
+ }
+
+ if ((!url[0].Path.equals(path)) && (!url[0].Path.equals(path + "/"))) {
+ log.println("parseSmart works wrong");
+ log.println("path field : " + url[0].Path);
+ log.println("expected : " + path);
+ res = false;
+ }
+
+ if (!url[0].Name.equals(name)) {
+ log.println("parseSmart works wrong");
+ log.println("name field : " + url[0].Name);
+ log.println("expected : " + name);
+ res = false;
+ }
+
+ if (!url[0].Arguments.equals(arguments)) {
+ log.println("parseSmart works wrong");
+ log.println("arguments field : " + url[0].Arguments);
+ log.println("expected : " + arguments);
+ res = false;
+ }
+
+ if (!url[0].Mark.equals(mark)) {
+ log.println("parseSmart works wrong");
+ log.println("mark field : " + url[0].Mark);
+ log.println("expected : " + mark);
+ res = false;
+ }
+
+ String ftpURL = invalidUserPrefix +user + ":" + password + "@" + server + ":" +
+ port + path + "/" + name;
+
+ url[0] = new URL();
+ url[0].Complete = ftpURL;
+ log.print("parseSmart('" + ftpURL + "', 'ftp://'): ");
+ complete = oObj.parseSmart(url, "ftp://");
+ log.println(complete);
+ res &= complete;
+
+ if (!url[0].Protocol.equals("ftp://")) {
+ log.println("parseSmart works wrong");
+ log.println("protocol field : " + url[0].Protocol);
+ log.println("expected : ftp://");
+ res = false;
+ }
+
+ if (!url[0].User.equals(invalidUserPrefix+user)) {
+ log.println("parseSmart works wrong");
+ log.println("user field : " + url[0].User);
+ log.println("expected : " + user);
+ res = false;
+ }
+
+ if (!url[0].Password.equals(password)) {
+ log.println("parseSmart works wrong");
+ log.println("password field : " + url[0].Password);
+ log.println("expected : " + password);
+ res = false;
+ }
+
+ if (!url[0].Server.equals(server)) {
+ log.println("parseSmart works wrong");
+ log.println("server field : " + url[0].Server);
+ log.println("expected : " + server);
+ res = false;
+ }
+
+ if (url[0].Port != new Integer(port).shortValue()) {
+ log.println("parseSmart works wrong");
+ log.println("port field : " + url[0].Port);
+ log.println("expected : " + port);
+ res = false;
+ }
+
+ if ((!url[0].Path.equals(path)) && (!url[0].Path.equals(path + "/"))) {
+ log.println("parseSmart works wrong");
+ log.println("path field : " + url[0].Path);
+ log.println("expected : " + path);
+ res = false;
+ }
+
+ if (!url[0].Name.equals(name)) {
+ log.println("parseSmart works wrong");
+ log.println("name field : " + url[0].Name);
+ log.println("expected : " + name);
+ res = false;
+ }
+
+ tRes.tested("parseSmart()", res);
+ }
+
+ /**
+ * Gets the presentation of a URL. <p>
+ * Has <b> OK </b> status if the method returns the same
+ * URL as was passed in parameter.
+ */
+ public void _getPresentation() {
+ URL url = new URL();
+
+ url.Complete = expectedCompleteHTTP;
+
+ log.println("getPresentation('" + expectedCompleteHTTP + "', true): ");
+ String presentation = oObj.getPresentation(url, true);
+ boolean res = presentation.equals(expectedCompleteHTTP);
+ log.println("Resulted presentation: " + presentation);
+ log.println("Expected presentation: " + expectedCompleteHTTP);
+ log.println("Result: " + res);
+
+ url.Complete = expectedCompleteFTP;
+ log.println("getPresentation('" + expectedCompleteFTP + "', false): ");
+ // the password must be masqurade with <****>
+ String asterix = "";
+ for (int n = 0 ; n < password.length(); n++){
+ asterix += "*";
+ }
+ asterix = "<" + asterix.substring(1,asterix.length());
+ asterix = asterix.substring(0,asterix.length()-1) + ">";
+
+ presentation = oObj.getPresentation(url, false);
+ String expectedPresentation = "ftp://" + user + ":" + asterix + "@" +
+ server + ":" + port + path + "/" + name;
+ res &= presentation.equals(expectedPresentation);
+ log.println("Resulted presentation: " + presentation);
+ log.println("Expected presentation: " + expectedPresentation);
+ log.println("Result: " + res);
+
+ log.println("getPresentation('" + expectedCompleteFTP + "', true): ");
+ presentation = oObj.getPresentation(url, true);
+ expectedPresentation = "ftp://" + user + ":" + password + "@" +
+ server + ":" + port + path + "/" + name;
+ res &= presentation.equals(expectedPresentation);
+ log.println("Resulted presentation: " + presentation);
+ log.println("Expected presentation: " + expectedPresentation);
+ log.println("Result: " + res);
+
+ String incorrectURL = "*bla-bla*";
+ url.Complete = incorrectURL;
+ log.println("getPresentation('" + incorrectURL + "', false): ");
+ presentation = oObj.getPresentation(url, false);
+ expectedPresentation = "";
+ res &= presentation.equals(expectedPresentation);
+ log.println("Resulted presentation: " + presentation);
+ log.println("Expected presentation: " + expectedPresentation);
+ log.println("Result: " + res);
+
+ tRes.tested("getPresentation()", res);
+ }
+
+} // finish class _XURLTransformer
+