diff options
Diffstat (limited to 'qadevOOo/runner')
41 files changed, 801 insertions, 841 deletions
diff --git a/qadevOOo/runner/base/java_complex.java b/qadevOOo/runner/base/java_complex.java index 0a69d047d5ac..0690fb8a0138 100644 --- a/qadevOOo/runner/base/java_complex.java +++ b/qadevOOo/runner/base/java_complex.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: java_complex.java,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.8.1 $ * * This file is part of OpenOffice.org. * @@ -84,10 +84,11 @@ public class java_complex implements TestBase{ public boolean executeTest(TestParameters param, DescEntry[] entries) { // is there an ini file for the complex tests defined? String complexIniFileName = ((String)param.get("ComplexIni")); - if (complexIniFileName != null) { + if (complexIniFileName != null) + { CfgParser ini = new CfgParser(complexIniFileName); ini.getIniParameters(param); - } + } DynamicClassLoader dcl = new DynamicClassLoader(); ComplexTestCase testClass = null; diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java index 19b451f39138..64f55e8f0814 100644 --- a/qadevOOo/runner/base/java_fat.java +++ b/qadevOOo/runner/base/java_fat.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: java_fat.java,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.2.1 $ * * This file is part of OpenOffice.org. * @@ -522,7 +522,9 @@ public class java_fat implements TestBase { XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager( param); - param.put("ServiceFactory", msf); + if (msf != null){ + param.put("ServiceFactory", msf); + } return office; } diff --git a/qadevOOo/runner/complexlib/ComplexTestCase.java b/qadevOOo/runner/complexlib/ComplexTestCase.java index 2a7c54bdd848..4fb5d757fb0e 100644 --- a/qadevOOo/runner/complexlib/ComplexTestCase.java +++ b/qadevOOo/runner/complexlib/ComplexTestCase.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ComplexTestCase.java,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.2.1 $ * * This file is part of OpenOffice.org. * @@ -42,7 +42,7 @@ import java.io.PrintWriter; /** * Base class for all complex tests. */ -public abstract class ComplexTestCase implements ComplexTest { +public abstract class ComplexTestCase extends Assurance implements ComplexTest { /** The test parameters **/ protected static TestParameters param = null; @@ -50,10 +50,6 @@ public abstract class ComplexTestCase implements ComplexTest { protected static LogWriter log = null; /** Description entry **/ protected DescEntry subEntry = null; - /** State of the current test method **/ - protected boolean state = true; - /** The message if the test did fail **/ - protected String message = null; /** * The method name which will be written into f.e. the data base **/ @@ -240,268 +236,5 @@ public abstract class ComplexTestCase implements ComplexTest { return this.getClass().getName(); } - /** - * Assure that s is true. - * This function generates "Assure failed." as standard message. - * @param s The condition that should be true. - */ - protected void assure(boolean s) { - assure("Assure failed.", s, false); - } - - /** - * Assure that s is true. - * The given message will be only evaluated, if s is false. - * @param msg The message that is evaluated. - * @param s The condition that should be true. - */ - protected void assure(String msg, boolean s) { - assure(msg, s, false); - } - - /** - * Assure that two boolean values are equal - * @param expected specifies the expected boolean value - * @param actual specifies the actual boolean value - */ - protected void assureEquals( boolean expected, boolean actual ) { - assureEquals( "Equality test failed", new Boolean( expected ), new Boolean( actual ), false ); - } - - /** - * Assure that two boolean values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected boolean value - * @param actual specifies the actual boolean value - */ - protected void assureEquals( String message, boolean expected, boolean actual ) { - assureEquals( message, new Boolean( expected ), new Boolean( actual ), false ); - } - - /** - * Assure that two byte values are equal - * @param expected specifies the expected byte value - * @param actual specifies the actual byte value - */ - protected void assureEquals( byte expected, byte actual ) { - assureEquals( "Equality test failed", new Byte( expected ), new Byte( actual ), false ); - } - - /** - * Assure that two byte values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected byte value - * @param actual specifies the actual byte value - */ - protected void assureEquals( String message, byte expected, byte actual ) { - assureEquals( message, new Byte( expected ), new Byte( actual ), false ); - } - - /** - * Assure that two double values are equal - * @param expected specifies the expected double value - * @param actual specifies the actual double value - */ - protected void assureEquals( double expected, double actual ) { - assureEquals( "Equality test failed", new Double( expected ), new Double( actual ), false ); - } - - /** - * Assure that two double values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected double value - * @param actual specifies the actual double value - */ - protected void assureEquals( String message, double expected, double actual ) { - assureEquals( message, new Double( expected ), new Double( actual ), false ); - } - - /** - * Assure that two float values are equal - * @param expected specifies the expected float value - * @param actual specifies the actual float value - */ - protected void assureEquals( float expected, float actual ) { - assureEquals( "Equality test failed", new Float( expected ), new Float( actual ), false ); - } - - /** - * Assure that two float values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected float value - * @param actual specifies the actual float value - */ - protected void assureEquals( String message, float expected, float actual ) { - assureEquals( message, new Float( expected ), new Float( actual ), false ); - } - - /** - * Assure that two short values are equal - * @param expected specifies the expected short value - * @param actual specifies the actual short value - */ - protected void assureEquals( short expected, short actual ) { - assureEquals( "Equality test failed", new Short( expected ), new Short( actual ), false ); - } - - /** - * Assure that two short values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected short value - * @param actual specifies the actual short value - */ - protected void assureEquals( String message, short expected, short actual ) { - assureEquals( message, new Short( expected ), new Short( actual ), false ); - } - - /** - * Assure that two int values are equal - * @param expected specifies the expected int value - * @param actual specifies the actual int value - */ - protected void assureEquals( int expected, int actual ) { - assureEquals( "Equality test failed", new Integer( expected ), new Integer( actual ), false ); - } - - /** - * Assure that two int values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected int value - * @param actual specifies the actual int value - */ - protected void assureEquals( String message, int expected, int actual ) { - assureEquals( message, new Integer( expected ), new Integer( actual ), false ); - } - - /** - * Assure that two long values are equal - * @param expected specifies the expected long value - * @param actual specifies the actual long value - */ - protected void assureEquals( long expected, long actual ) { - assureEquals( "Equality test failed", new Long( expected ), new Long( actual ), false ); - } - - /** - * Assure that two long values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected long value - * @param actual specifies the actual long value - */ - protected void assureEquals( String message, long expected, long actual ) { - assureEquals( message, new Long( expected ), new Long( actual ), false ); - } - - /** - * Assure that two string values are equal - * @param expected specifies the expected string value - * @param actual specifies the actual string value - */ - protected void assureEquals( String expected, String actual ) { - assureEquals( "Equality test failed", expected, actual, false ); - } - /** - * Assure that two string values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected string value - * @param actual specifies the actual string value - */ - protected void assureEquals( String message, String expected, String actual ) { - assureEquals( message, expected, actual, false ); - } - - /** - * Assure that two object are equal - * @param expected specifies the expected object value - * @param actual specifies the actual object value - */ - protected void assureEquals( Object expected, Object actual ) { - assureEquals( "Equality test failed", expected, actual, false ); - } - - /** - * Assure that two objects are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected object value - * @param actual specifies the actual object value - */ - protected void assureEquals( String message, Object expected, Object actual ) { - assureEquals( message, expected, actual, false ); - } - - /** - * Mark the currently executed method as failed. - * This function generates "Test did fail." as standard message. - */ - protected void failed() { - assure("Test did fail.", false, false); - } - - /** - * Mark the currently executed method as failed. - * with the given message. - * @param msg The message of the failure. - */ - protected void failed(String msg) { - assure(msg, false, false); - } - - /** - * Assure that s is true. - * The given message will be only evaluated, if s is false. - * Normally, assure() leaves the current test method, and the next one - * is executed. With the parameter 'cont' set to true, the current test - * method will continue.<br> - * The current method will of course marked as failed. - * @param msg The message that is evaluated. - * @param s The condition that should be true. - * @param cont Continue with test method, even if s is false. - */ - protected void assure(String msg, boolean s, boolean cont) { - state &= s; - if (!s) { - message += msg + "\r\n"; - log.println(msg); - if (!cont) { - throw new AssureException(msg); - } - } - } - - protected void assureEquals( String message, Object expected, Object actual, boolean cont ) { - assure( message + " (expected: " + expected.toString() + ", actual: " + actual.toString() + ")", - expected.equals( actual ), cont ); - } - - /** - * Mark the currently executed method as failed. - * with the given message. - * The given message will be only evaluated, if s is false. - * With the parameter 'cont' set to true, the current test - * method will continue.<br> - * The current method will of course marked as failed. - * @param msg The message that is evaluated. - * @param cont Continue with test method, even if s is false. - */ - protected void failed(String msg, boolean cont) { - assure(msg, false, cont); - } - - /** - * @deprecated - */ - protected void addResult(String message, boolean state) { - String msg = message + " - " + state; - this.state &= state; - this.message += msg + "\r\n"; - log.println(msg); - } - - public class AssureException extends RuntimeException { - - public AssureException(String msg) { - super(msg); - } - } }
\ No newline at end of file diff --git a/qadevOOo/runner/convwatch/BuildID.java b/qadevOOo/runner/convwatch/BuildID.java index ae8283eb35ef..fed56715fafa 100644 --- a/qadevOOo/runner/convwatch/BuildID.java +++ b/qadevOOo/runner/convwatch/BuildID.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BuildID.java,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.8.1 $ * * This file is part of OpenOffice.org. * @@ -31,7 +31,7 @@ package convwatch; import java.io.File; -import convwatch.OSHelper; +import helper.OSHelper; import convwatch.IniFile; import java.util.Date; diff --git a/qadevOOo/runner/convwatch/ConvWatchStarter.java b/qadevOOo/runner/convwatch/ConvWatchStarter.java index 1d55e85fb8f2..45fd78cf80c3 100644 --- a/qadevOOo/runner/convwatch/ConvWatchStarter.java +++ b/qadevOOo/runner/convwatch/ConvWatchStarter.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ConvWatchStarter.java,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.8.1 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,7 @@ import convwatch.NameHelper; import convwatch.HTMLOutputter; import helper.OfficeProvider; import helper.OfficeWatcher; +import helper.OSHelper; import convwatch.PerformanceContainer; /** @@ -246,7 +247,7 @@ public class ConvWatchStarter extends EnhancedComplexTestCase { // check a whole directory // a whole directory - FileFilter aFileFilter = aGTA.getFileFilter(); + FileFilter aFileFilter = FileHelper.getFileFilter(); Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories()); if (aList.length == 0) diff --git a/qadevOOo/runner/convwatch/DB.java b/qadevOOo/runner/convwatch/DB.java index b53e05faacf9..4f6ab74a738b 100644 --- a/qadevOOo/runner/convwatch/DB.java +++ b/qadevOOo/runner/convwatch/DB.java @@ -3,6 +3,7 @@ package convwatch; import java.sql.Connection; import java.util.StringTokenizer; import java.util.ArrayList; +import helper.OSHelper; // import convwatch.DBHelper; diff --git a/qadevOOo/runner/convwatch/DocumentConverter.java b/qadevOOo/runner/convwatch/DocumentConverter.java index b82b99085cbf..6c4e821a481e 100644 --- a/qadevOOo/runner/convwatch/DocumentConverter.java +++ b/qadevOOo/runner/convwatch/DocumentConverter.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DocumentConverter.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.1 $ * * This file is part of OpenOffice.org. * @@ -176,9 +176,9 @@ public class DocumentConverter extends EnhancedComplexTestCase String sRemovePath = aInputPath.getAbsolutePath(); // a whole directory - FileFilter aFileFilter = aGTA.getFileFilter(); + FileFilter aFileFilter = FileHelper.getFileFilter(); - Object[] aList = DirectoryHelper.traverse(m_sInputPath, aGTA.getFileFilter(), aGTA.includeSubDirectories()); + Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories()); for (int i=0;i<aList.length;i++) { String sEntry = (String)aList[i]; diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java index 222db6eea17a..821d4afdd98f 100644 --- a/qadevOOo/runner/convwatch/FileHelper.java +++ b/qadevOOo/runner/convwatch/FileHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FileHelper.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.1 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ import java.io.File; import java.io.FileFilter; import java.util.ArrayList; import java.util.StringTokenizer; +import helper.OSHelper; import javax.swing.JOptionPane; @@ -366,5 +367,43 @@ public class FileHelper GlobalLogWriter.get().println("Message: " + e.getMessage()); } } + + /** + * Within the directory run through, it's possible to say which file extension types should not + * consider like '*.prn' because it's not a document. + * + * @return a FileFilter function + */ + public static FileFilter getFileFilter() + { + FileFilter aFileFilter = new FileFilter() + { + public boolean accept( File pathname ) + { + // leave out files which started by '~$' these are Microsoft Office temp files + if (pathname.getName().startsWith("~$")) + { + return false; + } + + if (pathname.getName().endsWith(".prn")) + { + return false; + } + // This type of document no one would like to load. + if (pathname.getName().endsWith(".zip")) + { + return false; + } + // just a hack + if (pathname.getName().endsWith("_")) + { + return false; + } + return true; + } + }; + return aFileFilter; + } } diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java index 0247f8e37414..59d2045937c0 100644 --- a/qadevOOo/runner/convwatch/FilenameHelper.java +++ b/qadevOOo/runner/convwatch/FilenameHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FilenameHelper.java,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.8.1 $ * * This file is part of OpenOffice.org. * @@ -39,7 +39,7 @@ package convwatch; import helper.URLHelper; import convwatch.FileHelper; -import convwatch.StringHelper; +import helper.StringHelper; import util.utils; interface Filenamer diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java index 26d18c0bec83..a12378189b07 100644 --- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java +++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: GraphicalDifferenceCheck.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.1 $ * * This file is part of OpenOffice.org. * @@ -97,7 +97,7 @@ public class GraphicalDifferenceCheck String sRemovePath = aInputPath.getAbsolutePath(); // a whole directory - Object[] aList = DirectoryHelper.traverse(_sInputPath, _aGTA.getFileFilter(), _aGTA.includeSubDirectories()); + Object[] aList = DirectoryHelper.traverse(_sInputPath, FileHelper.getFileFilter(), _aGTA.includeSubDirectories()); for (int i=0;i<aList.length;i++) { String sEntry = (String)aList[i]; @@ -190,7 +190,7 @@ public class GraphicalDifferenceCheck { String fs = System.getProperty("file.separator"); // a whole directory - Object[] aList = DirectoryHelper.traverse(_sInputPath, _aGTA.getFileFilter(), _aGTA.includeSubDirectories()); + Object[] aList = DirectoryHelper.traverse(_sInputPath, FileHelper.getFileFilter(), _aGTA.includeSubDirectories()); if (aList.length != 0) { for (int i=0;i<aList.length;i++) diff --git a/qadevOOo/runner/convwatch/GraphicalTestArguments.java b/qadevOOo/runner/convwatch/GraphicalTestArguments.java index d58308245e03..34a73ef8f11a 100644 --- a/qadevOOo/runner/convwatch/GraphicalTestArguments.java +++ b/qadevOOo/runner/convwatch/GraphicalTestArguments.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: GraphicalTestArguments.java,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.8.1 $ * * This file is part of OpenOffice.org. * @@ -423,43 +423,6 @@ public class GraphicalTestArguments public boolean isHidden() {return m_bHidden;} public String getDefaultXMLFormatApp() {return m_sDefaultXMLFormatApplication;} - /** - * Within the directory run through, it's possible to say which file extension types should not - * consider like '*.prn' because it's not a document. - * - * @return a FileFilter function - */ - public FileFilter getFileFilter() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - // leave out files which started by '~$' these are Microsoft Office temp files - if (pathname.getName().startsWith("~$")) - { - return false; - } - - if (pathname.getName().endsWith(".prn")) - { - return false; - } - // This type of document no one would like to load. - if (pathname.getName().endsWith(".zip")) - { - return false; - } - // just a hack - if (pathname.getName().endsWith("_")) - { - return false; - } - return true; - } - }; - return aFileFilter; - } /** * @return true, if subdirectories should run through diff --git a/qadevOOo/runner/convwatch/HTMLOutputter.java b/qadevOOo/runner/convwatch/HTMLOutputter.java index 6e84d8cd1243..f2d10ba71bcc 100644 --- a/qadevOOo/runner/convwatch/HTMLOutputter.java +++ b/qadevOOo/runner/convwatch/HTMLOutputter.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: HTMLOutputter.java,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.8.1 $ * * This file is part of OpenOffice.org. * @@ -33,6 +33,7 @@ package convwatch; import java.io.File; import java.io.FileWriter; import util.utils; +import helper.OSHelper; public class HTMLOutputter { diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java index 7e748a7999be..6c79aa1c647a 100644 --- a/qadevOOo/runner/convwatch/MSOfficePrint.java +++ b/qadevOOo/runner/convwatch/MSOfficePrint.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MSOfficePrint.java,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.8.1 $ * * This file is part of OpenOffice.org. * @@ -36,9 +36,10 @@ import java.io.FileWriter; import java.io.RandomAccessFile; import convwatch.GraphicalTestArguments; import helper.ProcessHandler; -import convwatch.StringHelper; +import helper.StringHelper; import convwatch.ConvWatchException; import java.util.ArrayList; +import helper.OSHelper; /** * This object gives all functionallity to print msoffice documents. diff --git a/qadevOOo/runner/convwatch/NameHelper.java b/qadevOOo/runner/convwatch/NameHelper.java index 14ca5e8c3607..05c1b36cdf2a 100644 --- a/qadevOOo/runner/convwatch/NameHelper.java +++ b/qadevOOo/runner/convwatch/NameHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NameHelper.java,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.8.1 $ * * This file is part of OpenOffice.org. * @@ -34,7 +34,7 @@ package convwatch; * This container class should help to handle the name of the current document */ -class NameHelper +public class NameHelper { /** * diff --git a/qadevOOo/runner/convwatch/OSHelper.java b/qadevOOo/runner/convwatch/OSHelper.java index 19407ff9f9a9..9924dbd89c11 100644 --- a/qadevOOo/runner/convwatch/OSHelper.java +++ b/qadevOOo/runner/convwatch/OSHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OSHelper.java,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.8.1 $ * * This file is part of OpenOffice.org. * @@ -29,59 +29,59 @@ ************************************************************************/ package convwatch; - -class OSHelper -{ - public static boolean isWindows() - { - String sOSName = System.getProperty("os.name"); - if (sOSName.toLowerCase().startsWith("windows")) - { - return true; - } - return false; - } - // not need - // public static boolean isUnix() - public static boolean isSolarisIntel() - { - if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || - System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && - System.getProperty("os.arch").equals("x86")) - { - return true; - } - return false; - } - public static boolean isSolarisSparc() - { - if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || - System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && - System.getProperty("os.arch").equals("sparc")) - { - return true; - } - return false; - } - public static boolean isLinuxIntel() - { - if (System.getProperty("os.name").toLowerCase().startsWith("linux") && - System.getProperty("os.arch").equals("i386")) - { - return true; - } - return false; - } - - public static boolean isUnix() - { - if (isLinuxIntel() || - isSolarisIntel() || - isSolarisSparc()) - { - return true; - } - return false; - } - -} +// +// class OSHelper +// { +// public static boolean isWindows() +// { +// String sOSName = System.getProperty("os.name"); +// if (sOSName.toLowerCase().startsWith("windows")) +// { +// return true; +// } +// return false; +// } +// // not need +// // public static boolean isUnix() +// public static boolean isSolarisIntel() +// { +// if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || +// System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && +// System.getProperty("os.arch").equals("x86")) +// { +// return true; +// } +// return false; +// } +// public static boolean isSolarisSparc() +// { +// if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || +// System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && +// System.getProperty("os.arch").equals("sparc")) +// { +// return true; +// } +// return false; +// } +// public static boolean isLinuxIntel() +// { +// if (System.getProperty("os.name").toLowerCase().startsWith("linux") && +// System.getProperty("os.arch").equals("i386")) +// { +// return true; +// } +// return false; +// } +// +// public static boolean isUnix() +// { +// if (isLinuxIntel() || +// isSolarisIntel() || +// isSolarisSparc()) +// { +// return true; +// } +// return false; +// } +// +// } diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java index 89a3379eec32..39b11433e692 100644 --- a/qadevOOo/runner/convwatch/OfficePrint.java +++ b/qadevOOo/runner/convwatch/OfficePrint.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OfficePrint.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.8.1 $ * * This file is part of OpenOffice.org. * @@ -54,6 +54,7 @@ import com.sun.star.uno.AnyConverter; import helper.URLHelper; import helper.PropertyHelper; +import helper.OSHelper; import convwatch.FileHelper; import convwatch.MSOfficePrint; import convwatch.GraphicalTestArguments; diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java index 65860d92bc92..f21d3f1821c4 100644 --- a/qadevOOo/runner/convwatch/PRNCompare.java +++ b/qadevOOo/runner/convwatch/PRNCompare.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PRNCompare.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.1 $ * * This file is part of OpenOffice.org. * @@ -35,8 +35,8 @@ import helper.ProcessHandler; import java.io.File; import convwatch.PixelCounter; import convwatch.StatusHelper; -import convwatch.OSHelper; -import convwatch.StringHelper; +import helper.OSHelper; +import helper.StringHelper; import java.util.ArrayList; import util.utils; diff --git a/qadevOOo/runner/convwatch/PixelCounter.java b/qadevOOo/runner/convwatch/PixelCounter.java index 3f01428c28d7..4e93e7d77798 100644 --- a/qadevOOo/runner/convwatch/PixelCounter.java +++ b/qadevOOo/runner/convwatch/PixelCounter.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PixelCounter.java,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.8.1 $ * * This file is part of OpenOffice.org. * @@ -190,7 +190,7 @@ public class PixelCounter { public static void main(String[] args) { - String a = StringHelper.createValueString(10, 4); + String a = helper.StringHelper.createValueString(10, 4); int dummy = 1; /* BorderRemover a = new BorderRemover(); diff --git a/qadevOOo/runner/convwatch/ReferenceBuilder.java b/qadevOOo/runner/convwatch/ReferenceBuilder.java index 7d91501810ba..efdd22826581 100644 --- a/qadevOOo/runner/convwatch/ReferenceBuilder.java +++ b/qadevOOo/runner/convwatch/ReferenceBuilder.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ReferenceBuilder.java,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.8.1 $ * * This file is part of OpenOffice.org. * @@ -183,9 +183,9 @@ public class ReferenceBuilder extends EnhancedComplexTestCase String sRemovePath = aInputPath.getAbsolutePath(); // a whole directory - FileFilter aFileFilter = aGTA.getFileFilter(); + FileFilter aFileFilter = FileHelper.getFileFilter(); - Object[] aList = DirectoryHelper.traverse(m_sInputPath, aGTA.getFileFilter(), aGTA.includeSubDirectories()); + Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories()); // fill into DB // DB.filesRemove(aGTA.getDBInfoString()); // for (int j=0;j<aList.length;j++) diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java index b241bde12e80..3933f9da318b 100755 --- a/qadevOOo/runner/convwatch/ReportDesignerTest.java +++ b/qadevOOo/runner/convwatch/ReportDesignerTest.java @@ -1,4 +1,5 @@ -/************************************************************************* +/* + ************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -7,7 +8,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ReportDesignerTest.java,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.8.1 $ * * This file is part of OpenOffice.org. * @@ -160,9 +161,13 @@ public class ReportDesignerTest extends ComplexTestCase { String mTestDocumentPath; + /** + * This method returns a list of Strings, each string must be a function name in this class. + * @return + */ public String[] getTestMethodNames() { - return new String[] {"ReportDesignTest"}; + return new String[] {"ReportDesignTest"}; // MAIN } private void checkIfOfficeExists(String _sOfficePathWithTrash) @@ -182,6 +187,13 @@ public class ReportDesignerTest extends ComplexTestCase { } } + // if (sOfficePath.startsWith("\"") || + // sOfficePath.startsWith("'")) + // { + // sOfficePath = sOfficePath.substring(1); + // } + sOfficePath = helper.StringHelper.removeQuoteIfExists(sOfficePath); + log.println(sOfficePath); File sOffice = new File(sOfficePath); if (! sOffice.exists()) @@ -262,10 +274,15 @@ public class ReportDesignerTest extends ComplexTestCase { private static String m_sSourceVersion; private static String m_sDestinationVersion; + private static String m_sSourceName; + private static String m_sDestinationName; private static final int WRITER = 1; private static final int CALC = 2; + /** + * This is the main test Function of current ReportDesignerTest + */ public void ReportDesignTest() { convwatch.GlobalLogWriter.set(log); @@ -280,6 +297,7 @@ public class ReportDesignerTest extends ComplexTestCase { // -------------------- preconditions, try to find an office -------------------- String sAppExecutionCommand = (String) param.get("AppExecutionCommand"); + log.println("sAppExecutionCommand='" + sAppExecutionCommand + "'"); String sUser = System.getProperty("user.name"); log.println("user.name='" + sUser + "'"); @@ -293,7 +311,9 @@ public class ReportDesignerTest extends ComplexTestCase { m_sParentDistinct = System.getProperty("ParentDistinct"); m_sSourceVersion = System.getProperty("SourceVersion"); + m_sSourceName = System.getProperty("SourceName"); m_sDestinationVersion = System.getProperty("DestinationVersion"); + m_sDestinationName = System.getProperty("DestinationName"); // createDBEntry(); // log.println("Current CWS: " + m_sCWS_WORK_STAMP); // log.println("Current MWS: " + m_sUPDMinor); @@ -324,6 +344,7 @@ public class ReportDesignerTest extends ComplexTestCase { // String sCurrentDirectory = System.getProperty("user.dir"); // log.println("Current Dir: " + sCurrentDirectory); String sDocument = (String) param.get(convwatch.PropertyName.DOC_COMPARATOR_INPUT_PATH); + sDocument = helper.StringHelper.removeQuoteIfExists( sDocument ); startTestForFile(sDocument); // if (sDocument.toLowerCase().indexOf("writer") >= 0) // { @@ -352,7 +373,7 @@ public class ReportDesignerTest extends ComplexTestCase { private void startTestForFile(String _sDocument /*, int _nType*/) { File aFile = new File(_sDocument); - assure("Test File doesn't '" + _sDocument + "'exist.", aFile.exists()); + assure("Test File '" + _sDocument + "' doesn't exist.", aFile.exists()); String sFileURL = URLHelper.getFileURLFromSystemPath(_sDocument); log.println("File URL: " + sFileURL); @@ -462,16 +483,17 @@ public class ReportDesignerTest extends ComplexTestCase { // String sFixRefSubDirectory = "ReportDesign_qa_complex_" + getFileFormat(_nType); String sFixRefSubDirectory = "ReportDesignFixRef"; - // String sSourceVersion = m_sSourceVersion; - String sSourceVersion = sFixRefSubDirectory; - String sSourceName = ""; - String sSourceCreatorType = "fixref"; + String sSourceVersion = m_sSourceVersion; + // String sSourceVersion = sFixRefSubDirectory; + String sSourceName = m_sSourceName; + // String sSourceCreatorType = "fixref"; + String sSourceCreatorType = ""; String sDestinationVersion = m_sDestinationVersion; // if (sDestinationVersion.length() == 0) // { // sDestinationVersion = m_sUPDMinor; // } - String sDestinationName = ""; + String sDestinationName = m_sDestinationName; String sDestinationCreatorType = ""; String sDocumentPoolDir = getOutputPath(/*_nType*/); String sDocumentPoolName = getDocumentPoolName(/*_nType*/); @@ -560,6 +582,7 @@ public class ReportDesignerTest extends ComplexTestCase { if (m_sOutputPath == null) { String sOutputPath = (String)param.get( convwatch.PropertyName.DOC_COMPARATOR_OUTPUT_PATH ); + sOutputPath = helper.StringHelper.removeQuoteIfExists(sOutputPath); if (!sOutputPath.endsWith("/") || // construct the output file name !sOutputPath.endsWith("\\")) @@ -639,6 +662,7 @@ public class ReportDesignerTest extends ComplexTestCase { PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList); log.println("Load component: '" + _sName + "'"); xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", 0, aLoadProperties); + log.println("Load component: '" + _sName + "' done"); } catch (com.sun.star.io.IOException e) { diff --git a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java b/qadevOOo/runner/convwatch/SimpleFileSemaphore.java index 6cef81568b5b..ff00c1bff0c7 100644 --- a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java +++ b/qadevOOo/runner/convwatch/SimpleFileSemaphore.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: SimpleFileSemaphore.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.8.1 $ * * This file is part of OpenOffice.org. * @@ -32,6 +32,7 @@ package convwatch; import java.io.File; import java.io.RandomAccessFile; +import helper.OSHelper; public class SimpleFileSemaphore /* extends *//* implements */ { diff --git a/qadevOOo/runner/convwatch/StringHelper.java b/qadevOOo/runner/convwatch/StringHelper.java index 69042404d515..7042382bc052 100644 --- a/qadevOOo/runner/convwatch/StringHelper.java +++ b/qadevOOo/runner/convwatch/StringHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StringHelper.java,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.8.1 $ * * This file is part of OpenOffice.org. * @@ -28,56 +28,79 @@ * ************************************************************************/ -package convwatch; - -public class StringHelper { - - public static String doubleQuote(String _sStr) - { - return "\"" + _sStr + "\""; - } - - public static String singleQuote(String _sStr) - { - return "'" + _sStr + "'"; - } - - public static String doubleQuoteIfNeed(String _sStr) - { - if (_sStr.startsWith("\"") && _sStr.endsWith("\"")) - { - // don't quote twice - return _sStr; - } - if (_sStr.indexOf(" ") == -1) - { - // don't quote, if there is no space in name - return _sStr; - } - if (_sStr.indexOf("%") != -1) - { - return singleQuote(_sStr); - } - - return doubleQuote(_sStr); - } - - /** - * Convert a value to a string with a given length, if the len is greater the len of the value string representation - * fill it's front with '0' - * So ("5", 4) will result in a string "0005" - */ - public static String createValueString(int _nValue, int _nLen) - { - String sValue = String.valueOf(_nValue); - StringBuffer a = new StringBuffer(); - while (_nLen > sValue.length()) - { - a.append('0'); - _nLen --; - } - a.append(sValue); - return a.toString(); - } - -} +// LLA: moved to helper.StringHelper package convwatch; +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper public class StringHelper { +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper public static String doubleQuote(String _sStr) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper return "\"" + _sStr + "\""; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper public static String singleQuote(String _sStr) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper return "'" + _sStr + "'"; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper public static String removeQuoteIfNeed(String _sPath) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper String sNewPath = _sPath; +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper if (_sPath.startsWith("\"") || +// LLA: moved to helper.StringHelper _sPath.startsWith("'")) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper // remove trailing quotes, if exists +// LLA: moved to helper.StringHelper sNewPath = sNewPath.substring(1); +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper if (_sPath.endsWith("\"") || +// LLA: moved to helper.StringHelper _sPath.endsWith("'")) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper // remove trailing quotes, if exists +// LLA: moved to helper.StringHelper sNewPath = sNewPath.substring(0, sNewPath.length() - 1); +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper return sNewPath; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper public static String doubleQuoteIfNeed(String _sStr) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper if (_sStr.startsWith("\"") && _sStr.endsWith("\"")) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper // don't quote twice +// LLA: moved to helper.StringHelper return _sStr; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper if (_sStr.indexOf(" ") == -1) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper // don't quote, if there is no space in name +// LLA: moved to helper.StringHelper return _sStr; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper if (_sStr.indexOf("%") != -1) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper return singleQuote(_sStr); +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper return doubleQuote(_sStr); +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper /** +// LLA: moved to helper.StringHelper * Convert a value to a string with a given length, if the len is greater the len of the value string representation +// LLA: moved to helper.StringHelper * fill it's front with '0' +// LLA: moved to helper.StringHelper * So ("5", 4) will result in a string "0005" +// LLA: moved to helper.StringHelper * @param _nValue +// LLA: moved to helper.StringHelper * @param _nLen +// LLA: moved to helper.StringHelper * @return +// LLA: moved to helper.StringHelper */ +// LLA: moved to helper.StringHelper public static String createValueString(int _nValue, int _nLen) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper String sValue = String.valueOf(_nValue); +// LLA: moved to helper.StringHelper StringBuffer a = new StringBuffer(); +// LLA: moved to helper.StringHelper while (_nLen > sValue.length()) +// LLA: moved to helper.StringHelper { +// LLA: moved to helper.StringHelper a.append('0'); +// LLA: moved to helper.StringHelper _nLen --; +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper a.append(sValue); +// LLA: moved to helper.StringHelper return a.toString(); +// LLA: moved to helper.StringHelper } +// LLA: moved to helper.StringHelper +// LLA: moved to helper.StringHelper } diff --git a/qadevOOo/runner/convwatch/TriState.java b/qadevOOo/runner/convwatch/TriState.java index 37b33a3d8035..35e5d9f4c10c 100644 --- a/qadevOOo/runner/convwatch/TriState.java +++ b/qadevOOo/runner/convwatch/TriState.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TriState.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.8.1 $ * * This file is part of OpenOffice.org. * @@ -51,7 +51,7 @@ public class TriState /** Returns the value of this TriState object as an int - @returns the primitive <code>int</code> value of this object. + * @return the primitive <code>int</code> value of this object. */ public int intValue() { diff --git a/qadevOOo/runner/convwatch/makefile.mk b/qadevOOo/runner/convwatch/makefile.mk index 8b29e23b5125..3c9d24fd7407 100644 --- a/qadevOOo/runner/convwatch/makefile.mk +++ b/qadevOOo/runner/convwatch/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.13 $ +# $Revision: 1.13.8.1 $ # # This file is part of OpenOffice.org. # @@ -69,7 +69,6 @@ JAVAFILES = \ EnhancedComplexTestCase.java \ MSOfficePrint.java \ GraphicalTestArguments.java \ - StringHelper.java \ GraphicalDifferenceCheck.java \ DocumentConverter.java\ DBHelper.java\ diff --git a/qadevOOo/runner/helper/BuildEnvTools.java b/qadevOOo/runner/helper/BuildEnvTools.java index 9e58fd30ac27..a9f23161bc25 100644 --- a/qadevOOo/runner/helper/BuildEnvTools.java +++ b/qadevOOo/runner/helper/BuildEnvTools.java @@ -75,12 +75,19 @@ public class BuildEnvTools { if (mDebug) { log.println("### " + mPlatform); } - if ((mPlatform == null) || ((!mPlatform.equals(PropertyName.UNXSOLS)) && - (!mPlatform.equalsIgnoreCase(PropertyName.UNXSOLI)) && (!mPlatform.equals(PropertyName.UNXLNGI)) && - (!mPlatform.equals(PropertyName.WNTMSCI)))) { - + if (mPlatform == null){ msg += PropertyName.OPERATING_SYSTEM + "\nFill this parameter with an operating system like unxsols," + - " unxsoli, unxlngi or wntmsci. \n\n"; + " unxsoli, unxlngi, unxmacxi or wntmsci. \n\n"; + } + if( + (!mPlatform.equalsIgnoreCase(PropertyName.UNXSOLS)) && + (!mPlatform.equalsIgnoreCase(PropertyName.UNXSOLI)) && + (!mPlatform.equalsIgnoreCase(PropertyName.UNXLNGI)) && + (!mPlatform.equalsIgnoreCase(PropertyName.UNXMACXI))&& + (!mPlatform.equalsIgnoreCase(PropertyName.WNTMSCI)) ){ + + msg += PropertyName.OPERATING_SYSTEM + ":" + mPlatform + "\nFill this parameter with an operating system like unxsols," + + " unxsoli, unxlngi, unxmacxi or wntmsci. \n\n"; error = true; } diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java index 56aa35601b36..95ea722481a8 100644 --- a/qadevOOo/runner/helper/CfgParser.java +++ b/qadevOOo/runner/helper/CfgParser.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: CfgParser.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.1 $ * * This file is part of OpenOffice.org. * @@ -80,6 +80,11 @@ public class CfgParser { System.setProperty("DOCPTH",(String)pValue); } + if (pName.equals(PropertyName.SRC_ROOT)) { + + System.setProperty(pName,(String)pValue); + + } } } diff --git a/qadevOOo/runner/helper/ClParser.java b/qadevOOo/runner/helper/ClParser.java index b8d27938187d..3e0907122877 100644 --- a/qadevOOo/runner/helper/ClParser.java +++ b/qadevOOo/runner/helper/ClParser.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ClParser.java,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.2.1 $ * * This file is part of OpenOffice.org. * @@ -32,9 +32,9 @@ package helper; import java.util.Properties; import lib.TestParameters; +import util.PropertyName; import util.utils; - /** * This class parses commandline Argument and stores <br> * them into TestParameter @@ -44,6 +44,7 @@ public class ClParser { * Parses the commandline argument and puts them<br> * into the TestParameters */ + public void getCommandLineParameter(TestParameters param, String[] args) { Properties mapping = getMapping(); @@ -65,23 +66,26 @@ public class ClParser { if (pValue.startsWith("-")) { i++; pValue = "yes"; - } else if (pValue.startsWith("'")){ + } else if (pValue.startsWith("'")) { i++; - while ( ! pValue.endsWith("'")){ + while (!pValue.endsWith("'")) { i++; pValue = pValue + " " + args[i].trim(); } pValue = utils.replaceAll13(pValue, "'", ""); i++; - } - else { + } else { i += 2; } if (pName.equals("TestDocumentPath")) { System.setProperty("DOCPTH", pValue); } + if (pName.equals(PropertyName.SRC_ROOT)) { + System.setProperty(pName,pValue); + + } } else { pValue = "yes"; i++; diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java index 3cc94c59004d..64408418f22a 100644 --- a/qadevOOo/runner/helper/OfficeProvider.java +++ b/qadevOOo/runner/helper/OfficeProvider.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OfficeProvider.java,v $ - * $Revision: 1.22 $ + * $Revision: 1.22.2.5 $ * * This file is part of OpenOffice.org. * @@ -45,6 +45,8 @@ import java.io.File; import java.io.PrintWriter; import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; import lib.TestParameters; import share.DescEntry; @@ -229,18 +231,31 @@ public class OfficeProvider implements AppProvider { int k = 0; - while ((k < 21) && (msf == null)) { - try { - Thread.sleep(k * 1000); + // wait up to 21 seconds to get an office connection + while ((k < 42) && (msf == null)) + { + try + { msf = connect(cncstr); - } catch (com.sun.star.uno.Exception ue) { + } + catch (com.sun.star.uno.Exception ue) + { exConnectFailed = ue; exc = ue.getMessage(); - } catch (java.lang.Exception je) { + } + catch (java.lang.Exception je) + { exConnectFailed = je; exc = je.getMessage(); } - + if (msf == null) + { + try + { + Thread.sleep(k * 500); + } + catch (InterruptedException ex){ } + } k++; } @@ -252,12 +267,17 @@ public class OfficeProvider implements AppProvider { if (bAppExecutionHasWarning) { System.out.println(errorMessage); } - } else if (isExecutable) { - backupUserLayer(param, msf); + } else if (isExecutable) + { + if (! param.getBool(util.PropertyName.DONT_BACKUP_USERLAYER)) + { + backupUserLayer(param, msf); + } } } else { - System.out.println("Could not connect an Office" + - " and cannot start one."); + System.out.println("Could not connect an Office and cannot start one.\n". + concat("please start an office with following parameter:\n"). + concat("\nsoffice -accept=").concat((String) param.get("ConnectionString")).concat(";urp;\n")); if (bAppExecutionHasWarning) { System.out.println(errorMessage); } @@ -336,7 +356,7 @@ public class OfficeProvider implements AppProvider { dbg("OfficeWatcher will be finished"); ow.finish = true; } else { - dbg("OfficeWatcher seems to be finishedß"); + dbg("OfficeWatcher seems to be finished"); } return true; @@ -425,14 +445,17 @@ public class OfficeProvider implements AppProvider { } } - final String AppKillCommand = (String) param.get("AppKillCommand"); - if (AppKillCommand != null) { - final StringTokenizer aKillCommandToken = new StringTokenizer(AppKillCommand, ";"); - while (aKillCommandToken.hasMoreTokens()) { + final String AppKillCommand = (String) param.get(util.PropertyName.APP_KILL_COMMAND); + if (AppKillCommand != null) + { + String sAppKillCommand = StringHelper.removeSurroundQuoteIfExists(AppKillCommand); + final StringTokenizer aKillCommandToken = new StringTokenizer(sAppKillCommand, ";"); + while (aKillCommandToken.hasMoreTokens()) + { final String sKillCommand = aKillCommandToken.nextToken(); dbg("User defined an application to destroy the started process. Trying to execute: " + sKillCommand); - final ProcessHandler pHdl = new ProcessHandler(sKillCommand, 3000); + final ProcessHandler pHdl = new ProcessHandler(sKillCommand, 1000); // 3000 seems to be too long pHdl.runCommand(); pHdl.kill(); @@ -455,27 +478,34 @@ public class OfficeProvider implements AppProvider { param.remove("AppProvider"); param.remove("ServiceFactory"); - //copy user_backup into user layer - try { - final String userLayer = (String) param.get("userLayer"); - final String copyLayer = (String) param.get("copyLayer"); - if (userLayer != null && copyLayer != null) { - final File copyFile = new File(copyLayer); - dbg("copy '" + copyFile + "' -> '" + userLayer + "'"); - FileTools.copyDirectory(copyFile, new File(userLayer), new String[]{"temp"}); - dbg("copy '" + copyFile + "' -> '" + userLayer + "' finished"); + if (! param.getBool(util.PropertyName.DONT_BACKUP_USERLAYER)) + { + //copy user_backup into user layer + try { + final String userLayer = (String) param.get("userLayer"); + final String copyLayer = (String) param.get("copyLayer"); + if (userLayer != null && copyLayer != null) + { + final File copyFile = new File(copyLayer); + dbg("copy '" + copyFile + "' -> '" + userLayer + "'"); + FileTools.copyDirectory(copyFile, new File(userLayer), new String[]{"temp"}); + dbg("copy '" + copyFile + "' -> '" + userLayer + "' finished"); - // remove all user_backup folder in temp dir - // this is for the case the runner was killed and some old backup folder still stay in temp dir + // remove all user_backup folder in temp dir + // this is for the case the runner was killed and some old backup folder still stay in temp dir - } else { - System.out.println("Cannot copy layer: '" + copyLayer + "' back to user layer: '" + userLayer + "'"); + } + else + { + System.out.println("Cannot copy layer: '" + copyLayer + "' back to user layer: '" + userLayer + "'"); + } + } + catch (java.io.IOException e) + { + dbg("Couldn't recover from backup\n" + e.getMessage()); } - } catch (java.io.IOException e) { - dbg("Couldn't recover from backup\n" + e.getMessage()); } - return result; } @@ -624,7 +654,7 @@ public class OfficeProvider implements AppProvider { ow.ping(); try { System.out.println(utils.getDateTime() + "OfficeProvider:Owp: sleep "); - OfficeWatcherPing.sleep(5000); + OfficeWatcherPing.sleep(1000); // 5000 } catch (InterruptedException ex) { ex.printStackTrace(); } diff --git a/qadevOOo/runner/helper/OfficeWatcher.java b/qadevOOo/runner/helper/OfficeWatcher.java index 1196283df4bd..c2f32d02314a 100644 --- a/qadevOOo/runner/helper/OfficeWatcher.java +++ b/qadevOOo/runner/helper/OfficeWatcher.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OfficeWatcher.java,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.2.1 $ * * This file is part of OpenOffice.org. * @@ -92,7 +92,7 @@ public class OfficeWatcher extends Thread implements share.Watcher { if (ph != null) { dbg("the Office is idle for " + timeOut / 1000 + " seconds, it probably hangs and is killed NOW."); - final String AppKillCommand = (String) params.get("AppKillCommand"); + final String AppKillCommand = (String) params.get(util.PropertyName.APP_KILL_COMMAND); if (AppKillCommand != null) { final StringTokenizer aKillCommandToken = new StringTokenizer(AppKillCommand, ";"); while (aKillCommandToken.hasMoreTokens()) { diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java index 0e2638b7f1be..af469fdf6442 100644 --- a/qadevOOo/runner/helper/ProcessHandler.java +++ b/qadevOOo/runner/helper/ProcessHandler.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ProcessHandler.java,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.2.2 $ * * This file is part of OpenOffice.org. * @@ -410,7 +410,7 @@ public class ProcessHandler { proc.destroy(); try { - Thread.sleep(5000 * counter); + Thread.sleep(1000 * counter); // 5000 } catch (java.lang.InterruptedException e) { } try { @@ -444,6 +444,8 @@ public class ProcessHandler { log.print(cmdLineArray[i]); log.print(" "); } + log.println(""); + proc = runtime.exec(cmdLineArray, envVars); } else { if (workDir != null) { diff --git a/qadevOOo/runner/helper/PropertyHelper.java b/qadevOOo/runner/helper/PropertyHelper.java index 3210a1e9e846..0747caafece5 100755 --- a/qadevOOo/runner/helper/PropertyHelper.java +++ b/qadevOOo/runner/helper/PropertyHelper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PropertyHelper.java,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.8.1 $ * * This file is part of OpenOffice.org. * @@ -52,18 +52,20 @@ public class PropertyHelper } else { - if (_aPropertyList.size() > 0) - { - aSaveProperties = new PropertyValue[_aPropertyList.size()]; - for (int i = 0;i<_aPropertyList.size(); i++) - { - aSaveProperties[i] = (PropertyValue) _aPropertyList.get(i); - } - } - else - { - aSaveProperties = new PropertyValue[0]; - } + aSaveProperties = (PropertyValue[])_aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]); + // old java 1.4 +// if (_aPropertyList.size() > 0) +// { +// aSaveProperties = new PropertyValue[_aPropertyList.size()]; +// for (int i = 0;i<_aPropertyList.size(); i++) +// { +// aSaveProperties[i] = (PropertyValue) _aPropertyList.get(i); +// } +// } +// else +// { +// aSaveProperties = new PropertyValue[0]; +// } } return aSaveProperties; } diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java index 66beb3bdd127..c87a5b21f263 100644 --- a/qadevOOo/runner/lib/TestParameters.java +++ b/qadevOOo/runner/lib/TestParameters.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TestParameters.java,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.2.1 $ * * This file is part of OpenOffice.org. * @@ -113,10 +113,9 @@ public class TestParameters extends Hashtable { /** * The Path to the test documents that are loaded during the test <br> - * default will be the tmp dir */ - public String TestDocumentPath=util.utils.getUsersTempDir(); + public String TestDocumentPath="unkown"; /** * 'true' is a log should be written, 'false' elsewhere <br> @@ -312,6 +311,8 @@ public class TestParameters extends Hashtable { } else { operatingSystem = PropertyName.UNXSOLS; } + } else if (osname.indexOf ("mac")>-1) { + operatingSystem = PropertyName.UNXMACXI; } else { System.out.println("ERROR: not supported platform: " + osname); System.exit(1); diff --git a/qadevOOo/runner/makefile.mk b/qadevOOo/runner/makefile.mk index 5ab2b51dee36..b3afff1ba9ce 100644 --- a/qadevOOo/runner/makefile.mk +++ b/qadevOOo/runner/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.15 $ +# $Revision: 1.15.2.1 $ # # This file is part of OpenOffice.org. # @@ -38,7 +38,7 @@ TARGET = $(PRJNAME) SUBDIRS_TESTS = mod ifc complex SUBDIRS_RUNNER = util share stats lib complexlib helper basicrunner \ - base org$/openoffice convwatch + base org$/openoffice convwatch graphical JARCOMMANDS_TESTS = $(foreach,i,$(SUBDIRS_TESTS) -C $(CLASSDIR) $i) JARCOMMANDS_RUNNER = $(foreach,i,$(SUBDIRS_RUNNER) -C $(CLASSDIR) $i) diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index 99b1965e8fe5..ee135f7e976a 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: Runner.java,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.8.2 $ * * This file is part of OpenOffice.org. * @@ -42,10 +42,58 @@ import helper.CfgParser; * fill the TestParameters.<br> * Will then call the appropriate Testbase to run the tests. */ -public class Runner { +public class Runner +{ + private static long m_nStartTime; + + private static long getStartTime() + { + return m_nStartTime; + } + /* + simple helper functions to start/stop a timer, to know how long a process need in milliseconds + */ + private static long getTime() + { + return System.currentTimeMillis(); + } + private static void setStartTime(long _nStartTime) + { + m_nStartTime = _nStartTime; + } + + /* + return the time, which is done until last startTime() + */ + private static long meanTime(long _nCurrentTimer) + { + if (_nCurrentTimer == 0) + { + System.out.println("Forgotten to initialise a start timer?"); + return 0; + } + long nMeanTime = getTime(); + return nMeanTime - _nCurrentTimer; + } + + private static String beautifyTime(long _nTime) + { + long sec = (_nTime / 1000) % 60; + long min = (_nTime / (60 * 1000)) % 60; + long hour = _nTime / (60 * 60 * 1000); + StringBuffer aTime = new StringBuffer(); + aTime.append(helper.StringHelper.createValueString((int)hour, 2)). + append(':'). + append(helper.StringHelper.createValueString((int)min, 2)). + append(':'). + append(helper.StringHelper.createValueString((int)sec, 2)); + return aTime.toString(); + } public static void main(String[] args) { + setStartTime(getTime()); + DynamicClassLoader dcl = new DynamicClassLoader(); // get a class for test parameters @@ -63,6 +111,7 @@ public class Runner { ini.getIniParameters(param); //parse the commandline arguments + // TODO: no right error message, if no parameter given! cli.getCommandLineParameter(param,args); Object tj = param.get("TestJob"); @@ -83,11 +132,18 @@ public class Runner { (String)param.get("TestBase")); boolean worked = toExecute.executeTest(param); + long nTime = meanTime(getStartTime()); + String sBeautifyTime = beautifyTime(nTime); - if (!worked) { + System.out.println("Job run took: " + nTime + "ms " + " [" + sBeautifyTime + "]"); + + if (!worked) + { System.out.println("Job "+param.get("TestJob")+" failed"); System.exit(-1); - } else { + } + else + { System.out.println("Job "+param.get("TestJob")+" done"); System.exit(0); } diff --git a/qadevOOo/runner/stats/SimpleLogWriter.java b/qadevOOo/runner/stats/SimpleLogWriter.java index 534f1a28f135..965bf6ebc7ad 100644 --- a/qadevOOo/runner/stats/SimpleLogWriter.java +++ b/qadevOOo/runner/stats/SimpleLogWriter.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: SimpleLogWriter.java,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.2.2 $ * * This file is part of OpenOffice.org. * @@ -64,13 +64,25 @@ public class SimpleLogWriter extends PrintWriter implements LogWriter { } public void println(String msg) { - if ((ow == null) && (entry != null)) { + if ((ow == null) && (entry != null)) + { this.ow = (share.Watcher) entry.UserDefinedParams.get("Watcher"); - if (this.ow != null) { + if (this.ow != null) + { this.ow.ping(); } - } else { - this.ow.ping(); + } + else + { + if (ow != null) + { + this.ow.ping(); + } + else + { + // special case: ow == null && entry == null + System.out.println(msg); + } } if (m_bLogging) { @@ -92,7 +104,11 @@ public class SimpleLogWriter extends PrintWriter implements LogWriter { return this.ow; } - public void setWatcher(Object watcher) { - entry.UserDefinedParams.put("Watcher", (share.Watcher) watcher); + public void setWatcher(Object watcher) + { + if (watcher != null) + { + entry.UserDefinedParams.put("Watcher", (share.Watcher) watcher); + } } } diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java index b31fa31b7dad..16d3386633d4 100644 --- a/qadevOOo/runner/util/AccessibilityTools.java +++ b/qadevOOo/runner/util/AccessibilityTools.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AccessibilityTools.java,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.8.1 $ * * This file is part of OpenOffice.org. * @@ -259,12 +259,14 @@ public class AccessibilityTools { XAccessibleContext ac = xacc.getAccessibleContext(); boolean isShowing = ac.getAccessibleStateSet() .contains(com.sun.star.accessibility.AccessibleStateType.SHOWING); - if ((ac.getAccessibleRole() == role) && + + // hotfix for i91828: + // if role to serach is 0 then ignore the role. + if ( (role == 0 || ac.getAccessibleRole() == role) && (ac.getAccessibleName().indexOf(name) > -1) && (utils.getImplName(ac).indexOf(implName) > -1) && isShowing) { SearchedAccessible = xacc; - //System.out.println("FOUND the desired component -- "+ ac.getAccessibleName() +isShowing); return ac; } else { diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 3f0835dd6438..2e34e4de49d3 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DesktopTools.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.8.2 $ * * This file is part of OpenOffice.org. * @@ -34,26 +34,21 @@ import com.sun.star.awt.WindowDescriptor; import com.sun.star.awt.XToolkit; import com.sun.star.awt.XWindowPeer; import com.sun.star.awt.XTopWindow; -import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XEnumeration; -import com.sun.star.container.XEnumerationAccess; -import com.sun.star.container.XNameAccess; -import com.sun.star.container.XNameContainer; import com.sun.star.container.XNameReplace; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XFrame; import com.sun.star.frame.XModel; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XSingleServiceFactory; import com.sun.star.uno.UnoRuntime; // access the implementations via names import com.sun.star.uno.XInterface; -import com.sun.star.util.XChangesBatch; import com.sun.star.util.XCloseable; import com.sun.star.util.XModifiable; import com.sun.star.view.XViewSettingsSupplier; @@ -123,6 +118,17 @@ public class DesktopTools { } /** + * returns the current component on the desktop + * @param xMSF the XMultiServiceFactory + * @return XComponent of the current component on the desktop + */ + public static XFrame getCurrentFrame(XMultiServiceFactory xMSF) { + XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop.class, createDesktop(xMSF)); + return xDesktop.getCurrentFrame(); + } + + /** * returns an object arrary of all open documents * @param xMSF the MultiServiceFactory * @return returns an Array of document kinds like ["swriter"] @@ -239,7 +245,7 @@ public class DesktopTools { { throw new IllegalArgumentException("Document could not be loaded"); } - + bringWindowToFront(oDoc); return oDoc; } //finish openNewDoc @@ -259,7 +265,9 @@ public class DesktopTools { XCloseable.class, DocumentToClose); try { - modified.setModified(false); + if (modified != null){ + modified.setModified(false); + } closer.close(true); } catch (com.sun.star.util.CloseVetoException e) { System.out.println("Couldn't close document"); @@ -399,12 +407,24 @@ public class DesktopTools { } /** + * Due to typo deprecated + * @param xModel + * @deprecated + */ + @Deprecated + public static void bringWindowToFromt(XModel xModel){ + bringWindowToFront(xModel); + } + + /** * This function brings a document to the front.<P> * NOTE: it is not possible to change the window order of your Window-Manager!! * Only the order of Office documents are changeable. * @param xModel the XModel of the document to bring to top */ - public static void bringWindowToFromt(XModel xModel){ + public static void bringWindowToFront(XModel xModel){ + System.out.println("DEBUG: bring to front xModel"); + XTopWindow xTopWindow = (XTopWindow) UnoRuntime.queryInterface( XTopWindow.class, @@ -412,4 +432,12 @@ public class DesktopTools { xTopWindow.toFront(); } + + public static void bringWindowToFront(XComponent xComponent){ + System.out.println("DEBUG: bring to front xCompoent"); + XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); + if (xModel != null){ + bringWindowToFront(xModel); + } + } } diff --git a/qadevOOo/runner/util/PropertyName.java b/qadevOOo/runner/util/PropertyName.java index 71ba8d5df809..1b0b8ffb7445 100644 --- a/qadevOOo/runner/util/PropertyName.java +++ b/qadevOOo/runner/util/PropertyName.java @@ -39,6 +39,10 @@ public interface PropertyName { */ final public static String APP_EXECUTION_COMMAND = "AppExecutionCommand"; /** + * parameter name: "AppKillCommand" + */ + final public static String APP_KILL_COMMAND = "AppKillCommand"; + /** * parameter name: "ConnectionString" */ final public static String CONNECTION_STRING = "ConnectionString"; @@ -147,4 +151,13 @@ public interface PropertyName { * internal only, no parameter */ final public static String UNXSOLI = "unxsoli"; + /** + * internal only, no parameter + */ + final public static String UNXMACXI = "unxmacxi"; + + /** + * can be used to dont backup the user layer, faster office start/stop but less secure default is to backup the user layer + */ + final public static String DONT_BACKUP_USERLAYER = "DontBackupUserLayer"; } diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 8d2c9dc0136f..a1aecee855f0 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: SOfficeFactory.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.8.2 $ * * This file is part of OpenOffice.org. * @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package util; import java.util.Hashtable; @@ -60,32 +59,31 @@ public class SOfficeFactory { private static Hashtable lookup = new Hashtable(10); protected XComponentLoader oCLoader; - private SOfficeFactory( XMultiServiceFactory xMSF ) { + private SOfficeFactory(XMultiServiceFactory xMSF) { // get XInterface of Desktop service Object oInterface; try { - oInterface = xMSF.createInstance( "com.sun.star.frame.Desktop" ); - } - catch( com.sun.star.uno.Exception e ) { + oInterface = xMSF.createInstance("com.sun.star.frame.Desktop"); + } catch (com.sun.star.uno.Exception e) { throw new IllegalArgumentException( - "Desktop Service not available" ); + "Desktop Service not available"); } // query the desktop interface and then it's componentloader - XDesktop oDesktop = ( XDesktop ) UnoRuntime.queryInterface( - XDesktop.class, oInterface ); + XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop.class, oInterface); - oCLoader = ( XComponentLoader ) UnoRuntime.queryInterface( - XComponentLoader.class, oDesktop ); + oCLoader = (XComponentLoader) UnoRuntime.queryInterface( + XComponentLoader.class, oDesktop); } - public static SOfficeFactory getFactory( XMultiServiceFactory xMSF ) { + public static SOfficeFactory getFactory(XMultiServiceFactory xMSF) { - SOfficeFactory soFactory = (SOfficeFactory)lookup.get(new Integer(xMSF.hashCode()).toString()); + SOfficeFactory soFactory = (SOfficeFactory) lookup.get(new Integer(xMSF.hashCode()).toString()); - if ( soFactory == null ) { - soFactory = new SOfficeFactory( xMSF ); - lookup.put( new Integer(xMSF.hashCode()).toString(), soFactory ); + if (soFactory == null) { + soFactory = new SOfficeFactory(xMSF); + lookup.put(new Integer(xMSF.hashCode()).toString(), soFactory); } return soFactory; @@ -94,83 +92,75 @@ public class SOfficeFactory { // ********************************************************* // Document creation. The documents needed are created here. // ********************************************************* - /** * method which opens a new TextDocument * * @see XTextDocument */ + public XTextDocument createTextDoc(String frameName) + throws com.sun.star.uno.Exception { - public XTextDocument createTextDoc( String frameName ) - throws com.sun.star.uno.Exception { + XComponent oDoc = openDoc("swriter", frameName); - XComponent oDoc = openDoc("swriter",frameName); - - if ( oDoc != null) { - return (XTextDocument) - UnoRuntime.queryInterface( XTextDocument.class, oDoc ); - } - else { + if (oDoc != null) { + DesktopTools.bringWindowToFront(oDoc); + return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, oDoc); + } else { return null; } } // finished createTextDoc + /** * method which opens a new TextDocument * * @see XTextDocument */ - - public XTextDocument createTextDoc( String frameName, PropertyValue[] mediaDescriptor ) - throws com.sun.star.uno.Exception { + public XTextDocument createTextDoc(String frameName, PropertyValue[] mediaDescriptor) + throws com.sun.star.uno.Exception { XComponent oDoc = openDoc("swriter", frameName, mediaDescriptor); - if ( oDoc != null) { - return (XTextDocument) UnoRuntime.queryInterface( XTextDocument.class, oDoc ); - } - else { + if (oDoc != null) { + DesktopTools.bringWindowToFront(oDoc); + return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, oDoc); + } else { return null; } } // finished createTextDoc - - /** + /** * method which opens a new SpreadsheetDocument * * @see XSpreadsheetDocument */ + public XSpreadsheetDocument createCalcDoc(String frameName) + throws com.sun.star.uno.Exception { - public XSpreadsheetDocument createCalcDoc( String frameName ) - throws com.sun.star.uno.Exception { - - XComponent oDoc = openDoc("scalc",frameName); + XComponent oDoc = openDoc("scalc", frameName); - if ( oDoc != null) { - return (XSpreadsheetDocument) - UnoRuntime.queryInterface( XSpreadsheetDocument.class, oDoc ); - } - else { + if (oDoc != null) { + DesktopTools.bringWindowToFront(oDoc); + return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); + } else { return null; } } // finished createCalcDoc - /** + /** * method which opens a new SpreadsheetDocument * * @see XSpreadsheetDocument */ + public XSpreadsheetDocument createCalcDoc(String frameName, PropertyValue[] mediaDescriptor) + throws com.sun.star.uno.Exception { - public XSpreadsheetDocument createCalcDoc( String frameName, PropertyValue[] mediaDescriptor ) - throws com.sun.star.uno.Exception { + XComponent oDoc = openDoc("scalc", frameName, mediaDescriptor); - XComponent oDoc = openDoc("scalc",frameName, mediaDescriptor); - - if ( oDoc != null) { - return (XSpreadsheetDocument) - UnoRuntime.queryInterface( XSpreadsheetDocument.class, oDoc ); - } - else { + if (oDoc != null) { + DesktopTools.bringWindowToFront(oDoc); + return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); + } else { return null; } } // finished createCalcDoc @@ -178,66 +168,58 @@ public class SOfficeFactory { /** * method which opens a new DrawDocument */ + public XComponent createDrawDoc(String frameName) + throws com.sun.star.uno.Exception { - public XComponent createDrawDoc( String frameName ) - throws com.sun.star.uno.Exception { - - return openDoc("sdraw",frameName); + return openDoc("sdraw", frameName); } // finished createDrawDoc /** * method which opens a new ImpressDocument */ - /** * method which opens a new DrawDocument */ + public XComponent createDrawDoc(String frameName, PropertyValue[] mediaDescriptor) + throws com.sun.star.uno.Exception { - public XComponent createDrawDoc( String frameName, PropertyValue[] mediaDescriptor ) - throws com.sun.star.uno.Exception { - - return openDoc("sdraw",frameName, mediaDescriptor ); + return openDoc("sdraw", frameName, mediaDescriptor); } // finished createDrawDoc /** * method which opens a new ImpressDocument */ + public XComponent createImpressDoc(String frameName) + throws com.sun.star.uno.Exception { - public XComponent createImpressDoc( String frameName ) - throws com.sun.star.uno.Exception { - - return openDoc("simpress",frameName); + return openDoc("simpress", frameName); } // finished createImpressDoc /** * method which opens a new ImpressDocument */ + public XComponent createImpressDoc(String frameName, PropertyValue[] mediaDescriptor) + throws com.sun.star.uno.Exception { - public XComponent createImpressDoc( String frameName, PropertyValue[] mediaDescriptor ) - throws com.sun.star.uno.Exception { - - return openDoc("simpress",frameName, mediaDescriptor); + return openDoc("simpress", frameName, mediaDescriptor); } // finished createImpressDoc - /** * method which opens a new MathDocument */ + public XComponent createMathDoc(String frameName) + throws com.sun.star.uno.Exception { - public XComponent createMathDoc( String frameName ) - throws com.sun.star.uno.Exception { - - return openDoc("smath",frameName); + return openDoc("smath", frameName); } // finished createMathDoc /** * method which opens a new MathDocument */ + public XComponent createMathDoc(String frameName, PropertyValue[] mediaDescriptor) + throws com.sun.star.uno.Exception { - public XComponent createMathDoc( String frameName, PropertyValue[] mediaDescriptor ) - throws com.sun.star.uno.Exception { - - return openDoc("smath",frameName, mediaDescriptor); + return openDoc("smath", frameName, mediaDescriptor); } // finished createMathDoc /** @@ -245,121 +227,120 @@ public class SOfficeFactory { * * @see XChartDocument */ - - public XChartDocument createChartDoc( String frameName ) - throws com.sun.star.uno.Exception { + public XChartDocument createChartDoc(String frameName) + throws com.sun.star.uno.Exception { // XComponent oDoc = loadDocument( // util.utils.getFullTestURL("emptyChart.sds")); XComponent oDoc = loadDocument("private:factory/schart"); - if ( oDoc != null) { - return (XChartDocument) - UnoRuntime.queryInterface( XChartDocument.class, oDoc ); - } - else { + if (oDoc != null) { + DesktopTools.bringWindowToFront(oDoc); + return (XChartDocument) UnoRuntime.queryInterface(XChartDocument.class, oDoc); + } else { return null; } } // finished createChartDoc - /** * creates a simple TextTable defaultet to 2 rows and 2 columns */ - public static XTextTable createTextTable( XTextDocument xTextDoc ) - throws com.sun.star.uno.Exception { + public static XTextTable createTextTable(XTextDocument xTextDoc) + throws com.sun.star.uno.Exception { TableDsc tDsc = new TableDsc(); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextTable oTable = (XTextTable)instCreate.getInstance(); + XTextTable oTable = (XTextTable) instCreate.getInstance(); return oTable; } + /** * creates a TextTable with a specified count of rows and columns */ - public static XTextTable createTextTable( XTextDocument xTextDoc, - int rows, int columns ) - throws com.sun.star.uno.Exception { + public static XTextTable createTextTable(XTextDocument xTextDoc, + int rows, int columns) + throws com.sun.star.uno.Exception { - TableDsc tDsc = new TableDsc( rows, columns ); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + TableDsc tDsc = new TableDsc(rows, columns); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextTable oTable = (XTextTable)instCreate.getInstance(); + XTextTable oTable = (XTextTable) instCreate.getInstance(); return oTable; - } + } + /** * creates a simple TextFrame * ... to be continued */ - public static XTextFrame createTextFrame( XTextDocument xTextDoc ) - throws com.sun.star.uno.Exception { + public static XTextFrame createTextFrame(XTextDocument xTextDoc) + throws com.sun.star.uno.Exception { FrameDsc tDsc = new FrameDsc(); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextFrame oFrame = (XTextFrame)instCreate.getInstance(); + XTextFrame oFrame = (XTextFrame) instCreate.getInstance(); return oFrame; } + /** * creates a simple TextFrame * ... to be continued */ - public static XTextFrame createTextFrame( XTextDocument xTextDoc, - int height, int width ) - { + public static XTextFrame createTextFrame(XTextDocument xTextDoc, + int height, int width) { FrameDsc tDsc = new FrameDsc(height, width); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextFrame oFrame = (XTextFrame)instCreate.getInstance(); + XTextFrame oFrame = (XTextFrame) instCreate.getInstance(); return oFrame; } - public static void insertString( XTextDocument xTextDoc, String cString ) - throws com.sun.star.uno.Exception { - XText xText = xTextDoc.getText(); - XText oText = (XText)UnoRuntime.queryInterface( - XText.class, xText); + public static void insertString(XTextDocument xTextDoc, String cString) + throws com.sun.star.uno.Exception { + XText xText = xTextDoc.getText(); + XText oText = (XText) UnoRuntime.queryInterface( + XText.class, xText); - XTextCursor oCursor = oText.createTextCursor(); - oText.insertString(oCursor, cString, false); + XTextCursor oCursor = oText.createTextCursor(); + oText.insertString(oCursor, cString, false); } - public static void insertTextContent( XTextDocument xTextDoc, - XTextContent xCont ) - throws com.sun.star.lang.IllegalArgumentException { - XText xText = xTextDoc.getText(); - XText oText = (XText)UnoRuntime.queryInterface( - XText.class, xText); + public static void insertTextContent(XTextDocument xTextDoc, + XTextContent xCont) + throws com.sun.star.lang.IllegalArgumentException { + XText xText = xTextDoc.getText(); + XText oText = (XText) UnoRuntime.queryInterface( + XText.class, xText); - XTextCursor oCursor = oText.createTextCursor(); - oText.insertTextContent(oCursor, xCont, false); + XTextCursor oCursor = oText.createTextCursor(); + oText.insertTextContent(oCursor, xCont, false); } - public static com.sun.star.table.XCell getFirstTableCell( - XTextContent oTable ) { + public static com.sun.star.table.XCell getFirstTableCell( + XTextContent oTable) { - String CellNames[] = ((XTextTable)oTable).getCellNames(); + String CellNames[] = ((XTextTable) oTable).getCellNames(); - com.sun.star.table.XCell oCell = ((XTextTable)oTable).getCellByName( - CellNames[0]); - return oCell; + com.sun.star.table.XCell oCell = ((XTextTable) oTable).getCellByName( + CellNames[0]); + return oCell; } /** * the method createBookmark */ - public static XTextContent createBookmark( XTextDocument xTextDoc ) - throws com.sun.star.uno.Exception { + public static XTextContent createBookmark(XTextDocument xTextDoc) + throws com.sun.star.uno.Exception { BookmarkDsc tDsc = new BookmarkDsc(); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextContent oBookmark = (XTextContent)instCreate.getInstance(); + XTextContent oBookmark = (XTextContent) instCreate.getInstance(); return oBookmark; } /// finish createBookmark @@ -367,13 +348,13 @@ public class SOfficeFactory { /** * the method createReferenceMark */ - public static XTextContent createReferenceMark( XTextDocument xTextDoc ) - throws com.sun.star.uno.Exception { + public static XTextContent createReferenceMark(XTextDocument xTextDoc) + throws com.sun.star.uno.Exception { ReferenceMarkDsc tDsc = new ReferenceMarkDsc(); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextContent oReferenceMark = (XTextContent)instCreate.getInstance(); + XTextContent oReferenceMark = (XTextContent) instCreate.getInstance(); return oReferenceMark; } /// finish createReferenceMark @@ -381,13 +362,13 @@ public class SOfficeFactory { /** * the method createFootnote */ - public static XTextContent createFootnote( XTextDocument xTextDoc ) - throws com.sun.star.uno.Exception { + public static XTextContent createFootnote(XTextDocument xTextDoc) + throws com.sun.star.uno.Exception { FootnoteDsc tDsc = new FootnoteDsc(); - InstCreator instCreate = new InstCreator( xTextDoc, tDsc ); + InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextContent oFootnote = (XTextContent)instCreate.getInstance(); + XTextContent oFootnote = (XTextContent) instCreate.getInstance(); return oFootnote; } /// finish createFootnote @@ -395,68 +376,64 @@ public class SOfficeFactory { /** * the method create Index */ + public static XTextContent createIndex(XTextDocument xTextDoc, String kind) + throws com.sun.star.uno.Exception { - public static XTextContent createIndex( XTextDocument xTextDoc, String kind) - throws com.sun.star.uno.Exception { + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, + xTextDoc); - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) - UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDoc ); + Object oInt = oDocMSF.createInstance(kind); - Object oInt = oDocMSF.createInstance( kind ); - - XTextContent xTC = (XTextContent) - UnoRuntime.queryInterface(XDocumentIndex.class,oInt); + XTextContent xTC = (XTextContent) UnoRuntime.queryInterface(XDocumentIndex.class, oInt); return xTC; } - public static XSpreadsheet createSpreadsheet( XSpreadsheetDocument oDoc ) - throws com.sun.star.uno.Exception { + public static XSpreadsheet createSpreadsheet(XSpreadsheetDocument oDoc) + throws com.sun.star.uno.Exception { - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) - UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); Object oInt = oDocMSF.createInstance( - "com.sun.star.sheet.Spreadsheet" ); + "com.sun.star.sheet.Spreadsheet"); - XSpreadsheet oSpreadsheet = (XSpreadsheet) - UnoRuntime.queryInterface( XSpreadsheet.class, oInt ); + XSpreadsheet oSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, oInt); return oSpreadsheet; } - public static XIndexAccess getTableCollection( XTextDocument oDoc ){ + public static XIndexAccess getTableCollection(XTextDocument oDoc) { - XTextTablesSupplier oTTS = (XTextTablesSupplier) - UnoRuntime.queryInterface( XTextTablesSupplier.class, oDoc ); + XTextTablesSupplier oTTS = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, oDoc); XNameAccess oNA = oTTS.getTextTables(); - XIndexAccess oIA = (XIndexAccess) - UnoRuntime.queryInterface( XIndexAccess.class, oNA ); + XIndexAccess oIA = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oNA); return oIA; } - public static String getUniqueName( XInterface oInterface, String prefix ) { - XNameAccess oNameAccess = (XNameAccess) - UnoRuntime.queryInterface( XNameAccess.class, oInterface ); - if (oNameAccess == null) + public static String getUniqueName(XInterface oInterface, String prefix) { + XNameAccess oNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oInterface); + if (oNameAccess == null) { return null; + } int i; - for (i = 0; oNameAccess.hasByName( prefix + i ); i++ ) {}; + for (i = 0; oNameAccess.hasByName(prefix + i); i++) { + } + ; return prefix + i; } public XShape createShape(XComponent oDoc, int height, int width, int x, int y, String kind) { //possible values for kind are 'Ellipse', 'Line' and 'Rectangle' - ShapeDsc sDsc = new ShapeDsc( height, width, x, y, kind ); - InstCreator instCreate = new InstCreator( oDoc, sDsc ); + ShapeDsc sDsc = new ShapeDsc(height, width, x, y, kind); + InstCreator instCreate = new InstCreator(oDoc, sDsc); - XShape oShape = (XShape)instCreate.getInstance(); + XShape oShape = (XShape) instCreate.getInstance(); - return oShape; + return oShape; } @@ -467,194 +444,189 @@ public class SOfficeFactory { XInterface oInterface = null; XDiagram oDiagram = null; - //get LineDiagram - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + //get LineDiagram + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); - try{ - oInterface = (XInterface) oDocMSF.createInstance("com.sun.star.chart."+kind); - oDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, oInterface); - } catch ( Exception e ) { + try { + oInterface = (XInterface) oDocMSF.createInstance("com.sun.star.chart." + kind); + oDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, oInterface); + } catch (Exception e) { // Some exception occures.FAILED - System.out.println( "Couldn't create "+kind+"-Diagram "+ e ); + System.out.println("Couldn't create " + kind + "-Diagram " + e); } return oDiagram; } /* // create a Control-Instance which specified in kind(String) - */ + */ public XInterface createControl(XComponent oDoc, String kind) { XInterface oControl = null; - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); - try{ - oControl = (XInterface) oDocMSF.createInstance("com.sun.star.form.component."+kind); - } catch ( Exception e ) { + try { + oControl = (XInterface) oDocMSF.createInstance("com.sun.star.form.component." + kind); + } catch (Exception e) { // Some exception occures.FAILED - System.out.println( "Couldn't create instance "+ kind + ": "+ e ); + System.out.println("Couldn't create instance " + kind + ": " + e); } - return oControl; + return oControl; } /* // create an Instance which is specified in kind(String) - */ + */ public Object createInstance(XComponent oDoc, String kind) { Object oInstance = null; - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); - try{ - oInstance = (Object) oDocMSF.createInstance(kind); - } catch ( Exception e ) { + try { + oInstance = (Object) oDocMSF.createInstance(kind); + } catch (Exception e) { // Some exception occures.FAILED - System.out.println( "Couldn't create instance "+ kind + ": "+ e ); + System.out.println("Couldn't create instance " + kind + ": " + e); } - return oInstance; + return oInstance; } - public XControlShape createControlShape(XComponent oDoc, int height, int width, int x, int y, String kind) { - Size size = new Size(); + Size size = new Size(); Point position = new Point(); XControlShape oCShape = null; XControlModel aControl = null; //get MSF - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); - - try{ - Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); - Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon ); - oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt ); - size.Height = height; - size.Width = width; - position.X = x; - position.Y = y; - oCShape.setSize(size); - oCShape.setPosition(position); - - - } catch ( Exception e ) { + XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + + try { + Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); + Object aCon = oDocMSF.createInstance("com.sun.star.form.component." + kind); + aControl = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aCon); + oCShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, oInt); + size.Height = height; + size.Width = width; + position.X = x; + position.Y = y; + oCShape.setSize(size); + oCShape.setPosition(position); + + + } catch (Exception e) { // Some exception occures.FAILED - System.out.println( "Couldn't create instance "+ e ); + System.out.println("Couldn't create instance " + e); } - try{ - oCShape.setControl(aControl); - } catch ( Exception e ) { + try { + oCShape.setControl(aControl); + } catch (Exception e) { // Some exception occures.FAILED - System.out.println( "Couldn't get Control "+ e ); + System.out.println("Couldn't get Control " + e); } - return oCShape; + return oCShape; } - public XComponent loadDocument( String fileName ) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.io.IOException, - com.sun.star.uno.Exception { + public XComponent loadDocument(String fileName) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.io.IOException, + com.sun.star.uno.Exception { - // that noargs thing for load attributes - PropertyValue [] szEmptyArgs = new PropertyValue [0]; - String frameName = "_blank"; - - XComponent oDoc = oCLoader.loadComponentFromURL( - fileName, frameName, 0, szEmptyArgs ); + // that noargs thing for load attributes + PropertyValue[] szEmptyArgs = new PropertyValue[0]; + String frameName = "_blank"; - if ( oDoc == null ) { - return null; - } + XComponent oDoc = oCLoader.loadComponentFromURL( + fileName, frameName, 0, szEmptyArgs); - return oDoc; + if (oDoc == null) { + return null; + } + DesktopTools.bringWindowToFront(oDoc); + return oDoc; } - public XComponent loadDocument( String fileName , PropertyValue[] Args) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.io.IOException, - com.sun.star.uno.Exception { + public XComponent loadDocument(String fileName, PropertyValue[] Args) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.io.IOException, + com.sun.star.uno.Exception { - // that noargs thing for load attributes - String frameName = "_blank"; + // that noargs thing for load attributes + String frameName = "_blank"; - XComponent oDoc = oCLoader.loadComponentFromURL( - fileName, frameName, 0, Args ); + XComponent oDoc = oCLoader.loadComponentFromURL( + fileName, frameName, 0, Args); - if ( oDoc == null ) { - return null; - } + if (oDoc == null) { + return null; + } + DesktopTools.bringWindowToFront(oDoc); - return oDoc; + return oDoc; } public XComponent openDoc(String kind, String frameName) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.io.IOException, - com.sun.star.uno.Exception { + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.io.IOException, + com.sun.star.uno.Exception { // that noargs thing for load attributes - PropertyValue [] Args = null; + PropertyValue[] Args = null; if (kind.equals("simpress")) { - Args = new PropertyValue [1]; + Args = new PropertyValue[1]; PropertyValue Arg = new PropertyValue(); Arg.Name = "OpenFlags"; Arg.Value = "S"; Arg.Handle = -1; Arg.State = PropertyState.DEFAULT_VALUE; - Args[0]=Arg; - } - else { - Args = new PropertyValue [0]; + Args[0] = Arg; + } else { + Args = new PropertyValue[0]; } - if ( frameName == null ) { + if (frameName == null) { frameName = "_blank"; } // load a blank a doc - XComponent oDoc = oCLoader.loadComponentFromURL( - "private:factory/"+kind, frameName, 40, Args ); + XComponent oDoc = oCLoader.loadComponentFromURL("private:factory/" + kind, frameName, 40, Args); + DesktopTools.bringWindowToFront(oDoc); return oDoc; } // finished openDoc - - public XComponent openDoc(String kind, String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.io.IOException, - com.sun.star.uno.Exception { + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.io.IOException, + com.sun.star.uno.Exception { - if ( frameName == null ) { - frameName = "_blank"; - } - // load a blank a doc - XComponent oDoc = oCLoader.loadComponentFromURL( - "private:factory/"+kind, frameName, 40, mediaDescriptor ); + if (frameName == null) { + frameName = "_blank"; + } + // load a blank a doc + XComponent oDoc = oCLoader.loadComponentFromURL( + "private:factory/" + kind, frameName, 40, mediaDescriptor); + DesktopTools.bringWindowToFront(oDoc); - return oDoc; + return oDoc; } // finished openDoc // query for XServiceInfo - public Object queryXServiceInfo( Object oObj ) - { - if ( oObj != null ) { + public Object queryXServiceInfo(Object oObj) { + if (oObj != null) { XServiceInfo oInfo = (XServiceInfo) UnoRuntime.queryInterface( - XServiceInfo.class, oObj); - System.out.println ("!!!! XServiceInfo n.a. !!!! "); - } - else { - System.out.println ("Object is empty!!!! "); + XServiceInfo.class, oObj); + System.out.println("!!!! XServiceInfo n.a. !!!! "); + } else { + System.out.println("Object is empty!!!! "); } return null; } // finish queryXServiceInfo - }
\ No newline at end of file diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java index 7ab13882487f..3f154fa6248c 100644 --- a/qadevOOo/runner/util/compare/GraphicalComparator.java +++ b/qadevOOo/runner/util/compare/GraphicalComparator.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: GraphicalComparator.java,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.8.1 $ * * This file is part of OpenOffice.org. * @@ -122,7 +122,7 @@ class GraphicalComparator implements DocComparator String sInputPath = m_aArguments.getInputPath(); if (FileHelper.isDir(sInputPath)) { - Object[] aList = DirectoryHelper.traverse(sInputPath, m_aArguments.getFileFilter(), m_aArguments.includeSubDirectories()); + Object[] aList = DirectoryHelper.traverse(sInputPath, FileHelper.getFileFilter(), m_aArguments.includeSubDirectories()); for (int i=0;i<aList.length;i++) { // get document + path diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 5c682d31507f..f4cf3d1253dd 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: utils.java,v $ - * $Revision: 1.17 $ + * $Revision: 1.17.2.3 $ * * This file is part of OpenOffice.org. * @@ -68,6 +68,8 @@ public class utils { * * This method adds the DOCPTH to a given file * + * @param sDocName the file which should be completed to the test doc path + * @return $TESTDOCPATH/sDocName */ public static String getFullTestDocName(String sDocName) { String docpth = System.getProperty("DOCPTH"); @@ -75,17 +77,46 @@ public class utils { docpth = docpth.substring(0, docpth.length() - 1); } + System.out.println("docpth:" + docpth); + + String pthSep = System.getProperty("file.separator"); + + if (docpth.equals("unkown")) { + System.out.println("try to get tDoc from $SRC_ROOT/qadevOOo"); + String srcRoot = System.getProperty(PropertyName.SRC_ROOT); + if (srcRoot != null) { + File srcR = new File(srcRoot); + String[] list = srcR.list(new FilenameFilter() { + + public boolean accept(File dir, String name) { + return name.startsWith("qadevOOo"); + } + }); + + if (list[0] != null) { + String tDoc = srcRoot.concat(pthSep).concat(list[0]).concat(pthSep).concat("testdocs"); + + if (new File(tDoc).exists()) { + docpth = tDoc; + } + } + } + } + if (docpth.startsWith("http:")) { return docpth + "/" + sDocName; } String testdocPth = ""; - String pthSep = System.getProperty("file.separator"); - if (docpth == null) { + + if (docpth.equals("unkown")) { + System.out.println("try to get tDoc from OBJDSCS"); String objdscPth = System.getProperty("OBJDSCS"); - int i = objdscPth.indexOf("objdsc"); - String arcPth = objdscPth.substring(0, i - 1); - testdocPth = arcPth + pthSep + "doc" + pthSep + "java" + - pthSep + "testdocs" + pthSep + sDocName; + if (objdscPth != null) { + int i = objdscPth.indexOf("objdsc"); + String arcPth = objdscPth.substring(0, i - 1); + testdocPth = arcPth + pthSep + "doc" + pthSep + "java" + + pthSep + "testdocs" + pthSep + sDocName; + } } else { testdocPth = docpth + pthSep + sDocName; } @@ -924,7 +955,8 @@ public class utils { XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xCont); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, + XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( + XURLTransformer.class, xMSF.createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an array of URL objects. |