diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed /qadevOOo | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
Diffstat (limited to 'qadevOOo')
43 files changed, 60 insertions, 2296 deletions
diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java index 74fad940051f..575ec0793f69 100644 --- a/qadevOOo/runner/complexlib/Assurance.java +++ b/qadevOOo/runner/complexlib/Assurance.java @@ -55,109 +55,27 @@ public class Assurance 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", 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, expected, 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 @@ -169,33 +87,11 @@ public class Assurance 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 @@ -207,24 +103,9 @@ public class Assurance 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 ); - } + + /** * assures the two given sequences are of equal length, and have equal content @@ -239,13 +120,7 @@ public class Assurance } } - /** - * assures the two given sequences are of equal length, and have equal content - */ - public <T> void assureEquals( String i_message, T[] i_expected, T[] i_actual ) - { - assureEquals( i_message, i_expected, i_actual, false ); - } + /** invokes a given method on a given object, and assures a certain exception is caught * @param _message is the message to print when the check fails @@ -301,49 +176,11 @@ public class Assurance assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method. Those implicitly define - * the classes of the arguments of the method which is called. - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, - final Class<?> _expectedExceptionClass ) - { - assureException( - "did not catch the expected exception (" + - ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + - ") while calling " + _object.getClass().getName() + "." + _methodName, - _object, _methodName, _methodArgs, _expectedExceptionClass ); - } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method - * @param _argClasses are the classes to assume for the arguments of the methods - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - protected void assureException( final Object _object, final String _methodName, final Class<?>[] _argClasses, - final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) - { - assureException( - "did not catch the expected exception (" + - ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + - ") while calling " + _object.getClass().getName() + "." + _methodName, - _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); - } - /** - * 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. diff --git a/qadevOOo/runner/convwatch/DBHelper.java b/qadevOOo/runner/convwatch/DBHelper.java index 12b2651613b0..e6381f027ccf 100644 --- a/qadevOOo/runner/convwatch/DBHelper.java +++ b/qadevOOo/runner/convwatch/DBHelper.java @@ -188,44 +188,7 @@ public class DBHelper aSQLThread.start(); } - public int QueryIntFromSQL(Connection _aCon, String _sSQL, String _sColumnName) - throws ValueNotFoundException - { - Statement oStmt = null; - int nValue = 0; - try - { - oStmt = _aCon.createStatement(); - - ResultSet oResult = oStmt.executeQuery(_sSQL); - oResult.next(); - try - { - if (_sColumnName.length() == 0) - { - // take the first row value (started with 1) - nValue = oResult.getInt(1); - } - else - { - nValue = oResult.getInt(_sColumnName); - } - } - catch (SQLException e) - { - String sError = e.getMessage(); - GlobalLogWriter.get().println("DB: Original SQL error: " + sError); - throw new ValueNotFoundException("Can't execute SQL: " + _sSQL); - } - } - catch(SQLException e) - { - String sError = e.getMessage(); - GlobalLogWriter.get().println("DB: Couldn't execute sql string " + _sSQL + "\n" + sError); - } - return nValue; - } public String Quote(String _sToQuote) { diff --git a/qadevOOo/runner/convwatch/DirectoryHelper.java b/qadevOOo/runner/convwatch/DirectoryHelper.java index ac0b94de12c7..ee338d3e09d5 100644 --- a/qadevOOo/runner/convwatch/DirectoryHelper.java +++ b/qadevOOo/runner/convwatch/DirectoryHelper.java @@ -71,13 +71,7 @@ public class DirectoryHelper return a.m_aFileList.toArray(); } - public static Object[] traverse( String _sDirectory, boolean _bRecursiveIsAllowed ) - { - DirectoryHelper a = new DirectoryHelper(); - a.setRecursiveIsAllowed(_bRecursiveIsAllowed); - a.traverse_impl(_sDirectory, null); - return a.m_aFileList.toArray(); - } + private void traverse_impl( String afileDirectory, FileFilter _aFileFilter ) { diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java index 221be5fa74be..3cf88eb267b4 100644 --- a/qadevOOo/runner/convwatch/FileHelper.java +++ b/qadevOOo/runner/convwatch/FileHelper.java @@ -39,12 +39,7 @@ public class FileHelper } - public static void MessageBox(String _sStr) - { - String sVersion = System.getProperty("java.version"); - String sOSName = System.getProperty("os.name"); - JOptionPane.showMessageDialog( null, _sStr, sVersion + " " + sOSName + " Hello World Debugger", JOptionPane.INFORMATION_MESSAGE ); - } + public static boolean exists(String _sFile) { diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java index 9d2919fcaf95..bc64b148ee62 100644 --- a/qadevOOo/runner/convwatch/FilenameHelper.java +++ b/qadevOOo/runner/convwatch/FilenameHelper.java @@ -175,13 +175,7 @@ abstract class FilenameHelper_impl implements Filenamer return FileHelper.isDir(getSystemPath()); } - /** - * @return true, if the file really exist. - */ - public boolean exists() - { - return FileHelper.exists(createAbsoluteFilename()); - } + /** * @return the current suffix diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java index 0f8182b998c7..23e975815837 100644 --- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java +++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java @@ -191,16 +191,7 @@ public class GraphicalDifferenceCheck return bOk; } - /** - * Used for the comparance of graphical differences. - * Method compares one document (_sInputFile) with an older document of the same name in the provided directory (_sReferencePath). - * - * The path _sOutputPath must be writeable - */ - public static boolean checkOneFile(String _sInputFile, String _sOutputPath, String _sReferencePath, GraphicalTestArguments _aGTA) throws ConvWatchException - { - return checkOneFile( _sInputFile, _sOutputPath, _sReferencePath, null, _aGTA); - } + /** diff --git a/qadevOOo/runner/convwatch/HTMLOutputter.java b/qadevOOo/runner/convwatch/HTMLOutputter.java index 6425ec96816b..087101c97576 100644 --- a/qadevOOo/runner/convwatch/HTMLOutputter.java +++ b/qadevOOo/runner/convwatch/HTMLOutputter.java @@ -206,168 +206,13 @@ public class HTMLOutputter private final static String DIFFER_BM_TABLETITLE = "Diff file (RB)"; private final static String OK_TABLETITLE = "OK?"; - public void checkSection(String _sDocumentName) - { - try - { - m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls); - m_aOut.write( "<p>Legend:<br>"); - m_aOut.write( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<br>"); - m_aOut.write( stronghtml(SECONDGFX_TABLETITLE) + " contains the same document opened within OpenOffice.org also printed via ghostscript as jpeg.<br>"); - m_aOut.write( stronghtml(DIFFER_TABLETITLE)+" is build via composite from original and new picture. The result should be a whole black picture, if there are no differences.<br>At the moment "+stronghtml(STATUS_TABLETITLE)+" is only ok, if the difference file contains only one color (black).</p>" ); - m_aOut.write( stronghtml(DIFFER_BM_TABLETITLE) + " is build via composite from original and new picture after the border of both pictures are removed, so differences based on center problems may solved here"); - m_aOut.write( "</p>"); - m_aOut.write( "<p>Some words about the percentage value<br>"); - m_aOut.write( "If a character is on the original page (a) and on the new page this character is moved to an other position only (b) , this means the difference is 100%.<br>"); - m_aOut.write( "If character (b) is also bigger than character (a) the percentage is grow over the 100% mark.<br>"); - m_aOut.write( "This tool count only the pixels which are differ to it's background color. It makes no sense to count all pixels, or the difference percentage will most the time in a very low percentage range."); - m_aOut.write( "</p>"); - m_aOut.write( "<table class=\"infotable\">" + ls); - m_aOut.write( "<TR>" + ls); - m_aOut.write( tableHeaderCell( FIRSTGFX_TABLETITLE) ); - m_aOut.write( tableHeaderCell( SECONDGFX_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(DIFFER_BM_TABLETITLE) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_BM_TABLETITLE ) ); - m_aOut.write( tableHeaderCell( OK_TABLETITLE) ); - m_aOut.write( "</TR>" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } - } - - public void checkLine(StatusHelper _aStatus, boolean _bCurrentResult) - { - try - { - m_aOut.write( "<TR>" + ls); - String sLink = getHREF(FileHelper.getBasename(_aStatus.m_sOldGfx), FileHelper.getBasename(_aStatus.m_sOldGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx)); - m_aOut.write( tableDataCell(sLink) ); - String sPercent = String.valueOf(_aStatus.nPercent) + "%"; - if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5) - { - sPercent += " (less 5% is ok)"; - } - m_aOut.write(tableDataCell( sPercent ) ); - - if (_aStatus.m_sDiff_BM_Gfx == null) - { - sLink = "No diffs, therefore no moves"; - m_aOut.write( tableDataCell(sLink) ); - m_aOut.write(tableDataCell( "" ) ); - } - else - { - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx), FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx)); - m_aOut.write( tableDataCell(sLink) ); - - String sPercent2 = String.valueOf(_aStatus.nPercent2) + "%"; - if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5) - { - sPercent2 += " (less 5% is ok)"; - } - m_aOut.write(tableDataCell( sPercent2 ) ); - } - - // is the check positiv, in a defined range - if (_bCurrentResult) - { - m_aOut.write(tableDataCell( "YES" ) ); - } - else - { - m_aOut.write(tableDataCell( "NO" ) ); - } - - m_aOut.write( "</TR>" + ls); - } - catch (java.io.IOException e) - { - } - } - public void checkDiffDiffSection(String _sDocumentName) - { - try - { - m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls); - - m_aOut.write( "<p>Legend:<br>"); - m_aOut.write( "</p>"); - - m_aOut.write( "<table class=\"infotable\">" + ls); - - m_aOut.write( "<TR>" + ls); - m_aOut.write( tableHeaderCell( "Source to actual difference" ) ); - m_aOut.write( tableHeaderCell( "Actual difference" ) ); - m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) ); - - m_aOut.write( tableHeaderCell( OK_TABLETITLE) ); - - m_aOut.write( "</TR>" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } - } - - public void checkDiffDiffLine(StatusHelper _aStatus, boolean _bCurrentResult) - { - try - { - m_aOut.write( "<TR>" + ls); - // the link to the old difference can't offer here - - String sBasename = FileHelper.getBasename(m_sFilename); - String sNew = sBasename.substring(m_sNamePrefix.length()); - - String sLink; - sLink = getHREF(sNew, sNew); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx)); - m_aOut.write( tableDataCell(sLink) ); - - String sPercent = String.valueOf(_aStatus.nPercent) + "%"; - m_aOut.write(tableDataCell( sPercent ) ); - - // is the check positiv, in a defined range - if (_bCurrentResult) - { - m_aOut.write(tableDataCell( "YES" ) ); - } - else - { - m_aOut.write(tableDataCell( "NO" ) ); - } - - m_aOut.write( "</TR>" + ls); - } - catch (java.io.IOException e) - { - } - } - } diff --git a/qadevOOo/runner/convwatch/INIOutputter.java b/qadevOOo/runner/convwatch/INIOutputter.java index 673b8789be46..3c9745fbe198 100644 --- a/qadevOOo/runner/convwatch/INIOutputter.java +++ b/qadevOOo/runner/convwatch/INIOutputter.java @@ -98,10 +98,7 @@ public class INIOutputter } } - public void startSection(int _nNumber) - { - writeSection( "page" + String.valueOf(_nNumber)); - } + public void close() { diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 1b3f46942dc5..dc3b55a50774 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -267,91 +267,10 @@ class IniFile return sValue; } - /** - write back the ini file to the disk, only if there exist changes - */ - public void store() - { - if (m_bListContainUnsavedChanges == false) - { - // nothing has changed, so no need to store - return; - } - File aFile = new File(m_sFilename); - if (aFile.exists()) - { - aFile.delete(); - if (aFile.exists()) - { - GlobalLogWriter.get().println("Couldn't delete the file " + m_sFilename); - return; - } - } - try - { - RandomAccessFile aWriter = new RandomAccessFile(aFile, "rw"); - for (int i=0; i<m_aList.size();i++) - { - String sLine = getItem(i); - aWriter.writeBytes(sLine); - aWriter.writeByte('\n'); - } - aWriter.close(); - } - catch (java.io.FileNotFoundException fne) - { - GlobalLogWriter.get().println("couldn't open file for writing " + m_sFilename); - GlobalLogWriter.get().println("Message: " + fne.getMessage()); - } - catch(java.io.IOException ie) - { - GlobalLogWriter.get().println("Exception occurs while writing to file " + m_sFilename); - GlobalLogWriter.get().println("Message: " + ie.getMessage()); - } - } - /** - insert a value - there are 3 cases - 1. section doesn't exist, goto end and insert a new section, insert a new key value pair - 2. section exist but key not, search section, search key, if key is -1 get last known key position and insert new key value pair there - 3. section exist and key exist, remove the old key and insert the key value pair at the same position - */ - public void insertValue(String _sSection, String _sKey, String _sValue) - { - int i = findSection(_sSection); - if (i == -1) - { - // case 1: section doesn't exist - String sFindSection = buildSectionName(_sSection); - - m_aList.add(sFindSection); - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.add(sKeyValuePair); - m_bListContainUnsavedChanges = true; - return; - } - int j = findKeyFromKnownSection(i, _sKey); - if (j == -1) - { - // case 2: section exist, but not the key - j = findLastKnownKeyIndex(i, _sKey); - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.add(j, sKeyValuePair); - m_bListContainUnsavedChanges = true; - return; - } - else - { - // case 3: section exist, and also the key - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.set(j, sKeyValuePair); - m_bListContainUnsavedChanges = true; - } - } } diff --git a/qadevOOo/runner/convwatch/LISTOutputter.java b/qadevOOo/runner/convwatch/LISTOutputter.java index 3053953f1f3c..175b32d3b2a6 100644 --- a/qadevOOo/runner/convwatch/LISTOutputter.java +++ b/qadevOOo/runner/convwatch/LISTOutputter.java @@ -56,17 +56,7 @@ public class LISTOutputter } public String getFilename() {return m_sFilename;} - public void createHeader() - { - try - { - m_aOut.write("# This file is automatically created by a convwatch run" + ls); - m_aOut.write("# " + ls); - } - catch (java.io.IOException e) - { - } - } + public void writeValue(String _sValue) { diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java index 376d0a6edbe7..83da79d511d6 100644 --- a/qadevOOo/runner/convwatch/OfficePrint.java +++ b/qadevOOo/runner/convwatch/OfficePrint.java @@ -787,35 +787,7 @@ public class OfficePrint { // TODO: move this away! - static void showType(String _sInputURL, XMultiServiceFactory _xMSF) - { - if (_sInputURL.length() == 0) - { - return; - } - if (_xMSF == null) - { - GlobalLogWriter.get().println("MultiServiceFactory not set."); - return; - } - XTypeDetection aTypeDetection = null; - try - { - Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection"); - aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.get().println("Can't get com.sun.star.document.TypeDetection."); - return; - } - if (aTypeDetection != null) - { - String sType = aTypeDetection.queryTypeByURL(_sInputURL); - GlobalLogWriter.get().println("Type is: " + sType); - } - } diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java index e7aea95609dc..dc9b9eb2344f 100644 --- a/qadevOOo/runner/convwatch/PRNCompare.java +++ b/qadevOOo/runner/convwatch/PRNCompare.java @@ -39,18 +39,6 @@ public class PRNCompare fs = System.getProperty("file.separator"); } - String executeSynchronously(String _sCommand) - { - ProcessHandler aHandler = new ProcessHandler(_sCommand); - aHandler.executeSynchronously(); - - String sText = aHandler.getOutputText(); - - GlobalLogWriter.get().println("Exitcode: " + String.valueOf(aHandler.getExitCode())); - return sText; - } - - private int getMaxNumOfFileEntry(String _sDirectory, String _sBasename) { // TODO: check if directory exist should be done earlier @@ -140,18 +128,7 @@ public class PRNCompare return aList; } - public StatusHelper[] compare_new() - { - String[] aRefList = createJPEGFromPostscript(m_sOutputPath, m_sReferencePath, m_sReferenceFile, getResolutionInDPI()); -// TODO: Assume, that Postscript is already in the OutputPath, this may change. - String[] aPSList = createJPEGFromPostscript(m_sOutputPath, m_sOutputPath, m_sPostScriptFile, getResolutionInDPI()); - StatusHelper[] aList = createDiffs(aRefList, - aPSList, - getMaxPages(), - m_tUseBorderMove); - return aList; - } private static String getJPEGName(String _sOutputPath, String _sBasename, String _sGS_PageOutput) { diff --git a/qadevOOo/runner/convwatch/PixelCounter.java b/qadevOOo/runner/convwatch/PixelCounter.java index 29c244d57465..240e973e3282 100644 --- a/qadevOOo/runner/convwatch/PixelCounter.java +++ b/qadevOOo/runner/convwatch/PixelCounter.java @@ -75,23 +75,7 @@ class CountNotBlack extends CountPixel class graphics_stuff { - public int stuff() - { -// (1) decoding - int rgba = 0; // ...; // comes from PixelGrabber, BufferedImage.getRGB etc. - int red = (rgba >> 16) & 0xff; - int green = (rgba >> 8) & 0xff; - int blue = rgba & 0xff; - int alpha = (rgba >> 24) & 0xff; -// (2) now modify red, green, blue and alpha as you like; -// make sure that each of the four values stays in the -// interval 0 to 255 -// ... -// (3) and encode back to an int, e.g. to give it to MemoryImageSource or -// BufferedImage.setRGB - rgba = (alpha << 24) | (red << 16) | (green << 8) | blue; - return 0; - } + private static void countPixel(ImageHelper img, int _w, int _h, CountPixel _aPixelCounter) { diff --git a/qadevOOo/runner/graphical/BuildID.java b/qadevOOo/runner/graphical/BuildID.java index 2a83aa9ce2c3..1e08fb8c20bc 100644 --- a/qadevOOo/runner/graphical/BuildID.java +++ b/qadevOOo/runner/graphical/BuildID.java @@ -139,25 +139,8 @@ public class BuildID return sBuildID; } - public static String getMinor(String _sOfficePath) - { - final String sOfficePath = getOfficePath(_sOfficePath); - final String sMinor = "m" + getBuildID(sOfficePath, "ProductMinor"); - return sMinor; - } - public static String getCWSName(String _sOfficePath) - { - final String sOfficePath = getOfficePath(_sOfficePath); - final String sBuildID = getBuildID(sOfficePath, "buildid"); - String sCWSName = "MWS"; - int nIdx = sBuildID.indexOf("[CWS:"); - if (nIdx > 0) - { - int nIdx2 = sBuildID.indexOf("]", nIdx); - sCWSName = sBuildID.substring(nIdx + 5, nIdx2); - } - return sCWSName; - } + + } diff --git a/qadevOOo/runner/graphical/DirectoryHelper.java b/qadevOOo/runner/graphical/DirectoryHelper.java index a52add895a0b..2acb91154ae8 100644 --- a/qadevOOo/runner/graphical/DirectoryHelper.java +++ b/qadevOOo/runner/graphical/DirectoryHelper.java @@ -72,13 +72,7 @@ public class DirectoryHelper return a.m_aFileList.toArray(); } - public static Object[] traverse( String _sDirectory, boolean _bRecursiveIsAllowed ) - { - DirectoryHelper a = new DirectoryHelper(); - a.setRecursiveIsAllowed(_bRecursiveIsAllowed); - a.traverse_impl(_sDirectory, null); - return a.m_aFileList.toArray(); - } + private void traverse_impl( String afileDirectory, FileFilter _aFileFilter ) { diff --git a/qadevOOo/runner/graphical/FileHelper.java b/qadevOOo/runner/graphical/FileHelper.java index bee04eb64622..440e6273743a 100644 --- a/qadevOOo/runner/graphical/FileHelper.java +++ b/qadevOOo/runner/graphical/FileHelper.java @@ -44,12 +44,7 @@ public class FileHelper } - public static void MessageBox(String _sStr) - { - String sVersion = System.getProperty("java.version"); - String sOSName = System.getProperty("os.name"); - JOptionPane.showMessageDialog( null, _sStr, sVersion + " " + sOSName + " Hello World Debugger", JOptionPane.INFORMATION_MESSAGE ); - } + public static boolean exists(String _sFile) { @@ -66,27 +61,7 @@ public class FileHelper return false; } - public static boolean isDir(String _sDir) - { - if (_sDir == null) - { - return false; - } - try - { - File aFile = new File(_sDir); - if (aFile.exists() && aFile.isDirectory()) - { - return true; - } - } - catch (NullPointerException e) - { - GlobalLogWriter.println("Exception caught. FileHelper.isDir('" + _sDir + "')"); - e.printStackTrace(); - } - return false; - } + public static String getBasename(String _sFilename) { @@ -456,33 +431,7 @@ public class FileHelper }; return aFileFilter; } - /** - * Within the directory run through, it's possible to say which file extension types should not - * consider like '*.ini' because it's not a document. - * - * @return a FileFilter function - */ - public static FileFilter getFileFilterINI() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - String sPathname = pathname.getName().toLowerCase(); - if (sPathname.endsWith("index.ini")) - { - // don't consider the index.ini file - return false; - } - if (sPathname.endsWith(".ini")) - { - return true; - } - return false; - } - }; - return aFileFilter; - } + public static String appendPath(String _sPath, String _sRelativePathToAdd) { @@ -616,12 +565,6 @@ public class FileHelper aIniFile.close(); } - public static void addBasenameToPostscript(String _sOutputFilename) - { - String sIndexFilename = FileHelper.appendPath(_sOutputFilename, "postscript.ini"); - String sBasename = FileHelper.getBasename(_sOutputFilename); - addBasenameToFile(sIndexFilename, sBasename, "", "", ""); - } public static void addBasenameToIndex(String _sOutputFilename, String _sBasename, String _sCreator, String _sType, String _sSource) { String sIndexFilename = FileHelper.appendPath(_sOutputFilename, "index.ini"); diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java index b2508b173c38..326365adb832 100644 --- a/qadevOOo/runner/graphical/IniFile.java +++ b/qadevOOo/runner/graphical/IniFile.java @@ -409,10 +409,7 @@ public class IniFile implements Enumeration<String> insertValue(_sSection, _sKey, String.valueOf(_nValue)); } - public void insertValue(String _sSection, String _sKey, long _nValue) - { - insertValue(_sSection, _sKey, String.valueOf(_nValue)); - } + /** insert a value diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java index 6d9c5c698d37..c33b09632850 100644 --- a/qadevOOo/runner/graphical/JPEGCreator.java +++ b/qadevOOo/runner/graphical/JPEGCreator.java @@ -31,17 +31,7 @@ public class JPEGCreator extends EnhancedComplexTestCase return new String[]{"PostscriptOrPDFToJPEG"}; } - /** - * test function. - */ - public void PostscriptOrPDFToJPEG() - { - GlobalLogWriter.set(log); - ParameterHelper aParam = new ParameterHelper(param); - // run through all documents found in Inputpath - foreachPSorPDFinInputPath(aParam); - } public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index 2132297f893d..13db6222dbee 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -162,57 +162,7 @@ public class MSOfficePostscriptCreator implements IOffice return false; } - public void storeToFileWithMSOffice( ParameterHelper _aGTA, - String _sInputFile, - String _sOutputFile) throws OfficeException, java.io.IOException - { - String sDocumentSuffix = FileHelper.getSuffix(_sInputFile); - String sFilterName = _aGTA.getExportFilterName(); - ArrayList<String> aStartCommand = new ArrayList<String>(); - if (isWordDocument(sDocumentSuffix)) - { - aStartCommand = createWordStoreHelper(); - } - else if (isExcelDocument(sDocumentSuffix)) - { - aStartCommand = createExcelStoreHelper(); - } - else if (isPowerPointDocument(sDocumentSuffix)) - { - } - else if (sDocumentSuffix.toLowerCase().equals(".xml")) - { - // special case, if xml we prefer word, but with DEFAULT_XML_FORMAT_APP=excel it's changeable. - String sDocFormat = getXMLDocumentFormat(_sInputFile); - if (sDocFormat.equals("excel")) - { - aStartCommand = createExcelStoreHelper(); - } - else - { - aStartCommand = createWordStoreHelper(); - } - } - else - { - GlobalLogWriter.println("No Microsoft Office document format found."); - throw new WrongSuffixException("No MS office document format found."); - } - if (aStartCommand != null) - { - if (sFilterName == null) - { -// TODO: hardcoded FilterName in perl script - sFilterName = ""; // xlXMLSpreadsheet"; - } - - aStartCommand.add(_sInputFile); - aStartCommand.add(sFilterName); - aStartCommand.add(_sOutputFile); - realStartCommand(aStartCommand); - } - } /** diff --git a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java index 4408b527a1f6..126c3b78b20a 100644 --- a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java @@ -576,74 +576,12 @@ public class OpenOfficePostscriptCreator implements IOffice } - /** - * @return true, if the reference (*.prrn file) based on given output path and given input path exist. - * If OVERWRITE_REFERENCE is set, always return false. - */ - public boolean isReferenceExists(ParameterHelper _aGTA, - String _sAbsoluteOutputPath, - String _sAbsoluteInputFile) - { - if (! FileHelper.exists(_sAbsoluteInputFile)) - { - return false; - } - String sInputFileBasename = FileHelper.getBasename(_sAbsoluteInputFile); - String sOutputPath; - if (_sAbsoluteOutputPath != null) - { - sOutputPath = _sAbsoluteOutputPath; - } - else - { - String sInputPath = FileHelper.getPath(_sAbsoluteInputFile); - sOutputPath = sInputPath; - } - - String sPrintFilename = FileHelper.getNameNoSuffix(sInputFileBasename); - - String sAbsolutePrintFilename = FileHelper.appendPath(sOutputPath, sPrintFilename + ".prn"); - if (FileHelper.exists(sAbsolutePrintFilename) && _aGTA.getOverwrite() == false) - { - GlobalLogWriter.println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite."); - return true; - } - return false; - } // TODO: move this away! - void showType(String _sInputURL, XMultiServiceFactory _xMSF) - { - if (_sInputURL.length() == 0) - { - return; - } - if (_xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory not set."); - return; - } - XTypeDetection aTypeDetection = null; - try - { - Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection"); - aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.println("Can't get com.sun.star.document.TypeDetection."); - return; - } - if (aTypeDetection != null) - { - String sType = aTypeDetection.queryTypeByURL(_sInputURL); - GlobalLogWriter.println("Type is: " + sType); - } - } @@ -875,133 +813,7 @@ public class OpenOfficePostscriptCreator implements IOffice } - public void convertDocument(String _sInputFile, String _sOutputPath, ParameterHelper _aGTA) - { - XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory(); - if (xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory in GraphicalTestArgument not set."); - return; - } - - String sInputURL = URLHelper.getFileURLFromSystemPath(_sInputFile); - XComponent aDoc = loadFromURL( _aGTA, sInputURL); - if (aDoc == null) - { - GlobalLogWriter.println("Can't load document '"+ sInputURL + "'"); - return; - } - - if (_sOutputPath == null) - { - GlobalLogWriter.println("Outputpath not set."); - return; - } - - if (! isStoreAllowed()) - { - GlobalLogWriter.println("It's not allowed to store, check Input/Output path."); - return; - } - - XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, aDoc ); - - // store the document in an other directory - XStorable xStorable = UnoRuntime.queryInterface( XStorable.class, aDoc); - if (xStorable == null) - { - GlobalLogWriter.println("com.sun.star.frame.XStorable is null"); - return; - } - String sFilterName = _aGTA.getExportFilterName(); - - ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); - - String sExtension = ""; - - if (sFilterName != null && sFilterName.length() > 0) - { - String sInternalFilterName = getInternalFilterName(sFilterName, xMSF); - String sServiceName = getServiceNameFromFilterName(sFilterName, xMSF); - - GlobalLogWriter.println("Filter detection:"); - // check if service name from file filter is the same as from the loaded document - boolean bServiceFailed = false; - if (sServiceName == null || sInternalFilterName == null) - { - GlobalLogWriter.println("Given FilterName '" + sFilterName + "' seems to be unknown."); - bServiceFailed = true; - } - if (! xServiceInfo.supportsService(sServiceName)) - { - GlobalLogWriter.println("Service from FilterName '" + sServiceName + "' is not supported by loaded document."); - bServiceFailed = true; - } - if (bServiceFailed == true) - { - GlobalLogWriter.println("Please check '" + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + "' in the property file."); - return; - } - - if (sInternalFilterName != null && sInternalFilterName.length() > 0) - { - // get the FileExtension, by the filter name, if we don't get a file extension - // we assume the is also no right filter name. - sExtension = getFileExtension(sInternalFilterName, xMSF); - if (sExtension == null) - { - GlobalLogWriter.println("Can't found an extension for filtername, take it from the source."); - } - } - - PropertyValue Arg = new PropertyValue(); - Arg.Name = "FilterName"; - Arg.Value = sFilterName; - aPropertyList.add(Arg); - showProperty(Arg); - GlobalLogWriter.println("FilterName is set to: " + sFilterName); - } - - String sOutputURL = ""; - try - { - // create the new filename with the extension, which is ok to the file format - String sInputFileBasename = FileHelper.getBasename(_sInputFile); - String sInputFileNameNoSuffix = FileHelper.getNameNoSuffix(sInputFileBasename); - String fs = System.getProperty("file.separator"); - String sOutputFile = _sOutputPath; - if (! sOutputFile.endsWith(fs)) - { - sOutputFile += fs; - } - if (sExtension != null && sExtension.length() > 0) - { - sOutputFile += sInputFileNameNoSuffix + "." + sExtension; - } - else - { - sOutputFile += sInputFileBasename; - } - - if (FileHelper.exists(sOutputFile) && _aGTA.getOverwrite() == false) - { - GlobalLogWriter.println("File already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite."); - return; - } - - sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputFile); - - GlobalLogWriter.println("Store document as '" + sOutputURL + "'"); - xStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList)); - GlobalLogWriter.println("Document stored."); - } - catch (com.sun.star.io.IOException e) - { - GlobalLogWriter.println("Can't store document '" + sOutputURL + "'. Message is :'" + e.getMessage() + "'"); - } - - } private OfficeProvider m_aProvider = null; private void startOffice() @@ -1041,12 +853,8 @@ public class OpenOfficePostscriptCreator implements IOffice } } - public void disallowStore() - { - } - public void allowStore() - { - } + + public boolean isStoreAllowed() { return false; diff --git a/qadevOOo/runner/graphical/PixelCounter.java b/qadevOOo/runner/graphical/PixelCounter.java index 0807b26cbdeb..b0b9e41d7e66 100644 --- a/qadevOOo/runner/graphical/PixelCounter.java +++ b/qadevOOo/runner/graphical/PixelCounter.java @@ -34,19 +34,7 @@ class CountNotWhite extends CountPixel { } - public void countold(final int pixel) - { - // final int alpha = (pixel >> 24) & 0xff; - final int red = (pixel >> 16) & 0xff; - final int green = (pixel >> 8) & 0xff; - final int blue = (pixel ) & 0xff; - if (red == 0xff && green == 0xff && blue == 0xff) - { - return; - } - ++m_nCount; - } @Override public void count(final int pixel) { @@ -79,19 +67,7 @@ class CountNotBlack extends CountPixel { } - public void countold(final int pixel) - { - // final int alpha = (pixel >> 24) & 0xff; - final int red = (pixel >> 16) & 0xff; - final int green = (pixel >> 8) & 0xff; - final int blue = (pixel ) & 0xff; - if (red == 0x00 && green == 0x00 && blue == 0x00) - { - return; - } - ++m_nCount; - } @Override public void count(final int pixel) { diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java index 3d62291baa00..f6029bc0e8a0 100644 --- a/qadevOOo/runner/helper/ConfigHelper.java +++ b/qadevOOo/runner/helper/ConfigHelper.java @@ -181,28 +181,10 @@ public class ConfigHelper } - public static Object readDirectKey(XMultiServiceFactory xSMGR , - String sConfigFile, - String sRelPath , - String sKey ) - throws com.sun.star.uno.Exception - { - ConfigHelper aConfig = new ConfigHelper(xSMGR, sConfigFile, true); - return aConfig.readRelativeKey(sRelPath, sKey); - } - public static void writeDirectKey(XMultiServiceFactory xSMGR , - String sConfigFile, - String sRelPath , - String sKey , - Object aValue ) - throws com.sun.star.uno.Exception - { - ConfigHelper aConfig = new ConfigHelper(xSMGR, sConfigFile, false); - aConfig.writeRelativeKey(sRelPath, sKey, aValue); - aConfig.flush(); - } + + /** diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java index bde788a5e687..e698d47104f3 100644 --- a/qadevOOo/runner/helper/ConfigurationRead.java +++ b/qadevOOo/runner/helper/ConfigurationRead.java @@ -71,14 +71,7 @@ public class ConfigurationRead { this(xMSF, "org.openoffice.Setup"); } - /** - * Does the node with this hierarchical name exist? - * @param name The hierarchical name of a subnode. - * @return True, if the node exists. - */ - public boolean hasByHieracrhicalName(String name) { - return root.hasByHierarchicalName(name); - } + /** @@ -91,28 +84,7 @@ public class ConfigurationRead { return names; } - /** - * Get all elements of this node - * @param name The name of the node - * @return All elements of this node (as hierarchical names). - */ - public String[] getSubNodeNames(String name) { - String[]names = null; - try { - Object next = root.getByHierarchicalName(name); - XNameAccess x = UnoRuntime.queryInterface( - XNameAccess.class, next); - names = x.getElementNames(); - for (int i=0; i< names.length; i++) { - names[i] = name + "/" + names[i]; - } - } - catch(Exception e) { - //just return null, if there are no further nodes - } - return names; - } /** * Get contents of a node by its hierarchical name. diff --git a/qadevOOo/runner/helper/FileTools.java b/qadevOOo/runner/helper/FileTools.java index 8a859183ebf6..cede7c46059d 100644 --- a/qadevOOo/runner/helper/FileTools.java +++ b/qadevOOo/runner/helper/FileTools.java @@ -92,19 +92,7 @@ public class FileTools { in.close(); out.close(); } - /** - * Deletes all files and subdirectories under dir and the directory itself. - * Returns true if all deletions were successful. - * If the deletion fails, the method the method continues to delete rest - * of the files and returns false. - * @return Returns true if all deletions were successful, else false. - * @param dir the directory to delete - */ - public static boolean deleteDir(File dir) { - // The directory is now empty so delete it - return cleanDir(dir); - } public static boolean cleanDir(File dir) { diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java index 43372d224b67..35b32999cb4a 100644 --- a/qadevOOo/runner/helper/ProcessHandler.java +++ b/qadevOOo/runner/helper/ProcessHandler.java @@ -576,18 +576,7 @@ public class ProcessHandler flushInput(); } - /** - * This method is useful when the process was executed - * asynchronously. Waits for process to exit and return - * its result. - * - * @return <code>true</code> if process correctly exited - * (exit code doesn't affect to this result). - */ - public boolean waitFor() - { - return waitFor(0); - } + /** * This method is useful when the process was executed @@ -737,20 +726,7 @@ public class ProcessHandler } } - /** - * Prints the string specified to sdtin of external - * command. '\n' is not added so if you need you - * should terminate the string with '\n'. <p> - * - * The method can also be called before the command - * starts its execution. Then the text is buffered - * and transferred to command when it will be started. - */ - public void printInputText(String str) - { - stdInBuff += str; - flushInput(); - } + /** * Returns information about was the command started or @@ -940,15 +916,5 @@ public class ProcessHandler } } - /** - * to stop the extra thread, before he will kill a running office. This will stop the thread. - */ - public void stopWatcher() - { - if (m_aWatcher != null) - { - m_aWatcher.holdOn(); - shortWait(5000); - } - } + } diff --git a/qadevOOo/runner/helper/StringHelper.java b/qadevOOo/runner/helper/StringHelper.java index 3ed630030e76..6308a0a2eacb 100644 --- a/qadevOOo/runner/helper/StringHelper.java +++ b/qadevOOo/runner/helper/StringHelper.java @@ -71,25 +71,7 @@ public class StringHelper return sNewPath; } - 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 diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java index c869f1a1d48b..ebf59b01e0eb 100644 --- a/qadevOOo/runner/helper/URLHelper.java +++ b/qadevOOo/runner/helper/URLHelper.java @@ -144,84 +144,11 @@ public class URLHelper - /** - * The same as getURLWithProtocolFromSystemPath() before but uses string parameter instead - * of a File types. It exist to supress converting of necessary parameters in the - * outside code. But of course getURLWithProtocolFromSystemPath(File,File,String) will be - * a little bit faster then this method ... - * - * @param sSystemPath - * represent the file in system notation - * - * @param sBasePath - * define the base path of the aSystemPath value, - * which must be replaced with the value of "sServerPath". - * - * @param sServerPath - * Will be used to replace sBasePath. - * - * @example - * System Path = "d:\test\file.txt" - * Base Path = "d:\test" - * Server Path = "http://alaska:8000" - * => "http://alaska:8000/file.txt" - * - * @return [String] - * an url which represent the given system path - * and uses the given protocol - */ - public static String getURLWithProtocolFromSystemPath( String sSystemPath, String sBasePath, String sServerPath ) - { - return getURLWithProtocolFromSystemPath(new File(sSystemPath), new File(sBasePath), sServerPath); - } - /** - * This convert an URL (formated as a string) to a struct com.sun.star.util.URL. - * It use a special service to do that: the URLTransformer. - * Because some API calls need it and it's not allowed to set "Complete" - * part of the util struct only. The URL must be parsed. - * - * @param sURL - * URL for parsing in string notation - * - * @return [com.sun.star.util.URL] - * URL in UNO struct notation - */ - public static com.sun.star.util.URL parseURL(XURLTransformer xParser, String sURL) - { - com.sun.star.util.URL aURL = null; - if (sURL==null || sURL.equals("")) - return null; - - try - { - // Create special service for parsing of given URL. -/* com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)OfficeConnect.createRemoteInstance( - com.sun.star.util.XURLTransformer.class, - "com.sun.star.util.URLTransformer"); -*/ - // Because it's an in/out parameter we must use an array of URL objects. - com.sun.star.util.URL[] aParseURL = new com.sun.star.util.URL[1]; - aParseURL[0] = new com.sun.star.util.URL(); - aParseURL[0].Complete = sURL; - - // Parse the URL - xParser.parseStrict(aParseURL); - - aURL = aParseURL[0]; - } - catch(com.sun.star.uno.RuntimeException exRuntime) - { - // Any UNO method of this scope can throw this exception. - // Reset the return value only. - aURL = null; - } - return aURL; - } /** diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 9ee716eeefd0..1866b2646dac 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -170,47 +170,9 @@ public class Parameters implements XPropertySet { } } - public static String getString(XPropertySet props, String name) { - try { - return (String)props.getPropertyValue(name); - } catch (UnknownPropertyException e) { - return null; - } catch (WrappedTargetException e) { - return null; - } - } - public static Object get(XPropertySet props, String name) { - try { - return props.getPropertyValue(name); - } catch (UnknownPropertyException e) { - return null; - } catch (WrappedTargetException e) { - return null; - } - } - public static Map<String, Object> toMap(XPropertySet props) { - HashMap<String, Object> result = new HashMap<String, Object>(10); - XPropertySetInfo setInfo = props.getPropertySetInfo(); - Property[] properties = setInfo.getProperties(); - for (int i = 0; i < properties.length; i++) { - String name = properties[i].Name; - Object value; - try { - value = props.getPropertyValue(name); - } catch (WrappedTargetException e) { - continue; - } catch (UnknownPropertyException e) { - continue; - } - - result.put(name, value); - } - - return result; - } } diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java index 680e499cf8da..fc4a2b4fe9d3 100644 --- a/qadevOOo/runner/lib/Status.java +++ b/qadevOOo/runner/lib/Status.java @@ -86,13 +86,7 @@ public class Status extends SimpleStatus { return new Status( SKIPPED, state ); } - /** - * This is a factory method for creating a Status representing that the - * result of the activity was excluded. It always has FAILED state. - */ - public static Status excluded() { - return new Status( EXCLUDED, false ); - } + /** * Creates a Status representing an activity failed for an arbitrary reason. diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java index 6b893106c65b..5ca0b9bbead4 100644 --- a/qadevOOo/runner/util/AccessibilityTools.java +++ b/qadevOOo/runner/util/AccessibilityTools.java @@ -262,53 +262,6 @@ public class AccessibilityTools { return null; } - /** - * This methods retunrs the <CODE>XAccessibleContext</CODE> of a named Sheet-Cell like "G5".<p> - * @param xSheetAcc The <CODE>XAccessibleContext</CODE> of a Sheet - * @param cellName The name of a cell like "A5" - * @return the <CODE>XAccessiblecontext</CODE> of the named cell - */ - public static XAccessibleContext getSheetCell(XAccessibleContext xSheetAcc, String cellName){ - - int cellIndex = 0; - int column =0; - int charMem = 0; - for (int n=0; n<cellName.length(); n++){ - String cha = cellName.substring(n,n+1); - System.out.println("char: " + cha + " "); - - byte[] bytes = cha.getBytes(); - - if ((bytes[0] >= 'A') && (bytes[0] <= 'Z')){ - charMem = bytes[0]-64; - column++; - if ( column == 2 ){ - cellIndex += charMem * 26; - } - cellIndex= cellIndex+ (bytes[0]-65); - } else { - String sNumb = cellName.substring(n, cellName.length()); - int iNumb = Integer.valueOf(sNumb).intValue(); - cellIndex += (iNumb-1) * 256; - System.out.println("numb:" + (iNumb-1) * 256); - } - - } - - try { - XAccessibleContext ac = xSheetAcc.getAccessibleChild(cellIndex).getAccessibleContext(); - System.out.println(ac.getAccessibleRole() + "," + - ac.getAccessibleName() + "(" + - ac.getAccessibleDescription() + "):" + - utils.getImplName(ac)); - - return ac; - } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { - System.out.println("ERROR: could not get child at index " + cellIndex +"': " + ex.toString()); - return null; - } - } - public static void printAccessibleTree(PrintWriter log, XAccessible xacc, boolean debugIsActive) { debug = debugIsActive; if (debug) printAccessibleTree(log, xacc, ""); diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 5f22f5407dd2..7b352179929e 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -280,12 +280,7 @@ public class DBTools { */ public DataSourceInfo newDataSourceInfo() { return new DataSourceInfo() ;} - /** - * Returns new instance of <code>DataSourceInfo</code> class. - */ - public DataSourceInfo newDataSourceInfo(Object dataSource) { - return new DataSourceInfo(dataSource); - } + /** * Registers the datasource on the specified name in @@ -324,75 +319,9 @@ public class DBTools { registerDB(name, dataSource) ; } - /** - * RESERVED. Not used. - */ - public XConnection connectToTextDB(String contextName, - String dbDir, String fileExtension) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - - xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir)); - - PropertyValue extParam = new PropertyValue() ; - extParam.Name = "EXT" ; - extParam.Value = fileExtension ; - xSrcProp.setPropertyValue("Info", new PropertyValue[] {extParam}) ; - dbContext.registerObject(contextName, newSource) ; - Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; - - XCompletedConnection xSrcCon = UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ; - - XConnection con = xSrcCon.connectWithCompletion(xHandler) ; - - return con ; - } finally { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception e) {} - } - } - - /** - * Registers DBase database (directory with DBF files) in the - * global DB context, then connects to it. - * @param contextName Name under which DB will be registered. - * @param dbDir The directory with DBF tables. - * @return Connection to the DB. - */ - public XConnection connectToDBase(String contextName, - String dbDir) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir)); - - dbContext.registerObject(contextName, newSource) ; - - XConnection con = connectToSource(newSource) ; - - return con ; - } catch(com.sun.star.uno.Exception e) { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception ex) {} - - throw e ; - } - } /** * Performs connection to DataSource specified. @@ -461,23 +390,7 @@ public class DBTools { return src ; } - /** - * Connects to <code>DataSource</code> specially created for testing. - * This source always has name <code>'APITestDatabase'</code> and it - * is registered in subdirectory <code>TestDB</code> of directory - * <code>docPath</code> which is supposed to be a directory with test - * documents, but can be any other (it must have subdirectory with DBF - * tables). If such data source doesn't exists or exists with - * different URL it is recreated and reregistered. Finally connection - * performed. - * @param docPath Path to database <code>TestDB</code> directory. - * @return Connection to test database. - */ - public XConnection connectToTestDB(String docPath) - throws com.sun.star.uno.Exception { - return connectToSource(registerTestDB(docPath)) ; - } /** * Empties the table in the specified source. @@ -584,44 +497,9 @@ public class DBTools { xClose.close() ; } - /** - * Initializes test table specified of the connection specified. - * Deletes all record from table, and then inserts data from - * <code>TST_TABLE_VALUES</code> constant array. <p> - * Test table has some predefined format which includes as much - * field types as possible. For every column type constants - * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc. - * are declared for column index fast find. - * @param con Connection to data source where test table exists. - * @param table Test table name. - */ - public void initializeTestTable(XConnection con, String table) - throws com.sun.star.sdbc.SQLException { - - deleteAllRows(con, table) ; - for (int i = 0; i < TST_TABLE_VALUES.length; i++) { - addRowToTestTable(con, table, TST_TABLE_VALUES[i], TST_STREAM_LENGTHS[i]) ; - } - } - - /** - * Prints full info about currently registered DataSource's. - */ - public void printRegisteredDatabasesInfo(PrintWriter out) { - XEnumerationAccess dbContEA = UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ; - XEnumeration xEnum = dbContEA.createEnumeration() ; - out.println("DatabaseContext registered DataSource's :") ; - while (xEnum.hasMoreElements()) { - try { - DataSourceInfo inf = new DataSourceInfo(xEnum.nextElement()) ; - inf.printInfo(out) ; - } catch (com.sun.star.container.NoSuchElementException e) {} - catch (com.sun.star.lang.WrappedTargetException e) {} - } - } /** * Convert system pathname to SOffice URL string diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 30bfd8725d43..8e6ad3238cde 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -101,17 +101,7 @@ public class DesktopTools return xDesktop.getComponents().createEnumeration(); } - /** - * returns the current component on the desktop - * @param xMSF the XMultiServiceFactory - * @return XComponent of the current component on the desktop - */ - public static XComponent getCurrentComponent(XMultiServiceFactory xMSF) - { - XDesktop xDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - return xDesktop.getCurrentComponent(); - } + /** * returns the current component on the desktop @@ -460,15 +450,7 @@ public class DesktopTools } } - /** - * Due to typo deprecated - * @deprecated - */ - @Deprecated - public static void bringWindowToFromt(XModel xModel) - { - bringWindowToFront(xModel); - } + /** * This function brings a document to the front.<P> diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java index acb89d88e26c..4facd805fd34 100644 --- a/qadevOOo/runner/util/DrawTools.java +++ b/qadevOOo/runner/util/DrawTools.java @@ -130,21 +130,4 @@ public class DrawTools { return oShape; } - /** - * creates a XShape and adds it to the documents - * first drawpage - * @param oDoc the document - * @param height the height of the shape - * @param width the width of the shape - * @param x the x-position of the shape - * @param y the y-position of the shape - * @param kind the kind of the shape ('Ellipse', 'Line' or 'Rectangle') - */ - public void addShape( XComponent oDoc, int height, int width, int x, - int y, String kind ) { - - getShapes(getDrawPage(oDoc,0)).add(createShape( oDoc, height, width, x, - y, kind ) ); - } - } diff --git a/qadevOOo/runner/util/DynamicClassLoader.java b/qadevOOo/runner/util/DynamicClassLoader.java index ff70becefbba..8fdd721f1ea2 100644 --- a/qadevOOo/runner/util/DynamicClassLoader.java +++ b/qadevOOo/runner/util/DynamicClassLoader.java @@ -61,23 +61,6 @@ public class DynamicClassLoader { /** * Get an instance of a class. The constructor matching to the - * arguments is used and the arguments are given to this constructor. - * @param className The class to instantiate. - * @param ctorArgs Arguments for the constructor. - * @return The instance of the class. - */ - public Object getInstance(String className, Object[] ctorArgs) - throws IllegalArgumentException { - Class<?>[] ctorType = new Class[ctorArgs.length]; - for(int i=0; i<ctorType.length; i++) { - ctorType[i] = ctorArgs[i].getClass(); - } - return getInstance(className, ctorType, ctorArgs); - - } - - /** - * Get an instance of a class. The constructor matching to the * given calss types is used and the instance is created using the arguments * for the constructor. * @param className The class to instantiate. diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 9064487f791c..2de4698877c2 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -260,24 +260,7 @@ public class FormTools { return UnoRuntime.queryInterface(XLoadable.class, the_form); } - public static XLoadable bindForm( XTextDocument aDoc, String formName ) { - XLoadable formLoader = null; - try { - XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName); - XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); - formProps.setPropertyValue("DataSourceName","Bibliography"); - formProps.setPropertyValue("Command","biblio"); - formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form); - } - catch (Exception ex) { - System.out.println("Exception: "+ex); - ex.printStackTrace(System.err); - } - - return formLoader; - } /** * Binds the form with the name specified of <code>aDoc</code> Writer document diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 8a841397ee5c..dd46df9b6bdc 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -99,23 +99,7 @@ public class SOfficeFactory { } // finished createTextDoc - /** - * method which opens a new TextDocument - * - * @see XTextDocument - */ - public XTextDocument createTextDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - XComponent oDoc = openDoc("swriter", frameName, mediaDescriptor); - - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XTextDocument.class, oDoc); - } else { - return null; - } - } // finished createTextDoc /** * method which opens a new SpreadsheetDocument @@ -135,23 +119,7 @@ public class SOfficeFactory { } } // finished createCalcDoc - /** - * method which opens a new SpreadsheetDocument - * - * @see XSpreadsheetDocument - */ - public XSpreadsheetDocument createCalcDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - - XComponent oDoc = openDoc("scalc", frameName, mediaDescriptor); - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); - } else { - return null; - } - } // finished createCalcDoc /** * method which opens a new DrawDocument @@ -162,17 +130,7 @@ public class SOfficeFactory { 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 { - return openDoc("sdraw", frameName, mediaDescriptor); - } // finished createDrawDoc /** * method which opens a new ImpressDocument @@ -183,14 +141,7 @@ public class SOfficeFactory { 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 { - return openDoc("simpress", frameName, mediaDescriptor); - } // finished createImpressDoc /** * method which opens a new MathDocument @@ -201,14 +152,7 @@ public class SOfficeFactory { 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 { - return openDoc("smath", frameName, mediaDescriptor); - } // finished createMathDoc /** * method which opens a new ChartDocument @@ -261,19 +205,7 @@ public class SOfficeFactory { return oTable; } - /** - * creates a simple TextFrame - * ... to be continued - */ - public static XTextFrame createTextFrame(XTextDocument xTextDoc) - { - - FrameDsc tDsc = new FrameDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextFrame oFrame = (XTextFrame) instCreate.getInstance(); - return oFrame; - } /** * creates a simple TextFrame @@ -289,15 +221,7 @@ public class SOfficeFactory { return oFrame; } - public static void insertString(XTextDocument xTextDoc, String cString) - { - XText xText = xTextDoc.getText(); - XText oText = UnoRuntime.queryInterface( - XText.class, xText); - XTextCursor oCursor = oText.createTextCursor(); - oText.insertString(oCursor, cString, false); - } public static void insertTextContent(XTextDocument xTextDoc, XTextContent xCont) @@ -335,33 +259,9 @@ public class SOfficeFactory { } /// finish createBookmark - /** - * the method createReferenceMark - */ - public static XTextContent createReferenceMark(XTextDocument xTextDoc) - { - - ReferenceMarkDsc tDsc = new ReferenceMarkDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oReferenceMark = (XTextContent) instCreate.getInstance(); - return oReferenceMark; - - } /// finish createReferenceMark - /** - * the method createFootnote - */ - public static XTextContent createFootnote(XTextDocument xTextDoc) - { - FootnoteDsc tDsc = new FootnoteDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oFootnote = (XTextContent) instCreate.getInstance(); - return oFootnote; - } /// finish createFootnote /** * the method create Index @@ -403,16 +303,7 @@ public class SOfficeFactory { return oIA; } - public static String getUniqueName(XInterface oInterface, String prefix) { - XNameAccess oNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oInterface); - if (oNameAccess == null) { - return null; - } - int i; - for (i = 0; oNameAccess.hasByName(prefix + i); i++) { - } - return prefix + i; - } + public XShape createShape(XComponent oDoc, int height, int width, int x, int y, String kind) { //possible values for kind are 'Ellipse', 'Line' and 'Rectangle' @@ -482,45 +373,7 @@ public class SOfficeFactory { return oInstance; } - public XControlShape createControlShape(XComponent oDoc, int height, int width, int x, int y, String kind) { - - Size size = new Size(); - Point position = new Point(); - XControlShape oCShape = null; - XControlModel aControl = null; - - //get MSF - XMultiServiceFactory oDocMSF = 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 = UnoRuntime.queryInterface(XControlModel.class, aCon); - oCShape = 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 occurs.FAILED - System.out.println("Couldn't create instance " + e); - } - - try { - oCShape.setControl(aControl); - } catch (Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't get Control " + e); - } - - - return oCShape; - - } public XComponent loadDocument(String fileName) throws com.sun.star.lang.IllegalArgumentException, @@ -607,15 +460,5 @@ public class SOfficeFactory { } // finished openDoc - // query for XServiceInfo - public Object queryXServiceInfo(Object oObj) { - if (oObj != null) { - UnoRuntime.queryInterface( - XServiceInfo.class, oObj); - System.out.println("!!!! XServiceInfo n.a. !!!! "); - } else { - System.out.println("Object is empty!!!! "); - } - return null; - } // finish queryXServiceInfo + } diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 0d289f4d68da..09896ade63e0 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -32,82 +32,15 @@ import com.sun.star.datatransfer.*; public class SysUtils { - public static String getJavaPath() { - String cp = System.getProperty("java.class.path"); - String jh = System.getProperty("java.home"); - String fs = System.getProperty("file.separator"); - jh = jh + fs + "bin" + fs; - jh = jh + "java -classpath "+cp; - return jh; - } - private static ArrayList<String> files = new ArrayList<String>(); - public static Object[] traverse( String afileDirectory ) { + private static ArrayList<String> files = new ArrayList<String>(); - File fileDirectory = new File(afileDirectory); - // Testing, if the file is a directory, and if so, it throws an exception - if ( !fileDirectory.isDirectory() ) { - throw new IllegalArgumentException( - "not a directory: " + fileDirectory.getName() - ); - } - // Getting all files and directories in the current directory - File[] entries = fileDirectory.listFiles( - new FileFilter() { - public boolean accept( File pathname ) { - return true; - } - } - ); - - // Iterating for each file and directory - for ( int i = 0; i < entries.length; ++i ) { - // Testing, if the entry in the list is a directory - if ( entries[ i ].isDirectory() ) { - // Recursive call for the new directory - traverse( entries[ i ].getAbsolutePath() ); - } else { - // adding file to List - try { - // Composing the URL by replacing all backslashs - String stringUrl = "file:///" - + entries[ i ].getAbsolutePath().replace( '\\', '/' ); - files.add(stringUrl); - } - catch( Exception exception ) { - exception.printStackTrace(); - } - } - } - return files.toArray(); - } - public static XComponent getActiveComponent(XMultiServiceFactory msf) { - XComponent ac = null; - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - ac = xDesk.getCurrentComponent(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return ac; - } - public static XFrame getActiveFrame(XMultiServiceFactory msf) { - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - return xDesk.getCurrentFrame(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return null; - } /** * Tries to obtain text data from cliboard if such one exists. diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index c97c6d47c008..2004bca59a8c 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -196,180 +196,20 @@ public class UITools { } } - /** - * Deactivates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to deactivated - */ - public boolean deactivateToggleButton(String buttonName){ - return clickToggleButton(buttonName, false); - } - /** - * Activates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to activated - */ - public boolean activateToggleButton(String buttonName){ - return clickToggleButton(buttonName, true); - } - /** - * returns the value of named radio button - * @param buttonName the name of the button to get the value of - * @throws java.lang.Exception if something fail - * @return Integer - */ - public Integer getRadioButtonValue(String buttonName) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.RADIO_BUTTON, buttonName); - - return (Integer) getValue(xRB); - } catch (Exception e) { - throw new Exception("Could not get value from RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * returns the named graphic - * @param GraphicName the name of the graphic - * @return XInterface - * @throws java.lang.Exception if something fail - */ - public XInterface getGraphic(String GraphicName) throws java.lang.Exception - { - return AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.GRAPHIC, - GraphicName); - } - /** - * set a named radio button the a given value - * @param buttonName the name of the button to set - * @param iValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setRadioButtonValue(String buttonName, int iValue) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.RADIO_BUTTON, buttonName); - if(xRB == null) - System.out.println("AccessibleObjectForRole couldn't be found for " + buttonName); - XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xRB); - if(oValue == null) - System.out.println("XAccessibleValue couldn't be queried for " + buttonName); - oValue.setCurrentValue(new Integer(iValue)); - } catch (Exception e) { - e.printStackTrace(); - - throw new Exception("Could not set value to RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * select an item in nanmed listbox - * @param ListBoxName the name of the listbox - * @param nChildIndex the index of the item to set - * @throws java.lang.Exception if something fail - */ - public void selectListboxItem(String ListBoxName, int nChildIndex) - throws java.lang.Exception - { - try { - XAccessibleContext xListBox = null; - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - XAccessibleContext xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - XAccessibleSelection xListSelect = UnoRuntime.queryInterface(XAccessibleSelection.class, xList); - xListSelect.selectAccessibleChild(nChildIndex); - } catch (Exception e) { - throw new Exception("Could not select item '" +nChildIndex+ - "' in listbox '" + ListBoxName + "' : " + e.toString()); - } - } - /** - * This method returns all entries as XInterface of a list box - * @param ListBoxName the name of the listbox - * @return Object[] containing XInterface - * @throws java.lang.Exception if something fail - */ - - public Object[] getListBoxObjects(String ListBoxName) - throws java.lang.Exception - { - ArrayList<XInterface> Items = new ArrayList<XInterface>(); - try { - XAccessibleContext xListBox = null; - XAccessibleContext xList = null; - - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - - if (xListBox == null){ - // get the list of TreeListBox - xList =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.TREE, ListBoxName); - - // all other list boxes have a children of kind of LIST - } else { - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - } - - for (int i=0;i<xList.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xList.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - Items.add(xChildInterface); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child form list of '" - + ListBoxName + "' : " + e.toString()); - } - } - - } catch (Exception e) { - throw new Exception("Could not get list of items from '" - + ListBoxName + "' : " + e.toString()); - } - Object[]ret = new XInterface[Items.size()]; - for (int i=0;i<Items.size();i++){ - ret[i] = Items.get(i); - } - return ret; - } /** * Helper method: returns the entry manes of a List-Box @@ -429,27 +269,7 @@ public class UITools { String[]ret = new String[Items.size()]; return Items.toArray(ret); } - /** - * set to a named nureric filed a given value - * @param NumericFieldName the name of the nureic field - * @param cValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setNumericFieldValue(String NumericFieldName, String cValue) - throws java.lang.Exception - { - try{ - XInterface xNumericField =AccessibilityTools.getAccessibleObjectForRole( - mXRoot, AccessibleRole.TEXT, NumericFieldName); - UnoRuntime.queryInterface( - XAccessibleEditableText.class, xNumericField); - setString(xNumericField, cValue); - } catch (Exception e) { - throw new Exception("Could not set value '" + cValue + - "' into NumericField '" + NumericFieldName + "' : " + e.toString()); - } - } /** * returns the value of a numeric field @@ -511,66 +331,10 @@ public class UITools { } - /** - * returns the numeric value of a numeric filed. This is needed ie. for - * fields include the moneytary unit. - * @param NumericFieldName the name of the numeric filed - * @return the value of the numeric filed - * @throws java.lang.Exception if something fail - */ - public Double getNumericFieldNumericValue(String NumericFieldName) - throws java.lang.Exception - { - try{ - Double retValue = null; - String sValue = getNumericFieldValue(NumericFieldName); - String sAmount = removeCharactersFromCurrencyString(sValue); - retValue = Double.valueOf(sAmount); - return retValue; - - } catch (Exception e) { - throw new Exception("Could get numeric value from NumericField '" - + NumericFieldName + "' : " + e.toString()); - } - } - /** - * returns the content of a TextBox - * @param TextFieldName the name of the textbox - * @return the value of the text box - * @throws java.lang.Exception if something fail - */ - public String getTextBoxText(String TextFieldName) - throws java.lang.Exception - { - String TextFieldText = null; - try{ - XAccessibleContext xTextField =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.SCROLL_PANE, TextFieldName); - XAccessible xTextFieldAccess = UnoRuntime.queryInterface(XAccessible.class, xTextField); - XAccessibleContext xFrame =AccessibilityTools.getAccessibleObjectForRole( - xTextFieldAccess, AccessibleRole.TEXT_FRAME); - for (int i=0;i<xFrame.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xFrame.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - TextFieldText += (getString(xChildInterface)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child fom TextFrame of '" - + TextFieldName + "' : " + e.toString()); - } - } - return TextFieldText; - } catch (Exception e) { - throw new Exception("Could not get content fom Textbox '" - + TextFieldName + "' : " + e.toString()); - } - } /** * set a value to a named check box @@ -598,26 +362,7 @@ public class UITools { } } - /** - * returns the value of the named check box - * @param CheckBoxName the name of the check box - * @return the value of the check box - * @throws java.lang.Exception if something fail - */ - public Integer getCheckBoxValue(String CheckBoxName) - throws java.lang.Exception - { - try { - XInterface xCheckBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.CHECK_BOX, CheckBoxName); - XAccessibleValue xCheckBoxValue = UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); - return (Integer) xCheckBoxValue.getCurrentValue(); - } catch (Exception e) { - throw new Exception("Could not set value to CheckBox '" - + CheckBoxName + "' : " + e.toString()); - } - } /** * returns the message of a Basic-MessageBox @@ -642,130 +387,13 @@ public class UITools { } } - /** - * fetch the window which is equal to the given <CODE>WindowName</CODE> - * @return the named window - * @throws java.lang.Exception if something fail - */ - public XWindow getTopWindow(String WindowName, boolean debug) throws java.lang.Exception - { - XInterface xToolKit = null; - try { - xToolKit = (XInterface) mMSF.createInstance("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - throw new Exception("Could not toolkit: " + e.toString()); - } - XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); - - int count = tk.getTopWindowCount(); - - XTopWindow retWindow = null; - - if (debug) System.out.println("getTopWindow ->"); - - for (int i=0; i < count ; i++){ - XTopWindow xTopWindow = tk.getTopWindow(i); - XAccessible xAcc = AccessibilityTools.getAccessibleObject(xTopWindow); - String accName = xAcc.getAccessibleContext().getAccessibleName(); - - if (debug){ - System.out.println("AccessibleName: " + accName); - } - - if (WindowName.equals(accName)){ - if (debug) System.out.println("-> found window with name '" + WindowName + "'"); - retWindow = xTopWindow; - } - } - if (debug) { - if (retWindow == null) System.out.println("could not found window with name '" + WindowName + "'"); - System.out.println("<- getTopWindow "); - } - return UnoRuntime.queryInterface(XWindow.class, retWindow); - } - public void clickMiddleOfAccessibleObject(short role, String name){ - - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - public void doubleClickMiddleOfAccessibleObject(short role, String name) { - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to double click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - utils.shortWait(100); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - /** - * <B>DEPRECATED</B> - * Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @deprecated Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @param log logWriter - */ - public void printAccessibleTree(PrintWriter log) - { - AccessibilityTools.printAccessibleTree(log, mXRoot); - } /** diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index f706d9c5878a..ac3c89e275d7 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -98,23 +98,9 @@ public class XMLTools { attrByName.put(attr.Name, attr) ; } - /** - * Adds an attribute with value specified. As a type of - * value 'CDATA' string specified. - * @param name The attribute name. - * @param value Attribute value. - */ - public void add(String name, String value) { - add(name, "CDATA", value) ; - } - /** - * Clears all attributes added before. - */ - public void clear() { - attrByName.clear() ; - attributes.clear() ; - } + + /*************************************** * XAttributeList methods @@ -392,12 +378,7 @@ public class XMLTools { public void addTagEnclosed(String tag, String outerTag) { tags.put(tag, outerTag) ; } - /** - * Adds a character data which must be contained in the XML data. - */ - public void addCharacters(String ch) { - chars.put(ch, "") ; - } + /** * Adds a character data which must be contained in the XML data and * must be inside the tag with name <code>outerTag</code>. @@ -647,9 +628,7 @@ public class XMLTools { tagSet.add(tag.name) ; } - public void addCharacters(String ch) { - chars.add(new Object[] {ch.trim(), null}) ; - } + public void addCharactersEnclosed(String ch, Tag outerTag) { chars.add(new Object[] {ch.trim(), outerTag}) ; @@ -760,36 +739,7 @@ public class XMLTools { } } - /** - * Creates <code>XDocumentHandler</code> implementation in form - * of <code>com.sun.star.xml.sax.Writer</code> service, which - * writes XML data into a <code>com.sun.star.io.Pipe</code> - * created. - * @return Single element array which contains the handler - * contained in <code>Any</code> structure. - */ - public static Object[] getDocumentHandler(XMultiServiceFactory xMSF) { - Object[] ret = new Object[1]; - try { - XInterface Writer = (XInterface) xMSF.createInstance( - "com.sun.star.xml.sax.Writer"); - XInterface oPipe = (XInterface) xMSF.createInstance - ( "com.sun.star.io.Pipe" ); - XOutputStream xPipeOutput = UnoRuntime. - queryInterface(XOutputStream.class, oPipe) ; - - XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); - xADS.setOutputStream(xPipeOutput); - XDocumentHandler handler = UnoRuntime.queryInterface(XDocumentHandler.class,Writer); - - Any arg = new Any(new Type(XDocumentHandler.class),handler); - - ret[0] = arg; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - return ret; - } + public static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) { PropertyValue[] props = new PropertyValue[propNames.length] ; @@ -863,73 +813,7 @@ public class XMLTools { oIn.closeInput(); } - /** - * Exports document (the whole or a part) into the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Document to be exported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param exportType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it also depends of document type) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be exported to. - */ - public static void exportDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String exportType, String fileURL) - throws com.sun.star.uno.Exception { - XDocumentHandler xDocHandWriter = XMLTools.getFileXMLWriter(xMSF, fileURL) ; - Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter); - XInterface oExp = (XInterface)xMSF.createInstanceWithArguments( - "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter", - new Object[] {arg}); - XExporter xExp = UnoRuntime.queryInterface - (XExporter.class, oExp) ; - xExp.setSourceDocument(xDoc) ; - - XFilter filter = UnoRuntime.queryInterface(XFilter.class, oExp) ; - filter.filter(XMLTools.createMediaDescriptor( - new String[] {"FilterName"}, - new Object[] {"Custom filter"})) ; - } - - /** - * Imports document (the whole or a part) from the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Target document to be imported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param importType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it hardly depends of XML data in file) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be imported from. - */ - public static void importDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String importType, String fileURL) - throws com.sun.star.uno.Exception { - - XInterface oImp = (XInterface)xMSF.createInstance( - "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); - XImporter xImp = UnoRuntime.queryInterface - (XImporter.class, oImp) ; - XDocumentHandler xDocHandImp = UnoRuntime.queryInterface - (XDocumentHandler.class, oImp) ; - - xImp.setTargetDocument(xDoc) ; - parseXMLFile(xMSF, fileURL, xDocHandImp) ; - } } diff --git a/qadevOOo/runner/util/compare/DocComparator.java b/qadevOOo/runner/util/compare/DocComparator.java index 3521876f10d2..8503fda8254a 100644 --- a/qadevOOo/runner/util/compare/DocComparator.java +++ b/qadevOOo/runner/util/compare/DocComparator.java @@ -29,14 +29,12 @@ public interface DocComparator { public boolean isReferenceExistent() throws IOException; - public void createReference() throws IOException; - public boolean compare() throws IOException; - public boolean isDiffReferenceExistent() throws IOException; - public void createDiffReference() throws IOException; + + public boolean isDiffReferenceExistent() throws IOException; public boolean compareDiff() throws IOException; diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java index f52e8f0bbfd7..30a39d3fdebc 100644 --- a/qadevOOo/runner/util/compare/GraphicalComparator.java +++ b/qadevOOo/runner/util/compare/GraphicalComparator.java @@ -51,24 +51,7 @@ class GraphicalComparator implements DocComparator return a; } - /** - * return a (FileFilter) function, which returns true, if the filename is a '*.prn' file - */ - FileFilter getTrueIfPRNFile_FileFilter() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - if (pathname.getName().endsWith(".prn")) - { - return true; - } - return false; - } - }; - return aFileFilter; - } + /** * build a new file from _sEntry by diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java index 99b0929bfbb4..2d711a1235c9 100644 --- a/qadevOOo/runner/util/dbg.java +++ b/qadevOOo/runner/util/dbg.java @@ -83,29 +83,7 @@ public class dbg { return types; } - /** - * Returns true if a specified target implements the interface with the - * given name. Note that the comparison is not case sensitive. - * @param xTarget The implementation which should be analysed. - * @param ifcName The name of the interface that is tested. The name can - * be full qualified, such as 'com.sun.star.io.XInputStream', or only - * consist of the interface name, such as 'XText'. - * @return True, if xTarget implements the interface named ifcType - * @see com.sun.star.uno.XInterface - */ - public static boolean implementsInterface( - XInterface xTarget, String ifcName) { - Type[] types = getInterfaceTypes(xTarget); - if( null != types ) { - int nLen = types.length; - for( int i = 0; i < nLen ; i++ ) { - if(types[i].getTypeName().toLowerCase().endsWith( - ifcName.toLowerCase())) - return true; - } - } - return false; - } + /** * Prints information about an interface type. @@ -203,18 +181,7 @@ public class dbg { } } - /** - * Print the names and the values of a sequnze of <code>PropertyValue</code> - * to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValueSequenzePairs(PropertyValue[] ps){ - for( int i = 0; i < ps.length; i++){ - printProperyValuePairs(ps[i], new PrintWriter(System.out)); - } - } /** * Print the names and the values of a sequenze of <code>PropertyValue</code> @@ -229,14 +196,7 @@ public class dbg { } } - /** - * Print the name and the value of a <code>PropertyValue</code> to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValuePairs(PropertyValue ps){ - printProperyValuePairs(ps, new PrintWriter(System.out)); - } + /** * Print the name and the value of a <code>PropertyValue</code> to a print writer. diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 73664ce6989a..332a85deae47 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -215,38 +215,7 @@ public class utils { return; } - /** - * - * This method get the version for a given TestBase/platform combination - * - */ - public static String getVersion(String aFile, String aPlatform, String aTestbase) { - if ((aFile == null) || (aPlatform == null) || (aTestbase == null)) { - return "/"; - } - File the_file = new File(aFile); - try { - RandomAccessFile raf = new RandomAccessFile(the_file, "r"); - String res = ""; - while (!res.equals("[" + aTestbase.toUpperCase() + "]")) { - res = raf.readLine(); - } - res = "=/"; - while ((!res.startsWith(aPlatform)) || (res.startsWith("["))) { - res = raf.readLine(); - } - raf.close(); - if (res.startsWith("[")) { - res = "/"; - } - return res.substring(res.indexOf("=") + 1); - - } catch (Exception e) { - System.out.println("Couldn't find version"); - return "/"; - } - } /** * @@ -307,24 +276,7 @@ public class utils { return settingPath; } - public static void setOfficeSettingsValue(XMultiServiceFactory msf, String setting, String value) { - try { - Object settings = msf.createInstance("com.sun.star.comp.framework.PathSettings"); - XPropertySet pthSettings = null; - try { - pthSettings = (XPropertySet) AnyConverter.toObject( - new Type(XPropertySet.class), settings); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - System.out.println("### couldn't get Office Settings"); - } - pthSettings.setPropertyValue(setting, value); - - } catch (Exception e) { - System.out.println("Couldn't set '" + setting + "' to value '" + value + "'"); - e.printStackTrace(); - } - } /** * This method returns the temp dicrectory of the user. @@ -570,15 +522,7 @@ public class utils { return true; } - public static void doOverwriteFile( - XMultiServiceFactory xMsf, String oldF, String newF) - { - try { - overwriteFile_impl(xMsf, oldF, newF); - } catch (InteractiveAugmentedIOException e) { - throw new RuntimeException(e); - } - } + public static boolean hasPropertyByName(XPropertySet props, String aName) { Property[] list = props.getPropertySetInfo().getProperties(); @@ -687,20 +631,7 @@ public class utils { return null; } - /** returns the path to the office binary folder - * - * @param msf The XMultiSeriveFactory - * @return the path to the office binrary or an empty string on any error - */ - public static String getOfficeBinPath(XMultiServiceFactory msf) { - String sysBinDir = ""; - try { - sysBinDir = utils.getSystemURL(utils.expandMacro(msf, "$SYSBINDIR")); - } catch (java.lang.Exception e) { - } - return sysBinDir; - } /** * Get an array of all property names from the property set. With the include @@ -871,37 +802,7 @@ public class utils { } - /** - * returns the platform of the office.<br> - * Since the runner and the office could run on different platform this function delivers the - * platform the office is running. - * @param xMSF the XMultiServiceFactory - * @return unxsols, unxsoli, unxlngi, wntmsci - */ - public static String getOfficeOS(XMultiServiceFactory xMSF) { - String platform = "unknown"; - - try { - String theOS = expandMacro(xMSF, "$_OS"); - if (theOS.equals("Windows")) { - platform = "wntmsci"; - } else if (theOS.equals("Linux")) { - platform = "unxlngi"; - } else { - if (theOS.equals("Solaris")) { - String theArch = expandMacro(xMSF, "$_ARCH"); - if (theArch.equals("SPARC")) { - platform = "unxsols"; - } else if (theArch.equals("x86")) { - platform = "unxsoli"; - } - } - } - } catch (Exception ex) { - } - return platform; - } /** * dispatches given <CODE>URL</CODE> to the document <CODE>XComponent</CODE> |