summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qadevOOo/prj/build.lst127
-rw-r--r--qadevOOo/prj/d.lst2
-rw-r--r--qadevOOo/runner/base/TestBase.java73
-rw-r--r--qadevOOo/runner/base/basic_fat.java214
-rw-r--r--qadevOOo/runner/base/java_complex.java128
-rw-r--r--qadevOOo/runner/base/java_fat.java335
-rw-r--r--qadevOOo/runner/base/makefile.mk81
-rw-r--r--qadevOOo/runner/basicrunner/BasicException.java76
-rw-r--r--qadevOOo/runner/basicrunner/BasicHandler.java648
-rw-r--r--qadevOOo/runner/basicrunner/BasicHandlerProvider.java188
-rw-r--r--qadevOOo/runner/basicrunner/BasicIfcTest.java208
-rw-r--r--qadevOOo/runner/basicrunner/BasicTestCase.java237
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/AttributeList.java173
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/Connector.java306
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/DispatchProviderInterceptor.java230
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/DocumentHandler.java381
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/Filter.java302
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/ThreadRunner.java290
-rw-r--r--qadevOOo/runner/basicrunner/basichelper/makefile.mk82
-rw-r--r--qadevOOo/runner/basicrunner/makefile.mk81
-rw-r--r--qadevOOo/runner/complexlib/ComplexTestCase.java146
-rw-r--r--qadevOOo/runner/complexlib/makefile.mk84
-rw-r--r--qadevOOo/runner/helper/APIDescGetter.java405
-rw-r--r--qadevOOo/runner/helper/AppProvider.java80
-rw-r--r--qadevOOo/runner/helper/CfgParser.java141
-rw-r--r--qadevOOo/runner/helper/ClParser.java141
-rw-r--r--qadevOOo/runner/helper/ComplexDescGetter.java118
-rw-r--r--qadevOOo/runner/helper/ConfigurationRead.java179
-rw-r--r--qadevOOo/runner/helper/OfficeProvider.java203
-rw-r--r--qadevOOo/runner/helper/OfficeWatcher.java114
-rw-r--r--qadevOOo/runner/helper/ProcessHandler.java391
-rw-r--r--qadevOOo/runner/helper/StreamSimulator.java569
-rw-r--r--qadevOOo/runner/helper/URLHelper.java335
-rw-r--r--qadevOOo/runner/helper/WindowListener.java78
-rw-r--r--qadevOOo/runner/helper/makefile.mk95
-rw-r--r--qadevOOo/runner/lib/DynamicClassLoader.java94
-rw-r--r--qadevOOo/runner/lib/ExceptionStatus.java126
-rw-r--r--qadevOOo/runner/lib/MultiMethodTest.java493
-rw-r--r--qadevOOo/runner/lib/MultiPropertyTest.java489
-rw-r--r--qadevOOo/runner/lib/Parameters.java268
-rw-r--r--qadevOOo/runner/lib/SimpleStatus.java135
-rw-r--r--qadevOOo/runner/lib/Status.java270
-rw-r--r--qadevOOo/runner/lib/StatusException.java115
-rw-r--r--qadevOOo/runner/lib/TestCase.java234
-rw-r--r--qadevOOo/runner/lib/TestEnvironment.java187
-rw-r--r--qadevOOo/runner/lib/TestParameters.java274
-rw-r--r--qadevOOo/runner/lib/TestResult.java168
-rw-r--r--qadevOOo/runner/lib/makefile.mk93
-rw-r--r--qadevOOo/runner/makefile.mk85
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java111
-rw-r--r--qadevOOo/runner/org/openoffice/makefile.mk81
-rw-r--r--qadevOOo/runner/share/ComplexTest.java73
-rw-r--r--qadevOOo/runner/share/DescEntry.java131
-rw-r--r--qadevOOo/runner/share/DescGetter.java75
-rw-r--r--qadevOOo/runner/share/LogWriter.java85
-rw-r--r--qadevOOo/runner/share/Watcher.java71
-rw-r--r--qadevOOo/runner/share/makefile.mk87
-rw-r--r--qadevOOo/runner/stats/SimpleLogWriter.java98
-rw-r--r--qadevOOo/runner/stats/SimpleOutProducer.java104
-rw-r--r--qadevOOo/runner/stats/Summarizer.java119
-rw-r--r--qadevOOo/runner/stats/makefile.mk86
-rw-r--r--qadevOOo/runner/util/AccessibilityTools.java270
-rw-r--r--qadevOOo/runner/util/BookmarkDsc.java118
-rw-r--r--qadevOOo/runner/util/ControlDsc.java116
-rw-r--r--qadevOOo/runner/util/DBTools.java852
-rw-r--r--qadevOOo/runner/util/DefaultDsc.java116
-rw-r--r--qadevOOo/runner/util/DesktopTools.java159
-rw-r--r--qadevOOo/runner/util/DrawTools.java193
-rw-r--r--qadevOOo/runner/util/FootnoteDsc.java118
-rw-r--r--qadevOOo/runner/util/FormTools.java365
-rw-r--r--qadevOOo/runner/util/FrameDsc.java161
-rw-r--r--qadevOOo/runner/util/InstCreator.java156
-rw-r--r--qadevOOo/runner/util/InstDescr.java87
-rw-r--r--qadevOOo/runner/util/ParagraphDsc.java119
-rw-r--r--qadevOOo/runner/util/ReferenceMarkDsc.java118
-rw-r--r--qadevOOo/runner/util/RegistryTools.java405
-rw-r--r--qadevOOo/runner/util/SOfficeFactory.java577
-rw-r--r--qadevOOo/runner/util/ShapeDsc.java135
-rw-r--r--qadevOOo/runner/util/StyleFamilyDsc.java115
-rw-r--r--qadevOOo/runner/util/SysUtils.java192
-rw-r--r--qadevOOo/runner/util/TableDsc.java131
-rw-r--r--qadevOOo/runner/util/TextSectionDsc.java118
-rw-r--r--qadevOOo/runner/util/ValueChanger.java1007
-rw-r--r--qadevOOo/runner/util/ValueComparer.java239
-rw-r--r--qadevOOo/runner/util/WriterTools.java143
-rw-r--r--qadevOOo/runner/util/XInstCreator.java74
-rw-r--r--qadevOOo/runner/util/XMLTools.java976
-rw-r--r--qadevOOo/runner/util/dbg.java309
-rw-r--r--qadevOOo/runner/util/makefile.mk110
-rw-r--r--qadevOOo/runner/util/utils.java549
90 files changed, 19421 insertions, 0 deletions
diff --git a/qadevOOo/prj/build.lst b/qadevOOo/prj/build.lst
new file mode 100644
index 000000000000..e61d09749f99
--- /dev/null
+++ b/qadevOOo/prj/build.lst
@@ -0,0 +1,127 @@
+qa qadevOOo : OOoRunner NULL
+qa qadevOOo usr1 - all qa_mkout NULL
+qa qadevOOo\runner\util nmake - all util NULL
+qa qadevOOo\runner\share nmake - all share util NULL
+qa qadevOOo\runner\stats nmake - all stats share NULL
+qa qadevOOo\runner\lib nmake - all lib stats NULL
+qa qadevOOo\runner\complexlib nmake - all complexlib lib NULL
+qa qadevOOo\runner\helper nmake - all helper complexlib NULL
+qa qadevOOo\runner\basicrunner\basichelper nmake - all basicrunner_basichelper helper NULL
+qa qadevOOo\runner\basicrunner nmake - all basicrunner basicrunner_basichelper NULL
+qa qadevOOo\runner\base nmake - all base basicrunner NULL
+qa qadevOOo\runner\org\openoffice nmake - all org_openoffice base NULL
+qa qadevOOo\runner nmake - all runner org_openoffice NULL
+qa qadevOOo\tests\java\ifc\accessibility nmake - all ifc_accessibility runner NULL
+qa qadevOOo\tests\java\ifc\awt nmake - all ifc_awt ifc_accessibility NULL
+qa qadevOOo\tests\java\ifc\beans nmake - all ifc_beans ifc_awt NULL
+qa qadevOOo\tests\java\ifc\bridge nmake - all ifc_bridge ifc_beans NULL
+qa qadevOOo\tests\java\ifc\chart nmake - all ifc_chart ifc_bridge NULL
+qa qadevOOo\tests\java\ifc\connection nmake - all ifc_connection ifc_chart NULL
+qa qadevOOo\tests\java\ifc\container nmake - all ifc_container ifc_connection NULL
+qa qadevOOo\tests\java\ifc\datatransfer\clipboard nmake - all ifc_datatransfer_clipboard ifc_container NULL
+qa qadevOOo\tests\java\ifc\datatransfer nmake - all ifc_datatransfer ifc_datatransfer_clipboard NULL
+qa qadevOOo\tests\java\ifc\document nmake - all ifc_document ifc_datatransfer NULL
+qa qadevOOo\tests\java\ifc\drawing nmake - all ifc_drawing ifc_document NULL
+qa qadevOOo\tests\java\ifc\form nmake - all ifc_form ifc_drawing NULL
+qa qadevOOo\tests\java\ifc\form\component nmake - all ifc_form_component ifc_form NULL
+qa qadevOOo\tests\java\ifc\formula nmake - all ifc_formula ifc_form_component NULL
+qa qadevOOo\tests\java\ifc\frame nmake - all ifc_frame ifc_formula NULL
+qa qadevOOo\tests\java\ifc\i18n nmake - all ifc_i18n ifc_frame NULL
+qa qadevOOo\tests\java\ifc\io nmake - all ifc_io ifc_i18n NULL
+qa qadevOOo\tests\java\ifc\java nmake - all ifc_java ifc_io NULL
+qa qadevOOo\tests\java\ifc\lang nmake - all ifc_lang ifc_java NULL
+qa qadevOOo\tests\java\ifc\linguistic2 nmake - all ifc_linguistic2 ifc_lang NULL
+qa qadevOOo\tests\java\ifc\loader nmake - all ifc_loader ifc_linguistic2 NULL
+qa qadevOOo\tests\java\ifc\presentation nmake - all ifc_presentation ifc_loader NULL
+qa qadevOOo\tests\java\ifc\reflection nmake - all ifc_reflection ifc_presentation NULL
+qa qadevOOo\tests\java\ifc\registry nmake - all ifc_registry ifc_reflection NULL
+qa qadevOOo\tests\java\ifc\script nmake - all ifc_script ifc_registry NULL
+qa qadevOOo\tests\java\ifc\sdb nmake - all ifc_sdb ifc_script NULL
+qa qadevOOo\tests\java\ifc\sdbc nmake - all ifc_sdbc ifc_sdb NULL
+qa qadevOOo\tests\java\ifc\sdbcx nmake - all ifc_sdbcx ifc_sdbc NULL
+qa qadevOOo\tests\java\ifc\sheet nmake - all ifc_sheet ifc_sdbcx NULL
+qa qadevOOo\tests\java\ifc\style nmake - all ifc_style ifc_sheet NULL
+qa qadevOOo\tests\java\ifc\system nmake - all ifc_system ifc_style NULL
+qa qadevOOo\tests\java\ifc\table nmake - all ifc_table ifc_system NULL
+qa qadevOOo\tests\java\ifc\task nmake - all ifc_task ifc_table NULL
+qa qadevOOo\tests\java\ifc\text nmake - all ifc_text ifc_task NULL
+qa qadevOOo\tests\java\ifc\ucb nmake - all ifc_ucb ifc_text NULL
+qa qadevOOo\tests\java\ifc\ui\dialogs nmake - all ifc_ui_dialogs ifc_ucb NULL
+qa qadevOOo\tests\java\ifc\uno nmake - all ifc_uno ifc_ui_dialogs NULL
+qa qadevOOo\tests\java\ifc\util nmake - all ifc_util ifc_uno NULL
+qa qadevOOo\tests\java\ifc\view nmake - all ifc_view ifc_util NULL
+qa qadevOOo\tests\java\ifc\xml\sax nmake - all ifc_xml_sax ifc_view NULL
+qa qadevOOo\tests\java\ifc\xml nmake - all ifc_xml ifc_xml_sax NULL
+qa qadevOOo\tests\java\mod\_acceptor nmake - all mod__acceptor ifc_xml NULL
+qa qadevOOo\tests\java\mod\_adabas nmake - all mod__adabas ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ado nmake - all mod__ado ifc_xml NULL
+qa qadevOOo\tests\java\mod\_brdgfctr nmake - all mod__brdgfctr ifc_xml NULL
+qa qadevOOo\tests\java\mod\_cached nmake - all mod__cached ifc_xml NULL
+qa qadevOOo\tests\java\mod\_cmdmail nmake - all mod__cmdmail ifc_xml NULL
+qa qadevOOo\tests\java\mod\_cnt nmake - all mod__cnt ifc_xml NULL
+qa qadevOOo\tests\java\mod\_connectr nmake - all mod__connectr ifc_xml NULL
+qa qadevOOo\tests\java\mod\_corefl nmake - all mod__corefl ifc_xml NULL
+qa qadevOOo\tests\java\mod\_cpld nmake - all mod__cpld ifc_xml NULL
+qa qadevOOo\tests\java\mod\_dbaccess nmake - all mod__dbaccess ifc_xml NULL
+qa qadevOOo\tests\java\mod\_dbpool nmake - all mod__dbpool ifc_xml NULL
+qa qadevOOo\tests\java\mod\_defreg nmake - all mod__defreg ifc_xml NULL
+qa qadevOOo\tests\java\mod\_dtrans nmake - all mod__dtrans ifc_xml NULL
+qa qadevOOo\tests\java\mod\_dynamicloader nmake - all mod__dynamicloader ifc_xml NULL
+qa qadevOOo\tests\java\mod\_file\calc nmake - all mod__file_calc ifc_xml NULL
+qa qadevOOo\tests\java\mod\_file\dbase nmake - all mod__file_dbase ifc_xml NULL
+qa qadevOOo\tests\java\mod\_file\flat nmake - all mod__file_flat ifc_xml NULL
+qa qadevOOo\tests\java\mod\_fileacc nmake - all mod__fileacc ifc_xml NULL
+qa qadevOOo\tests\java\mod\_fop nmake - all mod__fop ifc_xml NULL
+qa qadevOOo\tests\java\mod\_forms nmake - all mod__forms ifc_xml NULL
+qa qadevOOo\tests\java\mod\_fps nmake - all mod__fps ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ftransl nmake - all mod__ftransl ifc_xml NULL
+qa qadevOOo\tests\java\mod\_fwk nmake - all mod__fwk ifc_xml NULL
+qa qadevOOo\tests\java\mod\_fwl nmake - all mod__fwl ifc_xml NULL
+qa qadevOOo\tests\java\mod\_i18n nmake - all mod__i18n ifc_xml NULL
+qa qadevOOo\tests\java\mod\_impreg nmake - all mod__impreg ifc_xml NULL
+qa qadevOOo\tests\java\mod\_insp nmake - all mod__insp ifc_xml NULL
+qa qadevOOo\tests\java\mod\_inv nmake - all mod__inv ifc_xml NULL
+qa qadevOOo\tests\java\mod\_invadp nmake - all mod__invadp ifc_xml NULL
+qa qadevOOo\tests\java\mod\_javaloader nmake - all mod__javaloader ifc_xml NULL
+qa qadevOOo\tests\java\mod\_jdbc nmake - all mod__jdbc ifc_xml NULL
+qa qadevOOo\tests\java\mod\_jen nmake - all mod__jen ifc_xml NULL
+qa qadevOOo\tests\java\mod\_lng nmake - all mod__lng ifc_xml NULL
+qa qadevOOo\tests\java\mod\_lnn nmake - all mod__lnn ifc_xml NULL
+qa qadevOOo\tests\java\mod\_mcnttype nmake - all mod__mcnttype ifc_xml NULL
+qa qadevOOo\tests\java\mod\_mozab nmake - all mod__mozab ifc_xml NULL
+qa qadevOOo\tests\java\mod\_namingservice nmake - all mod__namingservice ifc_xml NULL
+qa qadevOOo\tests\java\mod\_odbc nmake - all mod__odbc ifc_xml NULL
+qa qadevOOo\tests\java\mod\_proxyfac nmake - all mod__proxyfac ifc_xml NULL
+qa qadevOOo\tests\java\mod\_proxyset nmake - all mod__proxyset ifc_xml NULL
+qa qadevOOo\tests\java\mod\_rdbtdp nmake - all mod__rdbtdp ifc_xml NULL
+qa qadevOOo\tests\java\mod\_remotebridge nmake - all mod__remotebridge ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sc nmake - all mod__sc ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sch nmake - all mod__sch ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sd nmake - all mod__sd ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sfx nmake - all mod__sfx ifc_xml NULL
+qa qadevOOo\tests\java\mod\_simreg nmake - all mod__simreg ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sm nmake - all mod__sm ifc_xml NULL
+qa qadevOOo\tests\java\mod\_smgr nmake - all mod__smgr ifc_xml NULL
+qa qadevOOo\tests\java\mod\_smplmail nmake - all mod__smplmail ifc_xml NULL
+qa qadevOOo\tests\java\mod\_srtrs nmake - all mod__srtrs ifc_xml NULL
+qa qadevOOo\tests\java\mod\_stm nmake - all mod__stm ifc_xml NULL
+qa qadevOOo\tests\java\mod\_svtools nmake - all mod__svtools ifc_xml NULL
+qa qadevOOo\tests\java\mod\_svx nmake - all mod__svx ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sw nmake - all mod__sw ifc_xml NULL
+qa qadevOOo\tests\java\mod\_sysdtrans nmake - all mod__sysdtrans ifc_xml NULL
+qa qadevOOo\tests\java\mod\_syssh nmake - all mod__syssh ifc_xml NULL
+qa qadevOOo\tests\java\mod\_tcv nmake - all mod__tcv ifc_xml NULL
+qa qadevOOo\tests\java\mod\_tdmgr nmake - all mod__tdmgr ifc_xml NULL
+qa qadevOOo\tests\java\mod\_text nmake - all mod__text ifc_xml NULL
+qa qadevOOo\tests\java\mod\_toolkit nmake - all mod__toolkit ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucb nmake - all mod__ucb ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucpdav nmake - all mod__ucpdav ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucpfile nmake - all mod__ucpfile ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucphier nmake - all mod__ucphier ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucppkg nmake - all mod__ucppkg ifc_xml NULL
+qa qadevOOo\tests\java\mod\_ucprmt nmake - all mod__ucprmt ifc_xml NULL
+qa qadevOOo\tests\java\mod\_uui nmake - all mod__uui ifc_xml NULL
+qa qadevOOo\tests\java\mod\_uuresolver nmake - all mod__uuresolver ifc_xml NULL
+qa qadevOOo\tests\java\mod\_xmloff\Chart nmake - all mod__xmloff_Chart ifc_xml NULL
+qa qadevOOo\tests\java\mod\_xmloff\Draw nmake - all mod__xmloff_Draw ifc_xml NULL
+qa qadevOOo\tests\java\mod\_xmloff\Impress nmake - all mod__xmloff_Impress ifc_xml NULL
diff --git a/qadevOOo/prj/d.lst b/qadevOOo/prj/d.lst
new file mode 100644
index 000000000000..5d6afbd7b083
--- /dev/null
+++ b/qadevOOo/prj/d.lst
@@ -0,0 +1,2 @@
+..\%__SRC%\class\OOoRunner.jar %_DEST%\bin%_EXT%\OOoRunner.jar
+
diff --git a/qadevOOo/runner/base/TestBase.java b/qadevOOo/runner/base/TestBase.java
new file mode 100644
index 000000000000..ff939c253385
--- /dev/null
+++ b/qadevOOo/runner/base/TestBase.java
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestBase.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:21 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package base;
+
+import lib.TestParameters;
+/**
+ *
+ * Base Interface to execute a given TestJob
+ */
+public interface TestBase {
+
+ public boolean executeTest(TestParameters param);
+
+}
diff --git a/qadevOOo/runner/base/basic_fat.java b/qadevOOo/runner/base/basic_fat.java
new file mode 100644
index 000000000000..37f3198286d0
--- /dev/null
+++ b/qadevOOo/runner/base/basic_fat.java
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: basic_fat.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:22 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package base;
+
+import base.TestBase;
+import lib.TestParameters;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.DynamicClassLoader;
+import share.DescEntry;
+import share.DescGetter;
+import share.LogWriter;
+import helper.APIDescGetter;
+import helper.OfficeProvider;
+import helper.ProcessHandler;
+import stats.Summarizer;
+import basicrunner.BasicTestCase;
+import basicrunner.BasicIfcTest;
+
+import java.io.PrintWriter;
+
+import com.sun.star.lang.XMultiServiceFactory;
+
+/**
+ * The testbase for executing basic tests.
+ * @see lib.TestBase
+ */
+public class basic_fat implements TestBase{
+
+ /**
+ * Execute a test.
+ * @param param The test parameters.
+ * @param return True, if the test was executed.
+ */
+ public boolean executeTest(TestParameters param) {
+ DescGetter dg = new APIDescGetter();
+ String job = (String) param.get("TestJob");
+
+ //get Job-Descriptions
+ System.out.print("Getting Descriptions for Job: "+job+" from ");
+ DescEntry[] entries = dg.getDescriptionFor(job,
+ (String) param.get("DescriptionPath"),true);
+
+ if (entries == null ) {
+ System.out.println("Couldn't get Description for Job");
+ return false;
+ }
+
+ String conStr = (String) param.get("ConnectionString");
+ System.out.print("> Connecting the Office ");
+ System.out.println("With "+conStr);
+
+ for (int l=0;l<entries.length;l++) {
+ if (entries[l].hasErrorMsg) {
+ System.out.println(entries[l].ErrorMsg);
+ continue;
+ }
+
+ OfficeProvider office = new OfficeProvider();
+ XMultiServiceFactory msf = (XMultiServiceFactory)
+ office.getManager(param);
+ if (msf == null) return false;
+
+ param.put("ServiceFactory",msf);
+
+ DescEntry entry = entries[l];
+
+ //get some helper classes
+ Summarizer sumIt = new Summarizer();
+ DynamicClassLoader dcl = new DynamicClassLoader();
+
+ TestCase tCase = null;
+
+ tCase = (TestCase)
+ new BasicTestCase(entry);
+
+ if (tCase == null) {
+ sumIt.summarizeDown(entry,entry.ErrorMsg);
+ LogWriter sumObj = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+ sumObj.initialize(entry,true);
+ sumObj.summary(entry);
+ return true;
+ }
+
+ System.out.println("Creating: "+tCase.getObjectName());
+ LogWriter log = (LogWriter) dcl.getInstance(
+ (String)param.get("LogWriter"));
+ log.initialize(entry,true);
+ entry.UserDefinedParams = param;
+ tCase.setLogWriter((PrintWriter) log);
+ tCase.initializeTestCase(param);
+ TestEnvironment tEnv = tCase.getTestEnvironment(param);
+
+ System.out.println("created "+tCase.getObjectName());
+ for (int j=0;j<entry.SubEntryCount;j++) {
+ if (!entry.SubEntries[j].isToTest) {
+ Summarizer.summarizeDown(entry.SubEntries[j],"not part of the job");
+ continue;
+ }
+ System.out.println("running: "+entry.SubEntries[j].entryName);
+ LogWriter ifclog = (LogWriter) dcl.getInstance(
+ (String)param.get("LogWriter"));
+ ifclog.initialize(entry.SubEntries[j],true);
+ entry.SubEntries[j].UserDefinedParams = param;
+ entry.SubEntries[j].Logger = ifclog;
+
+ if (tEnv.isDisposed()) {
+ tEnv = tCase.getTestEnvironment(param);
+ System.out.println("created "+tCase.getObjectName());
+ }
+ BasicIfcTest ifc = null;
+ lib.TestResult res = null;
+ ifc = new BasicIfcTest(entry.SubEntries[j].longName);
+ res = ifc.run(entry.SubEntries[j],tEnv,param);
+
+ sumIt.summarizeUp(entry.SubEntries[j]);
+ LogWriter sumIfc = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+
+ sumIfc.initialize(entry.SubEntries[j],true);
+ sumIfc.summary(entry.SubEntries[j]);
+ }
+ try {
+ tCase.cleanupTestCase(param);
+ } catch (Exception e) {
+ log.println("TestCase already gone");
+ }
+ sumIt.summarizeUp(entry);
+ LogWriter sumObj = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+ sumObj.initialize(entry,true);
+ sumObj.summary(entry);
+ }
+
+ if (entries.length > 1) {
+ System.out.println();
+ int counter = 0;
+ System.out.println("Failures that appeared during scenario execution:");
+ for (int i=0;i<entries.length;i++) {
+ if (! entries[i].State.endsWith("OK")) {
+ System.out.println("\t "+entries[i].longName);
+ counter++;
+ }
+ }
+ System.out.println(counter +" of "+entries.length + " tests failed" );
+ }
+
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) param.get("AppProvider");
+
+ if (ph != null) ph.kill();
+ return true;
+ }
+}
diff --git a/qadevOOo/runner/base/java_complex.java b/qadevOOo/runner/base/java_complex.java
new file mode 100644
index 000000000000..7a64649b38f5
--- /dev/null
+++ b/qadevOOo/runner/base/java_complex.java
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: java_complex.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package base;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import java.lang.reflect.Constructor;
+import complexlib.ComplexTestCase;
+import lib.DynamicClassLoader;
+import share.DescGetter;
+import helper.ComplexDescGetter;
+import helper.OfficeProvider;
+import share.DescEntry;
+import share.LogWriter;
+import stats.Summarizer;
+import base.TestBase;
+
+/**
+ * Test base for executing a java complex test.
+ * @see base.TestBase
+ */
+public class java_complex implements TestBase{
+
+ /**
+ * Execute a test.
+ * @param param The test parameters.
+ * @return True, if the test was executed.
+ */
+ public boolean executeTest(lib.TestParameters param) {
+ // get the test job without leading "-o "
+ String testJob = ((String)param.get("TestJob")).substring(3).trim();
+ ComplexTestCase testClass = null;
+ DynamicClassLoader dcl = new DynamicClassLoader();
+ // create an instance
+ try {
+ testClass = (ComplexTestCase)dcl.getInstance(testJob);
+ }
+ catch(java.lang.Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ DescGetter descGetter = new ComplexDescGetter(testClass);
+ DescEntry dEntry = descGetter.getDescriptionFor(testJob,null,true)[0];
+
+ LogWriter log = (LogWriter)dcl.getInstance(
+ (String)param.get("LogWriter"));
+ log.initialize(dEntry,true);
+ dEntry.Logger = log;
+
+ if (!param.getBool("NoOffice")) {
+ OfficeProvider office = new OfficeProvider();
+ XMultiServiceFactory msf = (XMultiServiceFactory)
+ office.getManager(param);
+ if (msf == null) return false;
+ param.put("ServiceFactory",msf);
+ }
+
+ testClass.executeMethods(dEntry, param);
+
+ Summarizer sum = new Summarizer();
+ sum.summarizeUp(dEntry);
+
+ LogWriter out = (LogWriter)dcl.getInstance(
+ (String)param.get("OutProducer"));
+ out.summary(dEntry);
+ return true;
+ }
+
+
+}
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java
new file mode 100644
index 000000000000..f6d876cfe5dc
--- /dev/null
+++ b/qadevOOo/runner/base/java_fat.java
@@ -0,0 +1,335 @@
+/*************************************************************************
+ *
+ * $RCSfile: java_fat.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:21 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package base;
+
+
+import java.io.PrintWriter;
+
+import lib.TestParameters;
+import lib.TestCase;
+import lib.Status;
+import lib.MultiMethodTest;
+import lib.TestEnvironment;
+import lib.DynamicClassLoader;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.uno.XComponentContext;
+
+import share.DescEntry;
+import share.DescGetter;
+import helper.APIDescGetter;
+import helper.OfficeProvider;
+import base.TestBase;
+
+import share.LogWriter;
+import stats.Summarizer;
+
+/**
+ *
+ * this class handles tests written in java and running on a fat Office
+ */
+public class java_fat implements TestBase {
+
+ public static boolean debug = false;
+
+ public boolean executeTest(lib.TestParameters param) {
+ DescGetter dg = new APIDescGetter();
+ String job = (String) param.get("TestJob");
+ boolean retValue = true;
+
+ //get Job-Descriptions
+ System.out.print("Getting Descriptions for Job: "+job+" from ");
+ DescEntry[] entries = dg.getDescriptionFor(job,
+ (String) param.get("DescriptionPath"),true);
+
+ if (entries == null ) {
+ System.out.println("Couldn't get Description for Job");
+ return false;
+ }
+
+ String conStr = (String) param.get("ConnectionString");
+ System.out.print("> Connecting the Office");
+ System.out.println(" With "+conStr);
+
+ OfficeProvider office = new OfficeProvider();
+
+ for (int l=0;l<entries.length;l++) {
+
+ if (entries[l] == null ) {
+ continue;
+ }
+
+ if (entries[l].hasErrorMsg) {
+ System.out.println(entries[l].ErrorMsg);
+ continue;
+ }
+
+ XMultiServiceFactory msf = (XMultiServiceFactory)
+ office.getManager(param);
+ if (msf == null) {
+ retValue = false;
+ continue;
+ }
+ param.put("ServiceFactory",msf);
+
+ DescEntry entry = entries[l];
+
+ //get some helper classes
+ Summarizer sumIt = new Summarizer();
+ DynamicClassLoader dcl = new DynamicClassLoader();
+
+ TestCase tCase = null;
+
+ try {
+ tCase = (TestCase)
+ dcl.getInstance("mod._"+entry.entryName);
+ } catch (java.lang.IllegalArgumentException ie) {
+ entry.ErrorMsg=ie.getMessage();
+ entry.hasErrorMsg=true;
+ }
+
+ if (tCase == null) {
+ sumIt.summarizeDown(entry,entry.ErrorMsg);
+ LogWriter sumObj = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+ sumObj.initialize(entry,true);
+ entry.UserDefinedParams = param;
+ sumObj.summary(entry);
+ continue;
+ }
+
+ System.out.println("Creating: "+tCase.getObjectName());
+ LogWriter log = (LogWriter) dcl.getInstance(
+ (String)param.get("LogWriter"));
+ log.initialize(entry,true);
+ entry.UserDefinedParams = param;
+ TestEnvironment tEnv = null;
+ try {
+ tCase.setLogWriter((PrintWriter) log);
+ tCase.initializeTestCase(param);
+ tEnv = tCase.getTestEnvironment(param);
+ } catch (Exception e) {
+ System.out.println("Exception while creating "+tCase.getObjectName());
+ System.out.println("Message "+e.getMessage());
+ tEnv = null;
+ }
+ if (tEnv == null) {
+ sumIt.summarizeDown(entry,"Couldn't create "+tCase.getObjectName());
+ LogWriter sumObj = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+ sumObj.initialize(entry,true);
+ entry.UserDefinedParams = param;
+ sumObj.summary(entry);
+ continue;
+ }
+ System.out.println(tCase.getObjectName()+" recreated ");
+ for (int j=0;j<entry.SubEntryCount;j++) {
+ if (!entry.SubEntries[j].isToTest) {
+ Summarizer.summarizeDown(entry.SubEntries[j],"not part of the job");
+ continue;
+ }
+ System.out.println("running: "+entry.SubEntries[j].entryName);
+ LogWriter ifclog = (LogWriter) dcl.getInstance(
+ (String)param.get("LogWriter"));
+
+ ifclog.initialize(entry.SubEntries[j],true);
+ entry.SubEntries[j].UserDefinedParams = param;
+ entry.SubEntries[j].Logger = ifclog;
+
+ if (tEnv == null || tEnv.isDisposed()) {
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) param.get("AppProvider");
+ if (ph != null) {
+ ph.kill();
+ shortWait(5000);
+ }
+ tEnv = getEnv(entry,param);
+ }
+
+ MultiMethodTest ifc = null;
+ lib.TestResult res = null;
+ try {
+ ifc = (MultiMethodTest) dcl.getInstance(
+ entry.SubEntries[j].entryName);
+ res = ifc.run(entry.SubEntries[j],tEnv,param);
+ } catch (IllegalArgumentException iae) {
+ System.out.println("Couldn't load class "+entry.SubEntries[j].entryName);
+ System.out.println("**** "+iae.getMessage()+" ****");
+ Summarizer.summarizeDown(entry.SubEntries[j],iae.getMessage());
+ } catch (java.lang.RuntimeException e) {
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) param.get("AppProvider");
+ if (ph != null) {
+ ph.kill();
+ shortWait(5000);
+ }
+ tEnv = getEnv(entry,param);
+ ifc = (MultiMethodTest) dcl.getInstance(
+ entry.SubEntries[j].entryName);
+ if ((tEnv != null) && (ifc != null)) {
+ res = ifc.run(entry.SubEntries[j],tEnv,param);
+ } else res = null;
+ }
+ if (res != null) {
+ for (int k=0;k<entry.SubEntries[j].SubEntryCount;k++) {
+ if (res.hasMethod(entry.SubEntries[j].SubEntries[k].entryName)) {
+ entry.SubEntries[j].SubEntries[k].State=
+ res.getStatusFor(entry.SubEntries[j].SubEntries[k].entryName).toString();
+ }
+ }
+ }
+ sumIt.summarizeUp(entry.SubEntries[j]);
+
+ LogWriter sumIfc = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+
+ sumIfc.initialize(entry.SubEntries[j],true);
+ entry.SubEntries[j].UserDefinedParams = param;
+ sumIfc.summary(entry.SubEntries[j]);
+ }
+ try {
+ tCase.cleanupTestCase(param);
+ } catch (Exception e) {
+ System.out.println("#### couldn't cleanup :-(");
+ }
+ sumIt.summarizeUp(entry);
+ LogWriter sumObj = (LogWriter) dcl.getInstance(
+ (String)param.get("OutProducer"));
+ sumObj.initialize(entry,true);
+ sumObj.summary(entry);
+ }
+ if (entries.length > 1) {
+ System.out.println();
+ int counter = 0;
+ System.out.println("Failures that appeared during scenario execution:");
+ for (int i=0;i<entries.length;i++) {
+ if (! entries[i].State.endsWith("OK")) {
+ System.out.println("\t "+entries[i].longName);
+ counter++;
+ }
+ }
+ System.out.println(counter +" of "+entries.length + " tests failed" );
+ }
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) param.get("AppProvider");
+ if (ph != null) {
+ ph.kill();
+ shortWait(5000);
+ }
+ return retValue;
+ }
+
+ protected TestEnvironment getEnv(DescEntry entry, TestParameters param) {
+ OfficeProvider office = new OfficeProvider();
+ XMultiServiceFactory msf = (XMultiServiceFactory)
+ office.getManager(param);
+ if (msf == null) return null;
+ param.put("ServiceFactory",msf);
+
+ DynamicClassLoader dcl = new DynamicClassLoader();
+
+ TestCase tCase = null;
+
+ try {
+ tCase = (TestCase)
+ dcl.getInstance("mod._"+entry.entryName);
+ } catch (java.lang.IllegalArgumentException ie) {
+ entry.ErrorMsg=ie.getMessage();
+ entry.hasErrorMsg=true;
+ }
+
+ System.out.println("Creating: "+tCase.getObjectName());
+ LogWriter log = (LogWriter) dcl.getInstance(
+ (String)param.get("LogWriter"));
+ log.initialize(entry,true);
+ entry.UserDefinedParams = param;
+ tCase.setLogWriter((PrintWriter) log);
+ TestEnvironment tEnv = null;
+ try {
+ tCase.initializeTestCase(param);
+ tEnv = tCase.getTestEnvironment(param);
+ } catch (com.sun.star.lang.DisposedException de) {
+ System.out.println("Office disposed");
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) param.get("AppProvider");
+ if (ph != null) {
+ ph.kill();
+ shortWait(5000);
+ }
+ }
+ return tEnv;
+ }
+
+ protected void shortWait(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (java.lang.InterruptedException ie) {}
+ }
+}
diff --git a/qadevOOo/runner/base/makefile.mk b/qadevOOo/runner/base/makefile.mk
new file mode 100644
index 000000000000..f1ad7c747c42
--- /dev/null
+++ b/qadevOOo/runner/base/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:20 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = OOoRunner
+PACKAGE = base
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+JAVAFILES = TestBase.java java_complex.java java_fat.java basic_fat.java
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/basicrunner/BasicException.java b/qadevOOo/runner/basicrunner/BasicException.java
new file mode 100644
index 000000000000..a42fd6502d68
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/BasicException.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: BasicException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner;
+
+/** An exception while executing a Basic test.
+ */
+public class BasicException extends Throwable {
+ /** Detailed information about the exception.
+ */
+ public String info;
+
+ /** Constructor with detailed information.
+ * @param info Information about the exception.
+ */
+ public BasicException(String info) {
+ this.info = info;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/basicrunner/BasicHandler.java b/qadevOOo/runner/basicrunner/BasicHandler.java
new file mode 100644
index 000000000000..4024c89be8c4
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/BasicHandler.java
@@ -0,0 +1,648 @@
+/*************************************************************************
+ *
+ * $RCSfile: BasicHandler.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner;
+
+
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.connection.ConnectionSetupException;
+import com.sun.star.container.ContainerEvent;
+import com.sun.star.container.ElementExistException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XContainer;
+import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XSet;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XChangesBatch;
+import com.sun.star.util.XSortable;
+import java.util.Hashtable;
+import lib.TestParameters;
+
+import share.LogWriter;
+
+
+/**
+ * This class is a java-part of BASIC-java interaction "driver"
+ * It is used to call Star-Basic's function from java using
+ * basic's part of "driver" where listeners are implemented.
+ * The instance of the BasicHandler should be added to the MSF that will be
+ * used for loading BASIC's part of "driver".<br>
+ * After opening basic's document it creates an instance of the
+ * HandlerContainer using BasicHandler. HandlerContainer is a UNO
+ * XContainer and XNameContainer.
+ * Only one instance of BasicHandler can be used at the moment.
+ * @see com.sun.star.lang.XServiceInfo
+ * @see com.sun.star.lang.XSingleServiceFactory
+ */
+public class BasicHandler implements XServiceInfo, XSingleServiceFactory {
+ /**
+ * serviceName is the name of service that can be created in BASIC.
+ */
+ static final String serviceName =
+ "com.sun.star.jsuite.basicrunner.BasicHandler";
+
+ /**
+ * <code>container</code> is a SHARED variable (between BASIC and Java).
+ * It is used for interacting.
+ */
+ static private HandlerContainer container = null;
+
+ /**
+ * Contains a writer to log an information about the interface testing, to
+ * allows for tests to access it.
+ */
+ static private LogWriter log;
+
+ /**
+ * <code>oHandlerDoc</code> is a referrence to BASIC's document.
+ */
+ static private XComponent oHandlerDoc = null;
+
+ /**
+ * <code>xMSF</code> is a MultiServiceFactory currently used by
+ * BasicHandler.
+ */
+ static private XMultiServiceFactory xMSF = null;
+
+ /**
+ * Interface being tested now.
+ */
+ static private BasicIfcTest TestedInterface = null;
+
+ /**
+ * Ab enhanced scheme of timeouts can be used with BASIC tests.
+ * A small timeout can be used zo wait for changes in the test status.
+ * <code>respFlag</code> is set to <code>true</code> when a BASIC test
+ * writes any log information.
+ */
+ static private boolean respFlag = false;
+
+ /**
+ * <code>iBasicTimeout</code> is the amount of milliseconds that
+ * the BasicHandler will wait for a response from tests
+ * (finish to execute a method or add log information)
+ * before it decides that SOffice is dead.
+ */
+ static private int iBasicTimeout = 10000;
+
+
+
+ /**
+ * Creates an instance of a HandlerContainer. This instance is used from
+ * BASIC.
+ * @param tParam The test parameters.
+ */
+ public BasicHandler(TestParameters tParam) {
+ if (tParam.get("soapi.test.basic.debugFile") != null) {
+ iBasicTimeout = 0; // Debug mode.
+ }
+ container = new HandlerContainer(this);
+ }
+
+ /**
+ * Set the tested interface and a log writer.
+ * @param ifc The test of an interface
+ * @param log A log writer.
+ */
+ public void setTestedInterface(BasicIfcTest ifc, LogWriter log) {
+ this.log = log;
+ TestedInterface = ifc;
+ }
+
+ /**
+ * Is called when BASIC signals that it has performed the test of a method.
+ * @param methodName The name of the method.
+ * @bResult The result of the test.
+ */
+ synchronized void methodTested(String methodName, boolean bResult) {
+ respFlag = true;
+ TestedInterface.methodTested(methodName, bResult);
+ notify() ;
+ }
+
+ /**
+ * Is called when BASIC sends a signal to write some log information.
+ * @param info The string to write.
+ */
+ synchronized public void Log(String info) {
+ respFlag = true;
+ log.println(info);
+ notify() ;
+ }
+
+ /**
+ * Is called by BasicIfcTest to find out if this BasicHandler uses the
+ * correct MultiServiceFactory.
+ * @param xMSF The MultiServiceFactory
+ * @see com.sun.star.lang.XMultiServiceFactory
+ * @return True, if xMSF is equal to the MultiServiceFactory of this class.
+ */
+ public boolean isUptodate(XMultiServiceFactory xMSF) {
+ return xMSF.equals(this.xMSF);
+ }
+
+
+ /**
+ * Establishes a connection between BASIC and Java.
+ * If required, hte BASIC part of the "driver" is loaded.
+ * @param sBasicBridgeURL The URL of the basic bridge document
+ * (BasicBridge.sxw)
+ * @param tParam The test parameters.
+ * @param xMSF The MultiServiceFactory
+ * @param log The log writer.
+ * @see com.sun.star.lang.XMultiServiceFactory
+ * @throws ConnectionSetupException Exception is thrown, if no connection could be made.
+ */
+ public synchronized void Connect(String sBasicBridgeURL,
+ TestParameters tParam, XMultiServiceFactory xMSF,
+ LogWriter log) throws ConnectionSetupException {
+ this.log = log;
+ try {
+ this.xMSF = xMSF;
+ Object oInterface = xMSF.createInstance(
+ "com.sun.star.frame.Desktop");
+ XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, oInterface);
+ XComponentLoader oCLoader = (XComponentLoader)
+ UnoRuntime.queryInterface(
+ XComponentLoader.class, oDesktop);
+
+ // load BasicBridge with MarcoEceutionMode = Always-no warn
+ //PropertyValue[] DocArgs = null;
+ PropertyValue[] DocArgs = new PropertyValue[1];
+ PropertyValue DocArg = new PropertyValue();
+ DocArg.Name = "MacroExecutionMode";
+ DocArg.Value = new Short(
+ com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
+ DocArgs[0] = DocArg;
+
+ // configure Office to allow to execute macos
+ PropertyValue [] ProvArgs = new PropertyValue [1];
+ PropertyValue Arg = new PropertyValue();
+ Arg.Name = "nodepath";
+ Arg.Value = "/org.openoffice.Office.Common/Security";
+ ProvArgs[0] = Arg;
+
+ Object oProvider = xMSF.createInstance(
+ "com.sun.star.configuration.ConfigurationProvider");
+
+ XMultiServiceFactory oProviderMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, oProvider);
+
+ Object oSecure = oProviderMSF.createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationUpdateAccess",
+ ProvArgs);
+
+ XPropertySet oSecureProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oSecure);
+
+ Object oScripting = oSecureProps.getPropertyValue("Scripting");
+ XPropertySet oScriptingSettings = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oScripting);
+
+ oScriptingSettings.setPropertyValue("Warning",new Boolean(false));
+ oScriptingSettings.setPropertyValue("OfficeBasic",new Integer(2));
+
+ XChangesBatch oSecureChange = (XChangesBatch)
+ UnoRuntime.queryInterface(XChangesBatch.class, oSecure);
+ oSecureChange.commitChanges();
+
+ // As we want to have some information about a debugFile
+ // BEFORE connection is established
+ // we pass the information about it in frame name.
+ String sFrameName = (String)tParam.get(
+ "soapi.test.basic.debugFile");
+ if (sFrameName == null) sFrameName = "BasicRunner";
+
+ oHandlerDoc = oCLoader.loadComponentFromURL(sBasicBridgeURL,
+ sFrameName, 40, DocArgs);
+
+ do {
+ respFlag = false ;
+ wait(10000); // waiting for basic response for 10 seconds.
+ } while (respFlag && !container.hasByName("BASIC_Done")) ;
+
+ if (!container.hasByName("BASIC_Done")) {
+ throw new ConnectionSetupException("Connection timed out.");
+ }
+ } catch (Exception e) {
+ System.out.println("Exception: " + e.toString());
+ throw new ConnectionSetupException();
+ }
+
+ log.println("Java-BASIC connection established!");
+ }
+
+ /**
+ * Overloads perform(Strin fName, Object params) for convenience.
+ * @return A proprty value as result.
+ *
+ public synchronized PropertyValue perform(String fName)
+ throws BasicException {
+ return perform(fName, "");
+ }
+*/
+ /**
+ * Perform a test of a method.
+ * @param fName The name of the method to test.
+ * @param params The test parameters.
+ * @return A proprty value as result of the test.
+ * @throws BasicException The method could not be executed.
+ */
+ public synchronized PropertyValue perform(String fName, Object params)
+ throws BasicException {
+ try {
+ container.callBasicFunction(fName, params);
+
+ do {
+ respFlag = false;
+ // waiting for basic response for iBasicTimeout milliseconds.
+ wait(iBasicTimeout);
+ } while(respFlag && !container.hasByName("BASIC_Done"));
+
+ } catch (InterruptedException e) {
+ System.out.println("The operation " + fName + " was interrupted.");
+ } catch (com.sun.star.lang.DisposedException de) {
+ System.out.println("## Office is disposed");
+ }
+
+ if (!container.hasByName("BASIC_Done")) {
+ System.out.println("Operation timed out.");
+ }
+
+ Object res = container.getByName("BASIC_Done") ;
+ container.removeByName("BASIC_Done");
+
+ if (!(res instanceof PropertyValue)) {
+ if (res == null) {
+ System.out.println(
+ "BasicBridge returns null");
+ throw new BasicException(
+ "BasicBridge returns null");
+ } else {
+ System.out.println(
+ "BasicBridge returns wrong type: " + res.getClass());
+ throw new BasicException(
+ "BasicBridge returns wrong type: " + res.getClass());
+ }
+ }
+
+ PropertyValue result = (PropertyValue) res ;
+
+ if ((result.Value instanceof String) && (((String)result.Value)).startsWith("Exception")) {
+ throw new BasicException((String)result.Value);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns true, if name is a supported service of this class.
+ * @param name The service name.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return serviceName.equals(name);
+ }
+
+ /**
+ * Return all supported service names.
+ * @return All supported services.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {serviceName};
+ }
+
+ /**
+ * Get the implementation name.
+ * @return Implementation name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+
+ /**
+ * Create an instance of HandlerContainer.
+ * Arguments are not supported here, so they will be ignored.
+ * @param args The arguments.
+ * @return The instance.
+ */
+ public Object createInstanceWithArguments(Object[] args) {
+ return container;
+ }
+
+ /**
+ * Create an instance of HandlerContainer.
+ * @return The instance.
+ */
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ /**
+ * Dispose the BASIC document.
+ */
+ public synchronized void dispose() {
+ try {
+ if (oHandlerDoc != null) {
+ oHandlerDoc.dispose();
+ wait(1000);
+ }
+ } catch (Exception e) {
+ System.out.println("Exception: " + e.toString());
+ }
+ }
+}
+
+
+/**
+ * This class handles the communication between Java and BASIC.
+ * @see com.sun.star.container.XContainer
+ * @see com.sun.star.container.XNameContainer
+ * @see com.sun.star.lang.XTypeProvider
+ */
+class HandlerContainer implements XContainer, XNameContainer, XTypeProvider{
+
+ /** Container for parameters.
+ **/
+ Hashtable container = new Hashtable(20);
+ /**
+ * An array of listeners for container events.
+ * @see com.sun.star.container.XContainerListener
+ */
+ static XContainerListener[] listener = null;
+
+ /** The BasicHandler belonging to this handler. **/
+ BasicHandler parent = null;
+
+ /**
+ * Constructor with the parent BasicHandler.
+ * @param par The BasicHandler.
+ */
+ public HandlerContainer(BasicHandler par) {
+ parent = par;
+ }
+
+ /**
+ * Call a BASIC function, meaning a test method.
+ * @param fName The method name.
+ * @param args Arguments for the method.
+ */
+ public void callBasicFunction(String fName, Object args) {
+ // BASIC's listener should be called ONLY in this case.
+ if (container.containsKey(fName)) {
+ container.remove(fName);
+ }
+ container.put(fName, args);
+ if (listener != null) {
+ ContainerEvent event = new ContainerEvent();
+ event.Element = fName;
+ for (int i=0; i<listener.length; i++){
+ if (listener[i] != null) {
+ listener[i].elementInserted(event);
+ }
+ }
+ }
+ }
+
+ /**
+ * Insert an object into the container.
+ * @param name The key for the object.
+ * @param object The object to insert.
+ * @throws IllegalArgumentException Throws this exception when trying to insert null.
+ */
+ public void insertByName(String name, Object object) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.ElementExistException, com.sun.star.lang.WrappedTargetException {
+
+ // BASIC and Java can insert into the container.
+ if (container.containsKey(name)) {
+ container.remove(name);
+ }
+ container.put(name, object);
+
+ PropertyValue result = null ;
+
+ if (object instanceof PropertyValue) {
+ result = (PropertyValue)object;
+ if (name.equals("BASIC_Done")) {
+ synchronized (parent) {
+ parent.notify();
+ }
+ } else if (name.equals("BASIC_MethodTested")) {
+ parent.methodTested(result.Name,
+ ((Boolean)result.Value).booleanValue());
+ }
+ } else if (name.equals("BASIC_Log")) {
+ parent.Log(object.toString());
+ }
+ }
+
+ /**
+ * Remove the object with this name from the container.
+ * @param name The key.
+ */
+ public void removeByName(String name) {
+ container.remove(name) ;
+ }
+
+ /**
+ * Unsupported method.
+ * @param name The name of the key.
+ * @param value The value.
+ * @throws WrappedTargetException Throws this exception when called falsely.
+ */
+ public void replaceByName(String name, Object value)
+ throws WrappedTargetException {
+ throw new WrappedTargetException("Unsupported");
+ }
+
+ /**
+ * Has a value for this key.
+ * @param name The name of a key.
+ * @return True, if name exists as key in the container.
+ */
+ public boolean hasByName(String name) {
+ return container.containsKey(name);
+ }
+
+ /**
+ * Get an object by its key.
+ * @param name The name of the key.
+ * @return The object of this key.
+ */
+ public Object getByName(String name) {
+ return container.get(name);
+ }
+
+ /**
+ * Get all key names.
+ * @return All names of keys.
+ */
+ public String[] getElementNames() {
+ String[] res = new String[container.size()];
+ return (String[])container.keySet().toArray(res);
+ }
+
+ /**
+ * Is the xcontainer empty?
+ * @return True, if the container has elements.
+ */
+ public boolean hasElements() {
+ return !container.isEmpty();
+ }
+
+ /**
+ * Get the type of this class.
+ * @return The type of this class.
+ */
+ public Type getElementType() {
+ try {
+ return new Type(String.class);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Get the implementation id of this class.
+ * @return A unique id for this class
+ * @see com.sun.star.lang.XTypeProvider
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Get all types of this class.
+ * @return All implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i) {
+ types[i] = new Type(interfaces[i]);
+ }
+ return types;
+ }
+
+ /**
+ * Add a listener
+ * @param xListener The listener.
+ */
+ public void addContainerListener(XContainerListener xListener){
+ int length = 0;
+ if (listener != null)
+ length = listener.length;
+
+ XContainerListener[] mListener =
+ new XContainerListener[length+1];
+ for (int i=0; i<length-1; i++) {
+ mListener[i] = listener[i];
+ // listener already added
+ if (((Object)xListener).equals(listener[i]))
+ return;
+ }
+ mListener[length] = xListener;
+ listener = mListener;
+ }
+
+ /**
+ * Remove a listener
+ * @param xListener The listener.
+ */
+ public void removeContainerListener(XContainerListener xListener){
+ if (listener != null && listener.length != 0) {
+ int length = listener.length;
+ XContainerListener[] mListener =
+ new XContainerListener[length-1];
+ boolean found = false;
+ int j=0;
+ for (int i=0; i<length-1; i++) {
+ if (!((Object)xListener).equals(listener[j])) {
+ mListener[i] = listener[j];
+ }
+ else {
+ j++;
+ found = true;
+ }
+ j++;
+ }
+ if (!found) {
+ if (((Object)xListener).equals(listener[length-1]))
+ listener = mListener;
+ }
+ else
+ listener = mListener;
+
+ }
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/BasicHandlerProvider.java b/qadevOOo/runner/basicrunner/BasicHandlerProvider.java
new file mode 100644
index 000000000000..a24dd2e5a1a3
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/BasicHandlerProvider.java
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * $RCSfile: BasicHandlerProvider.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.container.XSet;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.container.ElementExistException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.connection.ConnectionSetupException;
+import lib.TestParameters;
+import share.LogWriter;
+import basicrunner.basichelper.Connector;
+import basicrunner.basichelper.DocumentHandler;
+import basicrunner.basichelper.ThreadRunner;
+import basicrunner.basichelper.AttributeList;
+import basicrunner.basichelper.Filter;
+import basicrunner.basichelper.DispatchProviderInterceptor;
+
+/**
+ * This class provides a BasicHandler. All classes for the communication with
+ * and handling of the BASIC tests are instantiated and inserted int the
+ * MultiServiceFactory of StarOffice.
+ */
+public class BasicHandlerProvider {
+
+ /** The BassicHandler **/
+ static BasicHandler oHandler = null;
+ /** The Connector **/
+ static Connector oConnector = null;
+ /** The DocumentHandler **/
+ static DocumentHandler oDocumentHandler = null;
+ /** The Thread Runner **/
+ static ThreadRunner oThreadRunner = null;
+ /** The AttributeList **/
+ static AttributeList oAttributeList = null;
+ /** The Filter **/
+ static Filter oFilter = null;
+ /** The DispatchProviderInterceptor **/
+ static DispatchProviderInterceptor oCeptor = null ;
+ /** The MultiServiceFactory from StarOffice **/
+ static XMultiServiceFactory MSF = null;
+ /** IS this a new connection or an existing one? **/
+ static boolean bIsNewConnection = true;
+
+ /**
+ * Get a BasicHandler
+ * @param tParam Test parameters.
+ * @param log A log writer
+ * @return An instance of BasicHandler
+ */
+ static public BasicHandler getHandler(TestParameters tParam, LogWriter log) {
+
+ XMultiServiceFactory xMSF = tParam.getMSF();
+
+ if (!xMSF.equals(MSF)) {
+ MSF = xMSF;
+ oHandler = new BasicHandler(tParam);
+ oConnector = new Connector();
+ oFilter = new Filter();
+ oDocumentHandler = new DocumentHandler();
+ oThreadRunner = new ThreadRunner(xMSF);
+ oCeptor = new DispatchProviderInterceptor() ;
+ oAttributeList = new AttributeList();
+ XSet xMSFSet = (XSet)UnoRuntime.queryInterface(XSet.class, xMSF);
+
+ try {
+ xMSFSet.insert(oHandler);
+ xMSFSet.insert(oConnector);
+ xMSFSet.insert(oFilter);
+ xMSFSet.insert(oDocumentHandler);
+ xMSFSet.insert(oThreadRunner);
+ xMSFSet.insert(oCeptor);
+ xMSFSet.insert(oAttributeList);
+ } catch (ElementExistException e) {
+ System.out.println(e.toString());
+ } catch (IllegalArgumentException e) {
+ System.out.println(e.toString());
+ }
+
+ try {
+ oHandler.Connect(util.utils.getFullURL((String)tParam.get("BASICBRIDGE")),
+ tParam, xMSF, log);
+ } catch (ConnectionSetupException e) {
+ System.out.println("Can't connect to BASIC !");
+ }
+
+ bIsNewConnection = true;
+ } else {
+ bIsNewConnection = false;
+ }
+
+ return oHandler;
+ }
+
+ /**
+ * Is this a new connection?
+ * @return True, if the connection did not exist before.
+ */
+ static public boolean isNewConnection() {
+ return bIsNewConnection;
+ }
+
+ /**
+ * Dispose the BasicHandler
+ */
+ static public void disposeHandler() {
+
+ try {
+ if (oHandler != null) {
+ oHandler.dispose();
+ }
+ if (MSF != null) {
+ XSet xMSFSet = (XSet)UnoRuntime.queryInterface(XSet.class, MSF);
+ xMSFSet.remove(oHandler);
+ xMSFSet.remove(oFilter);
+ xMSFSet.remove(oConnector);
+ xMSFSet.remove(oDocumentHandler);
+ xMSFSet.remove(oThreadRunner);
+ xMSFSet.remove(oAttributeList);
+ }
+ } catch (Exception e){
+ System.out.println(e.toString());
+ }
+
+ MSF = null;
+ oHandler = null;
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/BasicIfcTest.java b/qadevOOo/runner/basicrunner/BasicIfcTest.java
new file mode 100644
index 000000000000..ca76226d5dba
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/BasicIfcTest.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * $RCSfile: BasicIfcTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:24 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner;
+
+import lib.TestResult;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import lib.Status;
+import share.DescEntry;
+import share.LogWriter;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.NoSuchElementException;
+
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.WrappedTargetException;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.beans.PropertyValue;
+
+
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * The BASIC interface test
+ */
+public class BasicIfcTest {
+ /** The BasicHandler **/
+ static BasicHandler oBasicHandler = null;
+ /** The result orf the test **/
+ protected TestResult tRes;
+ /** the name of the test **/
+ protected String testName;
+
+ /** Constructor with test name.
+ * @param name The name of the test.
+ */
+ public BasicIfcTest(String name) {
+ testName = name;
+ }
+
+ /**
+ * Let the test run.
+ * @param xTestedEntry Informaton about the interface to test.
+ * @param tEnv The environment of the test.
+ * @param tParam The test parameters.
+ * @return A result of the test.
+ */
+ public TestResult run(DescEntry xTestedEntry, TestEnvironment tEnv,
+ TestParameters tParam) {
+
+ String sResult = "";
+
+ this.tRes = new TestResult();
+ LogWriter log = xTestedEntry.Logger;
+
+ // Get Handler, that was created during object creation.
+ oBasicHandler = (BasicHandler)tEnv.getObjRelation("BasicHandler");
+
+ if (!oBasicHandler.isUptodate(tParam.getMSF())) {
+ // If Handler uses old MSF (in case of Office's GPF) then don't test
+ // interface.
+ return null;
+ }
+
+ boolean objectWasCreated = ((Boolean)tEnv.getObjRelation("objectCreated")).booleanValue();
+
+ if (objectWasCreated) {
+ oBasicHandler.setTestedInterface(this, log);
+
+ DescEntry methods[] = xTestedEntry.SubEntries;
+
+ String names[] = new String[methods.length + 1];
+ boolean isOpt[] = new boolean[methods.length + 1];
+ String other[] = new String[1];
+
+ String aName = xTestedEntry.longName;
+ aName = aName.substring(aName.indexOf("::")+2);
+ int oldIndex = 0;
+ int index = aName.indexOf("::");
+ names[0] = "";
+ while(index!=-1) {
+ names[0] += aName.substring(oldIndex,index) + ".";
+ oldIndex=index+2;
+ index=aName.indexOf("::", oldIndex);
+ }
+ names[0] += aName.substring(oldIndex);
+ isOpt[0] = xTestedEntry.isOptional;
+
+ for (int i = 1; i < names.length; i++) {
+ names[i] = methods[i - 1].entryName;
+ isOpt[i] = methods[i - 1].isOptional;
+ }
+
+ // for reasons of compatibility with JSuite we change the first
+ // character of EntryType to upper case.
+ String eType = xTestedEntry.EntryType;
+ other[0] = eType.toUpperCase().charAt(0)+eType.substring(1);
+
+ Object params[] = {names, isOpt, other};
+
+ try {
+ PropertyValue Res = oBasicHandler.perform("testInterface", params);
+ sResult = (String)Res.Value;
+ } catch (BasicException e) {
+ log.println(e.info);
+ sResult = "SKIPPED.FAILED";
+ }
+ } else { // if object was not created...
+ sResult = "SKIPPED.FAILED";
+ }
+
+ // now tRes has all substates: collect them
+ DescEntry[] subs = xTestedEntry.SubEntries;
+ for (int i = 0; i < subs.length ; i++) {
+ if (sResult.equals("SKIPPED.FAILED"))
+ subs[i].State = "SKIPPED.FAILED";
+ else if (sResult.equals("SKIPPED.OK"))
+ subs[i].State = "SKIPPED.OK";
+ else
+ if (tRes.getStatusFor(subs[i].entryName) == null) {
+ subs[i].State = "SKIPPED.FAILED";
+ } else {
+ subs[i].State = tRes.getStatusFor(
+ subs[i].entryName).toString();
+ }
+ }
+
+ xTestedEntry.State = sResult;
+ return null;
+ }
+
+ /**
+ * Set the result of the method that is tested.
+ * @param methodName The name of the method.
+ * @param bResult The result of the test.
+ */
+ public void methodTested(String methodName, boolean bResult) {
+ tRes.tested(methodName, bResult);
+ }
+
+ /**
+ * @return The name of the interface or the service tested.
+ */
+ String getTestedClassName() {
+ return testName;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/basicrunner/BasicTestCase.java b/qadevOOo/runner/basicrunner/BasicTestCase.java
new file mode 100644
index 000000000000..ba862658e515
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/BasicTestCase.java
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * $RCSfile: BasicTestCase.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:24 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner;
+
+import lib.TestCase;
+import lib.TestParameters;
+import lib.TestEnvironment;
+import share.DescEntry;
+import util.SOfficeFactory;
+import share.LogWriter;
+import stats.SimpleLogWriter;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XDocumentInfoSupplier;
+import com.sun.star.document.XDocumentInfo;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.FileReader;
+import java.io.PrintWriter;
+
+import java.util.Vector;
+
+import com.sun.star.uno.XInterface;
+import com.sun.star.beans.PropertyValue;
+
+
+/**
+ * The basic test case.
+ */
+public class BasicTestCase extends TestCase {
+
+ /**
+ * Specifies the PrintWriter to log information.
+ */
+ public PrintWriter oLog;
+
+ /** The name of the test object **/
+ protected String objName;
+ /** The implementation name of the test object **/
+ protected String implName;
+ /** A BasicHandler **/
+ static BasicHandler oBasicHandler = null;
+
+ /**
+ * Constructor with the entry which is to test.
+ * @param entry The description entry.
+ */
+ public BasicTestCase(DescEntry entry) {
+ this.objName = entry.entryName;
+ this.implName = entry.longName;
+ }
+
+
+ /**
+ * Initialize the test case.
+ * The BasicHandler is talken from the test parameters and several
+ * parameters are initialized.
+ * @param tParam The test parameters.
+ * @param pLog A log writer.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter pLog) {
+ // Create Handler ONLY here. If SOffice crashes,
+ // no new Handler will be created until new object's initialization.
+ this.oLog = pLog;
+ LogWriter log = (LogWriter)pLog;
+ oBasicHandler = BasicHandlerProvider.getHandler(tParam, log);
+ try {
+ oBasicHandler.perform("setValue",
+ "cBASPath = \"" + tParam.get("BASICRESPTH") + "/\"");
+ oBasicHandler.perform("setValue",
+ "cTestDocsDir = \"" + tParam.get("DOCPTH") + "/\"");
+ oBasicHandler.perform("setValue",
+ "CNCSTR = \"" + tParam.get("CNCSTR") + "\"");
+ if (tParam.get("soapi.test.hidewindows") != null) {
+ oBasicHandler.perform("setValue",
+ "soapi_test_hidewindows = true");
+ } else {
+ oBasicHandler.perform("setValue",
+ "soapi_test_hidewindows = false");
+ }
+ //this parameters are used by testcases of db-driver components
+ oBasicHandler.perform("setValue", "dbaseUrl = \"sdbc:dbase:" +
+ tParam.get("dbase.url") + "\"");
+ oBasicHandler.perform("setValue", "flatUrl = \"sdbc:flat:" +
+ tParam.get("flat.url") + "\"");
+ oBasicHandler.perform("setValue", "calcUrl = \"sdbc:calc:" +
+ tParam.get("calc.url") + "\"");
+ oBasicHandler.perform("setValue", "odbcUrl = \"sdbc:odbc:" +
+ tParam.get("odbc.url") + "\"");
+ oBasicHandler.perform("setValue", "jdbcUrl = \"jdbc:" +
+ tParam.get("jdbc.url") + "\"");
+ oBasicHandler.perform("setValue", "jdbcUser = \"" +
+ tParam.get("jdbc.user") + "\"");
+ oBasicHandler.perform("setValue", "jdbcPassword = \"" +
+ tParam.get("jdbc.password") + "\"");
+ oBasicHandler.perform("setValue", "adabasUrl = \"sdbc:adabas:" +
+ tParam.get("adabas.url") + "\"");
+ oBasicHandler.perform("setValue", "adabasUser = \"" +
+ tParam.get("adabas.user") + "\"");
+ oBasicHandler.perform("setValue", "adabasPassword = \"" +
+ tParam.get("adabas.password") + "\"");
+ oBasicHandler.perform("setValue", "adoUrl = \"sdbc:ado:" +
+ tParam.get("ado.url") + "\"");
+ oBasicHandler.perform("setValue", "mozabUrl = \"sdbc:address:" +
+ tParam.get("mozab.url") + "\"");
+ } catch (BasicException e) {
+ log.println(e.info);
+ helper.ProcessHandler ph =
+ (helper.ProcessHandler) tParam.get("AppProvider");
+
+ if (ph != null) ph.kill();
+ }
+ }
+
+ /**
+ * Create the environment for the test. This is done by BASIC.
+ * @param tParam The test parameters.
+ * @param log A log writer.
+ * @return The test environment
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+
+ PropertyValue Res;
+ boolean bObjectWasCreated = false;
+
+ try {
+ oBasicHandler.perform("setValue",
+ "cObjectImplementationName = \"" + implName + "\"");
+ Res = oBasicHandler.perform("createObject", objName);
+ bObjectWasCreated = ((Boolean)Res.Value).booleanValue();
+
+ if (!bObjectWasCreated) {
+ log.println("Couldn't create object");
+ }
+
+ } catch (BasicException e) {
+ log.println(e.info);
+ bObjectWasCreated = false;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(new XInterface(){});
+ tEnv.addObjRelation("objectCreated", new Boolean(bObjectWasCreated));
+ tEnv.addObjRelation("BasicHandler", oBasicHandler);
+ return tEnv;
+ }
+
+
+ protected void cleanupTestEnvironment(TestParameters tParam,
+ TestEnvironment tEnv, LogWriter log) {
+ }
+
+ /**
+ * BASIC is told to dispose the test object.
+ * @param tParam The test parameters.
+ */
+
+ public void cleanupTestCase(TestParameters tParam) {
+ PropertyValue Res;
+ oLog.println("Cleaning up testcase");
+ try {
+ Res = oBasicHandler.perform("disposeObject", objName);
+ } catch (BasicException e) {
+ oLog.println(e.info);
+ }
+ }
+
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/AttributeList.java b/qadevOOo/runner/basicrunner/basichelper/AttributeList.java
new file mode 100644
index 000000000000..e84e47067f07
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/AttributeList.java
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * $RCSfile: AttributeList.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:29 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.Type;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.xml.sax.XAttributeList;
+import util.XMLTools;
+
+/**
+* The class provides an implementation of the service
+* <code>com.sun.star.xml.sax.XAttributeList</code>.
+* @see com.sun.star.xml.sax.XAttributeList
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.lang.XSingleServiceFactory
+*/
+public class AttributeList implements XServiceInfo, XSingleServiceFactory {
+ /** The service name of this class **/
+ static final String __serviceName = "basichelper.AttributeList";
+
+ /**
+ * Returns True, of the service is supported.
+ * @param name The service name.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ /**
+ * Get all supported services.
+ * @return The supported services.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ /**
+ * Ask for the implementation name.
+ * @return The implementation name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+
+ /**
+ * Create an instance of the actual implementation of the AttributeList.
+ * Arguments are not supported, so they will bge ignored.
+ * @param args The arguments.
+ * @return A new instance of this class.
+ */
+ public Object createInstanceWithArguments(Object[] args) {
+ return new AttributeListImpl();
+ }
+
+ /**
+ * Create an instance of this class.
+ * @return A new instance of this class.
+ */
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+}
+
+/**
+ * The actual implementation of the service
+ * <code>com.sun.star.xml.sax.XAttributeList</code>.
+ * Extends the class util.XMLTools.AttributeList.
+ * @see util.XMLTools.AttributeList
+ * @see com.sun.star.xml.sax.XAttributeList
+ * @see com.sun.star.lang.XTypeProvider
+ * @see com.sun.star.lang.XInitialization
+ */
+class AttributeListImpl extends XMLTools.AttributeList
+ implements XTypeProvider, XInitialization {
+
+ /**
+ * Initialize this class.
+ * @param p0 An array of XML attributes that are added to the list.
+ * @throws Exception Initialize failed.
+ */
+ public void initialize(Object[] p0) throws com.sun.star.uno.Exception {
+ for(int i = 0; i + 2 < p0.length; i += 3) {
+ add((String)p0[i], (String)p0[i + 1], (String)p0[i + 2]);
+ }
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return All UNO types of this class.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Class superInterfaces[] = getClass().getSuperclass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length + superInterfaces.length];
+ int i = 0;
+ for(; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+ for(; i < interfaces.length + superInterfaces.length; ++ i)
+ types[i] = new Type(superInterfaces[i - interfaces.length]);
+ return types;
+ }
+
+ /**
+ * Get a unique id for this class
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/Connector.java b/qadevOOo/runner/basicrunner/basichelper/Connector.java
new file mode 100644
index 000000000000..67299f0473f6
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/Connector.java
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * $RCSfile: Connector.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:29 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+import com.sun.star.connection.ConnectionSetupException;
+import com.sun.star.connection.NoConnectException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.XSingleServiceFactory;
+
+/**
+ * This is a special service that is used in testing Acceptor
+ * component in BASIC. This componennt creates a separate thread
+ * that tries to connect to BASIC's acceptor. After successfull
+ * connection it writes a connectionString to XConnection.
+ */
+ public class Connector implements XServiceInfo, XSingleServiceFactory {
+ /** The service name of this class **/
+ static final String __serviceName = "basichelper.Connector";
+ /** The Connector implementation **/
+ static ConnectorImpl oConnector = null;
+
+ /** Create a connector.
+ */
+ public Connector() {
+ oConnector = new ConnectorImpl();
+ }
+
+ /**
+ * Returns an instance of the connector.
+ * Arguments are not supported here and will be ignored.
+ * @param args The arguments.
+ * @return The connector.
+ */
+ public Object createInstanceWithArguments(Object[] args) {
+ return oConnector;
+ }
+
+ /**
+ * Returns an instance of the connector.
+ * @return The connector.
+ */
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ /**
+ * Get a unique id for this implementation.
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+
+ /** Is this servioce supported?
+ * @param name The service name.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ /**
+ * Get all supported service names.
+ * @return All supported servcices.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ /**
+ * Get the implementation name of this class.
+ * @return The implementation name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+}
+
+/**
+ * The actual implementation of the connector
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.lang.XTypeProvider
+ * @see com.sun.star.container.XNameAccess
+ */
+class ConnectorImpl implements XInitialization, XTypeProvider, XNameAccess {
+ static String aState;
+ static Integer iTimeout;
+
+ /**
+ * Construct a new connector.
+ */
+ public ConnectorImpl() {
+ aState = "just created";
+ iTimeout = new Integer(3000);
+ }
+
+ /**
+ * Method initialize() creates a new thread that will try to connect to
+ * Acceptor for a few seconds. One should pass as parameters an array,
+ * where element 0 is an instance of Connector and element 1 is a
+ * connection string (the same as in Acceptor)
+ * @param parm1 An instance of XConnector.
+ * @see com.sun.star.connection.XConnector
+ * @throws Exception Is thrown, when initialize fails.
+ */
+ public void initialize(Object[] parm1) throws com.sun.star.uno.Exception {
+ aState = "just initialized";
+ XConnector cntr = (XConnector)UnoRuntime.queryInterface(
+ XConnector.class, parm1[0]);
+ ConnThread aThread = new ConnThread(cntr, (String)parm1[1]);
+ aThread.start();
+ }
+
+ /**
+ * Get the element names
+ * @return All element names.
+ */
+ public String[] getElementNames() {
+ return new String[]{"State", "Timeout"};
+ }
+
+ /**
+ * Does this element exist?
+ * @param name The element name.
+ * @return True, if the name exists.
+ */
+ public boolean hasByName(String name) {
+ return (name.equals("State") || name.equals("Timeout"));
+ }
+
+ /**
+ * Get an element by its name.
+ * @param name The name of the element.
+ * @return The value of the element.
+ * @throws NoSuchElementException The element does not exist.
+ */
+ public Object getByName(String name) throws NoSuchElementException{
+ if (name.equals("State"))
+ return aState;
+ else if (name.equals("Timeout"))
+ return iTimeout;
+ else
+ throw new NoSuchElementException();
+ }
+
+ /**
+ * Are there elements
+ * @return Always true.
+ */
+ public boolean hasElements() {
+ return true;
+ }
+
+ /**
+ * Get element type.
+ * @return null.
+ */
+ public Type getElementType() {
+ return null;
+ }
+
+ /**
+ * Get a unique id for this implementation.
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+}
+
+/**
+ * A connector thread
+ */
+class ConnThread extends Thread {
+ String connStr;
+ XConnector oConnector;
+
+ /**Construct the thread.
+ * @param oCntr A connector.
+ * @param cStr The conection string.
+ */
+ public ConnThread(XConnector oCntr, String cStr){
+ connStr = cStr;
+ oConnector = oCntr;
+ }
+
+ /**
+ * Run the thread.
+ */
+ public void run(){
+ try {
+ Thread.sleep(ConnectorImpl.iTimeout.intValue());
+ ConnectorImpl.aState = "before connection";
+ XConnection oConnection = oConnector.connect(connStr);
+ if (oConnection != null) {
+ ConnectorImpl.aState = "connected";
+ oConnection.write(connStr.getBytes());
+ oConnection.write(new byte[]{0});
+ } else
+ ConnectorImpl.aState = "XConnection is null";
+ } catch (ConnectionSetupException e) {
+ ConnectorImpl.aState = "ConnectionSetupException";
+ throw new RuntimeException(e.toString());
+ } catch (NoConnectException e) {
+ ConnectorImpl.aState = "NoConnectException";
+ throw new RuntimeException(e.toString());
+ } catch (Exception e) {
+ ConnectorImpl.aState = "error";
+ throw new RuntimeException("Can't sleep exception");
+ }
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/DispatchProviderInterceptor.java b/qadevOOo/runner/basicrunner/basichelper/DispatchProviderInterceptor.java
new file mode 100644
index 000000000000..91eb67407595
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/DispatchProviderInterceptor.java
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: DispatchProviderInterceptor.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Any;
+import com.sun.star.frame.XDispatchProviderInterceptor;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.DispatchDescriptor;
+import com.sun.star.util.URL;
+
+/**
+ * This implementation provides an implementation of an interceptor.
+ * @see com.sun.star.lang.XSingleServiceFactory
+ * @see com.sun.star.lang.XServiceInfo
+ */
+public class DispatchProviderInterceptor implements XServiceInfo,
+ XSingleServiceFactory {
+ /** The service name **/
+ static final String __serviceName =
+ "basichelper.DispatchProviderInterceptor";
+
+ /** Create an instance of the interceptor
+ * Arguments are not supported here, so they will be ignored.
+ * @param args The arguments.
+ * @return A new instance of the interceptor.
+ **/
+ public Object createInstanceWithArguments(Object[] args) {
+ return new InterceptorImpl();
+ }
+
+ /** Create an instance of the interceptor
+ * @return A new instance of the interceptor.
+ **/
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ /** Get the unique id for this implementation
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /** Get all implemented types.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+
+ /**
+ * Is this service supported?
+ * @param name The name of a service.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ /**
+ * Get all supported service names.
+ * @return All service names.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ /**
+ * Get the implementation name of this class.
+ * @return The name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+}
+
+/**
+ * The actual implementation of the interceptor.
+ * @see com.sun.star.lang.XTypeProvider
+ * @see com.sun.star.frame.XDispatchProviderInterceptor
+ * @see com.sun.star.frame.XDispatchProvider
+ */
+class InterceptorImpl implements XDispatchProvider,
+ XDispatchProviderInterceptor, XTypeProvider {
+
+ /** A master dispatch provider **/
+ public XDispatchProvider master = null;
+ /** A slave dispatch provider **/
+ public XDispatchProvider slave = null;
+
+ /** Get the slave dispatch provider
+ * @return The slave.
+ */
+ public XDispatchProvider getSlaveDispatchProvider() {
+ return slave;
+ }
+ /** Get the master dispatch provider
+ * @return The master.
+ */
+ public XDispatchProvider getMasterDispatchProvider() {
+ return master;
+ }
+
+ /** Set the slave dispatch provider
+ * @param prov The new slave.
+ */
+ public void setSlaveDispatchProvider(XDispatchProvider prov) {
+ slave = prov ;
+ }
+
+ /** Set the master dispatch provider
+ * @param prov The new master.
+ */
+ public void setMasterDispatchProvider(XDispatchProvider prov) {
+ master = prov ;
+ }
+
+ /** Searches for an <type>XDispatch</type> for the specified URL within
+ * the specified target frame.
+ * @param url The URL.
+ * @param frame The target frame
+ * @param flags Optional search flags.
+ * @return The dispatch object which provides the queried functionality
+ * or null if no dispatch object is available.
+ * @see com.sun.star.frame.XDispatch
+ */
+ public XDispatch queryDispatch(URL url, String frame, int flags) {
+ return master.queryDispatch(url, frame, flags) ;
+ }
+
+ /**
+ * Query for an array of <type>XDispatch</type>.
+ * @param desc A list of dipatch requests.
+ * @return A list of dispatch objects.
+ */
+ public XDispatch[] queryDispatches(DispatchDescriptor[] desc) {
+ return master.queryDispatches(desc) ;
+ }
+
+ /** Get the unique id for this implementation
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /** Get all implemented types.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/DocumentHandler.java b/qadevOOo/runner/basicrunner/basichelper/DocumentHandler.java
new file mode 100644
index 000000000000..d0cf7ca6bb73
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/DocumentHandler.java
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * $RCSfile: DocumentHandler.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Any;
+import com.sun.star.xml.sax.XDocumentHandler;
+import com.sun.star.xml.sax.XLocator;
+import com.sun.star.xml.sax.XAttributeList;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.NoSuchElementException;
+import java.util.Vector;
+import util.XMLTools.Tag;
+import util.XMLTools;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+
+/**
+ * This class provides a handler of the BASIC test document.
+ * @see com.sun.star.lang.XSingleServiceFactory
+ * @see com.sun.star.lang.XServiceInfo
+ */
+public class DocumentHandler implements XServiceInfo, XSingleServiceFactory {
+ /** The service name of this class **/
+ static final String __serviceName = "basichelper.DocumentHandler";
+ /** The actual handler of the document **/
+ static DocumentHandlerImpl oDocumentHandler = null;
+ /** A string writer **/
+ private StringWriter writer;
+ /** The log writer (just a wrapper around <code>writer</code>) **/
+ private PrintWriter log;
+
+ /**
+ * Create an instance of the document handler.
+ * @param args A boolean value as <codde>args[0]</code> determines,
+ * if checked XML data is printed to the log.
+ * Default is false.
+ * @return The document handler
+ */
+ public Object createInstanceWithArguments(Object[] args) {
+ boolean printXML = false;
+ if (args != null && args.length!=0 && args[0] instanceof Boolean)
+ printXML = ((Boolean)args[0]).booleanValue();
+ writer = new StringWriter();
+ log = new PrintWriter(writer);
+ oDocumentHandler = new DocumentHandlerImpl(log, printXML, writer);
+ return oDocumentHandler;
+ }
+
+ /**
+ * Create an instance of the document handler.
+ * @return The document handler
+ */
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ /** Get the unique id for this implementation
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /** Get all implemented types.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+ return types;
+ }
+
+ /** Is this servioce supported?
+ * @param name The service name.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ /**
+ * Get all supported service names.
+ * @return All supported servcices.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ /**
+ * Get the implementation name of this class.
+ * @return The implementation name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+}
+
+/**
+ * The actual implementation of the document handler
+ * @see util.XMLTools.XMLChecker
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see com.sun.star.container.XNameAccess
+ * @see com.sun.star.lang.XTypeProvider
+ */
+class DocumentHandlerImpl extends XMLTools.XMLChecker
+ implements XInitialization, XDocumentHandler,
+ XNameAccess, XTypeProvider {
+ /** A string writer **/
+ private StringWriter writer;
+
+ /**
+ * Constructor
+ * @param log_ A log writer.
+ * @param printXML Should XML data be printed to the log?
+ * @param logWriter A wrapper around <code>log_</code> for convenience.
+ */
+ public DocumentHandlerImpl(PrintWriter log_,
+ boolean printXML, StringWriter logWriter) {
+ super(log_, printXML);
+ writer = logWriter;
+ }
+
+ /**
+ * Initialize this class with rules.
+ * @param parm1 An array of filter rules:
+ * <code>processAction()</code> is called for every rule.
+ * @throws com.sun.star.uno.Exception for an incorrect rule.
+ */
+ public void initialize(Object[] parm1) throws com.sun.star.uno.Exception {
+ if (!(parm1[0] instanceof Object[])) return;
+ for (int i=0; i<parm1.length; i++) {
+ processActionForXMLChecker((Object[])parm1[i]);
+ }
+ }
+
+ /**
+ * Method processes all filters received from basic tests.
+ * Called by initialize().
+ * @param filterRule An array building one filter rule.
+ * @throws com.sun.star.uno.Exception for an incorrect rule.
+ */
+ private void processActionForXMLChecker(Object[] filterRule)
+ throws com.sun.star.uno.Exception {
+ int arrLen = filterRule.length;
+ String oTagName;
+ Object[] oTags;
+ Object[] oTag;
+ int tagsNum = arrLen-1;
+ Vector allTags = new Vector();
+ String CDATA = "";
+ String action = "";
+
+ // First element of rule is RuleName and should be String
+ if (!(filterRule[0] instanceof String)) {
+ throw new com.sun.star.uno.Exception("Error: incorrect filter rule "+
+ "received from basic test! Rule name must be a String.");
+ } else {
+ action = (String) filterRule[0];
+ }
+
+ // Searching for character data and defining amount of tags received.
+ for (int j=1; j<arrLen; j++) {
+ if ( (filterRule[j] instanceof String) && (j != 1) ) {
+ CDATA = (String) filterRule[j];
+ tagsNum--;
+ }
+ }
+
+ // Adding received tags to internal array.
+ oTags = new Object[tagsNum];
+ for (int j=1; j<=tagsNum; j++) {
+ if (filterRule[j] instanceof Object[]) {
+ oTags[j-1] = (Object[]) filterRule[j];
+ }
+ }
+
+ // Process all received tags for a given filter rule
+ for (int i=0; i<oTags.length; i++) {
+ if (oTags[i] instanceof Object[]) {
+ oTag = (Object[]) oTags[i];
+ oTagName = (String) oTag[0];
+ } else if (oTags[i] instanceof Object) {
+ oTag = new Object[1];
+ oTag[0] = (Object) oTags[i];
+ oTagName = (String) oTag[0];
+ } else {
+ throw new com.sun.star.uno.Exception("Error: invalid tag "+
+ "received from basic test! Check tag "
+ +i+" in rule '"+action+"'.");
+ }
+
+ // Action for constructor Tag(TagName, attrName, attrValue)
+ if (oTag.length == 3) {
+ if ((oTag[1] instanceof String)&&(oTag[2] instanceof String)) {
+ allTags.add(new Tag(oTagName,
+ (String) oTag[1], (String) oTag[2]));
+ } else {
+ throw new com.sun.star.uno.Exception("Error: invalid tag '"+
+ oTagName+"' received from basic test!");
+ }
+
+ // Action for constructors:
+ // Tag(TagName, String[][] attrValues )
+ // Tag(TagName, String[] attrNames)
+ // Tag(TagName, String attrName)
+ //
+ } else if (oTag.length == 2) {
+ if (oTag[1] instanceof String[][]) {
+ allTags.add(new Tag(oTagName, (String[][]) oTag[1]));
+ } else if (oTag[1] instanceof String[]) {
+ allTags.add(new Tag(oTagName, (String[]) oTag[1]));
+ } else if (oTag[1] instanceof String) {
+ allTags.add(new Tag(oTagName, (String) oTag[1]));
+ } else {
+ throw new com.sun.star.uno.Exception("Error: invalid tag '"+
+ oTagName+"' received from basic test!");
+ }
+
+ // Action for constructor Tag(TagName)
+ } else if (oTag.length == 1) {
+ if (oTag[0] instanceof String) {
+ allTags.add(new Tag(oTagName));
+ } else {
+ throw new com.sun.star.uno.Exception("Error: invalid tag '"+
+ oTagName+"' received from basic test!");
+ }
+ } else {
+ throw new com.sun.star.uno.Exception("Error: invalid tag '"+
+ oTagName+"' received from basic test!");
+ }
+ }
+
+ // Adding tags to XMLChecker
+ if ( action.equals((String)"TagExists") ) {
+ for (int i=0; i<allTags.size(); i++) {
+ addTag((Tag)allTags.get(i));
+ }
+ } else if (action.equals((String)"TagEnclosed")) {
+ addTagEnclosed((Tag) allTags.get(0), (Tag) allTags.get(1));
+ } else if (action.equals((String)"CharsEnclosed")) {
+ addCharactersEnclosed(CDATA, (Tag) allTags.get(0));
+ } else {
+ throw new com.sun.star.uno.Exception("Error: incorrect rule name '"+
+ action+"' received from basic test!");
+ }
+ }
+
+ /**
+ * Get the names of the elements.
+ * @return element names.
+ */
+ public String[] getElementNames() {
+ return new String[]{"XMLCode", "XMLIsCorrect"};
+ }
+
+ /**
+ * Is this an element?
+ * @param name Element name.
+ * @return true, if <code>name>/code> is the name of an element.
+ */
+ public boolean hasByName(String name) {
+ return (name.equals("XMLCode") || name.equals("XMLIsCorrect"));
+ }
+
+ /**
+ * Get an element by its name.
+ * @param name The element name.
+ * @return The element with the specified <code>name</code>.
+ * @throws NoSuchElementException Is thrown, if name does not exist.
+ */
+ public Object getByName(String name) throws NoSuchElementException{
+ if (name.equals("XMLIsCorrect"))
+ return new Boolean(this.check());
+ else if (name.equals("XMLCode")) {
+ return writer.getBuffer().toString();
+ } else
+ throw new NoSuchElementException();
+ }
+
+ /**
+ * Are there any elements?
+ * @return Always true.
+ */
+ public boolean hasElements() {
+ return true;
+ }
+
+ /**
+ * Get the element type.
+ * @return The type.
+ */
+ public Type getElementType() {
+ return new Type(Object.class);
+ }
+
+ /**
+ * Get a unique id for this implementation.
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+ return types;
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/Filter.java b/qadevOOo/runner/basicrunner/basichelper/Filter.java
new file mode 100644
index 000000000000..5ae31f358337
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/Filter.java
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * $RCSfile: Filter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.document.XFilter;
+import com.sun.star.beans.PropertyValue;
+
+
+/**
+ * Provides an implementation of XFilter.
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.lang.XServiceInfo
+ * @see com.sun.star.lang.XSingleServiceFactory
+ */
+public class Filter implements XServiceInfo, XSingleServiceFactory {
+ /** The service name of this class **/
+ static final String __serviceName = "basichelper.Filter";
+ /** The actual filter **/
+ static FilterImpl oFilter = null;
+
+ /**
+ * Construct a new filter
+ */
+ public Filter() {
+ oFilter = new FilterImpl();
+ }
+
+ /**
+ * Returns an instance of the filter.
+ * Arguments are not supported here and will be ignored.
+ * @param args The arguments.
+ * @return The filter.
+ */
+ public Object createInstanceWithArguments(Object[] args) {
+ return oFilter;
+ }
+
+ /**
+ * Returns an instance of the filter.
+ * @return The filter.
+ */
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ /**
+ * Get a unique id for this implementation.
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+
+ /** Is this servioce supported?
+ * @param name The service name.
+ * @return True, if the service is supported.
+ */
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ /**
+ * Get all supported service names.
+ * @return All supported servcices.
+ */
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ /**
+ * Get the implementation name of this class.
+ * @return The implementation name.
+ */
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+}
+
+/**
+ * The actual filter implementation
+ * @see com.sun.star.lang.XInitialization;
+ * @see com.sun.star.lang.XTypeProvider;
+ * @see com.sun.star.container.XNameAccess;
+ */
+class FilterImpl implements XInitialization, XTypeProvider, XNameAccess {
+ /** A state **/
+ static String aState;
+ /** A result **/
+ static boolean bResult;
+
+ /**
+ * Constructs a new filter.
+ */
+ public FilterImpl() {
+ aState = "just created";
+ bResult = false;
+ }
+
+ /**
+ * Get the element names
+ * @return All element names.
+ */
+ public String[] getElementNames() {
+ return new String[]{"State", "Result"};
+ }
+
+ /**
+ * Does this element exist?
+ * @param name The element name.
+ * @return True, if the name exists.
+ */
+ public boolean hasByName(String name) {
+ return (name.equals("State") || name.equals("Result"));
+ }
+
+ /**
+ * Get an element by its name.
+ * @param name The name of the element.
+ * @return The value of the element.
+ * @throws NoSuchElementException The element does not exist.
+ */
+ public Object getByName(String name) throws NoSuchElementException{
+ if (name.equals("State"))
+ return aState;
+ else if (name.equals("Result"))
+ return new Boolean(bResult);
+ else
+ throw new NoSuchElementException();
+ }
+
+ /**
+ * Are there elements
+ * @return Always true.
+ */
+ public boolean hasElements() {
+ return true;
+ }
+
+ /**
+ * Get element type.
+ * @return null.
+ */
+ public Type getElementType() {
+ return null;
+ }
+
+ /**
+ * Get a unique id for this implementation.
+ * @return The id.
+ */
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ /**
+ * Return all implemented types of this class.
+ * @return The implemented UNO types.
+ */
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+
+ return types;
+ }
+
+
+ /**
+ * Method initialize() creates a new thread that will try to start
+ * filtering
+ * @param parm1 An instance of XFilter
+ * @see com.sun.star.document.XFilter
+ * @throws Exception Is thrown, when initialize fails.
+ */
+ public void initialize(Object[] parm1) throws com.sun.star.uno.Exception {
+ XFilter oFilter = (XFilter)UnoRuntime.queryInterface(
+ XFilter.class, parm1[0]);
+ PropertyValue[] FilterDesc = (PropertyValue[])UnoRuntime.queryInterface(PropertyValue[].class, parm1[1]);
+ aState = "just initialized";
+ FilterThread aThread = new FilterThread(oFilter, FilterDesc);
+ aThread.start();
+ }
+}
+
+/**
+ * A thread for filtering.
+ */
+class FilterThread extends Thread {
+ /** The filter that is used **/
+ XFilter oFilter = null;
+ /** Filter descriptions **/
+ PropertyValue[] FilterDesc = null;
+
+ /**
+ * Construct the thread.
+ * @param oObj The filter.
+ * @param Desc The descriptions.
+ */
+ public FilterThread(XFilter oObj, PropertyValue[] Desc){
+ oFilter = oObj;
+ FilterDesc = Desc;
+ }
+
+ /**
+ * Let the thread run
+ */
+ public void run(){
+ boolean bOK;
+ try {
+ FilterImpl.aState = "before filtering";
+ bOK = oFilter.filter(FilterDesc);
+ FilterImpl.aState = "filtering finished";
+ FilterImpl.bResult = bOK;
+ } catch (Exception e) {
+ ConnectorImpl.aState = "error";
+ throw new RuntimeException("Can't filtering exception"
+ + e.toString());
+ }
+ }
+}
diff --git a/qadevOOo/runner/basicrunner/basichelper/ThreadRunner.java b/qadevOOo/runner/basicrunner/basichelper/ThreadRunner.java
new file mode 100644
index 000000000000..3d45494b4ff5
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/ThreadRunner.java
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * $RCSfile: ThreadRunner.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:27 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package basicrunner.basichelper;
+
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Any;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.util.XURLTransformer;
+import com.sun.star.frame.XController;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.URL;
+import com.sun.star.lang.XMultiServiceFactory;
+import util.utils;
+import com.sun.star.lang.XComponent;
+import lib.StatusException;
+import lib.Status;
+import util.SOfficeFactory;
+import com.sun.star.ui.dialogs.XExecutableDialog;
+
+
+public class ThreadRunner implements XServiceInfo, XSingleServiceFactory {
+ static final String __serviceName = "basichelper.ThreadRunner";
+ static ThreadRunnerImpl oThreadRunner = null;
+
+ public ThreadRunner(XMultiServiceFactory xMSF) {
+ oThreadRunner = new ThreadRunnerImpl(xMSF);
+ }
+
+ public Object createInstanceWithArguments(Object[] args) {
+ return oThreadRunner;
+ }
+
+ public Object createInstance() {
+ return createInstanceWithArguments(null);
+ }
+
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+ return types;
+ }
+
+ public boolean supportsService(String name) {
+ return __serviceName.equals(name);
+ }
+
+ public String[] getSupportedServiceNames() {
+ return new String[] {__serviceName};
+ }
+
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+}
+
+
+class ThreadRunnerImpl implements XInitialization, XTypeProvider {
+ Object oDoc = null;
+ String actionType = null;
+ String actionParm = null;
+ XMultiServiceFactory oMSF = null;
+
+ public ThreadRunnerImpl(XMultiServiceFactory MSF) {
+ oMSF = MSF;
+ }
+
+ public void initialize(Object[] params) throws com.sun.star.uno.Exception {
+ boolean parmsOK = false;
+
+ if (!(params[0] instanceof String)) {
+ throw new StatusException(Status.failed(
+ "Wrong first parameter for ThreadRunner, allowed values:" +
+ "'OpenToolkitDialog', 'OpenDialogFromFile', 'ExecuteDialog'"));
+ }
+
+ actionType = (String) params[0];
+
+ if (actionType.equals("OpenToolkitDialog")) {
+ if (params.length != 3 || !(params[2] instanceof Object) ||
+ !(params[1] instanceof String) ) {
+ throw new StatusException(Status.failed("Expected the " +
+ "following type of parameters for 'OpenToolkitDialog': " +
+ "String, Object"));
+ }
+ actionParm = (String)params[1];
+ oDoc = (Object)params[2];
+ ToolkitDialogThread aThread =
+ new ToolkitDialogThread(oMSF, oDoc, actionParm);
+ aThread.start();
+ } else if (actionType.equals("OpenDialogFromFile")) {
+ if (params.length != 2 || !(params[1] instanceof String) ) {
+ throw new StatusException(Status.failed("Expected the " +
+ "following type of parameters for 'OpenDialogFromFile': " +
+ "String"));
+ }
+ actionParm = (String)params[1];
+ DialogFromFileThread bThread =
+ new DialogFromFileThread(oMSF, actionParm);
+ bThread.start();
+ } else if ( actionType.equals("ExecuteDialog")) {
+ if (params.length != 2 || !(params[1] instanceof String)) {
+ throw new StatusException(Status.failed("Expected the " +
+ "following type of parameters for 'ExecuteDialog': " +
+ "String"));
+ }
+ ExecuteDialogThread cThread =
+ new ExecuteDialogThread(oMSF, (String)params[1]);
+ cThread.start();
+ } else {
+ System.out.println("Error! ThreadRunnerImpl.initialize(): " +
+ "Incorrect parameters!");
+ }
+ }
+
+ public byte[] getImplementationId() {
+ return toString().getBytes();
+ }
+
+ public Type[] getTypes() {
+ Class interfaces[] = getClass().getInterfaces();
+ Type types[] = new Type[interfaces.length];
+ for(int i = 0; i < interfaces.length; ++ i)
+ types[i] = new Type(interfaces[i]);
+ return types;
+ }
+}
+
+
+class ToolkitDialogThread extends Thread {
+ Object oDoc = null;
+ String url = null;
+ XMultiServiceFactory msf = null;
+
+ public ToolkitDialogThread(XMultiServiceFactory xMSF, Object doc, String sUrl) {
+ oDoc = doc;
+ url = sUrl;
+ msf = xMSF;
+ }
+
+ public void run() {
+ XModel aModel = (XModel) UnoRuntime.queryInterface(XModel.class, oDoc);
+ XController xController = aModel.getCurrentController();
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface( XDispatchProvider.class, xController );
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ msf.createInstance("com.sun.star.util.URLTransformer"));
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = url;
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0);
+ if( xDispatcher != null )
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't open dialog!!!");
+ throw new StatusException( "Couldn't open dialog!!!", e );
+ }
+ }
+}
+
+
+class DialogFromFileThread extends Thread {
+ String url = null;
+ SOfficeFactory SOF = null;
+
+ public DialogFromFileThread(XMultiServiceFactory xMSF, String sUrl) {
+ url = sUrl;
+ SOF = SOfficeFactory.getFactory(xMSF);
+ }
+
+ public void run() {
+ try {
+ String testUrl= utils.getFullTestURL(url);
+ System.out.println("loading "+testUrl);
+ XComponent xDoc = SOF.loadDocument(testUrl);
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't create document!!!");
+ throw new StatusException( "Couldn't create document!!!", e );
+ }
+ }
+
+}
+
+class ExecuteDialogThread extends Thread {
+ XMultiServiceFactory xMSF = null;
+ String serviceName = null;
+
+ public ExecuteDialogThread(XMultiServiceFactory xMSF, String serviceName) {
+ this.xMSF = xMSF;
+ this.serviceName = serviceName;
+ }
+
+ public void run() {
+ Object dlg = null;
+ try {
+ dlg = xMSF.createInstance(serviceName);
+ } catch(com.sun.star.uno.Exception e) {
+ throw new StatusException(Status.failed("Couldn't create service"));
+ }
+ XExecutableDialog execDlg = (XExecutableDialog)UnoRuntime.queryInterface
+ (XExecutableDialog.class, dlg);
+ execDlg.execute();
+ }
+}
+
+// $Log: not supported by cvs2svn $
+// Revision 1.2 2002/10/16 15:11:51 cn
+// CHG: ExecuteDialogThread added
+//
+// Revision 1.2 2002/10/16 10:07:06 moa
+// CHG: ExecuteDialogThread added
+//
+// Revision 1.1 2002/09/11 11:17:06 pav
+// ADD: initial version
+//
+
+
diff --git a/qadevOOo/runner/basicrunner/basichelper/makefile.mk b/qadevOOo/runner/basicrunner/basichelper/makefile.mk
new file mode 100644
index 000000000000..ebf004e4e46e
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/basichelper/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:27 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME = OOoRunner
+PACKAGE = basicrunner$/basichelper
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+JAVAFILES = AttributeList.java DocumentHandler.java Filter.java \
+ Connector.java DispatchProviderInterceptor.java \
+ ThreadRunner.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/basicrunner/makefile.mk b/qadevOOo/runner/basicrunner/makefile.mk
new file mode 100644
index 000000000000..a1e1a7534b5d
--- /dev/null
+++ b/qadevOOo/runner/basicrunner/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:24 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = OOoRunner
+PACKAGE = basicrunner
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+JAVAFILES = BasicException.java BasicIfcTest.java BasicHandler.java BasicTestCase.java BasicHandlerProvider.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+SUBDIRS = basichelper
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/complexlib/ComplexTestCase.java b/qadevOOo/runner/complexlib/ComplexTestCase.java
new file mode 100644
index 000000000000..eabf9fb3cd94
--- /dev/null
+++ b/qadevOOo/runner/complexlib/ComplexTestCase.java
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComplexTestCase.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package complexlib;
+
+import java.lang.reflect.Method;
+import share.DescEntry;
+import lib.TestParameters;
+import com.sun.star.lang.XMultiServiceFactory;
+import share.LogWriter;
+import share.ComplexTest;
+
+public abstract class ComplexTestCase implements ComplexTest {
+
+ protected static TestParameters param;
+ protected static LogWriter log;
+ protected DescEntry subEntry;
+ protected boolean state;
+ protected String message;
+
+ /**
+ * Call test. It is expected, that an environment is
+ * given to this test.
+ *
+ * @param method The name of the test method that should be called.
+ * @param environment The environment for the test.
+ */
+ public void executeMethods(DescEntry entry,
+ TestParameters environment) {
+
+ // get the environment
+ param = environment;
+ log = entry.Logger;
+
+ //executeMethodTests
+ for (int i=0; i<entry.SubEntries.length; i++) {
+ state = true;
+ message = "";
+ subEntry = entry.SubEntries[i];
+ Method testMethod = null;
+ try {
+ testMethod = this.getClass().getMethod(
+ subEntry.entryName,null);
+ testMethod.invoke(this, null);
+ }
+ catch(java.lang.reflect.InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ log.println(t.toString());
+ log.println("Message: " + t.getMessage());
+ subEntry.State="PASSED.FAILED";
+ continue;
+ }
+ catch(java.lang.Exception e) {
+ log.println(e.getClass().getName());
+ log.println("Message: " + e.getMessage());
+// e.printStackTrace();
+ subEntry.State="SKIPPED.FAILED";
+ continue;
+ }
+ subEntry.State = (state?"PASSED.OK":message);
+ subEntry.hasErrorMsg = state;
+ subEntry.ErrorMsg = message;
+ }
+ }
+
+ public abstract String[] getTestMethodNames();
+
+ public abstract String getTestObjectName();
+
+ protected void assure(String msg, boolean state) {
+ this.state &= state;
+ if (!state) {
+ this.message += msg + "\r\n";
+ log.println(msg);
+ }
+ }
+
+ protected void addResult(String message, boolean state) {
+ String msg = message + " - " + state;
+ this.state &= state;
+ this.message += msg + "\r\n";
+ log.println(msg);
+ }
+
+ protected void failed(String msg) {
+ assure(msg, false);
+ }
+}
diff --git a/qadevOOo/runner/complexlib/makefile.mk b/qadevOOo/runner/complexlib/makefile.mk
new file mode 100644
index 000000000000..a3753039e49a
--- /dev/null
+++ b/qadevOOo/runner/complexlib/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:53 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = OOoRunner
+PACKAGE = complexlib
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+
+JAVAFILES = ComplexTestCase.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
new file mode 100644
index 000000000000..f68a57d7cfe8
--- /dev/null
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -0,0 +1,405 @@
+/*************************************************************************
+ *
+ * $RCSfile: APIDescGetter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import share.DescGetter;
+import share.DescEntry;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/*
+ * This is the Office-API specific DescGetter
+ *
+ */
+
+public class APIDescGetter implements DescGetter{
+
+ /*
+ * gets the needed information about a StarOffice component
+ * @param descPath Path to the ComponentDescription
+ * @param entry contains the entry name, e.g. sw.SwXBodyText
+ * @param debug if true some debug information is displayed on standard out
+ */
+
+ public DescEntry[] getDescriptionFor(String job, String descPath,
+ boolean debug) {
+ if (job.startsWith("-o")) {
+ job = job.substring(3,job.length()).trim();
+ DescEntry entry = getDescriptionForSingleJob(job,descPath,debug);
+ if (entry != null) {
+ return new DescEntry[]{entry};
+ } else return null;
+ } if (job.startsWith("-sce")) {
+ job = job.substring(5,job.length()).trim();
+ return getScenario(job,descPath,debug);
+ } else return null;
+ }
+
+ protected DescEntry[] getScenario(String url, String descPath, boolean debug) {
+ ArrayList entryList = new ArrayList();
+ DescEntry[] entries = null;
+ String line = "";
+ BufferedReader scenario = null;
+ try {
+ scenario = new BufferedReader(new FileReader(url));
+ } catch (java.io.FileNotFoundException fnfe) {
+ if (debug) System.out.println("Couldn't find file "+url);
+ return entries;
+ }
+ while (line != null) {
+ try {
+ line = scenario.readLine();
+ if (line != null) {
+ if (line.startsWith("-o")) {
+ entryList.add(getDescriptionForSingleJob(
+ line.substring(3,line.length()).trim(),descPath,debug));
+ }
+ }
+ } catch (java.io.IOException ioe) {
+ if (debug) System.out.println("Exception while reading scenario");
+ }
+ }
+ return DescArray(entryList.toArray());
+ }
+ protected DescEntry getDescriptionForSingleJob(
+ String job, String descPath, boolean debug) {
+ boolean isSingleInterface = job.indexOf("::")>0;
+ String fullJob = job;
+ if (isSingleInterface) {
+ job = job.substring(0,job.indexOf("::"));
+ }
+ if (job.startsWith("bugs")) {
+ DescEntry Entry = new DescEntry();
+ Entry.entryName=job;
+ Entry.longName=job;
+ Entry.EntryType="bugdoc";
+ Entry.isOptional=false;
+ Entry.isToTest=true;
+ Entry.SubEntryCount=0;
+ Entry.hasErrorMsg=false;
+ Entry.State="non possible";
+ return Entry;
+ }
+ DescEntry entry = null;
+ if (descPath != null) {
+ entry = getFromDirectory(descPath, job, debug);
+ } else {
+ entry = getFromJar(job, debug);
+ }
+ boolean foundInterface = false;
+ if (isSingleInterface && entry !=null) {
+ for (int i = 0; i<entry.SubEntryCount; i++) {
+ if (!(entry.SubEntries[i].longName).equals(fullJob)) {
+ entry.SubEntries[i].isToTest=false;
+ } else {
+ foundInterface=true;
+ entry.SubEntries[i].isToTest=true;
+ }
+ }
+ }
+ if (isSingleInterface && !foundInterface) {
+ entry.hasErrorMsg=true;
+ entry.ErrorMsg = "Couldn't find a description for "+fullJob;
+ }
+
+ return entry;
+ }
+
+ protected static DescEntry[] getSubEntries(BufferedReader cvsFile,
+ DescEntry parent, boolean debug) {
+ String line = "";
+ String old_ifc_name = "";
+ ArrayList ifc_names = new ArrayList();
+ ArrayList meth_names = new ArrayList();
+ DescEntry ifcDesc = null;
+ DescEntry methDesc = null;
+ String entryType = "service";
+ while (line != null ) {
+ try {
+ line = cvsFile.readLine();
+ if (line != null && line.length()>0) {
+ String ifc_name = line.substring(line.indexOf(";")+2,
+ line.lastIndexOf(";")-1);
+ String meth_name = line.substring(line.lastIndexOf(";")+2,
+ line.length()-1);
+
+ methDesc=new DescEntry();
+ if (meth_name.indexOf("#optional")>0) {
+ methDesc.isOptional=true;
+ meth_name = meth_name.substring(0,meth_name.indexOf("#"));
+ }
+
+ if (meth_name.endsWith("()")) {
+ methDesc.EntryType="method";
+ entryType = "interface";
+ } else {
+ methDesc.EntryType="property";
+ entryType = "service";
+ }
+ methDesc.entryName=meth_name;
+ methDesc.isToTest = true;
+ String withoutHash = ifc_name;
+ if (ifc_name.indexOf("#optional") > 0) {
+ withoutHash = ifc_name.substring(0,ifc_name.indexOf("#"));
+ }
+ methDesc.longName=parent.entryName+"::"+ withoutHash
+ +"::"+meth_name;
+
+
+ if (!ifc_name.equals(old_ifc_name)) {
+ if (ifcDesc != null) {
+ ifcDesc.SubEntries=DescArray(meth_names.toArray());
+ ifcDesc.SubEntryCount=meth_names.size();
+ meth_names.clear();
+ ifc_names.add(ifcDesc);
+ }
+ ifcDesc = new DescEntry();
+ ifcDesc.isToTest = true;
+ old_ifc_name = ifc_name;
+ if (ifc_name.indexOf("#optional") > 0) {
+ ifcDesc.isOptional = true;
+ ifc_name = ifc_name.substring(0,ifc_name.indexOf("#"));
+ }
+
+ StringTokenizer st = new StringTokenizer(ifc_name, ":");
+ String className="";
+
+ int count=3;
+
+ if (ifc_name.startsWith("drafts")) {
+ count = 4;
+ }
+
+ for (int i = 0; st.hasMoreTokens(); i++) {
+ String token = st.nextToken();
+
+ // skipping (drafts.)com.sun.star
+ if (i >= count) {
+ if (!st.hasMoreTokens()) {
+ // inserting '_' before the last token
+ token = "_" + token;
+ }
+ className += "." + token;
+ }
+ }
+ ifcDesc.EntryType=entryType;
+ ifcDesc.entryName="ifc"+className;
+ ifcDesc.longName=parent.entryName+"::"+ifc_name;
+ }
+
+ meth_names.add(methDesc);
+ }
+ } catch (java.io.IOException ioe) {
+ parent.hasErrorMsg = true;
+ parent.ErrorMsg = "IOException while reading the description";
+ return null;
+ }
+ }
+
+ ifcDesc.SubEntries=DescArray(meth_names.toArray());
+ ifcDesc.SubEntryCount=meth_names.size();
+ ifc_names.add(ifcDesc);
+ return DescArray(ifc_names.toArray());
+ }
+
+ protected static DescEntry setErrorDescription(DescEntry entry, String ErrorMsg) {
+ entry.hasErrorMsg = true;
+ entry.ErrorMsg = ErrorMsg;
+ return entry;
+ }
+
+ protected static DescEntry[] DescArray(Object[] list) {
+ DescEntry[] entries = new DescEntry[list.length];
+ for (int i = 0; i<list.length;i++) {
+ entries[i] = (DescEntry) list[i];
+ }
+ return entries;
+ }
+
+ protected DescEntry getFromJar(String aEntry, boolean debug) {
+ int dotindex = aEntry.indexOf('.');
+ if (dotindex == -1) return null;
+ String module = aEntry.substring(0,aEntry.indexOf('.'));
+ String shortName = aEntry.substring(aEntry.indexOf('.')+1);
+ DescEntry theEntry = new DescEntry();
+ theEntry.entryName = aEntry;
+ theEntry.longName = aEntry;
+ theEntry.isOptional = false;
+ theEntry.EntryType = "component";
+ theEntry.isToTest = true;
+ BufferedReader csvFile = null;
+
+ java.net.URL url = this.getClass().getResource("/objdsc/"+module);
+ if (url == null && debug) {
+ System.out.println("Jar File doesn't contain descriptions for" +
+ " module '" + module +"'.");
+ return null;
+ }
+
+ try {
+ if (url.openConnection()
+ instanceof sun.net.www.protocol.file.FileURLConnection) {
+ //it's a file url not a jar url
+ if (debug) System.out.println("Getting description from path.");
+ return getFromDirectory(url.getPath(),aEntry,debug);
+ }
+ }
+ catch(java.io.IOException e) {
+ e.printStackTrace();
+ }
+
+
+ try {
+ // open connection to Jar
+ java.net.JarURLConnection con = (java.net.JarURLConnection)url.openConnection();
+ // get Jar file from connection
+ java.util.jar.JarFile f = con.getJarFile();
+ // Enumerate over all entries
+ java.util.Enumeration e = f.entries();
+ while (e.hasMoreElements()) {
+ String entry = e.nextElement().toString();
+ if (entry.endsWith(shortName.trim()+".csv")) {
+ InputStream input =
+ this.getClass().getResourceAsStream("/" + entry);
+ csvFile =
+ new BufferedReader(new InputStreamReader(input));
+ }
+ }
+ }
+ catch(java.io.IOException e) {
+ e.printStackTrace();
+ }
+
+ DescEntry[] subEntries = getSubEntries(csvFile,theEntry,debug);
+
+ theEntry.SubEntryCount=subEntries.length;
+ theEntry.SubEntries=subEntries;
+
+ return theEntry;
+ }
+
+ protected static DescEntry getFromDirectory(String descPath, String entry,
+ boolean debug) {
+
+ int dotindex = entry.indexOf('.');
+ if (dotindex == -1) return null;
+ String fs = System.getProperty("file.separator");
+ String module = entry.substring(0,entry.indexOf('.'));
+ String shortName = entry.substring(entry.indexOf('.')+1);
+ DescEntry aEntry = new DescEntry();
+ aEntry.entryName = entry;
+ aEntry.longName = entry;
+ aEntry.isOptional = false;
+ aEntry.EntryType = "component";
+ aEntry.isToTest = true;
+
+ if (debug) {
+ System.out.println("Parsing Description Path: "+descPath);
+ System.out.println("Searching module: "+module);
+ System.out.println("For the Component "+shortName);
+ }
+
+ File modPath = new File(descPath+fs+module);
+
+ if (!modPath.exists()) {
+ return setErrorDescription(aEntry,"Couldn't find module "+module);
+ }
+
+ String[] files = modPath.list();
+ String found = "none";
+
+ for (int i=0;i<files.length;i++) {
+ if (files[i].endsWith(shortName+".csv")) {
+ found = files[i];
+ break;
+ }
+ }
+
+ if (found.equals("none")) {
+ return setErrorDescription(aEntry,"Couldn't find component "+entry);
+ }
+
+ String aUrl = descPath+fs+module+fs+found;
+
+ BufferedReader csvFile = null;
+ try {
+ csvFile = new BufferedReader(new FileReader(aUrl));
+ } catch (java.io.FileNotFoundException fnfe) {
+ return setErrorDescription(aEntry,"Couldn't find file "+aUrl);
+ }
+
+ DescEntry[] subEntries = getSubEntries(csvFile,aEntry,debug);
+
+ aEntry.SubEntryCount=subEntries.length;
+ aEntry.SubEntries=subEntries;
+
+ return aEntry;
+
+ }
+
+}
diff --git a/qadevOOo/runner/helper/AppProvider.java b/qadevOOo/runner/helper/AppProvider.java
new file mode 100644
index 000000000000..e3732299ad9b
--- /dev/null
+++ b/qadevOOo/runner/helper/AppProvider.java
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppProvider.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+/**
+ *
+ * Interface to get a Manager to access the application to check
+ */
+public interface AppProvider {
+
+ /**
+ * Method to get the desired Manager
+ */
+ public Object getManager(lib.TestParameters param);
+
+ /**
+ * Method to dispose the desired Manager
+ */
+ public boolean disposeManager(lib.TestParameters param);
+
+}
diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java
new file mode 100644
index 000000000000..8f2802fc5733
--- /dev/null
+++ b/qadevOOo/runner/helper/CfgParser.java
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * $RCSfile: CfgParser.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import lib.TestParameters;
+import java.util.Properties;
+import java.util.Enumeration;
+import java.io.FileInputStream;
+
+/**
+ * This class parses the ini files and stores the data
+ * <br>
+ * inside TestParameters
+ */
+public class CfgParser {
+
+ protected static String iniFile="";
+
+ public CfgParser(String ini) {
+ this.iniFile = ini;
+ }
+
+ public static void getIniParameters(TestParameters param) {
+ Properties cfg = null;
+ if (iniFile.equals("")) {
+ //no iniFile given, search one in the users home directory
+ cfg = getProperties(getDefaultFileName(true));
+ //try to search the user dir if no iniFile could be found yet
+ if (cfg == null) {
+ cfg = getProperties(getDefaultFileName(false));
+ }
+ } else {
+ cfg = getProperties(iniFile);
+ }
+ if (cfg != null) {
+ Enumeration cfgEnum = cfg.keys();
+ while (cfgEnum.hasMoreElements()) {
+ String pName = (String) cfgEnum.nextElement();
+ Object pValue = cfg.getProperty(pName);
+ param.put(pName,pValue);
+
+ if (pName.equals("TestDocumentPath")) {
+ System.setProperty("DOCPTH",(String)pValue);
+ }
+ }
+ }
+ }
+
+ protected static Properties getProperties(String name) {
+ Properties prop = new Properties();
+ FileInputStream propFile = null;
+ try {
+ propFile = new FileInputStream(name);
+ prop.load(propFile);
+ propFile.close();
+ } catch (Exception e) {
+ //Exception while reading prop-file, returning null
+ return null;
+ }
+ return prop;
+ }
+
+ protected static String getDefaultFileName(boolean home) {
+ String fileSeparator = System.getProperty("file.separator");
+ String path = "";
+ if (home) {
+ //look inside the home directory
+ path = System.getProperty("user.home");
+ } else {
+ path = System.getProperty("user.dir");
+ }
+ if (fileSeparator.equals("/")) {
+ //suppose I'm on Unix-platform
+ return path+fileSeparator+".runner.props";
+ } else {
+ //suppose I'm on Windows
+ System.out.println("Parsing "+path+fileSeparator+"runner.props");
+ return path+fileSeparator+"runner.props";
+ }
+ }
+
+}
diff --git a/qadevOOo/runner/helper/ClParser.java b/qadevOOo/runner/helper/ClParser.java
new file mode 100644
index 000000000000..4ebc348838bb
--- /dev/null
+++ b/qadevOOo/runner/helper/ClParser.java
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * $RCSfile: ClParser.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import lib.TestParameters;
+import java.util.Properties;
+/**
+ * This class parses commandline Argument and stores <br>
+ * them into TestParameter
+ */
+public class ClParser {
+
+ /*
+ * Parses the commandline argument and puts them<br>
+ * into the TestParameters
+ */
+ public void getCommandLineParameter(TestParameters param,String[] args) {
+ Properties mapping = getMapping();
+ int j = 0;
+ boolean isTestJob = false;
+ while ((!isTestJob) && j<args.length) {
+ String pName = "";
+ String pValue = "";
+ if (args.length > j+1) {
+ pName = getParameterFor(mapping,args[j]);
+ pValue = args[j+1];
+ isTestJob = pName.equals("TestJob");
+ }
+ param.put(pName,pValue);
+ if (pName.equals("TestDocumentPath")) {
+ System.setProperty("DOCPTH",pValue);
+ }
+ if (!isTestJob) {
+ j=j+2;
+ }
+ }
+ String job="";
+ for (int k=j;k<args.length;k++) {
+ job += args[k]+" ";
+ }
+ param.put("TestJob",job);
+ }
+
+ /*
+ * This method returns the path to a Configuration file <br>
+ * if defined as command line parameter, an empty String elsewhere
+ */
+
+ public String getIniPath(String[] args) {
+ String iniFile="";
+ for (int i=0;i<args.length;i++) {
+ if (args[i].equals("-ini")) {
+ iniFile=args[i+1];
+ }
+ }
+ return iniFile;
+ }
+
+ /*
+ * This method maps commandline Parameters to TestParameters
+ */
+
+ protected Properties getMapping() {
+ Properties map = new Properties();
+ map.setProperty("-cs","ConnectionString");
+ map.setProperty("-tb","TestBase");
+ map.setProperty("-tdoc","TestDocumentPath");
+ map.setProperty("-objdsc","DescriptionPath");
+ map.setProperty("-cmd","AppExecutionCommand");
+ map.setProperty("-o","TestJob");
+ map.setProperty("-sce","TestJob");
+ return map;
+ }
+
+ protected String getParameterFor(Properties map, String name) {
+ String ret = map.getProperty(name);
+ if (ret == null) {
+ ret = name.substring(1);
+ }
+ return ret;
+ }
+}
diff --git a/qadevOOo/runner/helper/ComplexDescGetter.java b/qadevOOo/runner/helper/ComplexDescGetter.java
new file mode 100644
index 000000000000..ef1bfc8255be
--- /dev/null
+++ b/qadevOOo/runner/helper/ComplexDescGetter.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComplexDescGetter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package helper;
+
+import complexlib.ComplexTestCase;
+import share.DescEntry;
+import share.DescGetter;
+import share.ComplexTest;
+
+/**
+ *
+ */
+public class ComplexDescGetter implements DescGetter {
+
+ ComplexTest testClass;
+ /** Creates new ComplexDescGetter */
+ public ComplexDescGetter(ComplexTest tClass) {
+
+ testClass = tClass;
+ }
+
+ public DescEntry[] getDescriptionFor(String entry, String DescPath,
+ boolean debug) {
+
+ if (debug) {
+ System.out.println("Searching Class: "+((Object)testClass).toString());
+ System.out.println("Test Name: "+entry);
+ }
+
+ String testObjectName = testClass.getTestObjectName();
+ if (testObjectName != null) {
+ if (testObjectName.equals(""))
+ testObjectName = entry;
+ }
+ else
+ testObjectName = entry;
+
+ String[] testMethodName = testClass.getTestMethodNames();
+ DescEntry dEntry = new DescEntry();
+
+ dEntry.entryName = testObjectName;
+ dEntry.longName = testObjectName;
+ dEntry.isOptional = false;
+ dEntry.EntryType = "unit";
+ dEntry.isToTest = true;
+ dEntry.SubEntryCount = testMethodName.length;
+ dEntry.SubEntries = new DescEntry[dEntry.SubEntryCount];
+ for (int i=0; i<dEntry.SubEntryCount; i++) {
+ DescEntry aEntry = new DescEntry();
+ aEntry.entryName = testMethodName[i];
+ aEntry.longName = aEntry.entryName;
+ aEntry.isOptional = false;
+ aEntry.EntryType = "method";
+ aEntry.isToTest = true;
+ dEntry.SubEntries[i] = aEntry;
+ }
+
+ return new DescEntry[]{dEntry};
+ }
+}
diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java
new file mode 100644
index 000000000000..5845e8e3b8b4
--- /dev/null
+++ b/qadevOOo/runner/helper/ConfigurationRead.java
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * $RCSfile: ConfigurationRead.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package helper;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.container.XHierarchicalName;
+import com.sun.star.container.XHierarchicalNameAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyState;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Read configuration settings.
+ */
+public class ConfigurationRead {
+
+ XHierarchicalNameAccess root = null;
+
+ /**
+ * Creates new ConfigurationRead
+ * @param xMSF An instance of service
+ * "com.sun.star.configuration.ConfigurationProvider"
+ * @param rootnode The root of the configuration nodes.
+ */
+ public ConfigurationRead(XMultiServiceFactory xMSF, String rootnode) {
+
+ PropertyValue [] nodeArgs = new PropertyValue [1];
+ PropertyValue nodepath = new PropertyValue();
+ nodepath.Name = "nodepath";
+ nodepath.Value = rootnode;
+ nodepath.Handle = -1;
+ nodepath.State = PropertyState.DEFAULT_VALUE;
+ nodeArgs[0]=nodepath;
+
+ try {
+ Object rootObject = xMSF.createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationAccess",
+ nodeArgs);
+
+ root = (XHierarchicalNameAccess)
+ UnoRuntime.queryInterface(
+ XHierarchicalNameAccess.class, rootObject);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Creates new ConfigurationRead. This uses "org.openoffice.Setup"
+ * as default root name.
+ * @param xMSF An instance of service
+ * "com.sun.star.configuration.ConfigurationProvider"
+ */
+ public ConfigurationRead(XMultiServiceFactory xMSF) {
+ this(xMSF, "org.openoffice.Setup");
+ }
+
+ /**
+ * Does the node with this hierarchical name exist?
+ * @param name The hierarchical name of a subnode.
+ * @return True, if the node exists.
+ */
+ public boolean hasByHieracrhicalName(String name) throws NoSuchElementException,
+ com.sun.star.lang.WrappedTargetException {
+
+ return root.hasByHierarchicalName(name);
+
+ }
+
+
+ /**
+ * Get the elements of the root node.
+ * @return All elements of the root node.
+ */
+ public String[] getRootNodeNames() {
+
+ XNameAccess xName = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class, root);
+ String[]names = xName.getElementNames();
+ return names;
+ }
+
+ /**
+ * Get all elements of this node
+ * @param name The name of the node
+ * @return All elements of this node (as hierarchical names).
+ */
+ public String[] getSubNodeNames(String name) {
+ String[]names = null;
+ try {
+
+ Object next = root.getByHierarchicalName(name);
+ XNameAccess x = (XNameAccess)UnoRuntime.queryInterface(
+ XNameAccess.class, next);
+ names = x.getElementNames();
+ for (int i=0; i< names.length; i++) {
+ names[i] = name + "/" + names[i];
+ }
+ }
+ catch(Exception e) {
+ //just return null, if there are no further nodes
+ }
+ return names;
+ }
+
+ /**
+ * Get contents of a node by its hierarchical name.
+ * @param The hierarchical name of the node.
+ * @return The contents as an object
+ */
+ public Object getByHierarchicalName(String name) throws NoSuchElementException {
+ return root.getByHierarchicalName(name);
+ }
+
+}
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
new file mode 100644
index 000000000000..5ee3d55adf3e
--- /dev/null
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * $RCSfile: OfficeProvider.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.uno.XComponentContext;
+
+/**
+ * This class will connect the office and start it if possible
+ *
+ */
+public class OfficeProvider implements AppProvider {
+
+ protected static boolean debug = false;
+
+ public boolean disposeManager(lib.TestParameters param) {
+ XMultiServiceFactory msf = param.getMSF();
+ if (msf == null) {
+ return true;
+ } else {
+ XDesktop desk = null;
+ try {
+ desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, msf.createInstance(
+ "com.sun.star.frame.Desktop"));
+ } catch (com.sun.star.uno.Exception ue) {
+ return false;
+ }
+
+ msf = null;
+ if (desk != null) {
+ desk.terminate();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Method to get the ServiceManager of an Office
+ */
+ public Object getManager(lib.TestParameters param) {
+ String cncstr = "uno:"+param.get("ConnectionString")+
+ ";urp;StarOffice.NamingService";
+ debug = ((Boolean) param.get("DebugIsActive")).booleanValue();
+ XMultiServiceFactory msf = null;
+ String exc = "";
+ try {
+ msf = connect(cncstr);
+ } catch (com.sun.star.uno.Exception ue) {
+ exc=ue.getMessage();
+ } catch (java.lang.Exception je) {
+ exc=je.getMessage();
+ }
+ if (msf != null) {
+ return msf;
+ }
+ if (debug) System.out.println("Exception while connecting "+exc);
+ boolean isExecutable = false;
+ boolean isAppKnown = cncstr.indexOf("host=localhost")>0;
+ isAppKnown &= !((String) param.get("AppExecutionCommand")).equals("");
+ if (isAppKnown) {
+ if (debug)
+ System.out.println("Local Connection trying to start the Office");
+ String cmd = (String) param.get("AppExecutionCommand");
+ ProcessHandler ph = new ProcessHandler(cmd);
+ isExecutable = ph.executeAsynchronously();
+ if (isExecutable) {
+ param.put("AppProvider",ph);
+ OfficeWatcher ow = new OfficeWatcher(param);
+ param.put("Watcher",ow);
+ ow.start();
+ ow.ping();
+ }
+ } else {
+ return msf;
+ }
+ exc = "";
+ int k=0;
+ while ((k<11) && (msf==null)) {
+ try {
+ Thread.sleep(k*1000);
+ msf = connect(cncstr);
+ } catch (com.sun.star.uno.Exception ue) {
+ exc=ue.getMessage();
+ } catch (java.lang.Exception je) {
+ exc=je.getMessage();
+ }
+ k++;
+ }
+ if (debug && msf==null) System.out.println(
+ "Exception while connecting "+exc);
+ return msf;
+ }
+
+ protected static XMultiServiceFactory connect( String connectStr )
+ throws com.sun.star.uno.Exception,
+ com.sun.star.uno.RuntimeException,
+ com.sun.star.connection.NoConnectException,
+ Exception {
+ // Get component context
+ XComponentContext xcomponentcontext =
+ com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(
+ null );
+
+ // initial serviceManager
+ XMultiComponentFactory xLocalServiceManager =
+ xcomponentcontext.getServiceManager();
+
+ // create a connector, so that it can contact the office
+ Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
+ "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext );
+ XUnoUrlResolver urlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(
+ XUnoUrlResolver.class, xUrlResolver );
+
+ Object rInitialObject = urlResolver.resolve( connectStr );
+
+ XNamingService rName = (XNamingService)UnoRuntime.queryInterface(
+ XNamingService.class, rInitialObject );
+
+ XMultiServiceFactory xMSF = null;
+ if( rName != null ) {
+ if (debug) System.out.println( "got the remote naming service !" );
+ Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager" );
+
+ xMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface( XMultiServiceFactory.class, rXsmgr );
+ }
+
+ return ( xMSF );
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/helper/OfficeWatcher.java b/qadevOOo/runner/helper/OfficeWatcher.java
new file mode 100644
index 000000000000..99958bdbec73
--- /dev/null
+++ b/qadevOOo/runner/helper/OfficeWatcher.java
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * $RCSfile: OfficeWatcher.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import java.lang.Thread;
+import lib.TestParameters;
+
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.XComponent;
+import com.sun.star.beans.PropertyValue;
+
+public class OfficeWatcher extends Thread implements share.Watcher {
+
+ TestParameters params;
+ String StoredPing = "";
+
+ /** Creates new OfficeWatcher */
+ public OfficeWatcher(TestParameters param) {
+ this.params = param;
+ }
+
+ /**
+ * pings the office watcher to check for changes
+ */
+ public void ping() {
+ StoredPing += ".";
+ }
+
+ public void run() {
+ boolean isDone = false;
+ ProcessHandler ph = (ProcessHandler) params.get("AppProvider");
+ if (ph == null) {
+ isDone = true;
+ }
+ while (!isDone) {
+ String previous = StoredPing;
+ shortWait();
+ if (StoredPing.equals(previous)){
+ isDone = true;
+ }
+ }
+ if (ph !=null) {
+ ph.kill();
+ }
+ shortWait();
+ }
+
+ protected void shortWait() {
+ try {
+ this.sleep(params.getInt("TimeOut"));
+ } catch (java.lang.InterruptedException ie) {}
+ }
+
+}
diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java
new file mode 100644
index 000000000000..9fbab0263a52
--- /dev/null
+++ b/qadevOOo/runner/helper/ProcessHandler.java
@@ -0,0 +1,391 @@
+/*************************************************************************
+ *
+ * $RCSfile: ProcessHandler.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import java.io.InputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.io.PrintWriter;
+import java.io.PrintStream;
+import java.io.LineNumberReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+/**
+ * Class collect information from input stream in
+ * background (sparate thread) and outputs it to
+ * some log stream. I helps to avoid buffer overflow
+ * when output stream has small buffer size (e.g.
+ * in case when handling stdout from external
+ * <code>Process</code>)
+ *
+ * This class is currently used by ProcesHandler
+ * internally only.
+ */
+class Pump extends Thread {
+ private LineNumberReader reader;
+ private String pref ;
+ private Pump thread ;
+ private StringBuffer buf = new StringBuffer(256);
+ private PrintWriter log ;
+
+ /**
+ * Creates Pump for specified <code>InputStream</code>.
+ * This Pump also synchronously output text read to
+ * log by prefixed lines. Constructor immediately
+ * starts reading in a separate thread.
+ *
+ * @param is Stream which requires permanent reading.
+ * @param log Writer where prefixed text lines to be output
+ * @param outPrefix A prefix which is printed at the
+ * beginning of each output line.
+ */
+ public Pump(InputStream is, PrintWriter log, String outPrefix) {
+ this.pref = outPrefix == null ? "" : outPrefix ;
+ reader = new LineNumberReader(new InputStreamReader(is));
+ this.log = log ;
+ start() ;
+ }
+
+ public void run() {
+ try {
+ String line = reader.readLine() ;
+ while (line != null) {
+ log.println(pref + line);
+ log.flush();
+ buf.append(line).append('\n');
+ line = reader.readLine() ;
+ }
+ } catch (java.io.IOException e) {
+ log.println(pref + "Exception occured: " + e) ;
+ }
+ }
+
+ /**
+ * Returns the text collected from input stream.
+ */
+ public String getStringBuffer() {
+ return buf.toString();
+ }
+}
+
+/**
+ * Class provides convenient way for running external program
+ * handle its standard streams, control execution and check results.
+ * Instance of this class must be created only for a single
+ * execution. If you need to execute the same command again you
+ * should create a new instance for this.
+ */
+public class ProcessHandler {
+ private String cmdLine;
+ private String[] envVars = null;
+ private File workDir = null;
+ private PrintWriter log;
+
+ private int exitValue = -1;
+ private boolean isFinished = false;
+ private boolean isStarted = false;
+
+ private String stdInBuff = "";
+ private Pump stdout = null ;
+ private Pump stderr = null ;
+ private PrintStream stdIn = null ;
+
+ private Process proc = null ;
+
+ /**
+ * Creates instance with specified external command and
+ * log stream where debug info is printed and output
+ * of external command.
+ */
+ public ProcessHandler(String cmdLine, PrintWriter log) {
+ this(cmdLine, log, null, null);
+ }
+ /**
+ * Creates instance with specified external command.
+ * Debug info and output
+ * of external commandis printed to stdout.
+ */
+ public ProcessHandler(String cmdLine) {
+ this(cmdLine, null, null, null);
+ }
+ /**
+ * Creates instance with specified external command which
+ * will be executed in the some work directory and
+ * log stream where debug info and output
+ * of external command is printed .
+ * The specified environment variables are set for the new process.
+ * If log stream is null, logging is printed to stdout.
+ */
+ public ProcessHandler(String cmdLine, PrintWriter log,
+ File workDir, String[] envVars) {
+ this.cmdLine = cmdLine ;
+ this.workDir = workDir;
+ this.log = log;
+ this.cmdLine = cmdLine ;
+ this.envVars = envVars;
+ if (log == null)
+ this.log = new PrintWriter(new OutputStreamWriter(System.out));
+ else
+ this.log = log;
+ }
+ /**
+ * Creates instance with specified external command which
+ * will be executed in the some work directory.
+ * Debug info and output
+ * of external commandis printed to stdout.
+ */
+ public ProcessHandler(String cmdLine, File workDir) {
+ this(cmdLine, null, workDir, null);
+ }
+
+ /**
+ * Executes the command and returns only when the process
+ * exits.
+ *
+ * @return <code>true</code> if process was successfully
+ * started and correcly exits (exit code doesn't affect
+ * to this result).
+ */
+ public boolean executeSynchronously() {
+ execute() ;
+ return waitFor() ;
+ }
+
+ /**
+ * Executes the command immediately returns. The process
+ * remains in running state. Control of its state should
+ * be made by <code>waitFor</code> methods.
+ *
+ * @return <code>true</code> if process was successfully
+ * started.
+ */
+ public boolean executeAsynchronously() {
+ execute() ;
+ return isStarted() ;
+ }
+
+ public void kill() {
+ if (!isStarted()) return;
+ proc.destroy();
+ isStarted = false;
+ }
+
+ protected void execute() {
+ if (isStarted()) {
+ throw new RuntimeException(
+ "The process handler has already been executed.") ;
+ }
+ Runtime runtime = Runtime.getRuntime() ;
+ try {
+ log.println("Starting command: " + cmdLine) ;
+ if (workDir != null) {
+ proc = runtime.exec(cmdLine, envVars, workDir) ;
+ } else {
+ proc = runtime.exec(cmdLine, envVars) ;
+ }
+
+ isStarted = true ;
+ } catch (java.io.IOException e) {
+ log.println("The command "+cmdLine+" can't be started: " + e);
+ return;
+ }
+ stdout = new Pump(proc.getInputStream(), log, "out > ");
+ stderr = new Pump(proc.getErrorStream(), log, "err > ");
+ stdIn = new PrintStream(proc.getOutputStream()) ;
+
+ flushInput() ;
+ }
+
+ /**
+ * This method is useful when the process was executed
+ * asynchronously. Waits for process to exit and return
+ * its result.
+ *
+ * @return <code>true</code> if process correctly exited
+ * (exit code doesn't affect to this result).
+ */
+ public boolean waitFor() {
+ return waitFor(0) ;
+ }
+
+ /**
+ * This method is useful when the process was executed
+ * asynchronously. Waits during specified time for process
+ * to exit and return its status.
+ *
+ * @return <code>true</code> if process correctly exited
+ * (exit code doesn't affect to this result).
+ */
+ public boolean waitFor(long timeout) {
+ if (isFinished()) return true ;
+ if (!isStarted()) return false ;
+
+ if (timeout == 0) {
+ try {
+ proc.waitFor() ;
+ } catch (InterruptedException e) {
+ log.println("The process was interrupted: " + e);
+ }
+ isFinished = true ;
+ try {
+ exitValue = proc.exitValue() ;
+ } catch (IllegalThreadStateException e) {}
+ } else {
+ try {
+ while (!isFinished && timeout > 0) {
+ isFinished = true ;
+ Thread.sleep(1000);
+ timeout -= 1000 ;
+ try {
+ exitValue = proc.exitValue() ;
+ } catch (IllegalThreadStateException e) {
+ isFinished = false ;
+ }
+ }
+ } catch (InterruptedException ex) {
+ log.println("The process was interrupted: " + ex);
+ }
+ }
+
+ if (!isFinished) {
+ proc.destroy();
+ }
+
+ try {
+ stdout.join();
+ stderr.join();
+ } catch (InterruptedException e) {}
+
+ return isFinished() ;
+ }
+
+ protected void flushInput() {
+ if (stdIn == null) return ;
+
+ synchronized(stdInBuff) {
+ stdIn.print(stdInBuff);
+ stdIn.flush();
+ stdInBuff = "" ;
+ }
+ }
+
+ /**
+ * Returns the text output by external command to stdout.
+ */
+ public String getOutputText() {
+ return stdout.getStringBuffer();
+ }
+ /**
+ * Returns the text output by external command to stderr.
+ */
+ public String getErrorText() {
+ return stderr.getStringBuffer();
+ }
+
+ /**
+ * Prints the string specified to sdtin of external
+ * command. '\n' is not added so if you need you
+ * should terminate the string with '\n'. <p>
+ *
+ * The method can also be called before the command
+ * starts its execution. Then the text is buffered
+ * and transfered to command when it will be started.
+ */
+ public void printInputText(String str) {
+ stdInBuff += str ;
+ flushInput();
+ }
+
+ /**
+ * Returns information about was the command started or
+ * not.
+ *
+ * @return <code>true</code> if the external command was
+ * found and successfully started.
+ */
+ public boolean isStarted() {
+ return isStarted ;
+ }
+
+ /**
+ * Returns the information about the final state of command
+ * execution.
+ *
+ * @return <code>true</code> if the command correctly starts,
+ * exits and was not interrupted due to timeout.
+ */
+ public boolean isFinished() {
+ return isFinished ;
+ }
+
+ /**
+ * Returns exit code of the external command.
+ *
+ * @return exit code of command if it was finished,
+ * -1 if not.
+ */
+ public int getExitCode() {
+ return exitValue ;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/helper/StreamSimulator.java b/qadevOOo/runner/helper/StreamSimulator.java
new file mode 100644
index 000000000000..cb1abb9ed297
--- /dev/null
+++ b/qadevOOo/runner/helper/StreamSimulator.java
@@ -0,0 +1,569 @@
+/*************************************************************************
+ *
+ * $RCSfile: StreamSimulator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+import com.sun.star.uno.UnoRuntime;
+
+
+import com.sun.star.lang.DisposedException;
+import com.sun.star.uno.RuntimeException;
+import com.sun.star.uno.Exception;
+import com.sun.star.ucb.XSimpleFileAccess;
+
+/**
+ * It simulates an input and output stream and
+ * implements the interfaces XInputStream, XOutputStream.
+ * So it can be used for testing loading/saving of documents
+ * using streams instead of URLs.
+ *
+ */
+public class StreamSimulator implements com.sun.star.io.XInputStream ,
+ com.sun.star.io.XOutputStream ,
+ com.sun.star.io.XSeekable
+{
+ //_________________________________
+ /**
+ * @member m_sFileName name of the corrsponding file on disk
+ * @member m_xInStream the internal input stream for reading
+ * @member m_xOutStream the internal input stream for writing
+ * @member m_xSeek points at runtime to m_xInStream or m_xOutStream and make it seekable
+ *
+ * @member //m_aProtocol the external set protocol object for logging messages
+ * @member m_bInWasUsed indicates, that the input stream interface was used
+ * @member m_bOutWasUsed indicates, that the output stream interface was used
+ */
+
+ private String m_sFileName ;
+ private com.sun.star.io.XInputStream m_xInStream ;
+ private com.sun.star.io.XOutputStream m_xOutStream ;
+ private com.sun.star.io.XSeekable m_xSeek ;
+
+ //public ComplexTestEnvironment //m_aProtocol ;
+ public boolean m_bInWasUsed ;
+ public boolean m_bOutWasUsed ;
+
+ //_________________________________
+ /**
+ * construct a new instance of this class
+ * It set the name of the correspojnding file on disk, which
+ * should be source or target for the following operations on
+ * this object. And it regulate if it should function as
+ * input or output stream.
+ *
+ * @param sFileName
+ * name of the file on disk
+ * Will be used as source (if param bInput==true)
+ * or as target (if param bInput==false).
+ *
+ * @param bInput
+ * it specify, which interface should work at this object.
+ * <TRUE/> => we simulate an input stream
+ * <FALSE/> => we simulate an output stream
+ *
+ * @throw com.sun.star.io.NotConnectedException
+ * in case the internal streams to the file on disk couldn't established.
+ * They are neccessary. Otherwhise this simulator can't realy work.
+ */
+ public StreamSimulator( String sFileName , boolean bInput ,
+ lib.TestParameters param ) throws com.sun.star.io.NotConnectedException
+ {
+ ////m_aProtocol = new ComplexTestEnvironment();
+ m_sFileName = sFileName ;
+ m_bInWasUsed = false ;
+ m_bOutWasUsed = false ;
+
+ try
+ {
+ XSimpleFileAccess xHelper = (XSimpleFileAccess)
+ UnoRuntime.queryInterface(XSimpleFileAccess.class,
+ param.getMSF().createInstance("com.sun.star.ucb.SimpleFileAccess"));
+/* com.sun.star.ucb.XSimpleFileAccess xHelper = (com.sun.star.ucb.XSimpleFileAccess)OfficeConnect.createRemoteInstance(
+ com.sun.star.ucb.XSimpleFileAccess.class,
+ "com.sun.star.ucb.SimpleFileAccess");*/
+
+ if (xHelper == null)
+ throw new com.sun.star.io.NotConnectedException("ucb helper not available. Can't create streams.");
+
+ if (bInput)
+ {
+ m_xInStream = xHelper.openFileRead(m_sFileName);
+ m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface(
+ com.sun.star.io.XSeekable.class,
+ m_xInStream);
+ }
+ else
+ {
+ m_xOutStream = xHelper.openFileWrite(m_sFileName);
+ m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface(
+ com.sun.star.io.XSeekable.class,
+ m_xOutStream);
+ }
+ }
+ catch(com.sun.star.uno.Exception exUno)
+ {
+ ////m_aProtocol.log("\tstream not open. throw NotConnectedException\n\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("Could not open the file.");
+ }
+ }
+
+ public void finalize()
+ {
+ ////m_aProtocol.log("finalize was called. Please check if it was right or not.\n");
+ }
+
+ //_________________________________
+ /**
+ * following methods simulates the XInputStream.
+ * The notice all actions inside the internal protocol
+ * and try to map all neccessary functions to the internal
+ * open in-stream.
+ */
+ public int readBytes( /*OUT*/ byte[][] lData ,
+ /*IN*/ int nBytesToRead ) throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("readBytes(lData["+lData.length+"]["+lData[0]+"],"+nBytesToRead+")\n{\n");
+ m_bInWasUsed = true;
+
+ if (m_xInStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ int nRead = 0;
+ try
+ {
+ nRead = m_xInStream.readBytes(lData,nBytesToRead);
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\treads "+nRead+" bytes\n\tOK\n}\n");
+
+ //if (nRead != nBytesToRead)
+ //m_aProtocol.log("there are some missing bytes for reading!\n");
+
+ return nRead;
+ }
+
+ //_________________________________
+
+ public int readSomeBytes( /*OUT*/ byte[][] lData ,
+ /*IN*/ int nMaxBytesToRead ) throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException ,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("readSomeBytes(lData["+lData.length+"]["+lData[0]+"],"+nMaxBytesToRead+")\n{\n");
+ m_bInWasUsed = true;
+
+ if (m_xInStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ int nRead = 0;
+ try
+ {
+ nRead = m_xInStream.readSomeBytes(lData,nMaxBytesToRead);
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\treads "+nRead+" bytes\n\tOK\n}\n");
+
+ //if (nRead != nMaxBytesToRead)
+ //m_aProtocol.log("there are some missing bytes for reading!");
+
+ return nRead;
+ }
+
+ //_________________________________
+
+ public void skipBytes( /*IN*/ int nBytesToSkip ) throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException ,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("skipBytes("+nBytesToSkip+")\n{\n");
+ m_bInWasUsed = true;
+
+ if (m_xInStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ try
+ {
+ m_xInStream.skipBytes(nBytesToSkip);
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+
+ public int available() throws com.sun.star.io.NotConnectedException,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("available()\n{\n");
+ m_bInWasUsed = true;
+
+ if (m_xInStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ int nAvailable = 0;
+ try
+ {
+ nAvailable = m_xInStream.available();
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n"); throw exConnect;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\treturns "+nAvailable+" bytes\n\tOK\n}\n");
+ return nAvailable;
+ }
+
+ //_________________________________
+
+ public void closeInput() throws com.sun.star.io.NotConnectedException,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("closeInput()\n{\n");
+ m_bInWasUsed = true;
+
+ if (m_xInStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ try
+ {
+ m_xInStream.closeInput();
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n"); throw exConnect;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+ /**
+ * following methods simulates the XOutputStream.
+ * The notice all actions inside the internal protocol
+ * and try to map all neccessary functions to the internal
+ * open out-stream.
+ */
+ public void writeBytes( /*IN*/byte[] lData ) throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException ,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("writeBytes(lData["+lData.length+"])\n{\n");
+ m_bOutWasUsed = true;
+
+ if (m_xOutStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ try
+ {
+ m_xOutStream.writeBytes(lData);
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+
+ public void flush() throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException ,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("flush()\n{\n");
+ m_bOutWasUsed = true;
+
+ if (m_xOutStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ try
+ {
+ m_xOutStream.flush();
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+
+ public void closeOutput() throws com.sun.star.io.NotConnectedException ,
+ com.sun.star.io.BufferSizeExceededException,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("closeOutput()\n{\n");
+ m_bOutWasUsed = true;
+
+ if (m_xOutStream == null)
+ {
+ //m_aProtocol.log("\tstream not open. throw NotConnectedException\n\tfailed\n}\n");
+ throw new com.sun.star.io.NotConnectedException("stream not open");
+ }
+
+ try
+ {
+ m_xOutStream.closeOutput();
+ }
+ catch (com.sun.star.io.NotConnectedException exConnect) { //m_aProtocol.log("\tgot NotConnectedException\n\tfailed\n}\n" ); throw exConnect;
+ }
+ catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { //m_aProtocol.log("\tgot BufferSizeExceededException\n\tfailed\n}\n"); throw exBuffer;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+ /**
+ * following methods simulates the XSeekable.
+ * The notice all actions inside the internal protocol
+ * and try to map all neccessary functions to the internal
+ * open stream.
+ */
+ public void seek( /*IN*/long nLocation ) throws com.sun.star.lang.IllegalArgumentException,
+ com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("seek("+nLocation+")\n{\n");
+
+ if (m_xInStream != null)
+ m_bInWasUsed = true;
+ else
+ if (m_xOutStream != null)
+ m_bOutWasUsed = true;
+ else
+ //m_aProtocol.log("\tno stream open!\n");
+
+ if (m_xSeek == null)
+ {
+ //m_aProtocol.log("\tstream not seekable. throw IOException\n\tfailed\n}\n");
+ throw new com.sun.star.io.IOException("stream not seekable");
+ }
+
+ try
+ {
+ m_xSeek.seek(nLocation);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException exArg ) { //m_aProtocol.log("\tgot IllegalArgumentException\n\tfailed\n}\n" ); throw exArg;
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n" ); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\tOK\n}\n");
+ }
+
+ //_________________________________
+
+ public long getPosition() throws com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("getPosition()\n{\n");
+
+ if (m_xInStream != null)
+ m_bInWasUsed = true;
+ else
+ if (m_xOutStream != null)
+ m_bOutWasUsed = true;
+ else
+ //m_aProtocol.log("\tno stream open!\n");
+
+ if (m_xSeek == null)
+ {
+ //m_aProtocol.log("\tstream not seekable. throw IOException\n\tfailed\n}\n");
+ throw new com.sun.star.io.IOException("stream not seekable");
+ }
+
+ long nPos = 0;
+ try
+ {
+ nPos = m_xSeek.getPosition();
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n"); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\treturns pos="+nPos+"\n\tOK\n}\n");
+ return nPos;
+ }
+
+ //_________________________________
+
+ public long getLength() throws com.sun.star.io.IOException
+ {
+ //m_aProtocol.log("getLength()\n{\n");
+
+ if (m_xInStream != null)
+ m_bInWasUsed = true;
+ else
+ if (m_xOutStream != null)
+ m_bOutWasUsed = true;
+ else
+ //m_aProtocol.log("\tno stream open!\n");
+
+ if (m_xSeek == null)
+ {
+ //m_aProtocol.log("\tstream not seekable. throw IOException\n\tfailed\n}\n");
+ throw new com.sun.star.io.IOException("stream not seekable");
+ }
+
+ long nLen = 0;
+ try
+ {
+ nLen = m_xSeek.getLength();
+ }
+ catch (com.sun.star.io.IOException exIO ) { //m_aProtocol.log("\tgot IOException\n\tfailed\n}\n" ); throw exIO;
+ }
+ catch (com.sun.star.uno.RuntimeException exRuntime) { //m_aProtocol.log("\tgot RuntimeException\n\tfailed\n}\n"); throw exRuntime;
+ }
+ catch (com.sun.star.uno.Exception exUno ) { //m_aProtocol.log("\tgot Exception\n\tfailed\n}\n" );
+ }
+
+ //m_aProtocol.log("\treturns len="+nLen+"\n\tOK\n}\n");
+ return nLen;
+ }
+}
diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java
new file mode 100644
index 000000000000..7c81a7d718d5
--- /dev/null
+++ b/qadevOOo/runner/helper/URLHelper.java
@@ -0,0 +1,335 @@
+/*************************************************************************
+ *
+ * $RCSfile: URLHelper.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package helper;
+
+// __________ Imports __________
+
+// structs, const, ...
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.util.URL;
+
+// exceptions
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.RuntimeException;
+import java.net.MalformedURLException;
+
+// interfaces
+import com.sun.star.util.XURLTransformer;
+
+// helper
+import com.sun.star.uno.UnoRuntime;
+
+// others
+import java.io.File;
+import java.util.Vector;
+import java.util.Enumeration;
+
+
+/**
+ * It collects some static helper functons to handle URLs.
+ * Sometimes it's neccessary to convert URL from/to system pathes.
+ * Or from string to strutural notations (e.g. com.sun.star.util.URL).
+ * And sometimes java had another notation then the office it has.
+ *
+ */
+public class URLHelper
+{
+ // ____________________
+
+ /**
+ * Because the office need URLs for loading/saving documents
+ * we must convert used system pathes.
+ * And java use another notation for file URLs ... correct it.
+ *
+ * @param aSystemPath
+ * represent the file in system notation
+ *
+ * @return [String]
+ * a file url which represent the given system path
+ */
+ public static String getFileURLFromSystemPath( File aSystemPath )
+ {
+ String sFileURL = null;
+ try
+ {
+ //sFileURL = aSystemPath.toURI().toURL().toString();
+ sFileURL = aSystemPath.toURL().toString();
+ }
+ catch( MalformedURLException exWrong )
+ {
+ sFileURL = null;
+ }
+
+ // problem of java: file URL's are coded with 1 slash instead of 2 or 3 ones!
+ // => correct this problem first, otherwise office can't use these URL's
+ if(
+ (sFileURL != null ) &&
+ (sFileURL.startsWith("file:/") == true ) &&
+ (sFileURL.startsWith("file://") == false)
+ )
+ {
+ StringBuffer sWorkBuffer = new StringBuffer(sFileURL);
+ sWorkBuffer.insert(6,"//");
+ sFileURL = sWorkBuffer.toString();
+ }
+
+ return sFileURL;
+ }
+
+ // ____________________
+
+ /**
+ * The same as getFileURLFromSystemPath() before but uses string parameter instead
+ * of a File type. It exist to supress converting of neccessary parameters in the
+ * outside code. But of course getFileURLFromSystemPath(File) will be a little bit faster
+ * then this method ...
+ *
+ * @param sSystemPath
+ * represent the file in system notation
+ *
+ * @return [String]
+ * a file url which represent the given system path
+ */
+ public static String getFileURLFromSystemPath( String sSystemPath )
+ {
+ return getFileURLFromSystemPath(new File(sSystemPath));
+ }
+
+ // ____________________
+
+ /**
+ * Does the same as getFileURLFromSystemPath() before ... but uses
+ * the given protocol string (e.g."http://") insted of "file:///".
+ *
+ * @param aSystemPath
+ * represent the file in system notation
+ *
+ * @param aBasePath
+ * define the base path of the aSystemPath value,
+ * which must be replaced with the value of "sServerPath".
+ *
+ * @param sServerURL
+ * Will be used to replace sBasePath.
+ *
+ * @example
+ * System Path = "d:\test\file.txt"
+ * Base Path = "d:\test"
+ * Server Path = "http://alaska:8000"
+ * => "http://alaska:8000/file.txt"
+ *
+ * @return [String]
+ * an url which represent the given system path
+ * and uses the given protocol
+ */
+ public static String getURLWithProtocolFromSystemPath( File aSystemPath, File aBasePath, String sServerURL )
+ {
+ String sFileURL = URLHelper.getFileURLFromSystemPath(aSystemPath);
+ String sBaseURL = URLHelper.getFileURLFromSystemPath(aBasePath );
+
+ // cut last '/'!
+ if (sBaseURL.lastIndexOf('/')==(sBaseURL.length()-1))
+ sBaseURL = sBaseURL.substring(0,sBaseURL.length()-1);
+
+ // cut last '/'!
+ if (sServerURL.lastIndexOf('/')==(sServerURL.length()-1))
+ sServerURL = sServerURL.substring(0,sServerURL.length()-1);
+
+ int index = sFileURL.indexOf(sBaseURL);
+ String sURL = sFileURL.substring(0,index) + sServerURL +
+ sFileURL.substring(index+sBaseURL.length());
+ //String sURL = sFileURL.replaceFirst(sBaseURL,sServerURL);
+ return sURL;
+ }
+
+ // ____________________
+
+ /**
+ * The same as getURLWithProtocolFromSystemPath() before but uses string parameter instead
+ * of a File types. It exist to supress converting of neccessary parameters in the
+ * outside code. But of course getURLWithProtocolFromSystemPath(File,File,String) will be
+ * a little bit faster then this method ...
+ *
+ * @param sSystemPath
+ * represent the file in system notation
+ *
+ * @param sBasePath
+ * define the base path of the aSystemPath value,
+ * which must be replaced with the value of "sServerPath".
+ *
+ * @param sServerPath
+ * Will be used to replace sBasePath.
+ *
+ * @example
+ * System Path = "d:\test\file.txt"
+ * Base Path = "d:\test"
+ * Server Path = "http://alaska:8000"
+ * => "http://alaska:8000/file.txt"
+ *
+ * @return [String]
+ * an url which represent the given system path
+ * and uses the given protocol
+ */
+ public static String getURLWithProtocolFromSystemPath( String sSystemPath, String sBasePath, String sServerPath )
+ {
+ return getURLWithProtocolFromSystemPath(new File(sSystemPath), new File(sBasePath), sServerPath);
+ }
+
+ // ____________________
+
+ /**
+ * This convert an URL (formated as a string) to a struct com.sun.star.util.URL.
+ * It use a special service to do that: the URLTransformer.
+ * Because some API calls need it and it's not allowed to set "Complete"
+ * part of the util struct only. The URL must be parsed.
+ *
+ * @param sURL
+ * URL for parsing in string notation
+ *
+ * @return [com.sun.star.util.URL]
+ * URL in UNO struct notation
+ */
+ public static com.sun.star.util.URL parseURL(XURLTransformer xParser, String sURL)
+ {
+ com.sun.star.util.URL aURL = null;
+
+ if (sURL==null || sURL.equals(""))
+ return null;
+
+ try
+ {
+ // Create special service for parsing of given URL.
+/* com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)OfficeConnect.createRemoteInstance(
+ com.sun.star.util.XURLTransformer.class,
+ "com.sun.star.util.URLTransformer");
+*/
+ // Because it's an in/out parameter we must use an array of URL objects.
+ com.sun.star.util.URL[] aParseURL = new com.sun.star.util.URL[1];
+ aParseURL[0] = new com.sun.star.util.URL();
+ aParseURL[0].Complete = sURL;
+
+ // Parse the URL
+ xParser.parseStrict(aParseURL);
+
+ aURL = aParseURL[0];
+ }
+ catch(com.sun.star.uno.RuntimeException exRuntime)
+ {
+ // Any UNO method of this scope can throw this exception.
+ // Reset the return value only.
+ aURL = null;
+ }
+
+ return aURL;
+ }
+
+ //_________________________________
+ /**
+ * Return a name list of all available files of a directory.
+ * We filter pure sub directories names. All other files
+ * are returned as full qualified URL strings. So they can be
+ * used for further purposes. One parameter define the start directory,
+ * another one describe the url protocol, which the return URL names should have.
+ *
+ * @param sDir
+ * the start directory, which should include all test files
+ *
+ * @return [Vector]
+ * a filtered list of java File objects of all available files of the start dir
+ * and all accessable sub directories.
+ */
+ public static Vector getSystemFilesFromDir(String sStartDir)
+ {
+ File aRoot = new File(sStartDir);
+
+ if (! aRoot.exists())
+ return null;
+
+ if (! aRoot.isDirectory())
+ return null;
+
+ File[] lAllFiles = aRoot.listFiles();
+ if (lAllFiles == null )
+ return null;
+
+ Vector lFilteredFiles = new Vector(lAllFiles.length);
+
+ for (int i=0; i<lAllFiles.length; ++i)
+ {
+ if (lAllFiles[i].isFile())
+ lFilteredFiles.add(lAllFiles[i]);
+ else
+ if (lAllFiles[i].isDirectory())
+ {
+ // recursion!
+ Vector lSubFiles = URLHelper.getSystemFilesFromDir(lAllFiles[i].getPath());
+ if (lSubFiles != null)
+ {
+ Enumeration aSnapshot = lSubFiles.elements();
+ while (aSnapshot.hasMoreElements())
+ lFilteredFiles.add(aSnapshot.nextElement());
+ }
+ }
+ }
+
+ return lFilteredFiles;
+ }
+}
diff --git a/qadevOOo/runner/helper/WindowListener.java b/qadevOOo/runner/helper/WindowListener.java
new file mode 100644
index 000000000000..a19ae27c62c0
--- /dev/null
+++ b/qadevOOo/runner/helper/WindowListener.java
@@ -0,0 +1,78 @@
+/*
+ * WindowListener.java
+ *
+ * Created on 30. Juli 2002, 12:36
+ */
+
+package helper;
+
+/**
+ * An own implementation of a XWindowListener
+ *
+ */
+public class WindowListener implements com.sun.star.awt.XWindowListener {
+
+ // hidden called
+ public boolean hiddenTrigger;
+ // move called
+ public boolean movedTrigger;
+ // resize called
+ public boolean resizedTrigger;
+ // show called
+ public boolean shownTrigger;
+ // dispose called
+ public boolean disposeTrigger;
+
+ /**
+ * Creates a new WindowListener
+ */
+ public WindowListener() {
+ resetTrigger();
+ }
+
+ /**
+ * The window hidden event
+ */
+ public void windowHidden(com.sun.star.lang.EventObject eventObject) {
+ hiddenTrigger = true;
+ }
+
+ /**
+ * The window move event
+ */
+ public void windowMoved(com.sun.star.awt.WindowEvent windowEvent) {
+ movedTrigger = true;
+ }
+
+ /**
+ * The window resize event
+ */
+ public void windowResized(com.sun.star.awt.WindowEvent windowEvent) {
+ resizedTrigger = true;
+ }
+
+ /**
+ * The window show event
+ */
+ public void windowShown(com.sun.star.lang.EventObject eventObject) {
+ shownTrigger = true;
+ }
+
+ /**
+ * The dispose event
+ */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposeTrigger = true;
+ }
+
+ /**
+ * Reset all triggers to "not fired".
+ */
+ public void resetTrigger() {
+ hiddenTrigger = false;
+ movedTrigger = false;
+ resizedTrigger = false;
+ shownTrigger = false;
+ disposeTrigger = false;
+ }
+}
diff --git a/qadevOOo/runner/helper/makefile.mk b/qadevOOo/runner/helper/makefile.mk
new file mode 100644
index 000000000000..21bda0ba88fc
--- /dev/null
+++ b/qadevOOo/runner/helper/makefile.mk
@@ -0,0 +1,95 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:31 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = Runner
+PACKAGE = helper
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar juh.jar jut.jar \
+ unoil.jar
+
+JAVAFILES = APIDescGetter.java \
+ ConfigurationRead.java \
+ StreamSimulator.java \
+ AppProvider.java \
+ URLHelper.java \
+ CfgParser.java \
+ WindowListener.java \
+ ClParser.java \
+ OfficeWatcher.java \
+ OfficeProvider.java \
+ ComplexDescGetter.java \
+ ProcessHandler.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/lib/DynamicClassLoader.java b/qadevOOo/runner/lib/DynamicClassLoader.java
new file mode 100644
index 000000000000..105a77c61afe
--- /dev/null
+++ b/qadevOOo/runner/lib/DynamicClassLoader.java
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: DynamicClassLoader.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib ;
+
+public class DynamicClassLoader {
+
+ /**
+ * This method returns a class created by it's name
+ * created by call to <code>Class.forName()</code>.<p>
+ * This method must be overloaded if another loading
+ * policy is reauired for Component and Interface
+ * testing classes.
+ */
+ public static Class forName(String className)
+ throws ClassNotFoundException {
+
+ return Class.forName(className) ;
+ }
+
+ public Object getInstance(String className) {
+ try {
+ Class cls = DynamicClassLoader.forName(className);
+ return cls.newInstance();
+ } catch ( ClassNotFoundException e ) {
+ throw new IllegalArgumentException("Couldn't find " + className
+ + " " + e);
+ } catch ( IllegalAccessException e ) {
+ throw new IllegalArgumentException("Couldn't access " + className
+ + " " + e);
+ } catch ( InstantiationException e ) {
+ throw new IllegalArgumentException("Couldn't instantiate " +
+ className + " " + e);
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/ExceptionStatus.java b/qadevOOo/runner/lib/ExceptionStatus.java
new file mode 100644
index 000000000000..342b9a36252e
--- /dev/null
+++ b/qadevOOo/runner/lib/ExceptionStatus.java
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: ExceptionStatus.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+/**
+ * The class implements Status behaviour for exception runstate Status objects.
+ */
+class ExceptionStatus extends Status {
+ /**
+ * Contains the exception which caused the abnormal activty termination.
+ */
+ private final Throwable exception;
+
+ /**
+ * Creates an instance of Status object with EXCEPTION runstate.
+ *
+ * @param t the exception an activity terminated with.
+ */
+ ExceptionStatus( Throwable t ) {
+ exception = t;
+ }
+
+ /**
+ * @return state of the Status: FAILED.
+ */
+ public int getState() {
+ return FAILED;
+ }
+
+ /**
+ * @return the run state of the Status: EXCEPTION.
+ */
+ public int getRunState() {
+ return EXCEPTION;
+ }
+
+ /**
+ * @return a string describing run state of the Status.
+ */
+ public String getRunStateString() {
+ return exception.toString();
+ }
+
+ /**
+ * Compares this Status with obj.
+ *
+ * @return <tt>true</tt> if obj is an ExceptionStatus instance and has
+ * a similar exception.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof ExceptionStatus)) {
+ return false;
+ }
+
+ ExceptionStatus other = (ExceptionStatus)obj;
+
+ if (this.exception.getClass() != other.exception.getClass()) {
+ return false;
+ }
+
+ String thisMess = this.exception.getMessage();
+ String otherMess = other.exception.getMessage();
+
+ return (thisMess == otherMess)
+ || (thisMess != null && thisMess.equals(otherMess));
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/MultiMethodTest.java b/qadevOOo/runner/lib/MultiMethodTest.java
new file mode 100644
index 000000000000..87e6360eaa14
--- /dev/null
+++ b/qadevOOo/runner/lib/MultiMethodTest.java
@@ -0,0 +1,493 @@
+/*************************************************************************
+ *
+ * $RCSfile: MultiMethodTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sw $ $Date: 2003-01-27 16:27:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import share.DescEntry;
+import lib.TestParameters;
+import stats.Summarizer;
+
+
+/**
+ * The class supports method based interface tests development.
+ *
+ * <p>There are some points that should be fulfilled in a subclass to work
+ * correctly in the multi-method framework:
+ *
+ * 1. each subclass schould define a public field named oObj of type tested
+ * by the subclass, e.g. 'public XText oObj;'. That field will be initialized
+ * by the MultiMethodTest code with the instance of the interface to test.
+ * In a case of service testing the field type should be XPropertySet.
+ *
+ * 2. for the test of each method of the tested interface(or a property in the
+ * case of service testing) should be method with the following signature
+ * provided: 'public void _<method name>()', e.g. 'public void _getText()'.
+ * The methods will be called by MultiMethodText code using reflection API
+ * for each method in the interface description.
+ *
+ * 3. to set status for a call 'tRes.tested(String method,
+ * boolean result)' should be used. For example 'tRes.tested("getText()",
+ * true)'. Also 'tRes.assert(String assertion, boolean result)' call can
+ * be used. Note, that one can call the methods not neccesarily from the
+ * test for the tested method, but from other method tests too (in the
+ * MultiMethodTest subclass). See also TestResult and MultiMethodTest.tRes
+ * documentation.
+ *
+ * 4. the before() and after() methods can be overriden to perform some
+ * actions, accordingly, before and after calling the test methods.
+ *
+ * 5. besides tRes, there are some fields initialized in the MultiMethodTest,
+ * that can be used for implementing tests:
+ *
+ * - tEnv contains the environment tested
+ * - tParam contains parameters of the test
+ * - log a writer to log information about the test
+ *
+ * @see TestResult
+ */
+public class MultiMethodTest {
+
+ /**
+ * Contains the TestEnvironment being tested, to allow for tests to access
+ * it.
+ */
+ protected TestEnvironment tEnv;
+
+ /**
+ * Contains the TestParameters for the tests, to allow for tests to access
+ * it.
+ */
+ protected TestParameters tParam;
+
+ /**
+ * Contains the Description for the test
+ * it.
+ */
+ protected DescEntry entry;
+
+ /**
+ * Contains a writer to log an information about the interface testing, to
+ * allows for tests to access it.
+ */
+ protected PrintWriter log;
+
+ /**
+ * Contains the TestResult instance for the interface test to collect
+ * information about methods test.
+ */
+ protected TestResult tRes;
+
+ /**
+ * Contains names of the methods have been alreadycalled
+ */
+ private Vector methCalled = new Vector(10);
+
+ /**
+ * Disposes the test environment, which was corrupted by the test.
+ *
+ * @param tEnv the environment to dispose
+ */
+ public void disposeEnvironment( TestEnvironment tEnv ) {
+ disposeEnvironment();
+ }
+
+ /**
+ * Disposes the current test environment, which was corrupted by the test.
+ *
+ * @see #disposeEnvironment(TestEnvironment)
+ */
+ public void disposeEnvironment() {
+ tEnv.dispose();
+ TestCase tCase = tEnv.getTestCase();
+ tCase.disposeTestEnvironment( tEnv, tParam );
+ }
+
+ /**
+ * Runs the interface test: its method tests. First, it initializes some
+ * of MultiMethodTest fields, like tRes, log, tEnv, etc. Then, it queries
+ * the tested interface and initializes 'oObj' field (defined in a
+ * subclass). Before calling method tests, before() method calles to allow
+ * initialization of s stuff before testing. Then, the method tests are
+ * called. After them, after() method is called, to allow cleaning up the
+ * stuff initialized in before() and test methods.
+ *
+ * @param tEnv the environment to test
+ * @param ifcState the interface test state
+ * @param tParam the parameters of the test
+ *
+ * @see #before
+ * @see #after
+ */
+ public TestResult run( DescEntry entry, TestEnvironment tEnv, TestParameters tParam ) {
+
+ log = (PrintWriter) entry.Logger;
+
+ this.tEnv = tEnv;
+ this.tParam = tParam;
+ this.log = log;
+ this.entry = entry;
+ this.tRes = new TestResult();
+ Class testedClass;
+
+ String ifcName = getInterfaceName();
+ System.out.println("checking : "+ifcName);
+
+ // defining a name of the class corresponding to the tested interface
+ // or service
+ String testedClassName;
+
+ testedClassName = getTestedClassName();
+
+ if (entry.EntryType.equals("service")) {
+ testedClassName = "com.sun.star.beans.XPropertySet";
+ }
+
+ try {
+ testedClass = Class.forName(testedClassName);
+ } catch (ClassNotFoundException cnfE) {
+
+ cnfE.printStackTrace(log);
+ log.println("couldnt find a class : " + getTestedClassName());
+ return null;
+
+ }
+
+ // quering the tested interface from the tested object
+ XInterface tCase = tEnv.getTestObject();
+ Object oObj = UnoRuntime.queryInterface(
+ testedClass, tEnv.getTestObject());
+
+ if (oObj == null) {
+ if (entry.isOptional) {
+ Summarizer.summarizeDown(
+ entry,"Not supported but optional.OK");
+ } else {
+ Summarizer.summarizeDown(
+ entry,"queryInterface returned null.FAILED");
+ entry.ErrorMsg="queryInterface returned null";
+ entry.hasErrorMsg=true;
+ }
+
+ return null;
+ }
+
+ //setting the field oObj
+ setField("oObj",oObj);
+
+
+ // to perform some stuff before all method tests
+ try {
+ before();
+ } catch (Exception e){
+ setSubStates(e.toString());
+ return tRes;
+ }
+
+ // executing methods tests
+ for (int i=0;i<entry.SubEntryCount;i++) {
+ log.println("Execute: "+ entry.SubEntries[i].entryName);
+ try {
+ executeMethod( entry.SubEntries[i].entryName );
+ log.println(tRes.getStatusFor(entry.SubEntries[i].entryName));
+ } catch (Exception e){
+ log.println("Exception while checking: "+
+ entry.SubEntries[i].entryName+" : "+e.getMessage());
+ }
+ }
+
+ // to perform some stuff after all method tests
+ try {
+ after();
+ } catch (Exception e){}
+
+ return tRes;
+ }
+
+ /**
+ * Is called before calling method tests, but after initialization.
+ * Subclasses may override to perform actions before method tests.
+ */
+ protected void before() {
+ }
+
+ /**
+ * Is called after calling method tests. Subclasses may override
+ * to perform actions after method tests.
+ */
+ protected void after() {
+ }
+
+
+ /**
+ * @return the name of the interface or the service tested.
+ */
+ protected String getTestedClassName() {
+ String clsName = this.getClass().getName();
+
+ int firstDot = clsName.indexOf(".");
+ int lastDot = clsName.lastIndexOf(".");
+
+ String append = "com.sun.star.";
+
+ if (entry.longName.indexOf("::drafts::com::")>-1) {
+ append = "drafts.com.sun.star.";
+ }
+
+ return append
+ + clsName.substring(firstDot + 1, lastDot + 1)
+ + clsName.substring(lastDot + 2);
+ }
+
+ /**
+ * Sets a method status.
+ *
+ * @param methName the method name to set status
+ * @param methStatus the status to set to the method
+ */
+ protected void setStatus( String methName, Status methStatus ) {
+ tRes.tested( methName, methStatus );
+ }
+
+ /**
+ * sets the substates
+ */
+ protected void setSubStates(String msg) {
+ for (int k=0;k<entry.SubEntryCount;k++) {
+ entry.SubEntries[k].hasErrorMsg=true;
+ entry.SubEntries[k].ErrorMsg=msg;
+ if (entry.SubEntries[k].State.equals("UNKNOWN")) {
+ entry.SubEntries[k].State = msg;
+ }
+ }
+
+ }
+
+ /**
+ * Checks if the <code>method</code> is optional in the service.
+ */
+ protected boolean isOptional(String method) {
+ for (int k=0;k<entry.SubEntryCount;k++) {
+ if (entry.SubEntries[k].entryName.equals(method)) {
+ return entry.SubEntries[k].isOptional;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the <code>method</code> test has been already called.
+ */
+ protected boolean isCalled( String method ) {
+ return methCalled.contains( method );
+ }
+
+ /**
+ * @return the status set to the <code>method</code> test, if it has been
+ * set, <tt>null</tt> otherwise.
+ */
+ protected Status getStatusFor( String method ) {
+ return tRes.getStatusFor( method );
+ }
+
+ /**
+ * Calling of the method indicates that the <code>method</code> test should
+ * be called. The method checks this and if it is not called, calls it.
+ * If the method is failed or skipped, it throws StatusException.
+ */
+ protected void requiredMethod(String method) {
+ executeMethod( method );
+ Status mtStatus = getStatusFor( method );
+
+ if ( mtStatus != null
+ && (!mtStatus.isPassed() || mtStatus.isFailed()) ) {
+ log.println( "! Required method " + method + " failed" );
+ throw new StatusException( mtStatus );
+ }
+ }
+
+ /**
+ * Checks if the <code>method</code> was called, and if not, call it.
+ * On contrary to requiredMethod(), he method doesn't check its status.
+ */
+ protected void executeMethod( String method ) {
+ if ( ! isCalled( method ) ) {
+ callMethod( method );
+ }
+ }
+
+ /**
+ * Just calls the <code>method</code> test.
+ */
+ protected void callMethod(String method) {
+ methCalled.add(method);
+ invokeTestMethod(getMethodFor(method), method);
+ }
+
+ /**
+ * Invokes a test method of the subclass using reflection API. Handles
+ * the method results and sets its status.
+ *
+ * @param meth the subclass' method to invoke
+ * @param methName the name of the method
+ */
+ protected void invokeTestMethod(Method meth, String methName) {
+ if (meth == null) {
+ setStatus( methName, Status.skipped( false ) );
+ } else {
+ Status stat;
+
+ try {
+ meth.invoke(this, new Object[0]);
+ return;
+ } catch (InvocationTargetException itE) {
+ Throwable t = itE.getTargetException();
+
+ if ( t instanceof StatusException ) {
+ stat = ((StatusException)t).getStatus();
+ } else {
+ t.printStackTrace(log);
+ stat = Status.exception(t);
+ }
+ } catch (IllegalAccessException iaE) {
+ iaE.printStackTrace(log);
+ stat = Status.exception(iaE);
+ } catch (IllegalArgumentException iaE) {
+ iaE.printStackTrace(log);
+ stat = Status.exception(iaE);
+ } catch (ClassCastException ccE) {
+ ccE.printStackTrace(log);
+ stat = Status.exception(ccE);
+ }
+
+ setStatus(methName, stat);
+ }
+ }
+
+ /**
+ * Finds a testing method for the <code>method</code> of the interface.
+ *
+ * @return the testing method, if found, <tt>null</tt> otherwise
+ */
+ protected Method getMethodFor(String method) {
+ String mName = "_" + method;
+
+ if (mName.endsWith("()")) {
+ mName = mName.substring(0, mName.length() - 2);
+ }
+
+ final Class[] paramTypes = new Class[0];
+
+ try {
+ return this.getClass().getDeclaredMethod(mName, paramTypes);
+ } catch (NoSuchMethodException nsmE) {
+ return null;
+ }
+ }
+
+ /**
+ * @return the name of the interface tested
+ */
+ public String getInterfaceName() {
+ String clName = this.getClass().getName();
+ return clName.substring( clName.lastIndexOf('.') + 1 );
+ }
+
+
+ /**
+ * Initializes <code>fieldName</code> of the subclass with
+ * <code>value</code>.
+ *
+ * @return Status describing the result of the operation.
+ */
+ protected Status setField( String fieldName, Object value) {
+ Field objField;
+
+ try {
+ objField = this.getClass().getField( fieldName );
+ }
+ catch( NoSuchFieldException nsfE ){
+ return Status.exception( nsfE );
+ }
+
+ try {
+ objField.set( this, value );
+ return Status.passed(true);
+ }
+ catch( IllegalArgumentException iaE ){
+ return Status.exception( iaE );
+ }
+ catch( IllegalAccessException iaE ){
+ return Status.exception( iaE );
+ }
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java
new file mode 100644
index 000000000000..5eb9930fe581
--- /dev/null
+++ b/qadevOOo/runner/lib/MultiPropertyTest.java
@@ -0,0 +1,489 @@
+/*************************************************************************
+ *
+ * $RCSfile: MultiPropertyTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.uno.UnoRuntime;
+
+import java.lang.reflect.Method;
+
+import util.ValueChanger;
+import util.ValueComparer;
+
+/**
+ * MultiPropertyTest extends the functionality of MultiMethodTest to support
+ * services testing. Since, in most cases, service tests has one method testing
+ * most of its properties, the MultiPropertyTest provides unified version of
+ * the method: testProperty().
+ *
+ * <p>The testProperty() is called, when the MultiMethodTest's testing method
+ * is not found in the subclass. So, by defining such methods for properties
+ * the standard testing behavioutr can be changed.
+ *
+ * <p>The testing behaviour also can be changed by overriding compare(),
+ * getNewVAlue() or toString(Object) methods, or by extending PropertyTester
+ * class.
+ *
+ * @see MultiMethodTest
+ * @see #testProperty(String)
+ * @see #testProperty(String, Propertytester)
+ * @see #getNewValue
+ * @see #compare
+ * @see #toString(Object)
+ */
+public class MultiPropertyTest extends MultiMethodTest {
+ /**
+ * Contains a XPropertySet interface of the tested object. Is initialized
+ * in MultiMethodTest code.
+ */
+ public XPropertySet oObj;
+ protected boolean optionalService = false;
+
+ /**
+ * Overrides super.before() to check the service is supported by the object.
+ */
+ protected void before() {
+ XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class, oObj);
+
+ optionalService = entry.isOptional;
+
+ String theService = getTestedClassName();
+ if (xInfo != null && !xInfo.supportsService(theService)) {
+ log.println("Service "+theService+" not available");
+ if (optionalService) {
+ log.println("This is OK since it is optional");
+ } else {
+ Status.failed(theService + " is not supported");
+ }
+ }
+ }
+
+ /**
+ * Overrides MultiMethodTest.invokeTestMethod(). If the test for the
+ * <code>meth</code> is not available (<code>meth</code> == <tt>null</tt>)
+ * calls testProperty method for the method. Otherwise calls
+ * super.invokeTestMethod().
+ *
+ * @see #MultiMethodTest.invokeTestMethod()
+ */
+ protected void invokeTestMethod(Method meth, String methName) {
+ if (meth != null) {
+ super.invokeTestMethod(meth, methName);
+ } else {
+ testProperty(methName);
+ }
+ }
+
+ /**
+ * PropertyTester class defines how to test a property and defined
+ * to allow subclasses of MultiPropertyTest to change the testing
+ * behaviour more flexible, since the behaviour can be customized for
+ * each property separately, by providing subclass of PropertyTester
+ * and passing it to testProperty(String, PropertyTester method).
+ */
+ public class PropertyTester {
+ /**
+ * The method defines the whole process of testing propName
+ * property.
+ *
+ * <p>First, it checks if the property exists(it maybe optional).
+ * Then, a value to set the property with is calculated with
+ * getNewValue method. Normally, the new value is calculated
+ * based on old value, but subclasses can override the behaviour
+ * (for example, if old value is null) and specify their own value.
+ * Then the property is set with that new value and the result(
+ * it maybe an exception too, for example a PropertyVetoException)
+ * is checked with checkResult method.
+ *
+ * @param propName - the property to test.
+ * @result - adds the result of testing propName property to
+ * MultiMethodTest.tRes.
+ */
+ protected void testProperty(String propName) {
+ XPropertySetInfo info = oObj.getPropertySetInfo();
+
+ if (!info.hasPropertyByName(propName)) {
+ if (isOptional(propName) || optionalService) {
+ // skipping optional property test
+ log.println("Property '" + propName
+ + "' is optional and not supported");
+ tRes.tested(propName,true);
+ return;
+ } else {
+ // cannot test the property
+ log.println("Tested XPropertySet does not contain'"
+ + propName + "' property");
+ tRes.tested(propName, false);
+ return;
+ }
+ }
+
+ try {
+ Object oldValue = oObj.getPropertyValue(propName);
+
+ Object newValue;
+
+ // trying to create new value
+ try {
+ newValue = getNewValue(propName, oldValue);
+ } catch (java.lang.IllegalArgumentException e) {
+ // skipping test since new value is not available
+ Status.failed("Cannot create new value for '"
+ + propName + " : " + e.getMessage());
+ return;
+ }
+
+ // for an exception thrown during setting new value
+ // to pass it to checkResult method
+ Exception exception = null;
+
+ try {
+ oObj.setPropertyValue(propName, newValue);
+ } catch(IllegalArgumentException e) {
+ exception = e;
+ } catch(PropertyVetoException e) {
+ exception = e;
+ } catch(WrappedTargetException e) {
+ exception = e;
+ } catch(UnknownPropertyException e) {
+ exception = e;
+ } catch(RuntimeException e) {
+ exception = e;
+ }
+
+ // getting result value
+ Object resValue = oObj.getPropertyValue(propName);
+
+ // checking results
+ checkResult(propName, oldValue, newValue, resValue, exception);
+ } catch (Exception e) {
+ log.println("Exception occured while testing property '" + propName + "'");
+ e.printStackTrace(log);
+ tRes.tested(propName, false);
+ }
+ }
+
+ /**
+ * The method checks result of setting a new value to the
+ * property based o the following arguments:
+ * @propName - the property to test
+ * @oldValue - the old value of the property, before changing it.
+ * @newValue - the new value the property has been set with
+ * @resValue - the value of the property after having changed it
+ * @exception - if not null - the exception thrown by
+ * XPropertySet.setPropertyValue, else indicates
+ * normal method completion.
+ *
+ * <p>If the property is READ_ONLY, than either PropertyVetoException
+ * should be thrown or the value of property should not have changed
+ * (resValue is compared with oldValue with compare method).
+ *
+ * <p>If the property is not READ_ONLY, checks that the new value has
+ * been successfully set(resValue is compared with newValue with
+ * compare method).
+ *
+ * <p>If the exception is not null then(except the case of read-only
+ * property and PropertyVetoException above) it is rethrown to allow
+ * further catching it if needed.
+ *
+ * <p>Subclasses can override to change this behaviour.
+ */
+ protected void checkResult(String propName, Object oldValue,
+ Object newValue, Object resValue, Exception exception)
+ throws Exception {
+ XPropertySetInfo info = oObj.getPropertySetInfo();
+ Property prop = info.getPropertyByName(propName);
+
+ short attr = prop.Attributes;
+ boolean readOnly = (prop.Attributes
+ & PropertyAttribute.READONLY) != 0;
+ boolean maybeVoid = (prop.Attributes
+ & PropertyAttribute.MAYBEVOID) != 0;
+ //check get-set methods
+ if (maybeVoid) log.println("Property "+propName+" is void");
+ if (readOnly) log.println("Property "+propName+" is readOnly");
+ if (util.utils.isVoid(oldValue) && !maybeVoid) {
+ log.println(propName
+ + " is void, but it's not MAYBEVOID");
+ tRes.tested(propName, false);
+ } else if (oldValue == null ) {
+ log.println(propName
+ + " has null value, and therefore can't be changed");
+ tRes.tested(propName, true);
+ } else if (readOnly) {
+ // check if exception was thrown
+ if (exception != null) {
+ if (exception instanceof PropertyVetoException) {
+ // the change of read only prohibited - OK
+ log.println("Property is ReadOnly and wasn't changed");
+ log.println("Property '" + propName + "' OK");
+ tRes.tested(propName, true);
+ } else if (exception instanceof IllegalArgumentException) {
+ // the change of read only prohibited - OK
+ log.println("Property is ReadOnly and wasn't changed");
+ log.println("Property '" + propName + "' OK");
+ tRes.tested(propName, true);
+ } else if (exception instanceof UnknownPropertyException) {
+ // the change of read only prohibited - OK
+ log.println("Property is ReadOnly and wasn't changed");
+ log.println("Property '" + propName + "' OK");
+ tRes.tested(propName, true);
+ }else if (exception instanceof RuntimeException) {
+ // the change of read only prohibited - OK
+ log.println("Property is ReadOnly and wasn't changed");
+ log.println("Property '" + propName + "' OK");
+ tRes.tested(propName, true);
+ } else {
+ throw exception;
+ }
+ } else {
+ // if no exception - check that value
+ // has not changed
+ if (!compare(resValue, oldValue)) {
+ log.println("Read only property '"
+ + propName + "' has changed");
+ log.println("old = " + toString(oldValue));
+ log.println("new = " + toString(newValue));
+ log.println("result = " + toString(resValue));
+ log.println("expected = " + toString(oldValue));
+ tRes.tested(propName, false);
+ } else {
+ log.println("Read only property '"
+ + propName + "' hasn't changed");
+ log.println("Property '" + propName + "' OK");
+ tRes.tested(propName, true);
+ }
+ }
+ } else {
+ if (exception == null) {
+ // if no exception thrown
+ // check that the new value is set
+ if ((!compare(resValue, newValue)) || (compare(resValue, oldValue))) {
+ log.println("Value for '" + propName
+ + "' hasn't changed as expected");
+ log.println("old = " + toString(oldValue));
+ log.println("new = " + toString(newValue));
+ log.println("result = " + toString(resValue));
+ log.println("expected = " + toString(newValue));
+ if (resValue != null ) {
+ if ( (!compare(resValue, oldValue)) || (!resValue.equals(oldValue))) {
+ log.println("But it has changed.");
+ tRes.tested(propName, true);
+ } else {
+ tRes.tested(propName, false);
+ }
+ }
+ else {
+ tRes.tested(propName, false);
+ }
+ //tRes.tested(propName, false);
+ } else {
+ log.println("Property '" + propName + "' OK");
+ log.println("old = " + toString(oldValue));
+ log.println("new = " + toString(newValue));
+ log.println("result = " + toString(resValue));
+ log.println("expected = " + toString(newValue));
+ tRes.tested(propName, true);
+ }
+ } else {
+ throw exception;
+ }
+ }
+ }
+
+ /**
+ * The method produces new value of the property from the oldValue.
+ * It returns the result of ValueChanger.changePValue method.
+ * Subclasses can override the method to return their own value,
+ * when the changePValue beahviour is not enough, for example,
+ * when oldValue is null.
+ */
+ protected Object getNewValue(String propName, Object oldValue)
+ throws java.lang.IllegalArgumentException {
+ return ValueChanger.changePValue(oldValue);
+ }
+
+ /**
+ * The method compares obj1 and obj2. It calls
+ * MultiPropertyTest.compare, but subclasses can override to change
+ * the behaviour, since normally compare calls Object.equals method
+ * which is not apropriate in some cases(e.g., structs with equals
+ * not overridden).
+ */
+ protected boolean compare(Object obj1, Object obj2) {
+ return callCompare(obj1, obj2);
+ }
+
+ /**
+ * The method returns a String representation of the obj. It calls
+ * MultipropertyTest.toString(Object), but subclasses can override
+ * to change the behaviour.
+ */
+ protected String toString(Object obj) {
+ return callToString(obj);
+ }
+ }
+
+ /**
+ * Extension for <code>PropertyTester</code> which switches two
+ * different values. <code>getNewValue()</code> method of this
+ * class returns one of these two values depending on the
+ * old value, so new value is not equal to old value.
+ */
+ public class PropertyValueSwitcher extends PropertyTester {
+ Object val1 = null ;
+ Object val2 = null ;
+
+ /**
+ * Constructs a property tester with two different values
+ * specified as parameters.
+ *
+ * @param val1 Not <code>null</code> value for the property
+ * tested.
+ * @param val1 Not <code>null</code> value for the property
+ * tested which differs from the first value.
+ */
+ public PropertyValueSwitcher(Object val1, Object val2) {
+ this.val1 = val1 ;
+ this.val2 = val2 ;
+ }
+
+ /**
+ * Overriden method of <code>PropertyTester</code> which
+ * retruns new value from two values specified.
+ *
+ * @return The second value if old value is equal to the first
+ * one, the first value otherwise.
+ */
+ protected Object getNewValue(String propName, Object old) {
+ if (ValueComparer.equalValue(val1, old))
+ return val2 ;
+ else
+ return val1 ;
+ }
+ }
+
+ /**
+ * The method performs testing of propName property using propTester.
+ */
+ protected void testProperty(String propName, PropertyTester propTester) {
+ propTester.testProperty(propName);
+ }
+
+ /**
+ * The method performs testing of propName property. It uses PropertyTester
+ * instance for testing.
+ */
+ protected void testProperty(String propName) {
+ testProperty(propName, new PropertyTester());
+ }
+
+ /**
+ * Tests the property using <code>PropertyValueSwitcher</code>
+ * tester and two values for this property.
+ *
+ * @see #PropertyValueSwitcher
+ */
+ protected void testProperty(String propName, Object val1, Object val2) {
+ testProperty(propName, new PropertyValueSwitcher(val1, val2));
+ }
+
+ /**
+ * The method just calls compare. This is a workaround to CodeWarrior's
+ * compiler bug.
+ */
+ private boolean callCompare(Object obj1, Object obj2) {
+ return compare(obj1, obj2);
+ }
+
+ /**
+ * Compares two object. In the implementation calls obj1.equals(obj2).
+ */
+ protected boolean compare(Object obj1, Object obj2) {
+ return ValueComparer.equalValue(obj1, obj2);
+ }
+
+ /**
+ * The method just calls toString. This is a workaround to
+ * CodeWarrior's compiler bug.
+ */
+ private String callToString(Object obj) {
+ return toString(obj);
+ }
+
+ /**
+ * Gets string representation of the obj. In the implementation
+ * returns obj.toString().
+ */
+ protected String toString(Object obj) {
+ return obj == null ? "null" : obj.toString();
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java
new file mode 100644
index 000000000000..0207ccce5052
--- /dev/null
+++ b/qadevOOo/runner/lib/Parameters.java
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: Parameters.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.util.Iterator;
+import java.util.Hashtable;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+
+/**
+ * Parameters is a container of String parameters.
+ * @deprecated
+ */
+
+public class Parameters implements XPropertySet {
+/* final protected Map parameters;
+ final Parameters defaults; */
+ final protected Map parameters;
+ final Parameters defaults;
+ Property[] props;
+
+ public Parameters(Map params) {
+ this (params, null);
+ }
+
+ public Parameters(Map params, Parameters defaultParams) {
+ parameters = params;
+ defaults = defaultParams;
+ checkParameters(parameters);
+
+ Set paramSet = new HashSet(parameters.keySet());
+
+ if (defaults != null) {
+ Set defSet = defaults.toMap().keySet();
+ paramSet.addAll(defSet);
+ }
+
+ props = new Property[paramSet.size()];
+
+ int num = 0;
+
+ for (Iterator i = paramSet.iterator(); i.hasNext(); num++) {
+ String name = (String)i.next();
+
+ props[num] = new Property(name, num, new Type(String.class), (short)0);
+ }
+ }
+
+
+ public String get(String paramName) {
+ Object res = parameters.get(paramName);
+
+ if (res != null && res instanceof String)
+ return (String)res;
+
+ if (defaults != null)
+ return defaults.get(paramName);
+
+ return null;
+ }
+
+ public Object getPropertyValue(String name) {
+ Object erg = parameters.get(name);
+ if (erg == null && defaults != null)
+ return defaults.getPropertyValue(name);
+ return erg;
+ }
+
+ public void setPropertyValue(String name, Object value) {
+ parameters.put(name, value);
+ int size = props.length;
+ Property[] addProps = new Property[size+1];
+ for (int i=0; i<size; i++)
+ {
+ addProps[i] = props[i];
+ }
+ addProps[size] = new Property(name, size, new Type(value.getClass()), (short)0);
+ props = addProps;
+ }
+
+ public void addVetoableChangeListener(String name, XVetoableChangeListener l) {
+ }
+
+ public void removeVetoableChangeListener(String name, XVetoableChangeListener l) {
+ }
+
+ public void addPropertyChangeListener(String name, XPropertyChangeListener l) {
+ }
+
+ public void removePropertyChangeListener(String name, XPropertyChangeListener l) {
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ return new XPropertySetInfo() {
+ public Property[] getProperties() {
+ return props;
+ }
+
+ public boolean hasPropertyByName(String name) {
+ for (int i = 0; i < props.length; i++) {
+ Property prop = props[i];
+
+ if (prop.Name.equals(name)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Property getPropertyByName(String name) throws UnknownPropertyException {
+ for (int i = 0; i < props.length; i++) {
+ Property prop = props[i];
+
+ if (prop.Name.equals(name)) {
+ return prop;
+ }
+ }
+
+ throw new UnknownPropertyException(name);
+ }
+ };
+ }
+
+ public Map toMap() {
+ return new Hashtable(parameters) {
+ public Object get(Object obj) {
+ if (obj instanceof String) {
+ return Parameters.this.get((String) obj);
+ } else {
+ return null;
+ }
+ }
+ };
+ }
+
+ private static void checkParameters(Map params) {
+ for (Iterator i = params.keySet().iterator(); i.hasNext();) {
+ Object key = i.next();
+
+ if (!(key instanceof String)) {
+ throw new IllegalArgumentException(
+ "Wrong key " + key + ", it should be of String type");
+ }
+
+/* Object value = params.get(key);
+
+ if (!(value instanceof String)) {
+ throw new IllegalArgumentException(
+ "Wrong value " + value + ", it should be of String type");
+ } */
+ }
+ }
+
+ public static String getString(XPropertySet props, String name) {
+ try {
+ return (String)props.getPropertyValue(name);
+ } catch (UnknownPropertyException e) {
+ return null;
+ } catch (WrappedTargetException e) {
+ return null;
+ }
+ }
+
+ public static Object get(XPropertySet props, String name) {
+ try {
+ return props.getPropertyValue(name);
+ } catch (UnknownPropertyException e) {
+ return null;
+ } catch (WrappedTargetException e) {
+ return null;
+ }
+ }
+
+ public static Map toMap(XPropertySet props) {
+ Hashtable result = new Hashtable(10);
+
+ XPropertySetInfo setInfo = props.getPropertySetInfo();
+ Property[] properties = setInfo.getProperties();
+
+ for (int i = 0; i < properties.length; i++) {
+ String name = properties[i].Name;
+ Object value;
+
+ try {
+ value = props.getPropertyValue(name);
+ } catch (WrappedTargetException e) {
+ continue;
+ } catch (UnknownPropertyException e) {
+ continue;
+ }
+
+ result.put(name, value);
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/SimpleStatus.java b/qadevOOo/runner/lib/SimpleStatus.java
new file mode 100644
index 000000000000..8a15cc7bd85f
--- /dev/null
+++ b/qadevOOo/runner/lib/SimpleStatus.java
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * $RCSfile: SimpleStatus.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+/**
+ * The class is a simple implementation of Status class. It implements simple
+ * Status behaviour: its state, reason and log are defined when creating
+ * the SimpleSTatus instance.
+ */
+class SimpleStatus extends Status {
+ /**
+ * The field is holding state of the status.
+ */
+ protected final boolean state;
+
+ /**
+ * The field is holding reason of the status.
+ */
+ protected final int runState;
+
+ /**
+ * The constructor initialize state and reson field.
+ */
+ protected SimpleStatus( int runState, boolean state ) {
+ this.state = state;
+ this.runState = runState;
+ }
+
+ /**
+ * getState implementation. Just returns the state field value.
+ */
+ public int getState() {
+ return (state ? OK : FAILED);
+ }
+
+ /**
+ * getRunState() implementation. Just returns th runState field value.
+ */
+ public int getRunState() {
+ return runState;
+ }
+
+ /**
+ * getReason implementation. Just returns the reason field value.
+ */
+ public String getRunStateString() {
+ int runState = getRunState();
+
+ if ( runState == PASSED ) {
+ return "PASSED";
+ } else if ( runState == EXCLUDED ) {
+ return "EXCLUDED";
+ } else if ( runState == SKIPPED ) {
+ return "SKIPPED";
+ } else {
+ return "UNKNOWN";
+ }
+ }
+
+ /**
+ * Compares this Status with obj.
+ *
+ * @return <tt>true</tt> if obj is a SimpleStatus instance and it has
+ * the same state and runstate, <tt>false</tt> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof SimpleStatus)) {
+ return false;
+ }
+
+ SimpleStatus other = (SimpleStatus)obj;
+
+ return this.getState() == other.getState()
+ && this.getRunState() == other.getRunState();
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java
new file mode 100644
index 000000000000..ada44e3a1687
--- /dev/null
+++ b/qadevOOo/runner/lib/Status.java
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * $RCSfile: Status.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.io.PrintWriter;
+
+/**
+ * Status represents a result of a testing activity performed. The result is
+ * described in two ways: state and runtime state. The state describes if the
+ * activity was successful (OK state) or not (FAILED state). The runtime state
+ * describes what happend during the activity: the test can be:
+ * - PASSED - the activity completed normally (although it can complete with
+ * FAILED state)
+ * - SKIPPED - the activity was not performed because of a reason (it also can
+ * has OK or FAILED state)
+ * - EXCEPTION - the activity was abnormally terminated because of an
+ * unexpected exception. It always has a FAILED state.
+ * - EXCLUDED - the activity is expected to fail. The state represents how
+ * the state really completed: OK or FAILED.
+ * - other variants are not formalized now and can be represented by
+ * Status.failed() method. They always have a FAILED state.
+ */
+public abstract class Status {
+ /* Run states. */
+
+ /**
+ * The constatnt represents PASSED runtime state.
+ */
+ public final static int PASSED = 0;
+
+ /**
+ * The constant represents EXCEPTION runtime state.
+ */
+ public final static int EXCEPTION = 4;
+
+ /**
+ * The constant represents EXCLUDED runtime state.
+ */
+ public final static int EXCLUDED = 5;
+
+ /**
+ * The constant represents SKIPPED runtime state.
+ */
+ public final static int SKIPPED = 2;
+
+ /* Test states */
+
+ /**
+ * The constant represents FAILED state.
+ */
+ public final static int FAILED = 1;
+
+ /**
+ * The constant represents OK state.
+ */
+ public final static int OK = 3;
+
+ /**
+ * Returns the test state of the Status.
+ */
+ public abstract int getState();
+
+ /**
+ * Returns the run state of the Status.
+ */
+ public abstract int getRunState();
+
+ /**
+ * Returns the string describing run state of the Status. For example,
+ * "PASSED", "SKIPPED", "File file.txt is not found".
+ */
+ public abstract String getRunStateString();
+
+ /**
+ * This is a factory method for creating a Status representing normal
+ * actibity termination.
+ *
+ * @param state describes a test state (OK if state == true, FAILED
+ * otherwise).
+ */
+ public static Status passed( boolean state ) {
+ return new SimpleStatus(PASSED, state );
+ }
+
+ /**
+ * This is a factory method for creating a Status representing an exception
+ * activity termination. The Status alway has FAILED state.
+ *
+ * @param t the exception with that the activity completed.
+ */
+ public static Status exception( Throwable t ) {
+ return new ExceptionStatus( t );
+ }
+
+ /**
+ * This is a factory method for creating a Status representing a skipped
+ * activity.
+ *
+ * @param state describes a test state (OK if state == true, FAILED
+ * otherwise).
+ */
+ public static Status skipped( boolean state ) {
+ return new SimpleStatus( SKIPPED, state );
+ }
+
+ /**
+ * This is a factory method for creating a Status representing that the
+ * result of the activity was excluded. It alwas has FAILED state.
+ */
+ public static Status excluded() {
+ return new SimpleStatus( EXCLUDED, false );
+ }
+
+ /**
+ * Creates a Status representing an activity failed for an arbitrary reason.
+ * It always has FAILED state.
+ *
+ * @param reason describes why the activity failed
+ */
+ public static Status failed(final String reason) {
+ return new Status() {
+ public int getState() {
+ return FAILED;
+ }
+
+ public int getRunState() {
+ return SKIPPED;
+ }
+
+ public String getRunStateString() {
+ return reason;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null || this.getClass() != obj.getClass()) {
+ return false;
+ }
+ return this.getRunStateString().equals(
+ ((Status)obj).getRunStateString());
+ }
+ };
+ }
+
+ /**
+ * The method returns a human-readable description of the status.
+ * The Status implementation of the method returns the status state
+ * description and appends to it it the reason, for example:
+ * "FAILED.The getLabel works wrong", "PASSED.OK".
+ */
+ public String toString() {
+ String str = getRunStateString() + ".";
+
+ // Getting state of the status and converting it to string.
+ int state = getState();
+ if (state == OK) {
+ str += "OK";
+ } else {
+ // Although, normally, there should be only FAILED state,
+ // all other marked as failed too.
+ str += "FAILED";
+ }
+
+ return str;
+ }
+
+ /**
+ * Checks whether the status runstate is passed.
+ */
+ public boolean isPassed() {
+ return getRunState() == PASSED;
+ }
+
+ /**
+ * Checks whether the status runstate is skipped.
+ */
+ public boolean isSkipped() {
+ return getRunState() == SKIPPED;
+ }
+
+ /**
+ * Checks whether the status runstate is excluded.
+ */
+ public boolean isExcluded() {
+ return getRunState() == EXCLUDED;
+ }
+
+ /**
+ * Checks whether the status runstate is exception.
+ */
+ public boolean isException() {
+ return getRunState() == EXCEPTION;
+ }
+
+ /**
+ * Checks whether the status state is failed.
+ */
+ public boolean isFailed() {
+ return getState() == FAILED;
+ }
+
+ /**
+ * Checks whether the status state is ok.
+ */
+ public boolean isOK() {
+ return getState() == OK;
+ }
+
+ public String getDescription () {
+ return getRunStateString();
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/StatusException.java b/qadevOOo/runner/lib/StatusException.java
new file mode 100644
index 000000000000..c38ec5ec2caf
--- /dev/null
+++ b/qadevOOo/runner/lib/StatusException.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: StatusException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+/**
+ * StatusException is used to pass a Status object from a test code which is
+ * terminated abnormaly. In many cases this is because of an exception thrown,
+ * but that can also be any other event that hinders the test execution.
+ */
+public class StatusException extends RuntimeException {
+ /**
+ * Contains an exception if the StatusException was created with
+ * StatusException(String, Throwable) constructor.
+ */
+ protected Throwable exceptionThrown;
+
+ /**
+ * The Status contained in the StatusException.
+ */
+ protected Status status;
+
+ /**
+ * Constructs a StatusException containing an exception Status.
+ *
+ * @param message the message of the StatusException
+ * @param t the exception of the exception Status
+ */
+ public StatusException( String message, Throwable t ) {
+ super( message );
+ exceptionThrown = t;
+ status = Status.exception( t );
+ }
+
+ /**
+ * Creates a StatusException containing a Status.
+ */
+ public StatusException( Status st ) {
+ super( st.getRunStateString() );
+ status = st;
+ }
+
+ /**
+ * @return an exception, if this represents an exception Status,
+ * <tt>false</tt> otherwise.
+ */
+ public Throwable getThrownException() {
+ return exceptionThrown;
+ }
+
+ /**
+ * @return a status contained in the StatusException.
+ */
+ public Status getStatus() {
+ return status;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/TestCase.java b/qadevOOo/runner/lib/TestCase.java
new file mode 100644
index 000000000000..f3af02347c09
--- /dev/null
+++ b/qadevOOo/runner/lib/TestCase.java
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestCase.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.io.PrintWriter;
+
+import com.sun.star.uno.XInterface;
+
+import java.util.Hashtable;
+
+import lib.TestParameters;
+/**
+ * <code>TestCase</code> represent a factory for <code>TestEnvironment</code>s
+ * creation and disposing for a given implementation object. The
+ * <code>TestEnvironment</code> contains an instance of the implementation
+ * object and all additional objects needed to perform tests on the object.
+ *
+ * <p>The <code>TestCase</code> provides four methods for its subclasses to
+ * define its functionality: <code>initialize()</code>, <code>cleanup()</code>,
+ * <code>createTestEnvironment()</code> and <code>disposeTestEnvironment()</code>.
+ * The first two are intended to initialize and cleanup common objects shared
+ * among all instances of <code>TestEnvironment</code> produced by the
+ * <code>TestCase</code>, and they are called at the beginning and at the end of
+ * the <code>TestCase</code> lifecycle accordingly.
+ *
+ * <p>The other two are intended to produce and dispose
+ * <code>TestEnvironment</code> instances. The
+ * <code>createTestEnvironment()</code> is called to create a
+ * <code>TestEnvironment</code> instance and the
+ * <code>disposeTestEnvironment()</code> is called when the instane is not used
+ * anymore.
+ *
+ * @see lib.TestEnvironment
+ */
+public abstract class TestCase {
+
+ /**
+ * Specifies the PrintWriter to log information.
+ */
+ public PrintWriter log;
+
+ //public static TestCase tCase;
+
+ /**
+ * Sets the log to write information during testing.
+ */
+ public void setLogWriter( PrintWriter log ) {
+ this.log = log;
+ }
+
+ /**
+ * Initializes the <code>TestCase</code>. Calls <code>initialize()</code>
+ * method.
+ *
+ * @param tParam test parameters.
+ */
+ public void initializeTestCase( TestParameters tParam ) {
+ initialize( tParam, log );
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+
+ /**
+ * Cleans up the <code>TestCase</code>. Calls <code>cleanup()</code>.
+ *
+ * @param tParam test parameters
+ */
+ public void cleanupTestCase( TestParameters tParam ) {
+ cleanup( tParam, log );
+ }
+
+ /**
+ * Called while the <code>TestCase</code> cleanup. In the implementation
+ * does nothing. Subclasses can override to cleanup objects shared among
+ * all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #cleanupTestCase
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ }
+
+ /**
+ * Creates a <code>TestEnvironment</code> containing an instance of the
+ * implementation object and related objects needed to perform test.
+ *
+ * @param tParam test parameters
+ *
+ * @return the created <code>TestEnvironment</code>
+ *
+ * @see #createTestEnvironment()
+ * @see lib.TestEnvironment
+ */
+ public synchronized TestEnvironment getTestEnvironment( TestParameters tParam ) {
+ TestEnvironment tEnv = null;
+ try {
+ tEnv = createTestEnvironment( tParam, log );
+ System.out.println("Environment created");
+ if (tEnv != null) {
+ tEnv.setTestCase(this);
+ }
+ } catch (Exception e) {
+ System.out.println("Exception while getting Environment "+e.getMessage());
+ }
+ return tEnv;
+ }
+
+ /**
+ * Disposes the <code>TestEnvironment</code> when it is not needed anymore.
+ * The method calls <code>cleanupTestEnvironment()</code>.
+ *
+ * @param tEnv the environment to dispose
+ * @param tParam test parameters
+ *
+ * @see #cleanupTestEnvironment()
+ */
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam ) {
+ cleanupTestEnvironment( tParam, tEnv, log );
+ }
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected abstract TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log );
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>. In the
+ * implementation does nothing. Subclasses can override to clean up
+ * the environments created by them.
+ *
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #disposeTestEnvironment()
+ */
+ protected void cleanupTestEnvironment( TestParameters Param,
+ TestEnvironment tEnv, PrintWriter log ) {
+ }
+
+ /**
+ * @return the name of the object
+ */
+ public String getObjectName() {
+ String clName = this.getClass().getName();
+ return clName.substring( clName.lastIndexOf('.') + 1 );
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java
new file mode 100644
index 000000000000..014ab422e180
--- /dev/null
+++ b/qadevOOo/runner/lib/TestEnvironment.java
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestEnvironment.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:27:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+import com.sun.star.uno.XInterface;
+
+import java.util.Hashtable;
+
+
+/**
+ * The class contains an instance of a given implementation object and
+ * auxiliary objects associated with it and required for the object testing.
+ *
+ * @see TestCase
+ */
+
+public class TestEnvironment {
+ /**
+ * Contains object relations - auxiliary objects associated with the
+ * tested object and required for testing.
+ */
+ protected Hashtable relations = new Hashtable(10);
+
+ /**
+ * An instance of the tested implementation object.
+ */
+ protected XInterface testObject;
+
+ /**
+ * Indicates that the testObject is in invalid state and should notbe
+ * used for testing anymore.
+ */
+ protected boolean disposed = false;
+
+ /**
+ * A reference to TestCase which has created the test environment.
+ */
+ private TestCase tCase;
+
+ /**
+ * Creates an instance of test environment with testObject.
+ *
+ * @param testObject object to test
+ *
+ * @throws java.lang.IllegalArgumentException if the testObject is
+ * <tt>null</tt>.
+ */
+ public TestEnvironment( XInterface testObject ) {
+ if (testObject == null) {
+ throw new IllegalArgumentException(
+ "Couldn't create a test object");
+ }
+ this.testObject = testObject;
+ }
+
+ /**
+ * @return the object to test.
+ */
+ public XInterface getTestObject() {
+ return testObject;
+ }
+
+ /**
+ * Adds to the environment an auxiliary object required for testing.
+ *
+ * @param name a name to reference the auxiliary object
+ *
+ * @param relation the auxiliary object related to the tested one
+ */
+ public void addObjRelation( String name, Object relation) {
+ relations.put( name, relation );
+ }
+
+ /**
+ * Returns an auxiliary object referenced by tname.
+ *
+ * @param name a name of the object relation
+ *
+ * @return the auxiliary object(object relation)
+ */
+ public Object getObjRelation( String name ) {
+ return relations.get( name );
+ }
+
+ /**
+ * Checks if an auxiliary object has been registered with name
+ *
+ * @param name a name referencing an auxiliarx object
+ *
+ * @return <tt>true</tt> if the object has been associated, <tt>false</tt>
+ * otherwise.
+ */
+ public boolean hasObjRelation(String name) {
+ return (relations.get(name) != null) ;
+ }
+
+ /**
+ * Sets the <code>TestCase</code> that created the environment.
+ */
+ public void setTestCase( TestCase tCase) {
+ this.tCase = tCase;
+ }
+
+ /**
+ * @return the <code>TestCase</code> created the environment.
+ */
+ public TestCase getTestCase() {
+ return tCase;
+ }
+
+ /**
+ * Makes the environment invalid, i.e. it should not be used for
+ * testing anymore.
+ */
+ public void dispose() {
+ disposed = true;
+ }
+
+ /**
+ * Checks if the environment has been disposed.
+ *
+ * @return <tt>true</tt< if it has been disposed, <tt>false</tt> otherwise.
+ *
+ * @see #dispose()
+ */
+ public boolean isDisposed() {
+ return disposed;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java
new file mode 100644
index 000000000000..1dd677033ba5
--- /dev/null
+++ b/qadevOOo/runner/lib/TestParameters.java
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestParameters.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sw $ $Date: 2003-01-27 16:27:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.util.Hashtable;
+import com.sun.star.lang.XMultiServiceFactory;
+
+/**
+ * TestParameters describes a parameters (in a form of pairs: name, value) to
+ * be passed to tests and which may affect the test behaviour. That can be,
+ * for example, standard paths, connection strings, etc. The TestParameters
+ * also provides XMultiServiceFactory for the test (tests).
+ */
+public class TestParameters extends Hashtable {
+
+ /**
+ * The ConnectionString for Office Connection<br>
+ * default is 'socket,host=localhost,port=8100'
+ */
+
+ public String ConnectionString="socket,host=localhost,port=8100";
+
+ /**
+ * The AppProvider contains the Application Provider<br>
+ * to control the ServiceFactory.
+ */
+
+ public Object AppProvider=null;
+
+ /**
+ * The Process contains the Process handler<br>
+ * to control the Application.
+ */
+
+ public Object ProcessHandler=null;
+
+ /**
+ * The AppExecutionCmd contains the full qualified<br>
+ * command to an Application to be started.
+ */
+
+ public String AppExecutionCommand="";
+
+ /**
+ * The Testbase to be executed by the runner<br>
+ * default is 'java_fat'
+ */
+
+ public String TestBase="java_fat";
+
+ /**
+ * The ServiceFactory to create instances
+ */
+
+ public XMultiServiceFactory ServiceFactory;
+
+ /**
+ * The Path to the component description
+ */
+
+ public String DescriptionPath;
+
+ /**
+ * The Path to the test documents that are loaded during the test <br>
+ * default will be the tmp dir
+ */
+
+ public String TestDocumentPath=System.getProperty("java.io.tmpdir");
+
+ /**
+ * 'true' is a log should be written, 'false' elsewhere <br>
+ * these will be provided by the testcases<br>
+ * default is true
+ */
+
+ public boolean LoggingIsActive=true;
+
+ /**
+ * 'true' is a debug information should be written, 'false' elsewhere
+ * these will be provided by the framework.<br>
+ * Debug information will always be written on standard out.<br>
+ * default is true
+ */
+
+ public boolean DebugIsActive=false;
+
+ /*
+ * This parameter contains the testjob to be executed<br>
+ * by the framework
+ */
+
+ public Object TestJob;
+
+ /*
+ * This parameter contains the class used<br>
+ * for Logging
+ */
+
+ public String LogWriter="stats.SimpleLogWriter";
+
+ /*
+ * This parameter contains the class used<br>
+ * for Logging
+ */
+
+ public String OutProducer="stats.SimpleOutProducer";
+
+ /*
+ * This parameter contains the timeout used<br>
+ * by the watcher
+ */
+ public Integer TimeOut = new Integer(30000);
+
+ /**
+ * Wraper around "get()" with some debug output
+ * @param key A key of this table.
+ * @return The value of this key.
+ * @see java.util.Hashtable
+ */
+ public Object get(Object key) {
+ Object val = super.get(key);
+ if (val == null && DebugIsActive) {
+ System.out.print("Have been asked for key \""+key.toString());
+ System.out.println("\" which is not part of params.");
+ }
+ return val;
+ }
+
+ /**
+ * Special get method for boolean values: for convenience.
+ * Will return 'false' if the value is not of "Boolean" type.
+ * @param key A key of this table.
+ * @return The value of this key, castet to a boolean type.
+ */
+ public boolean getBool(Object key) {
+ Object val = super.get(key);
+ if (val instanceof Boolean)
+ return ((Boolean)val).booleanValue();
+ else return false;
+ }
+
+ /**
+ * Special get method for integer values: for convenience.
+ * Will return 'false' if the value is not of "Boolean" type.
+ * @param key A key of this table.
+ * @return The value of this key, castet to a boolean type.
+ */
+ public int getInt(Object key) {
+ Object val = super.get(key);
+ if (val instanceof Integer)
+ return ((Integer)val).intValue();
+ else return 0;
+ }
+
+ /**
+ * Wraper around "put()" that converts String values<br>
+ * "false", "true", "yes, "no"<br>
+ * to boolean.
+ * @param key A key of this table.
+ * @return The value of this key.
+ * @see java.util.Hashtable
+ */
+ public Object put(Object key, Object val) {
+ Object ret;
+ if (val instanceof String) {
+ String sVal = (String)val;
+ if (sVal.equalsIgnoreCase("true") ||
+ sVal.equalsIgnoreCase("yes")) {
+ return super.put(key,Boolean.TRUE);
+ }
+ else if (sVal.equalsIgnoreCase("false") ||
+ sVal.equalsIgnoreCase("no")) {
+
+ return super.put(key,Boolean.FALSE);
+ }
+ try {
+ Integer nr = new Integer(sVal);
+ if (nr.intValue() > 0) return super.put(key,nr);
+ } catch ( java.lang.NumberFormatException nfe) {}
+ }
+ return super.put(key,val);
+ }
+
+ /**
+ * Constructor, defaults for Parameters are set.
+ */
+
+ public TestParameters() {
+ //fill the propertyset
+ put("ConnectionString",ConnectionString);
+ put("TestBase",TestBase);
+ put("TestDocumentPath",TestDocumentPath);
+ put("LoggingIsActive",new Boolean(LoggingIsActive));
+ put("DebugIsActive",new Boolean(DebugIsActive));
+ put("OutProducer",OutProducer);
+ put("LogWriter",LogWriter);
+ put("AppExecutionCommand",AppExecutionCommand);
+ put("TimeOut",TimeOut);
+
+ //For compatibility Reasons
+ put("CNCSTR",ConnectionString);
+ put("DOCPTH",TestDocumentPath);
+ System.setProperty("DOCPTH",TestDocumentPath);
+ }
+
+ /**
+ * @return a XMultiServiceFactory to be used by a test (tests).
+ */
+ public XMultiServiceFactory getMSF() {
+ XMultiServiceFactory ret = null;
+ ret = (XMultiServiceFactory) get("ServiceFactory");
+ return ret;
+ }
+
+}// finish class TestParamenters
diff --git a/qadevOOo/runner/lib/TestResult.java b/qadevOOo/runner/lib/TestResult.java
new file mode 100644
index 000000000000..1bca5d8aa6e4
--- /dev/null
+++ b/qadevOOo/runner/lib/TestResult.java
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestResult.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sw $ $Date: 2003-01-27 16:27:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package lib;
+
+import java.util.Hashtable;
+
+/**
+ * The class supports interface tests development and Status calculation.
+ */
+public class TestResult extends Status {
+ /**
+ * Contains methods having been tested and their results.
+ */
+ protected Hashtable testedMethods = new Hashtable();
+
+
+ /**
+ * Returns the string describing run state of the test, e.g. PASSED,
+ * SKIPPED, etc.
+ *
+ * @see lib.Status
+ */
+ public String getRunStateString() {
+ return null;
+ }
+
+ /**
+ * Returns the state of the test, e.g. OK, FAILED.
+ *
+ * @see lib.Status
+ */
+ public int getState() {
+ return 0;
+ }
+
+ /**
+ * Returns the run state of the test, eg.g. : PASSED, SKIPPED, etc.
+ *
+ * @see lib.Status
+ */
+ public int getRunState() {
+ return 0;
+ }
+
+ /**
+ * The method makes method tested with the result, i.e. it adds to its
+ * state OK (if result == true) or FAILED (if result == false) status
+ * and makes the state of the method completed. It's equal to
+ * tested(method, Status(result)) call.
+ *
+ * @param method reffers to the method whoch was tested
+ * @param result the result of testing the method
+ *
+ * @return the result value
+ *
+ * @throw java.lang.IllegalArgumentException if the method is not
+ * available in the interface.
+ *
+ * @see #tested(String, Status)
+ */
+ public boolean tested( String method, boolean result) {
+ return tested( method, Status.passed( result ) );
+ }
+
+ /**
+ * The method makes the method tested with the status, i.e. it adds the
+ * status to its state and makes it completed.
+ *
+ * @param method reffers to the method whoch was tested
+ * @param status describes the result of testing the method
+ * @return <tt>true</tt> if status is OK, <tt>false</tt> otherwise.
+ *
+ * @throw java.lang.IllegalArgumentException if the method is not
+ * available in the interface.
+ */
+ public boolean tested( String method, Status status ) {
+ testedMethods.put(method,status);
+ return true;
+ }
+
+ /**
+ * @return methods available in the interface tested.
+ */
+ public String[] getTestedMethods() {
+ return (String[])testedMethods.keySet().toArray(
+ new String[testedMethods.size()]);
+ }
+
+ /**
+ * @return <tt>true</tt> if the method belongs to the interface tested,
+ * <tt>false</tt> otherwise.
+ */
+ public boolean hasMethod( String method ) {
+ return testedMethods.containsKey( method );
+ }
+
+ /**
+ * @return status of testing the method, if it is available (was set by
+ * the tested or assert method), <tt>null</tt> otherwise.
+ *
+ * @see #tested(String, boolean)
+ * @see #tested(String, Status)
+ * @see #assert
+ */
+ public Status getStatusFor( String method ) {
+ return (Status)testedMethods.get( method );
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/makefile.mk b/qadevOOo/runner/lib/makefile.mk
new file mode 100644
index 000000000000..26b40eabac0f
--- /dev/null
+++ b/qadevOOo/runner/lib/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:42 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = Runner
+PACKAGE = lib
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+
+JAVAFILES = DynamicClassLoader.java \
+ SimpleStatus.java \
+ TestEnvironment.java \
+ ExceptionStatus.java \
+ Status.java \
+ MultiMethodTest.java \
+ StatusException.java \
+ TestParameters.java \
+ TestResult.java \
+ MultiPropertyTest.java \
+ TestCase.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/makefile.mk b/qadevOOo/runner/makefile.mk
new file mode 100644
index 000000000000..7a2eff39abda
--- /dev/null
+++ b/qadevOOo/runner/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:26:44 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = OOoRunner
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+SUBDIRS = util share stats lib complexlib helper basicrunner \
+ base org$/openoffice
+
+
+MYJARCOMMANDS = $(foreach,i,$(SUBDIRS) -C $(CLASSDIR) $i)
+
+# --- Targets ------------------------------------------------------
+
+OWNJAR: ALLTAR
+
+.INCLUDE : target.mk
+
+OWNJAR:
+ +jar cvf $(CLASSDIR)$/$(TARGET).jar -C $(PRJ) objdsc $(MYJARCOMMANDS)
+
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
new file mode 100644
index 000000000000..b5b93bf883be
--- /dev/null
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: Runner.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice;
+
+import lib.TestParameters;
+import lib.DynamicClassLoader;
+import base.TestBase;
+import helper.ClParser;
+import helper.CfgParser;
+
+/**
+ * The main class, will call ClParser and CfgParser to <br>
+ * fill the TestParameters.<br>
+ * Will then call the appropriate Testbase to run the tests.
+ */
+public class Runner {
+
+ public static void main(String[] args) {
+ TestParameters param = new TestParameters();
+
+ ClParser cli = new ClParser();
+
+ //parse the commandline arguments if an ini-parameter is given
+ String iniFile = cli.getIniPath(args);
+
+ //initialize cfgParser with ini-path
+ CfgParser ini = new CfgParser(iniFile);
+
+ //parse ConfigFile
+ ini.getIniParameters(param);
+
+ //parse the commandline arguments
+ cli.getCommandLineParameter(param,args);
+
+ System.out.println("TestJob: "+param.get("TestJob"));
+
+ DynamicClassLoader dcl = new DynamicClassLoader();
+
+ TestBase toExecute = (TestBase) dcl.getInstance("base."+
+ (String)param.get("TestBase"));
+
+ boolean worked = toExecute.executeTest(param);
+
+ if (!worked) {
+ System.out.println("Couldn't execute Job "+param.get("TestJob"));
+ System.exit(1);
+ } else {
+ System.out.println("Job "+param.get("TestJob")+" successful executed");
+ System.exit(0);
+ }
+ }
+}
diff --git a/qadevOOo/runner/org/openoffice/makefile.mk b/qadevOOo/runner/org/openoffice/makefile.mk
new file mode 100644
index 000000000000..d3d92228a686
--- /dev/null
+++ b/qadevOOo/runner/org/openoffice/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:26:45 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME = OOoRunner
+PACKAGE = org$/openoffice
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+JAVAFILES = Runner.java
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/share/ComplexTest.java b/qadevOOo/runner/share/ComplexTest.java
new file mode 100644
index 000000000000..0d7edd9bbeb0
--- /dev/null
+++ b/qadevOOo/runner/share/ComplexTest.java
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComplexTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package share;
+
+/**
+ * Interface for complex tests.
+ */
+public interface ComplexTest {
+
+ public String[] getTestMethodNames();
+
+ public String getTestObjectName();
+
+}
+
diff --git a/qadevOOo/runner/share/DescEntry.java b/qadevOOo/runner/share/DescEntry.java
new file mode 100644
index 000000000000..0443e31b5dea
--- /dev/null
+++ b/qadevOOo/runner/share/DescEntry.java
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: DescEntry.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+package share;
+
+/**
+ *
+ * Structure to describe the entries to be tested
+ *
+ */
+public class DescEntry {
+
+ /**
+ * Contains the name used inside the framework
+ */
+ public String entryName;
+ /**
+ * Contains the name that may be used by state writers
+ */
+ public String longName;
+ /**
+ * Contains information if this entry is Optional
+ */
+ public boolean isOptional;
+ /**
+ * Contains information if this entry should be tested
+ */
+ public boolean isToTest;
+ /**
+ * Contains the information about the number of SubEntries
+ */
+ public int SubEntryCount;
+ /**
+ * Contains the SubEntries
+ */
+ public DescEntry[] SubEntries;
+
+ /**
+ * Contains information about the Type of the entry<br>
+ * possible 'component', 'interface', 'service', 'method', 'property', 'unit'
+ */
+ public String EntryType;
+
+ /**
+ * Contains the ErrorMsg is something went wrong while gaining<br>
+ * the description
+ */
+ public String ErrorMsg;
+
+ /**
+ * Contains information if errors occured while gaining the Description
+ */
+ public boolean hasErrorMsg;
+
+ /**
+ * Contains the state for this entry
+ */
+ public String State = "UNKNOWN";
+
+ /**
+ * Contains the LogWriter to be used by the entry-test
+ */
+
+ public share.LogWriter Logger;
+
+ /**
+ * Contains an arbitrary set of parameters
+ */
+
+ public java.util.Hashtable UserDefinedParams = new java.util.Hashtable();
+
+}
diff --git a/qadevOOo/runner/share/DescGetter.java b/qadevOOo/runner/share/DescGetter.java
new file mode 100644
index 000000000000..0b15013cadfa
--- /dev/null
+++ b/qadevOOo/runner/share/DescGetter.java
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: DescGetter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+package share;
+
+/**
+ *
+ * Base Interface to get a description for a given TestJob
+ *
+ */
+public interface DescGetter {
+
+ public DescEntry[] getDescriptionFor(String entry, String DescPath, boolean debug);
+
+}
+
diff --git a/qadevOOo/runner/share/LogWriter.java b/qadevOOo/runner/share/LogWriter.java
new file mode 100644
index 000000000000..b2115a5f9f60
--- /dev/null
+++ b/qadevOOo/runner/share/LogWriter.java
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: LogWriter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package share;
+
+public interface LogWriter {
+
+ /**
+ * Method to print
+ */
+ public void println(String msg);
+
+ /**
+ * initialization
+ *
+ */
+
+ public boolean initialize(share.DescEntry entry, boolean active);
+
+ /**
+ * will mostly be used by outproducers to sum up
+ * the information, maybe write them to a db
+ */
+
+ public boolean summary(share.DescEntry entry);
+
+}
diff --git a/qadevOOo/runner/share/Watcher.java b/qadevOOo/runner/share/Watcher.java
new file mode 100644
index 000000000000..81fa6724de25
--- /dev/null
+++ b/qadevOOo/runner/share/Watcher.java
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * $RCSfile: Watcher.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package share;
+
+public interface Watcher {
+
+ /**
+ * pings the watcher to check for changes
+ */
+ public void ping();
+
+}
diff --git a/qadevOOo/runner/share/makefile.mk b/qadevOOo/runner/share/makefile.mk
new file mode 100644
index 000000000000..fbebbe44bb75
--- /dev/null
+++ b/qadevOOo/runner/share/makefile.mk
@@ -0,0 +1,87 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:27:46 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = Runner
+PACKAGE = share
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+
+JAVAFILES = DescEntry.java \
+ DescGetter.java \
+ LogWriter.java \
+ ComplexTest.java \
+ Watcher.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/stats/SimpleLogWriter.java b/qadevOOo/runner/stats/SimpleLogWriter.java
new file mode 100644
index 000000000000..c7d056eb39c5
--- /dev/null
+++ b/qadevOOo/runner/stats/SimpleLogWriter.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: SimpleLogWriter.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stats;
+
+import share.LogWriter;
+
+import java.io.PrintWriter;
+
+public class SimpleLogWriter extends PrintWriter implements LogWriter {
+
+ boolean logging = false;
+ share.DescEntry entry = null;
+
+ public SimpleLogWriter() {
+ super(new PrintWriter(System.out));
+ }
+
+ public boolean initialize(share.DescEntry entry, boolean logging) {
+ this.logging = logging;
+ this.entry = entry;
+ return true;
+ }
+
+ public void println(String msg) {
+ share.Watcher ow = (share.Watcher)
+ entry.UserDefinedParams.get("Watcher");
+ if (ow != null) {
+ ow.ping();
+ }
+ if (logging) {
+ System.out.println("LOG> "+msg);
+ }
+ }
+
+ public boolean summary(share.DescEntry entry) {
+ return true;
+ }
+
+}
diff --git a/qadevOOo/runner/stats/SimpleOutProducer.java b/qadevOOo/runner/stats/SimpleOutProducer.java
new file mode 100644
index 000000000000..bbe911725c3c
--- /dev/null
+++ b/qadevOOo/runner/stats/SimpleOutProducer.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: SimpleOutProducer.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stats;
+
+import share.LogWriter;
+/**
+ *
+ * @author sw93809
+ */
+public class SimpleOutProducer implements LogWriter {
+
+
+ /** initialization, here a filename might be given
+ * or a dbUrL
+ */
+ public boolean initialize(share.DescEntry entry, boolean active) {
+ return true;
+ }
+
+ /** Method to print
+ */
+ public void println(String msg) {
+
+ }
+
+ /** will mostly be used by outproducers to sum up
+ * the information, maybe write them to a db
+ */
+ public boolean summary(share.DescEntry entry) {
+ String header = "***** State for "+entry.longName+" ******";
+ System.out.println(header);
+ if (entry.hasErrorMsg) {
+ System.out.println(entry.ErrorMsg);
+ System.out.println("Whole "+entry.EntryType+": "+entry.State);
+ } else {
+ System.out.println("Whole "+entry.EntryType+": "+entry.State);
+ }
+ for (int i=0;i<header.length();i++) {
+ System.out.print("*");
+ }
+ System.out.println("");
+ return true;
+ }
+
+}
diff --git a/qadevOOo/runner/stats/Summarizer.java b/qadevOOo/runner/stats/Summarizer.java
new file mode 100644
index 000000000000..2ebbcd8b2672
--- /dev/null
+++ b/qadevOOo/runner/stats/Summarizer.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: Summarizer.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stats;
+
+import java.util.Vector;
+import share.DescEntry;
+
+/**
+ *
+ * this class summs up the results of the subentries of a given DescEntry<br>
+ * and fills the subentries in cases of SKIPPED states
+ */
+public class Summarizer {
+
+ /**
+ *
+ * gets the state for a SuperEntry according to its subentries
+ */
+
+ public void summarizeUp(DescEntry entry) {
+ if ( ( entry.State != null ) && entry.State != "UNKNOWN") return;
+ int count = entry.SubEntryCount;
+ Vector failures = new Vector();
+ Vector states = new Vector();
+ for (int i=0; i<count; i++) {
+ if (entry.SubEntries[i].State == null)
+ entry.SubEntries[i].State = "PASSED.FAILED";
+ if (!entry.SubEntries[i].State.endsWith("OK")) {
+ failures.add(entry.SubEntries[i].entryName);
+ states.add(entry.SubEntries[i].State);
+ }
+ }
+ if (failures.size()>0) {
+ String errMsg = "";
+ String state = "PASSED.FAILED";
+ for (int j=0; j<failures.size();j++) {
+ if (states.elementAt(j).equals("not part of the job")) {
+ state = "Not possible since not all Interfaces/Services have been checked";
+ } else errMsg +=
+ failures.elementAt(j)+" - "+states.elementAt(j)+"\r\n";
+ }
+ entry.hasErrorMsg=true;
+ entry.ErrorMsg = errMsg;
+ entry.State = state;
+ } else {
+ entry.State = "PASSED.OK";
+ }
+ }
+
+ public static void summarizeDown(DescEntry entry, String state) {
+ entry.State = state;
+ for (int i=0; i<entry.SubEntryCount; i++) {
+ entry.SubEntries[i].State = state;
+ for (int j=0;j<entry.SubEntries[i].SubEntryCount;j++) {
+ summarizeDown(entry.SubEntries[i].SubEntries[j],state);
+ }
+ }
+ }
+
+}
diff --git a/qadevOOo/runner/stats/makefile.mk b/qadevOOo/runner/stats/makefile.mk
new file mode 100644
index 000000000000..ac2a6607a550
--- /dev/null
+++ b/qadevOOo/runner/stats/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:26:49 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = Runner
+PACKAGE = stats
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+
+JAVAFILES = \
+ SimpleOutProducer.java \
+ SimpleLogWriter.java \
+ Summarizer.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java
new file mode 100644
index 000000000000..6ead10c19c18
--- /dev/null
+++ b/qadevOOo/runner/util/AccessibilityTools.java
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.io.PrintWriter;
+
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.XAccessibleContext;
+import drafts.com.sun.star.accessibility.XAccessibleComponent;
+import drafts.com.sun.star.accessibility.XAccessibleRelationSet;
+import drafts.com.sun.star.accessibility.XAccessibleStateSet;
+
+public class AccessibilityTools {
+
+ public AccessibilityTools() {
+ //done = false;
+ SearchedContext = null;
+ }
+
+ public static XAccessible getAccessibleObject (XInterface xObject)
+ {
+ XAccessible xAccessible = null;
+ try
+ {
+ xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, xObject);
+ }
+ catch (Exception e)
+ {
+ System.out.println (
+ "caught exception while getting accessible object" + e);
+ e.printStackTrace();
+ }
+ return xAccessible;
+ }
+
+ public static XWindow getCurrentWindow (XMultiServiceFactory msf,XModel xModel)
+ {
+ XWindow xWindow = null;
+ try
+ {
+ if (xModel == null)
+ System.out.println ("invalid model (==null)");
+ XController xController = xModel.getCurrentController();
+ if (xController == null)
+ System.out.println ("can't get controller from model");
+ XFrame xFrame = xController.getFrame();
+ if (xFrame == null)
+ System.out.println ("can't get frame from controller");
+ xWindow = xFrame.getComponentWindow ();
+ if (xWindow == null)
+ System.out.println ("can't get window from frame");
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while getting current window" + e);
+ }
+
+ return xWindow;
+ }
+
+ public static XAccessibleContext SearchedContext = null;
+ public static XAccessible SearchedAccessible = null;
+
+ public static XAccessibleContext getAccessibleObjectForRole
+ (XAccessible xacc,short role) {
+ SearchedContext = null;
+ SearchedAccessible = null;
+ getAccessibleObjectForRole_(xacc, role) ;
+ return SearchedContext;
+ }
+
+ public static void getAccessibleObjectForRole_(XAccessible xacc,short role) {
+ XAccessibleContext ac = xacc.getAccessibleContext();
+ if (ac.getAccessibleRole()==role) {
+ SearchedContext = ac;
+ SearchedAccessible = xacc;
+ } else {
+ int k = ac.getAccessibleChildCount();
+ if (ac.getAccessibleChildCount() > 100) {
+ k = 50 ;
+ }
+ for (int i=0;i<k;i++) {
+ try {
+ getAccessibleObjectForRole_(ac.getAccessibleChild(i),role);
+ if (SearchedContext != null) return ;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Couldn't get Child");
+ }
+ }
+ }
+ }
+
+ public static XAccessibleContext getAccessibleObjectForRole(XAccessible xacc,
+ short role, String name) {
+ return getAccessibleObjectForRole(xacc, role, name, "");
+ }
+
+ public static XAccessibleContext getAccessibleObjectForRole(XAccessible xacc,
+ short role, String name, String implName) {
+
+ XAccessibleContext ac = xacc.getAccessibleContext();
+ if (ac.getAccessibleRole()==role
+ && ac.getAccessibleName().indexOf(name) > -1
+ && utils.getImplName(ac).indexOf(implName) > -1) {
+
+ SearchedAccessible = xacc;
+ System.out.println("FOUND the desired component");
+ return ac;
+ } else {
+ int k = ac.getAccessibleChildCount();
+ if (ac.getAccessibleChildCount() > 100) {
+ k = 50 ;
+ }
+ for (int i=0;i<k;i++) {
+ try {
+ XAccessibleContext ac1 = getAccessibleObjectForRole
+ (ac.getAccessibleChild(i), role, name, implName);
+ if (ac1 != null) return ac1;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Couldn't get Child");
+ }
+ }
+ }
+
+ return null ;
+ }
+
+ public static void printAccessibleTree(PrintWriter log, XAccessible xacc) {
+ printAccessibleTree(log, xacc, "");
+ }
+
+ protected static void printAccessibleTree(PrintWriter log, XAccessible xacc,
+ String indent) {
+
+ XAccessibleContext ac = xacc.getAccessibleContext();
+
+ log.println(indent + ac.getAccessibleRole() + "," +
+ ac.getAccessibleName() + "(" + ac.getAccessibleDescription() + "):"
+ + utils.getImplName(ac));
+
+ int k = ac.getAccessibleChildCount();
+
+ if (ac.getAccessibleChildCount() > 100) {
+ k = 50 ;
+ }
+ for (int i=0;i<k;i++) {
+ try {
+ printAccessibleTree(log, ac.getAccessibleChild(i), indent + " ");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Couldn't get Child");
+ }
+ }
+ if (ac.getAccessibleChildCount() > 100) {
+ k = ac.getAccessibleChildCount() ;
+ int st = ac.getAccessibleChildCount() - 50;
+ log.println(indent + " " + " ...... [skipped] ......");
+ for (int i=st;i<k;i++) {
+ try {
+ printAccessibleTree(log, ac.getAccessibleChild(i), indent + " ");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Couldn't get Child");
+ }
+ }
+ }
+ }
+
+ public static String accessibleToString(Object AC) {
+ XAccessibleContext xAC = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, AC);
+ if (xAC != null) {
+ return "" + xAC.getAccessibleRole() + "," + xAC.getAccessibleName()
+ + "(" + xAC.getAccessibleDescription() + "):";
+ }
+
+ XAccessible xA = (XAccessible)
+ UnoRuntime.queryInterface(XAccessible.class, AC);
+ if (xA == null) return "(Not supported)" ;
+ xAC = xA.getAccessibleContext();
+ return "" + xAC.getAccessibleRole() + "," + xAC.getAccessibleName()
+ + "(" + xAC.getAccessibleDescription() + ")";
+ }
+
+ public static boolean equals(XAccessible c1, XAccessible c2) {
+ if (c1 == null || c2 == null) return c1 == c2;
+ return AccessibilityTools.equals(c1.getAccessibleContext(),
+ c2.getAccessibleContext()) ;
+ }
+
+ public static boolean equals(XAccessibleContext c1, XAccessibleContext c2) {
+ if (c1 == null || c2 == null) return c1 == c2;
+
+ if (c1.getAccessibleRole() != c2.getAccessibleRole()) return false;
+ if (!c1.getAccessibleName().equals(c2.getAccessibleName())) return false;
+ if (!c1.getAccessibleDescription().equals(c2.getAccessibleDescription())) return false;
+ if (c1.getAccessibleChildCount() != c2.getAccessibleChildCount()) return false;
+
+ return AccessibilityTools.equals
+ (c1.getAccessibleParent(), c2.getAccessibleParent());
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/BookmarkDsc.java b/qadevOOo/runner/util/BookmarkDsc.java
new file mode 100644
index 000000000000..b7ff9ae375f7
--- /dev/null
+++ b/qadevOOo/runner/util/BookmarkDsc.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: BookmarkDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextContent;
+
+/**
+ * describes a Bookmark to be inserted in a container
+ */
+public class BookmarkDsc extends InstDescr {
+
+ final String service = "com.sun.star.text.Bookmark";
+ String ifcName = "com.sun.star.text.XTextContent";
+ private String name = null;
+
+
+ public BookmarkDsc() {
+ initBookmark();
+ }
+
+ public BookmarkDsc( String name ) {
+ this.name = name;
+ initBookmark();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void initBookmark() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object ServiceObj = null;
+
+ try {
+ ServiceObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XTextContent BM = (XTextContent)UnoRuntime.queryInterface( ifcClass,
+ ServiceObj );
+ return BM;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ControlDsc.java b/qadevOOo/runner/util/ControlDsc.java
new file mode 100644
index 000000000000..ed50e87e314e
--- /dev/null
+++ b/qadevOOo/runner/util/ControlDsc.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: ControlDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.form.*;
+import com.sun.star.awt.*;
+
+/**
+ * Describes a Control to be inserted in a container
+ */
+
+public class ControlDsc extends InstDescr {
+
+ private String name = null;
+ final String ifcName = "com.sun.star.form.XFormComponent";
+ String service = "com.sun.star.form.component.CommandButton";
+
+ public ControlDsc( String kind ) {
+ service="com.sun.star.form.component."+kind;
+ initControl();
+ }
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initControl() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+
+ Object SrvObj = null;
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+
+ XInterface Control = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj );
+
+ return Control;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java
new file mode 100644
index 000000000000..a8fa3e8f2274
--- /dev/null
+++ b/qadevOOo/runner/util/DBTools.java
@@ -0,0 +1,852 @@
+/*************************************************************************
+ *
+ * $RCSfile: DBTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.io.PrintWriter ;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+
+import com.sun.star.sdbc.SQLException ;
+import com.sun.star.sdbc.XConnection ;
+import com.sun.star.sdbc.XResultSet ;
+import com.sun.star.sdbc.XResultSetUpdate ;
+import com.sun.star.sdbc.XStatement ;
+import com.sun.star.sdbc.XRowUpdate ;
+import com.sun.star.util.Date ;
+import com.sun.star.uno.XNamingService ;
+import com.sun.star.task.XInteractionHandler ;
+import com.sun.star.sdb.XCompletedConnection ;
+import com.sun.star.container.XEnumeration ;
+import com.sun.star.container.XEnumerationAccess ;
+import com.sun.star.io.XInputStream ;
+import com.sun.star.io.XTextInputStream ;
+import com.sun.star.io.XDataInputStream ;
+import com.sun.star.container.XNameAccess ;
+import com.sun.star.sdbc.XCloseable ;
+import java.sql.Statement;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+/**
+* Provides useful methods for working with SOffice databases.
+* Database creation, data transfering, outputting infromation.
+*/
+public class DBTools {
+
+ private XMultiServiceFactory xMSF = null ;
+ private XNamingService dbContext = null ;
+ private Exception lastException = null ;
+
+ //JDBC driver
+ public final static String TST_JDBC_DRIVER = "org.gjt.mm.mysql.Driver";
+
+ // constants for TestDB table column indexes
+ public final static int TST_STRING = 1 ;
+ public final static int TST_INT = 2 ;
+ public final static int TST_DOUBLE = 5 ;
+ public final static int TST_DATE = 6 ;
+ public final static int TST_BOOLEAN = 10 ;
+ public final static int TST_CHARACTER_STREAM = 11 ;
+ public final static int TST_BINARY_STREAM = 12 ;
+
+ // constants for TestDB columns names
+ public final static String TST_STRING_F = "_TEXT" ;
+ public final static String TST_INT_F = "_INT" ;
+ public final static String TST_DOUBLE_F = "_DOUBLE" ;
+ public final static String TST_DATE_F = "_DATE" ;
+ public final static String TST_BOOLEAN_F = "_BOOL" ;
+ public final static String TST_CHARACTER_STREAM_F = "_MEMO1" ;
+ public final static String TST_BINARY_STREAM_F = "_MEMO2" ;
+
+ /**
+ * Values for filling test table.
+ */
+ public final static Object[][] TST_TABLE_VALUES = new Object[][] {
+ {new String("String1"), new Integer(1), null, null, new Double(1.1),
+ new Date((short) 1,(short) 1, (short) 2001), null, null, null,
+ new Boolean(true), null, null},
+ {new String("String2"), new Integer(2), null, null, new Double(1.2),
+ new Date((short) 2, (short) 1,(short) 2001), null, null, null,
+ new Boolean(false), null, null},
+ {null, null, null, null, null,
+ null, null, null, null,
+ null, null, null}
+ } ;
+
+ /**
+ * Array of lengths of streams for each row in of the
+ * <code>TST_TABLE_VALUES</code> constants.
+ */
+ public final static int[] TST_STREAM_LENGTHS = {0, 0, 0} ;
+
+ /**
+ * It's just a structure with some useful methods for representing
+ * <code>com.sun.star.sdb.DataSource</code> service. All this
+ * service's properties are stored in appropriate class fields.
+ * Class also allows to construct its instances using service
+ * information, and create new service instance upon class
+ * fields.
+ * @see com.sun.star.sdb.DataSource
+ */
+ public class DataSourceInfo {
+ /**
+ * Representation of <code>'Name'</code> property.
+ */
+ public String Name = null ;
+ /**
+ * Representation of <code>'URL'</code> property.
+ */
+ public String URL = null ;
+ /**
+ * Representation of <code>'Info'</code> property.
+ */
+ public PropertyValue[] Info = null ;
+ /**
+ * Representation of <code>'User'</code> property.
+ */
+ public String User = null ;
+ /**
+ * Representation of <code>'Password'</code> property.
+ */
+ public String Password = null ;
+ /**
+ * Representation of <code>'IsPasswordRequired'</code> property.
+ */
+ public Boolean IsPasswordRequired = null ;
+ /**
+ * Representation of <code>'SuppressVersionColumns'</code> property.
+ */
+ public Boolean SuppressVersionColumns = null ;
+ /**
+ * Representation of <code>'IsReadOnly'</code> property.
+ */
+ public Boolean IsReadOnly = null ;
+ /**
+ * Representation of <code>'TableFilter'</code> property.
+ */
+ public String[] TableFilter = null ;
+ /**
+ * Representation of <code>'TableTypeFilter'</code> property.
+ */
+ public String[] TableTypeFilter = null ;
+
+ /**
+ * Creates an empty instance.
+ */
+ public DataSourceInfo() {}
+
+ /**
+ * Creates an instance laying upon specified DataSource.
+ * @param dataSource All source properties are copied into
+ * class fields.
+ */
+ public DataSourceInfo(Object dataSource) {
+ XPropertySet xProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, dataSource) ;
+
+ try {
+ Name = (String)xProps.getPropertyValue("Name") ;
+ URL = (String)xProps.getPropertyValue("URL") ;
+ Info = (PropertyValue[])xProps.getPropertyValue("Info") ;
+ User = (String)xProps.getPropertyValue("User") ;
+ Password = (String)xProps.getPropertyValue("Password") ;
+ IsPasswordRequired = (Boolean)xProps.getPropertyValue("IsPasswordRequired") ;
+ SuppressVersionColumns = (Boolean)
+ xProps.getPropertyValue("SuppressVersionColumns") ;
+ IsReadOnly = (Boolean)xProps.getPropertyValue("IsReadOnly") ;
+ TableFilter = (String[])xProps.getPropertyValue("TableFilter") ;
+ TableTypeFilter = (String[])xProps.getPropertyValue("TableTypeFilter") ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ System.err.println("util.DBTools.DataSourceInfo: Error retrieving property") ;
+ e.printStackTrace(System.err) ;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ System.err.println("util.DBTools.DataSourceInfo: Error retrieving property") ;
+ e.printStackTrace(System.err) ;
+ }
+ }
+
+ /**
+ * Prints datasource info.
+ * @param out Stream to which information is printed.
+ */
+ public void printInfo(PrintWriter out) {
+ out.println("Name = '" + Name + "'") ;
+ out.println(" URL = '" + URL + "'") ;
+ out.print(" Info = ") ;
+ if (Info == null) out.println("null") ;
+ else {
+ out.print("{") ;
+ for (int i = 0; i < Info.length; i++) {
+ out.print(Info[i].Name + " = '" + Info[i].Value + "'") ;
+ if (i + 1 < Info.length) out.print("; ") ;
+ }
+ out.println("}") ;
+ }
+ out.println(" User = '" + User + "'") ;
+ out.println(" Password = '" + Password + "'") ;
+ out.println(" IsPasswordRequired = '" + IsPasswordRequired + "'") ;
+ out.println(" SuppressVersionColumns = '" + SuppressVersionColumns + "'") ;
+ out.println(" IsReadOnly = '" + IsReadOnly + "'") ;
+ out.print(" TableFilter = ") ;
+ if (TableFilter == null) out.println("null") ;
+ else {
+ out.print("{") ;
+ for (int i = 0; i < TableFilter.length; i++) {
+ out.print("'" + TableFilter[i] + "'") ;
+ if (i+1 < TableFilter.length) out.print("; ");
+ }
+ out.println("}") ;
+ }
+ out.print(" TableTypeFilter = ") ;
+ if (TableTypeFilter == null) out.println("null") ;
+ else {
+ out.print("{") ;
+ for (int i = 0; i < TableTypeFilter.length; i++) {
+ out.print("'" + TableTypeFilter[i] + "'") ;
+ if (i+1 < TableTypeFilter.length) out.print("; ");
+ }
+ out.println("}") ;
+ }
+ }
+
+ /**
+ * Creates new <code>com.sun.star.sdb.DataSource</code> service
+ * instance and copies all fields (which are not null) to
+ * appropriate service properties.
+ * @return <code>com.sun.star.sdb.DataSource</code> service.
+ */
+ public Object getDataSourceService() {
+ Object src = null ;
+ try {
+ src = xMSF.createInstance("com.sun.star.sdb.DataSource") ;
+ } catch (com.sun.star.uno.Exception e) {}
+
+ if (src == null) return null ;
+
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, src) ;
+
+ try {
+ if (Name != null) props.setPropertyValue("Name", Name) ;
+ if (URL != null) props.setPropertyValue("URL", URL) ;
+ if (Info != null) props.setPropertyValue("Info", Info) ;
+ if (User != null) props.setPropertyValue("User", User) ;
+ if (Password != null) props.setPropertyValue("Password", Password) ;
+ if (IsPasswordRequired != null) props.setPropertyValue("IsPasswordRequired", IsPasswordRequired) ;
+ if (SuppressVersionColumns != null) props.setPropertyValue("SuppressVersionColumns", SuppressVersionColumns) ;
+ if (IsReadOnly != null) props.setPropertyValue("IsReadOnly", IsReadOnly) ;
+ if (TableFilter != null) props.setPropertyValue("TableFilter", TableFilter) ;
+ if (TableTypeFilter != null) props.setPropertyValue("TableTypeFilter", TableTypeFilter) ;
+
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ return null ;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ return null ;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ return null ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null ;
+ }
+
+ return src ;
+ }
+ }
+
+ /**
+ * Creates class instance.
+ * @param xMSF <code>XMultiServiceFactory</code>.
+ */
+ public DBTools(XMultiServiceFactory xMSF) {
+ this.xMSF = xMSF ;
+
+ try {
+ Object cont = xMSF.createInstance("com.sun.star.sdb.DatabaseContext") ;
+
+ dbContext = (XNamingService) UnoRuntime.queryInterface
+ (XNamingService.class, cont) ;
+
+ } catch (com.sun.star.uno.Exception e) {}
+ }
+
+ /**
+ * Returns new instance of <code>DataSourceInfo</code> class.
+ */
+ public DataSourceInfo newDataSourceInfo() { return new DataSourceInfo() ;}
+
+ /**
+ * Returns new instance of <code>DataSourceInfo</code> class.
+ */
+ public DataSourceInfo newDataSourceInfo(Object dataSource) {
+ return new DataSourceInfo(dataSource);
+ }
+
+ /**
+ * Registers the datasource on the specified name in
+ * <code>DatabaseContext</code> service.
+ * @param name Name which dataSource will have in global context.
+ * @param dataSource <code>DataSource</code> object which is to
+ * be registered.
+ */
+ public void registerDB(String name, Object dataSource)
+ throws com.sun.star.uno.Exception {
+
+ dbContext.registerObject(name, dataSource) ;
+ }
+
+
+ /**
+ * First tries to revoke the datasource with the specified
+ * name and then registers a new one.
+ * @param name Name which dataSource will have in global context.
+ * @param dataSource <code>DataSource</code> object which is to
+ * be registered.
+ */
+ public void reRegisterDB(String name, Object dataSource)
+ throws com.sun.star.uno.Exception {
+
+ try {
+ revokeDB(name) ;
+ } catch (com.sun.star.uno.Exception e) {}
+
+ registerDB(name, dataSource) ;
+ }
+
+ /**
+ * RESERVED. Not used.
+ */
+ public XConnection connectToTextDB(String contextName,
+ String dbDir, String fileExtension)
+ throws com.sun.star.uno.Exception {
+
+ try {
+ XInterface newSource = (XInterface) xMSF.createInstance
+ ("com.sun.star.sdb.DataSource") ;
+
+ XPropertySet xSrcProp = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, newSource);
+
+ xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir));
+
+ PropertyValue extParam = new PropertyValue() ;
+ extParam.Name = "EXT" ;
+ extParam.Value = fileExtension ;
+
+ xSrcProp.setPropertyValue("Info", new PropertyValue[] {extParam}) ;
+
+ dbContext.registerObject(contextName, newSource) ;
+
+ Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
+ XInteractionHandler xHandler = (XInteractionHandler)
+ UnoRuntime.queryInterface(XInteractionHandler.class, handler) ;
+
+ XCompletedConnection xSrcCon = (XCompletedConnection)
+ UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ;
+
+ XConnection con = xSrcCon.connectWithCompletion(xHandler) ;
+
+ lastException = null ;
+ return con ;
+ } finally {
+ try {
+ dbContext.revokeObject(contextName) ;
+ } catch (Exception e) {}
+ }
+ }
+
+ /**
+ * Registers DBase database (directory with DBF files) in the
+ * global DB context, then connects to it.
+ * @param contextName Name under which DB will be registered.
+ * @param dbDir The directory with DBF tables.
+ * @return Connection to the DB.
+ */
+ public XConnection connectToDBase(String contextName,
+ String dbDir)
+ throws com.sun.star.uno.Exception {
+
+ try {
+ XInterface newSource = (XInterface) xMSF.createInstance
+ ("com.sun.star.sdb.DataSource") ;
+
+ XPropertySet xSrcProp = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, newSource);
+ xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir));
+
+ dbContext.registerObject(contextName, newSource) ;
+
+ XConnection con = connectToSource(newSource) ;
+
+ lastException = null ;
+ return con ;
+ } catch(com.sun.star.uno.Exception e) {
+ try {
+ dbContext.revokeObject(contextName) ;
+ } catch (Exception ex) {}
+
+ throw e ;
+ }
+ }
+
+ /**
+ * Performs connection to DataSource specified.
+ * @param dbSource <code>com.sun.star.sdb.DataSource</code> service
+ * specified data source which must be already registered in the
+ * <code>DatabaseContext</code> service.
+ * @param dbSource Data source to be connected to.
+ * @return Connection to the data source.
+ */
+ public XConnection connectToSource(Object dbSource)
+ throws com.sun.star.uno.Exception {
+
+ Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
+ XInteractionHandler xHandler = (XInteractionHandler)
+ UnoRuntime.queryInterface(XInteractionHandler.class, handler) ;
+
+ XCompletedConnection xSrcCon = (XCompletedConnection)
+ UnoRuntime.queryInterface(XCompletedConnection.class, dbSource) ;
+
+ return xSrcCon.connectWithCompletion(xHandler) ;
+ }
+
+ /**
+ * Registers Test data source in the <code>DatabaseContext</code> service.
+ * This source always has name <code>'APITestDatabase'</code> and it
+ * is registered in subdirectory <code>TestDB</code> of directory
+ * <code>docPath</code> which is supposed to be a directory with test
+ * documents, but can be any other (it must have subdirectory with DBF
+ * tables). If such data source doesn't exists or exists with
+ * different URL it is recreated and reregistered.
+ * @param docPath Path to database <code>TestDB</code> directory.
+ * @return <code>com.sun.star.sdb.DataSource</code> service
+ * implementation which represents TestDB.
+ */
+ public Object registerTestDB(String docPath)
+ throws com.sun.star.uno.Exception {
+
+ String testURL = null ;
+ if (docPath.endsWith("/") || docPath.endsWith("\\"))
+ testURL = dirToUrl(docPath + "TestDB") ;
+ else
+ testURL = dirToUrl(docPath + "/" + "TestDB") ;
+ testURL = "sdbc:dbase:" + testURL ;
+
+ String existURL = null ;
+
+ XNameAccess na = (XNameAccess) UnoRuntime.queryInterface
+ (XNameAccess.class, dbContext) ;
+
+ Object src = null ;
+ if (na.hasByName("APITestDatabase")) {
+ src = dbContext.getRegisteredObject("APITestDatabase") ;
+
+ XPropertySet srcPs = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, src) ;
+
+ existURL = (String) srcPs.getPropertyValue("URL") ;
+ }
+
+ if (src == null || !testURL.equals(existURL)) {
+ // test data source must be reregistered.
+ DataSourceInfo info = new DataSourceInfo() ;
+ info.URL = testURL ;
+ src = info.getDataSourceService() ;
+ reRegisterDB("APITestDatabase", src) ;
+ src = dbContext.getRegisteredObject("APITestDatabase") ;
+ }
+
+ return src ;
+ }
+
+ /**
+ * Connects to <code>DataSource</code> specially created for testing.
+ * This source always has name <code>'APITestDatabase'</code> and it
+ * is registered in subdirectory <code>TestDB</code> of directory
+ * <code>docPath</code> which is supposed to be a directory with test
+ * documents, but can be any other (it must have subdirectory with DBF
+ * tables). If such data source doesn't exists or exists with
+ * different URL it is recreated and reregistered. Finally connection
+ * performed.
+ * @param docPath Path to database <code>TestDB</code> directory.
+ * @return Connection to test database.
+ */
+ public XConnection connectToTestDB(String docPath)
+ throws com.sun.star.uno.Exception {
+
+ return connectToSource(registerTestDB(docPath)) ;
+ }
+
+ /**
+ * Empties the table in the specified source.
+ * @param con Connection to the DataSource where appropriate
+ * table exists.
+ * @param table The name of the table where all rows will be deleted.
+ * @return Number of rows deleted.
+ */
+
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Currently doesn't work because of bugs 85509, 85510
+
+ public int deleteAllRows(XConnection con, String table)
+ throws com.sun.star.sdbc.SQLException {
+
+ XStatement stat = con.createStatement() ;
+
+ XResultSet set = stat.executeQuery("SELECT * FROM " + table) ;
+
+ XResultSetUpdate updt = (XResultSetUpdate) UnoRuntime.queryInterface
+ (XResultSetUpdate.class, set) ;
+
+ int count = 0 ;
+ set.last() ;
+ int rowNum = set.getRow() ;
+ set.first() ;
+
+ for (int i = 0; i < rowNum; i++) {
+ updt.deleteRow() ;
+ set.next() ;
+ count ++ ;
+ }
+
+ XCloseable xClose = (XCloseable) UnoRuntime.queryInterface
+ (XCloseable.class, set) ;
+ xClose.close() ;
+
+ return count ;
+ }
+
+ /**
+ * Inserts row into test table of the specified connection.
+ * Test table has some predefined format which includes as much
+ * field types as possible. For every column type constants
+ * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc.
+ * are declared for column index fast find.
+ * @param con Connection to data source where test table exists.
+ * @param table Test table name.
+ * @param values Values to be inserted into test table. Values of
+ * this array inserted into appropriate fields depending on their
+ * types. So <code>String</code> value of the array is inserted
+ * into the field of <code>CHARACTER</code> type, etc.
+ * @param streamLength Is optional. It is used only if in values
+ * list <code>XCharacterInputStream</code> or <code>XBinaryInputStream
+ * </code> types specified. In this case the parameter specifies
+ * the length of the stream for inserting.
+ */
+ public void addRowToTestTable(XConnection con, String table, Object[] values,
+ int streamLength)
+ throws com.sun.star.sdbc.SQLException {
+
+ XStatement stat = con.createStatement() ;
+
+ XResultSet set = stat.executeQuery("SELECT * FROM " + table) ;
+
+ XResultSetUpdate updt = (XResultSetUpdate) UnoRuntime.queryInterface
+ (XResultSetUpdate.class, set) ;
+
+ XRowUpdate rowUpdt = (XRowUpdate) UnoRuntime.queryInterface
+ (XRowUpdate.class, set) ;
+
+ updt.moveToInsertRow() ;
+
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof String) {
+ rowUpdt.updateString(TST_STRING, (String) values[i]) ;
+ } else
+ if (values[i] instanceof Integer) {
+ rowUpdt.updateInt(TST_INT, ((Integer) values[i]).intValue()) ;
+ } else
+ if (values[i] instanceof Double) {
+ rowUpdt.updateDouble(TST_DOUBLE, ((Double) values[i]).doubleValue()) ;
+ } else
+ if (values[i] instanceof Date) {
+ rowUpdt.updateDate(TST_DATE, (Date) values[i]) ;
+ } else
+ if (values[i] instanceof Boolean) {
+ rowUpdt.updateBoolean(TST_BOOLEAN, ((Boolean) values[i]).booleanValue()) ;
+ } else
+ if (values[i] instanceof XTextInputStream) {
+ rowUpdt.updateCharacterStream(TST_CHARACTER_STREAM, (XInputStream) values[i],
+ streamLength) ;
+ } else
+ if (values[i] instanceof XDataInputStream) {
+ rowUpdt.updateBinaryStream(TST_BINARY_STREAM, (XInputStream) values[i],
+ streamLength) ;
+ }
+ }
+
+ updt.insertRow() ;
+
+ XCloseable xClose = (XCloseable) UnoRuntime.queryInterface
+ (XCloseable.class, set) ;
+ xClose.close() ;
+ }
+
+ /**
+ * Initializes test table specified of the connection specified.
+ * Deletes all record from table, and then inserts data from
+ * <code>TST_TABLE_VALUES</code> constant array. <p>
+ * Test table has some predefined format which includes as much
+ * field types as possible. For every column type constants
+ * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc.
+ * are declared for column index fast find.
+ * @param con Connection to data source where test table exists.
+ * @param table Test table name.
+ */
+ public void initializeTestTable(XConnection con, String table)
+ throws com.sun.star.sdbc.SQLException {
+
+ deleteAllRows(con, table) ;
+
+ for (int i = 0; i < TST_TABLE_VALUES.length; i++) {
+ addRowToTestTable(con, table, TST_TABLE_VALUES[i], TST_STREAM_LENGTHS[i]) ;
+ }
+ }
+
+ /**
+ * Prints full info about currently registered DataSource's.
+ */
+ public void printRegisteredDatabasesInfo(PrintWriter out) {
+ XEnumerationAccess dbContEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ;
+
+ XEnumeration enum = dbContEA.createEnumeration() ;
+
+ out.println("DatabaseContext registered DataSource's :") ;
+ while (enum.hasMoreElements()) {
+ try {
+ DataSourceInfo inf = new DataSourceInfo(enum.nextElement()) ;
+ inf.printInfo(out) ;
+ } catch (com.sun.star.container.NoSuchElementException e) {}
+ catch (com.sun.star.lang.WrappedTargetException e) {}
+ }
+ }
+
+ /**
+ * Convert system pathname to SOffice URL string
+ * (for example 'C:\Temp\DBDir\' -> 'file:///C|/Temp/DBDir/').
+ * Already converted string retured unchanged.
+ */
+ public static String dirToUrl(String dir) {
+ if (dir.startsWith("file:/")) return dir;
+ else return "file:///" + dir.replace(':', '|').replace('\\', '/') ;
+ }
+
+ /**
+ * Revokes datasource from global DB context.
+ * @param name DataSource name to be revoked.
+ */
+ public void revokeDB(String name) throws com.sun.star.uno.Exception
+ {
+ dbContext.revokeObject(name) ;
+ }
+
+ /**
+ * Initializes test table specified of the connection specified
+ * using JDBC driver. Drops table with the name <code>tbl_name</code>,
+ * creates new table with this name and then inserts data from
+ * <code>TST_TABLE_VALUES</code> constant array. <p>
+ * Test table has some predefined format which includes as much
+ * field types as possible. For every column type constants
+ * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc.
+ * are declared for column index fast find.
+ * @param tbl_name Test table name.
+ */
+ public void initTestTableUsingJDBC(String tbl_name, DataSourceInfo dsi)
+ throws java.sql.SQLException,
+ ClassNotFoundException {
+ //register jdbc driver
+ if ( dsi.Info[0].Name.equals("JavaDriverClass") ) {
+ Class.forName((String)dsi.Info[0].Value);
+ } else {
+ Class.forName(TST_JDBC_DRIVER);
+ }
+
+ //getting connection
+ Connection connection = null;
+
+ connection = DriverManager.getConnection(
+ dsi.URL, dsi.User, dsi.Password);
+ Statement statement = connection.createStatement();
+
+ //drop table
+ dropMySQLTable(statement, tbl_name);
+
+ //create table
+ createMySQLTable(statement, tbl_name);
+
+ //insert some content
+ insertContentMySQLTable(statement, tbl_name);
+ }
+
+ /**
+ * Inserts data from <code>TST_TABLE_VALUES</code> constant array
+ * to test table <code>tbl_name</code>.
+ * @param statement object used for executing a static SQL
+ * statement and obtaining the results produced by it.
+ * @param tbl_name Test table name.
+ */
+ protected void insertContentMySQLTable(Statement statement, String tbl_name)
+ throws java.sql.SQLException {
+
+
+ for(int i = 0; i < DBTools.TST_TABLE_VALUES.length; i++) {
+ String query = "insert into " + tbl_name + " values (";
+ int j = 0;
+ while(j < DBTools.TST_TABLE_VALUES[i].length) {
+ if (j > 0) {
+ query += ", ";
+ }
+ Object value = DBTools.TST_TABLE_VALUES[i][j];
+ if (value instanceof String ||
+ value instanceof Date) {
+ query += "'";
+ }
+ if (value instanceof Date) {
+ Date date = (Date)value;
+ query += date.Year + "-" + date.Month +
+ "-" + date.Day;
+ } else if (value instanceof Boolean) {
+ query += (((Boolean)value).booleanValue())
+ ? "1" : "0";
+ } else {
+ query += value;
+ }
+
+ if (value instanceof String ||
+ value instanceof Date) {
+ query += "'";
+ }
+ j++;
+ }
+ query += ")";
+ statement.executeUpdate(query);
+ }
+ }
+
+ /**
+ * Creates test table specified.
+ * Test table has some predefined format which includes as much
+ * field types as possible. For every column type constants
+ * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc.
+ * are declared for column index fast find.
+ * @param statement object used for executing a static SQL
+ * statement and obtaining the results produced by it.
+ * @param table Test table name.
+ */
+ protected void createMySQLTable(Statement statement, String tbl_name)
+ throws java.sql.SQLException {
+
+ final String empty_col_name = "Column";
+ int c = 0;
+ String query = "create table " + tbl_name + " (";
+ for (int i = 0; i < TST_TABLE_VALUES[0].length; i++) {
+ if (i > 0) query += ",";
+
+ switch(i + 1) {
+ case TST_BINARY_STREAM:
+ query += TST_BINARY_STREAM_F + " BLOB";
+ break;
+ case TST_BOOLEAN:
+ query += TST_BOOLEAN_F + " TINYINT";
+ break;
+ case TST_CHARACTER_STREAM:
+ query += TST_CHARACTER_STREAM_F + " TEXT";
+ break;
+ case TST_DATE:
+ query += TST_DATE_F + " DATE";
+ break;
+ case TST_DOUBLE:
+ query += TST_DOUBLE_F + " DOUBLE";
+ break;
+ case TST_INT:
+ query += TST_INT_F + " INT";
+ break;
+ case TST_STRING:
+ query += TST_STRING_F + " TEXT";
+ break;
+ default: query += empty_col_name + (c++) + " INT";
+ if (c == 1) {
+ query += " NOT NULL AUTO_INCREMENT";
+ }
+ }
+ }
+ query += ", PRIMARY KEY (" + empty_col_name + "0)";
+ query += ")";
+ statement.execute(query);
+ }
+
+ /**
+ * Drops table.
+ * @param statement object used for executing a static SQL
+ * statement and obtaining the results produced by it.
+ * @param table Test table name.
+ */
+ protected void dropMySQLTable(Statement statement, String tbl_name)
+ throws java.sql.SQLException {
+ statement.executeUpdate("drop table if exists " + tbl_name);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/DefaultDsc.java b/qadevOOo/runner/util/DefaultDsc.java
new file mode 100644
index 000000000000..b568cb12fb24
--- /dev/null
+++ b/qadevOOo/runner/util/DefaultDsc.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: DefaultDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.form.*;
+import com.sun.star.awt.*;
+/**
+ * Defaultdescriptor:
+ * This descriptor is useful for instances in default values.
+ */
+public class DefaultDsc extends InstDescr {
+
+ private String name = null;
+ String ifcName = null;
+ String service = null;
+
+ public DefaultDsc( String Interface, String kind ) {
+ service = kind;
+ ifcName = Interface;
+ initDefault();
+ }
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initDefault() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+
+ Object SrvObj = null;
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+
+ XInterface Default = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj );
+
+ return Default;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java
new file mode 100644
index 000000000000..f2d30118532c
--- /dev/null
+++ b/qadevOOo/runner/util/DesktopTools.java
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * $RCSfile: DesktopTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+
+/**
+ * contains helper methods for the Desktop
+ */
+
+public class DesktopTools {
+
+ /**
+ * Queries the XComponentLoader
+ *
+ * @param xMSF the MultiServiceFactory
+ * @return the gained XComponentLoader
+ */
+
+ public static XComponentLoader getCLoader( XMultiServiceFactory xMSF ) {
+ XDesktop oDesktop = ( XDesktop ) UnoRuntime.queryInterface(
+ XDesktop.class, createDesktop(xMSF) );
+
+ XComponentLoader oCLoader = ( XComponentLoader )
+ UnoRuntime.queryInterface( XComponentLoader.class, oDesktop );
+
+ return oCLoader;
+ } // finish getCLoader
+
+ /**
+ * Creates an Instance of the Desktop service
+ *
+ * @param xMSF the MultiServiceFactory
+ * @return the gained Object
+ */
+
+ public static Object createDesktop( XMultiServiceFactory xMSF ) {
+ Object oInterface;
+ try {
+ oInterface = xMSF.createInstance( "com.sun.star.frame.Desktop" );
+ }
+ catch( com.sun.star.uno.Exception e ) {
+ throw new IllegalArgumentException(
+ "Desktop Service not available" );
+ }
+ return oInterface;
+ } //finish createDesktop
+
+ /**
+ * Opens a new document of a given kind
+ * with arguments
+ * @param xMSF the MultiServiceFactory
+ * @return the XComponent Interface of the document
+ */
+
+ public static XComponent openNewDoc( XMultiServiceFactory xMSF, String kind,
+ PropertyValue[] Args ) {
+
+ XComponent oDoc = null ;
+ try {
+ oDoc = getCLoader(xMSF).loadComponentFromURL(
+ "private:factory/"+kind, "_blank", 0, Args );
+ }
+ catch (com.sun.star.uno.Exception e) {
+ throw new IllegalArgumentException( "Document could not be opened" );
+ }
+
+ return oDoc;
+ } //finish openNewDoc
+
+ /**
+ * loads a document of from a given url
+ * with arguments
+ * @param xMSF the MultiServiceFactory
+ * @return the XComponent Interface of the document
+ */
+
+ public static XComponent loadDoc( XMultiServiceFactory xMSF, String url,
+ PropertyValue[] Args ) {
+
+ XComponent oDoc = null ;
+ try {
+ oDoc = getCLoader(xMSF).loadComponentFromURL( url, "_blank", 0, Args );
+ }
+ catch (com.sun.star.uno.Exception e) {
+ throw new IllegalArgumentException( "Document could not be loaded" );
+ }
+
+ return oDoc;
+ } //finish openNewDoc
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java
new file mode 100644
index 000000000000..138182936aa7
--- /dev/null
+++ b/qadevOOo/runner/util/DrawTools.java
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: DrawTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.drawing.XShape;
+
+
+import util.DesktopTools;
+import util.InstCreator;
+import util.ShapeDsc;
+
+/**
+ * contains helper methods for draw documents
+ */
+
+
+public class DrawTools {
+
+ /**
+ * Opens a new draw document
+ * with arguments
+ * @param xMSF the MultiServiceFactory
+ * @return the XComponent Interface of the document
+ */
+
+ public static XComponent createDrawDoc( XMultiServiceFactory xMSF ) {
+ PropertyValue[] Args = new PropertyValue [0];
+ XComponent DrawDoc = DesktopTools.openNewDoc( xMSF, "sdraw", Args );
+ return DrawDoc;
+ } // finish createDrawDoc
+
+ /**
+ * gets the XDrawPages container of a draw document
+ *
+ * @param aDoc the draw document
+ * @return the XDrawpages container of the document
+ */
+
+ public static XDrawPages getDrawPages ( XComponent aDoc ) {
+ XDrawPages oDPn = null;
+ try {
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,aDoc);
+
+ oDPn = oDPS.getDrawPages();
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException( "Couldn't get drawpages" );
+ }
+ return oDPn;
+ } // finish getDrawPages
+
+ /**
+ * gets the specified XDrawPage of a draw document
+ *
+ * @param aDoc the draw document
+ * @param nr the index of the DrawPage
+ * @return the XDrawpage with index nr of the document
+ */
+
+ public static XDrawPage getDrawPage ( XComponent aDoc, int nr ) {
+ XDrawPage oDP = null;
+ try {
+ oDP = (XDrawPage) getDrawPages( aDoc ).getByIndex( nr );
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException( "Couldn't get drawpage" );
+ }
+ return oDP;
+ }
+
+ /**
+ * gets the XShapes container of a draw page
+ *
+ * @param oDP the draw page
+ * @return the XDrawShape container of the drawpage
+ */
+
+ public static XShapes getShapes ( XDrawPage oDP ) {
+ return (XShapes) UnoRuntime.queryInterface(XShapes.class,oDP);
+ }
+
+ /**
+ * creates a XShape
+ *
+ * @param oDoc the document
+ * @param height the height of the shape
+ * @param width the width of the shape
+ * @param x the x-position of the shape
+ * @param y the y-position of the shape
+ * @param kind the kind of the shape ('Ellipse', 'Line' or 'Rectangle')
+ * @return the created XShape
+ */
+
+ public XShape createShape( XComponent oDoc, int height, int width, int x,
+ int y, String kind ) {
+ //possible values for kind are 'Ellipse', 'Line' and 'Rectangle'
+
+ ShapeDsc sDsc = new ShapeDsc( height, width, x, y, kind );
+ InstCreator instCreate = new InstCreator( oDoc, sDsc );
+ XShape oShape = (XShape)instCreate.getInstance();
+
+ return oShape;
+ }
+
+ /**
+ * creates a XShape and adds it to the documents
+ * first drawpage
+ * @param oDoc the document
+ * @param height the height of the shape
+ * @param width the width of the shape
+ * @param x the x-position of the shape
+ * @param y the y-position of the shape
+ * @param kind the kind of the shape ('Ellipse', 'Line' or 'Rectangle')
+ * @return the created XShape
+ */
+
+ public void addShape( XComponent oDoc, int height, int width, int x,
+ int y, String kind ) {
+
+ getShapes(getDrawPage(oDoc,0)).add(createShape( oDoc, height, width, x,
+ y, kind ) );
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/FootnoteDsc.java b/qadevOOo/runner/util/FootnoteDsc.java
new file mode 100644
index 000000000000..2a27acbb0cbb
--- /dev/null
+++ b/qadevOOo/runner/util/FootnoteDsc.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: FootnoteDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextContent;
+
+/**
+ * describes a Footnote to be inserted in a container
+ */
+public class FootnoteDsc extends InstDescr {
+
+ final String service = "com.sun.star.text.Footnote";
+ String ifcName = "com.sun.star.text.XTextContent";
+ private String name = null;
+
+
+ public FootnoteDsc() {
+ initFootnote();
+ }
+
+ public FootnoteDsc( String name ) {
+ this.name = name;
+ initFootnote();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void initFootnote() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object ServiceObj = null;
+
+ try {
+ ServiceObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XTextContent FN = (XTextContent)UnoRuntime.queryInterface( ifcClass,
+ ServiceObj );
+ return FN;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java
new file mode 100644
index 000000000000..404c48703b09
--- /dev/null
+++ b/qadevOOo/runner/util/FormTools.java
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * $RCSfile: FormTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.XComponent;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.form.XFormsSupplier;
+import com.sun.star.form.XForm;
+import com.sun.star.form.XLoadable;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.beans.XPropertySet;
+
+/**
+ * contains helper methods forms
+ */
+
+public class FormTools {
+
+
+ /**
+ * creates a XControlShape
+ *
+ * @param oDoc the document
+ * @param height the height of the shape
+ * @param width the width of the shape
+ * @param x the x-position of the shape
+ * @param y the y-position of the shape
+ * @param kind the kind of the shape
+ * @return the created XControlShape
+ */
+ public static XControlShape createControlShape( XComponent oDoc, int height,
+ int width, int x, int y, String kind ) {
+
+ Size size = new Size();
+ Point position = new Point();
+ XControlShape oCShape = null;
+ XControlModel aControl = null;
+
+ //get MSF
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ XPropertySet model_props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class,aCon);
+ model_props.setPropertyValue("DefaultControl","com.sun.star.form.control."+kind);
+ aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon );
+ oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ e );
+ }
+
+ oCShape.setControl(aControl);
+
+ return oCShape;
+ } // finish createControlShape
+
+ public static XControlShape createUnoControlShape( XComponent oDoc, int height,
+ int width, int x, int y, String kind, String defControl ) {
+
+ Size size = new Size();
+ Point position = new Point();
+ XControlShape oCShape = null;
+ XControlModel aControl = null;
+
+ //get MSF
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ XPropertySet model_props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class,aCon);
+ model_props.setPropertyValue("DefaultControl","com.sun.star.awt."+defControl);
+ aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon );
+ oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
+
+
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ e );
+ }
+
+ oCShape.setControl(aControl);
+
+ return oCShape;
+ } // finish createControlShape
+
+ public static XControlShape createControlShapeWithDefaultControl( XComponent oDoc, int height,
+ int width, int x, int y, String kind ) {
+
+ Size size = new Size();
+ Point position = new Point();
+ XControlShape oCShape = null;
+ XControlModel aControl = null;
+
+ //get MSF
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+
+ aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon );
+ oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
+
+
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ e );
+ }
+
+ oCShape.setControl(aControl);
+
+ return oCShape;
+ } // finish createControlShape
+
+ public static XInterface createControl( XComponent oDoc, String kind ) {
+
+ XInterface oControl = null;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ oControl = (XInterface) oDocMSF.createInstance(
+ "com.sun.star.form.component."+kind);
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ kind + ": "+ e );
+ }
+ return oControl;
+ } // finish createControl
+
+ public static XNameContainer getForms ( XDrawPage oDP ) {
+ XFormsSupplier oFS = (XFormsSupplier) UnoRuntime.queryInterface(
+ XFormsSupplier.class,oDP);
+ return oFS.getForms();
+ } //finish getForms
+
+ public static void insertForm ( XComponent aDoc, XNameContainer Forms,
+ String aName ) {
+ try {
+ XInterface oControl = createControl(aDoc, "Form");
+ XForm oForm = (XForm) UnoRuntime.queryInterface(XForm.class, oControl);
+ Forms.insertByName(aName,oForm);
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException( "Couldn't insert Form" );
+ }
+ }
+
+ public static XControlShape insertControlShape( XComponent oDoc, int height,
+ int width, int x, int y, String kind ) {
+
+ XControlShape aShape = createControlShape(oDoc,height,width,x,y,kind);
+ XDrawPage oDP = DrawTools.getDrawPage(oDoc,0);
+ DrawTools.getShapes(oDP).add(aShape);
+ return aShape;
+ }
+
+ public static XLoadable bindForm( XTextDocument aDoc ) {
+ XLoadable formLoader = null;
+
+ try {
+ XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName("Standard");
+ XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form);
+ formProps.setPropertyValue("DataSourceName","Bibliography");
+ formProps.setPropertyValue("Command","biblio");
+ formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
+ formLoader = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form);
+ }
+ catch (Exception ex) {
+ System.out.println("Exception: "+ex);
+ ex.printStackTrace(System.out);
+ }
+
+ return formLoader;
+ }
+
+ /**
+ * Binds <code>'Standard'</code> form of <code>aDoc</code> Writer document
+ * to the <code>tableName</code> table of <code>sourceName</code>
+ * Data Source.
+ * @param aDoc Writer document where DB controls are added.
+ * @param sourceName The name of DataSource in the <code>DatabaseContext</code>.
+ * @param tableName The name of the table to which controls are bound.
+ * @return <code>com.sun.star.form.component.DatabaseForm</code> service
+ * implementation which is the bound form inside the document.
+ */
+ public static XLoadable bindForm( XTextDocument aDoc, String sourceName, String tableName )
+ throws com.sun.star.uno.Exception {
+
+ XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName("Standard");
+ XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form);
+ formProps.setPropertyValue("DataSourceName",sourceName);
+ formProps.setPropertyValue("Command",tableName);
+ formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
+
+ return (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form);
+ }
+
+ public static XLoadable bindForm( XTextDocument aDoc, String formName ) {
+ XLoadable formLoader = null;
+
+ try {
+ XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName);
+ XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form);
+ formProps.setPropertyValue("DataSourceName","Bibliography");
+ formProps.setPropertyValue("Command","biblio");
+ formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
+ formLoader = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form);
+ }
+ catch (Exception ex) {
+ System.out.println("Exception: "+ex);
+ ex.printStackTrace(System.out);
+ }
+
+ return formLoader;
+ }
+
+ /**
+ * Binds the form with the name specified of <code>aDoc</code> Writer document
+ * to the <code>tableName</code> table of <code>sourceName</code>
+ * Data Source.
+ * @param aDoc Writer document where DB controls are added.
+ * @param formName The name of the form to be bound.
+ * @param sourceName The name of DataSource in the <code>DatabaseContext</code>.
+ * @param tableName The name of the table to which controls are bound.
+ * @return <code>com.sun.star.form.component.DatabaseForm</code> service
+ * implementation which is the bound form inside the document.
+ */
+ public static XLoadable bindForm( XTextDocument aDoc, String formName, String sourceName,
+ String tableName) throws com.sun.star.uno.Exception {
+
+ XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName);
+ XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form);
+ formProps.setPropertyValue("DataSourceName",sourceName);
+ formProps.setPropertyValue("Command",tableName);
+ formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
+
+ return (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form);
+ }
+
+ public static void switchDesignOf(XMultiServiceFactory xMSF, XTextDocument aDoc) {
+ try {
+ com.sun.star.frame.XController aController = aDoc.getCurrentController();
+ com.sun.star.frame.XFrame aFrame = aController.getFrame();
+ com.sun.star.frame.XDispatchProvider aDispProv = (com.sun.star.frame.XDispatchProvider)
+ UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class,aFrame);
+ com.sun.star.util.URL aURL = new com.sun.star.util.URL();
+ aURL.Complete = ".uno:SwitchControlDesignMode";
+
+ Object instance = xMSF.createInstance("com.sun.star.util.URLTransformer");
+ com.sun.star.util.XURLTransformer atrans =
+ (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
+ com.sun.star.util.XURLTransformer.class,instance);
+ com.sun.star.util.URL[] aURLA = new com.sun.star.util.URL[1];
+ aURLA[0] = aURL;
+ atrans.parseStrict(aURLA);
+ aURL = aURLA[0];
+
+ com.sun.star.frame.XDispatch aDisp = (com.sun.star.frame.XDispatch)aDispProv.queryDispatch(aURL, "",
+ com.sun.star.frame.FrameSearchFlag.SELF |
+ com.sun.star.frame.FrameSearchFlag.CHILDREN);
+
+ com.sun.star.beans.PropertyValue[] noArgs = new com.sun.star.beans.PropertyValue[0];
+ aDisp.dispatch(aURL, noArgs);
+ } catch (Exception e) {
+ System.out.println("******* Mist");
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java
new file mode 100644
index 000000000000..8a2db913d8d6
--- /dev/null
+++ b/qadevOOo/runner/util/FrameDsc.java
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * $RCSfile: FrameDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextFrame;
+import com.sun.star.drawing.XShape;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.XPropertySet;
+/**
+ * the class FrameDsc
+ */
+public class FrameDsc extends InstDescr {
+
+ private Size size = null;
+ private int height = 2000;
+ private int width = 2000;
+ private String name = null;
+ private int autoheigth = 0;
+ private int anchorType = 0;// bound at paragraph
+
+ final String ifcName = "com.sun.star.text.XTextFrame";
+ final String service = "com.sun.star.text.TextFrame";
+
+ public FrameDsc() {
+ initFrame();
+ }
+
+ public FrameDsc( int nHeight, int nWidth ) {
+ height = nHeight;
+ width = nWidth;
+ initFrame();
+ }
+
+ public FrameDsc( String FrameName, int nHeight, int nWidth ) {
+ name = FrameName;
+ height = nHeight;
+ width = nWidth;
+ initFrame();
+ }
+ public String getName() {
+ return name;
+ }
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initFrame() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object SrvObj = null;
+
+ size = new Size();
+ size.Height = height;
+ size.Width = width;
+
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XShape shape = (XShape)UnoRuntime.queryInterface( XShape.class, SrvObj );
+ try {
+ shape.setSize(size);
+ }
+ catch( com.sun.star.beans.PropertyVetoException pvE ){
+ }
+
+ XTextFrame TF = (XTextFrame)UnoRuntime.queryInterface( ifcClass, SrvObj );
+
+ XPropertySet oPropSet = (XPropertySet)
+ UnoRuntime.queryInterface( XPropertySet.class, SrvObj );
+
+
+ try {
+ oPropSet.setPropertyValue("AnchorType", new Integer(2));
+ }
+ catch( com.sun.star.beans.UnknownPropertyException upE ){
+ }
+ catch( com.sun.star.beans.PropertyVetoException pvE ){
+ }
+ catch( com.sun.star.lang.IllegalArgumentException iaE ){
+ }
+ catch( com.sun.star.lang.WrappedTargetException wtE ){
+ }
+
+
+
+ return TF;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/InstCreator.java b/qadevOOo/runner/util/InstCreator.java
new file mode 100644
index 000000000000..8065a8b4169c
--- /dev/null
+++ b/qadevOOo/runner/util/InstCreator.java
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * $RCSfile: InstCreator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import util.XInstCreator;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.text.XTextTablesSupplier;
+import com.sun.star.text.XTextFramesSupplier;
+import com.sun.star.text.XTextSectionsSupplier;
+import com.sun.star.text.XFootnotesSupplier;
+import com.sun.star.text.XBookmarksSupplier;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XIndexAccess;
+
+
+public class InstCreator implements XInstCreator {
+ XInterface xParent;
+ XMultiServiceFactory xMSF;
+ XInterface xInstance;
+ XIndexAccess xIA;
+ InstDescr iDsc;
+
+ public InstCreator( XInterface xParent, InstDescr iDsc ) {
+ this.xParent = xParent;
+ this.iDsc = iDsc;
+
+ xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, xParent );
+
+ xInstance = createInstance();
+ xIA = createCollection();
+ }
+ public XInterface getInstance() {
+ return xInstance;
+ }
+
+ public XInterface createInstance() {
+ XInterface xIfc = null;
+ Object xObj = null;
+
+ xIfc = iDsc.createInstance( xMSF );
+
+ return xIfc;
+ }
+
+ public XIndexAccess getCollection() {
+ return xIA;
+ }
+
+ private XIndexAccess createCollection() {
+ XNameAccess oNA = null;
+
+ if ( iDsc instanceof TableDsc ) {
+ XTextTablesSupplier oTTS = (XTextTablesSupplier)
+ UnoRuntime.queryInterface(
+ XTextTablesSupplier.class, xParent );
+
+ oNA = oTTS.getTextTables();
+ }
+ if ( iDsc instanceof FrameDsc ) {
+ XTextFramesSupplier oTTS = (XTextFramesSupplier)
+ UnoRuntime.queryInterface(
+ XTextFramesSupplier.class, xParent );
+
+ oNA = oTTS.getTextFrames();
+ }
+ if ( iDsc instanceof BookmarkDsc ) {
+ XBookmarksSupplier oTTS = (XBookmarksSupplier)
+ UnoRuntime.queryInterface(
+ XBookmarksSupplier.class, xParent );
+
+ oNA = oTTS.getBookmarks();
+ }
+
+ if ( iDsc instanceof FootnoteDsc ) {
+ XFootnotesSupplier oTTS = (XFootnotesSupplier)
+ UnoRuntime.queryInterface(
+ XFootnotesSupplier.class, xParent );
+
+ return( oTTS.getFootnotes() );
+ }
+
+ if ( iDsc instanceof TextSectionDsc ) {
+ XTextSectionsSupplier oTSS = (XTextSectionsSupplier)
+ UnoRuntime.queryInterface(
+ XTextSectionsSupplier.class, xParent );
+
+ oNA = oTSS.getTextSections();
+ }
+
+ return (XIndexAccess)UnoRuntime.queryInterface(
+ XIndexAccess.class, oNA);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/InstDescr.java b/qadevOOo/runner/util/InstDescr.java
new file mode 100644
index 000000000000..db337d99edb1
--- /dev/null
+++ b/qadevOOo/runner/util/InstDescr.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: InstDescr.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+/**
+ * the class InstDescr
+ */
+abstract public class InstDescr {
+
+ protected Class ifcClass = null;
+
+ protected abstract String getIfcName();
+ protected abstract String getName();
+
+ /**
+ * the method getIfcClass
+ */
+ public Class getIfcClass() {
+ return ifcClass;
+ }
+ /**
+ * the method getService
+ */
+ protected abstract String getService();
+ protected abstract XInterface createInstance( XMultiServiceFactory docMSF );
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ParagraphDsc.java b/qadevOOo/runner/util/ParagraphDsc.java
new file mode 100644
index 000000000000..d257605d194b
--- /dev/null
+++ b/qadevOOo/runner/util/ParagraphDsc.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: ParagraphDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextContent;
+
+/**
+ * the class ParagraphDsc
+ */
+public class ParagraphDsc extends InstDescr {
+
+ final String service = "com.sun.star.text.Paragraph";
+ String ifcName = "com.sun.star.text.XTextContent";
+ private String name = null;
+
+
+ public ParagraphDsc() {
+ initParagraph();
+ }
+
+ public ParagraphDsc( String name ) {
+ this.name = name;
+ initParagraph();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void initParagraph() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object ServiceObj = null;
+
+ try {
+ ServiceObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XTextContent PG = (XTextContent)UnoRuntime.queryInterface( ifcClass,
+ ServiceObj );
+ return PG;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ReferenceMarkDsc.java b/qadevOOo/runner/util/ReferenceMarkDsc.java
new file mode 100644
index 000000000000..215e2f403c60
--- /dev/null
+++ b/qadevOOo/runner/util/ReferenceMarkDsc.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: ReferenceMarkDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextContent;
+
+/**
+ * the class ReferenceMarkDsc
+ */
+public class ReferenceMarkDsc extends InstDescr {
+
+ final String service = "com.sun.star.text.ReferenceMark";
+ String ifcName = "com.sun.star.text.XTextContent";
+ private String name = null;
+
+
+ public ReferenceMarkDsc() {
+ initReferenceMark();
+ }
+
+ public ReferenceMarkDsc( String name ) {
+ this.name = name;
+ initReferenceMark();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void initReferenceMark() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object ServiceObj = null;
+
+ try {
+ ServiceObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XTextContent RM = (XTextContent)UnoRuntime.queryInterface( ifcClass,
+ ServiceObj );
+ return RM;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/RegistryTools.java b/qadevOOo/runner/util/RegistryTools.java
new file mode 100644
index 000000000000..f4248a098a30
--- /dev/null
+++ b/qadevOOo/runner/util/RegistryTools.java
@@ -0,0 +1,405 @@
+/*************************************************************************
+ *
+ * $RCSfile: RegistryTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import java.io.PrintWriter ;
+
+import com.sun.star.registry.XRegistryKey ;
+import com.sun.star.registry.XSimpleRegistry ;
+import com.sun.star.registry.RegistryKeyType ;
+import com.sun.star.registry.RegistryValueType ;
+import com.sun.star.registry.InvalidRegistryException ;
+import com.sun.star.lang.XMultiServiceFactory ;
+import com.sun.star.uno.Exception;
+
+public class RegistryTools {
+
+ /**
+ * Creates 'com.sun.star.registry.SimpleRegistry'
+ * service.
+ * @param xMSF Multiservice factory.
+ * @return Service created.
+ */
+ public static XSimpleRegistry createRegistryService
+ (XMultiServiceFactory xMSF) throws com.sun.star.uno.Exception {
+
+ Object oInterface = xMSF.createInstance
+ ("com.sun.star.registry.SimpleRegistry");
+ return (XSimpleRegistry) UnoRuntime.queryInterface (
+ XSimpleRegistry.class, oInterface) ;
+ }
+
+ /**
+ * Opens registry file for reading/writing. If file doesn't
+ * exist a new one created.
+ * @param file Registry file name.
+ * @param xMSF Multiservice factory.
+ * @return Opened registry.
+ */
+ public static XSimpleRegistry openRegistry
+ (String file, XMultiServiceFactory xMSF)
+ throws com.sun.star.uno.Exception {
+
+ XSimpleRegistry reg = createRegistryService(xMSF) ;
+
+ reg.open(file, false, true) ;
+
+ return reg ;
+ }
+
+ /**
+ * Compares two registry keys, their names, value
+ * types and values.
+ * return <code>true</code> if key names, value types
+ * and values are equal, else returns <code>false</code>.
+ */
+ public static boolean compareKeys
+ (XRegistryKey key1, XRegistryKey key2) {
+
+ if (key1 == null || key2 == null ||
+ !key1.isValid() || !key2.isValid())
+
+ return false ;
+
+ String keyName1 = getShortKeyName(key1.getKeyName()) ;
+ String keyName2 = getShortKeyName(key2.getKeyName()) ;
+
+ if (!keyName1.equals(keyName2)) return false ;
+
+ try {
+ if (key1.getValueType() != key2.getValueType()) return false ;
+ } catch (InvalidRegistryException e) {
+ return false ;
+ }
+
+ RegistryValueType type ;
+ try {
+ type = key1.getValueType() ;
+
+ if (type.equals(RegistryValueType.ASCII)) {
+ if (!key1.getAsciiValue().equals(key2.getAsciiValue()))
+ return false ;
+ } else
+ if (type.equals(RegistryValueType.STRING)) {
+ if (!key1.getStringValue().equals(key2.getStringValue()))
+ return false ;
+ } else
+ if (type.equals(RegistryValueType.LONG)) {
+ if (key1.getLongValue() != key2.getLongValue())
+ return false ;
+ } else
+ if (type.equals(RegistryValueType.BINARY)) {
+ byte[] bin1 = key1.getBinaryValue() ;
+ byte[] bin2 = key2.getBinaryValue() ;
+ if (bin1.length != bin2.length)
+ return false ;
+ for (int i = 0; i < bin1.length; i++)
+ if (bin1[i] != bin2[i]) return false ;
+ } else
+ if (type.equals(RegistryValueType.ASCIILIST)) {
+ String[] list1 = key1.getAsciiListValue() ;
+ String[] list2 = key2.getAsciiListValue() ;
+ if (list1.length != list2.length)
+ return false ;
+ for (int i = 0; i < list1.length; i++)
+ if (!list1[i].equals(list2[i])) return false ;
+ } else
+ if (type.equals(RegistryValueType.STRINGLIST)) {
+ String[] list1 = key1.getStringListValue() ;
+ String[] list2 = key2.getStringListValue() ;
+ if (list1.length != list2.length)
+ return false ;
+ for (int i = 0; i < list1.length; i++)
+ if (!list1[i].equals(list2[i])) return false ;
+ } else
+ if (type.equals(RegistryValueType.LONGLIST)) {
+ int[] list1 = key1.getLongListValue() ;
+ int[] list2 = key2.getLongListValue() ;
+ if (list1.length != list2.length)
+ return false ;
+ for (int i = 0; i < list1.length; i++)
+ if (list1[i] != list2[i]) return false ;
+ }
+ } catch (Exception e) {
+ return false ;
+ }
+
+ return true ;
+ }
+
+ /**
+ * Gets name of the key relative to its parent.
+ * For example if full name of key is '/key1/subkey'
+ * short key name is 'subkey'
+ * @param keyName Full key name.
+ * @return Short key name.
+ */
+ public static String getShortKeyName(String keyName) {
+ if (keyName == null) return null ;
+ int idx = keyName.lastIndexOf("/") ;
+ if (idx < 0) return keyName ;
+ else return keyName.substring(idx + 1) ;
+ }
+
+ /**
+ * Compare all child keys.
+ * @param compareRoot If <code>true</code> method also
+ * compare root keys, if <code>false</code> it begins recursive
+ * comparing from children of root keys.
+ * @return <code>true</code> if keys and their sub keys are equal.
+ */
+ protected static boolean compareKeyTrees
+ (XRegistryKey tree1, XRegistryKey tree2, boolean compareRoot) {
+
+ if (compareRoot && !compareKeys(tree1, tree2)) return false ;
+
+ try {
+ String[] keyNames1 = tree1.getKeyNames() ;
+ String[] keyNames2 = tree2.getKeyNames() ;
+
+ if (keyNames1 == null && keyNames2 == null) return true ;
+
+ if (keyNames1 == null || keyNames2 == null ||
+ keyNames2.length != keyNames1.length)
+ return false ;
+
+ for (int i = 0; i < keyNames1.length; i++) {
+
+ String keyName = getShortKeyName(keyNames1[i]) ;
+ XRegistryKey key2 = tree2.openKey(keyName) ;
+
+ if (key2 == null)
+ // key with the same name doesn't exist in the second tree
+ return false ;
+
+ if (!tree1.getKeyType(keyName).equals(
+ tree2.getKeyType(keyName)))
+ return false ;
+
+ if (tree1.getKeyType(keyName).equals(
+ RegistryKeyType.LINK)) {
+
+ if (!getShortKeyName(tree1.getLinkTarget(keyName)).equals(
+ getShortKeyName(tree2.getLinkTarget(keyName))))
+
+ return false ;
+ } else {
+
+ if (compareKeyTrees(tree1.openKey(keyName),
+ tree2.openKey(keyName), true) == false) return false ;
+ }
+ }
+ } catch (InvalidRegistryException e) {
+ return false ;
+ }
+
+ return true ;
+ }
+
+ /**
+ * Compare keys specified and all their child keys.
+ * @return <code>true</code> if keys and their sub keys are equal.
+ */
+ public static boolean compareKeyTrees
+ (XRegistryKey tree1, XRegistryKey tree2) {
+
+ return compareKeyTrees(tree1, tree2, false) ;
+ }
+
+ /**
+ * Prints to a specified output about all keys and subkeys information
+ * (key name, type, value, link target, attributes) recursively.
+ * @param reg Registry for which information is needed.
+ * @param out Output stream.
+ */
+ public static void printRegistryInfo(XSimpleRegistry reg, PrintWriter out) {
+ try {
+ printRegistryInfo(reg.getRootKey(), out) ;
+ } catch (com.sun.star.registry.InvalidRegistryException e) {
+ out.println("!!! Can't open root registry key for info printing") ;
+ }
+ }
+
+ /**
+ * Prints to a specified output about all keys and subkeys information
+ * (key name, type, value, link target, attributes) recursively.
+ * @param root Key for which subkeys (and further) information is required.
+ * @param out Output stream.
+ */
+ public static void printRegistryInfo(XRegistryKey root, PrintWriter out) {
+ if (root == null) {
+ out.println("/(null)") ;
+ return ;
+ }
+
+ out.println("/") ;
+ try {
+ printTreeInfo(root, out, " ") ;
+ } catch (com.sun.star.registry.InvalidRegistryException e) {
+ out.println("Exception accessing registry :") ;
+ e.printStackTrace(out) ;
+ }
+ }
+
+ private static void printTreeInfo(XRegistryKey key,
+ PrintWriter out, String margin)
+ throws com.sun.star.registry.InvalidRegistryException {
+
+ String[] subKeys = key.getKeyNames() ;
+
+ if (subKeys == null || subKeys.length == 0) return ;
+
+ for (int i = 0; i < subKeys.length; i++) {
+ printKeyInfo(key, subKeys[i], out, margin) ;
+ XRegistryKey subKey = key.openKey
+ (getShortKeyName(subKeys[i])) ;
+ printTreeInfo(subKey, out, margin + " ") ;
+ subKey.closeKey() ;
+ }
+ }
+
+ private static void printKeyInfo(XRegistryKey parentKey,
+ String keyName, PrintWriter out, String margin)
+ throws com.sun.star.registry.InvalidRegistryException {
+
+ out.print(margin) ;
+ keyName = getShortKeyName(keyName) ;
+ XRegistryKey key = parentKey.openKey(keyName) ;
+ if (key != null)
+ out.print("/" + getShortKeyName(key.getKeyName()) + " ") ;
+ else {
+ out.println("(null)") ;
+ return ;
+ }
+
+ if (!key.isValid()) {
+ out.println("(not valid)") ;
+ return ;
+ }
+
+ if (key.isReadOnly()) {
+ out.print("(read only) ") ;
+ }
+
+ if (parentKey.getKeyType(keyName) == RegistryKeyType.LINK) {
+ out.println("(link to " + parentKey.getLinkTarget(keyName) + ")") ;
+ return ;
+ }
+
+ RegistryValueType type ;
+ try {
+ type = key.getValueType() ;
+
+ if (type.equals(RegistryValueType.ASCII)) {
+ out.println("[ASCII] = '" + key.getAsciiValue() + "'") ;
+ } else
+ if (type.equals(RegistryValueType.STRING)) {
+ out.println("[STRING] = '" + key.getStringValue() + "'") ;
+ } else
+ if (type.equals(RegistryValueType.LONG)) {
+ out.println("[LONG] = " + key.getLongValue()) ;
+ } else
+ if (type.equals(RegistryValueType.BINARY)) {
+ out.print("[BINARY] = {") ;
+ byte[] bin = key.getBinaryValue() ;
+ for (int i = 0; i < bin.length; i++)
+ out.print("" + bin[i] + ",") ;
+ out.println("}") ;
+ } else
+ if (type.equals(RegistryValueType.ASCIILIST)) {
+ out.print("[ASCIILIST] = {") ;
+ String[] list = key.getAsciiListValue() ;
+ for (int i = 0; i < list.length; i++)
+ out.print("'" + list[i] + "',") ;
+ out.println("}") ;
+ } else
+ if (type.equals(RegistryValueType.STRINGLIST)) {
+ out.print("[STRINGLIST] = {") ;
+ String[] list = key.getStringListValue() ;
+ for (int i = 0; i < list.length; i++)
+ out.print("'" + list[i] + "',") ;
+ out.println("}") ;
+ } else
+ if (type.equals(RegistryValueType.LONGLIST)) {
+ out.print("[LONGLIST] = {") ;
+ int[] list = key.getLongListValue() ;
+ for (int i = 0; i < list.length; i++)
+ out.print("" + list[i] + ",") ;
+ out.println("}") ;
+ } else {
+ out.println("") ;
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ out.println("Exception occured : ") ;
+ e.printStackTrace(out) ;
+ } finally {
+ key.closeKey() ;
+ }
+ }
+
+
+// public static void compareKeyTrees
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java
new file mode 100644
index 000000000000..73e8c455e65f
--- /dev/null
+++ b/qadevOOo/runner/util/SOfficeFactory.java
@@ -0,0 +1,577 @@
+/*************************************************************************
+ *
+ * $RCSfile: SOfficeFactory.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.util.Hashtable;
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+
+import com.sun.star.uno.UnoRuntime;
+// staroffice interfaces to provide desktop and componentloader
+// and components i.e. spreadsheets, writerdocs etc.
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+
+// name - value pair
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyState;
+
+// additional classes required for testcase
+import com.sun.star.sheet.*;
+import com.sun.star.text.*;
+import com.sun.star.container.*;
+import com.sun.star.chart.*;
+import com.sun.star.drawing.*;
+import com.sun.star.awt.*;
+
+public class SOfficeFactory {
+
+ private static Hashtable lookup = new Hashtable(10);
+ protected XComponentLoader oCLoader;
+
+ private SOfficeFactory( XMultiServiceFactory xMSF ) {
+ // get XInterface of Desktop service
+ Object oInterface;
+ try {
+ oInterface = xMSF.createInstance( "com.sun.star.frame.Desktop" );
+ }
+ catch( com.sun.star.uno.Exception e ) {
+ throw new IllegalArgumentException(
+ "Desktop Service not available" );
+ }
+
+ // query the desktop interface and then it's componentloader
+ XDesktop oDesktop = ( XDesktop ) UnoRuntime.queryInterface(
+ XDesktop.class, oInterface );
+
+ oCLoader = ( XComponentLoader ) UnoRuntime.queryInterface(
+ XComponentLoader.class, oDesktop );
+ }
+
+ public static SOfficeFactory getFactory( XMultiServiceFactory xMSF ) {
+
+ SOfficeFactory soFactory = (SOfficeFactory)lookup.get( xMSF );
+
+ if ( soFactory == null ) {
+ soFactory = new SOfficeFactory( xMSF );
+ lookup.put( xMSF, soFactory );
+ }
+
+ return soFactory;
+ }
+
+ // *********************************************************
+ // Document creation. The documents needed are created here.
+ // *********************************************************
+
+ /**
+ * method which opens a new TextDocument
+ *
+ * @see XTextDocument
+ */
+
+ public XTextDocument createTextDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ XComponent oDoc = openDoc("swriter",frameName);
+
+ if ( oDoc != null) {
+ return (XTextDocument)
+ UnoRuntime.queryInterface( XTextDocument.class, oDoc );
+ }
+ else {
+ return null;
+ }
+ } // finished createTextDoc
+
+ /**
+ * method which opens a new SpreadsheetDocument
+ *
+ * @see XSpreadsheetDocument
+ */
+
+ public XSpreadsheetDocument createCalcDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ XComponent oDoc = openDoc("scalc",frameName);
+
+ if ( oDoc != null) {
+ return (XSpreadsheetDocument)
+ UnoRuntime.queryInterface( XSpreadsheetDocument.class, oDoc );
+ }
+ else {
+ return null;
+ }
+ } // finished createCalcDoc
+
+ /**
+ * method which opens a new DrawDocument
+ */
+
+ public XComponent createDrawDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ return openDoc("sdraw",frameName);
+ } // finished createDrawDoc
+
+ /**
+ * method which opens a new ImpressDocument
+ */
+
+ public XComponent createImpressDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ return openDoc("simpress",frameName);
+ } // finished createImpressDoc
+
+
+ /**
+ * method which opens a new MathDocument
+ */
+
+ public XComponent createMathDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ return openDoc("smath",frameName);
+ } // finished createMathDoc
+
+ /**
+ * method which opens a new ChartDocument
+ *
+ * @see XChartDocument
+ */
+
+ public XChartDocument createChartDoc( String frameName )
+ throws com.sun.star.uno.Exception {
+
+ XComponent oDoc = openDoc("schart",frameName);
+
+ if ( oDoc != null) {
+ return (XChartDocument)
+ UnoRuntime.queryInterface( XChartDocument.class, oDoc );
+ }
+ else {
+ return null;
+ }
+ } // finished createChartDoc
+
+
+ /**
+ * creates a simple TextTable defaultet to 2 rows and 2 columns
+ */
+ public static XTextTable createTextTable( XTextDocument xTextDoc )
+ throws com.sun.star.uno.Exception {
+
+ TableDsc tDsc = new TableDsc();
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextTable oTable = (XTextTable)instCreate.getInstance();
+ return oTable;
+ }
+ /**
+ * creates a TextTable with a specified count of rows and columns
+ */
+ public static XTextTable createTextTable( XTextDocument xTextDoc,
+ int rows, int columns )
+ throws com.sun.star.uno.Exception {
+
+ TableDsc tDsc = new TableDsc( rows, columns );
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextTable oTable = (XTextTable)instCreate.getInstance();
+ return oTable;
+ }
+ /**
+ * creates a simple TextFrame
+ * ... to be continued
+ */
+ public static XTextFrame createTextFrame( XTextDocument xTextDoc )
+ throws com.sun.star.uno.Exception {
+
+ FrameDsc tDsc = new FrameDsc();
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextFrame oFrame = (XTextFrame)instCreate.getInstance();
+ return oFrame;
+ }
+ /**
+ * creates a simple TextFrame
+ * ... to be continued
+ */
+ public static XTextFrame createTextFrame( XTextDocument xTextDoc,
+ int height, int width )
+ {
+
+ FrameDsc tDsc = new FrameDsc(height, width);
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextFrame oFrame = (XTextFrame)instCreate.getInstance();
+ return oFrame;
+ }
+
+ public static void insertString( XTextDocument xTextDoc, String cString )
+ throws com.sun.star.uno.Exception {
+ XText xText = xTextDoc.getText();
+ XText oText = (XText)UnoRuntime.queryInterface(
+ XText.class, xText);
+
+ XTextCursor oCursor = oText.createTextCursor();
+ oText.insertString(oCursor, cString, false);
+ }
+
+ public static void insertTextContent( XTextDocument xTextDoc,
+ XTextContent xCont )
+ throws com.sun.star.lang.IllegalArgumentException {
+ XText xText = xTextDoc.getText();
+ XText oText = (XText)UnoRuntime.queryInterface(
+ XText.class, xText);
+
+ XTextCursor oCursor = oText.createTextCursor();
+ oText.insertTextContent(oCursor, xCont, false);
+ }
+
+ public static com.sun.star.table.XCell getFirstTableCell(
+ XTextContent oTable ) {
+
+ String CellNames[] = ((XTextTable)oTable).getCellNames();
+
+ com.sun.star.table.XCell oCell = ((XTextTable)oTable).getCellByName(
+ CellNames[0]);
+ return oCell;
+
+ }
+
+ /**
+ * the method createBookmark
+ */
+ public static XTextContent createBookmark( XTextDocument xTextDoc )
+ throws com.sun.star.uno.Exception {
+
+ BookmarkDsc tDsc = new BookmarkDsc();
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextContent oBookmark = (XTextContent)instCreate.getInstance();
+ return oBookmark;
+
+ } /// finish createBookmark
+
+ /**
+ * the method createReferenceMark
+ */
+ public static XTextContent createReferenceMark( XTextDocument xTextDoc )
+ throws com.sun.star.uno.Exception {
+
+ ReferenceMarkDsc tDsc = new ReferenceMarkDsc();
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextContent oReferenceMark = (XTextContent)instCreate.getInstance();
+ return oReferenceMark;
+
+ } /// finish createReferenceMark
+
+ /**
+ * the method createFootnote
+ */
+ public static XTextContent createFootnote( XTextDocument xTextDoc )
+ throws com.sun.star.uno.Exception {
+
+ FootnoteDsc tDsc = new FootnoteDsc();
+ InstCreator instCreate = new InstCreator( xTextDoc, tDsc );
+
+ XTextContent oFootnote = (XTextContent)instCreate.getInstance();
+ return oFootnote;
+
+ } /// finish createFootnote
+
+ /**
+ * the method create Index
+ */
+
+ public static XTextContent createIndex( XTextDocument xTextDoc, String kind)
+ throws com.sun.star.uno.Exception {
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDoc );
+
+ Object oInt = oDocMSF.createInstance( kind );
+
+ XTextContent xTC = (XTextContent)
+ UnoRuntime.queryInterface(XDocumentIndex.class,oInt);
+
+ return xTC;
+
+ }
+
+ public static XSpreadsheet createSpreadsheet( XSpreadsheetDocument oDoc )
+ throws com.sun.star.uno.Exception {
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ Object oInt = oDocMSF.createInstance(
+ "com.sun.star.sheet.Spreadsheet" );
+
+ XSpreadsheet oSpreadsheet = (XSpreadsheet)
+ UnoRuntime.queryInterface( XSpreadsheet.class, oInt );
+
+ return oSpreadsheet;
+ }
+
+ public static XIndexAccess getTableCollection( XTextDocument oDoc ){
+
+ XTextTablesSupplier oTTS = (XTextTablesSupplier)
+ UnoRuntime.queryInterface( XTextTablesSupplier.class, oDoc );
+
+ XNameAccess oNA = oTTS.getTextTables();
+ XIndexAccess oIA = (XIndexAccess)
+ UnoRuntime.queryInterface( XIndexAccess.class, oNA );
+
+ return oIA;
+ }
+
+ public static String getUniqueName( XInterface oInterface, String prefix ) {
+ XNameAccess oNameAccess = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, oInterface );
+ if (oNameAccess == null)
+ return null;
+ int i;
+ for (i = 0; oNameAccess.hasByName( prefix + i ); i++ ) {};
+ return prefix + i;
+ }
+
+ public XShape createShape(XComponent oDoc, int height, int width, int x, int y, String kind) {
+ //possible values for kind are 'Ellipse', 'Line' and 'Rectangle'
+
+ ShapeDsc sDsc = new ShapeDsc( height, width, x, y, kind );
+ InstCreator instCreate = new InstCreator( oDoc, sDsc );
+
+ XShape oShape = (XShape)instCreate.getInstance();
+
+ return oShape;
+
+ }
+
+ /**
+ * creates a Diagram wich specified in kind(String)
+ */
+ public XDiagram createDiagram(XComponent oDoc, String kind) {
+ XInterface oInterface = null;
+ XDiagram oDiagram = null;
+
+ //get LineDiagram
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ oInterface = (XInterface) oDocMSF.createInstance("com.sun.star.chart."+kind);
+ oDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, oInterface);
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create "+kind+"-Diagram "+ e );
+ }
+ return oDiagram;
+ }
+
+ /*
+ // create a Control-Instance which specified in kind(String)
+ */
+ public XInterface createControl(XComponent oDoc, String kind) {
+
+ XInterface oControl = null;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ oControl = (XInterface) oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ kind + ": "+ e );
+ }
+ return oControl;
+ }
+
+ /*
+ // create an Instance which is specified in kind(String)
+ */
+ public Object createInstance(XComponent oDoc, String kind) {
+
+ Object oInstance = null;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ oInstance = (Object) oDocMSF.createInstance(kind);
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ kind + ": "+ e );
+ }
+ return oInstance;
+ }
+
+
+ public XControlShape createControlShape(XComponent oDoc, int height, int width, int x, int y, String kind) {
+
+ Size size = new Size();
+ Point position = new Point();
+ XControlShape oCShape = null;
+ XControlModel aControl = null;
+
+ //get MSF
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ try{
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon );
+ oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
+
+
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't create instance "+ e );
+ }
+
+ try{
+ oCShape.setControl(aControl);
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ System.out.println( "Couldn't get Control "+ e );
+ }
+
+
+ return oCShape;
+
+ }
+
+ public XComponent loadDocument( String fileName )
+ throws com.sun.star.lang.IllegalArgumentException,
+ com.sun.star.io.IOException,
+ com.sun.star.uno.Exception {
+
+ // that noargs thing for load attributes
+ PropertyValue [] szEmptyArgs = new PropertyValue [0];
+ String frameName = "_blank";
+
+ XComponent oDoc = oCLoader.loadComponentFromURL(
+ fileName, frameName, 0, szEmptyArgs );
+
+ if ( oDoc == null ) {
+ return null;
+ }
+
+ return oDoc;
+ }
+
+ public XComponent openDoc(String kind, String frameName)
+ throws com.sun.star.lang.IllegalArgumentException,
+ com.sun.star.io.IOException,
+ com.sun.star.uno.Exception {
+
+ // that noargs thing for load attributes
+ PropertyValue [] Args = null;
+ if (kind.equals("simpress")) {
+ Args = new PropertyValue [1];
+ PropertyValue Arg = new PropertyValue();
+ Arg.Name = "OpenFlags";
+ Arg.Value = "S";
+ Arg.Handle = -1;
+ Arg.State = PropertyState.DEFAULT_VALUE;
+ Args[0]=Arg;
+ }
+ else {
+ Args = new PropertyValue [0];
+ }
+
+ if ( frameName == null ) {
+ frameName = "_blank";
+ }
+ // load a blank a doc
+ XComponent oDoc = oCLoader.loadComponentFromURL(
+ "private:factory/"+kind, frameName, 0, Args );
+
+ return oDoc;
+
+ } // finished openDoc
+
+ // query for XServiceInfo
+ public Object queryXServiceInfo( Object oObj )
+ {
+ if ( oObj != null ) {
+ XServiceInfo oInfo = (XServiceInfo) UnoRuntime.queryInterface(
+ XServiceInfo.class, oObj);
+ System.out.println ("!!!! XServiceInfo n.a. !!!! ");
+ }
+ else {
+ System.out.println ("Object is empty!!!! ");
+ }
+ return null;
+ } // finish queryXServiceInfo
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ShapeDsc.java b/qadevOOo/runner/util/ShapeDsc.java
new file mode 100644
index 000000000000..a16f309c96fc
--- /dev/null
+++ b/qadevOOo/runner/util/ShapeDsc.java
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * $RCSfile: ShapeDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.drawing.*;
+import com.sun.star.awt.*;
+/**
+ * the class TableDsc
+ */
+public class ShapeDsc extends InstDescr {
+
+ private int x = 0;
+ private int y = 0;
+ private int height = 0;
+ private int width = 0;
+ private String name = null;
+ final String ifcName = "com.sun.star.drawing.XShape";
+ String service = "com.sun.star.drawing.RectangleShape";
+
+ public ShapeDsc( int nheight, int nwidth, int nx, int ny, String kind ) {
+ x=nx;
+ y=ny;
+ height=nheight;
+ width=nwidth;
+ service="com.sun.star.drawing."+kind+"Shape";
+ initShape();
+ }
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initShape() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+
+
+ Object SrvObj = null;
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+
+ XShape Sh = (XShape)UnoRuntime.queryInterface(ifcClass, SrvObj );
+ Size size = new Size();
+ Point position = new Point();
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ try {
+ Sh.setSize(size);
+ Sh.setPosition(position);
+ }
+ catch ( com.sun.star.beans.PropertyVetoException e) {
+ }
+
+ return Sh;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/StyleFamilyDsc.java b/qadevOOo/runner/util/StyleFamilyDsc.java
new file mode 100644
index 000000000000..f68c8835f8d0
--- /dev/null
+++ b/qadevOOo/runner/util/StyleFamilyDsc.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: StyleFamilyDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.style.*;
+import com.sun.star.awt.*;
+/**
+ * the class StyleFamilyDsc
+ */
+public class StyleFamilyDsc extends InstDescr {
+
+ private String name = null;
+ final String ifcName = "com.sun.star.style.XStyle";
+ String service = "com.sun.star.style.CharacterStyle";
+
+ public StyleFamilyDsc( String kind ) {
+ service = "com.sun.star.style." + kind;
+ initStyleFamily();
+ }
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initStyleFamily() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+
+
+ Object SrvObj = null;
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+
+ XInterface StyleFamily = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj );
+
+ return StyleFamily;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java
new file mode 100644
index 000000000000..4ac1719812af
--- /dev/null
+++ b/qadevOOo/runner/util/SysUtils.java
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * $RCSfile: SysUtils.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Date: 2003-01-27 16:26:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.io.InputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.io.PrintWriter;
+import java.io.LineNumberReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.datatransfer.clipboard.*;
+import com.sun.star.datatransfer.*;
+
+public class SysUtils {
+
+ public static String getJavaPath() {
+ String cp = (String) System.getProperty("java.class.path");
+ String jh = (String) System.getProperty("java.home");
+ String fs = (String) System.getProperty("file.separator");
+ jh = jh + fs + "bin" + fs;
+ jh = jh + "java -classpath "+cp;
+ return jh;
+ }
+
+ static ArrayList files = new ArrayList();
+
+ public static Object[] traverse( String afileDirectory ) {
+
+ File fileDirectory = new File(afileDirectory);
+ // Testing, if the file is a directory, and if so, it throws an exception
+ if ( !fileDirectory.isDirectory() ) {
+ throw new IllegalArgumentException(
+ "not a directory: " + fileDirectory.getName()
+ );
+ }
+
+ // Getting all files and directories in the current directory
+ File[] entries = fileDirectory.listFiles(
+ new FileFilter() {
+ public boolean accept( File pathname ) {
+ return true;
+ }
+ }
+ );
+
+ // Iterating for each file and directory
+ for ( int i = 0; i < entries.length; ++i ) {
+ // Testing, if the entry in the list is a directory
+ if ( entries[ i ].isDirectory() ) {
+ // Recursive call for the new directory
+ traverse( entries[ i ].getAbsolutePath() );
+ } else {
+ // adding file to List
+ try {
+ // Composing the URL by replacing all backslashs
+ String stringUrl = "file:///"
+ + entries[ i ].getAbsolutePath().replace( '\\', '/' );
+ files.add(stringUrl);
+ }
+ catch( Exception exception ) {
+ exception.printStackTrace();
+ }
+
+ }
+ }
+ return files.toArray();
+ }
+
+ public static XComponent getActiveComponent(XMultiServiceFactory msf) {
+ XComponent ac = null;
+ try {
+ Object desk = msf.createInstance("com.sun.star.frame.Desktop");
+ XDesktop xDesk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,desk);
+ ac = xDesk.getCurrentComponent();
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't get active Component");
+ }
+ return ac;
+ }
+
+ public static XFrame getActiveFrame(XMultiServiceFactory msf) {
+ try {
+ Object desk = msf.createInstance("com.sun.star.frame.Desktop");
+ XDesktop xDesk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,desk);
+ return xDesk.getCurrentFrame();
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't get active Component");
+ }
+
+ return null;
+ }
+
+ /**
+ * Tries to obtain text data from cliboard if such one exists.
+ * The method iterates through all 'text/plain' supported data
+ * flavors and returns the first non-null String value.
+ *
+ * @param msf MultiserviceFactory
+ * @return First found string clipboard contents or null if no
+ * text contents were found.
+ * @throws com.sun.star.uno.Exception if system clipboard is not accessible.
+ */
+ public static String getSysClipboardText(XMultiServiceFactory msf)
+ throws com.sun.star.uno.Exception {
+
+ XClipboard xCB = (XClipboard) UnoRuntime.queryInterface
+ (XClipboard.class, msf.createInstance
+ ("com.sun.star.datatransfer.clipboard.SystemClipboard"));
+
+ XTransferable xTrans = xCB.getContents();
+
+ DataFlavor[] dfs = xTrans.getTransferDataFlavors();
+
+ for (int i = 0; i < dfs.length; i++) {
+ if (dfs[i].MimeType.startsWith("text/plain")) {
+ Object data = xTrans.getTransferData(dfs[i]);
+ if (data != null && data instanceof String) {
+ return (String) data;
+ }
+ }
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/TableDsc.java b/qadevOOo/runner/util/TableDsc.java
new file mode 100644
index 000000000000..00e7d1853077
--- /dev/null
+++ b/qadevOOo/runner/util/TableDsc.java
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextTable;
+/**
+ * the class TableDsc
+ */
+public class TableDsc extends InstDescr {
+
+ private int rows = 0;
+ private int columns = 0;
+ private String name = null;
+ final String ifcName = "com.sun.star.text.XTextTable";
+ final String service = "com.sun.star.text.TextTable";
+
+ public TableDsc() {
+ initTable();
+ }
+
+ public TableDsc( int nRows, int nColumns ) {
+ rows = nRows;
+ columns = nColumns;
+ initTable();
+ }
+
+ public TableDsc( String TableName, int nRows, int nColumns ) {
+ name = TableName;
+ rows = nRows;
+ columns = nColumns;
+ initTable();
+ }
+ public String getName() {
+ return name;
+ }
+ public String getIfcName() {
+ return ifcName;
+ }
+ public String getService() {
+ return service;
+ }
+
+ private void initTable() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object SrvObj = null;
+ try {
+ SrvObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+
+ XTextTable TT = (XTextTable)UnoRuntime.queryInterface(
+ ifcClass, SrvObj );
+
+ if ( rows > 0 && columns > 0 ) {
+ TT.initialize( rows, columns );
+ }
+
+ return TT;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/TextSectionDsc.java b/qadevOOo/runner/util/TextSectionDsc.java
new file mode 100644
index 000000000000..13370b7e3193
--- /dev/null
+++ b/qadevOOo/runner/util/TextSectionDsc.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextSectionDsc.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextContent;
+
+/**
+ * the class TextSectionDsc
+ */
+public class TextSectionDsc extends InstDescr {
+
+ final String service = "com.sun.star.text.TextSection";
+ String ifcName = "com.sun.star.text.XTextContent";
+ private String name = null;
+
+
+ public TextSectionDsc() {
+ initTextSection();
+ }
+
+ public TextSectionDsc( String name ) {
+ this.name = name;
+ initTextSection();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIfcName() {
+ return ifcName;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void initTextSection() {
+ try {
+ ifcClass = Class.forName( ifcName );
+ }
+ catch( ClassNotFoundException cnfE ) {
+ }
+ }
+ public XInterface createInstance( XMultiServiceFactory docMSF ) {
+ Object ServiceObj = null;
+
+ try {
+ ServiceObj = docMSF.createInstance( service );
+ }
+ catch( com.sun.star.uno.Exception cssuE ){
+ }
+ XTextContent PG = (XTextContent)UnoRuntime.queryInterface( ifcClass,
+ ServiceObj );
+ return PG;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
new file mode 100644
index 000000000000..f522da0aec4c
--- /dev/null
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -0,0 +1,1007 @@
+/*************************************************************************
+ *
+ * $RCSfile: ValueChanger.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.awt.Size;
+import com.sun.star.awt.Point;
+import com.sun.star.drawing.PolygonFlags;
+//import util.BitmapLoader;
+import com.sun.star.uno.Enum ;
+import java.lang.reflect.Field ;
+import java.lang.reflect.Method ;
+import java.lang.reflect.Modifier ;
+import java.lang.reflect.Array ;
+
+public class ValueChanger {
+
+
+ // Method to change a Value, thought for properties
+ public static Object changePValue( Object oldValue ) {
+
+ Object newValue = null;
+
+ if (oldValue == null)
+ return null;
+
+ if (oldValue instanceof Boolean) {
+ boolean oldbool = ((Boolean) oldValue).booleanValue();
+ newValue = new Boolean(!oldbool);
+ } else
+
+ if (oldValue instanceof Integer) {
+ int oldint = ((Integer) oldValue).intValue();
+ newValue = new Integer(oldint+5);
+ } else
+
+ if (oldValue instanceof Long) {
+ long oldlong = ((Long) oldValue).longValue();
+ newValue = new Long(oldlong + 15);
+ } else
+
+ if (oldValue instanceof Short) {
+ short oldshort = ((Short) oldValue).shortValue();
+ newValue = new Short((short) (oldshort + 1));
+ } else
+
+ if (oldValue instanceof Byte) {
+ byte oldbyte = ((Byte) oldValue).byteValue();
+ newValue = new Byte((byte) (oldbyte + 1));
+ } else
+
+ if (oldValue instanceof Float) {
+ float oldfloat = ((Float) oldValue).floatValue();
+ newValue = new Float((float) (oldfloat + 16.7));
+ } else
+
+ if (oldValue instanceof Double) {
+ double olddouble = ((Double) oldValue).doubleValue();
+ newValue = new Double(olddouble + 17.8);
+ } else
+
+ if (oldValue instanceof String) {
+ String oldString = (String) oldValue;
+ newValue = oldString + "New";
+ } else
+
+
+ if (oldValue instanceof com.sun.star.chart.ChartAxisArrangeOrderType) {
+ Object AO1 = com.sun.star.chart.ChartAxisArrangeOrderType.AUTO;
+ Object AO2= com.sun.star.chart.ChartAxisArrangeOrderType.SIDE_BY_SIDE;
+ Object AO3= com.sun.star.chart.ChartAxisArrangeOrderType.STAGGER_EVEN;
+ Object AO4= com.sun.star.chart.ChartAxisArrangeOrderType.STAGGER_ODD;
+
+ if (oldValue.equals(AO1)) newValue = AO2;
+ if (oldValue.equals(AO2)) newValue = AO3;
+ if (oldValue.equals(AO3)) newValue = AO4;
+ if (oldValue.equals(AO4)) newValue = AO1;
+ } else
+
+ if (oldValue instanceof com.sun.star.view.PaperOrientation) {
+ Object OR1 = com.sun.star.view.PaperOrientation.LANDSCAPE;
+ Object OR2 = com.sun.star.view.PaperOrientation.PORTRAIT;
+
+ if (oldValue.equals(OR1)) newValue = OR2;
+ else newValue = OR1;
+ } else
+
+ if (oldValue instanceof com.sun.star.lang.Locale) {
+ Object Loc1 = new com.sun.star.lang.Locale("en","US","");
+ Object Loc2 = new com.sun.star.lang.Locale("de","DE","");
+
+ if (oldValue.equals(Loc1)) newValue = Loc2;
+ else newValue = Loc1;
+ } else
+
+ if (oldValue instanceof com.sun.star.style.ParagraphAdjust) {
+ Object PA1 = com.sun.star.style.ParagraphAdjust.LEFT;
+ Object PA2 = com.sun.star.style.ParagraphAdjust.CENTER;
+
+ if (oldValue.equals(PA1)) newValue = PA2;
+ else newValue = PA1;
+ } else
+
+ if (oldValue instanceof com.sun.star.style.LineSpacing) {
+ com.sun.star.style.LineSpacing LS = new com.sun.star.style.LineSpacing();
+ com.sun.star.style.LineSpacing LSold = (com.sun.star.style.LineSpacing) oldValue;
+ LS.Height = (short) ((LSold.Height)+1);
+ LS.Mode = (short) ((LSold.Mode)+1);
+ newValue = LS;
+ } else
+
+ if (oldValue instanceof com.sun.star.drawing.Direction3D) {
+ com.sun.star.drawing.Direction3D D3D = new com.sun.star.drawing.Direction3D();
+ com.sun.star.drawing.Direction3D D3Dold = (com.sun.star.drawing.Direction3D) oldValue;
+ D3D.DirectionX = D3Dold.DirectionX + .5;
+ D3D.DirectionY = D3Dold.DirectionY + .5;
+ D3D.DirectionZ = D3Dold.DirectionZ + .5;
+ newValue = D3D;
+ } else
+
+ if (oldValue instanceof com.sun.star.style.GraphicLocation) {
+ Object GL1 = com.sun.star.style.GraphicLocation.AREA;
+ Object GL2 = com.sun.star.style.GraphicLocation.LEFT_BOTTOM;
+
+ if (oldValue.equals(GL1)) newValue = GL2;
+ else newValue = GL1;
+ } else
+
+ if (oldValue instanceof com.sun.star.style.TabStop) {
+ com.sun.star.style.TabStop TS = new com.sun.star.style.TabStop();
+ com.sun.star.style.TabStop TSold = (com.sun.star.style.TabStop) oldValue;
+ com.sun.star.style.TabAlign TA1 = com.sun.star.style.TabAlign.CENTER;
+ com.sun.star.style.TabAlign TA2 = com.sun.star.style.TabAlign.RIGHT;
+
+ if ((TSold.Alignment).equals(TA1)) TS.Alignment = TA2;
+ else TS.Alignment = TA1;
+
+ TS.Position = ((TSold.Position)+1);
+
+ newValue = TS;
+ } else
+
+ if (oldValue instanceof com.sun.star.style.DropCapFormat) {
+ com.sun.star.style.DropCapFormat DCF = new com.sun.star.style.DropCapFormat();
+ com.sun.star.style.DropCapFormat DCFold = (com.sun.star.style.DropCapFormat) oldValue;
+ DCF.Count = (byte) ((DCFold.Count)+1);
+ DCF.Distance = (short) ((DCFold.Distance)+1);
+ DCF.Lines = (byte) ((DCFold.Lines)+1);
+ newValue = DCF;
+ } else
+
+ if (oldValue instanceof com.sun.star.text.TextContentAnchorType) {
+ com.sun.star.text.TextContentAnchorType TCAT1 = com.sun.star.text.TextContentAnchorType.AS_CHARACTER;
+ com.sun.star.text.TextContentAnchorType TCAT2 = com.sun.star.text.TextContentAnchorType.AT_CHARACTER;
+ com.sun.star.text.TextContentAnchorType TCAT3 = com.sun.star.text.TextContentAnchorType.AT_FRAME;
+ com.sun.star.text.TextContentAnchorType TCAT4 = com.sun.star.text.TextContentAnchorType.AT_PAGE;
+ com.sun.star.text.TextContentAnchorType TCAT5 = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH;
+ if (oldValue.equals(TCAT1)) newValue = TCAT2;
+ if (oldValue.equals(TCAT2)) newValue = TCAT3;
+ if (oldValue.equals(TCAT3)) newValue = TCAT4;
+ if (oldValue.equals(TCAT4)) newValue = TCAT5;
+ if (oldValue.equals(TCAT5)) newValue = TCAT1;
+ } else
+
+ if (oldValue instanceof com.sun.star.text.WrapTextMode) {
+ com.sun.star.text.WrapTextMode WTM1 = com.sun.star.text.WrapTextMode.DYNAMIC;
+ com.sun.star.text.WrapTextMode WTM2 = com.sun.star.text.WrapTextMode.LEFT;
+ com.sun.star.text.WrapTextMode WTM3 = com.sun.star.text.WrapTextMode.NONE;
+ com.sun.star.text.WrapTextMode WTM4 = com.sun.star.text.WrapTextMode.PARALLEL;
+ com.sun.star.text.WrapTextMode WTM5 = com.sun.star.text.WrapTextMode.RIGHT;
+ com.sun.star.text.WrapTextMode WTM6 = com.sun.star.text.WrapTextMode.THROUGHT;
+ if (oldValue.equals(WTM1)) newValue = WTM2;
+ if (oldValue.equals(WTM2)) newValue = WTM3;
+ if (oldValue.equals(WTM3)) newValue = WTM4;
+ if (oldValue.equals(WTM4)) newValue = WTM5;
+ if (oldValue.equals(WTM5)) newValue = WTM6;
+ if (oldValue.equals(WTM6)) newValue = WTM1;
+ } else
+
+ if (oldValue instanceof com.sun.star.awt.Size) {
+ com.sun.star.awt.Size oldSize = (com.sun.star.awt.Size) oldValue;
+ com.sun.star.awt.Size newSize = new com.sun.star.awt.Size();
+ newSize.Height = oldSize.Height +1;
+ newSize.Width = oldSize.Width +1;
+ newValue = newSize;
+ } else
+
+ if (oldValue instanceof com.sun.star.awt.Rectangle) {
+ com.sun.star.awt.Rectangle oldRectangle = (com.sun.star.awt.Rectangle) oldValue;
+ com.sun.star.awt.Rectangle newRectangle = new com.sun.star.awt.Rectangle();
+ newRectangle.Height =oldRectangle.Height +1;
+ newRectangle.Width = oldRectangle.Width +1;
+ newRectangle.X =oldRectangle.Y +1;
+ newRectangle.Y = oldRectangle.X +1;
+ newValue = newRectangle;
+ } else
+
+ if (oldValue instanceof com.sun.star.awt.Point) {
+ com.sun.star.awt.Point oldPoint = (com.sun.star.awt.Point) oldValue;
+ com.sun.star.awt.Point newPoint = new com.sun.star.awt.Point();
+ newPoint.X = oldPoint.X +1;
+ newPoint.Y = oldPoint.Y +1;
+ newValue = newPoint;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.ShadowFormat) {
+ com.sun.star.table.ShadowFormat SF = new com.sun.star.table.ShadowFormat();
+ com.sun.star.table.ShadowFormat SFold = (com.sun.star.table.ShadowFormat) oldValue;
+ SF.IsTransparent = (! SFold.IsTransparent);
+ SF.ShadowWidth = (short) ((SFold.ShadowWidth)+1);
+ newValue = SF;
+ } else
+
+ if (oldValue instanceof com.sun.star.awt.FontSlant) {
+ com.sun.star.awt.FontSlant FS1 = com.sun.star.awt.FontSlant.DONTKNOW;
+ com.sun.star.awt.FontSlant FS2 = com.sun.star.awt.FontSlant.ITALIC;
+ com.sun.star.awt.FontSlant FS3 = com.sun.star.awt.FontSlant.NONE;
+ com.sun.star.awt.FontSlant FS4 = com.sun.star.awt.FontSlant.OBLIQUE;
+ com.sun.star.awt.FontSlant FS5 = com.sun.star.awt.FontSlant.REVERSE_ITALIC;
+ com.sun.star.awt.FontSlant FS6 = com.sun.star.awt.FontSlant.REVERSE_OBLIQUE;
+ if (oldValue.equals(FS1)) newValue = FS2;
+ if (oldValue.equals(FS2)) newValue = FS3;
+ if (oldValue.equals(FS3)) newValue = FS4;
+ if (oldValue.equals(FS4)) newValue = FS5;
+ if (oldValue.equals(FS5)) newValue = FS6;
+ if (oldValue.equals(FS6)) newValue = FS1;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.CellHoriJustify) {
+ com.sun.star.table.CellHoriJustify CHJ1 = com.sun.star.table.CellHoriJustify.BLOCK;
+ com.sun.star.table.CellHoriJustify CHJ2 = com.sun.star.table.CellHoriJustify.CENTER;
+ com.sun.star.table.CellHoriJustify CHJ3 = com.sun.star.table.CellHoriJustify.LEFT;
+ com.sun.star.table.CellHoriJustify CHJ4 = com.sun.star.table.CellHoriJustify.REPEAT;
+ com.sun.star.table.CellHoriJustify CHJ5 = com.sun.star.table.CellHoriJustify.RIGHT;
+ com.sun.star.table.CellHoriJustify CHJ6 = com.sun.star.table.CellHoriJustify.STANDARD;
+ if (oldValue.equals(CHJ1)) newValue = CHJ2;
+ if (oldValue.equals(CHJ2)) newValue = CHJ3;
+ if (oldValue.equals(CHJ3)) newValue = CHJ4;
+ if (oldValue.equals(CHJ4)) newValue = CHJ5;
+ if (oldValue.equals(CHJ5)) newValue = CHJ6;
+ if (oldValue.equals(CHJ6)) newValue = CHJ1;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.CellVertJustify) {
+ com.sun.star.table.CellVertJustify CVJ1 = com.sun.star.table.CellVertJustify.BOTTOM;
+ com.sun.star.table.CellVertJustify CVJ2 = com.sun.star.table.CellVertJustify.CENTER;
+ com.sun.star.table.CellVertJustify CVJ3 = com.sun.star.table.CellVertJustify.STANDARD;
+ com.sun.star.table.CellVertJustify CVJ4 = com.sun.star.table.CellVertJustify.TOP;
+ if (oldValue.equals(CVJ1)) newValue = CVJ2;
+ if (oldValue.equals(CVJ2)) newValue = CVJ3;
+ if (oldValue.equals(CVJ3)) newValue = CVJ4;
+ if (oldValue.equals(CVJ4)) newValue = CVJ1;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.CellOrientation) {
+ com.sun.star.table.CellOrientation CO1 = com.sun.star.table.CellOrientation.BOTTOMTOP;
+ com.sun.star.table.CellOrientation CO2 = com.sun.star.table.CellOrientation.STACKED;
+ com.sun.star.table.CellOrientation CO3 = com.sun.star.table.CellOrientation.STANDARD;
+ com.sun.star.table.CellOrientation CO4 = com.sun.star.table.CellOrientation.TOPBOTTOM;
+ if (oldValue.equals(CO1)) newValue = CO2;
+ if (oldValue.equals(CO2)) newValue = CO3;
+ if (oldValue.equals(CO3)) newValue = CO4;
+ if (oldValue.equals(CO4)) newValue = CO1;
+ } else
+
+ if (oldValue instanceof com.sun.star.util.CellProtection) {
+ com.sun.star.util.CellProtection CP = new com.sun.star.util.CellProtection();
+ com.sun.star.util.CellProtection CPold = (com.sun.star.util.CellProtection) oldValue;
+ CP.IsFormulaHidden = (! CPold.IsFormulaHidden);
+ CP.IsHidden = (! CPold.IsHidden);
+ CP.IsLocked = (! CPold.IsLocked);
+ CP.IsPrintHidden = (! CPold.IsPrintHidden);
+ newValue = CP;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.TableBorder) {
+ com.sun.star.table.TableBorder TBold = (com.sun.star.table.TableBorder) oldValue;
+ com.sun.star.table.TableBorder TB = new com.sun.star.table.TableBorder();
+ TB.IsBottomLineValid = (! TBold.IsBottomLineValid);
+ TB.IsDistanceValid = (! TBold.IsDistanceValid);
+ TB.IsRightLineValid = (! TBold.IsRightLineValid);
+ TB.IsTopLineValid = (! TBold.IsTopLineValid);
+ newValue = TB;
+ } else
+/*
+ if (oldValue instanceof com.sun.star.awt.XBitmap) {
+ newValue = new BitmapLoader();
+ }
+*/
+ if (oldValue instanceof com.sun.star.drawing.FillStyle) {
+ com.sun.star.drawing.FillStyle FS1 = com.sun.star.drawing.FillStyle.NONE;
+ com.sun.star.drawing.FillStyle FS2 = com.sun.star.drawing.FillStyle.SOLID;
+ com.sun.star.drawing.FillStyle FS3 = com.sun.star.drawing.FillStyle.GRADIENT;
+ com.sun.star.drawing.FillStyle FS4 = com.sun.star.drawing.FillStyle.HATCH;
+ com.sun.star.drawing.FillStyle FS5 = com.sun.star.drawing.FillStyle.BITMAP;
+ if (oldValue.equals(FS1)) newValue = FS2;
+ if (oldValue.equals(FS2)) newValue = FS3;
+ if (oldValue.equals(FS3)) newValue = FS4;
+ if (oldValue.equals(FS4)) newValue = FS5;
+ if (oldValue.equals(FS5)) newValue = FS1;
+ } else
+
+ if (oldValue instanceof com.sun.star.awt.Gradient){
+ com.sun.star.awt.Gradient _newValue = (com.sun.star.awt.Gradient)oldValue;
+ _newValue.Angle += 10;
+ _newValue.Border += 1;
+ _newValue.EndColor += 1000;
+ _newValue.EndIntensity -= 10;
+ _newValue.StartColor += 500;
+ _newValue.StartIntensity += 10;
+ _newValue.StepCount += 50;
+ _newValue.Style = com.sun.star.awt.GradientStyle.RADIAL;
+ _newValue.XOffset += 10;
+ _newValue.YOffset += 10;
+ newValue = _newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.text.GraphicCrop){
+ com.sun.star.text.GraphicCrop _newValue = (com.sun.star.text.GraphicCrop)oldValue;
+ _newValue.Bottom += 10;
+ _newValue.Left += 10;
+ _newValue.Right += 10;
+ _newValue.Top += 10;
+ newValue = _newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.drawing.BitmapMode){
+ com.sun.star.drawing.BitmapMode bm1 = com.sun.star.drawing.BitmapMode.NO_REPEAT;
+ com.sun.star.drawing.BitmapMode bm2 = com.sun.star.drawing.BitmapMode.REPEAT;
+ com.sun.star.drawing.BitmapMode bm3 = com.sun.star.drawing.BitmapMode.STRETCH;
+ if (oldValue.equals(bm1)) newValue = bm2;
+ if (oldValue.equals(bm2)) newValue = bm3;
+ if (oldValue.equals(bm3)) newValue = bm3;
+ } else
+
+ if (oldValue instanceof com.sun.star.drawing.TextAdjust){
+ com.sun.star.drawing.TextAdjust TA1 = com.sun.star.drawing.TextAdjust.BLOCK;
+ com.sun.star.drawing.TextAdjust TA2 = com.sun.star.drawing.TextAdjust.CENTER;
+ com.sun.star.drawing.TextAdjust TA3 = com.sun.star.drawing.TextAdjust.LEFT;
+ com.sun.star.drawing.TextAdjust TA4 = com.sun.star.drawing.TextAdjust.RIGHT;
+ com.sun.star.drawing.TextAdjust TA5 = com.sun.star.drawing.TextAdjust.STRETCH;
+ if (oldValue.equals(TA1)) newValue = TA2;
+ if (oldValue.equals(TA2)) newValue = TA3;
+ if (oldValue.equals(TA3)) newValue = TA4;
+ if (oldValue.equals(TA4)) newValue = TA5;
+ if (oldValue.equals(TA5)) newValue = TA1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.TextFitToSizeType){
+ com.sun.star.drawing.TextFitToSizeType TF1 = com.sun.star.drawing.TextFitToSizeType.ALLLINES;
+ com.sun.star.drawing.TextFitToSizeType TF2 = com.sun.star.drawing.TextFitToSizeType.NONE;
+ com.sun.star.drawing.TextFitToSizeType TF3 = com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL;
+ com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.RESIZEATTR;
+ if (oldValue.equals(TF1)) newValue = TF2;
+ if (oldValue.equals(TF2)) newValue = TF3;
+ if (oldValue.equals(TF3)) newValue = TF4;
+ if (oldValue.equals(TF4)) newValue = TF1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.TextAnimationKind){
+ com.sun.star.drawing.TextAnimationKind AK1 = com.sun.star.drawing.TextAnimationKind.NONE;
+ com.sun.star.drawing.TextAnimationKind AK2 = com.sun.star.drawing.TextAnimationKind.SLIDE;
+ com.sun.star.drawing.TextAnimationKind AK3 = com.sun.star.drawing.TextAnimationKind.SCROLL;
+ com.sun.star.drawing.TextAnimationKind AK4 = com.sun.star.drawing.TextAnimationKind.BLINK;
+ com.sun.star.drawing.TextAnimationKind AK5 = com.sun.star.drawing.TextAnimationKind.ALTERNATE;
+
+ if (oldValue.equals(AK1)) newValue = AK2;
+ if (oldValue.equals(AK2)) newValue = AK3;
+ if (oldValue.equals(AK3)) newValue = AK4;
+ if (oldValue.equals(AK4)) newValue = AK5;
+ if (oldValue.equals(AK5)) newValue = AK1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.TextAnimationDirection){
+ com.sun.star.drawing.TextAnimationDirection AD1 = com.sun.star.drawing.TextAnimationDirection.LEFT;
+ com.sun.star.drawing.TextAnimationDirection AD2 = com.sun.star.drawing.TextAnimationDirection.RIGHT;
+ com.sun.star.drawing.TextAnimationDirection AD3 = com.sun.star.drawing.TextAnimationDirection.DOWN;
+ com.sun.star.drawing.TextAnimationDirection AD4 = com.sun.star.drawing.TextAnimationDirection.UP;
+ if (oldValue.equals(AD1)) newValue = AD2;
+ if (oldValue.equals(AD2)) newValue = AD3;
+ if (oldValue.equals(AD3)) newValue = AD4;
+ if (oldValue.equals(AD4)) newValue = AD1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.LineStyle){
+ com.sun.star.drawing.LineStyle LS1 = com.sun.star.drawing.LineStyle.NONE;
+ com.sun.star.drawing.LineStyle LS2 = com.sun.star.drawing.LineStyle.DASH;
+ com.sun.star.drawing.LineStyle LS3 = com.sun.star.drawing.LineStyle.SOLID;
+ if (oldValue.equals(LS1)) newValue = LS2;
+ if (oldValue.equals(LS2)) newValue = LS3;
+ if (oldValue.equals(LS3)) newValue = LS1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.LineJoint){
+ com.sun.star.drawing.LineJoint LJ1 = com.sun.star.drawing.LineJoint.BEVEL;
+ com.sun.star.drawing.LineJoint LJ2 = com.sun.star.drawing.LineJoint.MIDDLE;
+ com.sun.star.drawing.LineJoint LJ3 = com.sun.star.drawing.LineJoint.MITER;
+ com.sun.star.drawing.LineJoint LJ4 = com.sun.star.drawing.LineJoint.NONE;
+ com.sun.star.drawing.LineJoint LJ5 = com.sun.star.drawing.LineJoint.ROUND;
+ if (oldValue.equals(LJ1)) newValue = LJ2;
+ if (oldValue.equals(LJ2)) newValue = LJ3;
+ if (oldValue.equals(LJ3)) newValue = LJ4;
+ if (oldValue.equals(LJ4)) newValue = LJ5;
+ if (oldValue.equals(LJ5)) newValue = LJ1;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.LineDash){
+ com.sun.star.drawing.LineDash _newValue = (com.sun.star.drawing.LineDash)oldValue;
+ _newValue.Dashes += 1;
+ _newValue.DashLen += 10;
+ _newValue.Distance += 20;
+ _newValue.DotLen += 10;
+ _newValue.Dots += 10;
+ _newValue.Style = com.sun.star.drawing.DashStyle.RECT;
+ newValue = _newValue;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.Hatch){
+ com.sun.star.drawing.Hatch _newValue = (com.sun.star.drawing.Hatch) oldValue;
+ _newValue.Angle += 10;
+ _newValue.Color += 1000;
+ _newValue.Distance += 10;
+ _newValue.Style = com.sun.star.drawing.HatchStyle.DOUBLE;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.RectanglePoint){
+ com.sun.star.drawing.RectanglePoint RP1 = com.sun.star.drawing.RectanglePoint.LEFT_BOTTOM;
+ com.sun.star.drawing.RectanglePoint RP2 = com.sun.star.drawing.RectanglePoint.LEFT_MIDDLE;
+ com.sun.star.drawing.RectanglePoint RP3 = com.sun.star.drawing.RectanglePoint.LEFT_TOP;
+ com.sun.star.drawing.RectanglePoint RP4 = com.sun.star.drawing.RectanglePoint.MIDDLE_BOTTOM;
+ com.sun.star.drawing.RectanglePoint RP5 = com.sun.star.drawing.RectanglePoint.MIDDLE_MIDDLE;
+ com.sun.star.drawing.RectanglePoint RP6 = com.sun.star.drawing.RectanglePoint.MIDDLE_TOP;
+ com.sun.star.drawing.RectanglePoint RP7 = com.sun.star.drawing.RectanglePoint.RIGHT_BOTTOM;
+ com.sun.star.drawing.RectanglePoint RP8 = com.sun.star.drawing.RectanglePoint.RIGHT_MIDDLE;
+ com.sun.star.drawing.RectanglePoint RP9 = com.sun.star.drawing.RectanglePoint.RIGHT_TOP;
+
+ if (oldValue.equals(RP1)) newValue = RP2;
+ if (oldValue.equals(RP2)) newValue = RP3;
+ if (oldValue.equals(RP3)) newValue = RP4;
+ if (oldValue.equals(RP4)) newValue = RP5;
+ if (oldValue.equals(RP5)) newValue = RP6;
+ if (oldValue.equals(RP6)) newValue = RP7;
+ if (oldValue.equals(RP7)) newValue = RP8;
+ if (oldValue.equals(RP8)) newValue = RP9;
+ if (oldValue.equals(RP9)) newValue = RP1;
+
+ } else
+ if (oldValue instanceof com.sun.star.chart.ChartErrorCategory){
+ com.sun.star.chart.ChartErrorCategory CC1 = com.sun.star.chart.ChartErrorCategory.CONSTANT_VALUE;
+ com.sun.star.chart.ChartErrorCategory CC2 = com.sun.star.chart.ChartErrorCategory.ERROR_MARGIN;
+ com.sun.star.chart.ChartErrorCategory CC3 = com.sun.star.chart.ChartErrorCategory.NONE;
+ com.sun.star.chart.ChartErrorCategory CC4 = com.sun.star.chart.ChartErrorCategory.PERCENT;
+ com.sun.star.chart.ChartErrorCategory CC5 = com.sun.star.chart.ChartErrorCategory.STANDARD_DEVIATION;
+ com.sun.star.chart.ChartErrorCategory CC6 = com.sun.star.chart.ChartErrorCategory.VARIANCE;
+ if (oldValue.equals(CC1)) newValue = CC2;
+ if (oldValue.equals(CC2)) newValue = CC3;
+ if (oldValue.equals(CC3)) newValue = CC4;
+ if (oldValue.equals(CC4)) newValue = CC5;
+ if (oldValue.equals(CC5)) newValue = CC6;
+ if (oldValue.equals(CC6)) newValue = CC1;
+ } else
+ if (oldValue instanceof com.sun.star.chart.ChartErrorIndicatorType){
+ com.sun.star.chart.ChartErrorIndicatorType IT1 = com.sun.star.chart.ChartErrorIndicatorType.LOWER;
+ com.sun.star.chart.ChartErrorIndicatorType IT2 = com.sun.star.chart.ChartErrorIndicatorType.NONE;
+ com.sun.star.chart.ChartErrorIndicatorType IT3 = com.sun.star.chart.ChartErrorIndicatorType.TOP_AND_BOTTOM;
+ com.sun.star.chart.ChartErrorIndicatorType IT4 = com.sun.star.chart.ChartErrorIndicatorType.UPPER;
+ if (oldValue.equals(IT1)) newValue = IT2;
+ if (oldValue.equals(IT2)) newValue = IT3;
+ if (oldValue.equals(IT3)) newValue = IT4;
+ if (oldValue.equals(IT4)) newValue = IT1;
+ } else
+ if (oldValue instanceof com.sun.star.chart.ChartRegressionCurveType){
+ com.sun.star.chart.ChartRegressionCurveType CT1 = com.sun.star.chart.ChartRegressionCurveType.EXPONENTIAL;
+ com.sun.star.chart.ChartRegressionCurveType CT2 = com.sun.star.chart.ChartRegressionCurveType.LINEAR;
+ com.sun.star.chart.ChartRegressionCurveType CT3 = com.sun.star.chart.ChartRegressionCurveType.LOGARITHM;
+ com.sun.star.chart.ChartRegressionCurveType CT4 = com.sun.star.chart.ChartRegressionCurveType.NONE;
+ com.sun.star.chart.ChartRegressionCurveType CT5 = com.sun.star.chart.ChartRegressionCurveType.POLYNOMIAL;
+ com.sun.star.chart.ChartRegressionCurveType CT6 = com.sun.star.chart.ChartRegressionCurveType.POWER;
+ if (oldValue.equals(CT1)) newValue = CT2;
+ if (oldValue.equals(CT2)) newValue = CT3;
+ if (oldValue.equals(CT3)) newValue = CT4;
+ if (oldValue.equals(CT4)) newValue = CT5;
+ if (oldValue.equals(CT5)) newValue = CT6;
+ if (oldValue.equals(CT6)) newValue = CT1;
+
+ } else
+ if (oldValue instanceof com.sun.star.chart.ChartDataRowSource){
+ com.sun.star.chart.ChartDataRowSource RS1 = com.sun.star.chart.ChartDataRowSource.COLUMNS;
+ com.sun.star.chart.ChartDataRowSource RS2 = com.sun.star.chart.ChartDataRowSource.ROWS;
+ if (oldValue.equals(RS1)) newValue = RS2;
+ if (oldValue.equals(RS2)) newValue = RS1;
+ } else
+ if (oldValue instanceof com.sun.star.awt.FontDescriptor){
+ com.sun.star.awt.FontDescriptor _newValue = (com.sun.star.awt.FontDescriptor)oldValue;
+ _newValue.CharacterWidth += 5;
+ _newValue.CharSet = com.sun.star.awt.CharSet.ANSI;
+ _newValue.Family = com.sun.star.awt.FontFamily.DECORATIVE;
+ _newValue.Height += 2;
+ _newValue.Kerning = !_newValue.Kerning;
+ _newValue.Name = "Courier";
+ _newValue.Orientation += 45;
+ _newValue.Pitch = com.sun.star.awt.FontPitch.VARIABLE;
+ _newValue.Slant = com.sun.star.awt.FontSlant.REVERSE_ITALIC;
+ _newValue.Strikeout = com.sun.star.awt.FontStrikeout.X;
+ _newValue.StyleName = "Bold";
+ _newValue.Type = com.sun.star.awt.FontType.SCALABLE;
+ _newValue.Underline = com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT;
+ _newValue.Weight += 5;
+ _newValue.Width += 6;
+ _newValue.WordLineMode = !_newValue.WordLineMode;
+
+ newValue = _newValue;
+ } else
+ if (oldValue instanceof com.sun.star.form.NavigationBarMode){
+ com.sun.star.form.NavigationBarMode BM1 = com.sun.star.form.NavigationBarMode.CURRENT;
+ com.sun.star.form.NavigationBarMode BM2 = com.sun.star.form.NavigationBarMode.NONE;
+ com.sun.star.form.NavigationBarMode BM3 = com.sun.star.form.NavigationBarMode.PARENT;
+ if (oldValue.equals(BM1)) newValue = BM2;
+ if (oldValue.equals(BM2)) newValue = BM3;
+ if (oldValue.equals(BM3)) newValue = BM1;
+ } else
+ if (oldValue instanceof com.sun.star.form.FormSubmitEncoding){
+ com.sun.star.form.FormSubmitEncoding SE1 = com.sun.star.form.FormSubmitEncoding.MULTIPART;
+ com.sun.star.form.FormSubmitEncoding SE2 = com.sun.star.form.FormSubmitEncoding.TEXT;
+ com.sun.star.form.FormSubmitEncoding SE3 = com.sun.star.form.FormSubmitEncoding.URL;
+ if (oldValue.equals(SE1)) newValue = SE2;
+ if (oldValue.equals(SE2)) newValue = SE3;
+ if (oldValue.equals(SE3)) newValue = SE1;
+ } else
+ if (oldValue instanceof com.sun.star.form.FormSubmitMethod){
+ com.sun.star.form.FormSubmitMethod FM1 = com.sun.star.form.FormSubmitMethod.GET;
+ com.sun.star.form.FormSubmitMethod FM2 = com.sun.star.form.FormSubmitMethod.POST;
+ if (oldValue.equals(FM1)) newValue = FM2;
+ if (oldValue.equals(FM2)) newValue = FM1;
+ } else
+
+ if (oldValue instanceof com.sun.star.text.SectionFileLink){
+ com.sun.star.text.SectionFileLink _newValue =
+ new com.sun.star.text.SectionFileLink();
+
+ _newValue.FileURL = util.utils.getFullTestURL("SwXTextSection.sdw");
+ newValue=_newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.BorderLine){
+ com.sun.star.table.BorderLine _newValue = (com.sun.star.table.BorderLine)oldValue;
+ _newValue.Color += 2;
+ _newValue.InnerLineWidth += 2;
+ _newValue.LineDistance += 2;
+ _newValue.OuterLineWidth += 3;
+ newValue=_newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.text.XTextColumns){
+ com.sun.star.text.XTextColumns _newValue = (com.sun.star.text.XTextColumns)oldValue;
+ _newValue.setColumnCount((short)1);
+ newValue=_newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.form.FormButtonType){
+ com.sun.star.form.FormButtonType BT1 = com.sun.star.form.FormButtonType.PUSH;
+ com.sun.star.form.FormButtonType BT2 = com.sun.star.form.FormButtonType.RESET;
+ com.sun.star.form.FormButtonType BT3 = com.sun.star.form.FormButtonType.SUBMIT;
+ com.sun.star.form.FormButtonType BT4 = com.sun.star.form.FormButtonType.URL;
+
+ if (oldValue.equals(BT1)) newValue = BT2;
+ if (oldValue.equals(BT2)) newValue = BT3;
+ if (oldValue.equals(BT3)) newValue = BT4;
+ if (oldValue.equals(BT4)) newValue = BT1;
+
+ } else
+ if (oldValue instanceof com.sun.star.form.ListSourceType){
+ com.sun.star.form.ListSourceType ST1 = com.sun.star.form.ListSourceType.QUERY;
+ com.sun.star.form.ListSourceType ST2 = com.sun.star.form.ListSourceType.SQL;
+ com.sun.star.form.ListSourceType ST3 = com.sun.star.form.ListSourceType.SQLPASSTHROUGH;
+ com.sun.star.form.ListSourceType ST4 = com.sun.star.form.ListSourceType.TABLE;
+ com.sun.star.form.ListSourceType ST5 = com.sun.star.form.ListSourceType.TABLEFIELDS;
+ com.sun.star.form.ListSourceType ST6 = com.sun.star.form.ListSourceType.VALUELIST;
+ if (oldValue.equals(ST1)) newValue = ST2;
+ if (oldValue.equals(ST2)) newValue = ST3;
+ if (oldValue.equals(ST3)) newValue = ST4;
+ if (oldValue.equals(ST4)) newValue = ST5;
+ if (oldValue.equals(ST5)) newValue = ST6;
+ if (oldValue.equals(ST6)) newValue = ST1;
+ } else
+ if (oldValue instanceof com.sun.star.table.BorderLine){
+ com.sun.star.table.BorderLine _newValue = (com.sun.star.table.BorderLine)oldValue;
+ _newValue.Color += 1000;
+ _newValue.InnerLineWidth += 2;
+ _newValue.LineDistance +=3;
+ _newValue.OuterLineWidth += 3;
+ newValue = _newValue;
+ } else
+ if (oldValue instanceof com.sun.star.sheet.DataPilotFieldOrientation) {
+ com.sun.star.sheet.DataPilotFieldOrientation FO1 = com.sun.star.sheet.DataPilotFieldOrientation.PAGE;
+ com.sun.star.sheet.DataPilotFieldOrientation FO2 = com.sun.star.sheet.DataPilotFieldOrientation.COLUMN;
+ com.sun.star.sheet.DataPilotFieldOrientation FO3 = com.sun.star.sheet.DataPilotFieldOrientation.DATA;
+ com.sun.star.sheet.DataPilotFieldOrientation FO4 = com.sun.star.sheet.DataPilotFieldOrientation.HIDDEN;
+ com.sun.star.sheet.DataPilotFieldOrientation FO5 = com.sun.star.sheet.DataPilotFieldOrientation.ROW;
+ if (oldValue.equals(FO1)) newValue = FO2;
+ if (oldValue.equals(FO2)) newValue = FO3;
+ if (oldValue.equals(FO3)) newValue = FO4;
+ if (oldValue.equals(FO4)) newValue = FO5;
+ if (oldValue.equals(FO5)) newValue = FO1;
+ } else
+ if (oldValue instanceof com.sun.star.sheet.GeneralFunction) {
+ com.sun.star.sheet.GeneralFunction GF1 = com.sun.star.sheet.GeneralFunction.NONE;
+ com.sun.star.sheet.GeneralFunction GF2 = com.sun.star.sheet.GeneralFunction.AVERAGE;
+ com.sun.star.sheet.GeneralFunction GF3 = com.sun.star.sheet.GeneralFunction.COUNT;
+ com.sun.star.sheet.GeneralFunction GF4 = com.sun.star.sheet.GeneralFunction.COUNTNUMS;
+ com.sun.star.sheet.GeneralFunction GF5 = com.sun.star.sheet.GeneralFunction.MAX;
+ com.sun.star.sheet.GeneralFunction GF6 = com.sun.star.sheet.GeneralFunction.MIN;
+ com.sun.star.sheet.GeneralFunction GF7 = com.sun.star.sheet.GeneralFunction.AUTO;
+ com.sun.star.sheet.GeneralFunction GF8 = com.sun.star.sheet.GeneralFunction.PRODUCT;
+ com.sun.star.sheet.GeneralFunction GF9 = com.sun.star.sheet.GeneralFunction.STDEV;
+ com.sun.star.sheet.GeneralFunction GF10 = com.sun.star.sheet.GeneralFunction.STDEVP;
+ com.sun.star.sheet.GeneralFunction GF11 = com.sun.star.sheet.GeneralFunction.SUM;
+ com.sun.star.sheet.GeneralFunction GF12 = com.sun.star.sheet.GeneralFunction.VAR;
+ com.sun.star.sheet.GeneralFunction GF13 = com.sun.star.sheet.GeneralFunction.VARP;
+
+ if (oldValue.equals(GF1)) newValue = GF2;
+ if (oldValue.equals(GF2)) newValue = GF3;
+ if (oldValue.equals(GF3)) newValue = GF4;
+ if (oldValue.equals(GF4)) newValue = GF5;
+ if (oldValue.equals(GF5)) newValue = GF6;
+ if (oldValue.equals(GF6)) newValue = GF7;
+ if (oldValue.equals(GF7)) newValue = GF8;
+ if (oldValue.equals(GF8)) newValue = GF9;
+ if (oldValue.equals(GF9)) newValue = GF10;
+ if (oldValue.equals(GF10)) newValue = GF11;
+ if (oldValue.equals(GF11)) newValue = GF12;
+ if (oldValue.equals(GF12)) newValue = GF13;
+ if (oldValue.equals(GF13)) newValue = GF1;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.CellAddress){
+ com.sun.star.table.CellAddress _newValue = (com.sun.star.table.CellAddress)oldValue;
+ _newValue.Column += 1;
+ _newValue.Row += 1;
+ newValue = _newValue;
+ } else
+
+ if (oldValue instanceof com.sun.star.table.TableOrientation){
+ com.sun.star.table.TableOrientation TO1 = com.sun.star.table.TableOrientation.COLUMNS;
+ com.sun.star.table.TableOrientation TO2 = com.sun.star.table.TableOrientation.ROWS;
+ if (oldValue.equals(TO1)) newValue = TO2; else newValue = TO1;
+ } else
+
+ if (oldValue instanceof com.sun.star.sheet.DataImportMode){
+ com.sun.star.sheet.DataImportMode DIM1 = com.sun.star.sheet.DataImportMode.NONE;
+ com.sun.star.sheet.DataImportMode DIM2 = com.sun.star.sheet.DataImportMode.QUERY;
+ com.sun.star.sheet.DataImportMode DIM3 = com.sun.star.sheet.DataImportMode.SQL;
+ com.sun.star.sheet.DataImportMode DIM4 = com.sun.star.sheet.DataImportMode.TABLE;
+
+ if (oldValue.equals(DIM1)) newValue = DIM2;
+ if (oldValue.equals(DIM2)) newValue = DIM3;
+ if (oldValue.equals(DIM3)) newValue = DIM4;
+ if (oldValue.equals(DIM4)) newValue = DIM1;
+
+ } else
+
+// if (oldValue instanceof com.sun.star.text.TableColumnSeparator[]){
+// com.sun.star.text.TableColumnSeparator[] _newValue = (com.sun.star.text.TableColumnSeparator[]) oldValue;
+// com.sun.star.text.TableColumnSeparator sep = new com.sun.star.text.TableColumnSeparator();
+// sep.IsVisible = ! _newValue[0].IsVisible;
+// _newValue[0] = sep;
+// newValue = _newValue;
+// } else
+
+ if (oldValue instanceof com.sun.star.style.BreakType){
+ com.sun.star.style.BreakType BT1 = com.sun.star.style.BreakType.COLUMN_AFTER;
+ com.sun.star.style.BreakType BT2 = com.sun.star.style.BreakType.COLUMN_BEFORE;
+ com.sun.star.style.BreakType BT3 = com.sun.star.style.BreakType.COLUMN_BOTH;
+ com.sun.star.style.BreakType BT4 = com.sun.star.style.BreakType.PAGE_AFTER;
+ com.sun.star.style.BreakType BT5 = com.sun.star.style.BreakType.PAGE_BEFORE;
+ com.sun.star.style.BreakType BT6 = com.sun.star.style.BreakType.PAGE_BOTH;
+ com.sun.star.style.BreakType BT7 = com.sun.star.style.BreakType.NONE;
+ if (oldValue.equals(BT1)) newValue = BT2;
+ if (oldValue.equals(BT2)) newValue = BT3;
+ if (oldValue.equals(BT3)) newValue = BT4;
+ if (oldValue.equals(BT4)) newValue = BT5;
+ if (oldValue.equals(BT6)) newValue = BT6;
+ if (oldValue.equals(BT6)) newValue = BT7;
+ if (oldValue.equals(BT7)) newValue = BT1;
+ } else
+ if (oldValue instanceof com.sun.star.sheet.ValidationAlertStyle){
+ com.sun.star.sheet.ValidationAlertStyle VAS1 = com.sun.star.sheet.ValidationAlertStyle.INFO;
+ com.sun.star.sheet.ValidationAlertStyle VAS2 = com.sun.star.sheet.ValidationAlertStyle.MACRO;
+ com.sun.star.sheet.ValidationAlertStyle VAS3 = com.sun.star.sheet.ValidationAlertStyle.STOP;
+ com.sun.star.sheet.ValidationAlertStyle VAS4 = com.sun.star.sheet.ValidationAlertStyle.WARNING;
+
+ if (oldValue.equals(VAS1)) newValue = VAS2;
+ if (oldValue.equals(VAS2)) newValue = VAS3;
+ if (oldValue.equals(VAS3)) newValue = VAS4;
+ if (oldValue.equals(VAS4)) newValue = VAS1;
+
+ } else
+ if (oldValue instanceof com.sun.star.sheet.ValidationType){
+ com.sun.star.sheet.ValidationType VT1 = com.sun.star.sheet.ValidationType.ANY;
+ com.sun.star.sheet.ValidationType VT2 = com.sun.star.sheet.ValidationType.CUSTOM;
+ com.sun.star.sheet.ValidationType VT3 = com.sun.star.sheet.ValidationType.DATE;
+ com.sun.star.sheet.ValidationType VT4 = com.sun.star.sheet.ValidationType.DECIMAL;
+ com.sun.star.sheet.ValidationType VT5 = com.sun.star.sheet.ValidationType.LIST;
+ com.sun.star.sheet.ValidationType VT6 = com.sun.star.sheet.ValidationType.TEXT_LEN;
+ com.sun.star.sheet.ValidationType VT7 = com.sun.star.sheet.ValidationType.TIME;
+ com.sun.star.sheet.ValidationType VT8 = com.sun.star.sheet.ValidationType.WHOLE;
+
+ if (oldValue.equals(VT1)) newValue = VT2;
+ if (oldValue.equals(VT2)) newValue = VT3;
+ if (oldValue.equals(VT3)) newValue = VT4;
+ if (oldValue.equals(VT4)) newValue = VT5;
+ if (oldValue.equals(VT5)) newValue = VT6;
+ if (oldValue.equals(VT6)) newValue = VT7;
+ if (oldValue.equals(VT7)) newValue = VT8;
+ if (oldValue.equals(VT8)) newValue = VT1;
+
+ } else
+ if (oldValue instanceof com.sun.star.text.WritingMode){
+ if (oldValue.equals(com.sun.star.text.WritingMode.LR_TB)) {
+ newValue = com.sun.star.text.WritingMode.TB_RL;
+ } else {
+ newValue = com.sun.star.text.WritingMode.LR_TB;
+ }
+ } else
+ if (oldValue instanceof com.sun.star.uno.Enum) {
+ // universal changer for Enumerations
+ try {
+ Class enumClass = oldValue.getClass() ;
+ Field[] flds = enumClass.getFields() ;
+
+ newValue = null ;
+
+ for (int i = 0; i < flds.length; i++) {
+ if (Enum.class.equals(flds[i].getType().getSuperclass())) {
+
+ Enum value = (Enum) flds[i].get(null) ;
+ if (newValue == null && !value.equals(oldValue)) {
+ newValue = value ;
+ break ;
+ }
+ }
+ }
+ } catch (Exception e) {
+ System.err.println("Exception occured while changing Enumeration value:") ;
+ e.printStackTrace(System.err) ;
+ }
+ if (newValue == null) newValue = oldValue ;
+
+ } else
+ if (oldValue instanceof com.sun.star.style.TabStop[]){
+ com.sun.star.style.TabStop[] _newValue = (com.sun.star.style.TabStop[]) oldValue;
+ if (_newValue.length == 0) {
+ _newValue = new com.sun.star.style.TabStop[1];
+ }
+ com.sun.star.style.TabStop sep = new com.sun.star.style.TabStop();
+ sep.Position += 1;
+ _newValue[0] = sep;
+ newValue = _newValue;
+ } else
+ if (oldValue instanceof short[]){
+ short[] oldArr = (short[])oldValue;
+ int len = oldArr.length;
+ short[] newArr = new short[len + 1];
+ for (int i = 0; i < len; i++) {
+ newArr[i] = (short)(oldArr[i] + 1);
+ }
+ newArr[len] = 5;
+ newValue = newArr;
+ } else
+ if (oldValue instanceof String[]){
+ String[] oldArr = (String[])oldValue;
+ int len = oldArr.length;
+ String[] newArr = new String[len + 1];
+ for (int i = 0; i < len; i++) {
+ newArr[i] = "_" + oldArr[i];
+ }
+ newArr[len] = "_dummy";
+ newValue = newArr;
+ } else
+
+ if (oldValue instanceof com.sun.star.util.DateTime) {
+ com.sun.star.util.DateTime oldDT = (com.sun.star.util.DateTime) oldValue;
+ com.sun.star.util.DateTime newDT = new com.sun.star.util.DateTime();
+ newDT.Day = (short) (oldDT.Day+(short) 1);
+ newDT.Hours = (short) (oldDT.Hours+(short) 1);
+ newValue = newDT;
+ } else
+ if (oldValue instanceof com.sun.star.text.TableColumnSeparator) {
+ com.sun.star.text.TableColumnSeparator oldTCS = (com.sun.star.text.TableColumnSeparator) oldValue;
+ com.sun.star.text.TableColumnSeparator newTCS = new com.sun.star.text.TableColumnSeparator();
+ newTCS.IsVisible = !(oldTCS.IsVisible);
+ newTCS.Position = (short) (oldTCS.Position+(short) 1);
+ newValue = newTCS;
+ } else
+ if (oldValue instanceof com.sun.star.drawing.HomogenMatrix3) {
+ com.sun.star.drawing.HomogenMatrix3 oldHM = (com.sun.star.drawing.HomogenMatrix3) oldValue;
+ com.sun.star.drawing.HomogenMatrix3 newHM = new com.sun.star.drawing.HomogenMatrix3();
+ newHM.Line1.Column1 = oldHM.Line1.Column1+1;
+ newHM.Line2.Column2 = oldHM.Line2.Column2+1;
+ newHM.Line3.Column3 = oldHM.Line3.Column3+1;
+ newValue = newHM;
+ } else
+
+ if (oldValue instanceof com.sun.star.drawing.PolyPolygonBezierCoords) {
+ com.sun.star.drawing.PolyPolygonBezierCoords oldPPC = (com.sun.star.drawing.PolyPolygonBezierCoords) oldValue;
+ com.sun.star.drawing.PolyPolygonBezierCoords newPPC = new com.sun.star.drawing.PolyPolygonBezierCoords();
+ newPPC.Coordinates = oldPPC.Coordinates;
+ newPPC.Flags = oldPPC.Flags;
+ PolygonFlags[][] fArray = new PolygonFlags[1][1];
+ PolygonFlags[] flags = new PolygonFlags[1];
+ flags[0] = PolygonFlags.NORMAL;
+ fArray[0] = flags;
+ Point[][] pArray = new Point[1][1];
+ Point[] points = new Point[1];
+ Point aPoint = new Point();
+ aPoint.X = 1;
+ aPoint.Y = 2;
+ points[0] = aPoint;
+ pArray[0] = points;
+ if ( oldPPC.Coordinates.length == 0 ) {
+ newPPC.Coordinates = pArray;
+ newPPC.Flags = fArray;
+ } else {
+ if ( oldPPC.Coordinates[0].length == 0 ) {
+ newPPC.Coordinates = pArray;
+ newPPC.Flags = fArray;
+ } else {
+ newPPC.Coordinates[0][0].X = oldPPC.Coordinates[0][0].X +1;
+ newPPC.Coordinates[0][0].Y = oldPPC.Coordinates[0][0].Y +1;
+ }
+ }
+ newValue = newPPC;
+ } else
+ if (oldValue.getClass().isArray()) {
+ // changer for arrays : changes all elements
+ Class arrType = oldValue.getClass().getComponentType() ;
+ newValue = Array.newInstance(arrType, Array.getLength(oldValue)) ;
+ for (int i = 0; i < Array.getLength(newValue); i++) {
+ if (!arrType.isPrimitive()) {
+ Object elem = changePValue(Array.get(oldValue, i)) ;
+ Array.set(newValue, i, elem);
+ } else {
+ if (Boolean.TYPE.equals(arrType)) {
+ Array.setBoolean(newValue, i, !Array.getBoolean(oldValue, i));
+ } else
+ if (Byte.TYPE.equals(arrType)) {
+ Array.setByte(newValue, i,
+ (byte) (Array.getByte(oldValue, i) + 1));
+ } else
+ if (Character.TYPE.equals(arrType)) {
+ Array.setChar(newValue, i,
+ (char) (Array.getChar(oldValue, i) + 1));
+ } else
+ if (Double.TYPE.equals(arrType)) {
+ Array.setDouble(newValue, i, Array.getDouble(oldValue, i) + 1);
+ } else
+ if (Float.TYPE.equals(arrType)) {
+ Array.setFloat(newValue, i, Array.getFloat(oldValue, i) + 1);
+ } else
+ if (Integer.TYPE.equals(arrType)) {
+ Array.setInt(newValue, i, Array.getInt(oldValue, i) + 1);
+ } else
+ if (Long.TYPE.equals(arrType)) {
+ Array.setLong(newValue, i, Array.getLong(oldValue, i) + 1);
+ } else
+ if (Short.TYPE.equals(arrType)) {
+ Array.setShort(newValue, i,
+ (short) (Array.getShort(oldValue, i) + 1));
+ }
+ }
+ }
+ } else
+ if (isStructure(oldValue)) {
+ // universal changer for structures
+ Class clazz = oldValue.getClass() ;
+ try {
+ newValue = clazz.newInstance() ;
+ Field[] fields = clazz.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ if ((fields[i].getModifiers() & Modifier.PUBLIC) != 0) {
+ Class fType = fields[i].getType() ;
+ Field field = fields[i] ;
+ if (!fType.isPrimitive()) {
+ field.set(newValue, changePValue(field.get(oldValue)));
+ } else {
+ if (Boolean.TYPE.equals(fType)) {
+ field.setBoolean(newValue, !field.getBoolean(oldValue));
+ } else
+ if (Byte.TYPE.equals(fType)) {
+ field.setByte(newValue, (byte) (field.getByte(oldValue) + 1));
+ } else
+ if (Character.TYPE.equals(fType)) {
+ field.setChar(newValue, (char) (field.getChar(oldValue) + 1));
+ } else
+ if (Double.TYPE.equals(fType)) {
+ field.setDouble(newValue, field.getDouble(oldValue) + 1);
+ } else
+ if (Float.TYPE.equals(fType)) {
+ field.setFloat(newValue, field.getFloat(oldValue) + 1);
+ } else
+ if (Integer.TYPE.equals(fType)) {
+ field.setInt(newValue, field.getInt(oldValue) + 1);
+ } else
+ if (Long.TYPE.equals(fType)) {
+ field.setLong(newValue, field.getLong(oldValue) + 1);
+ } else
+ if (Short.TYPE.equals(fType)) {
+ field.setShort(newValue, (short) (field.getShort(oldValue) + 1));
+ }
+ }
+ }
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace() ;
+ } catch (InstantiationException e) {
+ e.printStackTrace() ;
+ }
+
+ } else
+ {
+ System.out.println("ValueChanger don't know type " + oldValue.getClass());
+ }
+
+ return newValue;
+
+ } // end of Change PValue
+
+ /**
+ * Checks if the passed value is the API structure.
+ * The value assumed to be a structure if there are no public
+ * methods, and all public fields are not static or final.
+ *
+ * @param val the value to be checked.
+ * @return <code>true</code> if the value is acssumed to be a
+ * structure.
+ */
+ private static boolean isStructure(Object val) {
+ boolean result = true ;
+
+ Class clazz = val.getClass() ;
+
+ Method[] meth = clazz.getDeclaredMethods() ;
+ for (int i = 0; i < meth.length; i++) {
+ result &= (meth[i].getModifiers() & Modifier.PUBLIC) == 0 ;
+ }
+
+ Field[] fields = clazz.getDeclaredFields() ;
+ for (int i = 0; i < fields.length; i++) {
+ int mod = fields[i].getModifiers() ;
+ // If the field is PUBLIC it must not be STATIC or FINAL
+ result &= ((mod & Modifier.PUBLIC) == 0) ||
+ (((mod & Modifier.STATIC) == 0) && ((mod & Modifier.FINAL) == 0)) ;
+ }
+
+ return result ;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/ValueComparer.java b/qadevOOo/runner/util/ValueComparer.java
new file mode 100644
index 000000000000..58cd71cb44a4
--- /dev/null
+++ b/qadevOOo/runner/util/ValueComparer.java
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * $RCSfile: ValueComparer.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Enum;
+import com.sun.star.uno.XInterface;
+
+
+public class ValueComparer {
+
+ // Method to change a Value, thought for properties
+ public static boolean equalValue( Object first, Object second ) {
+ boolean eq = false;
+ try {
+ if ( (first==null) || (second == null) ) {
+ eq = (first == second);
+ }
+ else {
+ if ( util.utils.isVoid(first) && util.utils.isVoid(second) ) {
+ eq=true;
+ } else if ( util.utils.isVoid(first) || util.utils.isVoid(second) ) {
+ eq = (first == second);
+ } else {
+ eq = compareObjects(first, second);
+ }
+ }
+ }
+ catch (Exception e) {
+ System.out.println("Exception occured while comparing Objects");
+ e.printStackTrace();
+ }
+ return eq;
+ } // end of equalValue
+
+ static boolean compareArrays(Object op1, Object op2) throws Exception {
+ boolean result = true;
+ if((op1.getClass().getComponentType() == op2.getClass().getComponentType())
+ && (Array.getLength(op1) == Array.getLength(op2)))
+ {
+ Class zClass = op1.getClass().getComponentType();
+
+ for(int i = 0; i < Array.getLength(op1); ++ i)
+ result = result & compareObjects(Array.get(op1, i), Array.get(op2, i));
+ } else {
+ result = false ;
+ }
+
+ return result;
+ }
+
+ static boolean compareInterfaces(XInterface op1, XInterface op2) {
+ return op1 == op2;
+ }
+
+ static boolean compareUntil(Class zClass, Class untilClass, Object op1, Object op2) throws Exception {
+ boolean result = true;
+
+ // write inherited members first
+ Class superClass = zClass.getSuperclass();
+ if(superClass != null && superClass != untilClass)
+ result = result & compareUntil(superClass, untilClass, op1, op2);
+
+ Field fields[] = zClass.getDeclaredFields();
+
+ for(int i = 0; i < fields.length && result; ++ i) {
+ if((fields[i].getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) { // neither static nor transient ?
+ result = result & compareObjects(fields[i].get(op1), fields[i].get(op2));
+
+// if(!result)
+// System.err.println("blabal :" + fields[i]);
+ }
+ }
+
+ return result;
+ }
+
+ static boolean compareStructs(Object op1, Object op2) throws Exception {
+ boolean result = true;
+
+ if(op1.getClass() != op2.getClass())
+ result = false;
+ else {
+ result = compareUntil(op1.getClass(), Object.class, op1, op2);
+ }
+
+ return result;
+ }
+
+ static boolean compareThrowable(Throwable op1, Throwable op2) throws Exception {
+ boolean result = true;
+
+ if(op1.getClass() != op2.getClass())
+ result = false;
+ else {
+ result = compareUntil(op1.getClass(), Throwable.class, op1, op2);
+
+ result = result & op1.getMessage().equals(op2.getMessage());
+ }
+
+ return result;
+ }
+
+ static boolean compareEnums(Enum en1, Enum en2) {
+ return en1.getValue() == en2.getValue();
+ }
+
+ static boolean compareObjects(Object op1, Object op2) throws Exception {
+ boolean result = false;
+
+ if(op1 == op2)
+ result = true;
+
+ if ( (op1==null) || (op2 == null) ) {
+ result = (op1 == op2);
+ }
+
+ else if(op1.getClass().isPrimitive() && op2.getClass().isPrimitive())
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Byte.class && op2.getClass() == Byte.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Type.class && op2.getClass() == Type.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Boolean.class && op2.getClass() == Boolean.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Short.class && op2.getClass() == Short.class)
+ result = op1.equals(op2);
+
+ else if(Throwable.class.isAssignableFrom(op1.getClass()) && Throwable.class.isAssignableFrom(op2.getClass()))
+ result = compareThrowable((Throwable)op1, (Throwable)op2);
+
+ else if(op1.getClass() == Integer.class && op2.getClass() == Integer.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Character.class && op2.getClass() == Character.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Long.class && op2.getClass() == Long.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Void.class && op2.getClass() == Void.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Float.class && op2.getClass() == Float.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass() == Double.class && op2.getClass() == Double.class)
+ result = op1.equals(op2);
+
+ else if(op1.getClass().isArray() && op2.getClass().isArray())
+ result = compareArrays(op1, op2);
+
+ else if(op1.getClass() == Void.class || op2.getClass() == void.class) // write nothing ?
+ result = true;
+
+ else if(XInterface.class.isAssignableFrom(op1.getClass()) && XInterface.class.isAssignableFrom(op2.getClass()))
+ compareInterfaces((XInterface)op1, (XInterface)op2);
+
+ else if(Enum.class.isAssignableFrom(op1.getClass()) && Enum.class.isAssignableFrom(op2.getClass()))
+ compareEnums((Enum)op1, (Enum)op2);
+
+ else if(op1.getClass() == String.class && op2.getClass() == String.class) // is it a String ?
+ result = ((String)op1).equals((String)op2);
+
+ else // otherwise it must be a struct
+ result = compareStructs(op1, op2);
+
+ return result;
+ }
+
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/WriterTools.java b/qadevOOo/runner/util/WriterTools.java
new file mode 100644
index 000000000000..8043b42f7c9b
--- /dev/null
+++ b/qadevOOo/runner/util/WriterTools.java
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * $RCSfile: WriterTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.lang.XComponent;
+import com.sun.star.drawing.XDrawPageSupplier;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNamed;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextContent;
+
+import util.DesktopTools;
+
+public class WriterTools {
+
+ public static XTextDocument createTextDoc( XMultiServiceFactory xMSF ) {
+ PropertyValue[] Args = new PropertyValue [0];
+ XComponent comp = DesktopTools.openNewDoc( xMSF, "swriter", Args );
+ XTextDocument WriterDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,comp);
+ return WriterDoc;
+ } // finish createTextDoc
+
+ public static XTextDocument loadTextDoc( XMultiServiceFactory xMSF, String url ) {
+ PropertyValue[] Args = new PropertyValue [0];
+ XComponent comp = DesktopTools.loadDoc( xMSF, url, Args );
+ XTextDocument WriterDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,comp);
+ return WriterDoc;
+ } // finish createTextDoc
+
+
+ public static XDrawPage getDrawPage ( XTextDocument aDoc ) {
+ XDrawPage oDP = null;
+ try {
+ XDrawPageSupplier oDPS = (XDrawPageSupplier)
+ UnoRuntime.queryInterface(XDrawPageSupplier.class,aDoc);
+ oDP = (XDrawPage) oDPS.getDrawPage();
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException( "Couldn't get drawpage" );
+ }
+ return oDP;
+ }
+
+ public static void insertTextGraphic ( XTextDocument aDoc,
+ XMultiServiceFactory xMSF, int hpos, int vpos, int width, int height,
+ String pic, String name) {
+ try {
+ Object oGObject = (XInterface) xMSF.createInstance(
+ "com.sun.star.text.GraphicObject");
+
+ XText the_text = aDoc.getText();
+ XTextCursor the_cursor = the_text.createTextCursor();
+ XTextContent the_content = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class,oGObject);
+ the_text.insertTextContent(the_cursor,the_content,true);
+ XPropertySet oProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class,oGObject);
+
+ String fullURL = util.utils.getFullTestURL(pic);
+ oProps.setPropertyValue("GraphicURL",fullURL);
+ oProps.setPropertyValue("HoriOrientPosition",new Integer(hpos));
+ oProps.setPropertyValue("VertOrientPosition",new Integer(vpos));
+ oProps.setPropertyValue("Width",new Integer(width));
+ oProps.setPropertyValue("Height",new Integer(height));
+ XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class,oGObject);
+ the_name.setName(name);
+ }
+ catch (Exception ex) {
+ System.out.println("Exception while insertin TextGraphic");
+ ex.printStackTrace();
+ }
+
+
+ }
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/XInstCreator.java b/qadevOOo/runner/util/XInstCreator.java
new file mode 100644
index 000000000000..7f2cd249cfea
--- /dev/null
+++ b/qadevOOo/runner/util/XInstCreator.java
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: XInstCreator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import util.InstDescr;
+import java.util.Hashtable;
+import com.sun.star.uno.XInterface;
+import com.sun.star.container.XIndexAccess;
+
+public interface XInstCreator {
+
+ XInterface getInstance();
+ XInterface createInstance();
+ XIndexAccess getCollection();
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java
new file mode 100644
index 000000000000..9ff8fcc78293
--- /dev/null
+++ b/qadevOOo/runner/util/XMLTools.java
@@ -0,0 +1,976 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLTools.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.io.PrintWriter ;
+import java.util.Vector ;
+import java.util.Hashtable ;
+import java.util.Enumeration ;
+import java.util.HashSet ;
+
+// access the implementations via names
+import com.sun.star.uno.XInterface;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XActiveDataSource;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.xml.sax.XDocumentHandler;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.xml.sax.XLocator;
+import com.sun.star.xml.sax.XAttributeList;
+import com.sun.star.xml.sax.XParser ;
+import com.sun.star.xml.sax.InputSource ;
+import com.sun.star.lang.XComponent;
+import com.sun.star.document.XExporter;
+import com.sun.star.document.XImporter;
+import com.sun.star.document.XFilter;
+
+
+public class XMLTools {
+
+ /**
+ * The implementation of <code>com.sun.star.xml.sax.XAttributeList</code>
+ * where attributes and their values can be added.
+ */
+ public static class AttributeList implements XAttributeList {
+ private static class Attribute {
+ public String Name ;
+ public String Type ;
+ public String Value ;
+ }
+ private Hashtable attrByName = new Hashtable() ;
+ private Vector attributes = new Vector() ;
+ private PrintWriter log = null ;
+
+ /**
+ * Creates a class instance.
+ */
+ public AttributeList() {}
+
+ /**
+ * Constructs a list which will report to <code>log</code>
+ * specified about each <code>XDocumentHandler</code> method
+ * call.
+ */
+ public AttributeList(PrintWriter log) {
+ this.log = log ;
+ }
+
+ public AttributeList(XAttributeList list) {
+ if (list == null) return ;
+ for (short i = 0; i < list.getLength(); i++) {
+ add(list.getNameByIndex(i), list.getTypeByIndex(i),
+ list.getValueByIndex(i)) ;
+ }
+ }
+
+ /**
+ * Adds an attribute with type and value specified.
+ * @param name The attribute name.
+ * @param type Value type (usually 'CDATA' used).
+ * @param value Attribute value.
+ */
+ public void add(String name, String type, String value) {
+ Attribute attr = new Attribute() ;
+ attr.Name = name ;
+ attr.Type = type ;
+ attr.Value = value ;
+ attributes.add(attr) ;
+ attrByName.put(attr.Name, attr) ;
+ }
+
+ /**
+ * Adds an attribute with value specified. As a type of
+ * value 'CDATA' string specified.
+ * @param name The attribute name.
+ * @param value Attribute value.
+ */
+ public void add(String name, String value) {
+ add(name, "CDATA", value) ;
+ }
+
+ /**
+ * Clears all attributes added before.
+ */
+ public void clear() {
+ attrByName.clear() ;
+ attributes.clear() ;
+ }
+
+ /***************************************
+ * XAttributeList methods
+ ****************************************/
+
+ public short getLength() {
+ if (log != null)
+ log.println("getLength() called -> " + attributes.size()) ;
+ return (short) attributes.size() ;
+ }
+
+ public String getNameByIndex(short idx) {
+ String name = ((Attribute) attributes.get(idx)).Name ;
+ if (log != null)
+ log.println("getNameByIndex(" + idx + ") called -> '" +
+ name + "'") ;
+ return name ;
+ }
+
+ public String getTypeByIndex(short idx) {
+ String type = ((Attribute) attributes.get(idx)).Type ;
+ if (log != null)
+ log.println("getTypeByIndex(" + idx + ") called -> '" +
+ type + "'") ;
+ return type;
+ }
+
+ public String getTypeByName(String name) {
+ String type = ((Attribute) attrByName.get(name)).Type ;
+ if (log != null)
+ log.println("getTypeByName('" + name + "') called -> '" +
+ type + "'") ;
+ return type;
+ }
+ public String getValueByIndex(short idx) {
+ String value = ((Attribute) attributes.get(idx)).Value ;
+ if (log != null)
+ log.println("getValueByIndex(" + idx + ") called -> '" +
+ value + "'") ;
+ return value;
+ }
+
+ public String getValueByName(String name) {
+ String value = ((Attribute) attrByName.get(name)).Value ;
+ if (log != null)
+ log.println("getValueByName('" + name + "') called -> '" +
+ value + "'") ;
+ return value;
+ }
+ }
+
+ /**
+ * This class writes all XML data handled into a stream specified
+ * in the constructor.
+ */
+ public static class XMLWriter implements XDocumentHandler {
+ private PrintWriter _log = null ;
+ private XLocator loc = null;
+ private String align = "" ;
+
+ /**
+ * Creates a SAX handler which writes all XML data
+ * handled into a <code>log</code> stream specified.
+ */
+ public XMLWriter(PrintWriter log) {
+ _log = log ;
+ }
+
+ /**
+ * Creates a SAX handler which does nothing.
+ */
+ public XMLWriter() {
+ }
+
+ public void processingInstruction(String appl, String data) {
+ if (_log == null) return ;
+ _log.println(align + "<?" + appl + " " + data + "?>") ;
+ }
+ public void startDocument() {
+ if (_log == null) return ;
+ _log.println("START DOCUMENT:") ;
+ }
+ public void endDocument() {
+ if (_log == null) return ;
+ _log.println("END DOCUMENT:") ;
+ }
+ public void setDocumentLocator(XLocator loc) {
+ if (_log == null) return ;
+ _log.println("DOCUMENT LOCATOR: ('" + loc.getPublicId() +
+ "','" + loc.getSystemId() + "')") ;
+ }
+ public void startElement(String name, XAttributeList attr) {
+ if (_log == null) return ;
+ _log.print(align + "<" + name + " ") ;
+ if (attr != null) {
+ short attrLen = attr.getLength() ;
+ for (short i = 0; i < attrLen; i++) {
+ if (i != 0) _log.print(align + " ") ;
+ _log.print(attr.getNameByIndex(i) + "[" +
+ attr.getTypeByIndex(i) + "]=\"" +
+ attr.getValueByIndex(i) + "\"") ;
+ if (i+1 != attrLen) {
+ _log.println() ;
+ }
+ }
+ }
+ _log.println(">") ;
+
+ align += " " ;
+ }
+
+ public void endElement(String name) {
+ if (_log == null) return ;
+ align = align.substring(3) ;
+ _log.println(align + "</" + name + ">") ;
+ }
+
+ public void characters(String chars) {
+ if (_log == null) return ;
+ _log.println(align + chars) ;
+ }
+ public void ignorableWhitespace(String sp) {
+ if (_log == null) return ;
+ _log.println(sp) ;
+ }
+ }
+
+ /**
+ * Checks if the XML structure is well formed (i.e. all tags opened must be
+ * closed and all tags opened inside a tag must be closed
+ * inside the same tag). It also checks parameters passed.
+ * If any collisions found appropriate error message is
+ * output into a stream specified. No XML data output, i.e.
+ * no output will be performed if no errors occur.<p>
+ * After document is completed there is a way to cehck
+ * if the XML data and structure was valid.
+ */
+ public static class XMLWellFormChecker extends XMLWriter {
+ protected boolean docStarted = false ;
+ protected boolean docEnded = false ;
+ protected Vector tagStack = new Vector() ;
+ protected boolean wellFormed = true ;
+ protected boolean noOtherErrors = true ;
+ protected PrintWriter log = null ;
+ protected boolean printXMLData = false ;
+
+ public XMLWellFormChecker(PrintWriter log) {
+ super() ;
+ this.log = log ;
+ }
+
+ public XMLWellFormChecker(PrintWriter log_, boolean printXMLData) {
+ super(printXMLData ? log_ : null) ;
+ this.printXMLData = printXMLData ;
+ this.log = log_ ;
+ }
+
+ /**
+ * Reset all values. This is important e.g. for test of XFilter
+ * interface, where 'filter()' method istbstarted twice.
+ */
+ public void reset() {
+ docStarted = false ;
+ docEnded = false ;
+ tagStack = new Vector() ;
+ wellFormed = true ;
+ noOtherErrors = true ;
+ PrintWriter log = null ;
+ printXMLData = false ;
+ }
+
+ public void startDocument() {
+ super.startDocument();
+
+ if (docStarted) {
+ printError("Document is started twice.") ;
+ wellFormed = false ;
+ }
+
+ docStarted = true ;
+ }
+ public void endDocument() {
+ super.endDocument();
+ if (!docStarted) {
+ wellFormed = false ;
+ printError("Document ended but not started.") ;
+ }
+ docEnded = true ;
+ }
+ public void startElement(String name, XAttributeList attr) {
+ super.startElement(name, attr);
+ if (attr == null) {
+ printError("attribute list passed as parameter to startElement()"+
+ " method has null value for tag <" + name + ">") ;
+ noOtherErrors = false ;
+ }
+ tagStack.add(0, name) ;
+ }
+ public void endElement(String name) {
+ super.endElement(name);
+ if (wellFormed) {
+ if (tagStack.size() == 0) {
+ wellFormed = false ;
+ printError("No tags to close (bad closing tag </" + name + ">)") ;
+ } else {
+ String startTag = (String) tagStack.elementAt(0) ;
+ tagStack.remove(0) ;
+ if (!startTag.equals(name)) {
+ wellFormed = false ;
+ printError("Bad closing tag: </" + name +
+ ">; tag expected: </" + startTag + ">");
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if there were no errors during document handling.
+ * I.e. startDocument() and endDocument() must be called,
+ * XML must be well formed, paramters must be valid.
+ */
+ public boolean isWellFormed() {
+ if (!docEnded) {
+ printError("Document was not ended.") ;
+ wellFormed = false ;
+ }
+
+ return wellFormed && noOtherErrors ;
+ }
+
+ /**
+ * Prints error message and all tags where error occured inside.
+ * Also prints "Tag trace" in case if the full XML data isn't
+ * printed.
+ */
+ public void printError(String msg) {
+ log.println("!!! Error: " + msg) ;
+ if (printXMLData) return ;
+ log.println(" Tag trace :") ;
+ for (int i = 0; i < tagStack.size(); i++) {
+ String tag = (String) tagStack.elementAt(i) ;
+ log.println(" <" + tag + ">") ;
+ }
+ }
+ }
+
+ /**
+ * Beside structure of XML this class also can check existence
+ * of tags, inner tags, and character data. After document
+ * completion there is a way to check if required tags and
+ * character data was found. If there any error occurs an
+ * appropriate message is output.
+ */
+ public static class XMLTagsChecker extends XMLWellFormChecker {
+ protected Hashtable tags = new Hashtable() ;
+ protected Hashtable chars = new Hashtable() ;
+ protected boolean allOK = true ;
+
+ public XMLTagsChecker(PrintWriter log) {
+ super(log) ;
+ }
+
+ /**
+ * Adds a tag name which must be contained in the XML data.
+ */
+ public void addTag(String tag) {
+ tags.put(tag, "") ;
+ }
+ /**
+ * Adds a tag name which must be contained in the XML data and
+ * must be inside the tag with name <code>outerTag</code>.
+ */
+ public void addTagEnclosed(String tag, String outerTag) {
+ tags.put(tag, outerTag) ;
+ }
+ /**
+ * Adds a character data which must be contained in the XML data.
+ */
+ public void addCharacters(String ch) {
+ chars.put(ch, "") ;
+ }
+ /**
+ * Adds a character data which must be contained in the XML data and
+ * must be inside the tag with name <code>outerTag</code>.
+ */
+ public void addCharactersEnclosed(String ch, String outerTag) {
+ chars.put(ch, outerTag) ;
+ }
+
+ public void startElement(String name, XAttributeList attrs) {
+ super.startElement(name, attrs) ;
+ if (tags.containsKey(name)) {
+ String outerTag = (String) tags.get(name);
+ if (!outerTag.equals("")) {
+ boolean isInTag = false ;
+ for (int i = 0; i < tagStack.size(); i++) {
+ if (outerTag.equals((String) tagStack.elementAt(i))) {
+ isInTag = true ;
+ break ;
+ }
+ }
+ if (!isInTag) {
+ printError("Required tag <" + name + "> found, but is not enclosed in tag <" +
+ outerTag + ">") ;
+ allOK = false ;
+ }
+ }
+ tags.remove(name) ;
+ }
+ }
+
+ public void characters(String ch) {
+ super.characters(ch) ;
+ ch.trim() ;
+
+ if (chars.containsKey(ch)) {
+ String outerTag = (String) chars.get(ch);
+ if (!outerTag.equals("")) {
+ boolean isInTag = false ;
+ for (int i = 0; i < tagStack.size(); i++) {
+ if (outerTag.equals((String) tagStack.elementAt(i))) {
+ isInTag = true ;
+ break ;
+ }
+ }
+ if (!isInTag) {
+ printError("Required characters '" + ch + "' found, but are not enclosed in tag <" +
+ outerTag + ">") ;
+ allOK = false ;
+ }
+ }
+ chars.remove(ch) ;
+ }
+ }
+
+ /**
+ * Checks if the XML data was valid and well formed and if
+ * all necessary tags and character data was found.
+ */
+ public boolean checkTags() {
+ allOK &= isWellFormed() ;
+
+ Enumeration badTags = tags.keys() ;
+ Enumeration badChars = chars.keys() ;
+
+ if (badTags.hasMoreElements()) {
+ allOK = false ;
+ log.println("Required tags were not found in export :") ;
+ while(badTags.hasMoreElements()) {
+ log.println(" <" + ((String) badTags.nextElement()) + ">") ;
+ }
+ }
+ if (badChars.hasMoreElements()) {
+ allOK = false ;
+ log.println("Required characters were not found in export :") ;
+ while(badChars.hasMoreElements()) {
+ log.println(" <" + ((String) badChars.nextElement()) + ">") ;
+ }
+ }
+ reset();
+ return allOK ;
+ }
+ }
+
+ /**
+ * Represents an XML tag which must be found in XML data written.
+ * This tag can contain only its name or tag name and attribute
+ * name, or attribute value additionally.
+ */
+ public static class Tag {
+ private String name = null;
+ private String[][] attrList = new String[0][3] ;
+
+ /**
+ * Creates tag which has only a name. Attributes don't make sense.
+ * @param tagName The name of the tag.
+ */
+ public Tag(String tagName) {
+ name = tagName ;
+ }
+
+ /**
+ * Creates a tag with the name specified, which must have an
+ * attribute with name specified. The value of this attribute
+ * doesn't make sense.
+ * @param tagName The name of the tag.
+ * @param attrName The name of attribute which must be contained
+ * in the tag.
+ */
+ public Tag(String tagName, String attrName) {
+ name = tagName ;
+ attrList = new String[1][3] ;
+ attrList[0][0] = attrName ;
+ }
+
+ /**
+ * Creates a tag with the name specified, which must have an
+ * attribute with the value specified. The type of value
+ * assumed to be 'CDATA'.
+ * @param tagName The name of the tag.
+ * @param attrName The name of attribute which must be contained
+ * in the tag.
+ * @param attrValue Attribute value.
+ */
+ public Tag(String tagName, String attrName, String attrValue) {
+ name = tagName ;
+ attrList = new String[1][3] ;
+ attrList[0][0] = attrName ;
+ attrList[0][1] = "CDATA" ;
+ attrList[0][2] = attrValue ;
+ }
+
+ /**
+ * Creates a tag with the name specified, which must have
+ * attributes specified. The value of thesee attributes
+ * doesn't make sense.
+ * @param tagName The name of the tag.
+ * @param attrNames Array with names of attributes which must
+ * be contained in the tag.
+ */
+ public Tag(String tagName, String[] attrNames) {
+ name = tagName ;
+ attrList = new String[attrNames.length][3] ;
+ for (int i = 0; i < attrNames.length; i++) {
+ attrList[i][0] = attrNames[i] ;
+ }
+ }
+
+ /**
+ * Creates a tag with the name specified, which must have an
+ * attributes with their values specified. The type of all values
+ * assumed to be 'CDATA'.
+ * @param tagName The name of the tag.
+ * @param attrValues An array with attribute names and their values.
+ * <code>attrValues[N][0]</code> element contains the name of Nth
+ * attribute, and <code>attrValues[N][1]</code> element contains
+ * value of Nth attribute, if value is <code>null</code> then the
+ * attribute value can be any.
+ */
+ public Tag(String tagName, String[][] attrValues) {
+ name = tagName ;
+ attrList = new String[attrValues.length][3] ;
+ for (int i = 0; i < attrValues.length; i++) {
+ attrList[i][0] = attrValues[i][0] ;
+ attrList[i][1] = "CDATA" ;
+ attrList[i][2] = attrValues[i][1] ;
+ }
+ }
+
+ /**
+ * Gets tag String description.
+ */
+ public String toString() {
+ String ret = "<" + name ;
+ for (int i = 0; i < attrList.length; i++) {
+ ret += " " + attrList[i][0] + "=";
+ if (attrList[i][2] == null) {
+ ret += "(not specified)";
+ } else {
+ ret += "\"" + attrList[i][2] + "\"";
+ }
+ }
+ ret += ">";
+
+ return ret ;
+ }
+
+ protected boolean checkAttr(int attrListIdx, XAttributeList list) {
+ short j = 0 ;
+ int listLen = list.getLength();
+ while(j < listLen) {
+ if (attrList[attrListIdx][0].equals(list.getNameByIndex(j))) {
+ if (attrList[attrListIdx][2] == null) return true ;
+ return attrList[attrListIdx][2].equals(list.getValueByIndex(j)) ;
+ }
+ j++ ;
+ }
+ return false ;
+ }
+
+ /**
+ * Checks if this tag matches tag passed in parameters.
+ * I.e. if tag specifies only it's name it mathes if names
+ * are equal (attributes don't make sense). If there are
+ * some attributes names specified in this tag method checks
+ * if all names present in attribute list <code>list</code>
+ * (attributes' values don't make sense). If attributes specified
+ * with values method checks if these attributes exist and
+ * have appropriate values.
+ */
+ public boolean isMatchTo(String tagName, XAttributeList list) {
+ if (!name.equals(tagName)) return false;
+ boolean result = true ;
+ for (int i = 0; i < attrList.length; i++) {
+ result &= checkAttr(i, list) ;
+ }
+ return result ;
+ }
+ }
+
+ /**
+ * Class realises extended XML data checking. It has possibilities
+ * to check if a tag exists, if it has some attributes with
+ * values, and if this tag is contained in another tag (which
+ * also can specify any attributes). It can check if some
+ * character data exists inside any tag specified.
+ */
+ public static class XMLChecker extends XMLWellFormChecker {
+ protected HashSet tagSet = new HashSet() ;
+ protected Vector tags = new Vector() ;
+ protected Vector chars = new Vector() ;
+ protected Vector tagStack = new Vector() ;
+ protected Vector attrStack = new Vector() ;
+
+ public XMLChecker(PrintWriter log, boolean writeXML) {
+ super(log, writeXML) ;
+ }
+
+ public void addTag(Tag tag) {
+ tags.add(new Tag[] {tag, null}) ;
+ tagSet.add(tag.name) ;
+ }
+
+ public void addTagEnclosed(Tag tag, Tag outerTag) {
+ tags.add(new Tag[] {tag, outerTag}) ;
+ tagSet.add(tag.name) ;
+ }
+
+ public void addCharacters(String ch) {
+ chars.add(new Object[] {ch.trim(), null}) ;
+ }
+
+ public void addCharactersEnclosed(String ch, Tag outerTag) {
+ chars.add(new Object[] {ch.trim(), outerTag}) ;
+ }
+
+ public void startElement(String name, XAttributeList attr) {
+ try {
+ super.startElement(name, attr);
+
+ if (tagSet.contains(name)) {
+ for (int i = 0; i < tags.size(); i++) {
+ Tag[] tag = (Tag[]) tags.elementAt(i);
+ if (tag[0].isMatchTo(name, attr)) {
+ if (tag[1] == null) {
+ tags.remove(i--);
+ } else {
+ boolean isInStack = false ;
+ for (int j = 0; j < tagStack.size(); j++) {
+ if (tag[1].isMatchTo((String) tagStack.elementAt(j),
+ (XAttributeList) attrStack.elementAt(j))) {
+
+ isInStack = true ;
+ break ;
+ }
+ }
+ if (isInStack) {
+ tags.remove(i--) ;
+ }
+ }
+ }
+ }
+ }
+
+ tagStack.add(0, name) ;
+ attrStack.add(0, new AttributeList(attr));
+ } catch (Exception e) {
+ e.printStackTrace(log);
+ }
+ }
+
+ public void characters(String ch) {
+ super.characters(ch) ;
+ ch.trim();
+ for (int i = 0; i < chars.size(); i++) {
+ Object[] chr = (Object[]) chars.elementAt(i);
+ if (((String) chr[0]).equals(ch)) {
+ if (chr[1] == null) {
+ chars.remove(i--);
+ } else {
+ boolean isInStack = false ;
+ for (int j = 0; j < tagStack.size(); j++) {
+ if (((Tag) chr[1]).isMatchTo((String) tagStack.elementAt(j),
+ (XAttributeList) attrStack.elementAt(j))) {
+
+ isInStack = true ;
+ break ;
+ }
+ }
+ if (isInStack) {
+ chars.remove(i--) ;
+ }
+ }
+ }
+ }
+ }
+
+ public void endElement(String name) {
+ try {
+ super.endElement(name);
+
+ if (tagStack.size() > 0) {
+ tagStack.remove(0) ;
+ attrStack.remove(0) ;
+ }
+ } catch(Exception e) {
+ e.printStackTrace(log) ;
+ }
+ }
+
+ public boolean check() {
+ if (tags.size()> 0) {
+ log.println("!!! Error: Some tags were not found :") ;
+ for (int i = 0; i < tags.size(); i++) {
+ Tag[] tag = (Tag[]) tags.elementAt(i) ;
+ log.println(" Tag " + tag[0] + " was not found");
+ if (tag[1] != null)
+ log.println(" inside tag " + tag[1]) ;
+ }
+ }
+ if (chars.size() > 0) {
+ log.println("!!! Error: Some character data blocks were not found :") ;
+ for (int i = 0; i < chars.size(); i++) {
+ Object[] ch = (Object[]) chars.elementAt(i) ;
+ log.println(" Character data \"" + ch[0] + "\" was not found ") ;
+ if (ch[1] != null)
+ log.println(" inside tag " + ch[1]) ;
+ }
+ }
+
+ if (!isWellFormed())
+ log.println("!!! Some errors were found in XML structure") ;
+
+ boolean result = tags.size() == 0 && chars.size() == 0 && isWellFormed();
+ reset();
+ return result;
+ }
+ }
+
+ /**
+ * Creates <code>XDocumentHandler</code> implementation in form
+ * of <code>com.sun.star.xml.sax.Writer</code> service, which
+ * writes XML data into a <code>com.sun.star.io.Pipe</code>
+ * created.
+ * @return Single element array which contains the handler
+ * contained in <code>Any</code> structure.
+ */
+ public static Object[] getDocumentHandler(XMultiServiceFactory xMSF) {
+ Object[] ret = new Object[1];
+ try {
+ XInterface Writer = (XInterface) xMSF.createInstance(
+ "com.sun.star.xml.sax.Writer");
+ XInterface oPipe = (XInterface) xMSF.createInstance
+ ( "com.sun.star.io.Pipe" );
+ XOutputStream xPipeOutput = (XOutputStream) UnoRuntime.
+ queryInterface(XOutputStream.class, oPipe) ;
+
+ XActiveDataSource xADS = (XActiveDataSource)
+ UnoRuntime.queryInterface(XActiveDataSource.class,Writer);
+ xADS.setOutputStream(xPipeOutput);
+ XDocumentHandler handler = (XDocumentHandler)
+ UnoRuntime.queryInterface(XDocumentHandler.class,Writer);
+
+ Any arg = new Any(new Type(XDocumentHandler.class),handler);
+
+ ret[0] = arg;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ return ret;
+ }
+
+ public static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) {
+ PropertyValue[] props = new PropertyValue[propNames.length] ;
+
+ for (int i = 0; i < props.length; i++) {
+ props[i] = new PropertyValue() ;
+ props[i].Name = propNames[i] ;
+ if (values != null && i < values.length) {
+ props[i].Value = values[i] ;
+ }
+ }
+
+ return props ;
+ }
+
+ /**
+ * Gets the hanlder, which writes all the XML data passed to the
+ * file specified.
+ * @param xMSF Soffice <code>ServiceManager</code> factory.
+ * @param fileURL The file URL (in form file:///<path>) to which
+ * XML data is written.
+ * @return SAX handler to which XML data has to be written.
+ */
+ public static XDocumentHandler getFileXMLWriter(XMultiServiceFactory xMSF, String fileURL)
+ throws com.sun.star.uno.Exception
+ {
+ XInterface oFacc = (XInterface)xMSF.createInstance(
+ "com.sun.star.comp.ucb.SimpleFileAccess");
+ XSimpleFileAccess xFacc = (XSimpleFileAccess)UnoRuntime.queryInterface
+ (XSimpleFileAccess.class, oFacc) ;
+
+ XInterface oWriter = (XInterface)xMSF.createInstance(
+ "com.sun.star.xml.sax.Writer");
+ XActiveDataSource xWriterDS = (XActiveDataSource)
+ UnoRuntime.queryInterface(XActiveDataSource.class, oWriter);
+ XDocumentHandler xDocHandWriter = (XDocumentHandler) UnoRuntime.queryInterface
+ (XDocumentHandler.class, oWriter) ;
+
+ if (xFacc.exists(fileURL))
+ xFacc.kill(fileURL);
+ XOutputStream fOut = xFacc.openFileWrite(fileURL) ;
+ xWriterDS.setOutputStream(fOut);
+
+ return xDocHandWriter ;
+ }
+
+ /**
+ * Parses XML file and passes its data to the SAX handler specified.
+ * @param xMSF Soffice <code>ServiceManager</code> factory.
+ * @param fileURL XML file name (in form file:///<path>) to be parsed.
+ * @param handler SAX handler to which XML data from file will
+ * be transferred.
+ */
+ public static void parseXMLFile(XMultiServiceFactory xMSF,
+ String fileURL, XDocumentHandler handler) throws com.sun.star.uno.Exception
+ {
+ XInterface oFacc = (XInterface)xMSF.createInstance(
+ "com.sun.star.comp.ucb.SimpleFileAccess");
+ XSimpleFileAccess xFacc = (XSimpleFileAccess)UnoRuntime.queryInterface
+ (XSimpleFileAccess.class, oFacc) ;
+ XInputStream oIn = xFacc.openFileRead(fileURL) ;
+
+ XInterface oParser = (XInterface)xMSF.createInstance(
+ "com.sun.star.xml.sax.Parser");
+ XParser xParser = (XParser) UnoRuntime.queryInterface(XParser.class, oParser);
+
+ xParser.setDocumentHandler(handler) ;
+ InputSource inSrc = new InputSource() ;
+ inSrc.aInputStream = oIn ;
+ xParser.parseStream(inSrc) ;
+
+ oIn.closeInput();
+ }
+
+ /**
+ * Exports document (the whole or a part) into the file specified
+ * in XML format.
+ * @param xMSF Soffice <code>ServiceManager</code> factory.
+ * @param xDoc Document to be exported.
+ * @param docType Type of document (for example 'Calc', 'Writer', 'Draw')
+ * The type must start with <b>capital</b> letter.
+ * @param exportType The type of export specifies if the whole
+ * document will be exported or one of its parts (Meta info, Styles, etc.).
+ * The following types supported (it also depends of document type) :
+ * "" (empty string) - for the whole document ;
+ * "Content" - only content exported ;
+ * "Meta" - meta document info exported ;
+ * "Settings" - view settings of document exported ;
+ * "Styles" - document styles exported ;
+ * @param fileURL XML file name (in form file:///<path>) to be exported to.
+ */
+ public static void exportDocument(XMultiServiceFactory xMSF, XComponent xDoc,
+ String docType, String exportType, String fileURL)
+ throws com.sun.star.uno.Exception {
+
+ XDocumentHandler xDocHandWriter = XMLTools.getFileXMLWriter(xMSF, fileURL) ;
+
+ Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter);
+ XInterface oExp = (XInterface)xMSF.createInstanceWithArguments(
+ "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter",
+ new Object[] {arg});
+
+ XExporter xExp = (XExporter) UnoRuntime.queryInterface
+ (XExporter.class, oExp) ;
+ xExp.setSourceDocument(xDoc) ;
+
+ XFilter filter = (XFilter) UnoRuntime.queryInterface(XFilter.class, oExp) ;
+ filter.filter(XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"Custom filter"})) ;
+ }
+
+ /**
+ * Imports document (the whole or a part) from the file specified
+ * in XML format.
+ * @param xMSF Soffice <code>ServiceManager</code> factory.
+ * @param xDoc Target document to be imported.
+ * @param docType Type of document (for example 'Calc', 'Writer', 'Draw')
+ * The type must start with <b>capital</b> letter.
+ * @param exportType The type of export specifies if the whole
+ * document will be exported or one of its parts (Meta info, Styles, etc.).
+ * The following types supported (it hardly depends of XML data in file) :
+ * "" (empty string) - for the whole document ;
+ * "Content" - only content exported ;
+ * "Meta" - meta document info exported ;
+ * "Settings" - view settings of document exported ;
+ * "Styles" - document styles exported ;
+ * @param fileURL XML file name (in form file:///<path>) to be imported from.
+ */
+ public static void importDocument(XMultiServiceFactory xMSF, XComponent xDoc,
+ String docType, String importType, String fileURL)
+ throws com.sun.star.uno.Exception {
+
+ XInterface oImp = (XInterface)xMSF.createInstance(
+ "com.sun.star.comp." + docType + ".XML" + importType + "Importer");
+ XImporter xImp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oImp) ;
+ XDocumentHandler xDocHandImp = (XDocumentHandler) UnoRuntime.queryInterface
+ (XDocumentHandler.class, oImp) ;
+
+ xImp.setTargetDocument(xDoc) ;
+ parseXMLFile(xMSF, fileURL, xDocHandImp) ;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java
new file mode 100644
index 000000000000..b9b1a44b6b16
--- /dev/null
+++ b/qadevOOo/runner/util/dbg.java
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * $RCSfile: dbg.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:27:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.ITypeDescription;
+import com.sun.star.uno.IMethodDescription;
+import java.io.PrintWriter;
+import java.io.OutputStream;
+
+/**
+ * This class accumulates all kinds of methods for accessing debug information
+ * from UNO implementations.
+ */
+public class dbg {
+
+ /**
+ * Prints information about the supported interfaces of an implementation
+ * to standard out.
+ * @param xTarget The implementation which should be analysed.
+ * @see com.sun.star.uno.XInterface
+ */
+ public static void printInterfaces(XInterface xTarget) {
+ printInterfaces(xTarget, false);
+ }
+
+ /**
+ * Prints information about the supported interfaces of an implementation
+ * to standard out. Extended information can be printed.
+ * @param xTarget The implementation which should be analysed.
+ * @param extendedInfo Should extended information be printed?
+ * @see com.sun.star.uno.XInterface
+ */
+ public static void printInterfaces(XInterface xTarget,
+ boolean extendedInfo){
+ Type[] types = getInterfaceTypes(xTarget);
+ if( null != types ) {
+ int nLen = types.length;
+ for( int i = 0; i < nLen ; i++ ) {
+ System.out.println(types[i].getTypeName());
+ if (extendedInfo) {
+ printInterfaceInfo(types[i]);
+ System.out.println();
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns all interface types of an implementation as a type array.
+ * @param xTarget The implementation which should be analyzed.
+ * @return An array with all interface types; null if there are none.
+ * @see com.sun.star.uno.XInterface
+ */
+ public static Type[] getInterfaceTypes(XInterface xTarget) {
+ Type[] types = null;
+ XTypeProvider xTypeProvider = (XTypeProvider)
+ UnoRuntime.queryInterface( XTypeProvider.class, xTarget);
+ if( xTypeProvider != null )
+ types = xTypeProvider.getTypes();
+ return types;
+ }
+
+ /**
+ * Returns true if a specified target implements the interface with the
+ * given name. Note that the comparison is not case sensitive.
+ * @param xTarget The implementation which should be analysed.
+ * @param ifcName The name of the interface that is tested. The name can
+ * be full qualified, such as 'com.sun.star.io.XInputStream', or only
+ * consist of the interface name, such as 'XText'.
+ * @return True, if xTarget implements the interface named ifcType
+ * @see com.sun.star.uno.XInterface
+ */
+ public static boolean implementsInterface(
+ XInterface xTarget, String ifcName) {
+ Type[] types = getInterfaceTypes(xTarget);
+ if( null != types ) {
+ int nLen = types.length;
+ for( int i = 0; i < nLen ; i++ ) {
+ if(types[i].getTypeName().toLowerCase().endsWith(
+ ifcName.toLowerCase()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Prints information about an interface type.
+ *
+ * @param aType The type of the given interface.
+ * @see com.sun.star.uno.Type
+ */
+ public static void printInterfaceInfo (Type aType) {
+ try {
+ ITypeDescription tDesc =
+ (ITypeDescription)aType.getTypeDescription();
+ int anz = tDesc.getMethodDescriptions().length;
+ for (int i=0;i<anz;i++) {
+ IMethodDescription mDesc = tDesc.getMethodDescriptions()[i];
+ System.out.print("\t"+
+ mDesc.getReturnSignature().getTypeName()+" ");
+ System.out.println(mDesc.getName() + "()");
+ }
+ }
+ catch (Exception ex) {
+ System.out.println("Exception occured while printing InterfaceInfo");
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Prints a string array to standard out.
+ *
+ * @param entries : The array to be printed.
+ */
+ public static void printArray( String [] entries ) {
+ for ( int i=0; i< entries.length;i++ ) {
+ System.out.println(entries[i]);
+ }
+ }
+
+ /**
+ * Print all information about the property <code>name</code> from
+ * the property set <code>PS</code> to standard out.
+ * @param PS The property set which should contain a property called
+ * <code>name</code>.
+ * @param name The name of the property.
+ * @see com.sun.star.beans.XPropertySet
+ */
+ public static void printPropertyInfo(XPropertySet PS, String name) {
+ printPropertyInfo(PS, name, new PrintWriter(System.out)) ;
+ }
+
+ /**
+ * Print all information about the property <code>name</code> from
+ * the property set <code>PS</code> to a print writer.
+ * @param PS The property set which should contain a property called
+ * <code>name</code>.
+ * @param name The name of the property.
+ * @param out The print writer which is used as output.
+ * @see com.sun.star.beans.XPropertySet
+ */
+ public static void printPropertyInfo(XPropertySet PS, String name,
+ PrintWriter out) {
+ try {
+ XPropertySetInfo PSI = PS.getPropertySetInfo();
+ Property[] props = PSI.getProperties();
+ Property prop = PSI.getPropertyByName(name);
+ out.println("Property name is " + prop.Name);
+ out.println("Property handle is " + prop.Handle);
+ out.println("Property type is " + prop.Type.getTypeName());
+ out.println("Property current value is " +
+ PS.getPropertyValue(name));
+ out.println("Attributes :");
+ short attr = prop.Attributes;
+
+ if ((attr & PropertyAttribute.BOUND) != 0)
+ out.println("\t-BOUND");
+
+ if ((attr & PropertyAttribute.CONSTRAINED) != 0)
+ out.println("\t-CONSTRAINED");
+
+ if ((attr & PropertyAttribute.MAYBEAMBIGUOUS) != 0)
+ out.println("\t-MAYBEAMBIGUOUS");
+
+ if ((attr & PropertyAttribute.MAYBEDEFAULT) != 0)
+ out.println("\t-MAYBEDEFAULT");
+
+ if ((attr & PropertyAttribute.MAYBEVOID) != 0)
+ out.println("\t-MAYBEVOID");
+
+ if ((attr & PropertyAttribute.READONLY) != 0)
+ out.println("\t-READONLY");
+
+ if ((attr & PropertyAttribute.REMOVEABLE) != 0)
+ out.println("\t-REMOVEABLE");
+
+ if ((attr & PropertyAttribute.TRANSIENT) != 0)
+ out.println("\t-TRANSIENT");
+ } catch(com.sun.star.uno.Exception e) {
+ out.println("Exception!!!!");
+ e.printStackTrace(out);
+ }
+ }
+
+ /**
+ * Print the names of all properties inside this property set
+ * @param ps The property set which is printed.
+ * @see com.sun.star.beans.XPropertySet
+ */
+ public static void printPropertiesNames(XPropertySet ps) {
+ XPropertySetInfo psi = ps.getPropertySetInfo();
+ Property[] props = psi.getProperties();
+ for (int i = 0; i < props.length; i++)
+ System.out.println(i + ". " + props[i].Name);
+ }
+
+ /**
+ * Print the supported services of a UNO object.
+ * @param aObject A UNO object.
+ */
+ public static void getSuppServices (Object aObject) {
+ XServiceInfo xSI = (XServiceInfo)
+ UnoRuntime.queryInterface(XServiceInfo.class,aObject);
+ printArray(xSI.getSupportedServiceNames());
+ String str="Therein not Supported Service";
+ boolean notSupportedServices = false;
+ for (int i=0;i<xSI.getSupportedServiceNames().length;i++) {
+ if (! xSI.supportsService(xSI.getSupportedServiceNames()[i])) {
+ notSupportedServices = true;
+ str+="\n" + xSI.getSupportedServiceNames()[i];
+ }
+ }
+ if (notSupportedServices)
+ System.out.println(str);
+ }
+
+ /**
+ * Get the unique implementation id of a UNO object.
+ * @param xTarget An implementation of a UNO object.
+ * @return The implementation id.
+ */
+ public static String getImplID( XInterface xTarget ) {
+ String str = "";
+ XTypeProvider xTypeProvider = (XTypeProvider)
+ UnoRuntime.queryInterface( XTypeProvider.class, xTarget);
+ if( xTypeProvider != null ) {
+ byte[] id = xTypeProvider.getImplementationId();
+ str = "ImplementationID: ";
+ for (int i=0; i<id.length;i++) {
+ Byte b = new Byte(id[i]);
+ str += b.intValue();
+ }
+ } else {
+ str = "No Implementation ID available";
+ }
+ return str;
+ }
+
+
+} \ No newline at end of file
diff --git a/qadevOOo/runner/util/makefile.mk b/qadevOOo/runner/util/makefile.mk
new file mode 100644
index 000000000000..c82af1393ae5
--- /dev/null
+++ b/qadevOOo/runner/util/makefile.mk
@@ -0,0 +1,110 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Date: 2003-01-27 16:26:50 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME = Runner
+PACKAGE = util
+TARGET = $(PRJNAME)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+JARFILES = sandbox.jar ridl.jar jurt.jar unoil.jar
+
+JAVAFILES = AccessibilityTools.java \
+ FrameDsc.java \
+ TableDsc.java \
+ BookmarkDsc.java \
+ InstCreator.java \
+ TextSectionDsc.java \
+ ControlDsc.java \
+ InstDescr.java \
+ ValueChanger.java \
+ DBTools.java \
+ ParagraphDsc.java \
+ ValueComparer.java \
+ DefaultDsc.java \
+ ReferenceMarkDsc.java \
+ WriterTools.java \
+ DesktopTools.java \
+ RegistryTools.java \
+ XInstCreator.java \
+ DrawTools.java \
+ SOfficeFactory.java \
+ XMLTools.java \
+ FootnoteDsc.java \
+ ShapeDsc.java \
+ dbg.java \
+ FormTools.java \
+ StyleFamilyDsc.java \
+ SysUtils.java \
+ utils.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
new file mode 100644
index 000000000000..b6afcc558142
--- /dev/null
+++ b/qadevOOo/runner/util/utils.java
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * $RCSfile: utils.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change:$Date: 2003-01-27 16:26:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package util;
+
+import java.lang.System;
+import java.util.StringTokenizer;
+import java.io.*;
+import java.util.ArrayList;
+import java.io.RandomAccessFile;
+import java.net.Socket;
+import java.net.ServerSocket;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.Property;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.lang.XServiceInfo;
+
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+//For database connection
+import java.sql.*;
+
+public class utils {
+
+ /**
+ *
+ * This method adds the DOCPTH to a given file
+ *
+ */
+ public static String getFullTestDocName( String sDocName ) {
+ String docpth = System.getProperty("DOCPTH");
+ if (docpth.endsWith("\\") || docpth.endsWith("/"))
+ docpth = docpth.substring(0, docpth.length() - 1) ;
+
+ if (docpth.startsWith("http:")) {
+ return docpth+"/"+sDocName;
+ }
+ String testdocPth = "";
+ String pthSep = System.getProperty("file.separator");
+ if (docpth == null ) {
+ String objdscPth = System.getProperty("OBJDSCS");
+ int i = objdscPth.indexOf("objdsc");
+ String arcPth = objdscPth.substring(0,i-1);
+ testdocPth = arcPth + pthSep + "doc" + pthSep + "java" +
+ pthSep + "testdocs" + pthSep + sDocName;
+ }
+ else {
+ testdocPth = docpth + pthSep + sDocName;
+ }
+ return testdocPth;
+ }
+
+ /**
+ *
+ * This method adds the DOCPTH to a given file
+ * and changes the format to an file URL
+ *
+ */
+
+ public static String getFullTestURL( String sDocName ) {
+ String fullDocPath = getFullTestDocName(sDocName);
+ if (fullDocPath.startsWith("http:")) {
+ return fullDocPath;
+ }
+ if (fullDocPath.startsWith("file:")) {
+ return fullDocPath;
+ }
+ fullDocPath = fullDocPath.replace('\\','/');
+ String prefix = "";
+ if (fullDocPath.startsWith("/")) prefix="file://";
+ else prefix="file:///";
+ if (!fullDocPath.endsWith("/")) {
+ File aFile = new File(fullDocPath);
+ if (aFile.isDirectory()) {
+ fullDocPath +="/";
+ }
+ }
+ String fulldocURL = prefix+fullDocPath;
+ return fulldocURL;
+ }
+
+ /**
+ *
+ * This method changes a given URL to a valid file URL
+ *
+ */
+
+ public static String getFullURL( String sDocName ) {
+ String fullDocPath = sDocName;
+ if (fullDocPath.startsWith("http:")) {
+ return fullDocPath;
+ }
+ if (fullDocPath.startsWith("file:")) {
+ return fullDocPath;
+ }
+ if (fullDocPath.startsWith("ftp:")) {
+ return fullDocPath;
+ }
+ fullDocPath = fullDocPath.replace('\\','/');
+ String prefix = "";
+ if (fullDocPath.startsWith("/")) prefix="file://";
+ else prefix="file:///";
+ String fulldocURL = prefix+fullDocPath;
+ return fulldocURL;
+ }
+
+ /**
+ *
+ * This method creates folders needed
+ *
+ */
+
+
+ public static void make_Directories(String first, String path) {
+ String already_done = null;
+ String fs = System.getProperty("file.separator");
+ StringTokenizer path_tokenizer = new StringTokenizer(path,fs,false);
+ already_done = first;
+ while (path_tokenizer.hasMoreTokens()) {
+ String part = path_tokenizer.nextToken();
+ File new_dir = new File(already_done + File.separatorChar + part);
+ already_done = new_dir.toString();
+ //create the directory
+ new_dir.mkdirs();
+ }
+ return;
+ }
+
+ /**
+ *
+ * This method get the version for a given TestBase/platform combination
+ *
+ */
+
+ public static String getVersion(String aFile, String aPlatform, String aTestbase) {
+ if ( (aFile == null) || (aPlatform == null) || (aTestbase == null) ){
+ return "/";
+ }
+
+ File the_file = new File (aFile);
+ try {
+ RandomAccessFile raf = new RandomAccessFile(the_file, "r");
+ String res="";
+ while (!res.equals("["+aTestbase.toUpperCase()+"]")) {
+ res = raf.readLine();
+ }
+ res="=/";
+ while ( (!res.startsWith(aPlatform)) || (res.startsWith("[")) ) {
+ res = raf.readLine();
+ }
+ raf.close();
+ if (res.startsWith("[")) res="/";
+ return res.substring(res.indexOf("=")+1);
+
+ } catch (Exception e) {
+ System.out.println("Couldn't find version");
+ return "/";
+ }
+ }
+
+ /**
+ *
+ * This method get's the temp dir of the connected office
+ *
+ */
+
+ public static String getOfficeTemp (XMultiServiceFactory msf) {
+ String tmpDir = System.getProperty("java.io.tmpdir");
+ try {
+ Object settings = msf.createInstance("com.sun.star.frame.Settings");
+ if (settings == null) {
+ String td = getFullURL(tmpDir);
+ if (td == null)
+ td = getFullTestDocName("");
+ return td;
+ }
+ XNameAccess settingNames = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class,settings);
+ XPropertySet pthSettings = (XPropertySet) settingNames.getByName("PathSettings");
+ String tmp = (String) pthSettings.getPropertyValue("UserPath");
+ tmpDir = getFullURL(tmp+"/temp/");
+ } catch (Exception e) {
+ System.out.println("Couldn't get Office TEMP");
+ e.printStackTrace();
+ }
+ return tmpDir;
+ }
+
+ /**
+ * Gets StarOffice temp directory without 'file:///' prefix.
+ * For example is usefull for Registry URL specifying.
+ * @msf Office factory for accessing its settings.
+ * @return SOffice temporary directory in form for example
+ * 'd:/Office60/user/temp/'.
+ */
+ public static String getOfficeTempDir (XMultiServiceFactory msf) {
+
+ String dir = getOfficeTemp(msf) ;
+
+ int idx = dir.indexOf("file:///") ;
+
+ if (idx < 0) return dir ;
+
+ dir = dir.substring("file:///".length()) ;
+
+ idx = dir.indexOf(":") ;
+
+ // is the last character a '/' or a '\'?
+ boolean lastCharSet = dir.endsWith("/") || dir.endsWith("\\");
+
+ if (idx < 0) { // linux or solaris
+ dir = "/"+dir ;
+ dir += lastCharSet?"":"/";
+ }
+ else { // windows
+ dir += lastCharSet?"":"\\";
+ }
+
+ return dir;
+ }
+
+ /**
+ * Gets StarOffice temp directory without 'file:///' prefix.
+ * and System dependend file separator
+ */
+ public static String getOfficeTempDirSys (XMultiServiceFactory msf) {
+
+ String dir = getOfficeTemp(msf) ;
+ String sysDir = "";
+
+ int idx = dir.indexOf("file://") ;
+
+ // remove leading 'file://'
+ if (idx < 0) sysDir = dir;
+ else sysDir = dir.substring("file://".length());
+
+ // append '/' if not there (e.g. linux)
+ if ( sysDir.charAt(sysDir.length()-1) != '/' )
+ sysDir += "/";
+
+ // remove leading '/' and replace others with '\' on windows machines
+ String sep = System.getProperty("file.separator");
+ if (sep.equalsIgnoreCase("\\")) {
+ sysDir = sysDir.substring(1);
+ sysDir = sysDir.replace('/','\\');
+ }
+ return sysDir;
+ }
+
+ /**
+ *
+ * This method copies a given file to a new one
+ *
+ */
+ public static boolean copyFile (XMultiServiceFactory msf, String oldF, String newF) {
+ boolean res = false;
+ try {
+ Object fileacc = msf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
+ XSimpleFileAccess simpleAccess = (XSimpleFileAccess)
+ UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc);
+ if (!simpleAccess.exists(newF)) simpleAccess.copy(oldF,newF);
+
+ res = true;
+ } catch (Exception e) {
+ System.out.println("Couldn't copy file");
+ e.printStackTrace();
+ res = false;
+ }
+ return res;
+ }
+
+ /**
+ * Copies file to a new location using SOffice features. If the target
+ * file already exists, the file is deleted.
+ *
+ * @returns <code>true</code> if the file was successfully copied,
+ * <code>false</code> if some errors occured (e.g. file is locked, used
+ * by another process).
+ */
+ public static boolean overwriteFile(XMultiServiceFactory msf, String oldF, String newF) {
+ boolean res = false;
+ try {
+ Object fileacc = msf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
+
+ XSimpleFileAccess simpleAccess = (XSimpleFileAccess)
+ UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc);
+ if (simpleAccess.exists(newF)) simpleAccess.kill(newF);
+ simpleAccess.copy(oldF,newF);
+ res = true;
+ } catch (com.sun.star.ucb.InteractiveAugmentedIOException e) {
+ return false ;
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't create a service.");
+ e.printStackTrace();
+ }
+
+ return res;
+ }
+
+ public static boolean hasPropertyByName(XPropertySet props, String aName) {
+ Property[] list = props.getPropertySetInfo().getProperties();
+ boolean res = false;
+ for (int i=0;i<list.length;i++) {
+ String the_name = list[i].Name;
+ if (aName.equals(the_name)) res=true;
+ }
+ return res;
+ }
+
+ /**
+ *
+ * This method returns the implementation name of a given object
+ *
+ */
+
+ public static String getImplName (Object aObject) {
+ String res = "Error getting Implementation name";
+ try {
+ XServiceInfo xSI = (XServiceInfo)
+ UnoRuntime.queryInterface(XServiceInfo.class,aObject);
+ res = xSI.getImplementationName();
+ } catch (Exception e) {
+ res = "Error getting Implementation name ( "+e+" )";
+ }
+
+ return res;
+ }
+
+ /**
+ *
+ * This method checks if an Object is void
+ *
+ */
+
+ public static boolean isVoid (Object aObject) {
+ if (aObject instanceof com.sun.star.uno.Any) {
+ com.sun.star.uno.Any oAny = (com.sun.star.uno.Any) aObject;
+ return (oAny.getType().getTypeName().equals("void"));
+ } else {
+ return false;
+ }
+
+ }
+
+ /**
+ *
+ * This method replaces a substring with another
+ *
+ */
+
+ public static String replacePart (String all, String toReplace, String replacement) {
+ int where = 17;
+ while (all.indexOf(toReplace) > 0) {
+ where = all.indexOf(toReplace);
+ String left = all.substring(0,where);
+ String right = all.substring(where+toReplace.length(),all.length());
+ all = left + replacement + right;
+ }
+ return all;
+ }
+
+ /**
+ * Scan localhost for the next free port-number from a starting port
+ * on. If the starting port is smaller than 1024, port number starts with
+ * 10000 as default, because numbers < 1024 are never free on unix machines.
+ * @param startPort The port where scanning starts.
+ * @return The next free port.
+ */
+ public static int getNextFreePort(int startPort) {
+ if (startPort < 1024) startPort = 10000;
+ for (int port = startPort; port < 65536; port++) {
+ System.out.println("Scan port " + port);
+ try {
+ // first trying to establish a server-socket on localhost
+ // fails if there is already a server running
+ ServerSocket sSock = new ServerSocket(port);
+ sSock.close();
+ }
+ catch (IOException e) {
+ System.out.println(" -> server: occupied port " + port);
+ continue;
+ }
+ try {
+ // now trying to establish a client-socket
+ // fails if there is no server on any connectable machine
+ Socket sock = new Socket("localhost", port);
+ System.out.println(" -> socket: occupied port: " + port);
+ }
+ catch (IOException e) {
+ System.out.println(" -> free port");
+ return port;
+ }
+ }
+ return 65535;
+ }
+
+ public static void writeImplIDToDB(String language, String module,
+ String component, String remark) {
+ String dbURL = System.getProperty("DBURL");
+ if (dbURL.equals("none")) {
+ //System.out.println("No DBURL given to write ImplID");
+ return;
+ }
+
+ Connection con= null;
+ Statement stmt=null;
+ String platform = System.getProperty("OS");
+ String tBase = System.getProperty("TESTBASE");
+ String version = System.getProperty("VERSION");
+
+ //Connect the database
+ try {
+// DriverManager.registerDriver (new org.gjt.mm.mysql.Driver() );
+ String url = dbURL ;
+ con = DriverManager.getConnection(url,platform,platform);
+ }
+ catch (Exception ex) {
+ System.out.println("Couldn't connect database");
+ return;
+ }
+
+
+ //creating the statement
+ try {
+ stmt = con.createStatement();
+ stmt.executeQuery("insert into ImplID_State values (\""+language+"\",\""
+ +platform+"\",\""+tBase+"\",\""+module+"\",\""+component+"\",\""+version
+ +"\",\""+remark+"\",\"none\")");
+ con.close();
+ }
+ catch(SQLException e) {
+ while(e != null) {
+ if (e.getMessage().indexOf("Duplicate entry") != -1) {
+ try {
+ stmt.execute("update ImplID_State set version=\""+version+
+ "\" where platform=\""+platform+"\" AND language=\"java\" AND testbase=\""
+ +tBase+"\" AND module=\""+module+"\" AND component=\""+component+"\"");
+ con.close();
+ } catch (SQLException ex) {ex.printStackTrace();}
+ } else {
+ System.out.println("Message: "+ e.getMessage());
+ System.out.println("SQLState: "+ e.getSQLState());
+ System.out.println("Vendor: " + "" + e.getErrorCode());
+ e = e.getNextException();
+ }
+ }
+ e.printStackTrace();
+ }
+
+ }
+
+ public static URL parseURL(XMultiServiceFactory xMSF, String url){
+ URL[] rUrl = new URL[1];
+ rUrl[0] = new URL();
+ rUrl[0].Complete = url;
+
+ XURLTransformer xTrans = null;
+ try {
+ Object inst = xMSF.createInstance
+ ("com.sun.star.util.URLTransformer");
+ xTrans = (XURLTransformer) UnoRuntime.queryInterface
+ (XURLTransformer.class, inst);
+ } catch (com.sun.star.uno.Exception e) {}
+
+ xTrans.parseStrict(rUrl);
+
+ return rUrl[0];
+ }
+
+ public static String getOfficeURL(XMultiServiceFactory msf) {
+ try {
+ Object settings = msf.createInstance("com.sun.star.frame.Settings");
+ XNameAccess settingNames = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class,settings);
+ XPropertySet pthSettings = (XPropertySet) settingNames.getByName("PathSettings");
+ String path = (String) pthSettings.getPropertyValue("ProgPath");
+ return path;
+ } catch (Exception e) {
+ System.out.println("Couldn't get Office Settings ");
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+} \ No newline at end of file