summaryrefslogtreecommitdiffstats
path: root/qadevOOo/runner/helper
diff options
context:
space:
mode:
authorStephan Wunderlich <sw@openoffice.org>2003-01-27 15:27:53 +0000
committerStephan Wunderlich <sw@openoffice.org>2003-01-27 15:27:53 +0000
commit4e50cf2148ad8d3bebccb8823c2a56f295ddc763 (patch)
tree175372ec86a9dfa739143edc30069d925cba4e70 /qadevOOo/runner/helper
parentNEW: initial version (diff)
downloadcore-4e50cf2148ad8d3bebccb8823c2a56f295ddc763.tar.gz
core-4e50cf2148ad8d3bebccb8823c2a56f295ddc763.zip
NEW: initial version
Diffstat (limited to 'qadevOOo/runner/helper')
-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
13 files changed, 2849 insertions, 0 deletions
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