summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2010-06-01 11:40:18 +0200
committerIngrid Halama <iha@openoffice.org>2010-06-01 11:40:18 +0200
commitecf9a16e0022c858e3d7adffa25a2b8923f5e691 (patch)
tree9b4c7ecea8b6c19cd4cc7b15f2be5d9eae7a71d6 /qadevOOo
parent7844f1e00cc847d08783f5eb2089d597fa87ddc8 (diff)
parente3d773e8b7b3f0dec89c9c6e8b4a563a54b37818 (diff)
chart47: merge with DEV300_m80
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/runner/convwatch/OfficePrint.java65
-rw-r--r--qadevOOo/runner/graphical/BuildID.java6
-rw-r--r--qadevOOo/runner/graphical/DirectoryHelper.java6
-rw-r--r--qadevOOo/runner/graphical/EnhancedComplexTestCase.java52
-rw-r--r--qadevOOo/runner/graphical/FileHelper.java30
-rw-r--r--qadevOOo/runner/graphical/GlobalLogWriter.java17
-rw-r--r--qadevOOo/runner/graphical/HTMLResult.java2
-rw-r--r--qadevOOo/runner/graphical/IDocument.java2
-rw-r--r--qadevOOo/runner/graphical/IniFile.java47
-rw-r--r--qadevOOo/runner/graphical/JPEGComparator.java482
-rw-r--r--qadevOOo/runner/graphical/JPEGCreator.java53
-rw-r--r--qadevOOo/runner/graphical/MSOfficePostscriptCreator.java95
-rw-r--r--qadevOOo/runner/graphical/Office.java1
-rw-r--r--qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java180
-rw-r--r--qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java280
-rw-r--r--qadevOOo/runner/graphical/ParameterHelper.java16
-rw-r--r--qadevOOo/runner/graphical/PerformanceContainer.java18
-rw-r--r--qadevOOo/runner/graphical/PropertyName.java2
-rw-r--r--qadevOOo/runner/graphical/TimeHelper.java45
-rw-r--r--qadevOOo/runner/graphical/Tolerance.java23
-rw-r--r--qadevOOo/runner/graphical/makefile.mk3
-rw-r--r--qadevOOo/runner/helper/OfficeProvider.java30
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java5
-rw-r--r--qadevOOo/runner/util/utils.java52
-rw-r--r--qadevOOo/tests/java/ifc/accessibility/_XAccessibleContext.java3
-rw-r--r--qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java30
-rw-r--r--qadevOOo/tests/java/mod/_dbaccess/ORowSet.java2
-rw-r--r--qadevOOo/tests/java/mod/_forms/ODatabaseForm.java2
-rw-r--r--qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java2
29 files changed, 925 insertions, 626 deletions
diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java
index 7f9b86f2f920..c9a656ac84b4 100644
--- a/qadevOOo/runner/convwatch/OfficePrint.java
+++ b/qadevOOo/runner/convwatch/OfficePrint.java
@@ -49,10 +49,10 @@ import com.sun.star.uno.AnyConverter;
import helper.URLHelper;
import helper.PropertyHelper;
import helper.OSHelper;
-import convwatch.FileHelper;
-import convwatch.MSOfficePrint;
-import convwatch.GraphicalTestArguments;
-import convwatch.ConvWatchCancelException;
+// import convwatch.FileHelper;
+// import convwatch.MSOfficePrint;
+// import convwatch.GraphicalTestArguments;
+// import convwatch.ConvWatchCancelException;
// import helper.Parameter;
@@ -118,7 +118,7 @@ public class OfficePrint {
*/
static String getDocumentType( XComponent _aDoc )
{
- XModel xModel = (XModel) UnoRuntime.queryInterface( XModel.class, _aDoc);
+ XModel xModel = UnoRuntime.queryInterface( XModel.class, _aDoc);
PropertyValue[] aArgs = xModel.getArgs();
for (int i=0;i<aArgs.length;i++)
{
@@ -145,6 +145,9 @@ public class OfficePrint {
* the GraphicalTestArguments must contain a living MultiServiceFactory object
* or we crash here.
* Be aware, the ownership of the document gets to you, you have to close it.
+ * @param _aGTA
+ * @param _sInputURL
+ * @return
*/
public static XComponent loadFromURL(GraphicalTestArguments _aGTA,
String _sInputURL)
@@ -158,7 +161,7 @@ public class OfficePrint {
return null;
}
Object oDsk = _aGTA.getMultiServiceFactory().createInstance("com.sun.star.frame.Desktop");
- XDesktop aDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, oDsk);
+ XDesktop aDesktop = UnoRuntime.queryInterface(XDesktop.class, oDsk);
if (aDesktop != null)
{
@@ -172,7 +175,7 @@ public class OfficePrint {
// set here the loadComponentFromURL() properties
// at the moment only 'Hidden' is set, so no window is opened at work
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
// check which properties should set and count it.
// if (_aGTA.isHidden())
@@ -209,7 +212,7 @@ public class OfficePrint {
GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
// GlobalLogWriter.get().flush();
- XComponentLoader aCompLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
+ XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
// XComponent aDoc = null;
@@ -251,11 +254,11 @@ public class OfficePrint {
static boolean exportToPDF(XComponent _xComponent, String _sDestinationName)
{
XServiceInfo xServiceInfo =
- (XServiceInfo) UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XServiceInfo.class, _xComponent
);
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
PropertyValue aFiltername = new PropertyValue();
aFiltername.Name = "FilterName";
aFiltername.Value = getFilterName_forPDF(xServiceInfo);
@@ -266,7 +269,7 @@ public class OfficePrint {
try
{
XStorable store =
- (XStorable) UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XStorable.class, _xComponent
);
store.storeToURL(_sDestinationName, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
@@ -371,6 +374,10 @@ public class OfficePrint {
* Due to the fact we use a printer to convert the file to postscript, the default printer
* to create such postscript format must be installed, this is not tested here.
*
+ * @param _aGTA
+ * @param _sInputURL
+ * @param _sOutputURL
+ * @param _sPrintFileURL
* @return true, if print has been done.
* Be careful, true means only print returns with no errors, to be sure print is really done
* check existance of _sPrintFileURL
@@ -532,7 +539,7 @@ public class OfficePrint {
if (_aGTA.isStoreAllowed())
{
// store the document in an other directory
- XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _aDoc);
+ XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _aDoc);
if (aStorable != null)
{
PropertyValue [] szEmptyArgs = new PropertyValue [0];
@@ -571,7 +578,7 @@ public class OfficePrint {
// Change Pagesettings to DIN A4
GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Print document.");
- XPrintable aPrintable = (XPrintable) UnoRuntime.queryInterface( XPrintable.class, _aDoc);
+ XPrintable aPrintable = UnoRuntime.queryInterface( XPrintable.class, _aDoc);
if (aPrintable != null)
{
// System.out.println(" Set PaperFormat to DIN A4");
@@ -595,7 +602,7 @@ public class OfficePrint {
{
if (_aGTA.getPrinterName() != null)
{
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
// PropertyValue [] aPrintProps = new PropertyValue[1];
PropertyValue Arg = new PropertyValue();
Arg.Name = "Name";
@@ -619,20 +626,20 @@ public class OfficePrint {
// int nPropsCount = 0;
// If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
{
XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
Object aSettings = xMSF.createInstance( "com.sun.star.sheet.GlobalSheetSettings" );
if (aSettings != null)
{
- XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aSettings );
+ XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, aSettings );
xPropSet.setPropertyValue( "PrintAllSheets", new Boolean( true ) );
GlobalLogWriter.get().println("PrintAllSheets := true");
}
}
- ArrayList aPrintProps = new ArrayList();
+ ArrayList<PropertyValue> aPrintProps = new ArrayList<PropertyValue>();
// GlobalLogWriter.get().println("Property FileName:=" + _sPrintFileURL);
// PropertyValue [] aPrintProps = new PropertyValue[nProperties];
@@ -730,6 +737,9 @@ public class OfficePrint {
/**
+ * @param _aGTA
+ * @param _sAbsoluteOutputPath
+ * @param _sAbsoluteInputFile
* @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.
*/
@@ -783,6 +793,11 @@ public class OfficePrint {
* if is null, print only near the Input file path
* _sPrintType ".prn" Print input file with StarOffice/OpenOffice.org and the default printer as PostScript
*
+ * @param _aGTA
+ * @param _sAbsoluteOutputPath
+ * @param _sAbsoluteInputFile
+ * @return
+ * @throws ConvWatchCancelException
*/
public static boolean buildReference(GraphicalTestArguments _aGTA,
String _sAbsoluteOutputPath,
@@ -933,7 +948,7 @@ public class OfficePrint {
try
{
Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection");
- aTypeDetection = (XTypeDetection)UnoRuntime.queryInterface(XTypeDetection.class, oObj);
+ aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj);
}
catch(com.sun.star.uno.Exception e)
{
@@ -975,7 +990,7 @@ public class OfficePrint {
}
if (aObj != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
if (aNameAccess != null)
{
@@ -1066,7 +1081,7 @@ public class OfficePrint {
}
if (aObj != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
if (aNameAccess != null)
{
if (! aNameAccess.hasByName(_sFilterName))
@@ -1134,7 +1149,7 @@ public class OfficePrint {
try
{
Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection");
- aTypeDetection = (XTypeDetection)UnoRuntime.queryInterface(XTypeDetection.class, oObj);
+ aTypeDetection =UnoRuntime.queryInterface(XTypeDetection.class, oObj);
}
catch(com.sun.star.uno.Exception e)
{
@@ -1143,7 +1158,7 @@ public class OfficePrint {
}
if (aTypeDetection != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection);
if (aNameAccess != null)
{
@@ -1242,12 +1257,12 @@ public class OfficePrint {
// TODO: Do we need to wait?
TimeHelper.waitInSeconds(1, "wait after loadFromURL.");
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
// String sFilter = getFilterName_forExcel(xServiceInfo);
// System.out.println("Filter is " + sFilter);
// store the document in an other directory
- XStorable xStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, aDoc);
+ XStorable xStorable = UnoRuntime.queryInterface( XStorable.class, aDoc);
if (xStorable == null)
{
GlobalLogWriter.get().println("com.sun.star.frame.XStorable is null");
@@ -1266,7 +1281,7 @@ public class OfficePrint {
// initialize PropertyArray
// PropertyValue [] aStoreProps = new PropertyValue[ nPropertyCount ];
// int nPropertyIndex = 0;
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
String sExtension = "";
diff --git a/qadevOOo/runner/graphical/BuildID.java b/qadevOOo/runner/graphical/BuildID.java
index 4c5907ff34ad..cf9188d84a47 100644
--- a/qadevOOo/runner/graphical/BuildID.java
+++ b/qadevOOo/runner/graphical/BuildID.java
@@ -93,7 +93,7 @@ public class BuildID
}
else
{
- GlobalLogWriter.get().println("soffice executable not found.");
+ GlobalLogWriter.println("soffice executable not found.");
}
// int dummy = 0;
@@ -119,7 +119,7 @@ public class BuildID
}
else
{
- GlobalLogWriter.get().println("Property Build, can't open file '" + sOfficePath + "', please check.");
+ GlobalLogWriter.println("Property Build, can't open file '" + sOfficePath + "', please check.");
}
return sBuildID;
}
@@ -144,7 +144,7 @@ public class BuildID
}
else
{
- GlobalLogWriter.get().println("Property Build, can't open file '" + sOfficePath + "', please check.");
+ GlobalLogWriter.println("Property Build, can't open file '" + sOfficePath + "', please check.");
}
return sBuildID;
}
diff --git a/qadevOOo/runner/graphical/DirectoryHelper.java b/qadevOOo/runner/graphical/DirectoryHelper.java
index f3349da2800a..46930d19425f 100644
--- a/qadevOOo/runner/graphical/DirectoryHelper.java
+++ b/qadevOOo/runner/graphical/DirectoryHelper.java
@@ -38,7 +38,7 @@ import java.util.ArrayList;
*/
public class DirectoryHelper
{
- ArrayList m_aFileList = new ArrayList();
+ ArrayList<String> m_aFileList = new ArrayList<String>();
boolean m_bRecursiveIsAllowed = true;
void setRecursiveIsAllowed(boolean _bValue)
@@ -73,6 +73,10 @@ public class DirectoryHelper
* System.out.println(aEntry);
* }
*
+ * @param _sDirectory
+ * @param _aFileFilter
+ * @param _bRecursiveIsAllowed
+ * @return list of directories
*/
public static Object[] traverse( String _sDirectory, FileFilter _aFileFilter, boolean _bRecursiveIsAllowed )
{
diff --git a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java b/qadevOOo/runner/graphical/EnhancedComplexTestCase.java
index b465437f578f..c3ec2b3e8336 100644
--- a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java
+++ b/qadevOOo/runner/graphical/EnhancedComplexTestCase.java
@@ -44,8 +44,8 @@ abstract public class EnhancedComplexTestCase extends ComplexTestCase implements
private void callEntry(String _sEntry, ParameterHelper _aParam)
{
- log.println("- next file is: ------------------------------");
- log.println(_sEntry);
+ // log.println("- next file is: ------------------------------");
+ log.println("File: " + _sEntry);
// TODO: check if 'sEntry' is a guilty document.
File aFile = new File(_aParam.getInputPath());
String sPath = _aParam.getInputPath();
@@ -79,7 +79,8 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
// sNewDiffPath = FileHelper.appendPath(sNewDiffPath, sNewSubDir);
// }
}
- log.println("sEntry: " + _sEntry + " " /* + sNewReferencePath + " " */ + sNewOutputPath);
+ // log.println("sEntry: " + _sEntry + " " /* + sNewReferencePath + " " */ + sNewOutputPath);
+ log.println("Outputpath: " + sNewOutputPath);
// call interface with parameters
@@ -187,12 +188,34 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
}
else
{
- String sPath = FileHelper.getPath(sInputPath);
- String sBasename = FileHelper.getBasename(sInputPath);
+ String sInputPathWithPDF = sInputPath + ".pdf";
+ File aInputPathWithPDF = new File(sInputPathWithPDF);
- // there exist an index file, therefore we assume the given
- // file is already converted to postscript or pdf
- runThroughEveryReportInIndex(sPath, sBasename, _aParam);
+ if (aInputPathWithPDF.exists() &&
+ _aParam.getReferenceType().toLowerCase().equals("pdf"))
+ {
+ // create PDF only if a pdf file exists and creatortype is set to PDF
+ callEntry(sInputPathWithPDF, _aParam);
+ }
+ else
+ {
+ String sInputPathWithPS = sInputPath + ".ps";
+
+ File aInputPathWithPS = new File(sInputPathWithPS);
+ if (aInputPathWithPS.exists())
+ {
+ callEntry(sInputPathWithPS, _aParam);
+ }
+ else
+ {
+ String sPath = FileHelper.getPath(sInputPath);
+ String sBasename = FileHelper.getBasename(sInputPath);
+
+ // there exist an index file, therefore we assume the given
+ // file is already converted to postscript or pdf
+ runThroughEveryReportInIndex(sPath, sBasename, _aParam);
+ }
+ }
}
}
}
@@ -210,7 +233,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
{
// special case for odb files
int nFileCount = aIniFile.getIntValue(_sBasename, "reportcount", 0);
- ArrayList aList = new ArrayList();
+ ArrayList<String> aList = new ArrayList<String>();
for (int i=0;i<nFileCount;i++)
{
String sValue = aIniFile.getValue(_sBasename, "report" + i);
@@ -230,7 +253,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
// get the bad status and store it into the
for (int i=0;i<aList.size();i++)
{
- String sEntry = (String)aList.get(i);
+ String sEntry = aList.get(i);
callEntry(sEntry, _aParam);
// we want to know the current status of the run through
@@ -265,7 +288,12 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
}
}
}
+ else
+ {
+ assure("File '" + sIndexFile + "' doesn't exists.", aIndexFile.exists(), true);
+ }
}
+
private String getPSorPDFNameFromIniFile(IniFile _aIniFile, String _sName)
{
boolean bHasPostscriptOrPDF = false;
@@ -419,7 +447,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
{
// special case for odb files
int nFileCount = aIniFile.getIntValue(sBasename, "reportcount", 0);
- ArrayList aList = new ArrayList();
+ ArrayList<String> aList = new ArrayList<String>();
for (int i=0;i<nFileCount;i++)
{
String sValue = aIniFile.getValue(sBasename, "report" + i);
@@ -439,7 +467,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam)
for (int i=0;i<aList.size();i++)
{
- String sPSFile = (String)aList.get(i);
+ String sPSFile = aList.get(i);
// TODO: this information has to come out of the ini files
String sStatusRunThrough = "";
diff --git a/qadevOOo/runner/graphical/FileHelper.java b/qadevOOo/runner/graphical/FileHelper.java
index feb9e152e5d9..892f652567c1 100644
--- a/qadevOOo/runner/graphical/FileHelper.java
+++ b/qadevOOo/runner/graphical/FileHelper.java
@@ -50,9 +50,9 @@ public class FileHelper
String sOSArch = System.getProperty("os.arch");
String sOSVersion = System.getProperty("os.version");
- GlobalLogWriter.get().println(sOSName);
- GlobalLogWriter.get().println(sOSArch);
- GlobalLogWriter.get().println(sOSVersion);
+ GlobalLogWriter.println(sOSName);
+ GlobalLogWriter.println(sOSArch);
+ GlobalLogWriter.println(sOSVersion);
}
@@ -110,7 +110,7 @@ public class FileHelper
}
catch (NullPointerException e)
{
- GlobalLogWriter.get().println("Exception caught. FileHelper.isDir('" + _sDir + "')");
+ GlobalLogWriter.println("Exception caught. FileHelper.isDir('" + _sDir + "')");
e.printStackTrace();
}
return false;
@@ -258,7 +258,7 @@ public class FileHelper
}
catch (java.io.IOException e)
{
- GlobalLogWriter.get().println("Exception caught. FileHelper.makeDirectories('" + new_dir.getAbsolutePath() + "')");
+ GlobalLogWriter.println("Exception caught. FileHelper.makeDirectories('" + new_dir.getAbsolutePath() + "')");
}
}
}
@@ -361,9 +361,9 @@ public class FileHelper
{
if (m_bDebugTextShown == false)
{
- GlobalLogWriter.get().println("Found file: " + sName);
- GlobalLogWriter.get().println("Activate debug mode.");
- GlobalLogWriter.get().println("If debug mode is no longer necessary, remove the above file.");
+ GlobalLogWriter.println("Found file: " + sName);
+ GlobalLogWriter.println("Activate debug mode.");
+ GlobalLogWriter.println("If debug mode is no longer necessary, remove the above file.");
m_bDebugTextShown = true;
}
bDebug = true;
@@ -463,6 +463,16 @@ public class FileHelper
{
return false;
}
+ // leave out files starts with '.~lock.' these are OpenOffice.org lock files
+ if (pathname.getName().startsWith(".~lock."))
+ {
+ return false;
+ }
+ // leave out files ends with '#' these could be temp files
+ if (pathname.getName().endsWith("#"))
+ {
+ return false;
+ }
if (pathname.getName().endsWith(".prn"))
{
return false;
@@ -592,7 +602,7 @@ public class FileHelper
if (_sFile.startsWith("file://"))
{
sFilename = FileHelper.getSystemPathFromFileURL(_sFile);
- GlobalLogWriter.get().println("CreateInfoFile: '" + sFilename + "'" );
+ GlobalLogWriter.println("CreateInfoFile: '" + sFilename + "'" );
}
else
{
@@ -682,7 +692,7 @@ public class FileHelper
}
catch (java.io.IOException e)
{
- GlobalLogWriter.get().println("can't create Info file.");
+ GlobalLogWriter.println("can't create Info file.");
e.printStackTrace();
}
aIniFile.close();
diff --git a/qadevOOo/runner/graphical/GlobalLogWriter.java b/qadevOOo/runner/graphical/GlobalLogWriter.java
index a8deabfbce0a..478d3323abda 100644
--- a/qadevOOo/runner/graphical/GlobalLogWriter.java
+++ b/qadevOOo/runner/graphical/GlobalLogWriter.java
@@ -33,11 +33,22 @@ import stats.SimpleLogWriter;
public class GlobalLogWriter
{
private static LogWriter m_aGlobalLogWriter = null;
- public static synchronized void println(String _sMsg)
+
+ /**
+ * This is just a helper to get clearer code.
+ * use this GlobalLogWriter.println(...)
+ * @param _sMsg
+ */
+ protected static synchronized void println(String _sMsg)
{
get().println(_sMsg);
}
- public static synchronized LogWriter get()
+
+ /**
+ * @deprecated use GlobalLogWriter.println(...) direct
+ * @return
+ */
+ protected static synchronized LogWriter get()
{
if (m_aGlobalLogWriter == null)
{
@@ -52,7 +63,7 @@ public class GlobalLogWriter
// get().initialize(null, true);
// }
- public static synchronized void set(LogWriter _aLog)
+ protected static synchronized void set(LogWriter _aLog)
{
m_aGlobalLogWriter = _aLog;
}
diff --git a/qadevOOo/runner/graphical/HTMLResult.java b/qadevOOo/runner/graphical/HTMLResult.java
index 85ee0e88d356..af2a31a308ea 100644
--- a/qadevOOo/runner/graphical/HTMLResult.java
+++ b/qadevOOo/runner/graphical/HTMLResult.java
@@ -59,7 +59,7 @@ public class HTMLResult
catch (java.io.IOException e)
{
e.printStackTrace();
- GlobalLogWriter.get().println("ERROR: Can't create HTML Outputter");
+ GlobalLogWriter.println("ERROR: Can't create HTML Outputter");
// return null;
}
// m_sFilename = sFilename;
diff --git a/qadevOOo/runner/graphical/IDocument.java b/qadevOOo/runner/graphical/IDocument.java
index 3f724d5c5d9c..e23ddd4b91a1 100644
--- a/qadevOOo/runner/graphical/IDocument.java
+++ b/qadevOOo/runner/graphical/IDocument.java
@@ -40,7 +40,7 @@ public interface IDocument
* @param _sDocument
* @param _sResult
* @param _aParams
- * @throws graphical.DocumentLoaderException
+ * @throws OfficeException
*/
public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException;
}
diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java
index 832aef795e71..bd54a66b65fd 100644
--- a/qadevOOo/runner/graphical/IniFile.java
+++ b/qadevOOo/runner/graphical/IniFile.java
@@ -26,7 +26,7 @@
************************************************************************/
package graphical;
-import java.io.BufferedReader;
+// import java.io.BufferedReader;
import java.io.File;
import java.io.RandomAccessFile;
import java.util.ArrayList;
@@ -44,7 +44,7 @@ public class IniFile implements Enumeration
* Problem, if ini file changed why other write something difference, we don't realise this.
*/
private String m_sFilename;
- private ArrayList m_aList;
+ private ArrayList<String> m_aList;
boolean m_bListContainUnsavedChanges = false;
private int m_aEnumerationPos = 0;
@@ -76,13 +76,13 @@ public class IniFile implements Enumeration
}
}
- private ArrayList loadLines()
+ private ArrayList<String> loadLines()
{
File aFile = new File(m_sFilename);
- ArrayList aLines = new ArrayList();
+ ArrayList<String> aLines = new ArrayList<String>();
if (!aFile.exists())
{
- GlobalLogWriter.get().println("couldn't find file '" + m_sFilename + "', will be created.");
+ // GlobalLogWriter.println("couldn't find file '" + m_sFilename + "', will be created.");
// DebugHelper.exception(BasicErrorCode.SbERR_FILE_NOT_FOUND, "");
// m_bListContainUnsavedChanges = false;
return aLines;
@@ -104,14 +104,14 @@ public class IniFile implements Enumeration
}
catch (java.io.FileNotFoundException fne)
{
- GlobalLogWriter.get().println("couldn't open file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + fne.getMessage());
+ GlobalLogWriter.println("couldn't open file " + m_sFilename);
+ GlobalLogWriter.println("Message: " + fne.getMessage());
// DebugHelper.exception(BasicErrorCode.SbERR_FILE_NOT_FOUND, "");
}
catch (java.io.IOException ie)
{
- GlobalLogWriter.get().println("Exception occurs while reading from file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
+ GlobalLogWriter.println("Exception occurs while reading from file " + m_sFilename);
+ GlobalLogWriter.println("Message: " + ie.getMessage());
// DebugHelper.exception(BasicErrorCode.SbERR_INTERNAL_ERROR, ie.getMessage());
}
try
@@ -120,8 +120,8 @@ public class IniFile implements Enumeration
}
catch (java.io.IOException ie)
{
- GlobalLogWriter.get().println("Couldn't close file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
+ GlobalLogWriter.println("Couldn't close file " + m_sFilename);
+ GlobalLogWriter.println("Message: " + ie.getMessage());
// DebugHelper.exception(BasicErrorCode.SbERR_INTERNAL_ERROR, ie.getMessage());
}
return aLines;
@@ -165,7 +165,7 @@ public class IniFile implements Enumeration
private String getItem(int i)
{
- return (String) m_aList.get(i);
+ return m_aList.get(i);
}
private String buildSectionName(String _sSectionName)
@@ -380,7 +380,7 @@ public class IniFile implements Enumeration
}
catch (java.lang.NumberFormatException e)
{
- GlobalLogWriter.get().println("IniFile.getIntValue(): Caught a number format exception, return the default value.");
+ GlobalLogWriter.println("IniFile.getIntValue(): Caught a number format exception, return the default value.");
}
}
return nValue;
@@ -395,6 +395,8 @@ public class IniFile implements Enumeration
write back the ini file to the disk, only if there exist changes
* @deprecated use close() instead!
*/
+
+ // TODO: make private
public void store()
{
if (m_bListContainUnsavedChanges == false)
@@ -411,7 +413,7 @@ public class IniFile implements Enumeration
aFile.delete();
if (aFile.exists())
{
- GlobalLogWriter.get().println("Couldn't delete the file " + m_sFilename);
+ GlobalLogWriter.println("Couldn't delete the file " + m_sFilename);
return;
// DebugHelper.exception(BasicErrorCode.SbERR_INTERNAL_ERROR, "Couldn't delete the file " + m_sFilename);
}
@@ -439,14 +441,14 @@ public class IniFile implements Enumeration
}
catch (java.io.FileNotFoundException fne)
{
- GlobalLogWriter.get().println("couldn't open file for writing " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + fne.getMessage());
+ GlobalLogWriter.println("couldn't open file for writing " + m_sFilename);
+ GlobalLogWriter.println("Message: " + fne.getMessage());
// DebugHelper.exception(BasicErrorCode.SbERR_FILE_NOT_FOUND, "");
}
catch (java.io.IOException ie)
{
- GlobalLogWriter.get().println("Exception occurs while writing to file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
+ GlobalLogWriter.println("Exception occurs while writing to file " + m_sFilename);
+ GlobalLogWriter.println("Message: " + ie.getMessage());
// DebugHelper.exception(BasicErrorCode.SbERR_INTERNAL_ERROR, ie.getMessage());
}
}
@@ -467,7 +469,10 @@ public class IniFile implements Enumeration
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
- */
+ * @param _sSection
+ * @param _sKey
+ * @param _sValue
+ */
public void insertValue(String _sSection, String _sKey, String _sValue)
{
int i = findSection(_sSection);
@@ -637,7 +642,7 @@ public class IniFile implements Enumeration
{
while (i < m_aList.size())
{
- String sLine = (String) m_aList.get(i);
+ String sLine = m_aList.get(i);
if (sLine.startsWith("["))
{
return i;
@@ -657,7 +662,7 @@ public class IniFile implements Enumeration
int nLineWithSection = findNextSection(m_aEnumerationPos);
if (nLineWithSection != -1)
{
- String sSection = (String) m_aList.get(nLineWithSection);
+ String sSection = m_aList.get(nLineWithSection);
m_aEnumerationPos = findNextSection(nLineWithSection + 1);
sSection = sectionToString(sSection);
return sSection;
diff --git a/qadevOOo/runner/graphical/JPEGComparator.java b/qadevOOo/runner/graphical/JPEGComparator.java
index ed3417e04c9c..a643b2b333c3 100644
--- a/qadevOOo/runner/graphical/JPEGComparator.java
+++ b/qadevOOo/runner/graphical/JPEGComparator.java
@@ -26,18 +26,19 @@
*
* ***********************************************************************
*/
-
package graphical;
import helper.OSHelper;
import helper.ProcessHandler;
import java.io.File;
+import java.io.IOException;
/**
* Helper class to interpret a jpg filename
*/
class NameDPIPage
{
+
String Name;
int DPI;
int Page;
@@ -69,20 +70,20 @@ class NameDPIPage
String sDPI = sNameNoSuffix.substring(nDPIStart + 1, sNameNoSuffix.length() - 8);
try
{
- nDPI = Integer.valueOf(sDPI).intValue();
+ nDPI = Integer.valueOf(sDPI).intValue();
}
- catch(java.lang.NumberFormatException e)
+ catch (java.lang.NumberFormatException e)
{
- GlobalLogWriter.get().println("DPI: Number format exception");
+ GlobalLogWriter.println("DPI: Number format exception");
}
String sPage = sNameNoSuffix.substring(sNameNoSuffix.length() - 4);
try
{
- nPage = Integer.valueOf(sPage).intValue();
+ nPage = Integer.valueOf(sPage).intValue();
}
- catch(java.lang.NumberFormatException e)
+ catch (java.lang.NumberFormatException e)
{
- GlobalLogWriter.get().println("Page: Number format exception");
+ GlobalLogWriter.println("Page: Number format exception");
}
}
}
@@ -95,6 +96,77 @@ class NameDPIPage
}
}
+class CountNotXXXPixelsFromImage extends Thread
+{
+
+ private String m_sFilename;
+ protected int m_nValue;
+
+ CountNotXXXPixelsFromImage(String _sFilename)
+ {
+ m_sFilename = _sFilename;
+ }
+
+ public int getValue()
+ {
+ return m_nValue;
+ }
+
+ protected void setValue(int _nValue)
+ {
+ m_nValue = _nValue;
+ }
+
+ protected String getFilename()
+ {
+ return m_sFilename;
+ }
+}
+
+class CountNotWhitePixelsFromImage extends CountNotXXXPixelsFromImage
+{
+
+ CountNotWhitePixelsFromImage(String _sFilename)
+ {
+ super(_sFilename);
+ }
+
+ public void run()
+ {
+ try
+ {
+ final int nNotWhiteCount = PixelCounter.countNotWhitePixelsFromImage(getFilename());
+ setValue(nNotWhiteCount);
+ }
+ catch (java.io.IOException e)
+ {
+ m_nValue = -1;
+ }
+ }
+}
+
+class CountNotBlackPixelsFromImage extends CountNotXXXPixelsFromImage
+{
+
+ CountNotBlackPixelsFromImage(String _sFilename)
+ {
+ super(_sFilename);
+ }
+
+ public void run()
+ {
+ try
+ {
+ final int nNotBlackCount = PixelCounter.countNotBlackPixelsFromImage(getFilename());
+ setValue(nNotBlackCount);
+ }
+ catch (java.io.IOException e)
+ {
+ m_nValue = -1;
+ }
+ }
+}
+
/**
*
* @author ll93751
@@ -102,10 +174,12 @@ class NameDPIPage
public class JPEGComparator extends EnhancedComplexTestCase
{
// @Override
+
public String[] getTestMethodNames()
{
return new String[]{"CompareJPEGvsJPEG"};
}
+ private Tolerance m_aTolerance;
/**
* test function.
@@ -121,8 +195,8 @@ public class JPEGComparator extends EnhancedComplexTestCase
public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException
{
- // private void callEveryPictureInIniFile(IniFile _aIniFile, String _sSectionName, ParameterHelper _aParam)
- // {
+ // private void callEveryPictureInIniFile(IniFile _aIniFile, String _sSectionName, ParameterHelper _aParam)
+ // {
String sPath = FileHelper.getPath(_sDocumentName);
String sSectionName = FileHelper.getBasename(_sDocumentName);
@@ -141,8 +215,9 @@ public class JPEGComparator extends EnhancedComplexTestCase
// only which has 'pages' has also pictures
int nPages = aIniFile.getIntValue(sSectionName, "pages", 0);
String sJPEGSchema = aIniFile.getValue(sSectionName, "jpegschema");
-
- for (int i=1 ; i<=nPages ; i++)
+ int nTolerance = aIniFile.getIntValue(sSectionName, "tolerance", 0);
+ m_aTolerance = new Tolerance(nTolerance);
+ for (int i = 1; i <= nPages; i++)
{
String sJPEGFilename = JPEGCreator.getFilenameForJPEGSchema(sJPEGSchema, i);
// String sPath = FileHelper.getPath(_aParam.getInputPath());
@@ -171,7 +246,6 @@ public class JPEGComparator extends EnhancedComplexTestCase
evaluateResult(sResultIniFile, _aParams);
}
-
private void evaluateResult(String _sDocument, ParameterHelper _aParams)
{
String sResultIniFile = _sDocument + ".ini";
@@ -185,7 +259,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
IniFile aResultIniFile = new IniFile(sResultIniFile);
int nPages = aResultIniFile.getIntValue("global", "pages", 0);
- for (int i=0;i<nPages;i++)
+ for (int i = 0; i < nPages; i++)
{
String sCurrentPage = "page" + String.valueOf(i + 1);
int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1);
@@ -195,13 +269,13 @@ public class JPEGComparator extends EnhancedComplexTestCase
}
else if (nPercent <= 5)
{
- bad ++;
- ok_status=2;
+ bad++;
+ ok_status = 2;
}
else
{
- ugly ++;
- ok_status=3;
+ ugly++;
+ ok_status = 3;
}
}
@@ -226,7 +300,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
sBad = " bad:=" + bad;
sStatusMessage += sBad;
}
- if (ugly > 0)
+ if (ugly > 0)
{
sUgly = " ugly:=" + ugly;
sStatusMessage += sUgly;
@@ -263,53 +337,67 @@ public class JPEGComparator extends EnhancedComplexTestCase
_aParams.getTestParameters().put("current_ok_status", ok_status);
// if we have a ugly page, we must return this as a FAILED STATUS in Log file!
- // assure( "There exist pages marked as ugly.", ugly == 0)
+ assure("There exist pages marked as ugly.", ugly == 0);
}
private void checkOnePicture(String _sDocumentName, String _sResult, ParameterHelper _aParams)
{
GlobalLogWriter.println("JPEG: Compare difference between '" + _sDocumentName + "' and '" + _sResult + "'");
- File aResultFile = new File(_sResult);
- if (aResultFile.isDirectory())
- {
- // result is just a directory, so we search for the basename of the source and take this.
- String sBasename = FileHelper.getBasename(_sDocumentName);
- String sResultFilename = FileHelper.appendPath(_sResult, sBasename);
- aResultFile = new File(sResultFilename);
- if (aResultFile.exists())
- {
- // Original and Result exists
- String sInputPath = _aParams.getInputPath();
- if (sInputPath.toLowerCase().endsWith("index.ini"))
- {
- // special case
- // we want to get the buildid from the info file.
-
- }
-
- compareJPEG(_sDocumentName, sResultFilename, _aParams);
-
- }
- else
- {
- GlobalLogWriter.println("Warning: Result JPEG doesn't exists '" + sResultFilename + "'");
- }
- }
- else
- {
- // result is also a file
- if (aResultFile.exists())
- {
- compareJPEG(_sDocumentName, _sResult, _aParams);
- }
- else
- {
- GlobalLogWriter.println("Warning: Result JPEG doesn't exists '" + _sResult + "'");
- }
- }
- }
+ File aResultFile = new File(_sResult);
+ if (aResultFile.isDirectory())
+ {
+ // result is just a directory, so we search for the basename of the source and take this.
+ String sBasename = FileHelper.getBasename(_sDocumentName);
+ String sResultFilename = FileHelper.appendPath(_sResult, sBasename);
+ aResultFile = new File(sResultFilename);
+ if (aResultFile.exists())
+ {
+ // Original and Result exists
+ String sInputPath = _aParams.getInputPath();
+ if (sInputPath.toLowerCase().endsWith("index.ini"))
+ {
+ // special case
+ // we want to get the buildid from the info file.
+ }
+ compareJPEG(_sDocumentName, sResultFilename, _aParams);
+ }
+ else
+ {
+ String sResultFilenamePDF = util.utils.replaceAll13(sResultFilename, ".ps_", ".pdf_");
+ File aResultPDFFile = new File(sResultFilenamePDF);
+ if (aResultPDFFile.exists())
+ {
+ // Original and Result exists
+ String sInputPath = _aParams.getInputPath();
+ if (sInputPath.toLowerCase().endsWith("index.ini"))
+ {
+ // special case
+ // we want to get the buildid from the info file.
+ }
+
+ compareJPEG(_sDocumentName, sResultFilenamePDF, _aParams);
+ }
+ else
+ {
+ GlobalLogWriter.println("Warning: Result JPEG doesn't exists '" + sResultFilename + "'");
+ }
+ }
+ }
+ else
+ {
+ // result is also a file
+ if (aResultFile.exists())
+ {
+ compareJPEG(_sDocumentName, _sResult, _aParams);
+ }
+ else
+ {
+ GlobalLogWriter.println("Warning: Result JPEG doesn't exists '" + _sResult + "'");
+ }
+ }
+ }
/**
* compare 2 JPEGs, it is a need, that both _sDocumentName and _sResultFilename exist.
@@ -318,7 +406,6 @@ public class JPEGComparator extends EnhancedComplexTestCase
* @param _aParams
* @return 0=no difference !=0 both files differ
*/
-
private void compareJPEG(String _sDocumentName, String _sResult, ParameterHelper _aParams)
{
NameDPIPage aNameDPIPage = NameDPIPage.interpret(_sDocumentName);
@@ -328,7 +415,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
String sDestinationBasename = FileHelper.getBasename(_sResult);
String sDestinationPath = FileHelper.getPath(_sResult);
- if (! sSourcePath.equals(sDestinationPath))
+ if (!sSourcePath.equals(sDestinationPath))
{
// we want to have all in one Directory, Original, Reference and the Difference result.
// copy the original file to the reference path
@@ -354,9 +441,23 @@ public class JPEGComparator extends EnhancedComplexTestCase
// this means, 1=only one color, no differences found.
int nResult = identify(sDifference);
int nPercentColorDiffer = 0;
- String sResult = "NO";
+
+ String sResult = "YES";
+
+ if (m_aTolerance != null)
+ {
+ final int nAcceptedTolerance = m_aTolerance.getAccept();
+ if (nResult <= nAcceptedTolerance)
+ {
+ nResult = 1;
+ sResult = "IN TOLERANCE";
+ GlobalLogWriter.println("The differences are in tolerance.");
+
+ }
+ }
if (nResult != 1)
{
+ sResult = "NO";
try
{
nPercentColorDiffer = estimateGfx(sSource, sDestination, sDifference);
@@ -366,10 +467,6 @@ public class JPEGComparator extends EnhancedComplexTestCase
GlobalLogWriter.println("Can't estimate the different colors. " + e.getMessage());
}
}
- else
- {
- sResult = "YES";
- }
// store the result in a result.ini file
String sResultFile = FileHelper.appendPath(sDestinationPath, aNameDPIPage.Name + ".ini");
@@ -380,14 +477,16 @@ public class JPEGComparator extends EnhancedComplexTestCase
}
IniFile aResultIni = new IniFile(sResultFile);
- String[] aComment = {
+ String[] aComment =
+ {
"; This file is automatically created by a graphical.JPEGComparator run",
"; ",
"; If you see this file in a browser you may have forgotten to set the follows in the property file",
"; " + PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX + "=http://<computer>/gfxcmp_ui/cw.php?inifile=",
"; Please check the documentation if you got confused.",
"; ",
- "; "};
+ "; "
+ };
aResultIni.insertFirstComment(aComment);
// write down the global flags
@@ -396,7 +495,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
// INIoutput.writeValue("buildid", _sBuildID);
// INIoutput.writeValue("refbuildid", _sRefBuildID);
- String sRefBuildId = (String)_aParams.getTestParameters().get("RefBuildId");
+ String sRefBuildId = (String) _aParams.getTestParameters().get("RefBuildId");
if (sRefBuildId == null)
{
sRefBuildId = "";
@@ -410,8 +509,8 @@ public class JPEGComparator extends EnhancedComplexTestCase
// write down flags for each page
String sSection = "page" + String.valueOf(nPage);
- aResultIni.insertValue(sSection, "oldgfx", sSource);
- aResultIni.insertValue(sSection, "newgfx", sDestination);
+ aResultIni.insertValue(sSection, "oldgfx", sSource);
+ aResultIni.insertValue(sSection, "newgfx", sDestination);
aResultIni.insertValue(sSection, "diffgfx", sDifference);
aResultIni.insertValue(sSection, "percent", nPercentColorDiffer);
aResultIni.insertValue(sSection, "BM", "false");
@@ -490,8 +589,6 @@ public class JPEGComparator extends EnhancedComplexTestCase
// INIoutput.close();
// return bResultIsOk;
// }
-
-
/**
* count how much pixel differ and between Old or New and the Difference graphics
*
@@ -517,75 +614,119 @@ public class JPEGComparator extends EnhancedComplexTestCase
* @return the count of different pixels
* @throws java.io.IOException if file access is not possible
*/
-
public static int estimateGfx(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- throws java.io.IOException
- {
- // new count pixels
- final int nNotWhiteCount_OldGraphic = PixelCounter.countNotWhitePixelsFromImage(_sOldGfx);
- final int nNotWhiteCount_NewGraphic = PixelCounter.countNotWhitePixelsFromImage(_sNewGfx);
- final int nNotBlackCount_DiffGraphic = PixelCounter.countNotBlackPixelsFromImage(_sDiffGfx);
+ throws java.io.IOException
+ {
+ TimeHelper a = new TimeHelper();
+ a.start();
+ // Count Pixels
+ final int nNotWhiteCount_OldGraphic = PixelCounter.countNotWhitePixelsFromImage(_sOldGfx);
+ final int nNotWhiteCount_NewGraphic = PixelCounter.countNotWhitePixelsFromImage(_sNewGfx);
+ final int nNotBlackCount_DiffGraphic = PixelCounter.countNotBlackPixelsFromImage(_sDiffGfx);
+
+ // Count Pixels in different threads
+// CountNotWhitePixelsFromImage t1 = new CountNotWhitePixelsFromImage(_sOldGfx);
+// CountNotWhitePixelsFromImage t2 = new CountNotWhitePixelsFromImage(_sNewGfx);
+// CountNotBlackPixelsFromImage t3 = new CountNotBlackPixelsFromImage(_sDiffGfx);
+// t1.start();
+// t2.start();
+// t3.start();
+// try
+// {
+// t1.join();
+// }
+// catch (InterruptedException ex)
+// {
+// GlobalLogWriter.get().println("Thread 1 failed: " + ex.getMessage());
+// }
+// try
+// {
+// t2.join();
+// }
+// catch (InterruptedException ex)
+// {
+// GlobalLogWriter.get().println("Thread 2 failed: " + ex.getMessage());
+// }
+// try
+// {
+// t3.join();
+// }
+// catch (InterruptedException ex)
+// {
+// GlobalLogWriter.get().println("Thread 3 failed: " + ex.getMessage());
+// }
+// final int nNotWhiteCount_OldGraphic = t1.getValue();
+// final int nNotWhiteCount_NewGraphic = t2.getValue();
+// final int nNotBlackCount_DiffGraphic = t3.getValue();
+
+ a.stop();
+ GlobalLogWriter.println("Thread Time is: " + a.getTime());
- int nMinNotWhiteCount = Math.min(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
+ int nMinNotWhiteCount = Math.min(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
- // check if not zero
+ // check if not zero
+ if (nMinNotWhiteCount == 0)
+ {
+ nMinNotWhiteCount = Math.max(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
if (nMinNotWhiteCount == 0)
{
- nMinNotWhiteCount = Math.max(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
- if (nMinNotWhiteCount == 0)
- {
- nMinNotWhiteCount = 1;
- }
+ nMinNotWhiteCount = 1;
}
-
- int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
- GlobalLogWriter.get().println( "Graphics check, pixel based:" + String.valueOf(nPercent) + "% pixel differ ");
- return nPercent;
}
- private static int compareJPEG(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
+ int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
+ GlobalLogWriter.println("Graphics check, pixel based:" + String.valueOf(nPercent) + "% pixel differ ");
+ return nPercent;
+ }
+
+ private static int compareJPEG(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
+ {
+ String sComposite = "composite";
+ if (OSHelper.isWindows())
{
- String sComposite = "composite";
- if (OSHelper.isWindows())
+ sComposite = "composite.exe";
+ String sIMPath = (String) param.get("imagemagick.path");
+ if (sIMPath != null)
{
- sComposite = "composite.exe";
+ sComposite = FileHelper.appendPath(sIMPath, sComposite);
}
+ }
- // String sCommand = sComposite + " -compose difference " +
- // StringHelper.doubleQuoteIfNeed(_sOldGfx) + " " +
- // StringHelper.doubleQuoteIfNeed(_sNewGfx) + " " +
- // StringHelper.doubleQuoteIfNeed(_sDiffGfx);
+ // String sCommand = sComposite + " -compose difference " +
+ // StringHelper.doubleQuoteIfNeed(_sOldGfx) + " " +
+ // StringHelper.doubleQuoteIfNeed(_sNewGfx) + " " +
+ // StringHelper.doubleQuoteIfNeed(_sDiffGfx);
- String[] sCommandArray =
- {
- sComposite,
- "-compose",
- "difference",
- _sOldGfx,
- _sNewGfx,
- _sDiffGfx
- };
-
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- boolean bBackValue = aHandler.executeSynchronously();
- int nExitCode = aHandler.getExitCode();
- if (nExitCode != 0)
- {
- GlobalLogWriter.println("'" + sComposite + "' return with ");
- String sBack = aHandler.getOutputText();
- GlobalLogWriter.get().println("'" + sBack + "'");
- }
- else
+ String[] sCommandArray =
+ {
+ sComposite,
+ "-compose",
+ "difference",
+ _sOldGfx,
+ _sNewGfx,
+ _sDiffGfx
+ };
+
+ ProcessHandler aHandler = new ProcessHandler(sCommandArray);
+ boolean bBackValue = aHandler.executeSynchronously();
+ int nExitCode = aHandler.getExitCode();
+ if (nExitCode != 0)
+ {
+ GlobalLogWriter.println("'" + sComposite + "' return with ");
+ String sBack = aHandler.getOutputText();
+ GlobalLogWriter.println("'" + sBack + "'");
+ }
+ else
+ {
+ // creates an extra smaller difference picture
+ File aDiffFile = new File(_sDiffGfx);
+ if (aDiffFile.exists())
{
- // creates an extra smaller difference picture
- File aDiffFile = new File(_sDiffGfx);
- if (aDiffFile.exists())
- {
- JPEGCreator.convertToNearSameFileWithWidth340(_sDiffGfx);
- }
+ JPEGCreator.convertToNearSameFileWithWidth340(_sDiffGfx);
}
- return nExitCode;
}
+ return nExitCode;
+ }
/**
* wrapper for ImageMagick identify,
@@ -593,58 +734,60 @@ public class JPEGComparator extends EnhancedComplexTestCase
* if it's only one color (nResult==1), like background color, there is no difference.
*/
int identify(String _sDiffGfx)
+ {
+ int nResult = 0;
+ // would like to know what the meaning of %k is for ImageMagick's 'identify'
+ String sIM_Format = "%k";
+ // if (OSHelper.isWindows())
+ // {
+ // sIM_Format = "%%k";
+ // }
+
+ String sIdentify = "identify";
+ if (OSHelper.isWindows())
{
- int nResult = 0;
- // would like to know what the meaning of %k is for ImageMagick's 'identify'
- String sIM_Format = "%k";
- // if (OSHelper.isWindows())
- // {
- // sIM_Format = "%%k";
- // }
-
- String sIdentify = "identify";
- if (OSHelper.isWindows())
+ sIdentify = "identify.exe";
+ String sIMPath = (String) param.get("imagemagick.path");
+ if (sIMPath != null)
{
- sIdentify = "identify.exe";
+ sIdentify = FileHelper.appendPath(sIMPath, sIdentify);
}
+ }
- // String sCommand = sIdentify + " " + sIM_Format + " " + StringHelper.doubleQuoteIfNeed(_sDiffGfx);
-
- String[] sCommandArray =
- {
- sIdentify,
- "-format",
- sIM_Format,
- _sDiffGfx
- };
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- boolean bBackValue = aHandler.executeSynchronously();
- int nExitCode = aHandler.getExitCode();
-
- String sBack = aHandler.getOutputText();
- GlobalLogWriter.get().println("'" + sBack + "'");
+ // String sCommand = sIdentify + " " + sIM_Format + " " + StringHelper.doubleQuoteIfNeed(_sDiffGfx);
- // try to interpret the result, which we get as a String
- try
- {
- int nIdx = sBack.indexOf("\n");
- if (nIdx > 0)
- {
- sBack = sBack.substring(0, nIdx);
- }
-
- nResult = Integer.valueOf(sBack).intValue();
- }
- catch(java.lang.NumberFormatException e)
+ String[] sCommandArray =
+ {
+ sIdentify,
+ "-format",
+ sIM_Format,
+ _sDiffGfx
+ };
+ ProcessHandler aHandler = new ProcessHandler(sCommandArray);
+ boolean bBackValue = aHandler.executeSynchronously();
+ int nExitCode = aHandler.getExitCode();
+
+ String sBack = aHandler.getOutputText();
+ GlobalLogWriter.println("'" + sBack + "'");
+
+ // try to interpret the result, which we get as a String
+ try
+ {
+ int nIdx = sBack.indexOf("\n");
+ if (nIdx > 0)
{
- GlobalLogWriter.get().println("identify(): Number format exception");
- nResult = 0;
+ sBack = sBack.substring(0, nIdx);
}
- return nResult;
- }
-
-
+ nResult = Integer.valueOf(sBack).intValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ GlobalLogWriter.println("identify(): Number format exception");
+ nResult = 0;
+ }
+ return nResult;
+ }
// public static void main(String [] _args)
// {
//// give an index.ini file, ok
@@ -670,5 +813,4 @@ public class JPEGComparator extends EnhancedComplexTestCase
//
// org.openoffice.Runner.main(args);
// }
-
}
diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java
index 5f6343d9780d..a4336229e448 100644
--- a/qadevOOo/runner/graphical/JPEGCreator.java
+++ b/qadevOOo/runner/graphical/JPEGCreator.java
@@ -75,18 +75,35 @@ public class JPEGCreator extends EnhancedComplexTestCase
{
createSmallPictures(sJPEGNameSchema);
+ // read out tolerance file
+ String sFileDir = FileHelper.getPath(_sDocumentName);
+ String sBasename = FileHelper.getBasename(_sDocumentName);
+ int nTolerance = 0;
+ String sToleranceFile = FileHelper.appendPath(sFileDir, "tolerance.ini");
+ File aToleranceFile = new File(sToleranceFile);
+ if (aToleranceFile.exists())
+ {
+ IniFile aIniFile = new IniFile(sToleranceFile);
+ nTolerance = aIniFile.getIntValue(sBasename, "accept", 0); // default for all pages
+ aIniFile.close();
+ }
+
String sIndexFile = FileHelper.appendPath(_sResult, "index.ini");
File aIndexFile = new File(sIndexFile);
if (aIndexFile.exists())
{
// store only if an index file exists
IniFile aIniFile = new IniFile(sIndexFile);
- String sBasename = FileHelper.getBasename(_sDocumentName);
aIniFile.insertValue(sBasename, "jpegschema", sJPEGNameSchema);
aIniFile.insertValue(sBasename, "pages", nPages);
+ aIniFile.insertValue(sBasename, "tolerance", nTolerance);
aIniFile.close();
}
}
+ else
+ {
+ assure("There are no pages in document:'" + _sDocumentName + "', maybe document currupt?", false, true);
+ }
}
/**
@@ -96,6 +113,12 @@ public class JPEGCreator extends EnhancedComplexTestCase
*/
public void createSmallPictures(String _sJPEGSchema)
{
+ ParameterHelper aParam = new ParameterHelper(param);
+ if (! aParam.createSmallPictures())
+ {
+ return;
+ }
+
int nPages = 0;
if (_sJPEGSchema.length() > 0)
{
@@ -124,6 +147,11 @@ public class JPEGCreator extends EnhancedComplexTestCase
*/
public static void convertToNearSameFileWithWidth340(String _sJPEGFilename)
{
+ ParameterHelper aParam = new ParameterHelper(param);
+ if (! aParam.createSmallPictures())
+ {
+ return;
+ }
String sJPEGFilename = _sJPEGFilename.replaceAll("\\\\", "/");
// if (OSHelper.isWindows())
// {
@@ -160,7 +188,13 @@ private static void convertToWidth340(String _sFrom, String _To)
{
// TODO!
// HACK Hard coded!
- sConvertEXE = "C:\\Programme\\ImageMagick-6.0.3-q8\\convert.exe";
+ // sConvertEXE = "C:\\Programme\\ImageMagick-6.0.3-q8\\convert.exe";
+ sConvertEXE = "convert.exe";
+ String sConvertPath = (String)param.get("imagemagick.path");
+ if (sConvertPath != null)
+ {
+ sConvertEXE = FileHelper.appendPath(sConvertPath, sConvertEXE);
+ }
}
String[] sCommandArray =
@@ -178,7 +212,7 @@ private static void convertToWidth340(String _sFrom, String _To)
String sBack = aHandler.getOutputText();
if (sBack.length() > 0)
{
- GlobalLogWriter.get().println("'" + sBack + "'");
+ GlobalLogWriter.println("'" + sBack + "'");
}
// try to interpret the result, which we get as a String
// try
@@ -223,7 +257,7 @@ private static void convertToWidth340(String _sFrom, String _To)
}
else
{
- GlobalLogWriter.get().println("File: '" + _sFile + "' doesn't exist.");
+ GlobalLogWriter.println("File: '" + _sFile + "' doesn't exist.");
return "";
}
String sFileDir = FileHelper.getPath(_sFile);
@@ -291,6 +325,16 @@ private static void convertToWidth340(String _sFrom, String _To)
if (OSHelper.isWindows())
{
sGhostscriptEXE = "gswin32c.exe";
+ String sGhostscriptEXE2 = (String)param.get("gs.exe");
+ if (sGhostscriptEXE2 != null)
+ {
+ sGhostscriptEXE = sGhostscriptEXE2;
+ }
+ String sGhostscriptPath = (String)param.get("gs.path");
+ if (sGhostscriptPath != null)
+ {
+ sGhostscriptEXE = FileHelper.appendPath(sGhostscriptPath, sGhostscriptEXE);
+ }
}
// String sCommand = sGhostscriptEXE + " -dNOPROMPT -dBATCH -sDEVICE=jpeg -r" + String.valueOf(_nResolutionInDPI) + " -dNOPAUSE -sOutputFile=" + StringHelper.doubleQuoteIfNeed(sJPGFilename) + " " + StringHelper.doubleQuoteIfNeed(sOriginalFile);
@@ -333,6 +377,7 @@ private static void convertToWidth340(String _sFrom, String _To)
{
// return only a valid schema name if there at least one page.
sJPEGNameSchema = "";
+ assure("Document '" + sPostscriptOrPDFFile + "' doesn't create pages.", false, true);
}
}
else
diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
index 8a85c6b32afd..86eb28143ed2 100644
--- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
+++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
@@ -88,14 +88,14 @@ public class MSOfficePostscriptCreator implements IOffice
if (! isMSOfficeDocumentFormat(m_sDocumentName))
{
- GlobalLogWriter.get().println("This document type is not recognized as MSOffice format, as default fallback StarOffice/OpenOffice.org instead is used.");
+ GlobalLogWriter.println("This document type is not recognized as MSOffice format, as default fallback StarOffice/OpenOffice.org instead is used.");
throw new OfficeException("This document type is not recognized as MSOffice format, as default fallback StarOffice/OpenOffice.org instead is used.");
}
}
public void storeAsPostscript() throws OfficeException
{
- GlobalLogWriter.get().println("USE MSOFFICE AS EXPORT FORMAT.");
+ GlobalLogWriter.println("USE MSOFFICE AS EXPORT FORMAT.");
try
{
String sDocumentName = m_sDocumentName + ".ps";
@@ -112,12 +112,12 @@ public class MSOfficePostscriptCreator implements IOffice
catch(OfficeException e)
{
e.printStackTrace();
- GlobalLogWriter.get().println(e.getMessage());
+ GlobalLogWriter.println(e.getMessage());
throw new OfficeException("Exception caught. Problem with MSOffice printer methods.");
}
catch(java.io.IOException e)
{
- GlobalLogWriter.get().println(e.getMessage());
+ GlobalLogWriter.println(e.getMessage());
throw new OfficeException("IOException caught. Problem with MSOffice printer methods.");
}
}
@@ -177,11 +177,11 @@ public class MSOfficePostscriptCreator implements IOffice
private boolean isMSOfficeDocumentFormat(String _sFile)
{
String sDocumentSuffix = FileHelper.getSuffix(_sFile);
- if (isWordDocument(sDocumentSuffix)) return true;
- if (isExcelDocument(sDocumentSuffix)) return true;
- if (isPowerPointDocument(sDocumentSuffix)) return true;
+ if (isWordDocument(sDocumentSuffix)) {return true;}
+ if (isExcelDocument(sDocumentSuffix)) {return true;}
+ if (isPowerPointDocument(sDocumentSuffix)) {return true;}
// if suffix is xml, return also true, but we can't decide if word or excel
- if (sDocumentSuffix.toLowerCase().endsWith(".xml")) return true;
+ if (sDocumentSuffix.toLowerCase().endsWith(".xml")) {return true;}
return false;
}
@@ -191,7 +191,7 @@ public class MSOfficePostscriptCreator implements IOffice
{
String sDocumentSuffix = FileHelper.getSuffix(_sInputFile);
String sFilterName = _aGTA.getExportFilterName();
- ArrayList aStartCommand = new ArrayList();
+ ArrayList<String> aStartCommand = new ArrayList<String>();
if (isWordDocument(sDocumentSuffix))
{
aStartCommand = createWordStoreHelper();
@@ -222,7 +222,7 @@ public class MSOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("No Microsoft Office document format found.");
+ GlobalLogWriter.println("No Microsoft Office document format found.");
throw new WrongSuffixException("No MS office document format found.");
}
@@ -249,6 +249,11 @@ public class MSOfficePostscriptCreator implements IOffice
// -----------------------------------------------------------------------------
/**
* print the given file (_sInputFile) to the file name (_sPrintFile)
+ * @param _aGTA
+ * @param _sInputFile
+ * @param _sPrintFilename
+ * @throws OfficeException
+ * @throws java.io.IOException
*/
public void printToFileWithMSOffice( ParameterHelper _aGTA,
String _sInputFile,
@@ -258,7 +263,7 @@ public class MSOfficePostscriptCreator implements IOffice
setPrinterName(_aGTA.getPrinterName());
- ArrayList aStartCommand = new ArrayList();
+ ArrayList<String> aStartCommand = new ArrayList<String>();
if (isWordDocument(sDocumentSuffix))
{
aStartCommand = createWordPrintHelper();
@@ -293,7 +298,7 @@ public class MSOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("No Microsoft Office document format found.");
+ GlobalLogWriter.println("No Microsoft Office document format found.");
// TODO: use a better Exception!!!
throw new WrongSuffixException("No Mircosoft Office document format found.");
}
@@ -368,7 +373,13 @@ public class MSOfficePostscriptCreator implements IOffice
}
- ArrayList createWordPrintHelper() throws java.io.IOException
+ private String getPerlExe()
+ {
+ final String sPerlExe = System.getProperty("perl.exe", "perl");
+ return sPerlExe;
+ }
+
+ ArrayList<String> createWordPrintHelper() throws java.io.IOException
{
// create a program in tmp file
String sTmpPath = util.utils.getUsersTempDir();
@@ -376,7 +387,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sPrintViaWord = "printViaWord.pl";
- ArrayList aList = searchLocalFile(sPrintViaWord);
+ ArrayList<String> aList = searchLocalFile(sPrintViaWord);
if (aList.isEmpty() == false)
{
return aList;
@@ -465,30 +476,30 @@ public class MSOfficePostscriptCreator implements IOffice
out.write( "}" + ls);
out.close();
- aList.add("perl");
+ aList.add(getPerlExe());
aList.add(sFileName);
return aList;
}
// TODO: Maybe give a possibility to say where search the script from outside
- ArrayList searchLocalFile(String _sScriptName)
+ ArrayList<String> searchLocalFile(String _sScriptName)
{
String userdir = System.getProperty("user.dir");
- ArrayList aList = new ArrayList();
+ ArrayList<String> aList = new ArrayList<String>();
String sFileName = FileHelper.appendPath(userdir, _sScriptName);
File aPerlScript = new File(sFileName);
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("Search for local existance of " + aPerlScript.getAbsolutePath());
+ GlobalLogWriter.println("Search for local existance of " + aPerlScript.getAbsolutePath());
}
if (aPerlScript.exists())
{
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("OK, found it, use this instead the internal one.");
+ GlobalLogWriter.println("OK, found it, use this instead the internal one.");
}
String sName = aPerlScript.getAbsolutePath();
@@ -501,7 +512,7 @@ public class MSOfficePostscriptCreator implements IOffice
return aList;
}
- ArrayList createWordStoreHelper() throws java.io.IOException
+ ArrayList<String> createWordStoreHelper() throws java.io.IOException
{
// create a program in tmp file
String sTmpPath = util.utils.getUsersTempDir();
@@ -510,7 +521,7 @@ public class MSOfficePostscriptCreator implements IOffice
// ArrayList aList = new ArrayList();
String sSaveViaWord = "saveViaWord.pl";
- ArrayList aList = searchLocalFile(sSaveViaWord);
+ ArrayList<String> aList = searchLocalFile(sSaveViaWord);
if (aList.isEmpty() == false)
{
return aList;
@@ -519,7 +530,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sName = FileHelper.appendPath(sTmpPath, sSaveViaWord);
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("No local found, create a perl script: " + sName);
+ GlobalLogWriter.println("No local found, create a perl script: " + sName);
}
File aFile = new File(sName);
@@ -577,13 +588,13 @@ public class MSOfficePostscriptCreator implements IOffice
out.write( "$Word->Quit(); " + ls );
out.close();
- aList.add("perl");
+ aList.add(getPerlExe());
aList.add(sName);
return aList;
}
- ArrayList createExcelPrintHelper() throws java.io.IOException
+ ArrayList<String> createExcelPrintHelper() throws java.io.IOException
{
// create a program in tmp file
String sTmpPath = util.utils.getUsersTempDir();
@@ -591,7 +602,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sPrintViaExcel = "printViaExcel.pl";
- ArrayList aList = searchLocalFile(sPrintViaExcel);
+ ArrayList<String> aList = searchLocalFile(sPrintViaExcel);
if (aList.isEmpty() == false)
{
return aList;
@@ -599,14 +610,20 @@ public class MSOfficePostscriptCreator implements IOffice
String sName = FileHelper.appendPath(sTmpPath, sPrintViaExcel);
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("No local found, create a perl script: " + sName);
+ GlobalLogWriter.println("No local found, create a perl script: " + sName);
}
File aFile = new File(sName);
FileWriter out = new FileWriter(aFile);
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
+ // out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
+ // out.write( " if 0; " + ls );
+ out.write("#BEGIN" + ls);
+ out.write("#{" + ls);
+ out.write("#" + ls);
+ out.write("# # insert HACK" + ls);
+ out.write("# unshift(@INC, '');" + ls);
+ out.write("#}" + ls);
out.write( "use strict; " + ls );
out.write( " " + ls );
out.write( "if ( $^O ne \"MSWin32\") " + ls );
@@ -675,12 +692,12 @@ public class MSOfficePostscriptCreator implements IOffice
out.write( "}" + ls);
out.close();
- aList.add("perl");
+ aList.add(getPerlExe());
aList.add(sName);
return aList;
}
- ArrayList createExcelStoreHelper() throws java.io.IOException
+ ArrayList<String> createExcelStoreHelper() throws java.io.IOException
{
// create a program in tmp file
String sTmpPath = util.utils.getUsersTempDir();
@@ -688,7 +705,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sSaveViaExcel = "saveViaExcel.pl";
- ArrayList aList = searchLocalFile(sSaveViaExcel);
+ ArrayList<String> aList = searchLocalFile(sSaveViaExcel);
if (aList.isEmpty() == false)
{
return aList;
@@ -696,7 +713,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sName = FileHelper.appendPath(sTmpPath, sSaveViaExcel);
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("No local found, create a script: " + sName);
+ GlobalLogWriter.println("No local found, create a script: " + sName);
}
File aFile = new File(sName);
@@ -764,12 +781,12 @@ public class MSOfficePostscriptCreator implements IOffice
out.write( "$Excel->Quit(); " + ls );
out.close();
- aList.add("perl");
+ aList.add(getPerlExe());
aList.add(sName);
return aList;
}
- ArrayList createPowerPointPrintHelper() throws java.io.IOException
+ ArrayList<String> createPowerPointPrintHelper() throws java.io.IOException
{
// create a program in tmp file
String sTmpPath = util.utils.getUsersTempDir();
@@ -777,7 +794,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sPrintViaPowerPoint = "printViaPowerPoint.pl";
- ArrayList aList = searchLocalFile(sPrintViaPowerPoint);
+ ArrayList<String> aList = searchLocalFile(sPrintViaPowerPoint);
if (aList.isEmpty() == false)
{
return aList;
@@ -785,7 +802,7 @@ public class MSOfficePostscriptCreator implements IOffice
String sName = FileHelper.appendPath(sTmpPath, sPrintViaPowerPoint);
if (FileHelper.isDebugEnabled())
{
- GlobalLogWriter.get().println("No local found, create a script: " + sName);
+ GlobalLogWriter.println("No local found, create a script: " + sName);
}
File aFile = new File(sName);
@@ -865,7 +882,7 @@ public class MSOfficePostscriptCreator implements IOffice
out.write( "}" + ls);
out.close();
- aList.add("perl");
+ aList.add(getPerlExe());
aList.add(sName);
return aList;
}
@@ -879,7 +896,7 @@ public class MSOfficePostscriptCreator implements IOffice
File aFile = new File(_sFilename);
if (! aFile.exists())
{
- GlobalLogWriter.get().println("couldn't find file " + _sFilename);
+ GlobalLogWriter.println("couldn't find file " + _sFilename);
return "";
}
RandomAccessFile aReader = null;
@@ -911,7 +928,7 @@ public class MSOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("Unknown/unsupported data file: " + aLine);
+ GlobalLogWriter.println("Unknown/unsupported data file: " + aLine);
}
}
}
diff --git a/qadevOOo/runner/graphical/Office.java b/qadevOOo/runner/graphical/Office.java
index 88aeebc6b049..8ecee36cc742 100644
--- a/qadevOOo/runner/graphical/Office.java
+++ b/qadevOOo/runner/graphical/Office.java
@@ -48,6 +48,7 @@ public class Office implements IOffice
m_sResult = _sResult;
if (_aParam.getReferenceType().toLowerCase().equals("ooo") ||
+ _aParam.getReferenceType().toLowerCase().equals("ps") ||
_aParam.getReferenceType().toLowerCase().equals("pdf"))
{
m_aOffice = new OpenOfficePostscriptCreator(_aParam, m_sResult);
diff --git a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java b/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java
index a325ba5aaf0d..a0592d5ce143 100644
--- a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java
+++ b/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java
@@ -64,7 +64,7 @@ class PropertySetHelper
XPropertySet m_xPropertySet;
public PropertySetHelper(Object _aObj)
{
- m_xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aObj);
+ m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj);
}
/**
@@ -115,12 +115,12 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
try
{
XInterface xInterface = (XInterface) getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop" );
- m_xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
+ m_xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface);
}
catch (com.sun.star.uno.Exception e)
{
- GlobalLogWriter.get().println("ERROR: uno.Exception caught");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: uno.Exception caught");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
}
return m_xDesktop;
@@ -149,7 +149,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
{
if (m_xMultiServiceFactory == null)
{
- m_xMultiServiceFactory = (XMultiServiceFactory)m_aParameterHelper.getMultiServiceFactory();
+ m_xMultiServiceFactory = m_aParameterHelper.getMultiServiceFactory();
}
return m_xMultiServiceFactory;
}
@@ -192,95 +192,11 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
/**
* This is the main test Function of current ReportDesignerTest
+ * @param _sDocument
+ * @return
*/
-// public void load(String _sDocumentName)
-// {
-// // convwatch.GlobalLogWriter.set(log);
-//
-// // GlobalLogWriter.get().println("Set office watcher");
-// // OfficeWatcher aWatcher = (OfficeWatcher)m_aParameterHelper.getTestParameters().get("Watcher");
-// // GlobalLogWriter.get().setWatcher(aWatcher);
-//
-// try
-// {
-//
-// // -------------------- preconditions, try to find an office --------------------
-//
-//// String sAppExecutionCommand = (String) m_aParameterHelper.getTestParameters().get("AppExecutionCommand");
-//// GlobalLogWriter.get().println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
-////
-//// String sUser = System.getProperty("user.name");
-//// GlobalLogWriter.get().println("user.name='" + sUser + "'");
-////
-//// // String sVCSID = System.getProperty("VCSID");
-//// // GlobalLogWriter.get().println("VCSID='" + sVCSID + "'");
-//// // m_sMailAddress = sVCSID + "@openoffice.org";
-//// m_sMailAddress = System.getProperty("MailAddress");
-//// GlobalLogWriter.get().println("Assumed mail address: " + m_sMailAddress);
-////
-//// m_sParentDistinct = System.getProperty("ParentDistinct");
-////
-//// m_sSourceVersion = System.getProperty("SourceVersion");
-//// m_sSourceName = System.getProperty("SourceName");
-//// m_sDestinationVersion = System.getProperty("DestinationVersion");
-//// m_sDestinationName = System.getProperty("DestinationName");
-//// // createDBEntry();
-//// // GlobalLogWriter.get().println("Current CWS: " + m_sCWS_WORK_STAMP);
-//// // GlobalLogWriter.get().println("Current MWS: " + m_sUPDMinor);
-////
-//// if (m_sSourceVersion == null)
-//// {
-//// System.out.println("Error, Sourceversion is null.");
-//// System.exit(1);
-//// }
-////
-//// sAppExecutionCommand = sAppExecutionCommand.replaceAll( "\\$\\{USERNAME\\}", sUser);
-//// GlobalLogWriter.get().println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
-//
-// // an other way to replace strings
-// // sAppExecutionCommand = utils.replaceAll13(sAppExecutionCommand, "${USERNAME}", sUser);
-//
-// // checkIfOfficeExists(sAppExecutionCommand);
-// // param.put("AppExecutionCommand", new String(sAppExecutionCommand));
-//
-// // System.exit(1);
-//
-// // --------------------------- Start the given Office ---------------------------
-//
-// // startOffice();
-//
-// // ------------------------------ Start a test run ------------------------------
-//
-// // String sCurrentDirectory = System.getProperty("user.dir");
-// // GlobalLogWriter.get().println("Current Dir: " + sCurrentDirectory);
-//// String sDocument = (String) m_aParameterHelper.getTestParameters().get(convwatch.PropertyName.DOC_COMPARATOR_INPUT_PATH);
-//// sDocument = helper.StringHelper.removeQuoteIfExists( sDocument );
-// startTestForFile(_sDocumentName);
-// // if (sDocument.toLowerCase().indexOf("writer") >= 0)
-// // {
-// // startTestForFile(sDocument, WRITER);
-// // }
-// // else if (sDocument.toLowerCase().indexOf("calc") >= 0)
-// // {
-// // startTestForFile(sDocument, CALC);
-// // }
-// // else
-// // {
-// // assure("Can't identify the document no 'writer' nor 'calc' in it's name given.", false);
-// // }
-// }
-// catch (AssureException e)
-// {
-// // stopOffice();
-// // throw new AssureException(e.getMessage());
-// }
-//
-// // ------------------------------ Office shutdown ------------------------------
-// // stopOffice();
-// }
-// -----------------------------------------------------------------------------
- public ArrayList load(String _sDocument /*, int _nType*/)
+ public ArrayList<String> load(String _sDocument /*, int _nType*/)
{
// We need to copy the database file to a place where we have write access, NEVER use the docpool for this
String sOutputPath = m_aParameterHelper.getOutputPath();
@@ -295,9 +211,9 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
assure("There exists no file: " + sDestinationFile, FileHelper.exists(sDestinationFile));
String sFileURL = URLHelper.getFileURLFromSystemPath(sDestinationFile);
- GlobalLogWriter.get().println("File URL: " + sFileURL);
+ GlobalLogWriter.println("File URL: " + sFileURL);
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
// FYI: it is not allowed to open the document read only
// PropertyValue aReadOnly = new PropertyValue(); // always overwrite already exist files
@@ -307,7 +223,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
XComponent xDocComponent = loadComponent(sFileURL, getXDesktop(), aPropertyList);
- GlobalLogWriter.get().println("Load done");
+ GlobalLogWriter.println("Load done");
// context = createUnoService("com.sun.star.sdb.DatabaseContext")
// oDataBase = context.getByName("hh")
// oDBDoc = oDataBase.DatabaseDocument
@@ -318,35 +234,35 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
// reportContainer = oDBDoc.getReportDocuments()
// report = reportContainer.loadComponentFromURL("Report40","",0,args)
- ArrayList aList = null;
+ ArrayList<String> aList = null;
try
{
// XInterface x = (XInterface)getMultiServiceFactory().createInstance("com.sun.star.sdb.DatabaseContext");
// assure("can't create instance of com.sun.star.sdb.DatabaseContext", x != null);
-// GlobalLogWriter.get().println("createInstance com.sun.star.sdb.DatabaseContext done");
+// GlobalLogWriter.println("createInstance com.sun.star.sdb.DatabaseContext done");
// XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, x);
// showElements(xNameAccess);
// Object aObj = xNameAccess.getByName(sFileURL);
-// GlobalLogWriter.get().println("1");
+// GlobalLogWriter.println("1");
// PropertySetHelper aHelper = new PropertySetHelper(aObj);
// XDocumentDataSource xDataSource = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, aObj);
// Object aDatabaseDocument = aHelper.getPropertyValueAsObject("DatabaseDocument");
// XOfficeDatabaseDocument xOfficeDBDoc = xDataSource.getDatabaseDocument();
- XOfficeDatabaseDocument xOfficeDBDoc = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDocComponent);
+ XOfficeDatabaseDocument xOfficeDBDoc = UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDocComponent);
// XOfficeDatabaseDocument xOfficeDBDoc = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDataSource);
assure("can't access DatabaseDocument", xOfficeDBDoc != null);
-// GlobalLogWriter.get().println("2");
+// GlobalLogWriter.println("2");
- XModel xDBSource = (XModel)UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
+ XModel xDBSource = UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
Object aController = xDBSource.getCurrentController();
assure("Controller of xOfficeDatabaseDocument is empty!", aController != null);
-// GlobalLogWriter.get().println("3");
+// GlobalLogWriter.println("3");
- XDatabaseDocumentUI aDBDocUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
+ XDatabaseDocumentUI aDBDocUI = UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
aDBDocUI.connect();
boolean isConnect = aDBDocUI.isConnected();
if (isConnect)
@@ -360,19 +276,19 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
// aHelper = new PropertySetHelper(aController);
- XReportDocumentsSupplier xSupplier = (XReportDocumentsSupplier)UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
+ XReportDocumentsSupplier xSupplier = UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
XNameAccess xNameAccess = xSupplier.getReportDocuments();
assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null);
-// GlobalLogWriter.get().println("5");
+// GlobalLogWriter.println("5");
showElements(xNameAccess);
// Object aActiveConnectionObj = aHelper.getPropertyValueAsObject("ActiveConnection");
Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
assure("ActiveConnection is empty", aActiveConnectionObj != null);
-// GlobalLogWriter.get().println("5");
+// GlobalLogWriter.println("5");
- ArrayList aPropertyList2 = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList2 = new ArrayList<PropertyValue>();
PropertyValue aActiveConnection = new PropertyValue();
aActiveConnection.Name = "ActiveConnection";
@@ -384,8 +300,8 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
}
catch(Exception/*com.sun.star.uno.Exception*/ e)
{
- GlobalLogWriter.get().println("ERROR: Exception caught");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: Exception caught");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
// String mTestDocumentPath = (String) param.get("TestDocumentPath");
@@ -413,7 +329,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
String sDBConnection = (String)m_aParameterHelper.getTestParameters().get( convwatch.PropertyName.DB_CONNECTION_STRING );
if (sDBConnection != null && sDBConnection.length() > 0)
{
- GlobalLogWriter.get().println("DBConnection: " + sDBConnection);
+ GlobalLogWriter.println("DBConnection: " + sDBConnection);
// TODO: DB
// DB.init(sDBConnection);
@@ -447,9 +363,9 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
}
}
- private ArrayList loadAndStoreReports(XNameAccess _xNameAccess, ArrayList _aPropertyList /*, int _nType*/ )
+ private ArrayList<String> loadAndStoreReports(XNameAccess _xNameAccess, ArrayList<PropertyValue> _aPropertyList /*, int _nType*/ )
{
- ArrayList aList = new ArrayList();
+ ArrayList<String> aList = new ArrayList<String>();
if (_xNameAccess != null)
{
String[] sElementNames = _xNameAccess.getElementNames();
@@ -473,7 +389,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
private String getFormatExtension(Object _xComponent /* int _nType*/ )
{
String sExtension;
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
{
// calc
@@ -567,7 +483,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
- ArrayList aPropertyList = new ArrayList(); // set some properties for storeAsURL
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); // set some properties for storeAsURL
// PropertyValue aFileFormat = new PropertyValue();
// aFileFormat.Name = "FilterName";
@@ -580,19 +496,19 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
aPropertyList.add(aOverwrite);
// store the document in an other directory
- XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _xComponent);
+ XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _xComponent);
if (aStorable != null)
{
- GlobalLogWriter.get().println("store document as URL: '" + sOutputURL + "'");
+ GlobalLogWriter.println("store document as URL: '" + sOutputURL + "'");
try
{
aStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
}
catch (com.sun.star.io.IOException e)
{
- GlobalLogWriter.get().println("ERROR: Exception caught");
- GlobalLogWriter.get().println("Can't write document URL: '" + sOutputURL + "'");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: Exception caught");
+ GlobalLogWriter.println("Can't write document URL: '" + sOutputURL + "'");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
}
return sBackPathName;
@@ -601,26 +517,26 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList)
{
XComponent xDocComponent = null;
- XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );
+ XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );
try
{
PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList);
- GlobalLogWriter.get().println("Load component: '" + _sName + "'");
+ GlobalLogWriter.println("Load component: '" + _sName + "'");
xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", FrameSearchFlag.ALL, aLoadProperties);
- GlobalLogWriter.get().println("Load component: '" + _sName + "' done");
+ GlobalLogWriter.println("Load component: '" + _sName + "' done");
}
catch (com.sun.star.io.IOException e)
{
- GlobalLogWriter.get().println("ERROR: Exception caught");
- GlobalLogWriter.get().println("Can't load document '" + _sName + "'");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: Exception caught");
+ GlobalLogWriter.println("Can't load document '" + _sName + "'");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
catch (com.sun.star.lang.IllegalArgumentException e)
{
- GlobalLogWriter.get().println("ERROR: Exception caught");
- GlobalLogWriter.get().println("Illegal Arguments given to loadComponentFromURL.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: Exception caught");
+ GlobalLogWriter.println("Illegal Arguments given to loadComponentFromURL.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
return xDocComponent;
}
@@ -628,16 +544,16 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance
private void closeComponent(XComponent _xDoc)
{
// Close the document
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xDoc);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, _xDoc);
try
{
xCloseable.close(true);
}
catch (com.sun.star.util.CloseVetoException e)
{
- GlobalLogWriter.get().println("ERROR: CloseVetoException caught");
- GlobalLogWriter.get().println("CloseVetoException occured Can't close document.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("ERROR: CloseVetoException caught");
+ GlobalLogWriter.println("CloseVetoException occured Can't close document.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
}
}
diff --git a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java
index 06330a06d9ab..d918634f8d30 100644
--- a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java
+++ b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java
@@ -89,7 +89,7 @@ public class OpenOfficePostscriptCreator implements IOffice
m_aDocument = loadFromURL(m_aParameterHelper, sInputFileURL);
if (m_aDocument == null)
{
- GlobalLogWriter.get().println("loadDocumentFromURL() failed with document: " + sInputFileURL);
+ GlobalLogWriter.println("loadDocumentFromURL() failed with document: " + sInputFileURL);
throw new OfficeException("load(): failed with document" + sInputFileURL);
}
@@ -101,7 +101,8 @@ public class OpenOfficePostscriptCreator implements IOffice
if (m_aDocument != null)
{
String sDocumentName = FileHelper.appendPath(m_sOutputURL, m_sBasename);
- if (m_aParameterHelper.getReferenceType().toLowerCase().equals("ooo"))
+ if (m_aParameterHelper.getReferenceType().toLowerCase().equals("ooo") ||
+ m_aParameterHelper.getReferenceType().toLowerCase().equals("ps") )
{
String sPrintURL = sDocumentName + ".ps";
@@ -115,13 +116,13 @@ public class OpenOfficePostscriptCreator implements IOffice
storeAsPDF(m_aParameterHelper, m_aDocument, sPDFURL);
String sBasename = FileHelper.getBasename(sPDFURL);
- FileHelper.addBasenameToIndex(m_sOutputURL, sBasename, "OOo", "pdf-export", m_sDocumentName);
+ FileHelper.addBasenameToIndex(m_sOutputURL, sBasename, "pdf", "pdf-export", m_sDocumentName);
}
else
{
throw new OfficeException("unknown reference type");
}
- GlobalLogWriter.get().println("Close document.");
+ GlobalLogWriter.println("Close document.");
m_aDocument.dispose();
}
}
@@ -147,11 +148,11 @@ public class OpenOfficePostscriptCreator implements IOffice
try
{
sValue = AnyConverter.toString(_aValue.Value);
- GlobalLogWriter.get().println("Property " + sName + ":=" + sValue);
+ GlobalLogWriter.println("Property " + sName + ":=" + sValue);
}
catch (com.sun.star.lang.IllegalArgumentException e)
{
- GlobalLogWriter.get().println("showProperty: can't convert a object to string.");
+ GlobalLogWriter.println("showProperty: can't convert a object to string. " + e.getMessage());
}
}
@@ -160,7 +161,7 @@ public class OpenOfficePostscriptCreator implements IOffice
*/
private String getDocumentType( XComponent _aDoc )
{
- XModel xModel = (XModel) UnoRuntime.queryInterface( XModel.class, _aDoc);
+ XModel xModel = UnoRuntime.queryInterface( XModel.class, _aDoc);
PropertyValue[] aArgs = xModel.getArgs();
for (int i=0;i<aArgs.length;i++)
{
@@ -180,7 +181,7 @@ public class OpenOfficePostscriptCreator implements IOffice
private void showDocumentType( XComponent _aDoc )
{
String sNameValue = getDocumentType(_aDoc);
- GlobalLogWriter.get().println(" Property: '" + sNameValue);
+ GlobalLogWriter.println(" Property: '" + sNameValue);
}
/**
* load a OpenOffice.org document from a given URL (_sInputURL)
@@ -196,15 +197,15 @@ public class OpenOfficePostscriptCreator implements IOffice
{
if (_aGTA.getMultiServiceFactory() == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory in GraphicalTestArgument not set.");
+ GlobalLogWriter.println("MultiServiceFactory in GraphicalTestArgument not set.");
return null;
}
Object oDsk = _aGTA.getMultiServiceFactory().createInstance("com.sun.star.frame.Desktop");
- XDesktop aDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, oDsk);
+ XDesktop aDesktop = UnoRuntime.queryInterface(XDesktop.class, oDsk);
if (aDesktop != null)
{
- GlobalLogWriter.get().println("com.sun.star.frame.Desktop created.");
+ GlobalLogWriter.println("com.sun.star.frame.Desktop created.");
// String sInputURL = aCurrentParameter.sInputURL;
// String sOutputURL = aCurrentParameter.sOutputURL;
// String sPrintFileURL = aCurrentParameter.sPrintToFileURL;
@@ -214,7 +215,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// set here the loadComponentFromURL() properties
// at the moment only 'Hidden' is set, so no window is opened at work
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
// check which properties should set and count it.
// if (_aGTA.isHidden())
@@ -253,10 +254,10 @@ public class OpenOfficePostscriptCreator implements IOffice
aPropertyList.add(ReadOnly);
showProperty(ReadOnly);
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
- // GlobalLogWriter.get().flush();
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
+ // GlobalLogWriter.flush();
- XComponentLoader aCompLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
+ XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
// XComponent aDoc = null;
@@ -265,30 +266,31 @@ public class OpenOfficePostscriptCreator implements IOffice
_aGTA.getPerformance().stopTime(PerformanceContainer.Load);
if (aDoc != null)
{
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document done.");
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Load document done.");
showDocumentType(aDoc);
_aGTA.setDocumentType(getDocumentType(aDoc));
+// TODO: TimeHelper.waitInSeconds(20, "Wait after load document. Maybe helps due to layouting problems.");
}
else
{
- GlobalLogWriter.get().println(" Load document failed.");
+ GlobalLogWriter.println(" Load document failed.");
if (_aGTA.getImportFilterName() != null && _aGTA.getImportFilterName().length() > 0)
{
- GlobalLogWriter.get().println(" Please check FilterName := '" + _aGTA.getImportFilterName() + "'");
+ GlobalLogWriter.println(" Please check FilterName := '" + _aGTA.getImportFilterName() + "'");
}
- GlobalLogWriter.get().println("");
+ GlobalLogWriter.println("");
}
}
else
{
- GlobalLogWriter.get().println("com.sun.star.frame.Desktop failed.");
+ GlobalLogWriter.println("com.sun.star.frame.Desktop failed.");
}
}
catch ( com.sun.star.uno.Exception e )
{
// Some exception occures.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("UNO Exception caught.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
e.printStackTrace();
aDoc = null;
}
@@ -298,11 +300,11 @@ public class OpenOfficePostscriptCreator implements IOffice
private boolean exportToPDF(XComponent _xComponent, String _sDestinationName)
{
XServiceInfo xServiceInfo =
- (XServiceInfo) UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XServiceInfo.class, _xComponent
);
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
PropertyValue aFiltername = new PropertyValue();
aFiltername.Name = "FilterName";
aFiltername.Value = getFilterName_forPDF(xServiceInfo);
@@ -310,18 +312,19 @@ public class OpenOfficePostscriptCreator implements IOffice
showProperty(aFiltername);
boolean bWorked = true;
+// TODO: TimeHelper.waitInSeconds(20, "Wait before storeToURL. Maybe helps due to layouting problems.");
try
{
XStorable store =
- (XStorable) UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XStorable.class, _xComponent
);
store.storeToURL(_sDestinationName, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
}
catch (com.sun.star.io.IOException e)
{
- GlobalLogWriter.get().println("IO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("IO Exception caught.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
bWorked = false;
}
@@ -383,13 +386,13 @@ public class OpenOfficePostscriptCreator implements IOffice
//
// if (aDoc == null)
// {
-// GlobalLogWriter.get().println("Can't load document.");
+// GlobalLogWriter.println("Can't load document.");
// return bBack;
// }
// bBack = storeAsPDF(_aGTA, aDoc, _sOutputURL);
// FileHelper.createInfoFile(_sOutputURL, _aGTA, "as pdf");
//
-// GlobalLogWriter.get().println("Close document.");
+// GlobalLogWriter.println("Close document.");
// aDoc.dispose();
// return bBack;
// }
@@ -406,7 +409,7 @@ public class OpenOfficePostscriptCreator implements IOffice
if (!bBack)
{
- GlobalLogWriter.get().println("Can't store document as PDF.");
+ GlobalLogWriter.println("Can't store document as PDF.");
// bBack = false;
throw new OfficeException("Can't store document as PDF");
}
@@ -444,17 +447,17 @@ public class OpenOfficePostscriptCreator implements IOffice
// {
// // don't store document
// // input and output are equal OR
-// GlobalLogWriter.get().println("Warning: Inputpath and Outputpath are equal. Document will not stored again.");
+// GlobalLogWriter.println("Warning: Inputpath and Outputpath are equal. Document will not stored again.");
// disallowStore();
// }
// bBack = impl_printToFileWithOOo(_aGTA, aDoc, _sOutputURL, _sPrintFileURL);
//
-// GlobalLogWriter.get().println("Close document.");
+// GlobalLogWriter.println("Close document.");
// aDoc.dispose();
// }
// else
// {
-// GlobalLogWriter.get().println("loadDocumentFromURL() failed with document: " + _sInputURL);
+// GlobalLogWriter.println("loadDocumentFromURL() failed with document: " + _sInputURL);
// }
// return bBack;
// }
@@ -471,7 +474,7 @@ public class OpenOfficePostscriptCreator implements IOffice
boolean bFailed = true; // always be a pessimist,
if (_aDoc == null)
{
- GlobalLogWriter.get().println("No document is given.");
+ GlobalLogWriter.println("No document is given.");
return bBack;
}
@@ -482,27 +485,27 @@ public class OpenOfficePostscriptCreator implements IOffice
if (isStoreAllowed())
{
// store the document in an other directory
- XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _aDoc);
+ XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _aDoc);
if (aStorable != null)
{
PropertyValue [] szEmptyArgs = new PropertyValue [0];
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Store document.");
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Store document.");
_aGTA.getPerformance().startTime(PerformanceContainer.Store);
aStorable.storeAsURL(_sOutputURL, szEmptyArgs);
_aGTA.getPerformance().stopTime(PerformanceContainer.Store);
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Store document done.");
- TimeHelper.waitInSeconds(1, "After store as URL to:" + _sOutputURL);
- GlobalLogWriter.get().println("Reload stored file test.");
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Store document done.");
+ // TimeHelper.waitInSeconds(1, "After store as URL to:" + _sOutputURL);
+ GlobalLogWriter.println("Reload stored file test.");
XComponent aDoc = loadFromURL(_aGTA, _sOutputURL);
if (aDoc == null)
{
- GlobalLogWriter.get().println("Reload stored file test failed, can't reload file: " + _sOutputURL);
+ GlobalLogWriter.println("Reload stored file test failed, can't reload file: " + _sOutputURL);
}
else
{
- XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, aDoc);
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, aDoc);
if (xClose != null)
{
xClose.close(true);
@@ -511,7 +514,7 @@ public class OpenOfficePostscriptCreator implements IOffice
{
aDoc.dispose();
}
- TimeHelper.waitInSeconds(1, "after close temp document");
+ // TimeHelper.waitInSeconds(1, "after close temp document");
}
}
}
@@ -528,8 +531,8 @@ public class OpenOfficePostscriptCreator implements IOffice
catch ( com.sun.star.uno.Exception e )
{
// Some exception occures.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("UNO Exception caught.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
e.printStackTrace();
bBack = false;
@@ -541,8 +544,8 @@ public class OpenOfficePostscriptCreator implements IOffice
// System.out.println("Document loaded.");
// Change Pagesettings to DIN A4
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Print document.");
- XPrintable aPrintable = (XPrintable) UnoRuntime.queryInterface( XPrintable.class, _aDoc);
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Print document.");
+ XPrintable aPrintable = UnoRuntime.queryInterface( XPrintable.class, _aDoc);
if (aPrintable != null)
{
// System.out.println(" Set PaperFormat to DIN A4");
@@ -566,14 +569,14 @@ public class OpenOfficePostscriptCreator implements IOffice
{
if (_aGTA.getPrinterName() != null)
{
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
// PropertyValue [] aPrintProps = new PropertyValue[1];
PropertyValue Arg = new PropertyValue();
Arg.Name = "Name";
Arg.Value = _aGTA.getPrinterName();
aPropertyList.add(Arg);
showProperty(Arg);
- // GlobalLogWriter.get().println("Printername is not null, so set to " + _aGTA.getPrinterName());
+ // GlobalLogWriter.println("Printername is not null, so set to " + _aGTA.getPrinterName());
aPrintable.setPrinter(PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
}
}
@@ -590,21 +593,21 @@ public class OpenOfficePostscriptCreator implements IOffice
// int nPropsCount = 0;
// If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
{
XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
Object aSettings = xMSF.createInstance( "com.sun.star.sheet.GlobalSheetSettings" );
if (aSettings != null)
{
- XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aSettings );
+ XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, aSettings );
xPropSet.setPropertyValue( "PrintAllSheets", new Boolean( true ) );
- GlobalLogWriter.get().println("PrintAllSheets := true");
+ GlobalLogWriter.println("PrintAllSheets := true");
}
}
- ArrayList aPrintProps = new ArrayList();
- // GlobalLogWriter.get().println("Property FileName:=" + _sPrintFileURL);
+ ArrayList<PropertyValue> aPrintProps = new ArrayList<PropertyValue>();
+ // GlobalLogWriter.println("Property FileName:=" + _sPrintFileURL);
// PropertyValue [] aPrintProps = new PropertyValue[nProperties];
PropertyValue Arg = new PropertyValue();
@@ -639,13 +642,13 @@ public class OpenOfficePostscriptCreator implements IOffice
showProperty(Arg);
}
- // GlobalLogWriter.get().println("Start printing.");
+ // GlobalLogWriter.println("Start printing.");
_aGTA.getPerformance().startTime(PerformanceContainer.Print);
aPrintable.print(PropertyHelper.createPropertyValueArrayFormArrayList(aPrintProps));
TimeHelper.waitInSeconds(1, "Start waiting for print ready.");
- GlobalLogWriter.get().println("Wait until document is printed.");
+ GlobalLogWriter.println("Wait until document is printed.");
boolean isBusy = true;
int nPrintCount = 0;
while (isBusy)
@@ -663,21 +666,22 @@ public class OpenOfficePostscriptCreator implements IOffice
if (nPrintCount > 3600)
{
// we will never wait >1h until print is ready!
- GlobalLogWriter.get().println("ERROR: Cancel print due to too long wait.");
+ GlobalLogWriter.println("ERROR: Cancel print due to too long wait.");
throw new com.sun.star.uno.Exception("Convwatch exception, wait too long for printing.");
}
}
- // TimeHelper.waitInSeconds(40, "Start waiting after print ready.");
+// TODO:
+// TimeHelper.waitInSeconds(40, "Start waiting after print ready.");
_aGTA.getPerformance().stopTime(PerformanceContainer.Print);
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Print document done.");
+ GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Print document done.");
// Create a .info file near the printed '.ps' or '.prn' file.
FileHelper.createInfoFile(_sPrintFileURL, _aGTA);
}
else
{
- GlobalLogWriter.get().println("Can't get XPrintable interface.");
+ GlobalLogWriter.println("Can't get XPrintable interface.");
}
bFailed = false;
bBack = true;
@@ -685,8 +689,8 @@ public class OpenOfficePostscriptCreator implements IOffice
catch ( com.sun.star.uno.Exception e )
{
// Some exception occures.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
+ GlobalLogWriter.println("UNO Exception caught.");
+ GlobalLogWriter.println("Message: " + e.getMessage());
e.printStackTrace();
bBack = false;
@@ -694,17 +698,20 @@ public class OpenOfficePostscriptCreator implements IOffice
if (bFailed == true)
{
- GlobalLogWriter.get().println("convwatch.OfficePrint: FAILED");
+ GlobalLogWriter.println("convwatch.OfficePrint: FAILED");
}
else
{
- GlobalLogWriter.get().println("convwatch.OfficePrint: OK");
+ GlobalLogWriter.println("convwatch.OfficePrint: OK");
}
return bBack;
}
/**
+ * @param _aGTA
+ * @param _sAbsoluteOutputPath
+ * @param _sAbsoluteInputFile
* @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.
*/
@@ -744,7 +751,7 @@ public class OpenOfficePostscriptCreator implements IOffice
String sAbsolutePrintFilename = FileHelper.appendPath(sOutputPath, sPrintFilename + ".prn");
if (FileHelper.exists(sAbsolutePrintFilename) && _aGTA.getOverwrite() == false)
{
- GlobalLogWriter.get().println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
+ GlobalLogWriter.println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
return true;
}
return false;
@@ -797,7 +804,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// String sAbsolutePrintFilename = sOutputPath + fs + sPrintFilename + ".prn";
// if (FileHelper.exists(sAbsolutePrintFilename) && _aGTA.getOverwrite() == false)
// {
-// GlobalLogWriter.get().println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
+// GlobalLogWriter.println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
// return true;
// }
//
@@ -816,7 +823,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// }
// else
// {
-// GlobalLogWriter.get().println("OfficePrint.buildreference(): Unknown print type.");
+// GlobalLogWriter.println("OfficePrint.buildreference(): Unknown print type.");
// return false;
// }
// return printToFile(_aGTA, sInputFileURL, sOutputFileURL, sPrintFileURL);
@@ -845,14 +852,14 @@ public class OpenOfficePostscriptCreator implements IOffice
// }
// else if (_aGTA.getReferenceType().toLowerCase().equals("pdf"))
// {
-// GlobalLogWriter.get().println("USE PDF AS EXPORT FORMAT.");
+// GlobalLogWriter.println("USE PDF AS EXPORT FORMAT.");
// bBack = storeAsPDF(_aGTA, _sInputFileURL, _sPrintFileURL);
// }
// else if (_aGTA.getReferenceType().toLowerCase().equals("msoffice"))
// {
// if (MSOfficePostscriptCreator.isMSOfficeDocumentFormat(_sInputFileURL))
// {
-// GlobalLogWriter.get().println("USE MSOFFICE AS EXPORT FORMAT.");
+// GlobalLogWriter.println("USE MSOFFICE AS EXPORT FORMAT.");
// MSOfficePostscriptCreator a = new MSOfficePostscriptCreator();
// try
// {
@@ -862,19 +869,19 @@ public class OpenOfficePostscriptCreator implements IOffice
// catch(OfficeException e)
// {
// e.printStackTrace();
-// GlobalLogWriter.get().println(e.getMessage());
+// GlobalLogWriter.println(e.getMessage());
// throw new OfficeException("Exception caught. Problem with MSOffice printer methods.");
// }
// catch(java.io.IOException e)
// {
-// GlobalLogWriter.get().println(e.getMessage());
+// GlobalLogWriter.println(e.getMessage());
// throw new OfficeException("IOException caught. Problem with MSOffice printer methods.");
// }
// bBack = true;
// }
// else
// {
-// GlobalLogWriter.get().println("This document type is not recognized as MSOffice format, as default fallback StarOffice/OpenOffice.org instead is used.");
+// GlobalLogWriter.println("This document type is not recognized as MSOffice format, as default fallback StarOffice/OpenOffice.org instead is used.");
// bBack = printToFileWithOOo(_aGTA, _sInputFileURL, _sOutputFileURL, _sPrintFileURL);
// }
// }
@@ -898,24 +905,24 @@ public class OpenOfficePostscriptCreator implements IOffice
if (_xMSF == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
+ GlobalLogWriter.println("MultiServiceFactory not set.");
return;
}
XTypeDetection aTypeDetection = null;
try
{
Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection");
- aTypeDetection = (XTypeDetection)UnoRuntime.queryInterface(XTypeDetection.class, oObj);
+ aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj);
}
catch(com.sun.star.uno.Exception e)
{
- GlobalLogWriter.get().println("Can't get com.sun.star.document.TypeDetection.");
+ GlobalLogWriter.println("Can't get com.sun.star.document.TypeDetection.");
return;
}
if (aTypeDetection != null)
{
String sType = aTypeDetection.queryTypeByURL(_sInputURL);
- GlobalLogWriter.get().println("Type is: " + sType);
+ GlobalLogWriter.println("Type is: " + sType);
}
}
@@ -931,7 +938,7 @@ public class OpenOfficePostscriptCreator implements IOffice
if (_xMSF == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
+ GlobalLogWriter.println("MultiServiceFactory not set.");
return null;
}
// XFilterFactory aFilterFactory = null;
@@ -942,12 +949,12 @@ public class OpenOfficePostscriptCreator implements IOffice
}
catch(com.sun.star.uno.Exception e)
{
- GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
+ GlobalLogWriter.println("Can't get com.sun.star.document.FilterFactory.");
return null;
}
if (aObj != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
if (aNameAccess != null)
{
@@ -965,7 +972,7 @@ public class OpenOfficePostscriptCreator implements IOffice
if (! aNameAccess.hasByName(_sFilterName))
{
- GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
+ GlobalLogWriter.println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
return null;
}
@@ -993,17 +1000,17 @@ public class OpenOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sFilterName + "'");
+ GlobalLogWriter.println("There are no elements for FilterName '" + _sFilterName + "'");
return null;
}
}
catch (com.sun.star.container.NoSuchElementException e)
{
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
+ GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage());
}
catch (com.sun.star.lang.WrappedTargetException e)
{
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
+ GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage());
}
}
}
@@ -1022,7 +1029,7 @@ public class OpenOfficePostscriptCreator implements IOffice
if (_xMSF == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
+ GlobalLogWriter.println("MultiServiceFactory not set.");
return null;
}
// XFilterFactory aFilterFactory = null;
@@ -1033,17 +1040,17 @@ public class OpenOfficePostscriptCreator implements IOffice
}
catch(com.sun.star.uno.Exception e)
{
- GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
+ GlobalLogWriter.println("Can't get com.sun.star.document.FilterFactory.");
return null;
}
if (aObj != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
if (aNameAccess != null)
{
if (! aNameAccess.hasByName(_sFilterName))
{
- GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
+ GlobalLogWriter.println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
return null;
}
@@ -1071,17 +1078,17 @@ public class OpenOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sFilterName + "'");
+ GlobalLogWriter.println("There are no elements for FilterName '" + _sFilterName + "'");
return null;
}
}
catch (com.sun.star.container.NoSuchElementException e)
{
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
+ GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage());
}
catch (com.sun.star.lang.WrappedTargetException e)
{
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
+ GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage());
}
}
}
@@ -1099,23 +1106,23 @@ public class OpenOfficePostscriptCreator implements IOffice
if (_xMSF == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
+ GlobalLogWriter.println("MultiServiceFactory not set.");
return null;
}
XTypeDetection aTypeDetection = null;
try
{
Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection");
- aTypeDetection = (XTypeDetection)UnoRuntime.queryInterface(XTypeDetection.class, oObj);
+ aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj);
}
catch(com.sun.star.uno.Exception e)
{
- GlobalLogWriter.get().println("Can't get com.sun.star.document.TypeDetection.");
+ GlobalLogWriter.println("Can't get com.sun.star.document.TypeDetection.");
return null;
}
if (aTypeDetection != null)
{
- XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection);
+ XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection);
if (aNameAccess != null)
{
@@ -1128,7 +1135,7 @@ public class OpenOfficePostscriptCreator implements IOffice
if (! aNameAccess.hasByName(_sInternalFilterName))
{
- GlobalLogWriter.get().println("TypeDetection.hasByName() says there exist no '" + _sInternalFilterName + "'" );
+ GlobalLogWriter.println("TypeDetection.hasByName() says there exist no '" + _sInternalFilterName + "'" );
return null;
}
@@ -1148,15 +1155,15 @@ public class OpenOfficePostscriptCreator implements IOffice
if (aPropertyValue.Name.equals("Extensions"))
{
aExtensions = (String[])aPropertyValue.Value;
- GlobalLogWriter.get().println(" Possible extensions are: " + String.valueOf(aExtensions.length));
+ GlobalLogWriter.println(" Possible extensions are: " + String.valueOf(aExtensions.length));
if (aExtensions.length > 0)
{
for (int j=0;j<aExtensions.length;j++)
{
- GlobalLogWriter.get().println(" " + aExtensions[j]);
+ GlobalLogWriter.println(" " + aExtensions[j]);
}
sExtension = aExtensions[0];
- GlobalLogWriter.get().println("");
+ GlobalLogWriter.println("");
}
}
}
@@ -1164,17 +1171,17 @@ public class OpenOfficePostscriptCreator implements IOffice
}
else
{
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sInternalFilterName + "'");
+ GlobalLogWriter.println("There are no elements for FilterName '" + _sInternalFilterName + "'");
return null;
}
}
catch (com.sun.star.container.NoSuchElementException e)
{
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
+ GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage());
}
catch (com.sun.star.lang.WrappedTargetException e)
{
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
+ GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage());
}
}
}
@@ -1187,7 +1194,7 @@ public class OpenOfficePostscriptCreator implements IOffice
XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
if (xMSF == null)
{
- GlobalLogWriter.get().println("MultiServiceFactory in GraphicalTestArgument not set.");
+ GlobalLogWriter.println("MultiServiceFactory in GraphicalTestArgument not set.");
return;
}
@@ -1196,33 +1203,33 @@ public class OpenOfficePostscriptCreator implements IOffice
XComponent aDoc = loadFromURL( _aGTA, sInputURL);
if (aDoc == null)
{
- GlobalLogWriter.get().println("Can't load document '"+ sInputURL + "'");
+ GlobalLogWriter.println("Can't load document '"+ sInputURL + "'");
return;
}
if (_sOutputPath == null)
{
- GlobalLogWriter.get().println("Outputpath not set.");
+ GlobalLogWriter.println("Outputpath not set.");
return;
}
if (! isStoreAllowed())
{
- GlobalLogWriter.get().println("It's not allowed to store, check Input/Output path.");
+ GlobalLogWriter.println("It's not allowed to store, check Input/Output path.");
return;
}
// TODO: Do we need to wait?
// TimeHelper.waitInSeconds(1, "wait after loadFromURL.");
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
// String sFilter = getFilterName_forExcel(xServiceInfo);
// System.out.println("Filter is " + sFilter);
// store the document in an other directory
- XStorable xStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, aDoc);
+ XStorable xStorable = UnoRuntime.queryInterface( XStorable.class, aDoc);
if (xStorable == null)
{
- GlobalLogWriter.get().println("com.sun.star.frame.XStorable is null");
+ GlobalLogWriter.println("com.sun.star.frame.XStorable is null");
return;
}
@@ -1238,7 +1245,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// initialize PropertyArray
// PropertyValue [] aStoreProps = new PropertyValue[ nPropertyCount ];
// int nPropertyIndex = 0;
- ArrayList aPropertyList = new ArrayList();
+ ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
String sExtension = "";
@@ -1247,22 +1254,22 @@ public class OpenOfficePostscriptCreator implements IOffice
String sInternalFilterName = getInternalFilterName(sFilterName, xMSF);
String sServiceName = getServiceNameFromFilterName(sFilterName, xMSF);
- GlobalLogWriter.get().println("Filter detection:");
+ 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.get().println("Given FilterName '" + sFilterName + "' seems to be unknown.");
+ GlobalLogWriter.println("Given FilterName '" + sFilterName + "' seems to be unknown.");
bServiceFailed = true;
}
if (! xServiceInfo.supportsService(sServiceName))
{
- GlobalLogWriter.get().println("Service from FilterName '" + sServiceName + "' is not supported by loaded document.");
+ GlobalLogWriter.println("Service from FilterName '" + sServiceName + "' is not supported by loaded document.");
bServiceFailed = true;
}
if (bServiceFailed == true)
{
- GlobalLogWriter.get().println("Please check '" + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + "' in the property file.");
+ GlobalLogWriter.println("Please check '" + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + "' in the property file.");
return;
}
@@ -1273,7 +1280,7 @@ public class OpenOfficePostscriptCreator implements IOffice
sExtension = getFileExtension(sInternalFilterName, xMSF);
if (sExtension == null)
{
- GlobalLogWriter.get().println("Can't found an extension for filtername, take it from the source.");
+ GlobalLogWriter.println("Can't found an extension for filtername, take it from the source.");
}
}
@@ -1283,7 +1290,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// aStoreProps[nPropertyIndex ++] = Arg;
aPropertyList.add(Arg);
showProperty(Arg);
- GlobalLogWriter.get().println("FilterName is set to: " + sFilterName);
+ GlobalLogWriter.println("FilterName is set to: " + sFilterName);
}
String sOutputURL = "";
@@ -1311,38 +1318,41 @@ public class OpenOfficePostscriptCreator implements IOffice
if (FileHelper.exists(sOutputFile) && _aGTA.getOverwrite() == false)
{
- GlobalLogWriter.get().println("File already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
+ GlobalLogWriter.println("File already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
return;
}
sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputFile);
- GlobalLogWriter.get().println("Store document as '" + sOutputURL + "'");
+ GlobalLogWriter.println("Store document as '" + sOutputURL + "'");
xStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- GlobalLogWriter.get().println("Document stored.");
+ GlobalLogWriter.println("Document stored.");
}
catch (com.sun.star.io.IOException e)
{
- GlobalLogWriter.get().println("Can't store document '" + sOutputURL + "'. Message is :'" + e.getMessage() + "'");
+ GlobalLogWriter.println("Can't store document '" + sOutputURL + "'. Message is :'" + e.getMessage() + "'");
}
// TODO: Do we need to wait?
// TimeHelper.waitInSeconds(1, "unknown in OfficePrint.convertDocument()");
}
-
- private boolean shouldOfficeStart()
- {
- String sNoOffice = (String)m_aParameterHelper.getTestParameters().get( "NoOffice" );
- if (sNoOffice != null)
- {
- if (sNoOffice.toLowerCase().startsWith("t") || sNoOffice.toLowerCase().startsWith("y"))
- {
- return false;
- }
- }
- return true;
- }
+ /**
+ *
+ * @return false, if 'NoOffice=yes' is given
+ */
+// private boolean shouldOfficeStart()
+// {
+// String sNoOffice = (String)m_aParameterHelper.getTestParameters().get( "NoOffice" );
+// if (sNoOffice != null)
+// {
+// if (sNoOffice.toLowerCase().startsWith("t") || sNoOffice.toLowerCase().startsWith("y"))
+// {
+// return false;
+// }
+// }
+// return true;
+// }
OfficeProvider m_aProvider = null;
private void startOffice()
@@ -1370,7 +1380,7 @@ public class OpenOfficePostscriptCreator implements IOffice
// Watcher Object is need in log object to give a simple way to say if a running office is alive.
// As long as a log comes, it pings the Watcher and says the office is alive, if not an
// internal counter increase and at a given point (300 seconds) the office is killed.
- GlobalLogWriter.get().println("Set office watcher");
+ GlobalLogWriter.println("Set office watcher");
if (GlobalLogWriter.get().getWatcher() == null)
{
OfficeWatcher aWatcher = (OfficeWatcher)m_aParameterHelper.getTestParameters().get("Watcher");
@@ -1383,7 +1393,11 @@ public class OpenOfficePostscriptCreator implements IOffice
// Office shutdown
if (m_aProvider != null)
{
- m_aProvider.closeExistingOffice(m_aParameterHelper.getTestParameters(), true);
+ String sAppExecCmd = (String)m_aParameterHelper.getTestParameters().get("AppExecutionCommand");
+ if (sAppExecCmd != null && sAppExecCmd.length() > 0)
+ {
+ m_aProvider.closeExistingOffice(m_aParameterHelper.getTestParameters(), true);
+ }
// if (OSHelper.isWindows())
// {
// aSemaphore.V(aSemaphore.getSemaphoreFile());
diff --git a/qadevOOo/runner/graphical/ParameterHelper.java b/qadevOOo/runner/graphical/ParameterHelper.java
index e3545a56e73b..598ee6c53007 100644
--- a/qadevOOo/runner/graphical/ParameterHelper.java
+++ b/qadevOOo/runner/graphical/ParameterHelper.java
@@ -193,7 +193,7 @@ public class ParameterHelper
String sReferenceType = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_REFERENCE_TYPE );
if (sReferenceType == null || sReferenceType.length() == 0)
{
- m_sReferenceType = "OOo";
+ m_sReferenceType = "ps";
}
else
{
@@ -241,6 +241,7 @@ public class ParameterHelper
/**
* Helper function to get the buildid of the current used OpenOffice.org
* out of the AppExecutionCommand the build ID
+ * @return
*/
public String getBuildID()
{
@@ -265,11 +266,12 @@ public class ParameterHelper
// check if MultiServiceFactory is given
if (getReferenceType().toLowerCase().equals("pdf") ||
+ getReferenceType().toLowerCase().equals("ps") ||
getReferenceType().toLowerCase().equals("ooo"))
{
if (xMSF == null)
{
- GlobalLogWriter.get().println("ERROR! MultiServiceFactory not given.");
+ GlobalLogWriter.println("ERROR! MultiServiceFactory not given.");
}
}
return xMSF;
@@ -417,5 +419,15 @@ public class ParameterHelper
return m_sHTMLPrefix;
}
+ public boolean createSmallPictures()
+ {
+ // boolean bCreateSmallPictures = true;
+ boolean bNoSmallPictures = m_aCurrentParams.getBool( PropertyName.NO_SMALL_PICTURES);
+ if (bNoSmallPictures == true)
+ {
+ return false;
+ }
+ return true;
+ }
}
diff --git a/qadevOOo/runner/graphical/PerformanceContainer.java b/qadevOOo/runner/graphical/PerformanceContainer.java
index c31d1efb79db..ab3b292926e5 100644
--- a/qadevOOo/runner/graphical/PerformanceContainer.java
+++ b/qadevOOo/runner/graphical/PerformanceContainer.java
@@ -59,7 +59,7 @@ public class PerformanceContainer /* extends *//* implements */ {
{
if (_nCurrentTimer == 0)
{
- GlobalLogWriter.get().println("Forgotten to initialise a start timer.");
+ GlobalLogWriter.println("Forgotten to initialise a start timer.");
return 0;
}
long nMeanTime = System.currentTimeMillis();
@@ -160,7 +160,7 @@ public class PerformanceContainer /* extends *//* implements */ {
}
catch (NumberFormatException e)
{
- GlobalLogWriter.get().println("Can't convert string to double " + _sStr);
+ GlobalLogWriter.println("Can't convert string to double " + _sStr);
}
return nValue;
}
@@ -185,7 +185,7 @@ public class PerformanceContainer /* extends *//* implements */ {
File aFile = new File(sFilename);
if (! aFile.exists())
{
- GlobalLogWriter.get().println("couldn't find file " + sFilename);
+ GlobalLogWriter.println("couldn't find file " + sFilename);
return;
}
@@ -236,13 +236,13 @@ public class PerformanceContainer /* extends *//* implements */ {
}
catch (java.io.FileNotFoundException fne)
{
- GlobalLogWriter.get().println("couldn't open file " + sFilename);
- GlobalLogWriter.get().println("Message: " + fne.getMessage());
+ GlobalLogWriter.println("couldn't open file " + sFilename);
+ GlobalLogWriter.println("Message: " + fne.getMessage());
}
catch (java.io.IOException ie)
{
- GlobalLogWriter.get().println("Exception while reading file " + sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
+ GlobalLogWriter.println("Exception while reading file " + sFilename);
+ GlobalLogWriter.println("Message: " + ie.getMessage());
}
try
{
@@ -250,8 +250,8 @@ public class PerformanceContainer /* extends *//* implements */ {
}
catch (java.io.IOException ie)
{
- GlobalLogWriter.get().println("Couldn't close file " + sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
+ GlobalLogWriter.println("Couldn't close file " + sFilename);
+ GlobalLogWriter.println("Message: " + ie.getMessage());
}
}
diff --git a/qadevOOo/runner/graphical/PropertyName.java b/qadevOOo/runner/graphical/PropertyName.java
index 8ca2835e8086..729fd0c33c38 100644
--- a/qadevOOo/runner/graphical/PropertyName.java
+++ b/qadevOOo/runner/graphical/PropertyName.java
@@ -69,5 +69,5 @@ public interface PropertyName
// final public static String DB_CONNECTION_STRING = "DB_CONNECTION_STRING";
// final public static String CHECK_NEED_TOOLS = "CHECK_NEED_TOOLS";
// final public static String CREATE_DEFAULT = "CREATE_DEFAULT_REFERENCE";
-
+ final public static String NO_SMALL_PICTURES = "NoSmallPictures";
}
diff --git a/qadevOOo/runner/graphical/TimeHelper.java b/qadevOOo/runner/graphical/TimeHelper.java
index d0180d82e423..057f9cd19494 100644
--- a/qadevOOo/runner/graphical/TimeHelper.java
+++ b/qadevOOo/runner/graphical/TimeHelper.java
@@ -29,6 +29,8 @@
package graphical;
+import java.util.Calendar;
+
/**
*
* @author ll93751
@@ -42,9 +44,48 @@ public class TimeHelper
*/
static void waitInSeconds(int _nSeconds, String _sReason)
{
- GlobalLogWriter.get().println("Wait " + String.valueOf(_nSeconds) + " sec. Reason: " + _sReason);
+ GlobalLogWriter.println("Wait 0.25 * " + String.valueOf(_nSeconds) + " sec. Reason: " + _sReason);
try {
- java.lang.Thread.sleep(_nSeconds * 1000);
+ java.lang.Thread.sleep(_nSeconds * 250);
} catch (java.lang.InterruptedException e2) {}
}
+
+ private int m_nSeconds;
+ private int m_nMilliSeconds;
+ private long m_nRealMilliSeconds;
+
+ private boolean m_bIsStopped = false;
+
+ public TimeHelper()
+ {}
+
+ public void start()
+ {
+ m_bIsStopped = false;
+ Calendar cal = Calendar.getInstance();
+ m_nSeconds = cal.get(Calendar.SECOND);
+ m_nMilliSeconds = cal.get(Calendar.MILLISECOND);
+ }
+ public void stop()
+ {
+ Calendar cal = Calendar.getInstance();
+ m_bIsStopped = true;
+ int nSeconds = cal.get(Calendar.SECOND);
+ m_nSeconds = nSeconds - m_nSeconds;
+ if (m_nSeconds < 0)
+ {
+ // add a minute
+ m_nSeconds += 60;
+ }
+
+ int nMilliSeconds = cal.get(Calendar.MILLISECOND);
+ m_nMilliSeconds = nMilliSeconds - m_nMilliSeconds;
+ m_nRealMilliSeconds = m_nSeconds * 1000 + m_nMilliSeconds;
+ }
+
+ public String getTime()
+ {
+ return String.valueOf(m_nRealMilliSeconds);
+ }
+
}
diff --git a/qadevOOo/runner/graphical/Tolerance.java b/qadevOOo/runner/graphical/Tolerance.java
new file mode 100644
index 000000000000..90e853c9124c
--- /dev/null
+++ b/qadevOOo/runner/graphical/Tolerance.java
@@ -0,0 +1,23 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package graphical;
+
+/**
+ *
+ * @author ll93751
+ */
+public class Tolerance
+{
+ private int m_nTolerance;
+ public Tolerance(int _nAccept)
+ {
+ m_nTolerance = _nAccept;
+ }
+ public int getAccept()
+ {
+ return m_nTolerance;
+ }
+}
diff --git a/qadevOOo/runner/graphical/makefile.mk b/qadevOOo/runner/graphical/makefile.mk
index db1f84ca26ca..4e1b0e98cba1 100644
--- a/qadevOOo/runner/graphical/makefile.mk
+++ b/qadevOOo/runner/graphical/makefile.mk
@@ -64,7 +64,8 @@ PostscriptCreator.java \
PropertyName.java \
TimeHelper.java \
WrongEnvironmentException.java \
-WrongSuffixException.java
+WrongSuffixException.java \
+Tolerance.java
# GraphicalComparator.java
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index adeecbdeba1d..8589de47ea82 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -130,9 +130,7 @@ public class OfficeProvider implements AppProvider
try
{
- desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
- msf.createInstance(
- "com.sun.star.frame.Desktop"));
+ desk = UnoRuntime.queryInterface(XDesktop.class, msf.createInstance("com.sun.star.frame.Desktop"));
}
catch (com.sun.star.uno.Exception ue)
{
@@ -341,18 +339,15 @@ public class OfficeProvider implements AppProvider
{
// Get component context
- final XComponentContext xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(
- null);
+ final XComponentContext xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
// initial serviceManager
final XMultiComponentFactory xLocalServiceManager = xcomponentcontext.getServiceManager();
// create a connector, so that it can contact the office
// XUnoUrlResolver urlResolver = UnoUrlResolver.create(xcomponentcontext);
- final Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
- final XUnoUrlResolver urlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(
- XUnoUrlResolver.class, xUrlResolver);
+ final Object xUrlResolver = xLocalServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
+ final XUnoUrlResolver urlResolver = UnoRuntime.queryInterface(XUnoUrlResolver.class, xUrlResolver);
final Object rInitialObject = urlResolver.resolve(connectStr);
@@ -363,8 +358,7 @@ public class OfficeProvider implements AppProvider
debug = true;
dbg("resolved url");
- xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(
- XMultiServiceFactory.class, rInitialObject);
+ xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, rInitialObject);
}
return xMSF;
@@ -485,7 +479,7 @@ public class OfficeProvider implements AppProvider
try
{
Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
- XFastPropertySet fps = (XFastPropertySet) UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
+ XFastPropertySet fps = UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
fps.setFastPropertyValue(0, false);
}
catch (com.sun.star.uno.Exception ex)
@@ -495,9 +489,7 @@ public class OfficeProvider implements AppProvider
try
{
- desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
- msf.createInstance(
- "com.sun.star.frame.Desktop"));
+ desk = UnoRuntime.queryInterface(XDesktop.class, msf.createInstance("com.sun.star.frame.Desktop"));
msf = null;
if (desk != null)
@@ -616,9 +608,7 @@ public class OfficeProvider implements AppProvider
{
while (compEnum.hasMoreElements())
{
- final XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
- XCloseable.class,
- compEnum.nextElement());
+ final XCloseable closer = UnoRuntime.queryInterface(XCloseable.class, compEnum.nextElement());
if (closer != null)
{
@@ -658,8 +648,7 @@ public class OfficeProvider implements AppProvider
if (xPathSubst != null)
{
- return (XStringSubstitution) UnoRuntime.queryInterface(
- XStringSubstitution.class, xPathSubst);
+ return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
}
else
{
@@ -790,6 +779,7 @@ public class OfficeProvider implements AppProvider
this.ow = ow;
}
+ @Override
public void run()
{
System.out.println(utils.getDateTime() + "OfficeProvider:Owp: start ");
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index 63486ca9d3f3..a3741774917e 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -182,8 +182,9 @@ public class Runner
}
}
- public static boolean run(String... args) {
- System.out.println("OOoRunner Main() version from 20100125 (yyyymmdd)");
+ public static boolean run(String... args)
+ {
+ System.out.println("OOoRunner Main() version from 20100323 (yyyymmdd)");
setStartTime(getTime());
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 1091824480a6..3f882f10fafb 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -45,6 +45,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.Property;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.ucb.InteractiveAugmentedIOException;
import com.sun.star.ucb.XSimpleFileAccess;
import com.sun.star.lang.XServiceInfo;
@@ -542,16 +543,10 @@ public class utils {
return res;
}
- /**
- * Copies file to a new location using OpenOffice.org features. If the target
- * file already exists, the file is deleted.
- *
- * @returns <code>true</code> if the file was successfully copied,
- * <code>false</code> if some errors occured (e.g. file is locked, used
- * by another process).
- */
- public static boolean overwriteFile(XMultiServiceFactory xMsf, String oldF, String newF) {
- boolean res = false;
+ private static void overwriteFile_impl(
+ XMultiServiceFactory xMsf, String oldF, String newF)
+ throws InteractiveAugmentedIOException
+ {
try {
Object fileacc = xMsf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
@@ -561,15 +556,42 @@ public class utils {
simpleAccess.kill(newF);
}
simpleAccess.copy(oldF, newF);
- res = true;
- } catch (com.sun.star.ucb.InteractiveAugmentedIOException e) {
- return false;
+ } catch (InteractiveAugmentedIOException e) {
+ throw e;
} catch (com.sun.star.uno.Exception e) {
- System.out.println("Couldn't copy " + oldF + " to " + newF + ".");
+ System.out.println("Couldn't copy " + oldF + " to " + newF + ":");
e.printStackTrace();
+ throw new RuntimeException(e);
}
+ }
- return res;
+ /**
+ * Copies file to a new location using OpenOffice.org features. If the target
+ * file already exists, the file is deleted.
+ *
+ * @returns <code>true</code> if the file was successfully copied,
+ * <code>false</code> if some errors occured (e.g. file is locked, used
+ * by another process).
+ */
+ public static boolean tryOverwriteFile(
+ XMultiServiceFactory xMsf, String oldF, String newF)
+ {
+ try {
+ overwriteFile_impl(xMsf, oldF, newF);
+ } catch (InteractiveAugmentedIOException e) {
+ return false;
+ }
+ 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) {
diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleContext.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleContext.java
index c0668a254195..47b24a337f2c 100644
--- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleContext.java
+++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleContext.java
@@ -327,8 +327,7 @@ public class _XAccessibleContext extends MultiMethodTest {
}
tRes.tested("getLocale()",
- (loc != null) && (loc.Language.length() > 0) &&
- (loc.Country.length() > 0));
+ (loc != null) && (loc.Language.length() > 0));
}
protected boolean checkStates(String[] expectedStateNames,
diff --git a/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java
index c4e80ee8a1d7..9c96506938da 100644
--- a/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java
+++ b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java
@@ -61,48 +61,50 @@ public class _XMessageBoxFactory extends MultiMethodTest {
final UITools tools = new UITools(
(XMultiServiceFactory) tParam.getMSF(),
UnoRuntime.queryInterface(XWindow.class, mb));
- final State[] state = new State[] { State.NONE };
+ final boolean[] done = new boolean[] { false };
+ final boolean[] good = new boolean[] { false };
XRequestCallback async = AsyncCallback.create(
tParam.getComponentContext());
async.addCallback(
new XCallback() {
public void notify(Object aData) {
mb.execute();
+ synchronized (done) {
+ done[0] = true;
+ done.notifyAll();
+ }
}
},
Any.VOID);
async.addCallback(
new XCallback() {
public void notify(Object aData) {
- boolean ok = true;
try {
tools.clickButton("OK");
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- e.printStackTrace();
- ok = false;
+ throw new RuntimeException(e);
}
- synchronized (state) {
- state[0] = ok ? State.GOOD : State.BAD;
- state.notifyAll();
+ synchronized (good) {
+ good[0] = true;
}
}
},
Any.VOID);
- boolean ok;
- synchronized (state) {
- while (state[0] == State.NONE) {
+ synchronized (done) {
+ while (!done[0]) {
try {
- state.wait();
+ done.wait();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
- ok = state[0] == State.GOOD;
+ }
+ boolean ok;
+ synchronized (good) {
+ ok = good[0];
}
tRes.tested("createMessageBox()", ok);
}
-
- private enum State { NONE, GOOD, BAD };
}
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
index 37311b118d0e..c349d5dcdb28 100644
--- a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
+++ b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
@@ -293,7 +293,7 @@ public class ORowSet extends TestCase {
oldF = utils.getFullURL(origDB);
newF = tempFolder + tableName + ".dbf";
}
- while ( !utils.overwriteFile( orb, oldF, newF ) );
+ while ( !utils.tryOverwriteFile( orb, oldF, newF ) );
m_tableFile = newF;
}
diff --git a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
index fe44c30e7c05..4b360e20fd10 100644
--- a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
+++ b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
@@ -311,7 +311,7 @@ public class ODatabaseForm extends TestCase {
oldF = utils.getFullURL(origDB);
newF = utils.getOfficeTemp((XMultiServiceFactory) tParam.getMSF()) + tableName +
".dbf";
- } while (!utils.overwriteFile(((XMultiServiceFactory) tParam.getMSF()), oldF, newF) &&
+ } while (!utils.tryOverwriteFile(((XMultiServiceFactory) tParam.getMSF()), oldF, newF) &&
(uniqueSuffix++ < 50));
}
}
diff --git a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
index 715fdc72d371..81e0d459c0a3 100644
--- a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
+++ b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
@@ -87,7 +87,7 @@ public class StandaloneDocumentInfo extends TestCase {
destUrl = utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) +
"SfxStandaloneDocInfoObject.sdw";
- utils.overwriteFile((XMultiServiceFactory)tParam.getMSF(), srcUrl, destUrl) ;
+ utils.doOverwriteFile((XMultiServiceFactory)tParam.getMSF(), srcUrl, destUrl) ;
}
/**