summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-12-11 16:25:29 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-12-12 08:16:17 +0000
commit117a82cd090ddd8efbc500350dc6082730f04720 (patch)
tree50c07684d43c06fd54d17532caca6a3afafd6967 /qadevOOo
parent04b183a9bc792a53a9f081353a79486faa4f3872 (diff)
java: remove dead code in qadevOOo
found by running UCDetector over the code many times, like peeling an onion Change-Id: I54d5147eb1b5c921ad236331bc4c1f765b13ca83 Reviewed-on: https://gerrit.libreoffice.org/13445 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/Jar_OOoRunner.mk82
-rw-r--r--qadevOOo/Jar_OOoRunnerLight.mk82
-rw-r--r--qadevOOo/runner/base/java_cmp.java74
-rw-r--r--qadevOOo/runner/complexlib/Assurance.java37
-rw-r--r--qadevOOo/runner/complexlib/MethodThread.java13
-rw-r--r--qadevOOo/runner/convwatch/BorderRemover.java261
-rw-r--r--qadevOOo/runner/convwatch/BuildID.java127
-rw-r--r--qadevOOo/runner/convwatch/ConvWatch.java372
-rw-r--r--qadevOOo/runner/convwatch/ConvWatchCancelException.java32
-rw-r--r--qadevOOo/runner/convwatch/ConvWatchException.java33
-rw-r--r--qadevOOo/runner/convwatch/ConvWatchStarter.java387
-rw-r--r--qadevOOo/runner/convwatch/CrashLoopTest.java50
-rw-r--r--qadevOOo/runner/convwatch/DB.java254
-rw-r--r--qadevOOo/runner/convwatch/DBHelper.java29
-rw-r--r--qadevOOo/runner/convwatch/DateHelper.java48
-rw-r--r--qadevOOo/runner/convwatch/DirectoryHelper.java125
-rw-r--r--qadevOOo/runner/convwatch/DocumentConverter.java242
-rw-r--r--qadevOOo/runner/convwatch/EnhancedComplexTestCase.java101
-rw-r--r--qadevOOo/runner/convwatch/FileHelper.java342
-rw-r--r--qadevOOo/runner/convwatch/FilenameHelper.java364
-rw-r--r--qadevOOo/runner/convwatch/GfxCompare.java177
-rw-r--r--qadevOOo/runner/convwatch/GlobalLogWriter.java5
-rw-r--r--qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java339
-rw-r--r--qadevOOo/runner/convwatch/GraphicalTestArguments.java682
-rw-r--r--qadevOOo/runner/convwatch/HTMLOutputter.java178
-rw-r--r--qadevOOo/runner/convwatch/INIOutputter.java190
-rw-r--r--qadevOOo/runner/convwatch/ImageHelper.java98
-rw-r--r--qadevOOo/runner/convwatch/IniFile.java238
-rw-r--r--qadevOOo/runner/convwatch/LISTOutputter.java85
-rw-r--r--qadevOOo/runner/convwatch/MSOfficePrint.java867
-rw-r--r--qadevOOo/runner/convwatch/NameHelper.java80
-rw-r--r--qadevOOo/runner/convwatch/OfficePrint.java1162
-rw-r--r--qadevOOo/runner/convwatch/PRNCompare.java504
-rw-r--r--qadevOOo/runner/convwatch/PerformanceContainer.java221
-rw-r--r--qadevOOo/runner/convwatch/PixelCounter.java138
-rw-r--r--qadevOOo/runner/convwatch/PropertyName.java58
-rw-r--r--qadevOOo/runner/convwatch/ReferenceBuilder.java257
-rw-r--r--qadevOOo/runner/convwatch/ReportDesignerTest.java535
-rw-r--r--qadevOOo/runner/convwatch/SimpleFileSemaphore.java180
-rw-r--r--qadevOOo/runner/convwatch/StatusHelper.java88
-rw-r--r--qadevOOo/runner/convwatch/TimeHelper.java35
-rw-r--r--qadevOOo/runner/convwatch/TriState.java68
-rw-r--r--qadevOOo/runner/convwatch/ValueNotFoundException.java27
-rw-r--r--qadevOOo/runner/graphical/BuildID.java143
-rw-r--r--qadevOOo/runner/graphical/DateHelper.java48
-rw-r--r--qadevOOo/runner/graphical/DirectoryHelper.java126
-rw-r--r--qadevOOo/runner/graphical/EnhancedComplexTestCase.java454
-rw-r--r--qadevOOo/runner/graphical/FileHelper.java503
-rw-r--r--qadevOOo/runner/graphical/GlobalLogWriter.java54
-rw-r--r--qadevOOo/runner/graphical/GraphicalComparator.java37
-rw-r--r--qadevOOo/runner/graphical/HTMLResult.java190
-rw-r--r--qadevOOo/runner/graphical/IOffice.java43
-rw-r--r--qadevOOo/runner/graphical/ImageHelper.java102
-rw-r--r--qadevOOo/runner/graphical/IniFile.java544
-rw-r--r--qadevOOo/runner/graphical/JPEGComparator.java653
-rw-r--r--qadevOOo/runner/graphical/JPEGCreator.java356
-rw-r--r--qadevOOo/runner/graphical/JPEGEvaluator.java59
-rw-r--r--qadevOOo/runner/graphical/MSOfficePostscriptCreator.java686
-rw-r--r--qadevOOo/runner/graphical/Office.java148
-rw-r--r--qadevOOo/runner/graphical/OfficeException.java36
-rw-r--r--qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java384
-rw-r--r--qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java631
-rw-r--r--qadevOOo/runner/graphical/ParameterHelper.java347
-rw-r--r--qadevOOo/runner/graphical/PerformanceContainer.java237
-rw-r--r--qadevOOo/runner/graphical/PixelCounter.java155
-rw-r--r--qadevOOo/runner/graphical/PostscriptCreator.java78
-rw-r--r--qadevOOo/runner/graphical/PropertyName.java39
-rw-r--r--qadevOOo/runner/graphical/TimeHelper.java68
-rw-r--r--qadevOOo/runner/graphical/Tolerance.java32
-rw-r--r--qadevOOo/runner/graphical/WrongEnvironmentException.java31
-rw-r--r--qadevOOo/runner/graphical/WrongSuffixException.java27
-rw-r--r--qadevOOo/runner/helper/ConfigurationRead.java16
-rw-r--r--qadevOOo/runner/helper/InetTools.java79
-rw-r--r--qadevOOo/runner/helper/OSHelper.java5
-rw-r--r--qadevOOo/runner/helper/ObjectInspectorModelImpl.java133
-rw-r--r--qadevOOo/runner/helper/ProcessHandler.java134
-rw-r--r--qadevOOo/runner/helper/PropertyHelper.java45
-rw-r--r--qadevOOo/runner/helper/SimpleMailSender.java162
-rw-r--r--qadevOOo/runner/lib/MultiMethodTest.java10
-rw-r--r--qadevOOo/runner/lib/Parameters.java164
-rw-r--r--qadevOOo/runner/lib/SimpleStatus.java7
-rw-r--r--qadevOOo/runner/lib/Status.java31
-rw-r--r--qadevOOo/runner/lib/TestResult.java8
-rw-r--r--qadevOOo/runner/share/ComplexTest.java2
-rw-r--r--qadevOOo/runner/share/LogWriter.java7
-rw-r--r--qadevOOo/runner/stats/ComplexDataBaseOutProducer.java172
-rw-r--r--qadevOOo/runner/stats/DataBaseOutProducer.java183
-rw-r--r--qadevOOo/runner/stats/FatDataBaseOutProducer.java135
-rw-r--r--qadevOOo/runner/stats/FileLogWriter.java140
-rw-r--r--qadevOOo/runner/stats/InternalLogWriter.java4
-rw-r--r--qadevOOo/runner/stats/SQLExecution.java332
-rw-r--r--qadevOOo/runner/stats/SimpleFileOutProducer.java109
-rw-r--r--qadevOOo/runner/stats/SimpleLogWriter.java4
-rw-r--r--qadevOOo/runner/stats/SimpleOutProducer.java4
-rw-r--r--qadevOOo/runner/util/BasicMacroTools.java218
-rw-r--r--qadevOOo/runner/util/BookmarkDsc.java5
-rw-r--r--qadevOOo/runner/util/ControlDsc.java75
-rw-r--r--qadevOOo/runner/util/FootnoteDsc.java5
-rw-r--r--qadevOOo/runner/util/FrameDsc.java6
-rw-r--r--qadevOOo/runner/util/InstDescr.java6
-rw-r--r--qadevOOo/runner/util/ParagraphDsc.java5
-rw-r--r--qadevOOo/runner/util/ReferenceMarkDsc.java79
-rw-r--r--qadevOOo/runner/util/StyleFamilyDsc.java75
-rw-r--r--qadevOOo/runner/util/TableDsc.java6
-rw-r--r--qadevOOo/runner/util/TextSectionDsc.java5
-rw-r--r--qadevOOo/runner/util/UITools.java20
-rw-r--r--qadevOOo/runner/util/ValueChanger.java2
-rw-r--r--qadevOOo/runner/util/XMLTools.java60
-rw-r--r--qadevOOo/runner/util/compare/DocComparator.java31
-rw-r--r--qadevOOo/runner/util/compare/DocComparatorFactory.java47
-rw-r--r--qadevOOo/runner/util/compare/GraphicalComparator.java236
-rw-r--r--qadevOOo/runner/util/compare/PDFComparator.java38
-rw-r--r--qadevOOo/runner/util/db/DatabaseDocument.java5
-rw-r--r--qadevOOo/runner/util/utils.java19
114 files changed, 3 insertions, 18304 deletions
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 1dd5fbec1113..a39f64e9aaca 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -45,7 +45,6 @@ $(eval $(call gb_Jar_set_packageroot,OOoRunner,\
))
$(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
- qadevOOo/runner/base/java_cmp \
qadevOOo/runner/base/java_complex \
qadevOOo/runner/base/java_fat \
qadevOOo/runner/base/java_fat_service \
@@ -54,72 +53,10 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/complexlib/ComplexTestCase \
qadevOOo/runner/complexlib/MethodThread \
qadevOOo/runner/complexlib/ShowTargets \
- qadevOOo/runner/convwatch/BorderRemover \
- qadevOOo/runner/convwatch/BuildID \
- qadevOOo/runner/convwatch/ConvWatch \
- qadevOOo/runner/convwatch/ConvWatchCancelException \
- qadevOOo/runner/convwatch/ConvWatchException \
- qadevOOo/runner/convwatch/ConvWatchStarter \
- qadevOOo/runner/convwatch/CrashLoopTest \
- qadevOOo/runner/convwatch/DateHelper \
qadevOOo/runner/convwatch/DB \
qadevOOo/runner/convwatch/DBHelper \
- qadevOOo/runner/convwatch/DirectoryHelper \
- qadevOOo/runner/convwatch/DocumentConverter \
- qadevOOo/runner/convwatch/EnhancedComplexTestCase \
- qadevOOo/runner/convwatch/FileHelper \
- qadevOOo/runner/convwatch/FilenameHelper \
- qadevOOo/runner/convwatch/GfxCompare \
qadevOOo/runner/convwatch/GlobalLogWriter \
- qadevOOo/runner/convwatch/GraphicalDifferenceCheck \
- qadevOOo/runner/convwatch/GraphicalTestArguments \
- qadevOOo/runner/convwatch/HTMLOutputter \
- qadevOOo/runner/convwatch/ImageHelper \
- qadevOOo/runner/convwatch/IniFile \
- qadevOOo/runner/convwatch/INIOutputter \
- qadevOOo/runner/convwatch/LISTOutputter \
- qadevOOo/runner/convwatch/MSOfficePrint \
- qadevOOo/runner/convwatch/NameHelper \
- qadevOOo/runner/convwatch/OfficePrint \
- qadevOOo/runner/convwatch/PerformanceContainer \
- qadevOOo/runner/convwatch/PixelCounter \
- qadevOOo/runner/convwatch/PRNCompare \
- qadevOOo/runner/convwatch/PropertyName \
- qadevOOo/runner/convwatch/ReferenceBuilder \
- qadevOOo/runner/convwatch/ReportDesignerTest \
- qadevOOo/runner/convwatch/SimpleFileSemaphore \
- qadevOOo/runner/convwatch/StatusHelper \
- qadevOOo/runner/convwatch/TimeHelper \
- qadevOOo/runner/convwatch/TriState \
- qadevOOo/runner/convwatch/ValueNotFoundException \
- qadevOOo/runner/graphical/BuildID \
- qadevOOo/runner/graphical/DateHelper \
- qadevOOo/runner/graphical/DirectoryHelper \
- qadevOOo/runner/graphical/EnhancedComplexTestCase \
qadevOOo/runner/graphical/FileHelper \
- qadevOOo/runner/graphical/GlobalLogWriter \
- qadevOOo/runner/graphical/GraphicalComparator \
- qadevOOo/runner/graphical/HTMLResult \
- qadevOOo/runner/graphical/ImageHelper \
- qadevOOo/runner/graphical/IniFile \
- qadevOOo/runner/graphical/IOffice \
- qadevOOo/runner/graphical/JPEGComparator \
- qadevOOo/runner/graphical/JPEGCreator \
- qadevOOo/runner/graphical/JPEGEvaluator \
- qadevOOo/runner/graphical/MSOfficePostscriptCreator \
- qadevOOo/runner/graphical/Office \
- qadevOOo/runner/graphical/OfficeException \
- qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor \
- qadevOOo/runner/graphical/OpenOfficePostscriptCreator \
- qadevOOo/runner/graphical/ParameterHelper \
- qadevOOo/runner/graphical/PerformanceContainer \
- qadevOOo/runner/graphical/PixelCounter \
- qadevOOo/runner/graphical/PostscriptCreator \
- qadevOOo/runner/graphical/PropertyName \
- qadevOOo/runner/graphical/TimeHelper \
- qadevOOo/runner/graphical/Tolerance \
- qadevOOo/runner/graphical/WrongEnvironmentException \
- qadevOOo/runner/graphical/WrongSuffixException \
qadevOOo/runner/helper/APIDescGetter \
qadevOOo/runner/helper/AppProvider \
qadevOOo/runner/helper/BuildEnvTools \
@@ -131,9 +68,7 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/helper/ContextMenuInterceptor \
qadevOOo/runner/helper/CwsDataExchangeImpl \
qadevOOo/runner/helper/FileTools \
- qadevOOo/runner/helper/InetTools \
qadevOOo/runner/helper/LoggingThread \
- qadevOOo/runner/helper/ObjectInspectorModelImpl \
qadevOOo/runner/helper/OfficeProvider \
qadevOOo/runner/helper/OfficeWatcher \
qadevOOo/runner/helper/OSHelper \
@@ -141,8 +76,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/helper/ProcessHandler \
qadevOOo/runner/helper/PropertyHandlerFactroy \
qadevOOo/runner/helper/PropertyHandlerImpl \
- qadevOOo/runner/helper/PropertyHelper \
- qadevOOo/runner/helper/SimpleMailSender \
qadevOOo/runner/helper/StreamSimulator \
qadevOOo/runner/helper/StringHelper \
qadevOOo/runner/helper/UnoProvider \
@@ -152,7 +85,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/lib/ExceptionStatus \
qadevOOo/runner/lib/MultiMethodTest \
qadevOOo/runner/lib/MultiPropertyTest \
- qadevOOo/runner/lib/Parameters \
qadevOOo/runner/lib/SimpleStatus \
qadevOOo/runner/lib/Status \
qadevOOo/runner/lib/StatusException \
@@ -167,26 +99,14 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/share/DescGetter \
qadevOOo/runner/share/LogWriter \
qadevOOo/runner/share/Watcher \
- qadevOOo/runner/stats/ComplexDataBaseOutProducer \
- qadevOOo/runner/stats/DataBaseOutProducer \
- qadevOOo/runner/stats/FatDataBaseOutProducer \
- qadevOOo/runner/stats/FileLogWriter \
qadevOOo/runner/stats/InternalLogWriter \
qadevOOo/runner/stats/OutProducerFactory \
- qadevOOo/runner/stats/SimpleFileOutProducer \
qadevOOo/runner/stats/SimpleLogWriter \
qadevOOo/runner/stats/SimpleOutProducer \
- qadevOOo/runner/stats/SQLExecution \
qadevOOo/runner/stats/Summarizer \
qadevOOo/runner/util/AccessibilityTools \
- qadevOOo/runner/util/BasicMacroTools \
qadevOOo/runner/util/BookmarkDsc \
qadevOOo/runner/util/CalcTools \
- qadevOOo/runner/util/compare/DocComparator \
- qadevOOo/runner/util/compare/DocComparatorFactory \
- qadevOOo/runner/util/compare/GraphicalComparator \
- qadevOOo/runner/util/compare/PDFComparator \
- qadevOOo/runner/util/ControlDsc \
qadevOOo/runner/util/db/DatabaseDocument \
qadevOOo/runner/util/db/DataSource \
qadevOOo/runner/util/db/DataSourceDescriptor \
@@ -203,11 +123,9 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/util/InstDescr \
qadevOOo/runner/util/ParagraphDsc \
qadevOOo/runner/util/PropertyName \
- qadevOOo/runner/util/ReferenceMarkDsc \
qadevOOo/runner/util/RegistryTools \
qadevOOo/runner/util/ShapeDsc \
qadevOOo/runner/util/SOfficeFactory \
- qadevOOo/runner/util/StyleFamilyDsc \
qadevOOo/runner/util/SysUtils \
qadevOOo/runner/util/TableDsc \
qadevOOo/runner/util/TextSectionDsc \
diff --git a/qadevOOo/Jar_OOoRunnerLight.mk b/qadevOOo/Jar_OOoRunnerLight.mk
index ec353914ce82..3fcdd35e10ab 100644
--- a/qadevOOo/Jar_OOoRunnerLight.mk
+++ b/qadevOOo/Jar_OOoRunnerLight.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Jar_set_packageroot,OOoRunnerLight,\
))
$(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
- qadevOOo/runner/base/java_cmp \
qadevOOo/runner/base/java_complex \
qadevOOo/runner/base/java_fat \
qadevOOo/runner/base/java_fat_service \
@@ -51,72 +50,10 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/complexlib/ComplexTestCase \
qadevOOo/runner/complexlib/MethodThread \
qadevOOo/runner/complexlib/ShowTargets \
- qadevOOo/runner/convwatch/BorderRemover \
- qadevOOo/runner/convwatch/BuildID \
- qadevOOo/runner/convwatch/ConvWatch \
- qadevOOo/runner/convwatch/ConvWatchCancelException \
- qadevOOo/runner/convwatch/ConvWatchException \
- qadevOOo/runner/convwatch/ConvWatchStarter \
- qadevOOo/runner/convwatch/CrashLoopTest \
- qadevOOo/runner/convwatch/DateHelper \
qadevOOo/runner/convwatch/DB \
qadevOOo/runner/convwatch/DBHelper \
- qadevOOo/runner/convwatch/DirectoryHelper \
- qadevOOo/runner/convwatch/DocumentConverter \
- qadevOOo/runner/convwatch/EnhancedComplexTestCase \
- qadevOOo/runner/convwatch/FileHelper \
- qadevOOo/runner/convwatch/FilenameHelper \
- qadevOOo/runner/convwatch/GfxCompare \
qadevOOo/runner/convwatch/GlobalLogWriter \
- qadevOOo/runner/convwatch/GraphicalDifferenceCheck \
- qadevOOo/runner/convwatch/GraphicalTestArguments \
- qadevOOo/runner/convwatch/HTMLOutputter \
- qadevOOo/runner/convwatch/ImageHelper \
- qadevOOo/runner/convwatch/IniFile \
- qadevOOo/runner/convwatch/INIOutputter \
- qadevOOo/runner/convwatch/LISTOutputter \
- qadevOOo/runner/convwatch/MSOfficePrint \
- qadevOOo/runner/convwatch/NameHelper \
- qadevOOo/runner/convwatch/OfficePrint \
- qadevOOo/runner/convwatch/PerformanceContainer \
- qadevOOo/runner/convwatch/PixelCounter \
- qadevOOo/runner/convwatch/PRNCompare \
- qadevOOo/runner/convwatch/PropertyName \
- qadevOOo/runner/convwatch/ReferenceBuilder \
- qadevOOo/runner/convwatch/ReportDesignerTest \
- qadevOOo/runner/convwatch/SimpleFileSemaphore \
- qadevOOo/runner/convwatch/StatusHelper \
- qadevOOo/runner/convwatch/TimeHelper \
- qadevOOo/runner/convwatch/TriState \
- qadevOOo/runner/convwatch/ValueNotFoundException \
- qadevOOo/runner/graphical/BuildID \
- qadevOOo/runner/graphical/DateHelper \
- qadevOOo/runner/graphical/DirectoryHelper \
- qadevOOo/runner/graphical/EnhancedComplexTestCase \
qadevOOo/runner/graphical/FileHelper \
- qadevOOo/runner/graphical/GlobalLogWriter \
- qadevOOo/runner/graphical/GraphicalComparator \
- qadevOOo/runner/graphical/HTMLResult \
- qadevOOo/runner/graphical/ImageHelper \
- qadevOOo/runner/graphical/IniFile \
- qadevOOo/runner/graphical/IOffice \
- qadevOOo/runner/graphical/JPEGComparator \
- qadevOOo/runner/graphical/JPEGCreator \
- qadevOOo/runner/graphical/JPEGEvaluator \
- qadevOOo/runner/graphical/MSOfficePostscriptCreator \
- qadevOOo/runner/graphical/Office \
- qadevOOo/runner/graphical/OfficeException \
- qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor \
- qadevOOo/runner/graphical/OpenOfficePostscriptCreator \
- qadevOOo/runner/graphical/ParameterHelper \
- qadevOOo/runner/graphical/PerformanceContainer \
- qadevOOo/runner/graphical/PixelCounter \
- qadevOOo/runner/graphical/PostscriptCreator \
- qadevOOo/runner/graphical/PropertyName \
- qadevOOo/runner/graphical/TimeHelper \
- qadevOOo/runner/graphical/Tolerance \
- qadevOOo/runner/graphical/WrongEnvironmentException \
- qadevOOo/runner/graphical/WrongSuffixException \
qadevOOo/runner/helper/APIDescGetter \
qadevOOo/runner/helper/AppProvider \
qadevOOo/runner/helper/BuildEnvTools \
@@ -128,9 +65,7 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/helper/ContextMenuInterceptor \
qadevOOo/runner/helper/CwsDataExchangeImpl \
qadevOOo/runner/helper/FileTools \
- qadevOOo/runner/helper/InetTools \
qadevOOo/runner/helper/LoggingThread \
- qadevOOo/runner/helper/ObjectInspectorModelImpl \
qadevOOo/runner/helper/OfficeProvider \
qadevOOo/runner/helper/OfficeWatcher \
qadevOOo/runner/helper/OSHelper \
@@ -138,8 +73,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/helper/ProcessHandler \
qadevOOo/runner/helper/PropertyHandlerFactroy \
qadevOOo/runner/helper/PropertyHandlerImpl \
- qadevOOo/runner/helper/PropertyHelper \
- qadevOOo/runner/helper/SimpleMailSender \
qadevOOo/runner/helper/StreamSimulator \
qadevOOo/runner/helper/StringHelper \
qadevOOo/runner/helper/UnoProvider \
@@ -149,7 +82,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/lib/ExceptionStatus \
qadevOOo/runner/lib/MultiMethodTest \
qadevOOo/runner/lib/MultiPropertyTest \
- qadevOOo/runner/lib/Parameters \
qadevOOo/runner/lib/SimpleStatus \
qadevOOo/runner/lib/Status \
qadevOOo/runner/lib/StatusException \
@@ -164,26 +96,14 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/share/DescGetter \
qadevOOo/runner/share/LogWriter \
qadevOOo/runner/share/Watcher \
- qadevOOo/runner/stats/ComplexDataBaseOutProducer \
- qadevOOo/runner/stats/DataBaseOutProducer \
- qadevOOo/runner/stats/FatDataBaseOutProducer \
- qadevOOo/runner/stats/FileLogWriter \
qadevOOo/runner/stats/InternalLogWriter \
qadevOOo/runner/stats/OutProducerFactory \
- qadevOOo/runner/stats/SimpleFileOutProducer \
qadevOOo/runner/stats/SimpleLogWriter \
qadevOOo/runner/stats/SimpleOutProducer \
- qadevOOo/runner/stats/SQLExecution \
qadevOOo/runner/stats/Summarizer \
qadevOOo/runner/util/AccessibilityTools \
- qadevOOo/runner/util/BasicMacroTools \
qadevOOo/runner/util/BookmarkDsc \
qadevOOo/runner/util/CalcTools \
- qadevOOo/runner/util/compare/DocComparator \
- qadevOOo/runner/util/compare/DocComparatorFactory \
- qadevOOo/runner/util/compare/GraphicalComparator \
- qadevOOo/runner/util/compare/PDFComparator \
- qadevOOo/runner/util/ControlDsc \
qadevOOo/runner/util/db/DatabaseDocument \
qadevOOo/runner/util/db/DataSource \
qadevOOo/runner/util/db/DataSourceDescriptor \
@@ -200,11 +120,9 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunnerLight,\
qadevOOo/runner/util/InstDescr \
qadevOOo/runner/util/ParagraphDsc \
qadevOOo/runner/util/PropertyName \
- qadevOOo/runner/util/ReferenceMarkDsc \
qadevOOo/runner/util/RegistryTools \
qadevOOo/runner/util/ShapeDsc \
qadevOOo/runner/util/SOfficeFactory \
- qadevOOo/runner/util/StyleFamilyDsc \
qadevOOo/runner/util/SysUtils \
qadevOOo/runner/util/TableDsc \
qadevOOo/runner/util/TextSectionDsc \
diff --git a/qadevOOo/runner/base/java_cmp.java b/qadevOOo/runner/base/java_cmp.java
deleted file mode 100644
index 86927bc598d6..000000000000
--- a/qadevOOo/runner/base/java_cmp.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package base;
-
-
-
-
-/**
- *
- * this class handles tests written in java without running an Office with
- * own bootstrapping of UNO
- */
-public class java_cmp implements TestBase {
-
- private final TestBase mWrappedTestBase = new java_fat();
-
- public boolean executeTest(lib.TestParameters param) {
- param.put("OfficeProvider", "helper.UnoProvider");
- return mWrappedTestBase.executeTest(param);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java
index 0cbc1e0aaf20..f2169b02ef59 100644
--- a/qadevOOo/runner/complexlib/Assurance.java
+++ b/qadevOOo/runner/complexlib/Assurance.java
@@ -52,28 +52,6 @@ public class Assurance
assure(msg, s, false);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/**
* Assure that two int values are equal
* @param message the message to print when the equality test fails
@@ -84,12 +62,6 @@ public class Assurance
assureEquals( message, Integer.valueOf( expected ), Integer.valueOf( actual ), false );
}
-
-
-
-
-
-
/**
* Assure that two string values are equal
* @param message the message to print when the equality test fails
@@ -100,10 +72,6 @@ public class Assurance
assureEquals( message, expected, actual, false );
}
-
-
-
-
/**
* assures the two given sequences are of equal length, and have equal content
*/
@@ -117,8 +85,6 @@ public class Assurance
}
}
-
-
/**
* Mark the currently executed method as failed.
* with the given message.
@@ -173,8 +139,5 @@ public class Assurance
private AssureException(String msg) {
super(msg);
}
- public AssureException(Throwable cause) {
- super(cause);
- }
}
}
diff --git a/qadevOOo/runner/complexlib/MethodThread.java b/qadevOOo/runner/complexlib/MethodThread.java
index d30df06609f8..0d86c7310c15 100644
--- a/qadevOOo/runner/complexlib/MethodThread.java
+++ b/qadevOOo/runner/complexlib/MethodThread.java
@@ -40,19 +40,6 @@ public class MethodThread extends Thread
private boolean mExceptionHappened = false;
private Object[] mParameter = null;
- /**
- * Constructor.
- * @param testMethod The method that will be invoked.
- * @param invokeClass The class where the method is invoked.
- * @param log The logging mechanism.
- */
- public MethodThread(Method testMethod, Object invokeClass, PrintWriter log)
- {
- mTestMethod = testMethod;
- mInvokeClass = invokeClass;
- mLog = log;
- }
-
public MethodThread(Method testMethod, Object invokeClass, Object[] parameter, PrintWriter log)
{
mTestMethod = testMethod;
diff --git a/qadevOOo/runner/convwatch/BorderRemover.java b/qadevOOo/runner/convwatch/BorderRemover.java
deleted file mode 100644
index dbd933b3ad35..000000000000
--- a/qadevOOo/runner/convwatch/BorderRemover.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.awt.image.RenderedImage;
-import java.awt.image.BufferedImage;
-import java.lang.reflect.Method;
-
-
-class Rect
-{
- private final int x;
- private final int y;
- private final int w;
- private final int h;
-
- public Rect(int _x, int _y, int _w, int _h)
- {
- x = _x;
- y = _y;
- w = _w;
- h = _h;
- }
- public int getX() {return x;}
- public int getY() {return y;}
- public int getWidth() {return w;}
- public int getHeight() {return h;}
-}
-
-class BorderRemover
-{
- // Helper values, filled after find Border
-
- // --------------------------------- test mode ---------------------------------
-
- /*
- * compares 2 colors with a given tolerance. So it's possible to check differences approximate.
- * @param _nColor1
- * @param _nColor2
- * @param _nTolerance is a percentage value how strong the colors could be differ
-
- */
- private boolean compareColorWithTolerance(int _nColor1, int _nColor2, int _nTolerance)
- {
- // int alpha1 = (_nColor1 >> 24) & 0xff;
- int red1 = (_nColor1 >> 16) & 0xff;
- int green1 = (_nColor1 >> 8) & 0xff;
- int blue1 = (_nColor1 ) & 0xff;
-
- // int alpha2 = (_nColor2 >> 24) & 0xff;
- int red2 = (_nColor2 >> 16) & 0xff;
- int green2 = (_nColor2 >> 8) & 0xff;
- int blue2 = (_nColor2 ) & 0xff;
-
- if (_nTolerance > 100)
- {
- _nTolerance = 100;
- }
-
- // calculate tolerance halve
- int nTolerable = (int) (_nTolerance * 256.0 / 100.0);
- if (nTolerable < 0)
- {
- nTolerable = 0;
- }
-
- // X - th < Y < X + th
- // if ((red1 - nTolerable) < red2 && red2 < (red1 + nTolerable))
- // is the same
- // abs (X - Y) < th
- if (Math.abs(red1 - red2) < nTolerable)
- {
- if (Math.abs(green1 - green2) < nTolerable)
- {
- if (Math.abs(blue1 - blue2) < nTolerable)
- {
- return true;
- }
- else
- {
- // blue differ
- }
- }
- else
- {
- // green differ
- }
- }
- else
- {
- // red differ
- }
-
- return false;
- }
-
- /**
- * create a new image from an exist one without it's borders
- * open the file (_sFilenameFrom) as an image, check if it contains any borders and remove
- * the borders.
- */
- public boolean createNewImageWithoutBorder(String _sFilenameFrom, String _sFilenameTo)
- throws java.io.IOException
- {
- ImageHelper aImageHelper = ImageHelper.createImageHelper(_sFilenameFrom);
-
- int nBorderColor = aImageHelper.getPixel(0,0);
- Rect aInnerRect = findBorder(aImageHelper, nBorderColor);
-
- RenderedImage aImage = createImage(aImageHelper, aInnerRect);
-
- File aWriteFile = new File(_sFilenameTo);
-
- Exception ex = null;
- try
- {
- Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO");
-
- Method getWriterMIMETypesMethod = imageIOClass.getDeclaredMethod("getWriterMIMETypes", new Class[]{ });
-
- getWriterMIMETypesMethod.invoke(imageIOClass, new Object[]{ });
- Method writeMethod = imageIOClass.getDeclaredMethod("write", new Class[]{ java.awt.image.RenderedImage.class,
- String.class,
- java.io.File.class});
- writeMethod.invoke(imageIOClass, new Object[]{aImage, "image/jpeg", aWriteFile});
- }
- catch(java.lang.ClassNotFoundException e) {
- e.printStackTrace();
- ex = e;
- }
- catch(java.lang.NoSuchMethodException e) {
- e.printStackTrace();
- ex = e;
- }
- catch(java.lang.IllegalAccessException e) {
- e.printStackTrace();
- ex = e;
- }
- catch(java.lang.reflect.InvocationTargetException e) {
- e.printStackTrace();
- ex = e;
- }
-
- if (ex != null) {
- // get Java version:
- String javaVersion = System.getProperty("java.version");
- throw new java.io.IOException(
- "Cannot construct object with current Java version " +
- javaVersion + ": " + ex.getMessage());
- }
-
- return true;
- }
-
-
- /**
- * runs through the image, pixel by pixel
- * as long as found pixels like the color at (0,0) this is interpreted as border.
- * as result it fills the m_nXMin, m_nXMax, m_nYMin, m_nYMax values.
- */
-
- private Rect findBorder(ImageHelper _aImage, int _nBorderColor)
- {
- int h = _aImage.getHeight();
- int w = _aImage.getWidth();
- int nXMin = w;
- int nXMax = 0;
- int nYMin = h;
- int nYMax = 0;
-
- for (int y = 0; y < h; y++)
- {
- for (int x = 0; x < nXMin; x++)
- {
- int nCurrentColor = _aImage.getPixel(x, y);
- if (! compareColorWithTolerance(nCurrentColor, _nBorderColor, 10))
- {
- nXMin = Math.min(nXMin, x);
- nYMin = Math.min(nYMin, y);
- }
- }
- }
- for (int y = 0; y < h; y++)
- {
- for (int nx = w - 1; nx >= nXMax; --nx)
- {
- int ny = h - y - 1;
- int nCurrentColor = _aImage.getPixel(nx, ny);
- if (! compareColorWithTolerance(nCurrentColor, _nBorderColor, 10))
- {
- nXMax = Math.max(nXMax, nx);
- nYMax = Math.max(nYMax, ny);
- }
- }
- }
-
- Rect aRect;
- if (nXMin < nXMax && nYMin < nYMax)
- {
- int nw = nXMax - nXMin + 1;
- int nh = nYMax - nYMin + 1;
-
- // this is the rectangle around the image content.
- aRect = new Rect(nXMin, nYMin, nw, nh );
- }
- else
- {
- // create the smalles possible image
- aRect = new Rect(0,0,1,1);
- }
-
-
- return aRect;
- }
-
- private RenderedImage createImage(ImageHelper _aImage, Rect _aRect) throws IllegalArgumentException
- {
-// TODO: throw if w or h < 0
- int w = _aRect.getWidth();
- int h = _aRect.getHeight();
-
- if (w <= 0 || h <= 0)
- {
- throw new IllegalArgumentException("width or height are too small or negative.");
- }
-
- BufferedImage aBI = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
-
- int nXOffset = _aRect.getX();
- int nYOffset = _aRect.getY();
-
- // Memory Block move
- for (int y = 0; y < h; y++)
- {
- for (int x = 0; x < w; x++)
- {
- // aPixels[y * w + x] = m_aImage.getPixel(m_nXMin + x, m_nYMin + y);
- aBI.setRGB(x, y, _aImage.getPixel(x + nXOffset, y + nYOffset));
- }
- }
- return aBI;
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/BuildID.java b/qadevOOo/runner/convwatch/BuildID.java
deleted file mode 100644
index 6fb16875ca59..000000000000
--- a/qadevOOo/runner/convwatch/BuildID.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import helper.OSHelper;
-
-public class BuildID
-{
- public static String getBuildID(String _sApp)
- {
- String sOfficePath = "";
- if (_sApp.startsWith("\""))
- {
- int nIdx = _sApp.indexOf('"', 1);
- if (nIdx == -1)
- {
- }
- else
- {
- // leave double qoute out.
- sOfficePath = _sApp.substring(1, nIdx);
- }
- }
- else
- {
- // check if a space exist, so we get all until space
- int nIdx = _sApp.indexOf(' ', 1);
- if (nIdx == -1)
- {
- sOfficePath = _sApp;
- }
- else
- {
- sOfficePath = _sApp.substring(0, nIdx);
- }
- }
- GlobalLogWriter.get().println("Office path: " + sOfficePath);
-
- String fs = System.getProperty("file.separator");
- String sBuildID = "";
- File aSOfficeFile = new File(sOfficePath);
- if (aSOfficeFile.exists())
- {
- int nIdx = sOfficePath.lastIndexOf(fs);
- sOfficePath = sOfficePath.substring(0, nIdx);
- sBuildID = getBuildIDFromBootstrap(sOfficePath);
- if (sBuildID.length() == 0)
- {
- sBuildID = getBuildIDFromVersion(sOfficePath);
- }
- }
- else
- {
- GlobalLogWriter.get().println("soffice executable not found.");
- }
-
- return sBuildID;
- }
-
- private static String getBuildIDFromBootstrap(String _sOfficePath)
- {
- String fs = System.getProperty("file.separator");
- String sBuildID = "";
- String sOfficePath = _sOfficePath;
- if (OSHelper.isWindows())
- {
- sOfficePath += fs + "bootstrap.ini";
- }
- else
- {
- sOfficePath += fs + "bootstraprc";
- }
- IniFile aIniFile = new IniFile(sOfficePath);
- if (aIniFile.is())
- {
- sBuildID = aIniFile.getValue("Bootstrap", "buildid");
- }
- else
- {
- GlobalLogWriter.get().println("Property Build, can't open file '" + sOfficePath + "', please check.");
- }
- return sBuildID;
- }
-
- private static String getBuildIDFromVersion(String _sOfficePath)
- {
- String fs = System.getProperty("file.separator");
- String sBuildID = "";
- String sOfficePath = _sOfficePath;
- if (OSHelper.isWindows())
- {
- sOfficePath += fs + "version.ini";
- }
- else
- {
- sOfficePath += fs + "versionrc";
- }
- IniFile aIniFile = new IniFile(sOfficePath);
- if (aIniFile.is())
- {
- sBuildID = aIniFile.getValue("Version", "buildid");
- }
- else
- {
- GlobalLogWriter.get().println("Property Build, can't open file '" + sOfficePath + "', please check.");
- }
- return sBuildID;
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/ConvWatch.java b/qadevOOo/runner/convwatch/ConvWatch.java
deleted file mode 100644
index 1c4ac3d08e6b..000000000000
--- a/qadevOOo/runner/convwatch/ConvWatch.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import helper.URLHelper;
-import java.io.File;
-
-public class ConvWatch
-{
-
- private String getBuildID_FromFile(String _sInfoFile)
- {
- String sBuildID = "";
- IniFile aIniFile = new IniFile(_sInfoFile);
- if (aIniFile.is())
- {
- sBuildID = aIniFile.getValue("", "buildid");
- }
- return sBuildID;
- }
- /**
- * Check if given document (_sAbsoluteInputFile) and it's postscript representation (_sAbsoluteReferenceFile) produce
- * the same output like the StarOffice / OpenOffice.org which is accessible with XMultiServiceFactory.
- * Here a simple graphically difference check is run through.
- *
- * Hint: In the OutputPath all needed files will create, there must
- * be very much space. It's not possible to say how much.
- * One page need up to 800kb as jpeg.
- * Sample: If a document contains 2 pages, we need 2*800kb for prn
- * output and 2*800kb for ps output and 2*800kb for it's difference
- * output. So up to 4800kb or 4.8mb.
- *
- * RAM is need least 300mb. Will say, it's tested on a pc with 128mb RAM and 256mb swap.
- *
- * It's also absolutlly impossible to say, how much time this functions consume.
- */
-
- private StatusHelper[] createPostscriptStartCheck(GraphicalTestArguments _aGTA,
- String _sOutputPath, String _sAbsoluteInputFile, String _sAbsoluteReferenceFile)
- throws ConvWatchCancelException
- {
-// TODO: some more checks
-
- if (! FileHelper.exists(_sAbsoluteInputFile))
- {
- throw new ConvWatchCancelException("createPostscriptStartCheck: Input file: " + _sAbsoluteInputFile + " does not exist.");
- }
-
- if (_sAbsoluteReferenceFile == null)
- {
- // we assume, that the prn file is near the document
- String sAbsoluteInputFileNoSuffix = FileHelper.getNameNoSuffix(_sAbsoluteInputFile);
- _sAbsoluteReferenceFile = sAbsoluteInputFileNoSuffix + ".prn";
- }
-
- String fs = System.getProperty("file.separator");
- File aAbsoluteReferenceFile = new File(_sAbsoluteReferenceFile);
-
- if (aAbsoluteReferenceFile.isDirectory())
- {
- String sBasename = FileHelper.getBasename(_sAbsoluteInputFile);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
- String sAbsoluteReferenceFileInfo = _sAbsoluteReferenceFile + fs + sNameNoSuffix + ".info";
- _sAbsoluteReferenceFile = _sAbsoluteReferenceFile + fs + sNameNoSuffix + ".prn";
-
- // Read the reference from the info file
- String sRefBuildID = "";
- if (FileHelper.exists(sAbsoluteReferenceFileInfo))
- {
- sRefBuildID = getBuildID_FromFile(sAbsoluteReferenceFileInfo);
- }
- _aGTA.setRefBuildID(sRefBuildID);
-
- }
- else
- {
- // java file has problems to check for directories, if the given directory doesn't exist.
- String sName = FileHelper.getBasename(_sAbsoluteReferenceFile);
- // thanks to Mircosoft, every document has a suffix, so if a name doesn't have a suffix, it must be a directory name
- int nIdx = sName.indexOf('.');
- if (nIdx == -1)
- {
- // must be a directory
- throw new ConvWatchCancelException("createPostscriptStartCheck: Given reference directory: '" + _sAbsoluteReferenceFile + "' does not exist.");
- }
- }
-
-
- boolean bAbsoluteReferenceFile = true;
- if (! FileHelper.exists(_sAbsoluteReferenceFile))
- {
- if (_aGTA.createDefaultReference())
- {
- GlobalLogWriter.get().println("Reference File doesn't exist, will create a default");
- bAbsoluteReferenceFile = false;
- }
- else
- {
- throw new ConvWatchCancelException("createPostscriptStartCheck: Given reference file: " + _sAbsoluteReferenceFile + " does not exist.");
- }
- }
-
- FileHelper.makeDirectories("", _sOutputPath);
-
- String sAbsoluteInputFileURL = URLHelper.getFileURLFromSystemPath(_sAbsoluteInputFile);
-
- String sInputFile = FileHelper.getBasename(_sAbsoluteInputFile);
-
- FileHelper.getNameNoSuffix(sInputFile);
-
-
- String sAbsoluteOutputFile = _sOutputPath + fs + sInputFile;
- String sAbsoluteOutputFileURL = URLHelper.getFileURLFromSystemPath(sAbsoluteOutputFile);
-
- String sReferenceFile = FileHelper.getBasename(_sAbsoluteReferenceFile);
- String sReferenceFileNoSuffix = FileHelper.getNameNoSuffix(sReferenceFile);
- String sPostScriptFile = sReferenceFileNoSuffix + ".ps";
-
- String sAbsolutePrintFile = _sOutputPath + fs + sPostScriptFile;
- String sAbsolutePrintFileURL = URLHelper.getFileURLFromSystemPath(sAbsolutePrintFile);
-
- // store and print the sAbsoluteInputFileURL file with StarOffice / OpenOffice.org
- OfficePrint.printToFile(_aGTA, sAbsoluteInputFileURL, sAbsoluteOutputFileURL, sAbsolutePrintFileURL);
-
- if (! FileHelper.exists(sAbsolutePrintFile))
- {
- throw new ConvWatchCancelException("createPostscriptStartCheck: Printed file " + sAbsolutePrintFile + " does not exist.");
- }
-
- if (!bAbsoluteReferenceFile)
- {
- // copy AbsolutePrintFile to AbsoluteReferenceFile
- String sDestinationFile = sAbsolutePrintFile; // URLHelper.getSystemPathFromFileURL(...)
- String sSourceFile = _sAbsoluteReferenceFile;
- FileHelper.copy(sDestinationFile, sSourceFile);
- // now the fix reference of the AbsoluteReferenceFile should exist.
- if (! FileHelper.exists(_sAbsoluteReferenceFile))
- {
- throw new ConvWatchCancelException("createPostscriptStartCheck: Given reference file: " + _sAbsoluteReferenceFile + " does not exist, after try to copy.");
- }
- }
-
- PRNCompare a = new PRNCompare();
- String sReferencePath = FileHelper.getPath(_sAbsoluteReferenceFile);
-
- a.setReferencePath( sReferencePath );
- a.setOutputPath( _sOutputPath );
- a.setReferenceFile( sReferenceFile );
- a.setPostScriptFile(sPostScriptFile );
- if (_aGTA.printAllPages())
- {
- a.setMaxPages(9999);
- }
- else
- {
- if (_aGTA.getMaxPages() > 0)
- {
- a.setMaxPages(_aGTA.getMaxPages());
- }
- if (_aGTA.getOnlyPages().length() != 0)
- {
- // we can't interpret the string of getOnlyPages() right without much logic, so print all pages here!
- a.setMaxPages(9999);
- }
- }
-
- a.setResolutionInDPI(_aGTA.getResolutionInDPI());
- a.setBorderMove(_aGTA.getBorderMove());
- a.setDocumentType(_aGTA.getDocumentType());
-
- StatusHelper[] aList = a.compare();
-
- _aGTA.setBorderMove(a.getBorderMove());
- return aList;
- }
-
-
- // This creates a status for exact on document
- private static boolean createINIStatus(StatusHelper[] aList, String _sFilenamePrefix, String _sOutputPath, String _sAbsoluteInputFile, String _sBuildID, String _sRefBuildID)
- {
- System.getProperty("file.separator");
- String sBasename = FileHelper.getBasename(_sAbsoluteInputFile);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
-// TODO: version info was fine
-// HTMLoutput.checkSection(sBasename);
- // Status end
-
- String sINIFile = _sFilenamePrefix + sNameNoSuffix + ".ini";
- INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile);
- INIoutput.createHeader();
-// TODO: version info was fine
-
- INIoutput.writeSection("global");
- INIoutput.writeValue("pages", String.valueOf(aList.length));
- INIoutput.writeValue("buildid", _sBuildID);
- INIoutput.writeValue("refbuildid", _sRefBuildID);
- INIoutput.writeValue("diffdiff", "no");
- INIoutput.writeValue("basename", sBasename);
-
- boolean bResultIsOk = true; // result over all pages
- for (int i=0;i<aList.length; i++)
- {
- INIoutput.writeSection("page" + (i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1)
- aList[i].printStatus();
-
- boolean bCurrentResult = true; // result over exact one page
-
- int nCurrentDiffStatus = aList[i].nDiffStatus;
-
- // check if the status is in a defined range
- if (nCurrentDiffStatus == StatusHelper.DIFF_NO_DIFFERENCES)
- {
- // ok.
- }
- else if (nCurrentDiffStatus == StatusHelper.DIFF_DIFFERENCES_FOUND && aList[i].nPercent < 5)
- {
- // ok.
- }
- else if (nCurrentDiffStatus == StatusHelper.DIFF_AFTER_MOVE_DONE_NO_PROBLEMS)
- {
- // ok.
- }
- else if (nCurrentDiffStatus == StatusHelper.DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND && aList[i].nPercent2 < 5)
- {
- // ok.
- }
- else
- {
- // failed.
- bCurrentResult = false; // logic: nDiff==0 = true if there is no difference
- }
-
- // Status
- INIoutput.checkLine(aList[i], bCurrentResult);
- bResultIsOk &= bCurrentResult;
- }
- // Status
- INIoutput.close();
- return bResultIsOk;
- }
-
-
-
- private static void createINIStatus_DiffDiff(StatusHelper[] aDiffDiffList, String _sFilenamePrefix, String _sOutputPath, String _sAbsoluteInputFile, String _sBuildID)
- {
- System.getProperty("file.separator");
- String sBasename = FileHelper.getBasename(_sAbsoluteInputFile);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
- String sINIFile = _sFilenamePrefix + sNameNoSuffix + ".ini";
-
- INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile);
- INIoutput.createHeader();
- // LLA? what if the are no values in the list? true or false;
- INIoutput.writeSection("global");
- INIoutput.writeValue("pages", String.valueOf(aDiffDiffList.length));
- INIoutput.writeValue("buildid", _sBuildID);
- INIoutput.writeValue("diffdiff", "yes");
- INIoutput.writeValue("basename", sBasename);
-
- for (int i=0;i<aDiffDiffList.length; i++)
- {
- INIoutput.writeSection("page" + (i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1)
- boolean bCurrentResult = (aDiffDiffList[i].nDiffStatus == StatusHelper.DIFF_NO_DIFFERENCES); // logic: nDiff==0 = true if there is no difference
-
- INIoutput.checkDiffDiffLine(aDiffDiffList[i], bCurrentResult);
- }
- // Status
- INIoutput.close();
- }
-
-
-
-
- public static boolean check(GraphicalTestArguments _aGTA,
- String _sOutputPath, String _sAbsoluteInputFile, String _sAbsoluteReferenceFile)
- throws ConvWatchCancelException, ConvWatchException
- {
- ConvWatch a = new ConvWatch();
- StatusHelper[] aList = a.createPostscriptStartCheck(_aGTA, _sOutputPath, _sAbsoluteInputFile, _sAbsoluteReferenceFile);
- DB.writeNumberOfPages(aList.length);
-
- boolean bResultIsOk = createINIStatus(aList, "", _sOutputPath, _sAbsoluteInputFile, _aGTA.getBuildID(), _aGTA.getRefBuildID());
-
- if (! bResultIsOk)
- {
- // it could be that this will store in a DB, there are problems with '\'
- String sErrorMessage = "Graphical compare failed with file ";
- String sErrorFile = _sAbsoluteInputFile.replace('\\', '/');
- sErrorMessage = sErrorMessage + "'" + sErrorFile + "'";
- DB.writeErrorFile(sErrorFile);
- throw new ConvWatchException(sErrorMessage);
- }
- return bResultIsOk;
- }
-
-
- public static boolean checkDiffDiff(GraphicalTestArguments _aGTA,
- String _sOutputPath, String _sAbsoluteInputFile, String _sAbsoluteReferenceFile,
- String _sAbsoluteDiffPath)
- throws ConvWatchCancelException, ConvWatchException
- {
- ConvWatch a = new ConvWatch();
- _aGTA.setBorderMove(TriState.FALSE);
- StatusHelper[] aList = a.createPostscriptStartCheck(_aGTA, _sOutputPath, _sAbsoluteInputFile, _sAbsoluteReferenceFile);
-
- createINIStatus(aList, "", _sOutputPath, _sAbsoluteInputFile, _aGTA.getBuildID(), _aGTA.getRefBuildID());
-
- StatusHelper[] aDiffDiffList = new StatusHelper[aList.length];
-
- String fs = System.getProperty("file.separator");
-
- boolean bDiffIsOk = true;
- boolean bFoundAOldDiff = false;
-
- PRNCompare aCompare = new PRNCompare();
- // LLA? what if the are no values in the list? true or false;
- for (int i=0;i<aList.length; i++)
- {
- String sOrigDiffName = aList[i].m_sDiffGfx;
- String sDiffBasename = FileHelper.getBasename(sOrigDiffName);
-
- String sNewDiffName = _sAbsoluteDiffPath + fs + sDiffBasename;
- if (! FileHelper.exists(sNewDiffName))
- {
- GlobalLogWriter.get().println("checkDiffDiff: Old diff file: '" + sNewDiffName + "' does not exist." );
- continue;
- }
-
- // make a simple difference between these both diff files.
- String sSourcePath1 = FileHelper.getPath(sOrigDiffName);
- String sSourceFile1 = sDiffBasename;
- String sSourcePath2 = _sAbsoluteDiffPath;
- String sSourceFile2 = sDiffBasename;
-
- StatusHelper aCurrentStatus = aCompare.checkDiffDiff(_sOutputPath, sSourcePath1, sSourceFile1, sSourcePath2, sSourceFile2);
- boolean bCurrentResult = (aCurrentStatus.nDiffStatus == StatusHelper.DIFF_NO_DIFFERENCES); // logic: nDiff==0 = true if there is no difference
- bDiffIsOk &= bCurrentResult;
- bFoundAOldDiff = true;
-
- aDiffDiffList[i] = aCurrentStatus;
- }
-
- createINIStatus_DiffDiff(aDiffDiffList, "DiffDiff_", _sOutputPath, _sAbsoluteInputFile, _aGTA.getBuildID());
-
- if (!bFoundAOldDiff)
- {
- throw new ConvWatchCancelException("No old difference file found." );
- }
- if (! bDiffIsOk)
- {
- throw new ConvWatchException("Graphical difference compare failed with file '" + _sAbsoluteInputFile + "'");
- }
- return bDiffIsOk;
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/ConvWatchCancelException.java b/qadevOOo/runner/convwatch/ConvWatchCancelException.java
deleted file mode 100644
index f360293e18f3..000000000000
--- a/qadevOOo/runner/convwatch/ConvWatchCancelException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class ConvWatchCancelException extends ConvWatchException
-{
- public ConvWatchCancelException(String _aMessage)
- {
- super(_aMessage);
- }
-
- public ConvWatchCancelException(String _aMessage, Throwable cause)
- {
- super(_aMessage, cause);
- }
-}
diff --git a/qadevOOo/runner/convwatch/ConvWatchException.java b/qadevOOo/runner/convwatch/ConvWatchException.java
deleted file mode 100644
index efd1e67e3dc9..000000000000
--- a/qadevOOo/runner/convwatch/ConvWatchException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class ConvWatchException extends Exception
-{
- public ConvWatchException(String _aMessage)
- {
- super(_aMessage);
- }
-
- public ConvWatchException(String _aMessage, Throwable cause)
- {
- super(_aMessage, cause);
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/ConvWatchStarter.java b/qadevOOo/runner/convwatch/ConvWatchStarter.java
deleted file mode 100644
index d6a4cca1e1aa..000000000000
--- a/qadevOOo/runner/convwatch/ConvWatchStarter.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.util.ArrayList;
-import java.io.File;
-import java.io.FileFilter;
-
-import com.sun.star.lang.XMultiServiceFactory;
-
-import helper.OfficeProvider;
-import helper.OfficeWatcher;
-import helper.OSHelper;
-
-/**
- * The following Complex Test will test
- * an already created document and it's postscript output (by an older office version)
- * with a new office version.
- * This test use Ghostscript for the jpeg export and graphically compare tools from ImageMagick.
- * Read the manual for more information.
- *
- * this is only the starter program
- * more is found in qadevOOo/runner/convwatch/*
- */
-
-public class ConvWatchStarter extends EnhancedComplexTestCase
-{
- // The first of the mandatory functions:
-
- // The second of the mandatory functions: return all test methods as an
- // array. There is only one test function in this example.
- /**
- * Return all test methods.
- * @return The test methods.
- */
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"compareGraphicalDiffs"};
- }
-
- String m_sInputPath = "";
- String m_sReferencePath = "";
- String m_sOutputPath = "";
- String m_sDiffPath = null;
-
- private void initMember()
- {
- // MUST PARAMETER
- // INPUTFILE ----------
- String sINPATH = (String)param.get( PropertyName.DOC_COMPARATOR_INPUT_PATH );
- boolean bQuit = false;
- if (sINPATH == null || sINPATH.length() == 0)
- {
- log.println("Please set input path (path to documents) " + PropertyName.DOC_COMPARATOR_INPUT_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_INPUT_PATH + " " + sINPATH);
- m_sInputPath = sINPATH;
- }
-
- // REFERENCE_PATH ----------
- String sREF = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_PATH );
- if (sREF == null || sREF.length() == 0)
- {
- log.println("Assumtion, reference directory and input directory are the same.");
- m_sReferencePath = m_sInputPath;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + " " + sREF);
- m_sReferencePath = sREF;
- }
-
- // OUTPUT_PATH ----------
- String sOUT = (String)param.get( PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
- if (sOUT == null || sOUT.length() == 0)
- {
- log.println("Please set output path (path to a temp directory) " + PropertyName.DOC_COMPARATOR_OUTPUT_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_OUTPUT_PATH + " " + sOUT);
- m_sOutputPath = sOUT;
- }
-
- if (bQuit)
- {
- assure("Must quit", false);
- }
-
-
- // DIFF_PATH ----------
- String sDIFF = (String)param.get( PropertyName.DOC_COMPARATOR_DIFF_PATH );
- if (sDIFF == null || sDIFF.length() == 0)
- {
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_DIFF_PATH + " " + sDIFF);
- m_sDiffPath = sDIFF;
- }
-
- if (m_sInputPath.startsWith("file:") ||
- m_sReferencePath.startsWith("file:") ||
- m_sOutputPath.startsWith("file:"))
- {
- assure("We can't handle file: URL right, use system path instead.", false);
- }
-
- }
-
-
- /**
- *
- * @return a List of software which must accessible as an external executable
- */
- @Override
- protected String[] mustInstalledSoftware()
- {
- ArrayList<String> aList = new ArrayList<String>();
- // Tools from ImageMagick
- if (! OSHelper.isWindows())
- {
- aList.add( "composite -version" );
- aList.add( "identify -version" );
-
- // Ghostscript
- aList.add( "gs -version" );
- }
- else
- {
- aList.add( "composite.exe -version" );
- aList.add( "identify.exe -version" );
-
- // Ghostscript
- aList.add( "gswin32c.exe -version" );
- }
-
- return aList.toArray(new String[aList.size()]);
- }
-
-
- /**
- * The test method itself.
- * Don't try to call it from outside, it is started only from qadevOOo runner
- */
-
- /* protected */
- public void compareGraphicalDiffs()
- {
- GlobalLogWriter.set(log);
- String sDBConnection = (String)param.get( PropertyName.DB_CONNECTION_STRING );
- // check if all need software is installed and accessible
- checkEnvironment(mustInstalledSoftware());
-
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
- if (aGTA == null)
- {
- assure("Must quit", false);
- }
- if (aGTA.cancelRequest())
- {
- return;
- }
-
- initMember();
-
- aGTA.allowStore();
-
- String sBuildID = aGTA.getBuildID();
- log.println("Current Office has buildid: " + sBuildID);
-
- String fs = System.getProperty("file.separator");
-
- String sHTMLName = "index.html";
- File aInputPathTest = new File(m_sInputPath);
- if (!aInputPathTest.isDirectory())
- {
- int n = m_sInputPath.lastIndexOf(fs);
- sHTMLName = m_sInputPath.substring(n + 1);
- sHTMLName += ".html";
- }
- HTMLOutputter HTMLoutput = HTMLOutputter.create(m_sOutputPath, sHTMLName);
- HTMLoutput.header( m_sOutputPath );
- HTMLoutput.indexSection( m_sOutputPath );
- LISTOutputter LISToutput = LISTOutputter.create(m_sOutputPath, "allfiles.txt");
-
- DB.init(aGTA.getDBInfoString() + "," + sDBConnection);
-
- File aInputPath = new File(m_sInputPath);
- if (aInputPath.isDirectory())
- {
- // check a whole directory
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilter();
-
- Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories());
- if (aList.length == 0)
- {
- log.println("Nothing to do, there are no document files found.");
- }
- else
- {
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
- log.println("- next file is: ------------------------------");
- log.println(sEntry);
-
- String sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, m_sInputPath);
-
- String sNewReferencePath = m_sReferencePath;
- String sNewOutputPath = m_sOutputPath;
- String sNewDiffPath = m_sDiffPath;
- if (sNewSubDir.length() > 0)
- {
- if (sNewReferencePath != null)
- sNewReferencePath = sNewReferencePath + fs + sNewSubDir;
-
- sNewOutputPath = sNewOutputPath + fs + sNewSubDir;
- if (sNewDiffPath != null)
- sNewDiffPath = sNewDiffPath + fs + sNewSubDir;
- }
-
- if (aGTA.checkIfUsableDocumentType(sEntry))
- {
- runGDCWithStatus(HTMLoutput, LISToutput, sEntry, sNewOutputPath, sNewReferencePath, sNewDiffPath, sNewSubDir);
- }
- if (aGTA.cancelRequest())
- {
- break;
- }
- }
- }
- }
- else
- {
- // check exact name
- if (aGTA.checkIfUsableDocumentType(m_sInputPath))
- {
- runGDCWithStatus(HTMLoutput, LISToutput, m_sInputPath, m_sOutputPath, m_sReferencePath, m_sDiffPath, "");
- }
- }
-
- LISToutput.close();
- HTMLoutput.close();
- log.println("The file '" + HTMLoutput.getFilename() + "' shows a html based status.");
- DB.writeHTMLFile(HTMLoutput.getFilename());
- }
-
-
-
- void runGDCWithStatus(HTMLOutputter _aHTMLoutput, LISTOutputter _aLISToutput, String _sInputFile, String _sOutputPath, String _sReferencePath, String _sDiffPath, String _sNewSubDir )
- {
- // start a fresh Office
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
-
- OfficeProvider aProvider = null;
- if (aGTA.shouldOfficeStart())
- {
- aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
- aProvider = new OfficeProvider();
- XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
- param.put("ServiceFactory", xMSF);
- aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);
-
- long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
- aGTA = getGraphicalTestArguments(); // get new TestArguments
- aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
- }
-
- // 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");
- OfficeWatcher aWatcher = (OfficeWatcher)param.get("Watcher");
- GlobalLogWriter.get().setWatcher(aWatcher);
-
- String sStatusRunThrough = "";
- String sStatusMessage = "";
- try
- {
- DB.destination_start();
- // better was:
- // load document
- // create postscript from document
- // check file
- GraphicalDifferenceCheck.checkOneFile(_sInputFile, _sOutputPath, _sReferencePath, _sDiffPath, aGTA);
- sStatusRunThrough = "PASSED, OK";
- DB.destination_finished();
- }
- catch(ConvWatchCancelException e)
- {
- assure(e.getMessage(), false, true);
- sStatusRunThrough = "CANCELLED, FAILED";
- sStatusMessage = e.getMessage();
- DB.destination_failed(sStatusRunThrough, sStatusMessage);
- }
- catch(ConvWatchException e)
- {
- assure(e.getMessage(), false, true);
- sStatusMessage = e.getMessage();
- sStatusRunThrough = "PASSED, FAILED";
- DB.destination_failed(sStatusRunThrough, sStatusMessage);
- }
- catch(com.sun.star.lang.DisposedException e)
- {
- assure(e.getMessage(), false, true);
- sStatusMessage = e.getMessage();
- sStatusRunThrough = "FAILED, FAILED";
- DB.destination_failed(sStatusRunThrough, sStatusMessage);
- }
-
- GlobalLogWriter.get().println("Watcher count is: " + aWatcher.getPing());
-
- // Office shutdown
- if (aProvider != null)
- {
- aProvider.closeExistingOffice(param, true);
- }
-
- // -------------------- Status --------------------
- String fs = System.getProperty("file.separator");
- String sBasename = FileHelper.getBasename(_sInputFile);
- String sFilenameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
-
- // -------------------- List of all files -----------------
- String sListFile;
- if (_sNewSubDir.length() > 0)
- {
- sListFile = _sNewSubDir + fs + sFilenameNoSuffix + ".ini";
- }
- else
- {
- sListFile = sFilenameNoSuffix + ".ini";
- }
- _aLISToutput.writeValue(sListFile);
-
- // -------------------- HTML --------------------
- String sLink;
- String sLinkDD;
- String sLinkName;
- String sLinkDDName;
- String sHTMLPrefix = aGTA.getHTMLOutputPrefix();
-
- GlobalLogWriter.get().println("----------------------------------------------------------------------");
- GlobalLogWriter.get().println(" OutputPath: " + _sOutputPath);
- GlobalLogWriter.get().println(" NewPath: " + _sNewSubDir);
- GlobalLogWriter.get().println("----------------------------------------------------------------------");
-
- sLink = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + sFilenameNoSuffix + ".ini";
- sLinkDD = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + "DiffDiff_" + sFilenameNoSuffix + ".ini";
- sLinkName = sFilenameNoSuffix;
- sLinkDDName = sFilenameNoSuffix + " (DiffDiff)";
-
- if (_sDiffPath != null && _sDiffPath.length() > 0)
- {
- _aHTMLoutput.indexLine( sLinkDD, sLinkDDName, sLink, sLinkName, sStatusRunThrough, sStatusMessage );
- }
- else
- {
- _aHTMLoutput.indexLine( sLink, sLinkName, "", "", sStatusRunThrough, sStatusMessage );
- }
-
- }
-
-
-}
diff --git a/qadevOOo/runner/convwatch/CrashLoopTest.java b/qadevOOo/runner/convwatch/CrashLoopTest.java
deleted file mode 100644
index 015314980d14..000000000000
--- a/qadevOOo/runner/convwatch/CrashLoopTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class CrashLoopTest extends ReferenceBuilder
-{
- // The first of the mandatory functions:
- /**
- * Return the name of the test.
- * In this case it is the actual name of the service.
- * @return The tested service.
- */
- @Override
- public String getTestObjectName() {
- return "CrashLoopTest runner";
- }
-
- // The second of the mandatory functions: return all test methods as an
- // array. There is only one test function in this example.
- /**
- * Return all test methods.
- * @return The test methods.
- */
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"testcrashandloops"};
- }
-
- public void testcrashandloops()
- {
- buildreference();
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/DB.java b/qadevOOo/runner/convwatch/DB.java
index 8b4c4ff006cf..a9b2f70763c2 100644
--- a/qadevOOo/runner/convwatch/DB.java
+++ b/qadevOOo/runner/convwatch/DB.java
@@ -20,7 +20,6 @@ package convwatch;
import java.sql.Connection;
import java.util.StringTokenizer;
-import java.util.ArrayList;
import helper.OSHelper;
public class DB extends DBHelper
@@ -54,70 +53,6 @@ public class DB extends DBHelper
getDB().updatestate_status("source started");
}
- public static void test()
- {
- getDB().sql_test();
- }
-
- public static void source_start()
- {
- getDB().updatestate_status("source started");
- }
-
- public static void source_finished()
- {
- getDB().updatestate_status( "source finished");
- }
-
- public static void source_failed(String _sMessage)
- {
- getDB().updatestate_status("source failed");
- getDB().updateinfo_status(_sMessage);
- }
-
- public static void destination_start()
- {
- getDB().updatestate_status("destination started");
- }
-
- public static void destination_finished()
- {
- getDB().updatestate_status("PASSED-OK");
- }
-
- public static void destination_failed(String _sStatus, String _sMessage)
- {
- getDB().updatestate_status(_sStatus);
- getDB().updateinfo_status(_sMessage);
- }
- public static void writeNumberOfPages(int _nPages)
- {
- getDB().updatepagecount_documents(_nPages);
- }
- public static void writeErrorFile(String _sErrorFile)
- {
- getDB().updateerrorfile_status(_sErrorFile);
- }
- public static void writeHTMLFile(String _sHTMLFile)
- {
- getDB().updatehtmlfile_status(_sHTMLFile);
- }
-
- public static void writeToDB(String _sFilename,
- String _sBasename,
- String _sFileFormat,
- String _sBuildID,
- String _sSourceType,
- int _nResolution )
- {
- GlobalLogWriter.get().println("DB: Filename:" + _sFilename);
- GlobalLogWriter.get().println("DB: Basename:" + _sBasename);
- GlobalLogWriter.get().println("DB: FileFormat:" + _sFileFormat);
- GlobalLogWriter.get().println("DB: BuildID:" + _sBuildID);
- GlobalLogWriter.get().println("DB: SourceType:" + _sSourceType);
- GlobalLogWriter.get().println("DB: Resolution:" + _nResolution);
- }
-
private String getEnvironment()
{
if (OSHelper.isWindows())
@@ -203,86 +138,6 @@ public class DB extends DBHelper
}
}
- private void sql_test()
- {
- String sUUID = getDBDistinct();
- System.out.println("UUID: " + sUUID);
- }
-
- private ArrayList<String> QuerySQL(Connection _aCon, String _sSQL)
- {
- java.sql.Statement oStmt = null;
- ArrayList<String> aResultList = new ArrayList<String>();
- try
- {
- try
- {
- oStmt = _aCon.createStatement();
- java.sql.ResultSet aResultSet = null;
- try
- {
- aResultSet = oStmt.executeQuery(_sSQL);
- java.sql.ResultSetMetaData aResultSetMetaData = aResultSet.getMetaData();
-
- int nColumnCount = aResultSetMetaData.getColumnCount(); // java sql starts with '1'
-
- while( aResultSet.next() )
- {
- StringBuffer aResult = new StringBuffer();
- try
- {
- aResult.append("sqlresult: ");
- for (int i=1;i<=nColumnCount;i++)
- {
- String sColumnName = aResultSetMetaData.getColumnName(i);
- aResult.append(sColumnName).append("=");
- String sValue;
- int nSQLType = aResultSetMetaData.getColumnType(i);
- switch(nSQLType)
- {
- case java.sql.Types.VARCHAR:
- sValue = "'" + aResultSet.getString(i) + "'";
- break;
- case java.sql.Types.INTEGER:
- {
- int nValue = aResultSet.getInt(i);
- sValue = String.valueOf(nValue);
- break;
- }
-
- default:
- sValue = "UNSUPPORTED TYPE";
- }
- aResult.append(sValue).append(", ");
- }
- String sResult = aResult.toString();
- aResultList.add(sResult);
- }
- catch (java.sql.SQLException e)
- {
- }
- }
- }
- finally
- {
- if (aResultSet != null)
- aResultSet.close();
- }
- }
- finally
- {
- if (oStmt != null)
- oStmt.close();
- }
- }
- catch (java.sql.SQLException e)
- {
- String sError = e.getMessage();
- GlobalLogWriter.get().println("DB: Original SQL error: " + sError);
- }
- return aResultList;
- }
-
private void updatestate_status(String _sStatus)
{
Connection aCon = new ShareConnection().getConnection();
@@ -294,43 +149,6 @@ public class DB extends DBHelper
SQLupdateValue( aCon, "status", sSet, sWhere );
}
}
- private void updateinfo_status(String _sInfo)
- {
- Connection aCon = new ShareConnection().getConnection();
-
- String sSet = "info=" + Quote(_sInfo);
- String sWhere = getWhereClause();
- SQLupdateValue( aCon, "status", sSet, sWhere );
- }
- private void updateerrorfile_status(String _sErrorFile)
- {
- Connection aCon = new ShareConnection().getConnection();
-
- String sErrorFile = _sErrorFile.replace('\\', '/');
-
- String sSet = "errorfile=" + Quote(sErrorFile);
- String sWhere = getWhereClause();
- SQLupdateValue( aCon, "status", sSet, sWhere );
- }
- private void updatehtmlfile_status(String _sHtmlFile)
- {
- Connection aCon = new ShareConnection().getConnection();
-
- String sHtmlFile = _sHtmlFile.replace('\\', '/');
-
- String sSet = "htmlfile=" + Quote(sHtmlFile);
- String sWhere = getWhereClause();
- SQLupdateValue( aCon, "status", sSet, sWhere );
- }
- private void updatepagecount_documents(int _nPageCount)
- {
- Connection aCon = new ShareConnection().getConnection();
-
- String sSet = "pagecount=" + _nPageCount;
- String sWhere = getWhereClause();
- SQLupdateValue( aCon, "documents", sSet, sWhere );
-
- }
private String getWhereClause()
@@ -353,76 +171,4 @@ public class DB extends DBHelper
return aWhereClause.toString();
}
- private String getDBDistinct()
- {
- Connection aCon = new ShareConnection().getConnection();
-
- String sSQL = "SELECT uuid()";
- ArrayList<String> aResultList = QuerySQL(aCon, sSQL);
-
- for (int i=0;i<aResultList.size();i++)
- {
- String sResult = aResultList.get(i);
-
- StringTokenizer aTokenizer = new StringTokenizer(sResult,",",false);
- if (aTokenizer.hasMoreTokens())
- {
- String sToken = aTokenizer.nextToken();
- int nIndex = sToken.indexOf("uuid()=");
- int nIndexTuettel = sToken.indexOf('\'', nIndex);
- int nIndexTuettel2 = sToken.lastIndexOf('\'');
- String sUuid = sToken.substring(nIndexTuettel + 1, nIndexTuettel2);
- return sUuid;
- }
- }
-
- return "0";
- }
-
- public static void insertinto_documentcompare(String _sSourceVersion, String _sSourceName, String _sSourceCreatorType,
- String _sDestinationVersion, String _sDestinationName, String _sDestinationCreatorType,
- String _sDocumentPoolDir, String _sDocumentPoolName, String _sMailAddress,
- String _sSpecial, String _sParentDistinct)
- {
- getDB().insertinto_documentcompare_impl( _sSourceVersion, _sSourceName, _sSourceCreatorType,
- _sDestinationVersion, _sDestinationName, _sDestinationCreatorType,
- _sDocumentPoolDir, _sDocumentPoolName, _sMailAddress,
- _sSpecial, _sParentDistinct);
- }
-
- private void insertinto_documentcompare_impl(String _sSourceVersion, String _sSourceName, String _sSourceCreatorType,
- String _sDestinationVersion, String _sDestinationName, String _sDestinationCreatorType,
- String _sDocumentPoolDir, String _sDocumentPoolName, String _sMailAddress,
- String _sSpecial, String _sParentDistinct)
- {
- // $sSQLInsert = "INSERT INTO documentcompare
- if (_sParentDistinct == null)
- {
- _sParentDistinct = "";
- }
-
- Connection aCon = new ShareConnection().getConnection();
-
- String sValueLine="dbdistinct2, environment, sourceversion, sourcename, sourcecreatortype, destinationversion, destinationname, destinationcreatortype, documentpoolpath, documentpool, mailfeedback, state, special, parentdistinct, startdate";
- String sDocumentPoolDir = _sDocumentPoolDir.replace('\\', '/');
- StringBuffer aDataLine = new StringBuffer();
- aDataLine.append( Quote(getDBDistinct()) ) . append( sComma ) .
- append( Quote( getEnvironment()) ) . append( sComma ) .
- append( Quote( _sSourceVersion) ) . append( sComma ) .
- append( Quote( _sSourceName) ) . append( sComma ) .
- append( Quote( _sSourceCreatorType ) ) . append( sComma ) .
- append( Quote( _sDestinationVersion) ) . append( sComma ) .
- append( Quote( _sDestinationName) ) . append( sComma ) .
- append( Quote( _sDestinationCreatorType ) ) . append( sComma ) .
- append( Quote( sDocumentPoolDir) ) . append( sComma ) .
- append( Quote( _sDocumentPoolName) ) . append( sComma ) .
- append( Quote( _sMailAddress) ) . append( sComma ) .
- append( Quote( "new" )) . append ( sComma ) .
- append( Quote( _sSpecial ) ) . append( sComma ) .
- append( Quote( _sParentDistinct ) ) . append( sComma ) .
- append( Quote( today() ));
-
- SQLinsertValues(aCon, "documentcompare", sValueLine, aDataLine.toString());
- }
-
}
diff --git a/qadevOOo/runner/convwatch/DBHelper.java b/qadevOOo/runner/convwatch/DBHelper.java
index dc76af3ad9d2..34e1e1cfdeee 100644
--- a/qadevOOo/runner/convwatch/DBHelper.java
+++ b/qadevOOo/runner/convwatch/DBHelper.java
@@ -93,28 +93,6 @@ class ShareConnection
public class DBHelper
{
- /**
- * This method inserts given values into<br>
- * the table 'states'
- * @param values a set of comma separated values to be inserted
- */
-
- public void SQLinsertValues(Connection _aCon, String _sTableName, String value_names, String values)
- {
- if (_aCon == null)
- {
- GlobalLogWriter.get().println("DB: ERROR: in SQLinsertValues, connection not established.");
- return;
- }
-
- StringBuffer aInsertStr = new StringBuffer();
-
- aInsertStr.append( "INSERT INTO " ) . append( _sTableName );
- aInsertStr.append( " (").append( value_names ).append ( ")" );
- aInsertStr.append(" VALUES (" ).append( values ).append( ")" );
- ExecSQL(_aCon, aInsertStr.toString() );
- }
-
public void SQLupdateValue(Connection _aCon, String _sTableName, String _sSet, String _sWhere)
{
if (_aCon == null)
@@ -205,13 +183,6 @@ public class DBHelper
return ts + _sToQuote + ts;
}
-/* default date format in the MySQL DB yyyy-MM-dd */
- public static String today()
- {
- return DateHelper.getDateString("yyyy-MM-dd");
- }
-
- public static final String sComma = ",";
public static final String sEqual = "=";
public static final String sAND = " AND ";
diff --git a/qadevOOo/runner/convwatch/DateHelper.java b/qadevOOo/runner/convwatch/DateHelper.java
deleted file mode 100644
index bef0a09e7a1c..000000000000
--- a/qadevOOo/runner/convwatch/DateHelper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.text.SimpleDateFormat;
-import java.util.GregorianCalendar;
-import java.text.FieldPosition;
-import java.util.Locale;
-
-public class DateHelper
-{
- public static String getDateTimeForFilename()
- {
- return getDateString("yyyyMMdd-HHmmss");
- }
-
- public static String getDateTimeForHumanreadableLog()
- {
- return getDateString("[yyyy/MM/dd hh:mm:ss]");
- }
-
- public static String getDateString(String _sFormat)
- {
- GregorianCalendar aCalendar = new GregorianCalendar();
- StringBuffer aBuf = new StringBuffer();
-
- Locale aLocale = new Locale("en","US");
- SimpleDateFormat aFormat = new SimpleDateFormat(_sFormat, aLocale);
- aBuf = aFormat.format(aCalendar.getTime(), aBuf, new FieldPosition(0) );
- return aBuf.toString();
- }
-}
diff --git a/qadevOOo/runner/convwatch/DirectoryHelper.java b/qadevOOo/runner/convwatch/DirectoryHelper.java
deleted file mode 100644
index 9d322c52fb5e..000000000000
--- a/qadevOOo/runner/convwatch/DirectoryHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-
-/**
- * Helper for directory access
- */
-public class DirectoryHelper
-{
- private final ArrayList<String> m_aFileList = new ArrayList<String>();
- private boolean m_bRecursiveIsAllowed = true;
-
- private void setRecursiveIsAllowed(boolean _bValue)
- {
- m_bRecursiveIsAllowed = _bValue;
- }
-
- /**
- * Traverse over a given directory, and filter with a given FileFilter
- * object and gives back the deep directory as a Object[] list, which
- * contain a String object for every directory entry.
- *
- * <B>Example</B>
- * List directory /bin, filter out all files which ends with '.prn'
- *
- * FileFilter aFileFilter = new FileFilter()
- * {
- * public boolean accept( File pathname )
- * {
- * if (pathname.getName().endsWith(".prn"))
- * {
- * return false;
- * }
- * return true;
- * }
- * };
- *
- * Object[] aList = DirectoryHelper.traverse("/bin", aFileFilter);
- * for (int i=0;i<aList.length;i++)
- * {
- * String aEntry = (String)aList[i];
- * System.out.println(aEntry);
- * }
- *
- */
- public static Object[] traverse( String _sDirectory, FileFilter _aFileFilter, boolean _bRecursiveIsAllowed )
- {
- DirectoryHelper a = new DirectoryHelper();
- a.setRecursiveIsAllowed(_bRecursiveIsAllowed);
- a.traverse_impl(_sDirectory, _aFileFilter);
- return a.m_aFileList.toArray();
- }
-
-
-
- private void traverse_impl( String afileDirectory, FileFilter _aFileFilter )
- {
- File fileDirectory = new File(afileDirectory);
- // Testing, if the file is a directory, and if so, it throws an exception
- if ( !fileDirectory.isDirectory() )
- {
- throw new IllegalArgumentException( "not a directory: " + fileDirectory.getName() );
- }
-
- // Getting all files and directories in the current directory
- File[] aDirEntries;
- if (_aFileFilter != null)
- {
- aDirEntries = fileDirectory.listFiles(_aFileFilter);
- }
- else
- {
- aDirEntries = fileDirectory.listFiles();
- }
-
- // Iterating for each file and directory
- for ( int i = 0; i < aDirEntries.length; ++i )
- {
- if ( aDirEntries[ i ].isDirectory() )
- {
- if (m_bRecursiveIsAllowed)
- {
- // Recursive call for the new directory
- traverse_impl( aDirEntries[ i ].getAbsolutePath(), _aFileFilter );
- }
- }
- else
- {
- // adding file to List
- try
- {
- // Composing the URL by replacing all backslashs
- String aStr = aDirEntries[ i ].getAbsolutePath();
- m_aFileList.add(aStr);
- }
- catch( Exception exception )
- {
- exception.printStackTrace();
- break;
- }
- }
- }
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/DocumentConverter.java b/qadevOOo/runner/convwatch/DocumentConverter.java
deleted file mode 100644
index a3d930de91ea..000000000000
--- a/qadevOOo/runner/convwatch/DocumentConverter.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-
-import com.sun.star.lang.XMultiServiceFactory;
-
-import helper.OfficeProvider;
-
-/**
- * The following Complex Test will test
- * an already created document and it's postscript output (by an older office version)
- * with a new office version.
- * This test use Ghostscript for the jpeg export and graphically compare tools from ImageMagick.
- * Read the manual for more information.
- *
- * this is only the starter program
- * more is found in qadevOOo/runner/convwatch/*
- */
-
-public class DocumentConverter extends EnhancedComplexTestCase
-{
- // The first of the mandatory functions:
- /**
- * Return the name of the test.
- * In this case it is the actual name of the service.
- * @return The tested service.
- */
- @Override
- public String getTestObjectName() {
- return "DocumentConverter runner";
- }
-
- // The second of the mandatory functions: return all test methods as an
- // array. There is only one test function in this example.
- /**
- * Return all test methods.
- * @return The test methods.
- */
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"convert"};
- }
-
- // This test is fairly simple, so there is no need for before() or after()
- // methods.
-
- public void before()
- {
- }
-
- public void after()
- {
- }
-
- // The test method itself.
- private String m_sInputPath = "";
- private String m_sReferencePath = "";
- void initMember()
- {
- // MUST PARAMETER
- // INPUT_PATH ----------
- String sINPATH = (String)param.get( PropertyName.DOC_COMPARATOR_INPUT_PATH );
- boolean bQuit = false;
- if (sINPATH == null || sINPATH.length() == 0)
- {
- log.println("Please set input path (path to documents) " + PropertyName.DOC_COMPARATOR_INPUT_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_INPUT_PATH + " " + sINPATH);
- m_sInputPath = sINPATH;
- }
-
- // REFERENCE_PATH ----------
- String sREF = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_PATH );
- if (sREF == null || sREF.length() == 0)
- {
- log.println("Please set output path (path to a directory, where the references should stay) " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + " " + sREF);
- m_sReferencePath = sREF;
- }
-
- if (bQuit)
- {
- assure("Must quit, Parameter problems.", false);
- }
-
- if (m_sInputPath.startsWith("file:") ||
- m_sReferencePath.startsWith("file:"))
- {
- assure("We can't handle file: URL right, use system path instead.", false);
- }
-
- }
-
- /**
- * Function returns a List of software which must accessible as an external executable
- */
- @Override
- protected String[] mustInstalledSoftware()
- {
- ArrayList<String> aList = new ArrayList<String>();
- // aList.add("perl -version");
- return aList.toArray(new String[aList.size()]);
- }
-
- // the test ======================================================================
- public void convert()
- {
- GlobalLogWriter.set(log);
- // check if all need software is installed and accessible
- checkEnvironment(mustInstalledSoftware());
-
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
- if (aGTA == null)
- {
- assure("Must quit", false);
- }
-
- initMember();
-
- File aInputPath = new File(m_sInputPath);
- if (aInputPath.isDirectory())
- {
- String fs = System.getProperty("file.separator");
-
- aInputPath.getAbsolutePath();
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilter();
-
- Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories());
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
-
- String sNewReferencePath = m_sReferencePath + fs + FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, m_sInputPath);
- log.println("- next file is: ------------------------------");
- log.println(sEntry);
-
- if (aGTA.checkIfUsableDocumentType(sEntry))
- {
- runGDC(sEntry, sNewReferencePath);
- }
- if (aGTA.cancelRequest())
- {
- break;
- }
- }
- }
- else
- {
- if (aGTA.checkIfUsableDocumentType(m_sInputPath))
- {
- runGDC(m_sInputPath, m_sReferencePath);
- }
- }
- }
-
- void runGDC(String _sInputFile, String _sReferencePath)
- {
- // first do a check if the reference not already exist, this is a big speedup, due to the fact,
- // we don't need to start a new office.
- GraphicalTestArguments aGTA_local = getGraphicalTestArguments();
- // start a fresh Office
- OfficeProvider aProvider = null;
- if (aGTA_local.restartOffice())
- {
- aProvider = new OfficeProvider();
- XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
- param.put("ServiceFactory", xMSF);
- }
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
-
- if (aGTA.getOfficeProgram().equalsIgnoreCase("msoffice"))
- {
- // ReferenceType is MSOffice
- GlobalLogWriter.get().println("USE MSOFFICE AS EXPORT FORMAT.");
- MSOfficePrint a = new MSOfficePrint();
- try
- {
- String sInputFileBasename = FileHelper.getBasename(_sInputFile);
- String fs = System.getProperty("file.separator");
- FileHelper.makeDirectories("", _sReferencePath);
- String sOutputFile = _sReferencePath;
- if (sOutputFile.endsWith(fs))
- {
- sOutputFile += sInputFileBasename;
- }
- else
- {
- sOutputFile += fs + sInputFileBasename;
- }
-
- a.storeToFileWithMSOffice(aGTA, _sInputFile, sOutputFile);
- }
- catch(ConvWatchCancelException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- }
- catch(java.io.IOException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- }
- }
- else
- {
- OfficePrint.convertDocument(_sInputFile, _sReferencePath, aGTA);
- }
-
- if (aGTA.restartOffice())
- {
- // Office shutdown
- aProvider.closeExistingOffice(param, true);
- }
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java b/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java
deleted file mode 100644
index 52587c62bfe7..000000000000
--- a/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import complexlib.ComplexTestCase;
-import helper.ProcessHandler;
-
-/**
- * Some Helperfunctions which are nice in ReferenceBuilder and ConvWatchTest
- */
-
-public abstract class EnhancedComplexTestCase extends ComplexTestCase
-{
- private void checkExistance(String _sScriptFile, String _sName)
- {
- ProcessHandler aHandler = new ProcessHandler(_sScriptFile);
- aHandler.executeSynchronously();
- TimeHelper.waitInSeconds(1, "wait after ProcessHandler.executeSynchronously()");
-
- StringBuffer aBuffer = new StringBuffer();
- aBuffer.append(aHandler.getErrorText()).append(aHandler.getOutputText());
- String sText = aBuffer.toString();
-
- if (sText.length() == 0)
- {
- String sError = "Must quit. " + _sName + " may be not accessible.";
- assure(sError, false);
- }
- else
- {
- }
- }
-
-
-
- protected void checkEnvironment(Object[] _aList)
- {
- // checks if some packages already installed,
- // this function will not return if packages are not installed,
- // it will call System.exit(1)!
-
- if (needCheckForInstalledSoftware())
- {
- for (int i=0;i<_aList.length;i++)
- {
- String sCommand = (String)_aList[i];
- // TODO: nice to have, a pair object
- checkExistance(sCommand, sCommand);
- }
- }
- }
-
-
-
- protected abstract Object[] mustInstalledSoftware();
- private boolean needCheckForInstalledSoftware()
- {
- String sNEEDCHECK = (String)param.get( PropertyName.CHECK_NEED_TOOLS );
-// TODO: I need to get the boolean value with get("name") because, if it is not given getBool() returns
-// with a default of 'false' which is not very helpful if the default should be 'true'
-// maybe a getBoolean("name", true) could be a better choice.
- if (sNEEDCHECK == null)
- {
- sNEEDCHECK = "false";
- }
- return sNEEDCHECK.equalsIgnoreCase("yes") ||
- sNEEDCHECK.equalsIgnoreCase("true");
- }
-
-
-
- public GraphicalTestArguments getGraphicalTestArguments()
- {
- GraphicalTestArguments aGTA = new GraphicalTestArguments(param);
- if (aGTA.getImportFilterName() != null && aGTA.getImportFilterName().equalsIgnoreCase("help"))
- {
- aGTA = null;
- }
- if (aGTA.getExportFilterName() != null && aGTA.getExportFilterName().equalsIgnoreCase("help"))
- {
- aGTA = null;
- }
- return aGTA;
- }
-}
diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java
deleted file mode 100644
index 515fe8ea7365..000000000000
--- a/qadevOOo/runner/convwatch/FileHelper.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.StringTokenizer;
-import helper.OSHelper;
-
-public class FileHelper
-{
- public FileHelper()
- {
- String sOSName = System.getProperty("os.name");
- String sOSArch = System.getProperty("os.arch");
- String sOSVersion = System.getProperty("os.version");
-
- GlobalLogWriter.get().println(sOSName);
- GlobalLogWriter.get().println(sOSArch);
- GlobalLogWriter.get().println(sOSVersion);
-
- }
-
-
-
- public static boolean exists(String _sFile)
- {
- if (_sFile == null) return false;
-
- File aFile = new File(_sFile);
- return aFile.exists();
- }
-
- public static boolean isDir(String _sDir)
- {
- if (_sDir == null) return false;
- try
- {
- File aFile = new File(_sDir);
- if (aFile.exists() && aFile.isDirectory())
- {
- return true;
- }
- }
- catch (NullPointerException e)
- {
- GlobalLogWriter.get().println("Exception caught. FileHelper.isDir('" + _sDir + "')");
- e.printStackTrace();
- }
- return false;
- }
-
- public static String getBasename(String _sFilename)
- {
- if (_sFilename == null) return "";
- String fs = System.getProperty("file.separator");
-
- int nIdx = _sFilename.lastIndexOf(fs);
- if (nIdx > 0)
- {
- return _sFilename.substring(nIdx + 1);
- }
- return _sFilename;
- }
-
- public static String getNameNoSuffix(String _sFilename)
- {
- if (_sFilename == null) return "";
- int nIdx = _sFilename.lastIndexOf('.');
- if (nIdx > 0)
- {
- return _sFilename.substring(0, nIdx);
- }
- return _sFilename;
- }
-
- public static String getSuffix(String _sFilename)
- {
- if (_sFilename == null) return "";
- int nIdx = _sFilename.lastIndexOf('.');
- if (nIdx > 0)
- {
- return _sFilename.substring(nIdx );
- }
- return "";
- }
-
- public static String getPath(String _sFilename)
- {
- if (_sFilename == null) return "";
- String fs = System.getProperty("file.separator");
-
- int nIdx = _sFilename.lastIndexOf(fs);
- if (nIdx > 0)
- {
- return _sFilename.substring(0, nIdx);
- }
- return "";
- }
-
- // creates all directories /tmp/a/b
-
- public static void makeDirectories(String first, String path)
- {
- makeDirectories(first, path, "0777");
- }
-
- private static void makeDirectories(String first, String path, String _sMode)
- {
- String fs = System.getProperty("file.separator");
- if (path.startsWith(fs + fs)) // starts with UNC Path
- {
- int n = path.indexOf(fs, 2);
- n = path.indexOf(fs, n + 1);
- first = path.substring(0, n);
- path = path.substring(n + 1);
- }
-
- String already_done = null;
- StringTokenizer path_tokenizer = new StringTokenizer(path,fs,false);
- already_done = first;
- while (path_tokenizer.hasMoreTokens())
- {
- String part = path_tokenizer.nextToken();
- File new_dir = new File(already_done + File.separatorChar + part);
- already_done = new_dir.toString();
- //create the directory
- new_dir.mkdirs();
- if (OSHelper.isUnix() &&
- _sMode.length() > 0)
- {
- try
- {
- chmod(new_dir, _sMode);
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.get().println("Exception caught. FileHelper.makeDirectories('" + new_dir.getAbsolutePath() + "')");
- }
- }
- }
- // return;
- }
-
- private static void chmod(File file, String mode) throws java.io.IOException
- {
- Runtime.getRuntime().exec
- (new String[]
- {"chmod", mode, file.getAbsolutePath()});
- }
-
- public static String removeFirstDirectorysAndBasenameFrom(String _sName, String _sRemovePath)
- {
- // pre: _sName: /a/b/c/d/e/f.g _sRemovePath /a/b/c
- // result: d/e
- String fs = System.getProperty("file.separator");
-
- String sBasename = FileHelper.getBasename(_sName);
- String sSubDirs = "";
- if (_sName.startsWith(_sRemovePath))
- {
- // if _sName starts with _sRemovePath
- int nRemovePathIndex = _sRemovePath.length();
- if (! _sRemovePath.endsWith(fs))
- {
- // add 1 if we not ends with file separator
- nRemovePathIndex ++;
- }
- int nBasenameIndex = _sName.length() - sBasename.length() - 1;
- if (nRemovePathIndex < nBasenameIndex)
- {
- sSubDirs = _sName.substring(nRemovePathIndex, nBasenameIndex);
- }
- }
- else
- {
- // special case, the _sRemovePath is not part of _sName
- sSubDirs = FileHelper.getPath(_sName);
- if (sSubDirs.startsWith(fs))
- {
- // remove leading file separator
- sSubDirs = sSubDirs.substring(1);
- }
- }
-
- return sSubDirs;
- }
-
- public static void test_removeFirstDirectorysAndBasenameFrom()
- {
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/a/b/c");
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/a/b/c/");
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/b/c");
- }
-
-
- public static String getSystemPathFromFileURL( String _sFileURL )
- {
- String sSystemFile = null;
-
- if(_sFileURL.startsWith("file:///"))
- {
- if (OSHelper.isWindows())
- {
- sSystemFile = _sFileURL.substring(8);
- }
- else
- {
- sSystemFile = _sFileURL.substring(7);
- }
- }
- else if (_sFileURL.startsWith("file://"))
- {
- sSystemFile = _sFileURL.substring(5);
- }
- String fs = System.getProperty("file.separator");
- if (! fs.equals("/"))
- {
- sSystemFile = sSystemFile.replace ('/', fs.toCharArray ()[0]);
- }
-// FEATURE FOR UNC NEED!!!
- return sSystemFile;
- }
-
- private static boolean m_bDebugTextShown = false;
- public static boolean isDebugEnabled()
- {
- boolean bDebug = false;
- String sTmpPath = util.utils.getUsersTempDir();
- String fs = System.getProperty("file.separator");
- String sName = sTmpPath + fs + "DOC_COMPARATOR_DEBUG";
- File aFile = new File(sName);
- if (aFile.exists())
- {
- if (!m_bDebugTextShown)
- {
- 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.");
- m_bDebugTextShown = true;
- }
- bDebug = true;
- }
- return bDebug;
- }
-
- public static void copy(String _sSource, String _sDestination)
- {
- try
- {
- File inputFile = new File(_sSource);
- File outputFile = new File(_sDestination);
-
- java.io.FileReader in = null;
- java.io.FileWriter out = null;
- try
- {
- in = new java.io.FileReader(inputFile);
- try
- {
- out = new java.io.FileWriter(outputFile);
- int c;
-
- while ((c = in.read()) != -1) {
- out.write(c);
- }
-
- }
- finally
- {
- if (out != null)
- out.close();
- }
- }
- finally
- {
- if (in != null)
- in.close();
- }
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.get().println("Exception caught. FileHelper.copy('" + _sSource + ", " + _sDestination + "')");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
- }
- }
-
- /**
- * Within the directory run through, it's possible to say which file extension types should not
- * consider like '*.prn' because it's not a document.
- *
- * @return a FileFilter function
- */
- public static FileFilter getFileFilter()
- {
- FileFilter aFileFilter = new FileFilter()
- {
- public boolean accept( File pathname )
- {
- // leave out files which started by '~$' these are Microsoft Office temp files
- if (pathname.getName().startsWith("~$"))
- {
- return false;
- }
-
- if (pathname.getName().endsWith(".prn"))
- {
- return false;
- }
- // This type of document no one would like to load.
- if (pathname.getName().endsWith(".zip"))
- {
- return false;
- }
- // just a hack
- if (pathname.getName().endsWith("_"))
- {
- return false;
- }
- return true;
- }
- };
- return aFileFilter;
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java
deleted file mode 100644
index ffe462209520..000000000000
--- a/qadevOOo/runner/convwatch/FilenameHelper.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import helper.URLHelper;
-import helper.StringHelper;
-
-/**
- * Helper class to hold a Filename or a FileURL
- * Something like File in Java,
- * with some more extensions direct to ConvWatch and its name conventions
- */
-abstract class FilenameHelper_impl
-{
- private String fs; // file separator like '/'
- private String m_sPath;
- private String m_sFilename;
- private String m_sSuffix;
- private int m_nNumber = 0;
-
- public String getNumber()
- {
- return StringHelper.createValueString(m_nNumber, 4);
- }
- public void setNumber(int _n)
- {
- m_nNumber = _n;
- }
- private void initMember()
- {
- fs = System.getProperty("file.separator");
- }
-
- /**
- * initialise a FilenameHelper_impl with a complete filename.
- * if the filename starts with 'file:///' it is interpret as a file URL
- *
- */
- public FilenameHelper_impl()
- {
- initMember();
- }
-
- public void setCompleteFilename(String _sFilename)
- {
- if (_sFilename.startsWith("file:///"))
- {
- _sFilename = FileHelper.getSystemPathFromFileURL(_sFilename);
- }
- _sFilename = _sFilename.replace("\\\\", "/");
-
- String sPath = checkPath(FileHelper.getPath(_sFilename));
- String sFilenameWithSuffix = checkFilename(FileHelper.getBasename(_sFilename));
- String sSuffix = splitSuffix(sFilenameWithSuffix);
-
- m_sPath = sPath;
- m_sFilename = FileHelper.getNameNoSuffix(sFilenameWithSuffix);
- m_sSuffix = sSuffix;
- }
-
- /**
- * initialise a FilenameHelper_impl with a path a name and a suffix separately
- */
- public FilenameHelper_impl(String _sPath, String _sName, String _sSuffix)
- {
- initMember();
- _sPath = _sPath.replace("\\\\", "/");
-
- String sPath = checkPath(_sPath);
- String sFilename = checkFilename(_sName);
- String sSuffix = checkSuffix(_sSuffix);
-
- m_sPath = sPath;
- m_sFilename = sFilename;
- m_sSuffix = sSuffix;
- }
-
- /**
- * @return the current path as a OOo path URL
- */
- public String getFileURL()
- {
- String sSystemPath = createAbsoluteFilename();
- String sFileURL = URLHelper.getFileURLFromSystemPath(sSystemPath);
- return sFileURL;
- }
-
-
- /**
- * @return the current path as a system path
- */
- public String getAbsoluteSystemFilename()
- {
- String sSystemFilename = createAbsoluteFilename();
- sSystemFilename = sSystemFilename.replace("/", fs);
- return sSystemFilename;
- }
-
- /**
- * @return the filename without it's suffix
- */
- public String getName()
- {
- return m_sFilename;
- }
- /**
- * set only the filename, maybe it's is only a directory.
- */
- public void setName(String _sName)
- {
- m_sFilename = _sName;
- }
- public void setPath(String _sName)
- {
- m_sPath = _sName;
- }
-
- /**
- * @return a created name
- */
- abstract public String buildName();
-
- /**
- * @return the complete filename with it's suffix
- */
- public String getFilename()
- {
- return buildName() + "." + getSuffix();
- }
-
- /**
- * @return the path as system path
- */
- public String getSystemPath()
- {
- String sSystemPath = m_sPath;
- sSystemPath = sSystemPath.replace("/", fs);
- return sSystemPath;
- }
- /**
- * @return true, if current SystemPath is a directory
- */
- public boolean isDirectory()
- {
- return FileHelper.isDir(getSystemPath());
- }
-
-
-
- /**
- * @return the current suffix
- */
- public String getSuffix()
- {
- return m_sSuffix;
- }
- /**
- * @return the complete name. Without convert the path separator!
- */
- private String createAbsoluteFilename()
- {
- return m_sPath + fs + getFilename();
- }
-
- /*
- * remove follows 'file separators'
- */
- private String checkPath(String _sPath)
- {
- String sPath;
- if (_sPath.endsWith("/") || _sPath.endsWith("\\"))
- {
- sPath = _sPath.substring(0, _sPath.length() - 1);
- }
- else
- {
- sPath = _sPath;
- }
- return sPath;
- }
-
- private String checkFilename(String _sFilename)
- {
- String sFilename;
- if (_sFilename.startsWith("/") || _sFilename.startsWith("\\"))
- {
- sFilename = _sFilename.substring(1);
- }
- else
- {
- sFilename = _sFilename;
- }
- return sFilename;
- }
-
- private String checkSuffix(String _sSuffix)
- {
- String sSuffix;
- if (_sSuffix.startsWith("."))
- {
- sSuffix = _sSuffix.substring(1);
- }
- else
- {
- sSuffix = _sSuffix;
- }
- return sSuffix;
- }
-
- private String splitSuffix(String _sName)
- {
- String sSuffix = FileHelper.getSuffix(_sName);
- return checkSuffix(sSuffix);
- }
-
- public boolean equals(FilenameHelper_impl _aOtherFN)
- {
- String sPath = createAbsoluteFilename();
- String sPathOther = _aOtherFN.createAbsoluteFilename();
- return sPath.equals(sPathOther);
- }
-
-}
-
-/**
- * Original filename
- */
-class OriginalFilename extends FilenameHelper_impl
-{
- @Override
- public String buildName()
- {
- return getName();
- }
-
- public OriginalFilename(){}
- public OriginalFilename(String _path, String _filename, String _ext) { super(_path, _filename, _ext);}
-}
-
-/**
- * Reference from original
- */
-class OriginalReferenceFilename extends FilenameHelper_impl
-{
- @Override
- public String getSuffix()
- {
- return "prn";
- }
- @Override
- public String buildName()
- {
- return getName();
- }
- public OriginalReferenceFilename(){}
- public OriginalReferenceFilename(String _path, String _filename, String _ext) { super(_path, _filename, _ext);}
-}
-
-/**
- * picture from reference from original
- */
-class OriginalReferencePictureFilename extends FilenameHelper_impl
-{
- @Override
- public String getSuffix()
- {
- return "jpg";
- }
- @Override
- public String buildName()
- {
- return getName() + "-" + getNumber() + "-ref";
- }
- public String getBuildString()
- {
- return getName() + "-" + "%04d" + "-ref";
- }
-
- public OriginalReferencePictureFilename(){}
- public OriginalReferencePictureFilename(String _path, String _filename, String _ext) { super(_path, _filename, _ext);}
-}
-
-/**
- * Reference from OpenOffice.org
- */
-class CurrentReferenceFilename extends FilenameHelper_impl
-{
- @Override
- public String getSuffix()
- {
- return "ps";
- }
- @Override
- public String buildName()
- {
- return getName();
- }
-
- public CurrentReferenceFilename(){}
- public CurrentReferenceFilename(String _path, String _filename, String _ext) { super(_path, _filename, _ext);}
-}
-
-/**
- * picture from reference from OpenOffice.org
- */
-class CurrentReferencePictureFilename extends FilenameHelper_impl
-{
- @Override
- public String getSuffix()
- {
- return "jpg";
- }
- @Override
- public String buildName()
- {
- return getName() + "-" + getNumber() + "-new-ref";
- }
- public String getBuildString()
- {
- return getName() + "-" + "%04d" + "-new-ref";
- }
-
- public CurrentReferencePictureFilename(){}
- public CurrentReferencePictureFilename(String _path, String _filename, String _ext) { super(_path, _filename, _ext);}
-}
-
-
-public class FilenameHelper
-{
-
- public static void main(String[] args)
- {
- OriginalReferenceFilename d = new OriginalReferenceFilename();
- d.setCompleteFilename("c:\\dir1\\dir2\\name.ext");
- System.out.println("Suffix: " + d.getSuffix());
- System.out.println("Path: " + d.getSystemPath());
- System.out.println("Absolute system path filename: " + d.getAbsoluteSystemFilename());
- System.out.println("URL: " + d.getFileURL());
- System.out.println("Filename: " + d.getFilename());
-
- new OriginalReferenceFilename("/dir1/dir2/", "name",".ext");
- new OriginalReferenceFilename("/dir1/dir2","name.ext","");
- new OriginalReferenceFilename("/dir1/dir2","/name.ext","");
- new OriginalReferenceFilename("/dir1/dir2","/name",".ext");
- new OriginalReferenceFilename("/dir1/dir2","name","ext");
-
- }
-}
diff --git a/qadevOOo/runner/convwatch/GfxCompare.java b/qadevOOo/runner/convwatch/GfxCompare.java
deleted file mode 100644
index b1de0561217e..000000000000
--- a/qadevOOo/runner/convwatch/GfxCompare.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.util.ArrayList;
-import helper.URLHelper;
-import java.io.File;
-
-public class GfxCompare extends EnhancedComplexTestCase
-{
- // The first of the mandatory functions:
-
- // The second of the mandatory functions: return all test methods as an
- // array. There is only one test function in this example.
- /**
- * Return all test methods.
- * @return The test methods.
- */
-
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"gfxcompare"};
- }
-
- /**
- *
- * @return a List of software which must accessible as an external executable
- */
- @Override
- protected String[] mustInstalledSoftware()
- {
- ArrayList<String> aList = new ArrayList<String>();
- // Tools from ImageMagick
- aList.add( "composite -version" );
- aList.add( "identify -version" );
-
- // Ghostscript
- aList.add( "gs -version" );
- return aList.toArray(new String[aList.size()]);
- }
-
-
- GraphicalTestArguments m_aArguments = null;
- /**
- * The test method itself.
- * Don't try to call it from outside, it is started only from qadevOOo runner
- */
-
- /* protected */
- public void gfxcompare()
- {
- GlobalLogWriter.set(log);
-
- // check if all need software is installed and accessible
- checkEnvironment(mustInstalledSoftware());
-
- m_aArguments = getGraphicalTestArguments();
-
- String sFile1 = (String)param.get("FILE1");
- String sFile2 = (String)param.get("FILE2");
- compare(sFile1, sFile2);
- }
-
-
-
- String createJPEG(String _sFile, String _sAdditional)
- {
- String sJPEGFile = "";
- if (_sFile.startsWith("file:///"))
- {
- _sFile = FileHelper.getSystemPathFromFileURL(_sFile);
- }
- File aFile = new File(_sFile);
- if (aFile.exists())
- {
- String sAbsFile = aFile.getAbsolutePath();
- if (!sAbsFile.equals(_sFile))
- {
- _sFile = sAbsFile;
- }
- }
- else
- {
- GlobalLogWriter.get().println("File: '" + _sFile + "' doesn't exist.");
- return "";
- }
- String sFileDir = FileHelper.getPath(_sFile);
- String sBasename = FileHelper.getBasename(_sFile);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
-
- String fs = System.getProperty("file.separator");
- String sTmpDir = util.utils.getUsersTempDir();
- if (m_aArguments.getOutputPath() != null)
- {
- sTmpDir = m_aArguments.getOutputPath();
- }
-
- if (_sFile.toLowerCase().endsWith("ps") ||
- _sFile.toLowerCase().endsWith("prn") ||
- _sFile.toLowerCase().endsWith("pdf"))
- {
- // seems to be a Postscript of PDF file
-
- String[] aList = PRNCompare.createJPEGFromPostscript(sTmpDir, sFileDir, sBasename, m_aArguments.getResolutionInDPI());
- sJPEGFile = aList[0];
- }
- else if (_sFile.toLowerCase().endsWith("jpg") ||
- _sFile.toLowerCase().endsWith("jpeg"))
- {
- // do nothing, it's already a picture.
- return _sFile;
- }
- else
- {
- // we assume it's an office document.
- String sInputURL;
- String sOutputURL;
- String sPrintFileURL;
-
- String sInputFile = sFileDir + fs + sBasename;
- sInputURL = URLHelper.getFileURLFromSystemPath(sInputFile);
-
- String sOutputFile = sTmpDir + fs + sBasename;
- sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputFile);
-
- String sPrintFile = sTmpDir + fs + sNameNoSuffix + _sAdditional + ".ps";
- sPrintFileURL = URLHelper.getFileURLFromSystemPath(sPrintFile);
-
- try
- {
- OfficePrint.printToFile(m_aArguments, sInputURL, sOutputURL, sPrintFileURL);
- sJPEGFile = createJPEG(sPrintFile, _sAdditional);
- }
- catch (ConvWatchCancelException e)
- {
- GlobalLogWriter.get().println("Exception caught, can't create:" + sPrintFileURL);
- }
- }
- return sJPEGFile;
- }
-
-
- public String compare(String _sFile1, String _sFile2)
- {
- String sJPEGFile1 = createJPEG(_sFile1, "-1");
- String sJPEGFile2 = createJPEG(_sFile2, "-2");
-
- if (sJPEGFile1.length() > 0 && sJPEGFile2.length() > 0)
- {
- String sDiffFile = PRNCompare.compareJPEGs(sJPEGFile1, sJPEGFile2);
-
- if (sDiffFile.length() > 0)
- {
- GlobalLogWriter.get().println("Difference created: " + sDiffFile);
- }
- return sDiffFile;
- }
- return "";
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/GlobalLogWriter.java b/qadevOOo/runner/convwatch/GlobalLogWriter.java
index aedaf265c940..f77845e56a47 100644
--- a/qadevOOo/runner/convwatch/GlobalLogWriter.java
+++ b/qadevOOo/runner/convwatch/GlobalLogWriter.java
@@ -34,10 +34,5 @@ public class GlobalLogWriter
return m_aGlobalLogWriter;
}
- public static synchronized void set(LogWriter _aLog)
- {
- m_aGlobalLogWriter = _aLog;
- }
-
}
diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java
deleted file mode 100644
index f9d1e29edbc4..000000000000
--- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-
-import helper.URLHelper;
-import com.sun.star.lang.XComponent;
-import com.sun.star.frame.XStorable;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.UnoRuntime;
-
-public class GraphicalDifferenceCheck
-{
- private static void showVersion()
- {
- // DEBUG only
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("");
- GlobalLogWriter.get().println("+##############################+");
- GlobalLogWriter.get().println("##### THIS IS CONVWATCH #####");
- GlobalLogWriter.get().println("##### Debug Version 1.0015 #####");
- GlobalLogWriter.get().println("+##############################+");
- GlobalLogWriter.get().println("");
- }
- }
-
- /**
- * Creates references form documents used by the graphical difference check
- *
- * @param _sInputPath the original document path
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- *
- * @throws ConvWatchException if there are problems, see message
- *
- * Stops rest, if one creation of reference fails.
- */
- public static void createReferences(String _sInputPath, String _sReferencePath, GraphicalTestArguments _aGTA) throws ConvWatchException
- {
- showVersion();
- File aInputPath = new File(_sInputPath);
-
- if (aInputPath.isDirectory())
- {
- String fs = System.getProperty("file.separator");
-
- aInputPath.getAbsolutePath();
-
- Object[] aList = DirectoryHelper.traverse(_sInputPath, FileHelper.getFileFilter(), _aGTA.includeSubDirectories());
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
- String sNewReferencePath = _sReferencePath + fs + FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, _sInputPath);
- createOneReferenceFile(sEntry, sNewReferencePath, _aGTA);
- }
- }
- else
- {
- createOneReferenceFile(_sInputPath, _sReferencePath, _aGTA);
- }
- }
-
-
- /**
- * Creates a reference for a single document used by the graphical difference check
- *
- * @param _sInputFile the original document
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- *
- * @throws ConvWatchException if the are problems, see containing message
- */
- public static boolean createOneReferenceFile(String _sInputFile, String _sReferencePath, GraphicalTestArguments _aGTA) throws ConvWatchException
- {
- showVersion();
- if (_aGTA != null)
- {
- _aGTA.setInputFile(_sInputFile);
- }
- return OfficePrint.buildReference(_aGTA, _sReferencePath, _sInputFile);
- }
-
- /**
- * Check if a reference exist
- *
- * @param _sInputFile the original document
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- */
- public static boolean isReferenceExists(String _sInputFile, String _sReferencePath, GraphicalTestArguments _aGTA)
- {
- return OfficePrint.isReferenceExists(_aGTA, _sReferencePath, _sInputFile);
- }
-
-
- /**
- * Used for the comparance of graphical differences.
- * Method compares one document (_sInputFile) with an older document of the same name in the provided directory (_sReferencePath).
- *
- * @param _sInputPath the original document path
- * @param _sOutputPath path where the same directory structure of the given input path will create. All the result documents
- * needed very much disk space (up to 10MB per page).
- * The path _sOutputPath must be writeable.
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- * @param _aGTA Helper class for lot of parameter to control the office.
- *
- * Disadvantage: stops rest if one test file has a problem.
- */
- public static boolean check(String _sInputPath, String _sOutputPath, String _sReferencePath, GraphicalTestArguments _aGTA ) throws ConvWatchException
- {
- return check(_sInputPath, _sOutputPath, _sReferencePath, null, _aGTA);
- }
-
- /**
- * Used for the comparance of graphical differences.
- * Method compares one document (_sInputFile) with an older document of the same name in the provided directory (_sReferencePath).
- *
- * @param _sInputPath the original document path
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- * @param _sOutputPath path where the same directory structure of the given input path will create. All the result documents
- * needed very much disk space (up to 10MB per page).
- * The path _sOutputPath must be writeable.
- * @param _sDiffPath Path to older differences.
- * @param _aGTA Helper class for lot of parameter to control the office.
- *
- *
- * Stops all, if one creation of reference fails
- */
- public static boolean check(String _sInputPath, String _sOutputPath, String _sReferencePath, String _sDiffPath, GraphicalTestArguments _aGTA ) throws ConvWatchException
- {
- showVersion();
-
- boolean bOk = true;
-
- File aInputPath = new File(_sInputPath);
- if (aInputPath.isDirectory())
- {
- String fs = System.getProperty("file.separator");
- // a whole directory
- Object[] aList = DirectoryHelper.traverse(_sInputPath, FileHelper.getFileFilter(), _aGTA.includeSubDirectories());
- if (aList.length != 0)
- {
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
- String sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, _sInputPath);
- String sNewReferencePath = _sReferencePath;
- String sNewOutputPath = _sOutputPath;
- String sNewDiffPath = _sDiffPath;
- if (sNewSubDir.length() > 0)
- {
- if (sNewReferencePath != null)
- {
- sNewReferencePath = sNewReferencePath + fs + sNewSubDir;
- }
-
- sNewOutputPath = sNewOutputPath + fs + sNewSubDir;
- if (sNewDiffPath != null)
- {
- sNewDiffPath = sNewDiffPath + fs + sNewSubDir;
- }
- }
- bOk &= checkOneFile(sEntry, sNewOutputPath, sNewReferencePath, sNewDiffPath, _aGTA);
- }
- }
- }
- else
- {
- bOk = /* GraphicalDifferenceCheck.*/ checkOneFile(_sInputPath, _sOutputPath, _sReferencePath, _sDiffPath, _aGTA);
- }
- return bOk;
- }
-
-
-
-
- /**
- * Used for the comparance of graphical differences.
- * Method compares one document (_sInputFile) with an older document of the same name in the provided directory (_sReferencePath).
- *
- * For scenarios, where a difference is known and further changes are of interest, differences itself can be compared.
- * This functionality is provided by the difference path parameter (_sDiffPath). If set, the difference of the current comparance (between input and reference),
- * will be compared with the (same named) difference document from a earlier comparance.
- *
- * The path _sOutputPath must be writeable
- */
- public static boolean checkOneFile(String _sInputFile, String _sOutputPath, String _sReferencePath, String _sDiffPath, GraphicalTestArguments _aGTA ) throws ConvWatchException
- {
- showVersion();
- if (_aGTA != null)
- {
- _aGTA.setInputFile(_sInputFile);
- }
-
- boolean bOk = false;
- if (_sDiffPath != null)
- {
- // check with an old diff
- bOk = convwatch.ConvWatch.checkDiffDiff(_aGTA, _sOutputPath, _sInputFile, _sReferencePath, _sDiffPath);
- }
- else
- {
- // one file
- bOk = convwatch.ConvWatch.check(_aGTA, _sOutputPath, _sInputFile, _sReferencePath);
- }
- return bOk;
- }
-
- /**
- * Instead of providing a saved document for graphical comparance a StarOffice xComponent
- * will be saved and afterwards compared.
- *
- * @param xComponent the test document to be compared as StarOffice component
- * @param _sOutputPath Path where test results are supposed to been saved. The path _sOutputPath must be writeable.
- * These documents need sufficient disk space (up to 10MB per page).
- * A directory structure will be created, which is a mirrored from input path.
- *
- * @param _resultDocName Name by which the xComponent shall be saved as OpenOffice.org XML document.
- * If provided without suffix, the suffix will be derived from the export filter.
- * @param _sReferencePath the directory where the document will print as file or export as pdf.
- * @param _aGTA Helper class for lot of parameter to control the office.
- */
- public static boolean checkOneFile(XComponent xComponent, String _sOutputPath, String _resultDocName, String _sReferencePath, GraphicalTestArguments _aGTA ) throws ConvWatchException
- {
- showVersion();
-
- // one file
- String sInputFile;
- sInputFile = createInputFile(xComponent, _sOutputPath, _resultDocName);
- sInputFile = FileHelper.getSystemPathFromFileURL(sInputFile);
- return convwatch.ConvWatch.check(_aGTA, _sOutputPath, sInputFile, _sReferencePath);
- }
-
- private static String createInputFile(XComponent xComponent, String _sOutputPath, String resultDocName)
- throws ConvWatchCancelException
- {
-
- // find the adequate XML StarOffice output filter to save the document and adequate suffix
- StringBuffer suffix = new StringBuffer();
- String exportFilter = getXMLOutputFilterforXComponent(xComponent, suffix);
- if(resultDocName == null)
- resultDocName = "OOoTestDocument";
- if(resultDocName.indexOf('.') == -1)
- resultDocName = suffix.insert(0, resultDocName).toString();
-
- // create a result URL for storing the office document
- String resultURL = URLHelper.getFileURLFromSystemPath(ensureEndingFileSep(_sOutputPath) + resultDocName);
-
- XStorable xStorable = null;
- xStorable = UnoRuntime.queryInterface(com.sun.star.frame.XStorable.class, xComponent);
- if(xStorable == null)
- {
- throw new ConvWatchCancelException("com.sun.star.frame.XStorable could not be instantiated from the office.");
- }
-
- PropertyValue pvFilterName = new PropertyValue("FilterName", -1, exportFilter, com.sun.star.beans.PropertyState.getDefault());
- PropertyValue pvOverwrite = new PropertyValue("Overwrite", -1, Boolean.TRUE, com.sun.star.beans.PropertyState.getDefault());
-
- try
- {
- xStorable.storeAsURL(resultURL, new PropertyValue[]{pvFilterName, pvOverwrite});
- }
- catch (com.sun.star.io.IOException e)
- {
- // wrap IOException
- throw new ConvWatchCancelException("Wrap IOException caught", e);
- }
-
- GlobalLogWriter.get().println("Saving XComponent as " + resultURL);
-
- return resultURL;
- }
-
-
- private static String getXMLOutputFilterforXComponent(XComponent xComponent, StringBuffer suffix){
- XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, xComponent);
- if (xSI.supportsService("com.sun.star.text.TextDocument")){
- resetBuffer(suffix, ".sxw");
- return "swriter: StarOffice XML (Writer)";
- }else if (xSI.supportsService("com.sun.star.sheet.SpreadsheetDocument")){
- resetBuffer(suffix, ".sxc");
- return "scalc: StarOffice XML (Calc)";
- }else if (xSI.supportsService("com.sun.star.presentation.PresentationDocument")){
- resetBuffer(suffix, ".sxi");
- return "simpress: StarOffice XML (Impress)";
- }else if(xSI.supportsService("com.sun.star.drawing.DrawingDocument")){
- resetBuffer(suffix, ".sxd");
- return "sdraw: StarOffice XML (Draw)";
- }else if (xSI.supportsService("com.sun.star.formula.FormulaProperties")){
- resetBuffer(suffix, ".sxm");
- return "smath: StarOffice XML (Math)";
- }
- return null;
- }
-
- private static StringBuffer resetBuffer(StringBuffer sb, String suffix)
- {
- if(sb != null)
- {
- sb.replace(0, sb.length(), suffix);
- }
- return sb;
- }
-
- private static String ensureEndingFileSep(String s)
- {
- if(s != null && s.length() != 0 && !s.endsWith(File.separator))
- {
- s = s.trim() + File.separator;
- }
- else
- {
- if(s == null)
- {
- s = "";
- }
- }
-
- return s;
- }
-
-
-}
diff --git a/qadevOOo/runner/convwatch/GraphicalTestArguments.java b/qadevOOo/runner/convwatch/GraphicalTestArguments.java
deleted file mode 100644
index 669083bd0778..000000000000
--- a/qadevOOo/runner/convwatch/GraphicalTestArguments.java
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import lib.TestParameters;
-import java.io.File;
-
-import com.sun.star.container.XNameAccess;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * This class object is more a Helper or Controller.
- * It stores information like:
- * - How to create a document (with a OpenOffice.org method, or with MS Word, or with OpenOffice.org as pdf)
- * - some more infos for OpenOffice.org method
- * - a service factory pointer
- * - if hidden mode should use
- * - target name
- *
- * - printer name
- *
- * - how to handle .xml files, which in Microsoft could be Excel or Word documents
- *
- * HOWTO USE:
- * For OOo,
- * create an GraphicalTestArguments with a set of TestParameters
- * GraphicalTestArguments a = new GraphicalTestArguments(params);
- *
- * If you wish to use pdf export instead of normal printer output, set also the reference type to 'pdf'
- * a.setReferenceType("pdf");
- *
- *
- * For MS Office:
- * create an GraphicalTestArguments and set the reference type to 'msoffice'
- * GraphicalTestArguments a = new GraphicalTestArguments(params);
- * a.setReferenceType("msoffice");
- *
- * within windows it's better to set also a printer name so it's simply possible to use for normal work the default printer
- * and for such tests with ConvWatch a extra printer.
- * a.setPrinterName("CrossOffice Printer");
- *
- */
-
-public class GraphicalTestArguments
-{
- /**
- 2DO:
- Possible reference types are currently
- // ooo
- // pdf
- // msoffice
- */
- private String m_sReferenceType = "OOo";
-
- private String m_sTargetFrameName = "_blank";
-
- private String m_sPrinterName = null;
-
- // Hidden = true hiddes a used OpenOffice.org, all code is executed in the background
- // This parameter is not used for RefType: msoffice
- private boolean m_bHidden = true;
-
- private String m_sDefaultXMLFormatApplication = null;
-
- private boolean m_bIncludeSubdirectories;
-
- private final TestParameters m_aCurrentParams;
-
- private final int m_nMaxPages; // default is 0 (print all pages)
- private final String m_sOnlyPage; // default is "", there is no page which we want to print only.
-
- private int m_nResolutionInDPI = 0;
-
- private boolean m_bStoreFile = true;
- private final boolean m_bResuseOffice;
-
-
-
-
-
- private String m_sDistinct = null;
-
- private boolean m_bCreateDefaultReference = false;
-
- public GraphicalTestArguments(TestParameters param)
- {
- m_aCurrentParams = param;
- // collect interesting information from the ComplexTestCase
-
-
- // REFERENCE_TYPE ----------
- String sReferenceType = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_TYPE );
- if (sReferenceType == null || sReferenceType.length() == 0)
- {
- }
- else
- {
- setReferenceType(sReferenceType);
- }
-
- // PRINTER_NAME ----------
- String sPrinterName = (String)param.get( PropertyName.DOC_COMPARATOR_PRINTER_NAME );
- if (sPrinterName == null || sPrinterName.length() == 0)
- {
- }
- else
- {
- setPrinterName(sPrinterName);
- }
- // DEFAULT_XML_FORMAT_APP ------
- String sDefaultXMLFormatApp = (String)param.get( PropertyName.DOC_COMPARATOR_DEFAULT_XML_FORMAT_APP );
- if (sDefaultXMLFormatApp == null || sDefaultXMLFormatApp.length() == 0)
- {
- }
- else
- {
- setDefaultXMLFormatApp(sDefaultXMLFormatApp);
- }
-
- m_bIncludeSubdirectories = true;
- String sRECURSIVE = (String)param.get( PropertyName.DOC_COMPARATOR_INCLUDE_SUBDIRS );
-// TODO: I need to get the boolean value with get("name") because, if it is not given getBool() returns
-// with a default of 'false' which is not very helpful if the default should be 'true'
-// maybe a getBoolean("name", true) could be a better choice.
- if (sRECURSIVE == null)
- {
- sRECURSIVE = "true";
- }
- if (sRECURSIVE.equalsIgnoreCase("no") ||
- sRECURSIVE.equalsIgnoreCase("false"))
- {
- m_bIncludeSubdirectories = false;
- }
-
-
- m_nMaxPages = param.getInt( PropertyName.DOC_COMPARATOR_PRINT_MAX_PAGE );
- m_sOnlyPage = (String)param.get(PropertyName.DOC_COMPARATOR_PRINT_ONLY_PAGE);
-
- m_nResolutionInDPI = param.getInt( PropertyName.DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION );
- if (m_nResolutionInDPI == 0)
- {
- // 212 DPI is 1754 x 2474 pixel for DIN A4
- m_nResolutionInDPI = 212;
- }
-
-
- String sImportFilterName = (String)param.get(PropertyName.DOC_CONVERTER_IMPORT_FILTER_NAME);
- if (sImportFilterName != null && sImportFilterName.length() > 0)
- {
- m_sImportFilterName = sImportFilterName;
-
- if (sImportFilterName.equalsIgnoreCase("help"))
- {
- showInternalFilterName(sImportFilterName, getMultiServiceFactory() );
- GlobalLogWriter.get().println("Must quit.");
- }
- }
-
- String sExportFilterName = (String)param.get(PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME);
- if (sExportFilterName != null && sExportFilterName.length() > 0)
- {
- m_sExportFilterName = sExportFilterName;
- if (sExportFilterName.equalsIgnoreCase("help"))
- {
- showInternalFilterName(sExportFilterName, getMultiServiceFactory() );
- GlobalLogWriter.get().println("Must quit.");
- }
- }
-
-
- String sOfficeProgram = (String)param.get(PropertyName.DOC_CONVERTER_OFFICE_PROGRAM);
- if (sOfficeProgram != null && sOfficeProgram.length() > 0)
- {
- m_sOfficeProgram = sOfficeProgram;
- }
-
- String sREUSE_OFFICE = (String)param.get( PropertyName.DOC_CONVERTER_REUSE_OFFICE);
- if (sREUSE_OFFICE == null)
- {
- sREUSE_OFFICE = "false";
- }
- m_bResuseOffice =
- sREUSE_OFFICE.equalsIgnoreCase("yes") ||
- sREUSE_OFFICE.equalsIgnoreCase("true");
-
-
- String sHTMLOutputPrefix = (String)param.get( PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX);
- if (sHTMLOutputPrefix == null)
- {
- m_sHTMLOutputPrefix = "";
- }
- else
- {
- m_sHTMLOutputPrefix = sHTMLOutputPrefix;
- }
-
- String sWithBorderMove = (String)param.get( PropertyName.DOC_COMPARATOR_GFXCMP_WITH_BORDERMOVE);
- if (sWithBorderMove == null)
- {
- sWithBorderMove = "";
- // m_tWithBorderMove = TriState.UNSET;
- m_tWithBorderMove = TriState.FALSE;
- }
- else if (sWithBorderMove.equalsIgnoreCase("yes") ||
- sWithBorderMove.equalsIgnoreCase("true"))
- {
- m_tWithBorderMove = TriState.TRUE;
- }
- else if (sWithBorderMove.equalsIgnoreCase("no") ||
- sWithBorderMove.equalsIgnoreCase("false"))
- {
- m_tWithBorderMove = TriState.FALSE;
- }
- else
- {
- m_tWithBorderMove = TriState.FALSE;
- // m_tWithBorderMove = TriState.UNSET;
- }
-
- String sDBInfoString = (String)param.get(PropertyName.DOC_COMPARATOR_DB_INFO_STRING);
- if (sDBInfoString != null)
- {
- m_sDBInfoString = sDBInfoString;
- }
-
- // DISTINCT ----------
- String sDistinct = (String)param.get( "DISTINCT" );
- if (sDistinct == null || sDistinct.length() == 0)
- {
- sDistinct = "";
- }
- else
- {
- m_sDistinct = sDistinct;
- }
- // HIDDEN
- String sOfficeViewable = (String)param.get(PropertyName.OFFICE_VIEWABLE);
- if (sOfficeViewable != null)
- {
- if (sOfficeViewable.equalsIgnoreCase("yes") ||
- sOfficeViewable.equalsIgnoreCase("true"))
- {
- setViewable();
- }
- else
- {
- setHidden();
- }
- }
- // CREATE_DEFAULT
- String sCreateDefault = (String)param.get(PropertyName.CREATE_DEFAULT);
- if (sCreateDefault != null)
- {
- m_bCreateDefaultReference =
- sCreateDefault.equalsIgnoreCase("yes") ||
- sCreateDefault.equalsIgnoreCase("true");
- }
-
- }
-
- public boolean checkIfUsableDocumentType(String _sName)
- {
- // @todo
- // check if the name is in the leave out list and then return 'false'
- return !(_sName.toLowerCase().endsWith(".jpg") ||
- _sName.toLowerCase().endsWith(".png") ||
- _sName.toLowerCase().endsWith(".gif") ||
- _sName.toLowerCase().endsWith(".bmp") ||
- _sName.toLowerCase().endsWith(".prn") ||
- _sName.toLowerCase().endsWith(".ps"));
- }
-
- private static void showInternalFilterName(String _sFilterName, XMultiServiceFactory _xMSF)
- {
- if (_sFilterName.length() == 0)
- {
- return;
- }
-
- if (_xMSF == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
- return;
- }
- Object aObj = null;
- try
- {
- aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory");
- }
- catch(com.sun.star.uno.Exception e)
- {
- GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
- return;
- }
- if (aObj != null)
- {
- XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
- if (aNameAccess != null)
- {
-
- if (_sFilterName.equalsIgnoreCase("help"))
- {
- GlobalLogWriter.get().println("Show all possible ElementNames from current version." );
- String[] aElementNames = aNameAccess.getElementNames();
- for (int i = 0; i<aElementNames.length; i++)
- {
- GlobalLogWriter.get().println(aElementNames[i]);
- }
- }
- }
- }
- }
-
- // set methods
- private void setReferenceType(String _sType)
- {
- // special casse, null is not allowed, set to default.
- if (_sType == null)
- {
- m_sReferenceType = "OOo";
- }
- else
- {
- m_sReferenceType = _sType;
- }
- }
- public void setTargetFrameName(String _sTargetFrameName) {m_sTargetFrameName = _sTargetFrameName;}
- private void setPrinterName(String _sName) {m_sPrinterName = _sName;}
- private void setHidden() { m_bHidden = true;}
- private void setViewable() {m_bHidden = false;}
- private void setDefaultXMLFormatApp(String _sNameOfApp) {m_sDefaultXMLFormatApplication = _sNameOfApp;}
-
- // get methods
- public XMultiServiceFactory getMultiServiceFactory()
- {
- XMultiServiceFactory xMSF = m_aCurrentParams.getMSF();
-
- // check if MultiServiceFactory is given
- if (getReferenceType().equalsIgnoreCase("pdf") ||
- getReferenceType().equalsIgnoreCase("ooo"))
- {
- if (xMSF == null)
- {
- GlobalLogWriter.get().println("ERROR! MultiServiceFactory not given.");
- }
- }
- return xMSF;
- }
-
- public String getReferenceType() {return m_sReferenceType;}
- public String getTargetFrameName() {return m_sTargetFrameName;}
- public String getPrinterName() {return m_sPrinterName;}
- public boolean isHidden() {return m_bHidden;}
- public String getDefaultXMLFormatApp() {return m_sDefaultXMLFormatApplication;}
-
-
- /**
- * @return true, if subdirectories should run through
- */
- public boolean includeSubDirectories() {return m_bIncludeSubdirectories;}
-
- /**
- * @return the number of pages to be print
- */
- public int getMaxPages() {return m_nMaxPages;}
-
- /**
- * @return as string, which pages should be print, e.g. '1-4;6' here, page 1 to 4 and page 6.
- */
- public String getOnlyPages()
- {
- if (m_sOnlyPage == null)
- {
- return "";
- }
- return m_sOnlyPage;
- }
-
- /**
- * @return true, if there should not print all pages at all, use getMaxPages() and or getOnlyPages() to get which pages to print
- */
- public boolean printAllPages()
- {
- return !((getMaxPages() > 0) || (getOnlyPages().length() != 0));
- }
-
- /**
- * @return integer value, which contain resolution in DPI.
- */
- public int getResolutionInDPI() {return m_nResolutionInDPI;}
-
- private static void checkIfMSWindowsConformPath(String _sPath)
- {
- if (_sPath != null && _sPath.length() > 1)
- {
- if (_sPath.charAt(1) == ':')
- {
- if (_sPath.charAt(2) != '\\')
- {
- GlobalLogWriter.get().println("This is not a Microsoft Windows conform path: '" + _sPath + "' please fix.");
- System.exit(1);
- }
- }
- }
- }
-
-
- /**
- * @return the INPUT_PATH out of the TestParameters
- */
- public String getInputPath()
- {
- String sInputPath;
- sInputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_INPUT_PATH);
- checkIfMSWindowsConformPath(sInputPath);
- return sInputPath;
- }
- /**
- * @return the OUTPUT_PATH out of the TestParameters
- */
- public String getOutputPath()
- {
- String sOutputPath;
- sOutputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_OUTPUT_PATH);
- checkIfMSWindowsConformPath(sOutputPath);
- return sOutputPath;
- }
- /**
- * @return the REFERENCE_PATH out of the TestParameters
- */
- public String getReferencePath()
- {
- String sReferencePath;
- sReferencePath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_REFERENCE_PATH);
- checkIfMSWindowsConformPath(sReferencePath);
- return sReferencePath;
- }
- /**
- * @return the DIFF_PATH out of the TestParameters
- */
- public String getDiffPath()
- {
- String sDiffPath;
- sDiffPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_DIFF_PATH);
- checkIfMSWindowsConformPath(sDiffPath);
- return sDiffPath;
- }
-
- public boolean getOverwrite()
- {
- boolean bOverwrite = m_aCurrentParams.getBool( PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE);
- return bOverwrite;
- }
- public String getReferenceInputPath()
- {
- String sReferenceInputPath;
- sReferenceInputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_REFERENCE_INPUT_PATH);
- return sReferenceInputPath;
- }
-
- /**
- * Helper function to get the buildid of the current used OpenOffice.org
- * out of the AppExecutionCommand the build ID
- */
- public String getBuildID()
- {
- String sAPP = (String)m_aCurrentParams.get(util.PropertyName.APP_EXECUTION_COMMAND);
- // return getBuildID(sAPP);
-// TODO: here we need the getBuildID(string) method
- String sBuildID = convwatch.BuildID.getBuildID(sAPP);
- return sBuildID;
- }
-
- public boolean shouldOfficeStart()
- {
- String sNoOffice = (String)m_aCurrentParams.get( "NoOffice" );
- if (sNoOffice != null)
- {
- if (sNoOffice.toLowerCase().startsWith("t") || sNoOffice.toLowerCase().startsWith("y"))
- {
- return false;
- }
- }
- return true;
- }
-
- // Handle for Reference Build ID, is set in ConvWatch.createPostscriptStartCheck()
- private String m_sRefBuildID;
-
- public void setRefBuildID(String _sRef)
- {
- m_sRefBuildID = _sRef;
- }
- public String getRefBuildID()
- {
- return m_sRefBuildID;
- }
-
- public void disallowStore()
- {
- m_bStoreFile = false;
- }
- public void allowStore()
- {
- m_bStoreFile = true;
- }
- public boolean isStoreAllowed()
- {
- return m_bStoreFile;
- }
- public boolean createDefaultReference()
- {
- return m_bCreateDefaultReference;
- }
-
-
- // get/set for FilterName
- // get the right Filtername (internal Name) from
- // http://framework.openoffice.org/files/documents/25/897/filter_description.html
-
- private String m_sImportFilterName = "";
- private String m_sExportFilterName = "";
- public void setImportFilterName(String _sImportFilterName)
- {
- m_sImportFilterName = _sImportFilterName;
- }
- public String getImportFilterName()
- {
- return m_sImportFilterName;
- }
- public void setExportFilterName(String _sExportFilterName)
- {
- m_sExportFilterName = _sExportFilterName;
- }
- public String getExportFilterName()
- {
- return m_sExportFilterName;
- }
-
- private String m_sOfficeProgram = "";
- public void setOfficeProgram(String _sName)
- {
- m_sOfficeProgram = _sName;
- }
- public String getOfficeProgram()
- {
- return m_sOfficeProgram;
- }
-
- public boolean restartOffice()
- {
- return !m_bResuseOffice;
- }
-
- private String m_sHTMLOutputPrefix = "";
- public String getHTMLOutputPrefix()
- {
- return m_sHTMLOutputPrefix;
- }
-
- private TriState m_tWithBorderMove = TriState.UNSET;
- public TriState getBorderMove()
- {
- return m_tWithBorderMove;
- }
- public void setBorderMove(TriState _tBorderMove)
- {
- m_tWithBorderMove = _tBorderMove;
- }
-
- private String m_sDocumentType = "";
- public void setDocumentType(String _sName)
- {
- m_sDocumentType = _sName;
- }
- public String getDocumentType()
- {
- return m_sDocumentType;
- }
-
- /*
- helper class for performance analyser features
- */
- private PerformanceContainer m_aPerformanceContainer = null;
- public PerformanceContainer getPerformance()
- {
- if (m_aPerformanceContainer == null)
- {
- m_aPerformanceContainer = new PerformanceContainer();
- }
- return m_aPerformanceContainer;
- }
-
- private String m_aInputFile;
- public void setInputFile(String _sInputFile)
- {
- m_aInputFile = _sInputFile;
- }
- public String getInputFile()
- {
- return m_aInputFile;
- }
-
- private String m_sDBInfoString;
- public String getDBInfoString()
- {
- if (m_sDBInfoString != null)
- {
- if (m_sDBInfoString.length() == 0)
- {
- return null;
- }
- }
-
- return m_sDBInfoString;
- }
-
- public boolean cancelRequest()
- {
- File aCancelFile = null;
- String fs;
- fs = System.getProperty("file.separator");
- String sTempPath = (String)m_aCurrentParams.get( PropertyName.TEMPPATH );
- if (sTempPath != null)
- {
- String sGDC_Dir = sTempPath;
-
- if (m_sDistinct.length() > 0)
- {
- sGDC_Dir = sGDC_Dir + fs + m_sDistinct;
- }
-
- String sCancelFile = sGDC_Dir + fs + "cancel_compare.txt";
- aCancelFile = new File(sCancelFile);
-
- if (aCancelFile.exists())
- {
- GlobalLogWriter.get().println("ATTENTION: Found file: '" + sCancelFile + "'.");
- GlobalLogWriter.get().println("User has canceled the program flow.");
- return true;
- }
- }
- return false;
- }
-
-}
-
-
-/*
-public class MSGraphicalTestArguments extends GraphicalTestArguments
-{
- MSGraphicalTestArguments()
- {
- setReferenceType("msoffice");
- }
-}
-
-public class OOoGraphicalTestArguments extends GraphicalTestArguments
-{
- OOoGraphicalTestArguments(XMultiServiceFactory _aFactory)
- {
- setMultiServiceFactory(_aFactory);
- }
-}
-*/
diff --git a/qadevOOo/runner/convwatch/HTMLOutputter.java b/qadevOOo/runner/convwatch/HTMLOutputter.java
deleted file mode 100644
index 9f5b650ea757..000000000000
--- a/qadevOOo/runner/convwatch/HTMLOutputter.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileWriter;
-import helper.OSHelper;
-
-public class HTMLOutputter {
- private FileWriter m_aOut;
- private String m_sFilename;
-
- /**
- * ls is the current line separator (carridge return)
- */
- private String ls;
-
- HTMLOutputter() {
- }
-
- public static HTMLOutputter create(String _sOutputPath,
- String _sHTMLFilename) {
- FileHelper.makeDirectories("", _sOutputPath);
- HTMLOutputter a = new HTMLOutputter();
- String fs = System.getProperty("file.separator");
- String sFilename = _sOutputPath + fs + _sHTMLFilename;
-
- try {
- File outputFile = new File(sFilename);
- a.m_aOut = new FileWriter(outputFile.toString());
- a.ls = System.getProperty("line.separator");
- } catch (java.io.IOException e) {
- e.printStackTrace();
- GlobalLogWriter.get().println("ERROR: Can't create HTML Outputter");
- return null;
- }
- a.m_sFilename = sFilename;
- return a;
- }
-
- public String getFilename() {
- return m_sFilename;
- }
-
- public void header(String _sTitle) {
- try {
- m_aOut.write("<html>" + ls);
- m_aOut.write("<head>" + ls);
- m_aOut.write("<title>" + _sTitle + "</title>" + ls);
- m_aOut.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />"
- + ls);
- m_aOut.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />"
- + ls);
- m_aOut.write("</head>" + ls);
- m_aOut.write("<body bgcolor=white>" + ls);
- m_aOut.flush();
- } catch (java.io.IOException e) {
- }
- }
-
- private final static String TEST_TABLETITLE = "Test";
- private final static String VISUAL_STATUS_TABLETITLE = "Visual status";
- private final static String VISUAL_STATUS_MESSAGE_TABLETITLE = "Message";
-
- public void indexSection(String _sOfficeInfo) {
- try {
- m_aOut.write("<h2>Results for " + _sOfficeInfo + "</h2>" + ls);
- m_aOut.write("<p>Legend:<br>");
- m_aOut.write(stronghtml(FIRSTGFX_TABLETITLE)
- + " contains the output printed via 'ghostscript' as a jpeg picture.<br>");
-
- m_aOut.write("<table class=\"infotable\">" + ls);
- m_aOut.write("<TR>");
- m_aOut.write(tableHeaderCell(TEST_TABLETITLE));
- m_aOut.write(tableHeaderCell(TEST_TABLETITLE));
- m_aOut.write(tableHeaderCell(VISUAL_STATUS_TABLETITLE));
- m_aOut.write(tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE));
- m_aOut.write("</TR>" + ls);
- m_aOut.flush();
- } catch (java.io.IOException e) {
- }
- }
-
- private String getHREF(String _sHREF, String _sPathInfo) {
- StringBuffer a = new StringBuffer();
- if (!OSHelper.isWindows()) {
- a.append("<A HREF=\"");
- a.append(_sHREF);
- a.append("\">");
- a.append(_sPathInfo);
- a.append("</A>");
- } else {
- // ! this should be replaced by a better method
- // ! name(WIN|UNIX)
- a.append("<A HREF=\"");
- a.append(_sHREF);
- a.append("\">");
- a.append(_sPathInfo);
- a.append("</A>");
-
- }
- return a.toString();
- }
-
- private String tableDataCell(String _sValue) {
- StringBuffer a = new StringBuffer();
- a.append("<TD>");
- a.append(_sValue);
- a.append("</TD>");
- return a.toString();
- }
-
- private String tableHeaderCell(String _sValue) {
- StringBuffer a = new StringBuffer();
- a.append("<TH>");
- a.append(_sValue);
- a.append("</TH>");
- return a.toString();
- }
-
- public void indexLine(String _sHTMLFile, String _sHTMLName,
- String _sHTMLFile2, String _sHTMLName2, String _sStatusRunThrough,
- String _sStatusMessage) {
- try {
- m_aOut.write("<TR>");
- m_aOut.write(tableDataCell(getHREF(_sHTMLFile, _sHTMLName)));
- if (_sHTMLFile2.length() > 0) {
- m_aOut.write(tableDataCell(getHREF(_sHTMLFile2, _sHTMLName2)));
- } else {
- m_aOut.write(tableDataCell(""));
- }
-
- m_aOut.write(tableDataCell(_sStatusRunThrough));
- m_aOut.write(tableDataCell(_sStatusMessage));
- m_aOut.write("</TR>" + ls);
-
- m_aOut.flush();
- } catch (java.io.IOException e) {
- }
- }
-
- public void close() {
- try {
- m_aOut.write("</TABLE>" + ls);
- m_aOut.write("</BODY></HTML>" + ls);
- m_aOut.flush();
- m_aOut.close();
- } catch (java.io.IOException e) {
- }
- }
-
- private String stronghtml(String _sValue) {
- StringBuffer a = new StringBuffer();
- a.append("<STRONG>");
- a.append(_sValue);
- a.append("</STRONG>");
- return a.toString();
- }
-
- private final static String FIRSTGFX_TABLETITLE = "Original print file as jpeg";
-
-}
diff --git a/qadevOOo/runner/convwatch/INIOutputter.java b/qadevOOo/runner/convwatch/INIOutputter.java
deleted file mode 100644
index 63a6eecd8335..000000000000
--- a/qadevOOo/runner/convwatch/INIOutputter.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileWriter;
-
-public class INIOutputter
-{
- private FileWriter m_aOut;
- private String m_sFilename;
-
-
- /**
- * ls is the current line separator (carriage return)
- */
- private String ls;
-
- public static INIOutputter create( String _sOutputPath, String _sHTMLFilename )
- {
- FileHelper.makeDirectories("", _sOutputPath);
- INIOutputter a = new INIOutputter();
- String fs = System.getProperty("file.separator");
- String sFilename = _sOutputPath + fs + _sHTMLFilename;
-
- try
- {
- File outputFile = new File(sFilename);
- a.m_aOut = new FileWriter(outputFile.toString());
- a.ls = System.getProperty("line.separator");
- }
- catch (java.io.IOException e)
- {
- e.printStackTrace();
- GlobalLogWriter.get().println("ERROR: Can't create INI Outputter");
- return null;
- }
- a.m_sFilename = sFilename;
-
- return a;
- }
- public String getFilename() {return m_sFilename;}
-
- public void createHeader()
- {
- try
- {
- m_aOut.write("; This file is automatically created by a convwatch run" + ls);
- m_aOut.write("; " + ls);
- m_aOut.write("; If you see this file in a browser you may have forgotten to set the follows in the property file" + ls);
- m_aOut.write("; " + PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX + "=http://lla-1.germany/gfxcmp/cw.php?inifile=" + ls);
- m_aOut.write("; Please check the documentation if you got confused." + ls);
- m_aOut.write("; " + ls);
- m_aOut.write("; " + ls);
- }
- catch (java.io.IOException e)
- {
- }
- }
-
- public void writeSection(String _sSectionName)
- {
- try
- {
- m_aOut.write("[" + _sSectionName + "]" + ls);
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
- public void writeValue(String _sName, String _sValue)
- {
- try
- {
- m_aOut.write(_sName + "=" + _sValue + ls);
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
-
-
- public void close()
- {
- try
- {
- m_aOut.flush();
- m_aOut.close();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
- public void checkLine(StatusHelper _aStatus, boolean _bCurrentResult)
- {
- try
- {
- m_aOut.write( "oldgfx=" + _aStatus.m_sOldGfx + ls);
- m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls);
- m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls);
-
- String sPercent = _aStatus.nPercent + "%";
- if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5)
- {
- sPercent += " (less 5% is ok)";
- }
- m_aOut.write("percent=" + sPercent + ls);
-
- if (_aStatus.m_sDiff_BM_Gfx == null)
- {
- m_aOut.write("BM=false" + ls);
- }
- else
- {
- m_aOut.write("BM=true" + ls);
- m_aOut.write( "old_BM_gfx=" + _aStatus.m_sOld_BM_Gfx + ls);
- m_aOut.write( "new_BM_gfx=" + _aStatus.m_sNew_BM_Gfx + ls);
- m_aOut.write( "diff_BM_gfx=" + _aStatus.m_sDiff_BM_Gfx + ls);
-
- String sPercent2 = _aStatus.nPercent2 + "%";
- if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5)
- {
- sPercent2 += " (less 5% is ok)";
- }
- m_aOut.write("percent2=" + sPercent2 + ls);
- }
-
- writeResult(_bCurrentResult);
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
- private void writeResult(boolean _bCurrentResult) throws java.io.IOException
- {
- // is the check positiv, in a defined range
- if (_bCurrentResult)
- {
- m_aOut.write("result=YES" + ls);
- }
- else
- {
- m_aOut.write("result=NO" + ls);
- }
- }
-
- public void checkDiffDiffLine(StatusHelper _aStatus, boolean _bCurrentResult)
- {
- try
- {
- m_aOut.write( "oldgfx=" + _aStatus.m_sOldGfx + ls);
- m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls);
- m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls);
-
- String sPercent = _aStatus.nPercent + "%";
- m_aOut.write("percent=" + sPercent + ls);
-
- // is the check positiv, in a defined range
- writeResult(_bCurrentResult);
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/ImageHelper.java b/qadevOOo/runner/convwatch/ImageHelper.java
deleted file mode 100644
index 5723c3fc85fb..000000000000
--- a/qadevOOo/runner/convwatch/ImageHelper.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.awt.Image;
-import java.awt.image.PixelGrabber;
-import java.awt.image.ImageObserver;
-import java.io.File;
-import java.lang.reflect.Method;
-
-class ImageHelper
-{
- private final Image m_aImage;
- private final int[] m_aPixels;
- private final int m_w;
-
-
- private ImageHelper(Image _aImage)
- {
- m_aImage = _aImage;
-
- // grab all (consume much memory)
- m_w = getWidth();
- int h = getHeight();
- int x = 0;
- int y = 0;
- m_aPixels = new int[m_w * h];
- PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, h, m_aPixels, 0, m_w);
- try {
- pg.grabPixels();
- } catch (InterruptedException e) {
- System.err.println("interrupted waiting for pixels!");
- return;
- }
- if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
- System.err.println("image fetch aborted or errored");
- return;
- }
- }
- public int getWidth() {return m_aImage.getWidth(null);}
- public int getHeight() {return m_aImage.getHeight(null);}
- // direct access to a pixel
- public int getPixel(int x, int y)
- {
- return m_aPixels[y * m_w + x];
- }
-
- public static ImageHelper createImageHelper(String _sFilename)
- throws java.io.IOException
- {
- Image aImage = null;
- File aFile = new File(_sFilename);
- Exception ex = null;
- try {
- Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO");
- Method readMethod = imageIOClass.getDeclaredMethod("read", new Class[]{java.io.File.class});
- Object retValue = readMethod.invoke(imageIOClass, new Object[]{aFile});
- aImage = (Image)retValue;
- }
- catch(java.lang.ClassNotFoundException e) {
- ex = e;
- }
- catch(java.lang.NoSuchMethodException e) {
- ex = e;
- }
- catch(java.lang.IllegalAccessException e) {
- ex = e;
- }
- catch(java.lang.reflect.InvocationTargetException e) {
- ex = e;
- }
-
- if (ex != null) {
- // get Java version:
- String javaVersion = System.getProperty("java.version");
- throw new java.io.IOException(
- "Cannot construct object with current Java version " +
- javaVersion + ": " + ex.getMessage());
- }
- return new ImageHelper(aImage);
- }
-}
diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java
deleted file mode 100644
index ddab207d1769..000000000000
--- a/qadevOOo/runner/convwatch/IniFile.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-
-/**
- Helper class to give a simple API to read/write windows like ini files
- */
-/* public */ // is only need, if we need this class outside package convwatch
-class IniFile
-{
- /**
- * internal representation of the ini file content.
- * Problem, if ini file changed why other write something difference, we don't realise this.
- */
- private final String m_sFilename;
- private final ArrayList<String> m_aList;
-
- /**
- open a ini file by its name
- @param _sFilename string a filename, if the file doesn't exist, a new empty ini file will create.
- write back to disk only if there are really changes.
- */
- public IniFile(String _sFilename)
- {
- m_sFilename = _sFilename;
- m_aList = loadLines();
- }
-
- private ArrayList<String> loadLines()
- {
- File aFile = new File(m_sFilename);
- ArrayList<String> aLines = new ArrayList<String>();
- if (! aFile.exists())
- {
- GlobalLogWriter.get().println("couldn't find file " + m_sFilename);
- return aLines;
- }
- RandomAccessFile aReader = null;
- try
- {
- aReader = new RandomAccessFile(aFile,"r");
- String aLine = "";
- while (aLine != null)
- {
- aLine = aReader.readLine();
- if (aLine != null)
- {
- aLines.add(aLine);
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.get().println("couldn't open file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.get().println("Exception occurs while reading from file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
- }
- try
- {
- aReader.close();
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.get().println("Couldn't close file " + m_sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
- }
- return aLines;
- }
-
- /**
- * @return true, if the ini file contain some readable data
- */
- public boolean is()
- {
- return m_aList.size() > 1;
- }
-
-
-
- private boolean isRemark(String _sLine)
- {
- return _sLine.length() < 2 ||
- _sLine.startsWith("#") ||
- _sLine.startsWith(";");
- }
-
- private String getItem(int i)
- {
- return m_aList.get(i);
- }
-
- private String buildSectionName(String _sSectionName)
- {
- String sFindSection = "[" + _sSectionName + "]";
- return sFindSection;
- }
- private String toLowerIfNeed(String _sName)
- {
- return _sName.toLowerCase();
- }
-
- // return the number where this section starts
- private int findSection(String _sSection)
- {
- String sFindSection = toLowerIfNeed(buildSectionName(_sSection));
- // ----------- find _sSection ---------------
- int i;
- for (i=0; i<m_aList.size();i++)
- {
- String sLine = toLowerIfNeed(getItem(i).trim());
- if (isRemark(sLine))
- {
- continue;
- }
- if (sFindSection.equals("[]"))
- {
- // special case, empty Section.
- return i - 1;
- }
- if (sLine.startsWith(sFindSection))
- {
- return i;
- }
- }
- return -1;
- }
-
- // return the line number, where the key is found.
- private int findKey(String _sSection, String _sKey)
- {
- int i = findSection(_sSection);
- if (i == -1)
- {
- // Section not found, therefore the value can't exist
- return -1;
- }
- return findKeyFromKnownSection(i, _sKey);
- }
-
- // i must be the index in the list, where the well known section starts
- private int findKeyFromKnownSection(int _nSectionIndex, String _sKey)
- {
- _sKey = toLowerIfNeed(_sKey);
- for (int j=_nSectionIndex + 1; j<m_aList.size();j++)
- {
- String sLine = getItem(j).trim();
-
- if (isRemark(sLine))
- {
- continue;
- }
-
- if (sLine.startsWith("["))
- {
- // found end.
- break;
- }
-
- int nEqual = sLine.indexOf('=');
- if (nEqual >= 0)
- {
- String sKey = toLowerIfNeed(sLine.substring(0, nEqual).trim());
- if (sKey.equals(_sKey))
- {
- return j;
- }
- }
- }
- return -1;
- }
-
- private String getValue(int _nIndex)
- {
- String sLine = getItem(_nIndex).trim();
- if (isRemark(sLine))
- {
- return "";
- }
- int nEqual = sLine.indexOf('=');
- if (nEqual >= 0)
- {
- String sValue = sLine.substring(nEqual + 1).trim();
- return sValue;
- }
- return "";
- }
-
- /**
- @param _sSection string
- @param _sKey string
- @return the value found in the inifile which is given by the section and key parameter
- */
- public String getValue(String _sSection, String _sKey)
- {
- String sValue = "";
- int i = findKey(_sSection, _sKey);
- if (i == -1)
- {
- // Section not found, therefore the value can't exist
- return "";
- }
-
- sValue = getValue(i);
-
- return sValue;
- }
-
-
-
-
-
-
-
-}
diff --git a/qadevOOo/runner/convwatch/LISTOutputter.java b/qadevOOo/runner/convwatch/LISTOutputter.java
deleted file mode 100644
index 175b32d3b2a6..000000000000
--- a/qadevOOo/runner/convwatch/LISTOutputter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileWriter;
-
-public class LISTOutputter
-{
- private FileWriter m_aOut;
- private String m_sFilename;
-
- /**
- * ls is the current line separator (carridge return)
- */
- private String ls;
-
- public static LISTOutputter create( String _sOutputPath, String _sFilename)
- {
- FileHelper.makeDirectories("", _sOutputPath);
- LISTOutputter a = new LISTOutputter();
- String fs = System.getProperty("file.separator");
- String sFilename = _sOutputPath + fs + _sFilename;
-
- try
- {
- File outputFile = new File(sFilename);
- a.m_aOut = new FileWriter(outputFile.toString());
- a.ls = System.getProperty("line.separator");
- }
- catch (java.io.IOException e)
- {
- e.printStackTrace();
- GlobalLogWriter.get().println("ERROR: Can't create LIST Outputter");
- return null;
- }
- a.m_sFilename = sFilename;
-
- return a;
- }
- public String getFilename() {return m_sFilename;}
-
-
-
- public void writeValue(String _sValue)
- {
- try
- {
- m_aOut.write(_sValue + ls);
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
- public void close()
- {
- try
- {
- m_aOut.flush();
- m_aOut.close();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java
deleted file mode 100644
index e6235bed9716..000000000000
--- a/qadevOOo/runner/convwatch/MSOfficePrint.java
+++ /dev/null
@@ -1,867 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.RandomAccessFile;
-import helper.ProcessHandler;
-import java.util.ArrayList;
-import helper.OSHelper;
-
-/**
- * This object gives all functionallity to print msoffice documents.
- * It also offers functions to check what type of document it is.
- * It handles *.doc as word documents and use word to print
- * *.xls as excel
- * *.ppt as powerpoint
- */
-
-class ProcessHelper
-{
- ArrayList<String> m_aArray;
-}
-
-public class MSOfficePrint
-{
- private String m_sPrinterName; // within Windows the tools need a printer name;
-
- private void setPrinterName(String _s) {m_sPrinterName = _s;}
-
-
- private static boolean isWordDocument(String _sSuffix)
- {
- return _sSuffix.toLowerCase().endsWith(".doc") ||
- _sSuffix.toLowerCase().endsWith(".rtf") ||
- _sSuffix.toLowerCase().endsWith(".dot");
- }
-
- private static boolean isExcelDocument(String _sSuffix)
- {
- // xlt templates
- // xlw
- // xla addin
- if (_sSuffix.toLowerCase().endsWith(".xls"))
- {
- return true;
- }
- /* temporal insertion by SUS
- if (_sSuffix.endsWith(".xml"))
- {
- return true;
- }*/
- return false;
- }
-
- private static boolean isPowerPointDocument(String _sSuffix)
- {
- return _sSuffix.toLowerCase().endsWith(".pps") ||
- _sSuffix.toLowerCase().endsWith(".ppt");
- }
-
- /**
- * returns true, if the given filename has a MS Office suffix.
- */
- public static 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 suffix is xml, return also true, but we can't decide if word or excel
- if (sDocumentSuffix.toLowerCase().endsWith(".xml")) return true;
- return false;
- }
-
- public void storeToFileWithMSOffice( GraphicalTestArguments _aGTA,
- String _sInputFile,
- String _sOutputFile) throws ConvWatchCancelException, java.io.IOException
- {
- String sDocumentSuffix = FileHelper.getSuffix(_sInputFile);
- String sFilterName = _aGTA.getExportFilterName();
- ArrayList<String> aStartCommand = new ArrayList<String>();
- if (isWordDocument(sDocumentSuffix))
- {
- aStartCommand = createWordStoreHelper();
- }
- else if (isExcelDocument(sDocumentSuffix))
- {
- aStartCommand = createExcelStoreHelper();
- }
- else if (isPowerPointDocument(sDocumentSuffix))
- {
- }
- else if (sDocumentSuffix.equalsIgnoreCase(".xml"))
- {
- // special case, if xml we prefer word, but with DEFAULT_XML_FORMAT_APP=excel it's changeable.
- if (_aGTA.getDefaultXMLFormatApp().equalsIgnoreCase("excel"))
- {
- aStartCommand = createExcelStoreHelper();
- }
- }
- else
- {
- GlobalLogWriter.get().println("No Microsoft Office document format found.");
-// TODO: use a better Exception!!!
- throw new ConvWatchCancelException/*WrongSuffixException*/("No MS office document format found.");
- }
- if (aStartCommand != null)
- {
- if (sFilterName == null)
- {
-// TODO: hardcoded FilterName in perl script
- sFilterName = ""; // xlXMLSpreadsheet";
- }
-
- aStartCommand.add(_sInputFile);
- aStartCommand.add(sFilterName);
- aStartCommand.add(_sOutputFile);
- realStartCommand(aStartCommand);
- }
- }
-
-
- /**
- * print the given file (_sInputFile) to the file name (_sPrintFile)
- */
- public void printToFileWithMSOffice( GraphicalTestArguments _aGTA,
- String _sInputFile,
- String _sPrintFilename) throws ConvWatchCancelException, java.io.IOException
- {
- String sDocumentSuffix = FileHelper.getSuffix(_sInputFile);
-
- setPrinterName(_aGTA.getPrinterName());
-
- ArrayList<String> aStartCommand = new ArrayList<String>();
- if (isWordDocument(sDocumentSuffix))
- {
- aStartCommand = createWordPrintHelper();
- }
- else if (isExcelDocument(sDocumentSuffix))
- {
- aStartCommand = createExcelPrintHelper();
- }
- else if (isPowerPointDocument(sDocumentSuffix))
- {
- aStartCommand = createPowerPointPrintHelper();
- }
- else if (sDocumentSuffix.equalsIgnoreCase(".xml"))
- {
-// TODO: Open XML File and check if we need excel or word
- String sOfficeType = getOfficeType(_sInputFile);
-
- // special case, if xml we prefer word, but with DEFAULT_XML_FORMAT_APP=excel it's changeable.
- if (sOfficeType.equals("excel"))
- {
- aStartCommand = createExcelPrintHelper();
- }
- else if (sOfficeType.equals("word"))
- {
- aStartCommand = createWordPrintHelper();
- }
- else
- {
- return;
- }
- }
- else
- {
- GlobalLogWriter.get().println("No Microsoft Office document format found.");
-// TODO: use a better Exception!!!
- throw new ConvWatchCancelException/*WrongSuffixException*/("No Mircosoft Office document format found.");
- }
-
- if (!aStartCommand.isEmpty())
- {
- String sPrinterName = m_sPrinterName;
- if (sPrinterName == null)
- {
- sPrinterName = "";
- }
-
- aStartCommand.add(_sInputFile);
- aStartCommand.add(m_sPrinterName);
- aStartCommand.add(_sPrintFilename);
-
- realStartCommand(aStartCommand);
- }
- String sUserDir = System.getProperty("user.home");
- String fs = System.getProperty("file.separator");
- if (! sUserDir.endsWith(fs))
- {
- sUserDir = sUserDir + fs;
- }
- _aGTA.getPerformance().readWordValuesFromFile(sUserDir + "msofficeloadtimes.txt");
- OfficePrint.createInfoFile(_sPrintFilename, _aGTA, "msoffice");
- TimeHelper.waitInSeconds(2, "Give Microsoft Office some time to print.");
- }
-
- private void realStartCommand(ArrayList<String> _aStartCommand) throws ConvWatchCancelException
- {
- if (_aStartCommand.isEmpty())
- {
- throw new ConvWatchCancelException/*WrongEnvironmentException*/("Given list is empty.");
- }
-
- try
- {
- // Convert the StartCommand ArrayList to a String List
- int nValues = _aStartCommand.size();
- String[] aList = new String[nValues];
- for (int i=0;i<nValues;i++)
- {
- String aStr = _aStartCommand.get(i);
- if (aStr == null)
- {
- aStr = "";
- }
- if (aStr.length() == 0)
- {
- aStr = "\"\"";
- }
- aList[i] = aStr;
- }
-
- // This is really the latest point where we can check if we are running within windows environment
- if (! OSHelper.isWindows())
- {
- // TODO: use a better Exception!!!
- throw new ConvWatchCancelException/*WrongEnvironmentException*/("We don't work within windows environment.");
- }
-
-
- ProcessHandler aHandler = new ProcessHandler(aList);
- aHandler.executeSynchronously();
- }
- catch (IndexOutOfBoundsException e)
- {
- throw new ConvWatchCancelException/*WrongEnvironmentException*/("Given list is too short.", e);
- }
-
- // return aHandler.getExitCode();
- }
-
-
- private ArrayList<String> createWordPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
- String fs = System.getProperty("file.separator");
-
- String sPrintViaWord = "printViaWord.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaWord);
- if (!aList.isEmpty())
- {
- return aList;
- }
-
- String sName = sTmpPath + fs + sPrintViaWord;
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile.toString());
-
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( "use Time::HiRes; " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Windows only.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE; " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Word'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: word_print.pl <Word file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " execl_print.pl c:\\book1.doc Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Too less arguments.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $startWordTime = Time::HiRes::time(); " + ls );
- out.write( "my $Word = Win32::OLE->new('Word.Application'); " + ls );
- out.write( "my $stopWordTime = Time::HiRes::time() - $startWordTime; " + ls );
- out.write( "# $Word->{'Visible'} = 1; # if you want to see what's going on " + ls );
- out.write( "# , ReadOnly => 1})" + ls );
- out.write(ls);
- out.write( "my $startLoadWordTime = Time::HiRes::time(); " + ls );
- out.write( "$Word->Documents->Open({Filename => $ARGV[0]}) " + ls );
- out.write( " || die('Unable to open document ', Win32::OLE->LastError()); " + ls );
- out.write( "my $stopLoadWordTime = Time::HiRes::time() - $startLoadWordTime; " + ls );
- out.write(ls);
- out.write( "my $startPrintWordTime = Time::HiRes::time(); " + ls);
- out.write( "my $oldActivePrinte = $Word->{ActivePrinter} ; " + ls );
- out.write( "$Word->{ActivePrinter} = $ARGV[1]; " + ls );
- out.write( "$Word->ActiveDocument->PrintOut({ " + ls );
- out.write( " Background => 0, " + ls );
- out.write( " Append => 0, " + ls );
- out.write( " Range => wdPrintAllDocument, " + ls );
- out.write( " Item => wdPrintDocumentContent, " + ls );
- out.write( " Copies => 1, " + ls );
- out.write( " PageType => wdPrintAllPages, " + ls );
- out.write( " PrintToFile => 1, " + ls );
- out.write( " OutputFileName => $ARGV[2] " + ls );
- out.write( " }); " + ls );
- out.write( "$Word->{ActivePrinter} = $oldActivePrinte; " + ls );
- out.write( "my $stopPrintWordTime = Time::HiRes::time() - $startPrintWordTime;" + ls);
-
- out.write( "# ActiveDocument.Close(SaveChanges:=WdSaveOptions.wdDoNotSaveChanges)" + ls );
- out.write( "my $sVersion = $Word->Application->Version();"+ls);
- out.write( "$Word->ActiveDocument->Close({SaveChanges => 0}); " + ls );
- out.write( "$Word->Quit(); " + ls );
-
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"WordVersion=$sVersion\\n\";" + ls);
- out.write( " print FILE \"WordStartTime=$stopWordTime\\n\";" + ls);
- out.write( " print FILE \"WordLoadTime=$stopLoadWordTime\\n\";" + ls);
- out.write( " print FILE \"WordPrintTime=$stopPrintWordTime\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
-
- // TODO: Maybe give a possibility to say where search the script from outside
-
- private ArrayList<String> searchLocalFile(String _sScriptName)
- {
- String userdir = System.getProperty("user.dir");
- String fs = System.getProperty("file.separator");
-
- ArrayList<String> aList = new ArrayList<String>();
- File aPerlScript = new File(userdir + fs + _sScriptName);
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("Search for local existence of " + aPerlScript.getAbsolutePath());
- }
-
- if (aPerlScript.exists())
- {
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("OK, found it, use this instead the internal one.");
- }
-
- String sName = aPerlScript.getAbsolutePath();
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
- return aList;
- }
-
- private ArrayList<String> createWordStoreHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
- String fs = System.getProperty("file.separator");
-
- String sSaveViaWord = "saveViaWord.pl";
-
- ArrayList<String> aList = searchLocalFile(sSaveViaWord);
- if (!aList.isEmpty())
- {
- return aList;
- }
-
- String sName = sTmpPath + fs + sSaveViaWord;
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("No local found, create a perl script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile.toString());
-
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( " " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Windows only.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE; " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Word'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: storeViaWord.pl <Word file> <output filer> <output file> \\n\" " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Too less arguments.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "my $Word = Win32::OLE->new('Word.Application'); " + ls );
- out.write( "# $Word->{'Visible'} = 1; # if you want to see what's going on " + ls );
- out.write( "my $Book = $Word->Documents->Open($ARGV[0]) " + ls );
- out.write( " || die('Unable to open document ', Win32::OLE->LastError()); " + ls );
- out.write( "# my $oldActivePrinte = $Word->{ActivePrinter} ; " + ls );
- out.write( "# $Word->{ActivePrinter} = $ARGV[1]; " + ls );
- out.write( "# $Word->ActiveDocument->PrintOut({ " + ls );
- out.write( "# Background => 0, " + ls );
- out.write( "# Append => 0, " + ls );
- out.write( "# Range => wdPrintAllDocument, " + ls );
- out.write( "# Item => wdPrintDocumentContent, " + ls );
- out.write( "# Copies => 1, " + ls );
- out.write( "# PageType => wdPrintAllPages, " + ls );
- out.write( "# PrintToFile => 1, " + ls );
- out.write( "# OutputFileName => $ARGV[2] " + ls );
- out.write( "# }); " + ls );
- out.write( "# $Word->{ActivePrinter} = $oldActivePrinte; " + ls );
- out.write( "$Book->savaAs($ARGV[2], $ARGV[1]); " + ls );
- out.write( "# ActiveDocument.Close(SaveChanges:=WdSaveOptions.wdDoNotSaveChanges)" + ls );
- out.write( "$Book->Close({SaveChanges => 0}); " + ls );
- out.write( "$Word->Quit(); " + ls );
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
-
-
- private ArrayList<String> createExcelPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
- String fs = System.getProperty("file.separator");
-
- String sPrintViaExcel = "printViaExcel.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaExcel);
- if (!aList.isEmpty())
- {
- return aList;
- }
- String sName = sTmpPath + fs + sPrintViaExcel;
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("No local found, create a perl script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile.toString());
-
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( " " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Windows only.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE qw(in with); " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Excel'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: printViaExcel.pl <Excel file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " execl_print.pl c:\\book1.xls Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Too less arguments.\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[0] $ARGV[0]\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[1] $ARGV[1]\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[2] $ARGV[2]\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $Excel = Win32::OLE->GetActiveObject('Excel.Application') " + ls );
- out.write( " || Win32::OLE->new('Excel.Application', 'Quit'); # get already active Excel " + ls );
- out.write( " # application or open new " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "my $Book = $Excel->Workbooks->Open( $ARGV[0] ); " + ls );
- out.write( " $Book->PrintOut({Copies => 1, " + ls );
- out.write( " ActivePrinter => $ARGV[1], " + ls );
- out.write( " PrToFileName => $ARGV[2], " + ls );
- out.write( " Collate => 1 " + ls );
- out.write( " }); " + ls );
- out.write( "# Close worksheets without store changes" + ls );
- out.write( "# $Book->Close({SaveChanges => 0}); " + ls );
- out.write( "my $sVersion = $Excel->Application->Version();"+ls);
- out.write( "$Excel->Quit(); " + ls );
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"ExcelVersion=$sVersion\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
-
- private ArrayList<String> createExcelStoreHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
- String fs = System.getProperty("file.separator");
-
- String sSaveViaExcel = "saveViaExcel.pl";
-
- ArrayList<String> aList = searchLocalFile(sSaveViaExcel);
- if (!aList.isEmpty())
- {
- return aList;
- }
- String sName = sTmpPath + fs + sSaveViaExcel;
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("No local found, create a script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile.toString());
-
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( "# This script is automatically created. " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE qw(in with); " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Excel'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: savaViaExcel.pl <Excel file> <filefilter> <output file> .\\n " + ls );
- out.write( " execl_print.pl c:\\book1.xls Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Too less arguments.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $Excel = Win32::OLE->GetActiveObject('Excel.Application') " + ls );
- out.write( " || Win32::OLE->new('Excel.Application', 'Quit'); # get already active Excel " + ls );
- out.write( " # application or open new " + ls );
- out.write( "my $sFilterParameter = $ARGV[1]; " + ls );
- out.write( "my $sFilterName = xlHTML; " + ls );
- out.write( "if ($sFilterParameter eq 'xlXMLSpreadsheet') " + ls );
- out.write( "{ " + ls );
- out.write( " $sFilterName = xlXMLSpreadsheet; " + ls );
- out.write( "} " + ls );
- out.write( "elsif ($sFilterParameter eq 'xlHTML') " + ls );
- out.write( "{ " + ls );
- out.write( " $sFilterName = xlHTML; " + ls );
- out.write( "} " + ls );
- out.write( "else " + ls );
- out.write( "{ " + ls );
- out.write( " my $undefined; " + ls);
- out.write( " $sFilterName = $undefined; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $Book = $Excel->Workbooks->Open( $ARGV[0] ); " + ls );
- out.write( "$Excel->{DisplayAlerts} = 0; " + ls );
- out.write( "$Book->saveAs($ARGV[2], " + ls );
- out.write( " $sFilterName, " + ls );
- out.write( " '', " + ls );
- out.write( " '', " + ls );
- out.write( " 0, " + ls );
- out.write( " 0, " + ls );
- out.write( " xlNoChange, " + ls );
- out.write( " xlLocalSessionChanges, " + ls );
- out.write( " 1); " + ls );
- out.write( "# Close worksheets without store changes" + ls );
- out.write( "# $Book->Close({SaveChanges => 0}); " + ls );
- out.write( "$Excel->Quit(); " + ls );
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
-
- private ArrayList<String> createPowerPointPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
- String fs = System.getProperty("file.separator");
-
- String sPrintViaPowerPoint = "printViaPowerPoint.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaPowerPoint);
- if (!aList.isEmpty())
- {
- return aList;
- }
- String sName = sTmpPath + fs + sPrintViaPowerPoint;
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.get().println("No local found, create a script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile.toString());
-
- out.write( "eval 'exec perl -wS $0 $1 $2 ' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( " " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Windows only.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE qw(in with); " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft PowerPoint'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: powerpoint_print.pl <PowerPoint file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " powerpoint_print.pl c:\\book.ppt Apple LaserWriter II NT v47.0 c:\\output\\book.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV < 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Too less arguments.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $PowerPoint = Win32::OLE->GetActiveObject('PowerPoint.Application') " + ls );
- out.write( " || Win32::OLE->new('PowerPoint.Application', 'Quit'); # get already active Excel " + ls );
- out.write( " # application or open new " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " $PowerPoint->{'Visible'} = 1; " + ls );
- out.write( " my $Presentation = $PowerPoint->Presentations->Add; " + ls );
- out.write( " my $Presentation = $PowerPoint->Presentations->Open( $ARGV[0] ); " + ls );
- out.write( "# we can't change active printer in powerpoint " + ls );
- out.write( "# $Presentation->PrintOptions->{ActivePrinter} = $ARGV[1]; " + ls );
- out.write( " print \"Active printer is: \" . $Presentation->PrintOptions->{ActivePrinter} . \"\\n\"; " + ls );
- out.write( " $Presentation->PrintOptions->{PrintInBackground} = 0; " + ls );
- out.write( " # PrintColorType = 1 means print in color and PrintColorType = 2 means print in gray " + ls );
- out.write( " $Presentation->PrintOptions->{PrintColorType} = 1; " + ls );
- out.write( " " + ls );
- out.write( " $Presentation->PrintOut({PrintToFile => $ARGV[2]}); " + ls );
- out.write( " sleep 5; " + ls );
- out.write( " print \"Presentation has been printed\\n\"; " + ls );
- out.write( "my $sVersion = $Presentation->Application->Version();"+ls);
- out.write( " $PowerPoint->Quit(); " + ls );
-
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"PowerPointVersion=$sVersion\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
-
- /**
- @param _sFilename a name to a ms office xml file
- @return 'word' or 'excel' or '' if type not known
- */
- private String getOfficeType(String _sFilename)
- {
- File aFile = new File(_sFilename);
- if (! aFile.exists())
- {
- GlobalLogWriter.get().println("couldn't find file " + _sFilename);
- return "";
- }
- RandomAccessFile aReader = null;
- String sOfficeType = "";
- try
- {
- aReader = new RandomAccessFile(aFile,"r");
- String aLine = "";
- while (aLine != null)
- {
- aLine = aReader.readLine();
- if (aLine != null)
- {
- aLine = aLine.trim();
- if ( (aLine.length() >= 2 ) &&
- (! aLine.startsWith("#")) &&
- (! aLine.startsWith(";")) )
- {
- int nIdx = aLine.indexOf("mso-application");
- if (nIdx > 0)
- {
- if (aLine.indexOf("Word.Document") > 0)
- {
- sOfficeType = "word";
- }
- else if (aLine.indexOf("Excel") > 0)
- {
- sOfficeType = "excel";
- }
- else
- {
- GlobalLogWriter.get().println("Unknown/unsupported data file: " + aLine);
- }
- }
- }
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- System.out.println("couldn't open file " + _sFilename);
- System.out.println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- System.out.println("Exception while reading file " + _sFilename);
- System.out.println("Message: " + ie.getMessage());
- }
- try
- {
- aReader.close();
- }
- catch (java.io.IOException ie)
- {
- System.out.println("Couldn't close file " + _sFilename);
- System.out.println("Message: " + ie.getMessage());
- }
- return sOfficeType;
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/NameHelper.java b/qadevOOo/runner/convwatch/NameHelper.java
deleted file mode 100644
index cade9b55360f..000000000000
--- a/qadevOOo/runner/convwatch/NameHelper.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-/**
- * This container class should help to handle the name of the current document
- */
-
-public class NameHelper
-{
- /**
- *
- */
- String m_sOutputPath;
-
- /**
- *
- */
- String m_sRelativeOutputPath;
-
- /**
- *
- */
- String m_sNameNoSuffix;
- String m_sSuffix;
-
- public NameHelper(String _sOutputPath, String _sRelativeOutputPath, String _sBasename)
- {
- m_sOutputPath = _sOutputPath;
- m_sRelativeOutputPath = _sRelativeOutputPath;
- String sNameNoSuffix = FileHelper.getNameNoSuffix(_sBasename);
- m_sNameNoSuffix = sNameNoSuffix;
- m_sSuffix = FileHelper.getSuffix(_sBasename);
- }
- /**
- * @return the OutputPath
- */
- public String getOutputPath() {return m_sOutputPath;}
-
- /**
- * @return the relative OutputPath
- */
- public String getRelativePath() {return m_sRelativeOutputPath;}
-
- /**
- * @return the document name without it's suffix
- */
- public String getName() {return m_sNameNoSuffix;}
-
- /**
- * @return the document suffix from the original document
- */
- public String getSuffix() {return m_sSuffix;}
-
- public void print()
- {
- GlobalLogWriter.get().println(" Outputpath: " + m_sOutputPath);
- GlobalLogWriter.get().println("relative Outputpath: " + m_sRelativeOutputPath);
- GlobalLogWriter.get().println(" Name: " + m_sNameNoSuffix);
- GlobalLogWriter.get().println(" Suffix: " + m_sSuffix);
-
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java
deleted file mode 100644
index ada4cb917e91..000000000000
--- a/qadevOOo/runner/convwatch/OfficePrint.java
+++ /dev/null
@@ -1,1162 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.io.FileWriter;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.document.XTypeDetection;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.frame.XDesktop;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.lang.XComponent;
-import com.sun.star.frame.XStorable;
-import com.sun.star.view.XPrintable;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.frame.XModel;
-import com.sun.star.uno.AnyConverter;
-
-import helper.URLHelper;
-import helper.PropertyHelper;
-import helper.OSHelper;
-
-/**
- * This Object is to print a given document with OpenOffice.org / StarOffice
- * over the normal printer driver
- * or over it's pdf exporter
- */
-public class OfficePrint {
-
-
- private static void showProperty(PropertyValue _aValue)
- {
- String sName = _aValue.Name;
- String sValue;
- try
- {
- sValue = AnyConverter.toString(_aValue.Value);
- GlobalLogWriter.get().println("Property " + sName + ":=" + sValue);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- // GlobalLogWriter.get().println("showProperty: can't convert a object to string.");
- GlobalLogWriter.get().println("Property " + sName + ":= a Object which can't convert by AnyConverter()");
- }
- }
-
- /**
- * shows the FilterName and MediaType from the given XComponent
- */
- private static String getDocumentType( XComponent _aDoc )
- {
- XModel xModel = UnoRuntime.queryInterface( XModel.class, _aDoc);
- PropertyValue[] aArgs = xModel.getArgs();
- for (int i=0;i<aArgs.length;i++)
- {
- PropertyValue aValue = aArgs[i];
- if (aValue.Name.equals("FilterName") ||
- aValue.Name.equals("MediaType"))
- {
- String sNameValue = "'" + aValue.Name + "' := '" + aValue.Value + "'";
- return sNameValue;
- }
- }
- return "";
- }
-
- private static void showDocumentType( XComponent _aDoc )
- {
- String sNameValue = getDocumentType(_aDoc);
- GlobalLogWriter.get().println(" Property: '" + sNameValue);
- }
- /**
- * load a OpenOffice.org document from a given URL (_sInputURL)
- * 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.
- */
- private static XComponent loadFromURL(GraphicalTestArguments _aGTA,
- String _sInputURL)
- {
- XComponent aDoc = null;
- try
- {
- if (_aGTA.getMultiServiceFactory() == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory in GraphicalTestArgument not set.");
- return null;
- }
- Object oDsk = _aGTA.getMultiServiceFactory().createInstance("com.sun.star.frame.Desktop");
- XDesktop aDesktop = UnoRuntime.queryInterface(XDesktop.class, oDsk);
-
- if (aDesktop != null)
- {
- GlobalLogWriter.get().println("com.sun.star.frame.Desktop created.");
-
-
- // set here the loadComponentFromURL() properties
- // at the moment only 'Hidden' is set, so no window is opened at work
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
-
- // set all property values
- if (_aGTA.isHidden())
- {
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "Hidden";
- Arg.Value = Boolean.TRUE;
- aPropertyList.add(Arg);
- showProperty(Arg);
- }
- if (_aGTA.getImportFilterName() != null && _aGTA.getImportFilterName().length() > 0)
- {
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "FilterName";
- Arg.Value = _aGTA.getImportFilterName();
- aPropertyList.add(Arg);
- showProperty(Arg);
- }
-
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
-
- XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
-
- _aGTA.getPerformance().startTime(PerformanceContainer.Load);
- aDoc = aCompLoader.loadComponentFromURL(_sInputURL, "_blank", 0, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList) );
- _aGTA.getPerformance().stopTime(PerformanceContainer.Load);
- if (aDoc != null)
- {
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document done.");
- showDocumentType(aDoc);
- _aGTA.setDocumentType(getDocumentType(aDoc));
- }
- else
- {
- GlobalLogWriter.get().println(" Load document failed.");
- if (_aGTA.getImportFilterName() != null && _aGTA.getImportFilterName().length() > 0)
- {
- GlobalLogWriter.get().println(" Please check FilterName := '" + _aGTA.getImportFilterName() + "'");
- }
- GlobalLogWriter.get().println("");
- }
- }
- else
- {
- GlobalLogWriter.get().println("com.sun.star.frame.Desktop failed.");
- }
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
- e.printStackTrace();
- }
- return aDoc;
- }
-
- private static boolean exportToPDF(XComponent _xComponent, String _sDestinationName)
- {
- XServiceInfo xServiceInfo =
- UnoRuntime.queryInterface(
- XServiceInfo.class, _xComponent
- );
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
- PropertyValue aFiltername = new PropertyValue();
- aFiltername.Name = "FilterName";
- aFiltername.Value = getFilterName_forPDF(xServiceInfo);
- aPropertyList.add(aFiltername);
- showProperty(aFiltername);
- boolean bWorked = true;
-
- try
- {
- XStorable store =
- 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());
- bWorked = false;
- }
-
- return bWorked;
- }
-
- private static String getFilterName_forPDF(XServiceInfo xServiceInfo)
- {
- String filterName = "";
-
- if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
- {
- //writer
- filterName = "writer_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
- {
- //calc
- filterName = "calc_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.drawing.DrawingDocument" ) )
- {
- //draw
- filterName = "draw_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.presentation.PresentationDocument" ) )
- {
- //impress
- filterName = "impress_pdf_Export";
- }
- else if (xServiceInfo.supportsService("com.sun.star.text.WebDocument"))
- {
- //html document
- filterName = "writer_web_pdf_Export";
- }
- else if ( xServiceInfo.supportsService("com.sun.star.text.GlobalDocument") )
- {
- //master document
- filterName = "writer_globaldocument_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.formulaFormulaProperties" ) )
- {
- //math document
- filterName = "math_pdf_Export";
- }
-
- return filterName;
- }
-
-
-
- private static boolean storeAsPDF(GraphicalTestArguments _aGTA,
- String _sInputURL,
- String _sOutputURL)
- {
- boolean bBack = false;
- XComponent aDoc = loadFromURL(_aGTA, _sInputURL);
-
- if (aDoc == null)
- {
- GlobalLogWriter.get().println("Can't load document.");
- return bBack;
- }
- bBack = storeAsPDF(_aGTA, aDoc, _sOutputURL);
- createInfoFile(_sOutputURL, _aGTA, "as pdf");
-
- GlobalLogWriter.get().println("Close document.");
- aDoc.dispose();
- return bBack;
- }
-
- private static boolean storeAsPDF(GraphicalTestArguments _aGTA,
- XComponent _aDoc,
- String _sOutputURL)
- {
- // try {
- boolean bBack = true;
- _aGTA.getPerformance().startTime(PerformanceContainer.StoreAsPDF);
- bBack = exportToPDF(_aDoc, _sOutputURL);
- _aGTA.getPerformance().stopTime(PerformanceContainer.StoreAsPDF);
-
- if (!bBack)
- {
- GlobalLogWriter.get().println("Can't store document as PDF.");
- bBack = false;
- }
- return bBack;
- }
-
-
-
- /**
- * print the document found in file (_sInputURL) to as postscript to file (_sPrintFileURL)
- * 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.
- *
- * @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 existence of _sPrintFileURL
- */
-
- private static boolean printToFileWithOOo(GraphicalTestArguments _aGTA,
- String _sInputURL,
- String _sOutputURL,
- String _sPrintFileURL)
- {
- boolean bBack = false;
-
- XComponent aDoc = loadFromURL(_aGTA, _sInputURL);
- if (aDoc != null)
- {
- if ( _sInputURL.equals(_sOutputURL) )
- {
- // don't store document
- // input and output are equal OR
- GlobalLogWriter.get().println("Warning: Inputpath and Outputpath are equal. Document will not stored again.");
- _aGTA.disallowStore();
- }
- bBack = impl_printToFileWithOOo(_aGTA, aDoc, _sOutputURL, _sPrintFileURL);
-
- GlobalLogWriter.get().println("Close document.");
- aDoc.dispose();
- }
- else
- {
- GlobalLogWriter.get().println("loadDocumentFromURL() failed with document: " + _sInputURL);
- }
- return bBack;
- }
-
-
- private static void createInfoFile(String _sFile, GraphicalTestArguments _aGTA)
- {
- createInfoFile(_sFile, _aGTA, "");
- }
-
- public static void createInfoFile(String _sFile, GraphicalTestArguments _aGTA, String _sSpecial)
- {
- String sFilename;
- if (_sFile.startsWith("file://"))
- {
- sFilename = FileHelper.getSystemPathFromFileURL(_sFile);
- GlobalLogWriter.get().println("CreateInfoFile: '" + sFilename + "'" );
- }
- else
- {
- sFilename = _sFile;
- }
- String sFileDir = FileHelper.getPath(sFilename);
- String sBasename = FileHelper.getBasename(sFilename);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
-
- String fs = System.getProperty("file.separator");
- String ls = System.getProperty("line.separator");
- String sInfoFilename = sFileDir + fs + sNameNoSuffix + ".info";
- File aInfoFile = new File(sInfoFilename);
-
- String sBuildID = "";
-
- FileWriter out = null;
- try
- {
- try
- {
- out = new FileWriter(aInfoFile.toString());
- out.write("# automatically created file by graphical compare" + ls);
- if (_aGTA != null)
- {
- if (_sSpecial != null && _sSpecial.equals("msoffice"))
- {
- out.write("# buildid from wordloadfile" + ls);
- sBuildID = _aGTA.getPerformance().getMSOfficeVersion();
- out.write("buildid=" + sBuildID + ls);
- }
- else
- {
- out.write("# buildid is read out of the bootstrap file" + ls);
- sBuildID = _aGTA.getBuildID();
- out.write("buildid=" + sBuildID + ls);
- }
- out.write(ls);
- out.write("# resolution given in DPI" + ls);
- out.write("resolution=" + _aGTA.getResolutionInDPI() + ls);
- }
- else
- {
- out.write("buildid=" + _sSpecial + ls);
- }
-
- out.write(ls);
- out.write("# Values out of System.getProperty(...)" + ls);
- out.write("os.name=" + System.getProperty("os.name") + ls);
- out.write("os.arch=" + System.getProperty("os.arch") + ls);
- out.write("os.version=" + System.getProperty("os.version") + ls);
-
- if (_aGTA != null)
- {
- out.write(ls);
- out.write("# Performance output, values are given in milli sec." + ls);
- _aGTA.getPerformance().print(out);
- }
-
- out.flush();
- }
- finally
- {
- if (out != null)
- out.close();
- }
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.get().println("can't create Info file.");
- e.printStackTrace();
- }
-
- String sExtension = FileHelper.getSuffix(_aGTA.getInputFile());
- if (sExtension.startsWith("."))
- {
- sExtension = sExtension.substring(1);
- }
-
- DB.writeToDB(_aGTA.getInputFile(),
- sNameNoSuffix,
- sExtension,
- sBuildID,
- _aGTA.getReferenceType(),
- _aGTA.getResolutionInDPI()
- );
- }
-
-
-
-
- private static boolean impl_printToFileWithOOo(GraphicalTestArguments _aGTA,
- XComponent _aDoc,
- String _sOutputURL,
- String _sPrintFileURL)
- {
- boolean bBack = false;
- boolean bFailed = true; // always be a pessimist,
- if (_aDoc == null)
- {
- GlobalLogWriter.get().println("No document is given.");
- return bBack;
- }
-
- try
- {
- if (_sOutputURL != null)
- {
- if (_aGTA.isStoreAllowed())
- {
- // store the document in an other directory
- XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _aDoc);
- if (aStorable != null)
- {
- PropertyValue [] szEmptyArgs = new PropertyValue [0];
-
- GlobalLogWriter.get().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(2, "After store as URL to:" + _sOutputURL);
- GlobalLogWriter.get().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);
- }
- }
- }
- }
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
-
- e.printStackTrace();
- bBack = false;
- }
-
- try
- {
-
- // Change Pagesettings to DIN A4
-
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Print document.");
- XPrintable aPrintable = UnoRuntime.queryInterface( XPrintable.class, _aDoc);
- if (aPrintable != null)
- {
- // configure Office to allow to execute macos
-
-// TODO: We need a possibility to set the printer name also for StarOffice/OpenOffice
- if (OSHelper.isWindows())
- {
- if (_aGTA.getPrinterName() != null)
- {
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "Name";
- Arg.Value = _aGTA.getPrinterName();
- aPropertyList.add(Arg);
- showProperty(Arg);
- aPrintable.setPrinter(PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- }
- }
-
- // set property values for XPrintable.print()
- // more can be found at "http://api.libreoffice.org/docs/common/ref/com/sun/star/view/PrintOptions.html"
-
- // If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
- 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 = UnoRuntime.queryInterface( XPropertySet.class, aSettings );
- xPropSet.setPropertyValue( "PrintAllSheets", Boolean.TRUE );
- GlobalLogWriter.get().println("PrintAllSheets := true");
- }
- }
-
- ArrayList<PropertyValue> aPrintProps = new ArrayList<PropertyValue>();
-
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "FileName";
- Arg.Value = _sPrintFileURL;
- aPrintProps.add(Arg);
- showProperty(Arg);
-
- if (!_aGTA.printAllPages())
- {
- String sPages = "";
- if (_aGTA.getMaxPages() > 0)
- {
- sPages = "1-" + _aGTA.getMaxPages();
- }
- if (_aGTA.getOnlyPages().length() != 0)
- {
- if (sPages.length() != 0)
- {
- sPages += ";";
- }
- sPages += String.valueOf(_aGTA.getOnlyPages());
- }
-
- Arg = new PropertyValue();
- Arg.Name = "Pages";
- Arg.Value = sPages;
- aPrintProps.add(Arg);
- showProperty(Arg);
- }
-
- _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.");
- boolean isBusy = true;
- int nPrintCount = 0;
- while (isBusy)
- {
- PropertyValue[] aPrinterProps = aPrintable.getPrinter();
- int nPropIndex = 0;
- while (!"IsBusy".equals(aPrinterProps[nPropIndex].Name))
- {
- nPropIndex++;
- }
- isBusy = aPrinterProps[nPropIndex].Value.equals(Boolean.TRUE);
- TimeHelper.waitInSeconds(1, "is print ready?");
- nPrintCount++;
- if (nPrintCount > 3600)
- {
- // we will never wait >1h until print is ready!
- GlobalLogWriter.get().println("ERROR: Cancel print due to too long wait.");
- throw new com.sun.star.uno.Exception("Convwatch exception, wait too long for printing.");
- }
- }
- _aGTA.getPerformance().stopTime(PerformanceContainer.Print);
- GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Print document done.");
-
- // Create a .info file near the printed '.ps' or '.prn' file.
- createInfoFile(_sPrintFileURL, _aGTA);
- }
- else
- {
- GlobalLogWriter.get().println("Can't get XPrintable interface.");
- }
- bFailed = false;
- bBack = true;
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.get().println("UNO Exception caught.");
- GlobalLogWriter.get().println("Message: " + e.getMessage());
-
- e.printStackTrace();
- bBack = false;
- }
-
- if (bFailed)
- {
- GlobalLogWriter.get().println("convwatch.OfficePrint: FAILED");
- }
- else
- {
- GlobalLogWriter.get().println("convwatch.OfficePrint: OK");
- }
- return bBack;
- }
-
-
- /**
- * @return true, if the reference (*.prrn file) based on given output path and given input path exist.
- * If OVERWRITE_REFERENCE is set, always return false.
- */
- public static boolean isReferenceExists(GraphicalTestArguments _aGTA,
- String _sAbsoluteOutputPath,
- String _sAbsoluteInputFile)
- {
- if (! FileHelper.exists(_sAbsoluteInputFile))
- {
- return false;
- }
-
- String fs = System.getProperty("file.separator");
-
- String sInputFileBasename = FileHelper.getBasename(_sAbsoluteInputFile);
- String sOutputPath;
- if (_sAbsoluteOutputPath != null)
- {
- sOutputPath = _sAbsoluteOutputPath;
- }
- else
- {
- String sInputPath = FileHelper.getPath(_sAbsoluteInputFile);
- sOutputPath = sInputPath;
- }
-
- String sPrintFilename = FileHelper.getNameNoSuffix(sInputFileBasename);
-
- String sAbsolutePrintFilename = sOutputPath + fs + sPrintFilename + ".prn";
- if (FileHelper.exists(sAbsolutePrintFilename) && !_aGTA.getOverwrite())
- {
- GlobalLogWriter.get().println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
- return true;
- }
- return false;
- }
-
-
- /**
- * create a reference file
- * _sAbsoluteInputPath contains the source file, if not exists, return with failure.
- * _sAbsoluteOutputPath contains the destination, where the file will store after load with StarOffice/OpenOffice.org
- * 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
- */
- public static boolean buildReference(GraphicalTestArguments _aGTA,
- String _sAbsoluteOutputPath,
- String _sAbsoluteInputFile)
- throws ConvWatchCancelException
- {
- if (! FileHelper.exists(_sAbsoluteInputFile))
- {
- throw new ConvWatchCancelException("buildReference(): Input file: " + _sAbsoluteInputFile + " does not exist.");
- }
-
- String fs = System.getProperty("file.separator");
-
- String sInputFileURL = URLHelper.getFileURLFromSystemPath(_sAbsoluteInputFile);
-
- String sInputFileBasename = FileHelper.getBasename(_sAbsoluteInputFile);
- String sOutputFileURL = null;
- String sOutputPath;
- if (_sAbsoluteOutputPath != null)
- {
- sOutputPath = _sAbsoluteOutputPath;
- FileHelper.makeDirectories("", sOutputPath);
- }
- else
- {
- String sInputPath = FileHelper.getPath(_sAbsoluteInputFile);
- sOutputPath = sInputPath;
- }
-
- String sPrintFilename = FileHelper.getNameNoSuffix(sInputFileBasename);
- String sPrintFileURL;
-
- String sAbsolutePrintFilename = sOutputPath + fs + sPrintFilename + ".prn";
- if (FileHelper.exists(sAbsolutePrintFilename) && !_aGTA.getOverwrite())
- {
- GlobalLogWriter.get().println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite.");
- return true;
- }
-
- if (_aGTA.getReferenceType().equalsIgnoreCase("msoffice"))
- {
- sPrintFileURL = URLHelper.getFileURLFromSystemPath(sAbsolutePrintFilename);
- }
- else if (_aGTA.getReferenceType().equalsIgnoreCase("pdf"))
- {
-// TODO: If we rename the stored file to *.pdf, we have to be sure that we use *.pdf also as a available reference
- sPrintFileURL = URLHelper.getFileURLFromSystemPath(sAbsolutePrintFilename );
- }
- else if (_aGTA.getReferenceType().equalsIgnoreCase("ooo"))
- {
- sPrintFileURL = URLHelper.getFileURLFromSystemPath(sAbsolutePrintFilename );
- }
- else
- {
- GlobalLogWriter.get().println("OfficePrint.buildreference(): Unknown print type.");
- return false;
- }
- return printToFile(_aGTA, sInputFileURL, sOutputFileURL, sPrintFileURL);
- }
-
- public static boolean printToFile(GraphicalTestArguments _aGTA,
- String _sInputFileURL,
- String _sOutputFileURL,
- String _sPrintFileURL) throws ConvWatchCancelException
- {
- boolean bBack = false;
- // check if given file is a picture, then do nothing
- String sDocumentSuffix = FileHelper.getSuffix(_sInputFileURL);
- if (sDocumentSuffix.toLowerCase().endsWith(".png") ||
- sDocumentSuffix.toLowerCase().endsWith(".gif") ||
- sDocumentSuffix.toLowerCase().endsWith(".jpg") ||
- sDocumentSuffix.toLowerCase().endsWith(".bmp"))
- {
- return false;
- }
-
-
- if (_aGTA.getReferenceType().equalsIgnoreCase("ooo"))
- {
- bBack = printToFileWithOOo(_aGTA, _sInputFileURL, _sOutputFileURL, _sPrintFileURL);
- }
- else if (_aGTA.getReferenceType().equalsIgnoreCase("pdf"))
- {
- GlobalLogWriter.get().println("USE PDF AS EXPORT FORMAT.");
- bBack = storeAsPDF(_aGTA, _sInputFileURL, _sPrintFileURL);
- }
- else if (_aGTA.getReferenceType().equalsIgnoreCase("msoffice"))
- {
- if (MSOfficePrint.isMSOfficeDocumentFormat(_sInputFileURL))
- {
- GlobalLogWriter.get().println("USE MSOFFICE AS EXPORT FORMAT.");
- MSOfficePrint a = new MSOfficePrint();
- try
- {
- a.printToFileWithMSOffice(_aGTA, FileHelper.getSystemPathFromFileURL(_sInputFileURL),
- FileHelper.getSystemPathFromFileURL(_sPrintFileURL));
- }
- catch(ConvWatchCancelException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- throw new ConvWatchCancelException("Exception caught. Problem with MSOffice printer methods.", e);
- }
- catch(java.io.IOException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- throw new ConvWatchCancelException("IOException caught. Problem with MSOffice printer methods.", e);
- }
- bBack = true;
- }
- else
- {
- GlobalLogWriter.get().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);
- }
- }
- else
- {
- throw new ConvWatchCancelException("OfficePrint.printToFile(): Unknown print type.");
- }
- return bBack;
- }
-
-
- // TODO: move this away!
-
-
-
-
-
- private static String getInternalFilterName(String _sFilterName, XMultiServiceFactory _xMSF)
- {
- if (_sFilterName.length() == 0)
- {
- return null;
- }
-
- if (_xMSF == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
- return null;
- }
- Object aObj = null;
- try
- {
- aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory");
- }
- catch(com.sun.star.uno.Exception e)
- {
- GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
- return null;
- }
- if (aObj != null)
- {
- XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
- if (aNameAccess != null)
- {
-
- if (! aNameAccess.hasByName(_sFilterName))
- {
- GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
- return null;
- }
-
- Object[] aElements = null;
- try
- {
- aElements = (Object[]) aNameAccess.getByName(_sFilterName);
- if (aElements != null)
- {
- String sInternalFilterName = null;
- for (int i=0;i<aElements.length; i++)
- {
- PropertyValue aPropertyValue = (PropertyValue)aElements[i];
- if (aPropertyValue.Name.equals("Type"))
- {
- String sValue = (String)aPropertyValue.Value;
- sInternalFilterName = sValue;
- }
- }
- return sInternalFilterName;
- }
- else
- {
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sFilterName + "'");
- return null;
- }
- }
- catch (com.sun.star.container.NoSuchElementException e)
- {
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
- }
- }
- }
- return null;
- }
-
-
-
- private static String getServiceNameFromFilterName(String _sFilterName, XMultiServiceFactory _xMSF)
- {
- if (_sFilterName.length() == 0)
- {
- return null;
- }
-
- if (_xMSF == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
- return null;
- }
- // XFilterFactory aFilterFactory = null;
- Object aObj = null;
- try
- {
- aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory");
- }
- catch(com.sun.star.uno.Exception e)
- {
- GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory.");
- return null;
- }
- if (aObj != null)
- {
- XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj);
- if (aNameAccess != null)
- {
- if (! aNameAccess.hasByName(_sFilterName))
- {
- GlobalLogWriter.get().println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" );
- return null;
- }
-
- Object[] aElements = null;
- try
- {
- aElements = (Object[]) aNameAccess.getByName(_sFilterName);
- if (aElements != null)
- {
- String sServiceName = null;
- for (int i=0;i<aElements.length; i++)
- {
- PropertyValue aPropertyValue = (PropertyValue)aElements[i];
- if (aPropertyValue.Name.equals("DocumentService"))
- {
- String sValue = (String)aPropertyValue.Value;
- sServiceName = sValue;
- break;
- }
- }
- return sServiceName;
- }
- else
- {
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sFilterName + "'");
- return null;
- }
- }
- catch (com.sun.star.container.NoSuchElementException e)
- {
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
- }
- }
- }
- return null;
- }
-
-
- private static String getFileExtension(String _sInternalFilterName, XMultiServiceFactory _xMSF)
- {
- if (_sInternalFilterName.length() == 0)
- {
- return null;
- }
-
- if (_xMSF == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory not set.");
- return null;
- }
- XTypeDetection aTypeDetection = null;
- try
- {
- Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection");
- aTypeDetection =UnoRuntime.queryInterface(XTypeDetection.class, oObj);
- }
- catch(com.sun.star.uno.Exception e)
- {
- GlobalLogWriter.get().println("Can't get com.sun.star.document.TypeDetection.");
- return null;
- }
- if (aTypeDetection != null)
- {
- XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection);
- if (aNameAccess != null)
- {
-
- if (! aNameAccess.hasByName(_sInternalFilterName))
- {
- GlobalLogWriter.get().println("TypeDetection.hasByName() says there exist no '" + _sInternalFilterName + "'" );
- return null;
- }
-
- Object[] aElements = null;
- String[] aExtensions;
- try
- {
- aElements = (Object[]) aNameAccess.getByName(_sInternalFilterName);
- if (aElements != null)
- {
- String sExtension = null;
- for (int i=0;i<aElements.length; i++)
- {
- PropertyValue aPropertyValue = (PropertyValue)aElements[i];
- if (aPropertyValue.Name.equals("Extensions"))
- {
- aExtensions = (String[])aPropertyValue.Value;
- GlobalLogWriter.get().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]);
- }
- sExtension = aExtensions[0];
- GlobalLogWriter.get().println("");
- }
- }
- }
- return sExtension;
- }
- else
- {
- GlobalLogWriter.get().println("There are no elements for FilterName '" + _sInternalFilterName + "'");
- return null;
- }
- }
- catch (com.sun.star.container.NoSuchElementException e)
- {
- GlobalLogWriter.get().println("NoSuchElementException caught. " + e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- GlobalLogWriter.get().println("WrappedTargetException caught. " + e.getMessage());
- }
-}
- }
- return null;
- }
-
-
- public static void convertDocument(String _sInputFile, String _sOutputPath, GraphicalTestArguments _aGTA)
- {
- XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
- if (xMSF == null)
- {
- GlobalLogWriter.get().println("MultiServiceFactory in GraphicalTestArgument not set.");
- return;
- }
-
- String sInputURL = URLHelper.getFileURLFromSystemPath(_sInputFile);
- XComponent aDoc = loadFromURL( _aGTA, sInputURL);
- if (aDoc == null)
- {
- GlobalLogWriter.get().println("Can't load document '"+ sInputURL + "'");
- return;
- }
-
- if (_sOutputPath == null)
- {
- GlobalLogWriter.get().println("Outputpath not set.");
- return;
- }
-
- if (! _aGTA.isStoreAllowed())
- {
- GlobalLogWriter.get().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 = UnoRuntime.queryInterface( XServiceInfo.class, aDoc );
-
- // store the document in an other directory
- XStorable xStorable = UnoRuntime.queryInterface( XStorable.class, aDoc);
- if (xStorable == null)
- {
- GlobalLogWriter.get().println("com.sun.star.frame.XStorable is null");
- return;
- }
-
- String sFilterName = _aGTA.getExportFilterName();
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
-
- String sExtension = "";
-
- if (sFilterName != null && sFilterName.length() > 0)
- {
- String sInternalFilterName = getInternalFilterName(sFilterName, xMSF);
- String sServiceName = getServiceNameFromFilterName(sFilterName, xMSF);
-
- GlobalLogWriter.get().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.");
- bServiceFailed = true;
- }
- if (! xServiceInfo.supportsService(sServiceName))
- {
- GlobalLogWriter.get().println("Service from FilterName '" + sServiceName + "' is not supported by loaded document.");
- bServiceFailed = true;
- }
- if (bServiceFailed)
- {
- GlobalLogWriter.get().println("Please check '" + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + "' in the property file.");
- return;
- }
-
- if (sInternalFilterName != null && sInternalFilterName.length() > 0)
- {
- // get the FileExtension, by the filter name, if we don't get a file extension
- // we assume the is also no right filter name.
- sExtension = getFileExtension(sInternalFilterName, xMSF);
- if (sExtension == null)
- {
- GlobalLogWriter.get().println("Can't found an extension for filtername, take it from the source.");
- }
- }
-
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "FilterName";
- Arg.Value = sFilterName;
- aPropertyList.add(Arg);
- showProperty(Arg);
- GlobalLogWriter.get().println("FilterName is set to: " + sFilterName);
- }
-
- String sOutputURL = "";
- try
- {
- // create the new filename with the extension, which is ok to the file format
- String sInputFileBasename = FileHelper.getBasename(_sInputFile);
- String sInputFileNameNoSuffix = FileHelper.getNameNoSuffix(sInputFileBasename);
- String fs = System.getProperty("file.separator");
- String sOutputFile = _sOutputPath;
- if (! sOutputFile.endsWith(fs))
- {
- sOutputFile += fs;
- }
- if (sExtension != null && sExtension.length() > 0)
- {
- sOutputFile += sInputFileNameNoSuffix + "." + sExtension;
- }
- else
- {
- sOutputFile += sInputFileBasename;
- }
-
- if (FileHelper.exists(sOutputFile) && !_aGTA.getOverwrite())
- {
- GlobalLogWriter.get().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 + "'");
- xStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- GlobalLogWriter.get().println("Document stored.");
- }
- catch (com.sun.star.io.IOException e)
- {
- GlobalLogWriter.get().println("Can't store document '" + sOutputURL + "'. Message is :'" + e.getMessage() + "'");
- }
-// TODO: Do we need to wait?
- TimeHelper.waitInSeconds(1, "unknown in OfficePrint.convertDocument()");
-
- }
-
-}
-
diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java
deleted file mode 100644
index 1dac4c8eed97..000000000000
--- a/qadevOOo/runner/convwatch/PRNCompare.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-
-import helper.ProcessHandler;
-import java.io.File;
-import helper.OSHelper;
-import helper.StringHelper;
-import java.util.ArrayList;
-
-
-// --------------------------------- PRNCompare ---------------------------------
-
-public class PRNCompare
-{
- private final String fs;
-
- public PRNCompare()
- {
- fs = System.getProperty("file.separator");
- }
-
- private int getMaxNumOfFileEntry(String _sDirectory, String _sBasename)
- {
-// TODO: check if directory exist should be done earlier
- File aDirectory = new File(_sDirectory);
- File[] aDirList = aDirectory.listFiles(
- );
-
- int nMaxNumber = 0;
- for(int n = 0; n<aDirList.length ; n++)
- {
- String sDirEntry = aDirList[n].getName();
- if (sDirEntry.endsWith(".jpg"))
- {
- int nNum = nMaxNumber;
-
- if (sDirEntry.startsWith(_sBasename))
- {
- int nJpgIdx = sDirEntry.lastIndexOf(".jpg");
- String sValue = sDirEntry.substring(_sBasename.length(), nJpgIdx);
- int nValue = 0;
- try
- {
- nValue = Integer.parseInt(sValue);
- }
- catch(java.lang.NumberFormatException e)
- {
- }
-
- nNum = nValue;
- }
-
- if (nNum > nMaxNumber)
- {
- nMaxNumber = nNum;
- }
- }
- }
- return nMaxNumber;
- }
-
-
- private String m_sReferencePath;
- private String m_sOutputPath;
-
- private String m_sReferenceFile;
- private String m_sPostScriptFile;
- private int m_nMaxPages = 0;
- private int m_nResolutionInDPI = 0;
- private TriState m_tUseBorderMove;
- private String m_sDocumentType;
-
- public void setReferencePath(String _sReferencePath) { m_sReferencePath = _sReferencePath; }
-
- public void setOutputPath(String _sOutPath) { m_sOutputPath = _sOutPath; }
-
- public void setReferenceFile(String _sPRNFile){ m_sReferenceFile = _sPRNFile;}
-
- public void setPostScriptFile(String _sPSFile){ m_sPostScriptFile = _sPSFile;}
-
- public void setBorderMove(TriState _b) {m_tUseBorderMove = _b;}
- public TriState getBorderMove() {return m_tUseBorderMove;}
- public void setMaxPages(int _n) {m_nMaxPages = _n;}
- private int getMaxPages() {return m_nMaxPages;}
-
- public void setResolutionInDPI(int _n) {m_nResolutionInDPI = _n;}
- private int getResolutionInDPI() {return m_nResolutionInDPI;}
-
- public void setDocumentType(String _sTypeName)
- {
- m_sDocumentType = _sTypeName;
- }
-
-
-
- public StatusHelper[] compare()
- {
- createJPEGFromPostscript(m_sOutputPath, m_sReferencePath, m_sReferenceFile, getResolutionInDPI());
-// TODO: Assume, that Postscript is already in the OutputPath, this may change.
- createJPEGFromPostscript(m_sOutputPath, m_sOutputPath, m_sPostScriptFile, getResolutionInDPI());
- StatusHelper[] aList = createDiffs(m_sOutputPath,
- m_sOutputPath, m_sReferenceFile,
- m_sOutputPath, m_sPostScriptFile,
- getMaxPages(), m_tUseBorderMove);
-
-// TODO: Rename?
-
- return aList;
- }
-
-
-
- private static String getJPEGName(String _sOutputPath, String _sBasename, String _sGS_PageOutput)
- {
- String fs = System.getProperty("file.separator");
-
- String sJPEGName = _sOutputPath + fs + _sBasename + _sGS_PageOutput + ".jpg";
- return sJPEGName;
- }
-
- /**
- * Create via ghostscript (gs) from the reference file for every page a JPEG file
- *
- * MUST set:
- * m_sOutputPath, m_sReferenceFile, m_sReferencePath
- *
- * return exit code from gs command
- */
- public static String[] createJPEGFromPostscript(String _sOutputPath, String _sSourcePath, String _sSourceFile, int _nResolutionInDPI)
- {
- String sGS_PageOutput = "%04d";
-
- FileHelper.makeDirectories("", _sOutputPath);
-
- // create a jpeg from original prn
- String fs = System.getProperty("file.separator");
-
- String sJPGFilename = getJPEGName(_sOutputPath, _sSourceFile, sGS_PageOutput);
- String sOriginalFile = _sSourcePath + fs + _sSourceFile;
- String sGS = "gs";
- if (OSHelper.isWindows())
- {
- sGS = "gswin32c.exe";
- }
-
- String[] sCommandArray =
- {
- sGS,
- "-dNOPROMPT",
- "-dBATCH",
- "-sDEVICE=jpeg",
- "-r" + _nResolutionInDPI,
- "-dNOPAUSE",
- "-sOutputFile=" + sJPGFilename,
- sOriginalFile
- };
-
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- aHandler.executeSynchronously();
-
- // TODO: return a real filename, due to the fact we don't know how much files are created, maybe better to return a list
-
- ArrayList<String> aFileList = new ArrayList<String>();
- for (int i=1;i<9999;i++)
- {
- String sNewJPEGFilename = sJPGFilename.replace(sGS_PageOutput, StringHelper.createValueString(i, 4));
- if (FileHelper.exists(sNewJPEGFilename))
- {
- aFileList.add(sNewJPEGFilename); // as long as the files exist, fill the array
- }
- else
- {
- break; // stop file check
- }
- }
- String[] aList = new String[aFileList.size()];
- aList = aFileList.toArray(aList);
- return aList; // sNewJPEGFilename;
- }
-
- /**
- * Create Difference Files from the JPEGs
- * parameter, how much difference files should create
- *
- * m_sPostScriptFile
- * m_sReferenceFile
- * m_sOutputPath
- */
- private StatusHelper[] createDiffs(String _sOutputPath, String _sSourcePath1, String _sSourceFile1, String _sSourcePath2, String _sSourceFile2, int _nMaxDiffs, TriState _tUseBorderMove)
- {
- if (_nMaxDiffs < 1)
- {
- _nMaxDiffs = 1;
- }
-
- String sS1Basename = FileHelper.getBasename(_sSourceFile1);
- String sS2Basename = FileHelper.getBasename(_sSourceFile2);
-
- // count, from which file (jpegs) exist more, take the less one
- // more are not compareable
- int nS1_Files = getMaxNumOfFileEntry(_sSourcePath1, sS1Basename);
- int nS2_Files = getMaxNumOfFileEntry(_sSourcePath2, sS2Basename);
-
- // take the min of both
- int nMin = Math.min(nS1_Files, nS2_Files);
- nMin = Math.min(nMin, _nMaxDiffs);
-
- StatusHelper[] aList = new StatusHelper[nMin];
-
-// TODO: if both document do not have same page count, produce an error
-
- int nStatusIndex = 0;
- for (int i=1;i<=nMin;i++)
- {
- String sOldGfx = getJPEGName(_sSourcePath1, sS1Basename, StringHelper.createValueString(i, 4));
- String sNewGfx = getJPEGName(_sSourcePath2, sS2Basename, StringHelper.createValueString(i, 4));
- String sDiffGfx_ = getJPEGName(_sOutputPath, sS1Basename + ".diff", StringHelper.createValueString(i, 4));
-
-
- String sDiffGfx = compareJPEGs(sOldGfx, sNewGfx, sDiffGfx_);
- StatusHelper aStatus = new StatusHelper(sOldGfx, sNewGfx, sDiffGfx);
-
- if (sDiffGfx.length() > 0)
- {
- int nResult = identify(sDiffGfx);
- if (nResult == 1)
- {
- aStatus.nDiffStatus = StatusHelper.DIFF_NO_DIFFERENCES;
- }
- else
- {
- try
- {
- int nPercent = estimateGfx(sOldGfx, sNewGfx, sDiffGfx);
- aStatus.nDiffStatus = StatusHelper.DIFF_DIFFERENCES_FOUND;
- aStatus.nPercent = nPercent;
-
-// TODO: insert here the new BorderRemover if the percentage value is creater than 75%
- if (nPercent > 75 &&
- ((_tUseBorderMove == TriState.TRUE ) ||
- ((_tUseBorderMove == TriState.UNSET) &&
- m_sDocumentType.indexOf("MS PowerPoint") > 0)))
- {
- setBorderMove(TriState.TRUE);
-
- String sOld_BM_Gfx = getJPEGName(_sSourcePath1, sS1Basename + ".BM", StringHelper.createValueString(i, 4));
- String sNew_BM_Gfx = getJPEGName(_sSourcePath2, sS2Basename + ".BM", StringHelper.createValueString(i, 4));
- String sDiff_BM_Gfx_ = getJPEGName(_sOutputPath, sS1Basename + ".diff.BM", StringHelper.createValueString(i, 4));
- aStatus.setFilesForBorderMove(sOld_BM_Gfx, sNew_BM_Gfx, sDiff_BM_Gfx_);
- try
- {
- BorderRemover a = new BorderRemover();
- a.createNewImageWithoutBorder(sOldGfx, sOld_BM_Gfx);
- a.createNewImageWithoutBorder(sNewGfx, sNew_BM_Gfx);
-
- String sDiff_BM_Gfx = compareJPEGs( sOld_BM_Gfx, sNew_BM_Gfx, sDiff_BM_Gfx_);
-
- if (sDiff_BM_Gfx.length() > 0)
- {
- nResult = identify(sDiff_BM_Gfx);
- if (nResult == 1)
- {
- aStatus.nDiffStatus = StatusHelper.DIFF_AFTER_MOVE_DONE_NO_PROBLEMS;
- aStatus.nPercent2 = 0;
- }
- else
- {
- nPercent = estimateGfx(sOld_BM_Gfx, sNew_BM_Gfx, sDiff_BM_Gfx);
- aStatus.nDiffStatus = StatusHelper.DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND;
- aStatus.nPercent2 = nPercent;
- }
- }
- else
- {
- }
- }
- catch(java.io.IOException e)
- {
- GlobalLogWriter.get().println("Exception caught. At border remove: " + e.getMessage());
- }
- }
-
-
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- }
- }
-
- }
- aList[nStatusIndex ++] = aStatus;
- }
- return aList;
- }
-
-
- public static String compareJPEGs(String _sOldGfx, String _sNewGfx)
- {
- String sBasename1 = FileHelper.getBasename(_sOldGfx);
- String sNameNoSuffix1 = FileHelper.getNameNoSuffix(sBasename1);
- String sBasename2 = FileHelper.getBasename(_sNewGfx);
- String sNameNoSuffix2 = FileHelper.getNameNoSuffix(sBasename2);
-
- String sTmpDir = util.utils.getUsersTempDir();
- String fs = System.getProperty("file.separator");
-
- String sDiffName = sTmpDir + fs + sNameNoSuffix1 + "-" + sNameNoSuffix2 + "-diff.jpg";
-
- return compareJPEGs(_sOldGfx, _sNewGfx, sDiffName);
- }
-
- private static String compareJPEGs(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- {
- String sComposite = "composite";
- if (OSHelper.isWindows())
- {
- sComposite = "composite.exe";
- }
-
- String[] sCommandArray =
- {
- sComposite,
- "-compose",
- "difference",
- _sOldGfx,
- _sNewGfx,
- _sDiffGfx
- };
-
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- aHandler.executeSynchronously();
-
- String sBack = aHandler.getOutputText();
- GlobalLogWriter.get().println("'" + sBack + "'");
-
- if (FileHelper.exists(_sDiffGfx))
- {
- return _sDiffGfx;
- }
- return "";
- }
-
- /**
- * wrapper for ImageMagick identify,
- * function checks how many different colors a picture contains.
- * if it's only one color (nResult==1), like background color, there is no difference.
- */
- private 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";
-
- String sIdentify = "identify";
- if (OSHelper.isWindows())
- {
- sIdentify = "identify.exe";
- }
-
- String[] sCommandArray =
- {
- sIdentify,
- "-format",
- sIM_Format,
- _sDiffGfx
- };
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- aHandler.executeSynchronously();
- String sBack = aHandler.getOutputText();
- GlobalLogWriter.get().println("'" + sBack + "'");
-
- // 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.parseInt(sBack);
- }
- catch(java.lang.NumberFormatException e)
- {
- GlobalLogWriter.get().println("Number format exception");
- nResult = 0;
- }
- return nResult;
- }
-
- /*
- * Check 2 different differ files
- * return 1 if there is no difference between both diff files.
- */
-
-// TODO: Maybe a StatusHelper is a better return value
- public StatusHelper checkDiffDiff(String _sOutputPath, String _sSourcePath1, String _sSourceFile1, String _sSourcePath2, String _sSourceFile2)
- {
- String sNewGfx = _sSourcePath1 + fs + _sSourceFile1;
- String sOldGfx = _sSourcePath2 + fs + _sSourceFile2;
-
- int nNumber = 1;
- String sDiffGfx;
- sDiffGfx = getJPEGName(_sOutputPath, _sSourceFile1 + ".diff", StringHelper.createValueString(nNumber, 4));
-
- StatusHelper aCurrentStatus = new StatusHelper(sOldGfx, sNewGfx, sDiffGfx);
-
- compareJPEGs(sOldGfx, sNewGfx, sDiffGfx);
-
- if (FileHelper.exists(sDiffGfx))
- {
- int nResult = identify(sDiffGfx);
- if (nResult == 1)
- {
- aCurrentStatus.nDiffStatus = StatusHelper.DIFF_NO_DIFFERENCES;
- }
- else
- {
- aCurrentStatus.nDiffStatus = StatusHelper.DIFF_DIFFERENCES_FOUND;
- try
- {
- aCurrentStatus.nPercent = estimateGfx(sOldGfx, sNewGfx, sDiffGfx);
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.get().println(e.getMessage());
- aCurrentStatus.nPercent = -1;
- }
- }
- }
- else
- {
- GlobalLogWriter.get().println("composite can't create the diffdiff file.");
- }
-
- return aCurrentStatus;
- }
-
-
- /**
- * count how much pixel differ and between Old or New and the Difference graphics
- *
- * First, count the old graphics, then the new graphics due to the fact both should be equal
- * it should be legal to take result from old or new. We take the graphics with less values.
- *
- * Second, count the difference graphics, now take the percent algorithm and
- * build a percent value, which contain the number of different pixels as a percent value
- *
- * Interpretation:
- * 0% there is no difference
- *
- * <100% Take a look into the difference graphics, maybe the difference graphics shows
- * text like outlined or the text is little bit move left, right up or down.
- *
- * >100% Yes it's possible that there is a difference more than 100%, maybe a font problem
- * between old and new graphics. The font of the new graphics is little bit bigger,
- * so the pixel count between old graphics and new graphics is twice the more.
- *
- */
- private int estimateGfx(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- throws java.io.IOException
- {
- // new count pixels
- int nNotWhiteCount_OldGraphic = PixelCounter.countNotWhitePixelsFromImage(_sOldGfx);
- int nNotWhiteCount_NewGraphic = PixelCounter.countNotWhitePixelsFromImage(_sNewGfx);
- int nNotBlackCount_DiffGraphic = PixelCounter.countNotBlackPixelsFromImage(_sDiffGfx);
-
- int nMinNotWhiteCount = Math.min(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
-
- // check if not zero
- if (nMinNotWhiteCount == 0)
- {
- nMinNotWhiteCount = Math.max(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
- if (nMinNotWhiteCount == 0)
- {
- nMinNotWhiteCount = 1;
- }
- }
-
- int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
- GlobalLogWriter.get().println( "Graphics check, pixel based:" + nPercent + "% pixel differ ");
- return nPercent;
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/PerformanceContainer.java b/qadevOOo/runner/convwatch/PerformanceContainer.java
deleted file mode 100644
index 2f32bdeaeb06..000000000000
--- a/qadevOOo/runner/convwatch/PerformanceContainer.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.RandomAccessFile;
-
-public class PerformanceContainer {
- /*
- simple helper functions to start/stop a timer, to know how long a process need in milliseconds
- */
- private long getStartTime()
- {
- return System.currentTimeMillis();
- }
- public void setStartTime(long _nStartTime)
- {
- }
-
- /*
- return the time, which is done until last startTime()
- */
- private long meanTime(long _nCurrentTimer)
- {
- if (_nCurrentTimer == 0)
- {
- GlobalLogWriter.get().println("Forgotten to initialise a start timer.");
- return 0;
- }
- long nMeanTime = System.currentTimeMillis();
- return nMeanTime - _nCurrentTimer;
- }
-
- /*
- public long stopTimer()
- {
- if (m_nStartTime == 0)
- {
- System.out.println("Forgotten to initialise start timer.");
- return 0;
- }
- long nStopTime = System.currentTimeMillis();
- return nStopTime - m_nStartTime;
- }
- */
-
- final static int Load = 0;
- final static int Store = 1;
- final static int Print = 2;
- final static int OfficeStart = 3;
- final static int StoreAsPDF = 4;
-
- private long m_nTime[];
- private String m_sMSOfficeVersion;
-
- public PerformanceContainer()
- {
- m_nTime = new long[5];
- // @todo: is this need?
- for (int i=0;i<5;i++)
- {
- m_nTime[i] = 0;
- }
- }
-
- public void setTime(int _nIndex, long _nValue)
- {
- m_nTime[_nIndex] = _nValue;
- }
- public long getTime(int _nIndex)
- {
- return m_nTime[_nIndex];
- }
-
- public void startTime(int _nIndex)
- {
- m_nTime[_nIndex] = getStartTime();
- }
-
- public void stopTime(int _nIndex)
- {
- m_nTime[_nIndex] = meanTime(m_nTime[_nIndex]);
- }
-
- public String getMSOfficeVersion()
- {
- return m_sMSOfficeVersion;
- }
- public void print(FileWriter out) throws java.io.IOException
- {
- String ls = System.getProperty("line.separator");
-
- out.write("loadtime=" + (m_nTime[ Load ]) + ls);
- out.write("storetime=" + (m_nTime[ Store ]) + ls);
- out.write("printtime=" + (m_nTime[ Print ]) + ls);
- out.write("officestarttime=" + (m_nTime[ OfficeStart ]) + ls);
- out.write("storeaspdftime=" + (m_nTime[ StoreAsPDF ]) + ls);
- }
-
- private static double stringToDouble(String _sStr)
- {
- double nValue = 0;
- try
- {
- nValue = Double.parseDouble( _sStr );
- }
- catch (NumberFormatException e)
- {
- GlobalLogWriter.get().println("Can't convert string to double " + _sStr);
- }
- return nValue;
- }
-
- private static long secondsToMilliSeconds(double _nSeconds)
- {
- return (long)(_nSeconds * 1000.0);
- }
-
- /*
- Helper function, which read some values from a given file
-
- sample of wordinfofile
- name=c:\doc-pool\wntmsci\samples\msoffice\word\LineSpacing.doc
- WordVersion=11.0
- WordStartTime=0.340490102767944
- WordLoadTime=0.650935888290405
- WordPrintTime=0.580835103988647
- */
- public void readWordValuesFromFile(String sFilename)
- {
- File aFile = new File(sFilename);
- if (! aFile.exists())
- {
- GlobalLogWriter.get().println("couldn't find file " + sFilename);
- return;
- }
-
- RandomAccessFile aRandomAccessFile = null;
- try
- {
- aRandomAccessFile = new RandomAccessFile(aFile,"r");
- String sLine = "";
- while (sLine != null)
- {
- sLine = aRandomAccessFile.readLine();
- if ( (sLine != null) &&
- (sLine.length() >= 2 ) &&
- (! sLine.startsWith("#")))
- {
- if (sLine.startsWith("WordStartTime="))
- {
- String sTime = sLine.substring(14);
- m_nTime[OfficeStart] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordLoadTime="))
- {
- String sTime = sLine.substring(13);
- m_nTime[Load] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordPrintTime="))
- {
- String sTime = sLine.substring(14);
- m_nTime[Print] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordVersion="))
- {
- String sMSOfficeVersion = sLine.substring(12);
- m_sMSOfficeVersion = "Word:" + sMSOfficeVersion;
- }
- else if (sLine.startsWith("ExcelVersion="))
- {
- String sMSOfficeVersion = sLine.substring(13);
- m_sMSOfficeVersion = "Excel:" + sMSOfficeVersion;
- }
- else if (sLine.startsWith("PowerPointVersion="))
- {
- String sMSOfficeVersion = sLine.substring(18);
- m_sMSOfficeVersion = "PowerPoint:" + sMSOfficeVersion;
- }
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.get().println("couldn't open file " + sFilename);
- GlobalLogWriter.get().println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.get().println("Exception while reading file " + sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
- }
- try
- {
- aRandomAccessFile.close();
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.get().println("Couldn't close file " + sFilename);
- GlobalLogWriter.get().println("Message: " + ie.getMessage());
- }
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/PixelCounter.java b/qadevOOo/runner/convwatch/PixelCounter.java
deleted file mode 100644
index 5a8f805db2fe..000000000000
--- a/qadevOOo/runner/convwatch/PixelCounter.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-abstract class CountPixel
-{
- int m_nCount = 0;
- public int getCount() {return m_nCount;}
- public abstract void count(int _nRGB);
-}
-
-
-class CountNotWhite extends CountPixel
-{
- @Override
- public void count(int pixel)
- {
- int red = (pixel >> 16) & 0xff;
- int green = (pixel >> 8) & 0xff;
- int blue = (pixel ) & 0xff;
-
- if (red == 0xff && green == 0xff && blue == 0xff)
- {
- return;
- }
- m_nCount++;
- }
-}
-
-
-class CountNotBlack extends CountPixel
-{
- @Override
- public void count(int pixel)
- {
- int red = (pixel >> 16) & 0xff;
- int green = (pixel >> 8) & 0xff;
- int blue = (pixel ) & 0xff;
-
- if (red == 0x00 && green == 0x00 && blue == 0x00)
- {
- return;
- }
- m_nCount++;
- }
-}
-
-
-class graphics_stuff
-{
-
-
- private static void countPixel(ImageHelper img, int _w, int _h, CountPixel _aPixelCounter)
- {
- for (int y = 0; y < _h; y++) {
- for (int x = 0; x < _w; x++) {
- _aPixelCounter.count(img.getPixel(x,y));
- }
- }
- }
- public static int countNotWhitePixel(ImageHelper _aImage)
- {
- int w = _aImage.getWidth();
- int h = _aImage.getHeight();
-
- CountPixel aCountNotWhite = new CountNotWhite();
- countPixel(_aImage, w, h, aCountNotWhite);
- return aCountNotWhite.getCount();
- }
-
- public static int countNotBlackPixel(ImageHelper _aImage)
- {
- int w = _aImage.getWidth();
- int h = _aImage.getHeight();
-
- CountPixel aCountNotBlack = new CountNotBlack();
- countPixel(_aImage, w, h, aCountNotBlack);
- return aCountNotBlack.getCount();
- }
-}
-
-
-
-public class PixelCounter {
- private ImageHelper m_aImage;
-
-
- private int countNotWhitePixel(String _sFile)
- throws java.io.IOException
- {
- m_aImage = ImageHelper.createImageHelper(_sFile);
- int nw = graphics_stuff.countNotWhitePixel(m_aImage);
- return nw;
- }
-
- private int countNotBlackPixel(String _sFile)
- throws java.io.IOException
- {
- m_aImage = ImageHelper.createImageHelper(_sFile);
- int nw = graphics_stuff.countNotBlackPixel(m_aImage);
- return nw;
- }
-
- public static int countNotWhitePixelsFromImage(String _sFile)
- throws java.io.IOException
- {
- PixelCounter a = new PixelCounter();
- return a.countNotWhitePixel(_sFile);
- }
-
- public static int countNotBlackPixelsFromImage(String _sFile)
- throws java.io.IOException
- {
- PixelCounter a = new PixelCounter();
- return a.countNotBlackPixel(_sFile);
- }
-
-
-
-}
-
-
diff --git a/qadevOOo/runner/convwatch/PropertyName.java b/qadevOOo/runner/convwatch/PropertyName.java
deleted file mode 100644
index 88269954c977..000000000000
--- a/qadevOOo/runner/convwatch/PropertyName.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public interface PropertyName
-{
- String DOC_COMPARATOR_INPUT_PATH = "DOC_COMPARATOR_INPUT_PATH";
- String DOC_COMPARATOR_OUTPUT_PATH = "DOC_COMPARATOR_OUTPUT_PATH";
- String DOC_COMPARATOR_DIFF_PATH = "DOC_COMPARATOR_DIFF_PATH";
- String DOC_COMPARATOR_REFERENCE_PATH = "DOC_COMPARATOR_REFERENCE_PATH";
- String DOC_COMPARATOR_REFERENCE_INPUT_PATH = "DOC_COMPARATOR_REFERENCE_INPUT_PATH";
- String DOC_COMPARATOR_REFERENCE_TYPE = "DOC_COMPARATOR_REFERENCE_CREATOR_TYPE";
- String DOC_COMPARATOR_PRINTER_NAME = "DOC_COMPARATOR_PRINTER_NAME";
- String DOC_COMPARATOR_DEFAULT_XML_FORMAT_APP = "DOC_COMPARATOR_DEFAULT_XML_FORMAT_APP";
- String DOC_COMPARATOR_INCLUDE_SUBDIRS = "DOC_COMPARATOR_INCLUDE_SUBDIRS";
- String DOC_COMPARATOR_PRINT_MAX_PAGE = "DOC_COMPARATOR_PRINT_MAX_PAGE";
- String DOC_COMPARATOR_PRINT_ONLY_PAGE = "DOC_COMPARATOR_PRINT_ONLY_PAGE";
- String DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION = "DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION";
- String DOC_COMPARATOR_OVERWRITE_REFERENCE = "DOC_COMPARATOR_OVERWRITE_REFERENCE";
-
- String DOC_COMPARATOR_HTML_OUTPUT_PREFIX = "DOC_COMPARATOR_HTML_OUTPUT_PREFIX";
- String DOC_COMPARATOR_GFXCMP_WITH_BORDERMOVE = "DOC_COMPARATOR_GFXCMP_WITH_BORDERMOVE";
-
- String DOC_CONVERTER_IMPORT_FILTER_NAME = "DOC_CONVERTER_IMPORT_FILTER_NAME";
- String DOC_CONVERTER_EXPORT_FILTER_NAME = "DOC_CONVERTER_EXPORT_FILTER_NAME";
- String DOC_CONVERTER_OFFICE_PROGRAM = "DOC_CONVERTER_OFFICE_PROGRAM";
- String DOC_CONVERTER_REUSE_OFFICE = "DOC_CONVERTER_REUSE_OFFICE";
-
- String DOC_COMPARATOR_LEAVE_OUT_FILES = "DOC_COMPARATOR_LEAVE_OUT_FILES";
-
- String DOC_COMPARATOR_DB_INFO_STRING = "DOC_COMPARATOR_DB_INFO_STRING";
-
- String TEMPPATH = "TEMPPATH";
-
- // set this variable to "true" or "yes" and loadComponentFromURL works with property Hidden=false
- String OFFICE_VIEWABLE = "OFFICE_VIEWABLE";
-
- String DB_CONNECTION_STRING = "DB_CONNECTION_STRING";
- String CHECK_NEED_TOOLS = "CHECK_NEED_TOOLS";
- String CREATE_DEFAULT = "CREATE_DEFAULT_REFERENCE";
-
-}
diff --git a/qadevOOo/runner/convwatch/ReferenceBuilder.java b/qadevOOo/runner/convwatch/ReferenceBuilder.java
deleted file mode 100644
index 2c4bc37a64cd..000000000000
--- a/qadevOOo/runner/convwatch/ReferenceBuilder.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.FileFilter;
-import com.sun.star.lang.XMultiServiceFactory;
-
-import helper.OfficeProvider;
-
-/**
- * The following Complex Test will test
- * an already created document and it's postscript output (by an older office version)
- * with a new office version.
- * This test use Ghostscript for the jpeg export and graphically compare tools from ImageMagick.
- * Read the manual for more information.
- *
- * this is only the starter program
- * more is found in qadevOOo/runner/convwatch/*
- */
-
-public class ReferenceBuilder extends EnhancedComplexTestCase
-{
- // The first of the mandatory functions:
- /**
- * Return the name of the test.
- * In this case it is the actual name of the service.
- * @return The tested service.
- */
- @Override
- public String getTestObjectName() {
- return "ReferenceBuilder runner";
- }
-
- // The second of the mandatory functions: return all test methods as an
- // array. There is only one test function in this example.
- /**
- * Return all test methods.
- * @return The test methods.
- */
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"buildreference"};
- }
-
- // This test is fairly simple, so there is no need for before() or after()
- // methods.
-
- public void before()
- {
- }
-
- public void after()
- {
- }
-
- // The test method itself.
- private String m_sInputPath = "";
- private String m_sReferencePath = "";
- private void initMember()
- {
- // MUST PARAMETER
- // INPUT_PATH ----------
- String sINPATH = (String)param.get( PropertyName.DOC_COMPARATOR_INPUT_PATH );
- boolean bQuit = false;
- if (sINPATH == null || sINPATH.length() == 0)
- {
- log.println("Please set input path (path to documents) " + PropertyName.DOC_COMPARATOR_INPUT_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_INPUT_PATH + " " + sINPATH);
- m_sInputPath = sINPATH;
- }
-
- // REFERENCE_PATH ----------
- String sREF = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_PATH );
- if (sREF == null || sREF.length() == 0)
- {
- log.println("Please set output path (path to a directory, where the references should stay) " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + "=path.");
- bQuit = true;
- }
- else
- {
- log.println("found " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + " " + sREF);
- m_sReferencePath = sREF;
- }
-
- if (bQuit)
- {
- assure("Must quit, Parameter problems.", false);
- }
-
- if (m_sInputPath.startsWith("file:") ||
- m_sReferencePath.startsWith("file:"))
- {
- assure("We can't handle file: URL right, use system path instead.", false);
- }
-
- }
-
- /**
- * Function returns a List of software which must accessible as an external executable
- */
- @Override
- protected String[] mustInstalledSoftware()
- {
- return new String[] { "perl -version" };
- }
-
- // the test ======================================================================
- public void buildreference()
- {
- GlobalLogWriter.set(log);
- String sDBConnection = (String)param.get( PropertyName.DB_CONNECTION_STRING );
-
- // check if all need software is installed and accessible
- checkEnvironment(mustInstalledSoftware());
-
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
- if (aGTA == null)
- {
- assure("Must quit", false);
- }
- if (aGTA.cancelRequest())
- {
- return;
- }
-
- initMember();
- DB.init(aGTA.getDBInfoString() + "," + sDBConnection);
- File aInputPath = new File(m_sInputPath);
- if (aInputPath.isDirectory())
- {
- String fs = System.getProperty("file.separator");
-
- aInputPath.getAbsolutePath();
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilter();
-
- Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories());
-
- // normal run.
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
-
- String sNewReferencePath = m_sReferencePath + fs + FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, m_sInputPath);
- log.println("- next file is: ------------------------------");
- log.println(sEntry);
- log.println(sNewReferencePath);
-
- if (aGTA.checkIfUsableDocumentType(sEntry))
- {
- runGDC(sEntry, sNewReferencePath);
- }
- if (aGTA.cancelRequest())
- {
- break;
- }
- }
- }
- else
- {
- if (aGTA.checkIfUsableDocumentType(m_sInputPath))
- {
- runGDC(m_sInputPath, m_sReferencePath);
- }
- }
- }
-
- private void runGDC(String _sInputPath, String _sReferencePath)
- {
- // first do a check if the reference not already exist, this is a big speedup, due to the fact,
- // we don't need to start a new office.
- GraphicalTestArguments aGTA = getGraphicalTestArguments();
- if (!GraphicalDifferenceCheck.isReferenceExists(_sInputPath, _sReferencePath, aGTA))
- {
- // start a fresh Office
- OfficeProvider aProvider = null;
- // SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
- if (aGTA.shouldOfficeStart())
- {
- aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
- aProvider = new OfficeProvider();
- XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
- param.put("ServiceFactory", xMSF);
- aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);
-
- long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
- aGTA = getGraphicalTestArguments();
- aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
- }
-
- // 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");
- Object aWatcher = param.get("Watcher");
- GlobalLogWriter.get().setWatcher(aWatcher);
-
- try
- {
- log.println("Reference type is " + aGTA.getReferenceType());
- DB.source_start();
- GraphicalDifferenceCheck.createOneReferenceFile(_sInputPath, _sReferencePath, aGTA);
- DB.source_finished();
- }
- catch(ConvWatchCancelException e)
- {
- assure(e.getMessage(), false);
- DB.source_failed(e.getMessage());
- }
- catch(ConvWatchException e)
- {
- assure(e.getMessage(), false);
- DB.source_failed(e.getMessage());
- }
- catch(com.sun.star.lang.DisposedException e)
- {
- assure(e.getMessage(), false, true);
- DB.source_failed(e.getMessage());
- }
-
- // Office shutdown
- if (aProvider != null)
- {
- boolean bClosed = aProvider.closeExistingOffice(param, true);
- // Hope I can check that the close of the office fails
- assure("Office closed", bClosed, true);
- }
- }
- else
- {
- // Reference already exist, do nothing, but DB change
- DB.source_finished();
- }
- }
-}
-
diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java
deleted file mode 100644
index 204f8d9c70f3..000000000000
--- a/qadevOOo/runner/convwatch/ReportDesignerTest.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XDesktop;
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XStorable;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.sdb.XDocumentDataSource;
-import com.sun.star.sdb.XOfficeDatabaseDocument;
-import com.sun.star.sdb.XReportDocumentsSupplier;
-import com.sun.star.sdb.application.XDatabaseDocumentUI;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-import com.sun.star.util.XCloseable;
-import com.sun.star.lang.XServiceInfo;
-
-import complexlib.ComplexTestCase;
-import helper.OfficeProvider;
-import helper.URLHelper;
-import helper.OfficeWatcher;
-
-class PropertySetHelper
-{
- XPropertySet m_xPropertySet;
- public PropertySetHelper(Object _aObj)
- {
- m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj);
- }
-
- /**
- get a property and don't convert it
- @param _sName the string name of the property
- @return the object value of the property without any conversion
- */
- public Object getPropertyValueAsObject(String _sName)
- {
- Object aObject = null;
-
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- System.out.println("ERROR: UnknownPropertyException caught. '" + _sName + "'");
- System.out.println("Message: " + e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- System.out.println("ERROR: WrappedTargetException caught.");
- System.out.println("Message: " + e.getMessage());
- }
- }
- return aObject;
- }
-}
-
-class PropertyHelper
-{
- /**
- Create a PropertyValue[] from a ArrayList
- @return a PropertyValue[]
- */
- public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList<PropertyValue> _aPropertyList)
- {
- // copy the whole PropertyValue List to an PropertyValue Array
- PropertyValue[] aSaveProperties = null;
-
- if (_aPropertyList == null)
- {
- aSaveProperties = new PropertyValue[0];
- }
- else
- {
- if (_aPropertyList.size() > 0)
- {
- aSaveProperties = new PropertyValue[_aPropertyList.size()];
- for (int i = 0;i<_aPropertyList.size(); i++)
- {
- aSaveProperties[i] = _aPropertyList.get(i);
- }
- }
- else
- {
- aSaveProperties = new PropertyValue[0];
- }
- }
- return aSaveProperties;
- }
-}
-
-public class ReportDesignerTest extends ComplexTestCase {
-
- String mTestDocumentPath;
-
- /**
- * This method returns a list of Strings, each string must be a function name in this class.
- */
- @Override
- public String[] getTestMethodNames()
- {
- return new String[] {"ReportDesignTest"}; // MAIN
- }
-
- private void checkIfOfficeExists(String _sOfficePathWithTrash)
- {
- String sOfficePath = "";
- int nIndex = _sOfficePathWithTrash.indexOf("soffice.exe");
- if (nIndex > 0)
- {
- sOfficePath = _sOfficePathWithTrash.substring(0, nIndex + 11);
- }
- else
- {
- nIndex = _sOfficePathWithTrash.indexOf("soffice");
- if (nIndex > 0)
- {
- sOfficePath = _sOfficePathWithTrash.substring(0, nIndex + 7);
- }
- }
-
- sOfficePath = helper.StringHelper.removeQuoteIfExists(sOfficePath);
-
- log.println(sOfficePath);
- File sOffice = new File(sOfficePath);
- if (! sOffice.exists())
- {
- log.println("ERROR: There exists no office installation at given path: '" + sOfficePath + "'");
- System.exit(0);
- }
- }
-
-
- private static XDesktop m_xDesktop = null;
- public static XDesktop getXDesktop()
- {
-
- if (m_xDesktop == null)
- {
- try
- {
- XInterface xInterface = (XInterface) m_xXMultiServiceFactory.createInstance( "com.sun.star.frame.Desktop" );
- m_xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface);
- }
- catch (com.sun.star.uno.Exception e)
- {
- log.println("ERROR: uno.Exception caught");
- log.println("Message: " + e.getMessage());
- }
- }
- return m_xDesktop;
- }
-
- private void showElements(XNameAccess _xNameAccess)
- {
- if (_xNameAccess != null)
- {
- String[] sElementNames = _xNameAccess.getElementNames();
- for(int i=0;i<sElementNames.length; i++)
- {
- System.out.println("Value: [" + i + "] := " + sElementNames[i]);
- }
- }
- else
- {
- System.out.println("Warning: Given object is null.");
- }
- }
-
-
- private OfficeProvider m_aProvider = null;
- private static XMultiServiceFactory m_xXMultiServiceFactory = null;
- private void startOffice()
- {
- param.put("TimeOut", Integer.valueOf(300000));
- System.out.println("TimeOut: " + param.getInt("TimeOut"));
- System.out.println("ThreadTimeOut: " + param.getInt("ThreadTimeOut"));
-
- m_aProvider = new OfficeProvider();
- m_xXMultiServiceFactory = (XMultiServiceFactory) m_aProvider.getManager(param);
- param.put("ServiceFactory", m_xXMultiServiceFactory);
- }
-
- private void stopOffice()
- {
- if (m_aProvider != null)
- {
- m_aProvider.closeExistingOffice(param, true);
- m_aProvider = null;
- }
- TimeHelper.waitInSeconds(2, "Give close Office some time.");
- }
-
- private String m_sMailAddress = null;
- private String m_sParentDistinct = null;
-
- private static String m_sSourceVersion;
- private static String m_sDestinationVersion;
- private static String m_sSourceName;
- private static String m_sDestinationName;
-
- /**
- * This is the main test Function of current ReportDesignerTest
- */
- public void ReportDesignTest()
- {
- convwatch.GlobalLogWriter.set(log);
-
- GlobalLogWriter.get().println("Set office watcher");
- OfficeWatcher aWatcher = (OfficeWatcher)param.get("Watcher");
- GlobalLogWriter.get().setWatcher(aWatcher);
-
- try
- {
-
- // -------------------- preconditions, try to find an office --------------------
-
- String sAppExecutionCommand = (String) param.get("AppExecutionCommand");
- log.println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
-
- String sUser = System.getProperty("user.name");
- log.println("user.name='" + sUser + "'");
-
- m_sMailAddress = System.getProperty("MailAddress");
- log.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");
-
- if (m_sSourceVersion == null)
- {
- System.out.println("Error, Sourceversion is null.");
- System.exit(1);
- }
-
- sAppExecutionCommand = sAppExecutionCommand.replaceAll( "\\$\\{USERNAME\\}", sUser);
- log.println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
-
- // an other way to replace strings
-
- checkIfOfficeExists(sAppExecutionCommand);
- param.put("AppExecutionCommand", sAppExecutionCommand);
-
- // --------------------------- Start the given Office ---------------------------
-
- startOffice();
-
- // ------------------------------ Start a test run ------------------------------
-
- String sDocument = (String) param.get(convwatch.PropertyName.DOC_COMPARATOR_INPUT_PATH);
- sDocument = helper.StringHelper.removeQuoteIfExists( sDocument );
- startTestForFile(sDocument);
- }
- catch (AssureException e)
- {
- stopOffice();
- throw new AssureException(e);
- }
-
- // ------------------------------ Office shutdown ------------------------------
- stopOffice();
- }
-
-
- private void startTestForFile(String _sDocument /*, int _nType*/)
- {
- File aFile = new File(_sDocument);
- assure("Test File '" + _sDocument + "' doesn't exist.", aFile.exists());
-
- String sFileURL = URLHelper.getFileURLFromSystemPath(_sDocument);
- log.println("File URL: " + sFileURL);
-
- XComponent xDocComponent = loadComponent(sFileURL, getXDesktop(), null);
- log.println("Load done");
-
- try
- {
- XInterface x = (XInterface)m_xXMultiServiceFactory.createInstance("com.sun.star.sdb.DatabaseContext");
- assure("can't create instance of com.sun.star.sdb.DatabaseContext", x != null);
- log.println("createInstance com.sun.star.sdb.DatabaseContext done");
-
- XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, x);
- showElements(xNameAccess);
- Object aObj = xNameAccess.getByName(sFileURL);
-
- XDocumentDataSource xDataSource = UnoRuntime.queryInterface(XDocumentDataSource.class, aObj);
- XOfficeDatabaseDocument xOfficeDBDoc = xDataSource.getDatabaseDocument();
-
- assure("can't access DatabaseDocument", xOfficeDBDoc != null);
-
- XModel xDBSource = UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
- Object aController = xDBSource.getCurrentController();
- assure("Controller of xOfficeDatabaseDocument is empty!", aController != null);
-
- XDatabaseDocumentUI aDBDocUI = UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
- aDBDocUI.connect();
-
- Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
- assure("ActiveConnection is empty", aActiveConnectionObj != null);
-
- XReportDocumentsSupplier xSupplier = UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
- xNameAccess = xSupplier.getReportDocuments();
- assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null);
-
- showElements(xNameAccess);
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
-
- PropertyValue aActiveConnection = new PropertyValue();
- aActiveConnection.Name = "ActiveConnection";
- aActiveConnection.Value = aActiveConnectionObj;
- aPropertyList.add(aActiveConnection);
-
- loadAndStoreReports(xNameAccess, aPropertyList /*, _nType*/ );
- createDBEntry(/*_nType*/);
- }
- catch(com.sun.star.uno.Exception e)
- {
- log.println("ERROR: Exception caught");
- log.println("Message: " + e.getMessage());
- }
-
- // Close the document
- closeComponent(xDocComponent);
- }
-
- private String getDocumentPoolName(/*int _nType*/)
- {
- return "AutogenReportDesignTest";
- }
-
-
- private void createDBEntry(/*int _nType*/)
- {
- // try to connect the database
- String sDBConnection = (String)param.get( convwatch.PropertyName.DB_CONNECTION_STRING );
- log.println("DBConnection: " + sDBConnection);
- DB.init(sDBConnection);
-
- String sSourceVersion = m_sSourceVersion;
- String sSourceName = m_sSourceName;
- String sSourceCreatorType = "";
- String sDestinationName = m_sDestinationName;
- String sDestinationCreatorType = "";
- String sDocumentPoolDir = getOutputPath(/*_nType*/);
- String sDocumentPoolName = getDocumentPoolName(/*_nType*/);
- String sSpecial = "";
-
- DB.insertinto_documentcompare(sSourceVersion, sSourceName, sSourceCreatorType,
- m_sDestinationVersion, sDestinationName, sDestinationCreatorType,
- sDocumentPoolDir, sDocumentPoolName, m_sMailAddress,
- sSpecial, m_sParentDistinct);
- TimeHelper.waitInSeconds(1, "wait for DB.");
- }
-
- private void loadAndStoreReports(XNameAccess _xNameAccess, ArrayList<PropertyValue> _aPropertyList /*, int _nType*/ )
- {
- if (_xNameAccess != null)
- {
- String[] sElementNames = _xNameAccess.getElementNames();
- for(int i=0;i<sElementNames.length; i++)
- {
- String sReportName = sElementNames[i];
- XComponent xDoc = loadComponent(sReportName, _xNameAccess, _aPropertyList);
- // print? or store?
- storeComponent(sReportName, xDoc /*, _nType*/);
- closeComponent(xDoc);
- }
- }
- }
-
- private String getFormatExtension(Object _xComponent /* int _nType*/ )
- {
- String sExtension;
- XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
- if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
- {
- // calc
- sExtension = ".ods";
- }
- else if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
- {
- //writer
- sExtension = ".odt";
- }
- else
- {
- sExtension = ".UNKNOWN";
- }
- return sExtension;
- }
-
- private String m_sOutputPath = null;
-
- private String getOutputPath(/*int _nType*/)
- {
- if (m_sOutputPath == null)
- {
- String sOutputPath = (String)param.get( convwatch.PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
- sOutputPath = helper.StringHelper.removeQuoteIfExists(sOutputPath);
-
- if (!sOutputPath.endsWith("/") || // construct the output file name
- !sOutputPath.endsWith("\\"))
- {
- sOutputPath += System.getProperty("file.separator");
- }
- sOutputPath += DateHelper.getDateTimeForFilename();
- sOutputPath += System.getProperty("file.separator");
-
- File aOutputFile = new File(sOutputPath); // create the directory of the given output path
- aOutputFile.mkdirs();
- m_sOutputPath = sOutputPath;
- }
- return m_sOutputPath;
- }
-
- /*
- store given _xComponent under the given Name in DOC_COMPARATOR_INPUTPATH
- */
- private void storeComponent(String _sName, Object _xComponent /*, int _nType*/ )
- {
- String sOutputPath = getOutputPath(/*_nType*/);
-
- // add DocumentPoolName
- sOutputPath += getDocumentPoolName(/*_nType*/);
- sOutputPath += System.getProperty("file.separator");
-
- File aOutputFile = new File(sOutputPath); // create the directory of the given output path
- aOutputFile.mkdirs();
-
- sOutputPath += _sName;
- sOutputPath += getFormatExtension(_xComponent /*_nType*/);
-
- String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); // set some properties for storeAsURL
-
- PropertyValue aOverwrite = new PropertyValue(); // always overwrite already exist files
- aOverwrite.Name = "Overwrite";
- aOverwrite.Value = Boolean.TRUE;
- aPropertyList.add(aOverwrite);
-
- // store the document in an other directory
- XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _xComponent);
- if (aStorable != null)
- {
- log.println("store document as URL: '" + sOutputURL + "'");
- try
- {
- aStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- }
- catch (com.sun.star.io.IOException e)
- {
- log.println("ERROR: Exception caught");
- log.println("Can't write document URL: '" + sOutputURL + "'");
- log.println("Message: " + e.getMessage());
- }
- }
- }
-
- private XComponent loadComponent(String _sName, Object _xComponent, ArrayList<PropertyValue> _aPropertyList)
- {
- XComponent xDocComponent = null;
- XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );
-
- try
- {
- PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList);
- log.println("Load component: '" + _sName + "'");
- xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", 0, aLoadProperties);
- log.println("Load component: '" + _sName + "' done");
- }
- catch (com.sun.star.io.IOException e)
- {
- log.println("ERROR: Exception caught");
- log.println("Can't load document '" + _sName + "'");
- log.println("Message: " + e.getMessage());
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- log.println("ERROR: Exception caught");
- log.println("Illegal Arguments given to loadComponentFromURL.");
- log.println("Message: " + e.getMessage());
- }
- return xDocComponent;
- }
-
- private void closeComponent(XComponent _xDoc)
- {
- // Close the document
- XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, _xDoc);
- try
- {
- xCloseable.close(true);
- }
- catch (com.sun.star.util.CloseVetoException e)
- {
- log.println("ERROR: CloseVetoException caught");
- log.println("CloseVetoException occurred Can't close document.");
- log.println("Message: " + e.getMessage());
- }
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java b/qadevOOo/runner/convwatch/SimpleFileSemaphore.java
deleted file mode 100644
index 0fd9882604c2..000000000000
--- a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-import java.io.File;
-import java.io.RandomAccessFile;
-import helper.OSHelper;
-
-public class SimpleFileSemaphore
-{
- String m_sInternSemaphoreFile;
- File m_aInternSemaphoreFile;
- GlobalLogWriter m_aLog;
-
- public static void sleep( int _nSeconds)
- {
- // wait a second here
- try
- {
- java.lang.Thread.sleep(1000L * _nSeconds);
- }
- catch (InterruptedException e2)
- {
- }
- }
-
- public SimpleFileSemaphore() throws IllegalArgumentException
- {
- String sInternFileName;
- if (OSHelper.isWindows())
- {
- sInternFileName = "C:/Temp/ConvwatchOOoSemaphore.txt";
- }
- else if (OSHelper.isUnix())
- {
- sInternFileName = "/tmp/ConvwatchOOoSemaphore.txt";
- }
- else
- {
- m_sInternSemaphoreFile = null;
- throw new IllegalArgumentException("Unknown System, can't initialise SimpleFileSemaphore");
- }
-
- m_sInternSemaphoreFile = sInternFileName;
- m_aInternSemaphoreFile = new File(sInternFileName);
- }
-
- public File getSemaphoreFile()
- {
- return m_aInternSemaphoreFile;
- }
-
-// wait until resource is available
- public void P(File _aSemaphore)
- {
- int nCount = 0;
- int nCheckLoop = 1;
-
- while ( nCheckLoop == 1)
- {
- // check if resource is available, if not, wait.
- if ( _aSemaphore.exists() )
- {
- GlobalLogWriter.get().println( "Active wait since " + nCount + "sec..");
- nCount ++;
- sleep( 1 );
- }
- else
- {
- sleep( 1 );
- if ( _aSemaphore.exists() )
- {
- // ups
- GlobalLogWriter.get().println( "ups...");
- }
- else
- {
- nCheckLoop = 0;
- }
- }
- }
-
- // block resource by ourself
- try
- {
- RandomAccessFile aWriter = new RandomAccessFile(_aSemaphore, "rw");
- aWriter.writeByte(1);
- aWriter.close();
- }
-
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.get().println( "caught: FileNotFoundException");
- }
- catch(java.io.IOException ie)
- {
- GlobalLogWriter.get().println( "caught: IOException");
- }
- }
-
-
-// block a resource
- public void V(File _aSemaphore)
- {
-
- if ( _aSemaphore.exists() )
- {
- _aSemaphore.delete();
- }
- else
- {
- GlobalLogWriter.get().println("Could be a problem here? No resource block found.");
- }
- }
-
- // --------------------------------- Unit test ---------------------------------
-
- private static boolean SEMAPHORE_SHOULD_EXIST = true;
- private static boolean SEMAPHORE_SHOULD_NOT_EXIST = false;
-
- private static void assure(boolean _b, String _sText)
- {
- System.out.print(_sText);
- System.out.print(" ");
- if (_b)
- {
- System.out.println("ok");
- }
- else
- {
- System.out.println("FAILED");
- }
- }
-
- private static void testSemaphoreFile(SimpleFileSemaphore a, boolean _bShouldFileExists)
- {
- System.out.println("Check if semaphore file exists.");
- File aSemaphoreFile = a.getSemaphoreFile();
- if (aSemaphoreFile.exists())
- {
- System.out.println("Name is: " + aSemaphoreFile.getAbsolutePath());
- assure(_bShouldFileExists == SEMAPHORE_SHOULD_EXIST, "Semaphore should exist!");
- }
- else
- {
- assure(_bShouldFileExists == SEMAPHORE_SHOULD_NOT_EXIST, "Semaphore should not exist!");
- }
- }
-
- public static void main( String[] argv )
- {
- SimpleFileSemaphore a = new SimpleFileSemaphore();
-
- testSemaphoreFile(a, SEMAPHORE_SHOULD_NOT_EXIST);
-
- a.P(a.getSemaphoreFile());
-
- testSemaphoreFile(a, SEMAPHORE_SHOULD_EXIST);
-
- a.V(a.getSemaphoreFile());
-
- testSemaphoreFile(a, SEMAPHORE_SHOULD_NOT_EXIST);
- }
-}
diff --git a/qadevOOo/runner/convwatch/StatusHelper.java b/qadevOOo/runner/convwatch/StatusHelper.java
deleted file mode 100644
index ea3241f55011..000000000000
--- a/qadevOOo/runner/convwatch/StatusHelper.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class StatusHelper
-{
- final static private int DIFF_NOT_REALLY_INITIALISED = 1;
- final static public int DIFF_NO_DIFFERENCES = 2;
- final static public int DIFF_DIFFERENCES_FOUND = 3;
- final static public int DIFF_AFTER_MOVE_DONE_NO_PROBLEMS = 4;
- final static public int DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND = 5;
-
-
-
- public String m_sOldGfx;
- public String m_sNewGfx;
- public String m_sDiffGfx;
- public int nDiffStatus = DIFF_NOT_REALLY_INITIALISED;
- public int nPercent = 0;
-
- // BorderMove Values
- public int nPercent2 = 0;
- public String m_sOld_BM_Gfx;
- public String m_sNew_BM_Gfx;
- public String m_sDiff_BM_Gfx;
-
- public StatusHelper(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- {
- m_sOldGfx = _sOldGfx;
- m_sNewGfx = _sNewGfx;
- m_sDiffGfx = _sDiffGfx;
- }
- public void setFilesForBorderMove(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- {
- m_sOld_BM_Gfx = _sOldGfx;
- m_sNew_BM_Gfx = _sNewGfx;
- m_sDiff_BM_Gfx = _sDiffGfx;
-
- }
-
- public void printStatus()
- {
- GlobalLogWriter.get().println(" Original file: " + m_sOldGfx);
- GlobalLogWriter.get().println(" New file: " + m_sNewGfx);
- GlobalLogWriter.get().println("Difference file: " + m_sDiffGfx);
- if (nDiffStatus == DIFF_NOT_REALLY_INITIALISED)
- {
- GlobalLogWriter.get().println("Early problem, may be the files doesn't exist.");
- }
- else if (nDiffStatus == DIFF_NO_DIFFERENCES)
- {
- GlobalLogWriter.get().println("No differences found, ok.");
- }
- else if (nDiffStatus == DIFF_DIFFERENCES_FOUND)
- {
- GlobalLogWriter.get().println("Files differ by " + nPercent + "%");
- }
- else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_NO_PROBLEMS)
- {
- GlobalLogWriter.get().println("No differences found, after move picture.");
- }
- else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND)
- {
- GlobalLogWriter.get().println("A picture move is done, the files differ by " + nPercent2 + " old was " + nPercent + "%");
- }
- else
- {
- GlobalLogWriter.get().println("Unknown DIFF_ values used, not handles yet.");
- }
- }
-
-}
diff --git a/qadevOOo/runner/convwatch/TimeHelper.java b/qadevOOo/runner/convwatch/TimeHelper.java
deleted file mode 100644
index 8d5d79252d1f..000000000000
--- a/qadevOOo/runner/convwatch/TimeHelper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class TimeHelper
-{
- /*
- wait a second the caller don't need to handle the interruptexception
- @param _nSeconds how long should we wait
- @param _sReason give a good reason, why we have to wait
- */
- static void waitInSeconds(int _nSeconds, String _sReason)
- {
- GlobalLogWriter.get().println("Wait " + _nSeconds + " sec. Reason: " + _sReason);
- try {
- java.lang.Thread.sleep(1000L * _nSeconds);
- } catch (InterruptedException e2) {}
- }
-}
diff --git a/qadevOOo/runner/convwatch/TriState.java b/qadevOOo/runner/convwatch/TriState.java
deleted file mode 100644
index ec9dfd194336..000000000000
--- a/qadevOOo/runner/convwatch/TriState.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-public class TriState
-{
- public static final TriState TRUE = new TriState(1);
- public static final TriState FALSE = new TriState(0);
- public static final TriState UNSET = new TriState(-1);
-
- private final int m_nValue;
-
- /**
- Allocates a <code>TriState</code> object representing the
- <code>value</code> argument.
-
- @param value the value of the <code>TriState</code>.
- */
- private TriState(int value)
- {
- m_nValue = value;
- }
-
- /**
- Returns the value of this TriState object as an int
- * @return the primitive <code>int</code> value of this object.
- */
- private int intValue()
- {
- return m_nValue;
- }
- /**
- Returns <code>true</code> if and only if the argument is not
- <code>null</code> and is a <code>TriState</code> object that
- contains the same <code>int</code> value as this object.
-
- @param obj the object to compare with.
- @return <code>true</code> if the objects are the same;
- <code>false</code> otherwise.
- */
-
- @Override
- public boolean equals(Object obj)
- {
- if ((obj != null) &&
- (obj instanceof TriState))
- {
- return m_nValue == ((TriState)obj).intValue();
- }
- return false;
- }
-}
diff --git a/qadevOOo/runner/convwatch/ValueNotFoundException.java b/qadevOOo/runner/convwatch/ValueNotFoundException.java
deleted file mode 100644
index 4892e1545f47..000000000000
--- a/qadevOOo/runner/convwatch/ValueNotFoundException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package convwatch;
-
-class ValueNotFoundException extends Exception
-{
- ValueNotFoundException(String _sMessage)
- {
- super(_sMessage);
- }
-}
diff --git a/qadevOOo/runner/graphical/BuildID.java b/qadevOOo/runner/graphical/BuildID.java
deleted file mode 100644
index 9ce55b2490b5..000000000000
--- a/qadevOOo/runner/graphical/BuildID.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.io.File;
-import helper.OSHelper;
-
-public class BuildID
-{
- private static String getOfficePath(String _sApp)
- {
- String sOfficePath = "";
- // TODO: StringHelper.removeQuote?
- if (_sApp.startsWith("\""))
- {
- int nIdx = _sApp.indexOf('"', 1);
- if (nIdx != -1)
- {
- // leave double qoute out.
- sOfficePath = _sApp.substring(1, nIdx);
- }
- }
- else
- {
- // check if _sApp ends with the office executable, if not
- if (! (_sApp.endsWith("soffice.exe") || _sApp.endsWith("soffice")))
- {
- // check if a space exist, so we get all until space
- int nIdx = _sApp.indexOf(' ', 1);
- if (nIdx == -1)
- {
- sOfficePath = _sApp;
- }
- else
- {
- sOfficePath = _sApp.substring(0, nIdx);
- }
- }
- else
- {
- sOfficePath = _sApp;
- }
- }
- return sOfficePath;
- }
-
- public static String getBuildID(String _sApp)
- {
- final String sOfficePath = getOfficePath(_sApp);
- final String sBuildID = getBuildID(sOfficePath, "buildid");
- return sBuildID;
- }
-
- private static String getBuildID(String _sOfficePath, String _sIniSection)
- {
- File aSOfficeFile = new File(_sOfficePath);
- String sBuildID = "";
- if (aSOfficeFile.exists())
- {
- String sOfficePath = FileHelper.getPath(_sOfficePath);
- sBuildID = getBuildIDFromBootstrap(sOfficePath, _sIniSection);
- if (sBuildID.length() == 0)
- {
- sBuildID = getBuildIDFromVersion(sOfficePath, _sIniSection);
- }
- }
- else
- {
- GlobalLogWriter.println("soffice executable not found.");
- }
-
- return sBuildID;
- }
-
- private static String getBuildIDFromBootstrap(String _sOfficePath, String _sIniSection)
- {
- String sBuildID = "";
- String sOfficePath;
- if (OSHelper.isWindows())
- {
- sOfficePath = FileHelper.appendPath(_sOfficePath, "bootstrap.ini");
- }
- else
- {
- sOfficePath = FileHelper.appendPath(_sOfficePath, "bootstraprc");
- }
- IniFile aIniFile = new IniFile(sOfficePath);
- if (aIniFile.is())
- {
- sBuildID = aIniFile.getValue("Bootstrap", /*"buildid"*/ _sIniSection);
- }
- else
- {
- GlobalLogWriter.println("Property Build, can't open file '" + sOfficePath + "', please check.");
- }
- return sBuildID;
- }
-
- private static String getBuildIDFromVersion(String _sOfficePath, String _sIniSection)
- {
- String sBuildID = "";
- String sOfficePath;
- if (OSHelper.isWindows())
- {
- sOfficePath = FileHelper.appendPath(_sOfficePath, "version.ini");
- }
- else
- {
- sOfficePath = FileHelper.appendPath(_sOfficePath, "versionrc");
- }
- IniFile aIniFile = new IniFile(sOfficePath);
- if (aIniFile.is())
- {
- sBuildID = aIniFile.getValue("Version", /*"buildid"*/ _sIniSection);
- }
- else
- {
- GlobalLogWriter.println("Property Build, can't open file '" + sOfficePath + "', please check.");
- }
- return sBuildID;
- }
-
-
-
-
-
-}
diff --git a/qadevOOo/runner/graphical/DateHelper.java b/qadevOOo/runner/graphical/DateHelper.java
deleted file mode 100644
index 1d1ecd9c37f4..000000000000
--- a/qadevOOo/runner/graphical/DateHelper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.text.SimpleDateFormat;
-import java.util.GregorianCalendar;
-import java.text.FieldPosition;
-import java.util.Locale;
-
-public class DateHelper
-{
- public static String getDateTimeForFilename()
- {
- return getDateString("yyyyMMdd-HHmmss");
- }
-
- public static String getDateTimeForHumanreadableLog()
- {
- return getDateString("[yyyy/MM/dd HH:mm:ss]");
- }
-
- private static String getDateString(String _sFormat)
- {
- GregorianCalendar aCalendar = new GregorianCalendar();
- StringBuffer aBuf = new StringBuffer();
-
- Locale aLocale = new Locale("en","US");
- SimpleDateFormat aFormat = new SimpleDateFormat(_sFormat, aLocale);
- aBuf = aFormat.format(aCalendar.getTime(), aBuf, new FieldPosition(0) );
- return aBuf.toString();
- }
-}
diff --git a/qadevOOo/runner/graphical/DirectoryHelper.java b/qadevOOo/runner/graphical/DirectoryHelper.java
deleted file mode 100644
index 0d0462795433..000000000000
--- a/qadevOOo/runner/graphical/DirectoryHelper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-
-/**
- * Helper for directory access
- */
-public class DirectoryHelper
-{
- private final ArrayList<String> m_aFileList = new ArrayList<String>();
- private boolean m_bRecursiveIsAllowed = true;
-
- private void setRecursiveIsAllowed(boolean _bValue)
- {
- m_bRecursiveIsAllowed = _bValue;
- }
-
- /**
- * Traverse over a given directory, and filter with a given FileFilter
- * object and gives back the deep directory as a Object[] list, which
- * contain a String object for every directory entry.
- *
- * <B>Example</B>
- * List directory /bin, filter out all files which ends with '.prn'
- *
- * FileFilter aFileFilter = new FileFilter()
- * {
- * public boolean accept( File pathname )
- * {
- * if (pathname.getName().endsWith(".prn"))
- * {
- * return false;
- * }
- * return true;
- * }
- * };
- *
- * Object[] aList = DirectoryHelper.traverse("/bin", aFileFilter);
- * for (int i=0;i<aList.length;i++)
- * {
- * String aEntry = (String)aList[i];
- * System.out.println(aEntry);
- * }
- *
- * @return list of directories
- */
- public static Object[] traverse( String _sDirectory, FileFilter _aFileFilter, boolean _bRecursiveIsAllowed )
- {
- DirectoryHelper a = new DirectoryHelper();
- a.setRecursiveIsAllowed(_bRecursiveIsAllowed);
- a.traverse_impl(_sDirectory, _aFileFilter);
- return a.m_aFileList.toArray();
- }
-
-
-
- private void traverse_impl( String afileDirectory, FileFilter _aFileFilter )
- {
- File fileDirectory = new File(afileDirectory);
- // Testing, if the file is a directory, and if so, it throws an exception
- if ( !fileDirectory.isDirectory() )
- {
- throw new IllegalArgumentException( "not a directory: " + fileDirectory.getName() );
- }
-
- // Getting all files and directories in the current directory
- File[] aDirEntries;
- if (_aFileFilter != null)
- {
- aDirEntries = fileDirectory.listFiles(_aFileFilter);
- }
- else
- {
- aDirEntries = fileDirectory.listFiles();
- }
-
- // Iterating for each file and directory
- for ( int i = 0; i < aDirEntries.length; ++i )
- {
- if ( aDirEntries[ i ].isDirectory() )
- {
- if (m_bRecursiveIsAllowed)
- {
- // Recursive call for the new directory
- traverse_impl( aDirEntries[ i ].getAbsolutePath(), _aFileFilter );
- }
- }
- else
- {
- // adding file to List
- try
- {
- // Composing the URL by replacing all backslashs
- String aStr = aDirEntries[ i ].getAbsolutePath();
- m_aFileList.add(aStr);
- }
- catch( Exception exception )
- {
- exception.printStackTrace();
- break;
- }
- }
- }
- }
-}
-
diff --git a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java b/qadevOOo/runner/graphical/EnhancedComplexTestCase.java
deleted file mode 100644
index 758edda3c711..000000000000
--- a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import complexlib.ComplexTestCase;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-
-abstract public class EnhancedComplexTestCase extends ComplexTestCase
-{
-
- /**
- * Call this for each document
- */
- protected abstract void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException;
-
-private void callEntry(String _sEntry, ParameterHelper _aParam)
-{
- log.println(" File: " + _sEntry);
- // TODO: check if 'sEntry' is a guilty document.
- File aFile = new File(_aParam.getInputPath());
- String sPath = _aParam.getInputPath();
- // problem here, isFile() checks also if the file exists, but a not existing file is not really a directory
- // therefore we check if the given file a path (isDirectory()) if not it must be a file
- if (aFile.isDirectory())
- {
- }
- else
- {
- // special case, if a file is given in inputpath
- sPath = FileHelper.getPath(_aParam.getInputPath());
- }
- String sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(_sEntry, sPath);
-
- String sNewOutputPath = _aParam.getOutputPath();
-
- // if there exist a subdirectory, add it to all result path
- if (sNewSubDir.length() > 0)
- {
-
- sNewOutputPath = FileHelper.appendPath(sNewOutputPath, sNewSubDir);
- }
- log.println("Outputpath: " + sNewOutputPath);
-
-
- // call interface with parameters
- try
- {
- checkOneFile(_sEntry, sNewOutputPath, _aParam);
- }
- catch (OfficeException e)
- {
- // TODO: unhandled yet.
- GlobalLogWriter.println("Warning: caught OfficeException " + e.getMessage());
- assure("Exception caught: " + e.getMessage(), false);
- }
-
-}
-
-/**
- * Run through all documents found in Inputpath.
- * Call the IDocument interface function call(...);
- */
- public void foreachDocumentinInputPath(ParameterHelper _aParam)
- {
- // TODO: auslagern in eine function, die ein Interface annimmt.
- File aInputPath = new File(_aParam.getInputPath());
- if (aInputPath.isDirectory())
- {
- // check a whole directory
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilter();
- traverseDirectory(aFileFilter, _aParam);
- }
- else
- {
- callEntry(_aParam.getInputPath(), _aParam);
- }
- }
-
- private void traverseDirectory(FileFilter _aFileFilter, ParameterHelper _aParam)
- {
- Object[] aList = DirectoryHelper.traverse(_aParam.getInputPath(), _aFileFilter, _aParam.isIncludeSubDirectories());
- if (aList.length == 0)
- {
- log.println("Nothing to do, there are no document files found.");
- }
- else
- {
- for (int i=0;i<aList.length;i++)
- {
- String sEntry = (String)aList[i];
- callEntry(sEntry, _aParam);
- }
- }
- }
-/**
- * Run through a given index.ini or run through a given directory,
- * find all postscript or pdf files.
- * Call the IDocument interface function call(...);
- */
- public void foreachPSorPDFinInputPath(ParameterHelper _aParam)
- {
- // TODO: auslagern in eine function, die ein Interface annimmt.
- String sInputPath = _aParam.getInputPath();
- File aInputPath = new File(sInputPath);
- if (aInputPath.isDirectory())
- {
- // check a whole directory
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilterPSorPDF();
- traverseDirectory(aFileFilter, _aParam);
- }
- else
- {
- // the inputpath contains a file
- if (sInputPath.toLowerCase().endsWith(".ini"))
- {
- IniFile aIniFile = new IniFile(_aParam.getInputPath());
- while (aIniFile.hasMoreElements())
- {
- String sKey = aIniFile.nextElement();
- String sPath = FileHelper.getPath(_aParam.getInputPath());
- String sEntry = FileHelper.appendPath(sPath, sKey);
- File aFile = new File(sEntry);
- assure("File '" + sEntry + "' doesn't exists.", aFile.exists(), true);
- if (aFile.exists())
- {
- callEntry(sEntry, _aParam);
- }
- }
- }
- else
- {
- // call for a single pdf/ps file
- if (sInputPath.toLowerCase().endsWith(".ps") ||
- sInputPath.toLowerCase().endsWith(".pdf") ||
- sInputPath.toLowerCase().endsWith(".prn"))
- {
- callEntry(sInputPath, _aParam);
- }
- else
- {
- String sInputPathWithPDF = sInputPath + ".pdf";
- File aInputPathWithPDF = new File(sInputPathWithPDF);
-
- if (aInputPathWithPDF.exists() &&
- _aParam.getReferenceType().equalsIgnoreCase("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);
- }
- }
- }
- }
- }
- }
-
- private void runThroughEveryReportInIndex(String _sPath, String _sBasename, ParameterHelper _aParam)
- {
- String sIndexFile = FileHelper.appendPath(_sPath, "index.ini");
- File aIndexFile = new File(sIndexFile);
- if (aIndexFile.exists())
- {
- IniFile aIniFile = new IniFile(sIndexFile);
-
- if (aIniFile.hasSection(_sBasename))
- {
- // special case for odb files
- int nFileCount = aIniFile.getIntValue(_sBasename, "reportcount", 0);
- ArrayList<String> aList = new ArrayList<String>();
- for (int i=0;i<nFileCount;i++)
- {
- String sValue = aIniFile.getValue(_sBasename, "report" + i);
-
- String sPSorPDFName = getPSorPDFNameFromIniFile(aIniFile, sValue);
- if (sPSorPDFName.length() > 0)
- {
- String sEntry = FileHelper.appendPath(_sPath, sPSorPDFName);
- aList.add(sEntry);
- }
- }
- aIniFile.close();
-
- int nOkStatus = 0;
- String sStatusRunThrough = "";
- String sStatusInfo = "";
- // get the bad status and store it into the
- for (int i=0;i<aList.size();i++)
- {
- String sEntry = aList.get(i);
- try
- {
- callEntry(sEntry, _aParam);
- }
- catch (AssureException e)
- {
- // we only need to catch the assure()
- // nOkStatus += 2;
- }
- // we want to know the current status of the run through
- // if the status is greater (more bad) then the current,
- // we will remember this. Only the very bad status will
- // seen.
- int nCurrentOkStatus = _aParam.getTestParameters().getInt("current_ok_status");
- if (nCurrentOkStatus > nOkStatus)
- {
- sStatusRunThrough = (String)_aParam.getTestParameters().get("current_state");
- sStatusInfo = (String)_aParam.getTestParameters().get("current_info");
- nOkStatus = nCurrentOkStatus;
- }
- }
- if (nOkStatus > 0)
- {
- _aParam.getTestParameters().put("last_state", sStatusRunThrough);
- _aParam.getTestParameters().put("last_info", sStatusInfo);
- }
- }
- else
- {
- // runThroughOneFileInIndex();
- String sPSorPDFName = getPSorPDFNameFromIniFile(aIniFile, _sBasename);
-
- aIniFile.close();
-
- if (sPSorPDFName.length() > 0)
- {
- String sEntry = FileHelper.appendPath(_sPath, sPSorPDFName);
- callEntry(sEntry, _aParam);
- }
- }
- }
- else
- {
- assure("File '" + sIndexFile + "' doesn't exists.", aIndexFile.exists(), true);
- }
- }
-
- private String getPSorPDFNameFromIniFile(IniFile _aIniFile, String _sName)
- {
- boolean bHasPostscriptOrPDF = false;
- String sPSBasename = _sName + ".ps";
- if (_aIniFile.hasSection(sPSBasename)) // checks for Postscript
- {
- bHasPostscriptOrPDF = true;
- }
- else
- {
- sPSBasename = _sName + ".pdf"; // checks for PDF
- if (_aIniFile.hasSection(sPSBasename))
- {
- bHasPostscriptOrPDF = true;
- }
- }
- if (bHasPostscriptOrPDF)
- {
- return sPSBasename;
- }
- return "";
- }
-
-/**
- * Run through a given index.ini or run through a given directory,
- * find all postscript or pdf files.
- * Call the IDocument interface function call(...);
- */
- public void foreachJPEGcompareWithJPEG(ParameterHelper _aParam)
- {
- // TODO: auslagern in eine function, die ein Interface annimmt.
- String sInputPath = _aParam.getInputPath();
- File aInputPath = new File(sInputPath);
- if (aInputPath.isDirectory())
- {
- // check a whole directory
- // a whole directory
- FileFilter aFileFilter = FileHelper.getFileFilterJPEG();
- traverseDirectory(aFileFilter, _aParam);
- }
- else
- {
- // the inputpath contains a file
- if (sInputPath.toLowerCase().endsWith(".ini"))
- {
- IniFile aIniFile = new IniFile(_aParam.getInputPath());
- while (aIniFile.hasMoreElements())
- {
- aIniFile.nextElement();
- }
- }
- else
- {
- // call for a single jpeg file
- try
- {
- String sOutputFilename = _aParam.getOutputPath();
- if (sInputPath.toLowerCase().endsWith(".jpg") ||
- sInputPath.toLowerCase().endsWith(".jpeg") )
- {
- checkOneFile(sInputPath, sOutputFilename, _aParam);
- }
- else
- {
- // check if there exists a ini file
- String sPath = FileHelper.getPath(sInputPath);
- String sBasename = FileHelper.getBasename(sInputPath);
-
- runThroughEveryReportInIndex(sPath, sBasename, _aParam);
-
- String sStatusRunThrough = (String)_aParam.getTestParameters().get("last_state");
- String sStatusInfo = (String)_aParam.getTestParameters().get("last_info");
-
- if (sStatusRunThrough != null &&
- sStatusInfo != null )
- {
- // store the bad status in the <Name>.odb.ps.ini file
- String sOutputPath = _aParam.getOutputPath();
- String sBasenameIni = FileHelper.appendPath(sOutputPath, sBasename + ".ps.ini");
- IniFile aBasenameIni = new IniFile(sBasenameIni);
- aBasenameIni.insertValue("global", "state", sStatusRunThrough);
- aBasenameIni.insertValue("global", "info", sStatusInfo);
- aBasenameIni.close();
- }
-
- }
- }
- catch (OfficeException e)
- {
- // TODO: unhandled yet.
- GlobalLogWriter.println("Warning: caught OfficeException " + e.getMessage());
- }
- }
- }
- }
-
-
-/**
- * Run through a given index.ini or run through a given directory,
- * find all ini files.
- * Call the IDocument interface function call(...);
- */
- public void foreachResultCreateHTML(ParameterHelper _aParam)
- {
- // TODO: auslagern in eine function, die ein Interface annimmt.
- String sInputPath = _aParam.getInputPath();
- new File(sInputPath);
-
- // call for a single ini file
- if (sInputPath.toLowerCase().endsWith(".ini") )
- {
- callEntry(sInputPath, _aParam);
- }
- else
- {
- // check if there exists an ini file
- String sPath = FileHelper.getPath(sInputPath);
- String sBasename = FileHelper.getBasename(sInputPath);
-
- runThroughEveryReportInIndex(sPath, sBasename, _aParam);
-
- // Create a HTML page which shows locally to all files in .odb
- if (sInputPath.toLowerCase().endsWith(".odb"))
- {
- String sIndexFile = FileHelper.appendPath(sPath, "index.ini");
- File aIndexFile = new File(sIndexFile);
- if (aIndexFile.exists())
- {
- IniFile aIniFile = new IniFile(sIndexFile);
-
- if (aIniFile.hasSection(sBasename))
- {
- // special case for odb files
- int nFileCount = aIniFile.getIntValue(sBasename, "reportcount", 0);
- ArrayList<String> aList = new ArrayList<String>();
- for (int i=0;i<nFileCount;i++)
- {
- String sValue = aIniFile.getValue(sBasename, "report" + i);
-
- String sPSorPDFName = getPSorPDFNameFromIniFile(aIniFile, sValue);
- if (sPSorPDFName.length() > 0)
- {
- aList.add(sPSorPDFName);
- }
- }
- if (aList.size() > 0)
- {
- // HTML output for the odb file, shows only all other documents.
- HTMLResult aOutputter = new HTMLResult(sPath, sBasename + ".ps.html" );
- aOutputter.header("content of DB file: " + sBasename);
- aOutputter.indexSection(sBasename);
-
- for (int i=0;i<aList.size();i++)
- {
- String sPSFile = aList.get(i);
-
- // Read information out of the ini files
- String sIndexFile2 = FileHelper.appendPath(sPath, sPSFile + ".ini");
- IniFile aIniFile2 = new IniFile(sIndexFile2);
- String sStatusRunThrough = aIniFile2.getValue("global", "state");
- String sStatusMessage = "";
- aIniFile2.close();
-
-
- String sHTMLFile = sPSFile + ".html";
- aOutputter.indexLine(sHTMLFile, sPSFile, sStatusRunThrough, sStatusMessage);
- }
- aOutputter.close();
-
- }
- }
- aIniFile.close();
- }
-
- }
- }
- }
-
-
-}
diff --git a/qadevOOo/runner/graphical/FileHelper.java b/qadevOOo/runner/graphical/FileHelper.java
index f496d842c224..88d404204a0a 100644
--- a/qadevOOo/runner/graphical/FileHelper.java
+++ b/qadevOOo/runner/graphical/FileHelper.java
@@ -18,213 +18,10 @@
package graphical;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.StringTokenizer;
import helper.OSHelper;
-import java.io.PrintStream;
-
public class FileHelper
{
- public FileHelper()
- {
- String sOSName = System.getProperty("os.name");
- String sOSArch = System.getProperty("os.arch");
- String sOSVersion = System.getProperty("os.version");
-
- GlobalLogWriter.println(sOSName);
- GlobalLogWriter.println(sOSArch);
- GlobalLogWriter.println(sOSVersion);
-
- }
-
-
-
- public static boolean exists(String _sFile)
- {
- if (_sFile == null)
- {
- return false;
- }
-
- File aFile = new File(_sFile);
- if (aFile.exists())
- {
- return true;
- }
- return false;
- }
-
-
-
- public static String getBasename(String _sFilename)
- {
- if (_sFilename == null)
- {
- return "";
- }
-
- int nIdx = _sFilename.lastIndexOf('\\');
- if (nIdx == -1)
- {
- nIdx = _sFilename.lastIndexOf('/');
- }
- if (nIdx > 0)
- {
- return _sFilename.substring(nIdx + 1);
- }
- return _sFilename;
- }
-
- public static String getNameNoSuffix(String _sFilename)
- {
- if (_sFilename == null)
- {
- return "";
- }
- int nIdx = _sFilename.lastIndexOf('.');
- if (nIdx > 0)
- {
- return _sFilename.substring(0, nIdx);
- }
- return _sFilename;
- }
-
- public static String getSuffix(String _sFilename)
- {
- if (_sFilename == null)
- {
- return "";
- }
- int nIdx = _sFilename.lastIndexOf('.');
- if (nIdx > 0)
- {
- return _sFilename.substring(nIdx );
- }
- return "";
- }
-
- public static String getPath(String _sFilename)
- {
- if (_sFilename == null)
- {
- return "";
- }
-
- int nIdx = _sFilename.lastIndexOf('\\');
- if (nIdx == -1)
- {
- nIdx = _sFilename.lastIndexOf('/');
- }
- if (nIdx > 0)
- {
- return _sFilename.substring(0, nIdx);
- }
- return "";
- }
-
-
- // creates all directories /tmp/a/b
-
- public static void makeDirectories(String first, String path)
- {
- makeDirectories(first, path, "0777");
- }
-
- private static void makeDirectories(String first, String path, String _sMode)
- {
- String fs = System.getProperty("file.separator");
- if (path.startsWith(fs + fs)) // starts with UNC Path
- {
- int n = path.indexOf(fs, 2);
- n = path.indexOf(fs, n + 1);
- first = path.substring(0, n);
- path = path.substring(n + 1);
- }
-
- String already_done = null;
- StringTokenizer path_tokenizer = new StringTokenizer(path,fs,false);
- already_done = first;
- while (path_tokenizer.hasMoreTokens())
- {
- String part = path_tokenizer.nextToken();
- File new_dir = new File(already_done + File.separatorChar + part);
- already_done = new_dir.toString();
- //create the directory
- new_dir.mkdirs();
- if (OSHelper.isUnix() &&
- _sMode.length() > 0)
- {
- try
- {
- chmod(new_dir, _sMode);
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.println("Exception caught. FileHelper.makeDirectories('" + new_dir.getAbsolutePath() + "')");
- }
- }
- }
- // return;
- }
-
- private static void chmod(File file, String mode) throws java.io.IOException
- {
- Runtime.getRuntime().exec
- (new String[]
- {"chmod", mode, file.getAbsolutePath()});
- }
-
- public static String removeFirstDirectorysAndBasenameFrom(String _sName, String _sRemovePath)
- {
- // pre: _sName: /a/b/c/d/e/f.g _sRemovePath /a/b/c
- // result: d/e
- String fs = System.getProperty("file.separator");
-
- String sBasename = FileHelper.getBasename(_sName);
- String sSubDirs = "";
- if (_sName.startsWith(_sRemovePath))
- {
- // if _sName starts with _sRemovePath
- int nRemovePathIndex = _sRemovePath.length();
- if (! _sRemovePath.endsWith(fs))
- {
- // add 1 if we not ends with file separator
- nRemovePathIndex ++;
- }
- int nBasenameIndex = _sName.length() - sBasename.length() - 1;
- if (nRemovePathIndex < nBasenameIndex)
- {
- sSubDirs = _sName.substring(nRemovePathIndex, nBasenameIndex);
- }
- }
- else
- {
- // special case, the _sRemovePath is not part of _sName
- sSubDirs = FileHelper.getPath(_sName);
- if (sSubDirs.startsWith(fs))
- {
- // remove leading file separator
- sSubDirs = sSubDirs.substring(1);
- }
- }
-
- return sSubDirs;
- }
-
- public static void test_removeFirstDirectorysAndBasenameFrom()
- {
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/a/b/c");
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/a/b/c/");
- removeFirstDirectorysAndBasenameFrom("/a/b/c/d/e/f.g", "/b/c");
- }
-
-
public static String getSystemPathFromFileURL( String _sFileURL )
{
String sSystemFile = null;
@@ -253,184 +50,7 @@ public class FileHelper
return sSystemFile;
}
- private static boolean m_bDebugTextShown = false;
- public static boolean isDebugEnabled()
- {
- boolean bDebug = false;
- String sTmpPath = util.utils.getUsersTempDir();
- String fs = System.getProperty("file.separator");
- String sName = sTmpPath + fs + "DOC_COMPARATOR_DEBUG";
- File aFile = new File(sName);
- if (aFile.exists())
- {
- if (!m_bDebugTextShown)
- {
- 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;
- }
- return bDebug;
- }
-
- private static void copyStream(InputStream _aIn, OutputStream _aOut) throws java.io.IOException
- {
- byte[] aBuffer = new byte[0xFFFF];
- for (int len; (len = _aIn.read(aBuffer)) != -1; )
- {
- _aOut.write(aBuffer, 0, len);
- }
- }
-
- public static void copy(String _sSource, String _sDestination)
- {
- FileInputStream aFIS = null;
- FileOutputStream aFOS = null;
-
- try
- {
- aFIS = new FileInputStream(_sSource);
- aFOS = new FileOutputStream(_sDestination);
- copyStream(aFIS, aFOS);
- }
- catch (java.io.IOException e)
- {
- System.out.println("Error: caught Exception: " + e.getMessage());
- }
- finally
- {
- if (aFIS != null)
- {
- try
- {
- aFIS.close();
- }
- catch (java.io.IOException e)
- {
- System.out.println("Error: caught Exception: " + e.getMessage());
- }
- }
- if (aFOS != null)
- {
- try
- {
- aFOS.close();
- }
- catch (java.io.IOException e)
- {
- System.out.println("Error: caught Exception: " + e.getMessage());
- }
- }
- }
-
- }
-
-
- /**
- * Within the directory run through, it's possible to say which file extension types should not
- * consider like '*.prn' because it's not a document.
- *
- * @return a FileFilter function
- */
- public static FileFilter getFileFilter()
- {
- FileFilter aFileFilter = new FileFilter()
- {
- public boolean accept( File pathname )
- {
- // leave out files which started by '~$' these are Microsoft Office temp files
- if (pathname.getName().startsWith("~$"))
- {
- return false;
- }
- // 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;
- }
- if (pathname.getName().endsWith(".ps"))
- {
- return false;
- }
- // This type of document no one would like to load.
- if (pathname.getName().endsWith(".zip"))
- {
- return false;
- }
- // just a hack
- if (pathname.getName().endsWith("_"))
- {
- return false;
- }
- return true;
- }
- };
- return aFileFilter;
- }
- /**
- * Within the directory run through, it's possible to say which file extension types should not
- * consider like '*.prn' because it's not a document.
- *
- * @return a FileFilter function
- */
- public static FileFilter getFileFilterPSorPDF()
- {
- FileFilter aFileFilter = new FileFilter()
- {
- public boolean accept( File pathname )
- {
- if (pathname.getName().endsWith(".ps"))
- {
- return true;
- }
- if (pathname.getName().endsWith(".pdf"))
- {
- return true;
- }
- return false;
- }
- };
- return aFileFilter;
- }
- /**
- * Within the directory run through, it's possible to say which file extension types should not
- * consider like '*.prn' because it's not a document.
- *
- * @return a FileFilter function
- */
- public static FileFilter getFileFilterJPEG()
- {
- FileFilter aFileFilter = new FileFilter()
- {
- public boolean accept( File pathname )
- {
- if (pathname.getName().toLowerCase().endsWith(".jpg"))
- {
- return true;
- }
- if (pathname.getName().toLowerCase().endsWith(".jpeg"))
- {
- return true;
- }
- return false;
- }
- };
- return aFileFilter;
- }
-
-
- public static String appendPath(String _sPath, String _sRelativePathToAdd)
+ public static String appendPath(String _sPath, String _sRelativePathToAdd)
{
String sNewPath = _sPath;
String fs = System.getProperty("file.separator");
@@ -447,126 +67,5 @@ public class FileHelper
}
- public static void createInfoFile(String _sFile, ParameterHelper _aGTA)
- {
- createInfoFile(_sFile, _aGTA, "");
- }
-
- public static void createInfoFile(String _sFile, ParameterHelper _aGTA, String _sSpecial)
- {
- String sFilename;
- if (_sFile.startsWith("file://"))
- {
- sFilename = FileHelper.getSystemPathFromFileURL(_sFile);
- GlobalLogWriter.println("CreateInfoFile: '" + sFilename + "'" );
- }
- else
- {
- sFilename = _sFile;
- }
- String sFileDir = FileHelper.getPath(sFilename);
- String sBasename = FileHelper.getBasename(sFilename);
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
-
- String sIniFile = FileHelper.appendPath(sFileDir, sBasename + ".ini");
- IniFile aIniFile = new IniFile(sIniFile);
-
- // OLD INFO FILE
-
- System.getProperty("line.separator");
- String sInfoFilename = FileHelper.appendPath(sFileDir, sNameNoSuffix + ".info");
- File aInfoFile = new File(sInfoFilename);
-
- String sBuildID = "";
-
- try
- {
- FileOutputStream out2 = new FileOutputStream(aInfoFile.toString());
- PrintStream out = new PrintStream(out2);
-
- out.println("# automatically created file by graphical compare");
- if (_aGTA != null)
- {
- if (_sSpecial != null && _sSpecial.equals("msoffice"))
- {
- out.println("# buildid from wordloadfile");
- sBuildID = _aGTA.getPerformance().getMSOfficeVersion();
- out.println("buildid=" + sBuildID);
- }
- else
- {
- out.println("# buildid is read out of the bootstrap file");
- sBuildID = _aGTA.getBuildID();
- out.println("buildid=" + sBuildID);
- }
- aIniFile.insertValue("global", "buildid", sBuildID);
-
- out.println();
- out.println("# resolution given in DPI");
- out.println("resolution=" + _aGTA.getResolutionInDPI());
- aIniFile.insertValue("global", "resolution", _aGTA.getResolutionInDPI());
- }
- else
- {
- out.println("buildid=" + _sSpecial);
- aIniFile.insertValue("global", "buildid", _sSpecial);
- }
-
- out.println();
- out.println("# Values out of System.getProperty(...)");
- out.println("os.name=" + System.getProperty("os.name"));
- out.println("os.arch=" + System.getProperty("os.arch"));
- out.println("os.version=" + System.getProperty("os.version"));
-
- aIniFile.insertValue("global", "os.name", System.getProperty("os.name"));
- aIniFile.insertValue("global", "os.arch", System.getProperty("os.arch"));
- aIniFile.insertValue("global", "os.version", System.getProperty("os.version"));
-
- if (_aGTA != null)
- {
- out.println();
- out.println("# Performance output, values are given in milli sec.");
- _aGTA.getPerformance().print(out);
- _aGTA.getPerformance().print(aIniFile, "global");
- }
-
- out.flush();
- out.close();
- out2.close();
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.println("can't create Info file.");
- e.printStackTrace();
- }
- aIniFile.close();
-
- }
-
- private static void addBasenameToFile(String _sIndexFilename, String _sBasename, String _sCreator, String _sType, String _sSource)
- {
- String sPath;
- if (_sIndexFilename.startsWith("file:"))
- {
- sPath = FileHelper.getSystemPathFromFileURL(_sIndexFilename);
- }
- else
- {
- sPath = _sIndexFilename;
- }
- String sIndexFilename = sPath; // FileHelper.appendPath(sPath, _sFilename);
- IniFile aIniFile = new IniFile(sIndexFilename);
- aIniFile.insertValue(_sBasename, "creator", _sCreator);
- aIniFile.insertValue(_sBasename, "type", _sType);
- aIniFile.insertValue(_sBasename, "source", _sSource);
- aIniFile.close();
- }
-
- public static void addBasenameToIndex(String _sOutputFilename, String _sBasename, String _sCreator, String _sType, String _sSource)
- {
- String sIndexFilename = FileHelper.appendPath(_sOutputFilename, "index.ini");
- addBasenameToFile(sIndexFilename, _sBasename, _sCreator, _sType, _sSource);
- }
-
}
diff --git a/qadevOOo/runner/graphical/GlobalLogWriter.java b/qadevOOo/runner/graphical/GlobalLogWriter.java
deleted file mode 100644
index 027e8c07d897..000000000000
--- a/qadevOOo/runner/graphical/GlobalLogWriter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import share.LogWriter;
-import stats.SimpleLogWriter;
-
-public class GlobalLogWriter
-{
- private static LogWriter m_aGlobalLogWriter = null;
-
- /**
- * 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);
- }
-
- protected static synchronized LogWriter get()
- {
- if (m_aGlobalLogWriter == null)
- {
- SimpleLogWriter aLog = new SimpleLogWriter();
- m_aGlobalLogWriter = aLog;
- }
- return m_aGlobalLogWriter;
- }
-
- protected static synchronized void set(LogWriter _aLog)
- {
- m_aGlobalLogWriter = _aLog;
- }
-
-}
-
diff --git a/qadevOOo/runner/graphical/GraphicalComparator.java b/qadevOOo/runner/graphical/GraphicalComparator.java
deleted file mode 100644
index 53a2d9aabcb2..000000000000
--- a/qadevOOo/runner/graphical/GraphicalComparator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class GraphicalComparator extends EnhancedComplexTestCase
-{
-
- @Override
- public String[] getTestMethodNames() {
- return new String[]{"check"};
- }
-
- public void check()
- {
- }
-
- public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
-}
diff --git a/qadevOOo/runner/graphical/HTMLResult.java b/qadevOOo/runner/graphical/HTMLResult.java
deleted file mode 100644
index 6d6ecb1b6335..000000000000
--- a/qadevOOo/runner/graphical/HTMLResult.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.io.File;
-import java.io.FileWriter;
-
-public class HTMLResult
-{
- private FileWriter m_aOut;
-
- /**
- * ls is the current line separator (carridge return)
- */
- private String ls;
-
- public HTMLResult( String _sOutputPath, String _sHTMLFilename )
- {
- FileHelper.makeDirectories("", _sOutputPath);
- String sFilename = FileHelper.appendPath(_sOutputPath, _sHTMLFilename);
-
- try
- {
- File outputFile = new File(sFilename);
- m_aOut = new FileWriter(outputFile.toString());
- ls = System.getProperty("line.separator");
- }
- catch (java.io.IOException e)
- {
- e.printStackTrace();
- GlobalLogWriter.println("ERROR: Can't create HTML Outputter");
- }
- }
-
- private void writeln(String _sStr)
- {
- try
- {
- m_aOut.write( _sStr );
- m_aOut.write ( ls );
- }
- catch (java.io.IOException e)
- {
- }
- }
- private void flush()
- {
- try
- {
- m_aOut.flush();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
-
- /**
- * create the HTML header
- */
- public void header(String _sTitle)
- {
- writeln( "<HTML>");
- writeln( "<HEAD>" );
- writeln( "<TITLE>" + _sTitle + "</TITLE>");
- writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />");
- writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />");
- writeln( "</HEAD>");
- writeln( "<BODY bgcolor=white>");
- flush();
- }
-
- private final static String TEST_TABLETITLE = "Document";
- private final static String VISUAL_STATUS_TABLETITLE = "Visual status";
- private final static String VISUAL_STATUS_MESSAGE_TABLETITLE = "Message";
- private final static String FIRSTGFX_TABLETITLE = "Original print file as jpeg";
-
- public void indexSection(String _sOfficeInfo)
- {
- writeln( "<H2>Results for " + _sOfficeInfo + "</H2>");
- writeln( "<P>This result was created at: " + DateHelper.getDateTimeForHumanreadableLog());
- writeln( "<P>Legend:<BR>");
- writeln( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<BR>");
-
- writeln( "<TABLE class=\"infotable\">");
- writeln( "<TR>");
- writeln( tableHeaderCell(TEST_TABLETITLE));
- writeln( tableHeaderCell(""));
- writeln( tableHeaderCell(VISUAL_STATUS_TABLETITLE));
- writeln( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE));
- writeln( "</TR>");
- flush();
- }
-/**
- * Returns the given _sHREF & _sPathInfo as a HTML String
- * <A HREF="_sHREF">_sPathInfo</A>
- * @param _sHREF
- * @param _sPathInfo
- * @return
- */
- private String getHREF(String _sHREF, String _sPathInfo)
- {
- StringBuffer a = new StringBuffer();
- a.append("<A HREF=\"");
- a.append(_sHREF);
- a.append("\">");
- a.append(_sPathInfo);
- a.append("</A>");
- return a.toString();
- }
-
- /**
- * Returns the given _sValue as a HTML Table cell with _sValue as content
- * @param _sValue
- * @return
- */
- private String tableDataCell(String _sValue)
- {
- StringBuffer a = new StringBuffer();
- a.append("<TD>");
- a.append(_sValue);
- a.append("</TD>");
- return a.toString();
- }
-
- /**
- * Returns the given _sValue as a HTML Table header cell with _sValue as content
- * @param _sValue
- * @return
- */
- private String tableHeaderCell(String _sValue)
- {
- StringBuffer a = new StringBuffer();
- a.append("<TH>");
- a.append(_sValue);
- a.append("</TH>");
- return a.toString();
- }
-
- public void indexLine(String _sHTMLFile, String _sHTMLName, String _sStatusRunThrough, String _sStatusMessage)
- {
- writeln( "<TR>");
- writeln(tableDataCell( getHREF(_sHTMLFile, _sHTMLName) ) );
- writeln(tableDataCell( "" ) );
- writeln( tableDataCell(_sStatusRunThrough) );
- writeln( tableDataCell(_sStatusMessage) );
- writeln( "</TR>");
- flush();
- }
-
- public void close()
- {
- writeln( "</TABLE>");
- writeln( "</BODY></HTML>");
- try
- {
- m_aOut.close();
- }
- catch (java.io.IOException e)
- {
- }
- }
-
-
- private String stronghtml(String _sValue)
- {
- StringBuffer a = new StringBuffer();
- a.append("<STRONG>");
- a.append(_sValue);
- a.append("</STRONG>");
- return a.toString();
- }
-
-}
diff --git a/qadevOOo/runner/graphical/IOffice.java b/qadevOOo/runner/graphical/IOffice.java
deleted file mode 100644
index 83094b8aa076..000000000000
--- a/qadevOOo/runner/graphical/IOffice.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public interface IOffice
-{
- /**
- * start an Office, if need
- */
- void start() throws OfficeException;
-
- /**
- * Load a document by it's Name
- */
- void load(String Name) throws OfficeException;
-
- /**
- * Create a postscript file in the DOC_COMPARATOR_OUTPUT_DIR directory from a loaded document
- */
- void storeAsPostscript() throws OfficeException;
-
-
- /**
- * Close the background office
- */
- void close() throws OfficeException;
-}
diff --git a/qadevOOo/runner/graphical/ImageHelper.java b/qadevOOo/runner/graphical/ImageHelper.java
deleted file mode 100644
index f625b3d95cff..000000000000
--- a/qadevOOo/runner/graphical/ImageHelper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.awt.Image;
-import java.awt.image.PixelGrabber;
-import java.awt.image.ImageObserver;
-import java.io.File;
-import java.lang.reflect.Method;
-
-class ImageHelper
-{
- private final Image m_aImage;
- private final int[] m_aPixels;
- private final int m_w;
-
-
- private ImageHelper(Image _aImage)
- {
- m_aImage = _aImage;
-
- // grab all (consume much memory)
- m_w = getWidth();
- int h = getHeight();
- int x = 0;
- int y = 0;
- m_aPixels = new int[m_w * h];
- PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, h, m_aPixels, 0, m_w);
- try
- {
- pg.grabPixels();
- }
- catch (InterruptedException e)
- {
- System.err.println("interrupted waiting for pixels!");
- return;
- }
- if ((pg.getStatus() & ImageObserver.ABORT) != 0)
- {
- System.err.println("image fetch aborted or errored");
- return;
- }
- }
- public int getWidth() {return m_aImage.getWidth(null);}
- public int getHeight() {return m_aImage.getHeight(null);}
- // direct access to a pixel
- public int getPixel(final int x, final int y)
- {
- return m_aPixels[y * m_w + x];
- }
-
- public static ImageHelper createImageHelper(String _sFilename)
- throws java.io.IOException
- {
- Image aImage = null;
- File aFile = new File(_sFilename);
- Exception ex = null;
- try {
- Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO");
- Method readMethod = imageIOClass.getDeclaredMethod("read", new Class[]{java.io.File.class});
- Object retValue = readMethod.invoke(imageIOClass, new Object[]{aFile});
- aImage = (Image)retValue;
- }
- catch(java.lang.ClassNotFoundException e) {
- ex = e;
- }
- catch(java.lang.NoSuchMethodException e) {
- ex = e;
- }
- catch(java.lang.IllegalAccessException e) {
- ex = e;
- }
- catch(java.lang.reflect.InvocationTargetException e) {
- ex = e;
- }
-
- if (ex != null) {
- // get Java version:
- String javaVersion = System.getProperty("java.version");
- throw new java.io.IOException(
- "Cannot construct object with current Java version " +
- javaVersion + ": " + ex.getMessage());
- }
- return new ImageHelper(aImage);
- }
-}
diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java
deleted file mode 100644
index cc82ce4c86db..000000000000
--- a/qadevOOo/runner/graphical/IniFile.java
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package graphical;
-
-import java.io.File;
-import java.io.RandomAccessFile;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-
-/**
- Helper class to give a simple API to read/write windows like ini files
-*/
-/* public */ // is only need, if we need this class outside package convwatch
-public class IniFile implements Enumeration<String>
-{
-
- /**
- * internal representation of the ini file content.
- * Problem, if ini file changed why other write something difference, we don't realise this.
- */
- private final String m_sFilename;
- private final ArrayList<String> m_aList;
- private boolean m_bListContainUnsavedChanges = false;
- private int m_aEnumerationPos = 0;
-
- /**
- open a ini file by its name
- @param _sFilename string a filename, if the file doesn't exist, a new empty ini file will create.
- write back to disk only if there are really changes.
- */
- public IniFile(String _sFilename)
- {
- m_sFilename = _sFilename;
- m_aList = loadLines();
- m_aEnumerationPos = findNextSection(0);
- }
-
- public void insertFirstComment(String[] _aList)
- {
- if (m_aList.isEmpty())
- {
- // can only insert if there is nothing else already in the ini file
- m_aList.addAll(Arrays.asList(_aList));
- }
- }
-
- private ArrayList<String> loadLines()
- {
- File aFile = new File(m_sFilename);
- ArrayList<String> aLines = new ArrayList<String>();
- if (!aFile.exists())
- {
- return aLines;
- }
- RandomAccessFile aReader = null;
- try
- {
- aReader = new RandomAccessFile(aFile, "r");
- String aLine = "";
- while (aLine != null)
- {
- aLine = aReader.readLine();
- if (aLine != null && aLine.length() > 0)
- {
- aLines.add(aLine);
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.println("couldn't open file " + m_sFilename);
- GlobalLogWriter.println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.println("Exception occurs while reading from file " + m_sFilename);
- GlobalLogWriter.println("Message: " + ie.getMessage());
- }
- try
- {
- aReader.close();
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.println("Couldn't close file " + m_sFilename);
- GlobalLogWriter.println("Message: " + ie.getMessage());
- }
- return aLines;
- }
-
- /**
- * @return true, if the ini file contain some readable data
- */
- public boolean is()
- {
- return m_aList.size() > 1;
- }
-
- /**
- * Check if a given Section and Key exists in the ini file
- * @return true if the given Section, Key exists, now you can get the value
- */
- public boolean hasValue(String _sSectionName, String _sKey)
- {
- return findKey(_sSectionName, _sKey) > 0;
- }
-
-
- private boolean isRemark(String _sLine)
- {
- return _sLine.length() < 2 ||
- _sLine.startsWith("#") ||
- _sLine.startsWith(";");
- }
-
- private String getItem(int i)
- {
- return m_aList.get(i);
- }
-
- private String buildSectionName(String _sSectionName)
- {
- String sFindSection = "[" + _sSectionName + "]";
- return sFindSection;
- }
-
- private String sectionToString(String _sSectionName)
- {
- String sKeyName = _sSectionName;
- if (sKeyName.startsWith("[") &&
- sKeyName.endsWith("]"))
- {
- sKeyName = sKeyName.substring(1, sKeyName.length() - 1);
- }
- return sKeyName;
- }
-
- private String toLowerIfNeed(String _sName)
- {
- return _sName.toLowerCase();
- }
-
- // return the number where this section starts
- private int findSection(String _sSection)
- {
- String sFindSection = toLowerIfNeed(buildSectionName(_sSection));
- // ----------- find _sSection ---------------
- int i;
- for (i = 0; i < m_aList.size(); i++)
- {
- String sLine = toLowerIfNeed(getItem(i).trim());
- if (isRemark(sLine))
- {
- continue;
- }
- if (sFindSection.equals("[]"))
- {
- // special case, empty Section.
- return i - 1;
- }
- if (sLine.startsWith(sFindSection))
- {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Checks if a given section exists in the ini file
- * @return true if the given _sSection was found
- */
- public boolean hasSection(String _sSection)
- {
- return findSection(_sSection) != -1;
- }
-
- // return the line number, where the key is found.
- private int findKey(String _sSection, String _sKey)
- {
- int i = findSection(_sSection);
- if (i == -1)
- {
- // Section not found, therefore the value can't exist
- return -1;
- }
- return findKeyFromKnownSection(i, _sKey);
- }
-
- // i must be the index in the list, where the well known section starts
- private int findKeyFromKnownSection(int _nSectionIndex, String _sKey)
- {
- _sKey = toLowerIfNeed(_sKey);
- for (int j = _nSectionIndex + 1; j < m_aList.size(); j++)
- {
- String sLine = getItem(j).trim();
-
- if (isRemark(sLine))
- {
- continue;
- }
- if (sLine.startsWith("[") )
- {
- // TODO: due to the fact we would like to insert an empty line before new sections
- // TODO: we should check if we are in an empty line and if, go back one line.
-
- // found end.
- break;
- }
-
- int nEqual = sLine.indexOf('=');
- if (nEqual >= 0)
- {
- String sKey = toLowerIfNeed(sLine.substring(0, nEqual).trim());
- if (sKey.equals(_sKey))
- {
- return j;
- }
- }
- }
- return -1;
- }
-
- // i must be the index in the list, where the well known section starts
- private int findLastKnownKeyIndex(int _nSectionIndex, String _sKey)
- {
- _sKey = toLowerIfNeed(_sKey);
- int i = _nSectionIndex + 1;
- for (int j = i; j < m_aList.size(); j++)
- {
- String sLine = getItem(j).trim();
-
- if (isRemark(sLine))
- {
- continue;
- }
-
- if (sLine.startsWith("["))
- {
- // found end.
- return j;
- }
-
- int nEqual = sLine.indexOf('=');
- if (nEqual >= 0)
- {
- String sKey = toLowerIfNeed(sLine.substring(0, nEqual).trim());
- if (sKey.equals(_sKey))
- {
- return j;
- }
- }
- }
- return i;
- }
-
- private String getValue(int _nIndex)
- {
- String sLine = getItem(_nIndex).trim();
- if (isRemark(sLine))
- {
- return "";
- }
- int nEqual = sLine.indexOf('=');
- if (nEqual >= 0)
- {
- String sValue = sLine.substring(nEqual + 1).trim();
- return sValue;
- }
- return "";
- }
-
- /**
- @param _sSection string
- @param _sKey string
- @return the value found in the inifile which is given by the section and key parameter
- */
- public String getValue(String _sSection, String _sKey)
- {
- String sValue = "";
- int nCurrentPosition = findKey(_sSection, _sKey);
- if (nCurrentPosition == -1)
- {
- // Section not found, therefore the value can't exist
- return "";
- }
-
- // m_sOldKey = _sKey;
- sValue = getValue(nCurrentPosition);
-
- return sValue;
- }
-
- /**
- * Returns the value at Section, Key converted to an integer
- * Check with hasValue(Section, Key) to check before you get into trouble.
- * @param _nDefault if there is a problem, key not found... this value will return
- */
- public int getIntValue(String _sSection, String _sKey, int _nDefault)
- {
- String sValue = getValue(_sSection, _sKey);
- int nValue = _nDefault;
- if (sValue.length() > 0)
- {
- try
- {
- nValue = Integer.parseInt(sValue);
- }
- catch (java.lang.NumberFormatException e)
- {
- GlobalLogWriter.println("IniFile.getIntValue(): Caught a number format exception, return the default value.");
- }
- }
- return nValue;
- }
-
- public void close()
- {
- store();
- }
-
- /**
- write back the ini file to the disk, only if there exist changes
- * @deprecated use close() instead!
- */
-
- // TODO: make private
- private void store()
- {
- if (!m_bListContainUnsavedChanges)
- {
- // nothing has changed, so no need to store
- return;
- }
-
- File aFile = new File(m_sFilename);
- if (aFile.exists())
- {
- // TODO: little bit unsafe here, first rename, after write is complete, delete the old.
- aFile.delete();
- if (aFile.exists())
- {
- GlobalLogWriter.println("Couldn't delete the file " + m_sFilename);
- return;
- }
- }
- try
- {
- RandomAccessFile aWriter = new RandomAccessFile(aFile, "rw");
- for (int i = 0; i < m_aList.size(); i++)
- {
- String sLine = getItem(i);
- if (sLine.startsWith("["))
- {
- // write an extra empty line before next section.
- aWriter.writeByte('\n');
- }
- aWriter.writeBytes(sLine);
- aWriter.writeByte('\n');
- }
- aWriter.close();
- }
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.println("couldn't open file for writing " + m_sFilename);
- GlobalLogWriter.println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.println("Exception occurs while writing to file " + m_sFilename);
- GlobalLogWriter.println("Message: " + ie.getMessage());
- }
- }
-
- public void insertValue(String _sSection, String _sKey, int _nValue)
- {
- insertValue(_sSection, _sKey, String.valueOf(_nValue));
- }
-
-
-
- /**
- insert a value
- there are 3 cases
- 1. section doesn't exist, goto end and insert a new section, insert a new key value pair
- 2. section exist but key not, search section, search key, if key is -1 get last known key position and insert new key value pair there
- 3. section exist and key exist, remove the old key and insert the key value pair at the same position
- */
- public void insertValue(String _sSection, String _sKey, String _sValue)
- {
- int i = findSection(_sSection);
- if (i == -1)
- {
- // case 1: section doesn't exist
- String sFindSection = buildSectionName(_sSection);
-
- // TODO: before create a new Section, insert a empty line
- m_aList.add(sFindSection);
- if (_sKey.length() > 0)
- {
- String sKeyValuePair = _sKey + "=" + _sValue;
- m_aList.add(sKeyValuePair);
- }
- m_bListContainUnsavedChanges = true;
- return;
- }
- int j = findKeyFromKnownSection(i, _sKey);
- if (j == -1)
- {
- // case 2: section exist, but not the key
- j = findLastKnownKeyIndex(i, _sKey);
- if (_sKey.length() > 0)
- {
- String sKeyValuePair = _sKey + "=" + _sValue;
- m_aList.add(j, sKeyValuePair);
- m_bListContainUnsavedChanges = true;
- }
- return;
- }
- else
- {
- // case 3: section exist, and also the key
- String sKeyValuePair = _sKey + "=" + _sValue;
- m_aList.set(j, sKeyValuePair);
- m_bListContainUnsavedChanges = true;
- }
- }
-
- public void removeSection(String _sSectionToRemove)
- {
- // first, search for the name
- int i = findSection(_sSectionToRemove);
- if (i == -1)
- {
- // Section to remove not found, do nothing.
- return;
- }
- // second, find the next section
- int j = findNextSection(i + 1);
- if (j == -1)
- {
- // if we are at the end, use size() as second section
- j = m_aList.size();
- }
- // remove all between first and second section
- for (int k = i; k < j; k++)
- {
- m_aList.remove(i);
- }
- // mark the list as changed
- m_bListContainUnsavedChanges = true;
- }
-
- /**
- * some tests for this class
- */
-
-
- /**
- * Enumeration Interface
- * @return true, if there are more Key values
- */
- public boolean hasMoreElements()
- {
- return m_aEnumerationPos >= 0 && m_aEnumerationPos < m_aList.size();
- }
-
- /**
- * Find the next line, which starts with '['
- * @param i start position
- * @return the line where '[' found or -1
- */
- private int findNextSection(int i)
- {
- if (i >= 0)
- {
- while (i < m_aList.size())
- {
- String sLine = m_aList.get(i);
- if (sLine.startsWith("["))
- {
- return i;
- }
- i++;
- }
- }
- return -1;
- }
-
- /**
- * Enumeration Interface
- * @return a key without the enveloped '[' ']'
- */
- public String nextElement()
- {
- int nLineWithSection = findNextSection(m_aEnumerationPos);
- if (nLineWithSection != -1)
- {
- String sSection = m_aList.get(nLineWithSection);
- m_aEnumerationPos = findNextSection(nLineWithSection + 1);
- sSection = sectionToString(sSection);
- return sSection;
- }
- else
- {
- m_aEnumerationPos = m_aList.size();
- }
- return null;
- }
-
- /**
- * Helper to count the occurrence of Sections
- * @return returns the count of '^['.*']$' Elements
- */
- public int getElementCount()
- {
- int nCount = 0;
- int nPosition = 0;
- while ((nPosition = findNextSection(nPosition)) != -1)
- {
- nCount++;
- nPosition++;
- }
- return nCount;
- }
-}
-
diff --git a/qadevOOo/runner/graphical/JPEGComparator.java b/qadevOOo/runner/graphical/JPEGComparator.java
deleted file mode 100644
index 4d07a03d3428..000000000000
--- a/qadevOOo/runner/graphical/JPEGComparator.java
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import helper.OSHelper;
-import helper.ProcessHandler;
-import java.io.File;
-
-/**
- * Helper class to interpret a jpg filename
- */
-class NameDPIPage
-{
-
- String Name;
- int DPI;
- int Page;
-
- private NameDPIPage(String _sName, int _nDPI, int _nPage)
- {
- Name = _sName;
- DPI = _nDPI;
- Page = _nPage;
- }
-
- public static NameDPIPage interpret(String _sFilename)
- {
- String sBasename = FileHelper.getBasename(_sFilename); // if exist a path, remove it
- String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename); // remove extension (.jpg)
-
- // check if there exist a 'DPI_' at specific position
- String sDPICheck = sNameNoSuffix.substring(sNameNoSuffix.length() - 8, sNameNoSuffix.length() - 4);
- String sName;
- int nDPI = -1;
- int nPage = -1;
- if (sDPICheck.equals("DPI_"))
- {
- // seems to be a generated filename by us.
- int nDPIStart = sNameNoSuffix.lastIndexOf('_', sNameNoSuffix.length() - 8);
- sName = sNameNoSuffix.substring(0, nDPIStart);
- if (nDPIStart > 0)
- {
- String sDPI = sNameNoSuffix.substring(nDPIStart + 1, sNameNoSuffix.length() - 8);
- try
- {
- nDPI = Integer.parseInt(sDPI);
- }
- catch (java.lang.NumberFormatException e)
- {
- GlobalLogWriter.println("DPI: Number format exception");
- }
- String sPage = sNameNoSuffix.substring(sNameNoSuffix.length() - 4);
- try
- {
- nPage = Integer.parseInt(sPage);
- }
- catch (java.lang.NumberFormatException e)
- {
- GlobalLogWriter.println("Page: Number format exception");
- }
- }
- }
- else
- {
- sName = sNameNoSuffix;
- }
-
- return new NameDPIPage(sName, nDPI, nPage);
- }
-}
-
-class CountNotXXXPixelsFromImage extends Thread
-{
-
- private final 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);
- }
-
- @Override
- 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);
- }
-
- @Override
- public void run()
- {
- try
- {
- final int nNotBlackCount = PixelCounter.countNotBlackPixelsFromImage(getFilename());
- setValue(nNotBlackCount);
- }
- catch (java.io.IOException e)
- {
- m_nValue = -1;
- }
- }
-}
-
-public class JPEGComparator extends EnhancedComplexTestCase
-{
-
- @Override
- public String[] getTestMethodNames()
- {
- return new String[]{"CompareJPEGvsJPEG"};
- }
- private Tolerance m_aTolerance;
-
- /**
- * test function.
- */
- public void CompareJPEGvsJPEG()
- {
- GlobalLogWriter.set(log);
- ParameterHelper aParam = new ParameterHelper(param);
-
- // run through all documents found in Inputpath
- foreachJPEGcompareWithJPEG(aParam);
- }
-
- public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException
- {
- String sPath = FileHelper.getPath(_sDocumentName);
- String sSectionName = FileHelper.getBasename(_sDocumentName);
-
- // take the build id out of the ini file in the reference file and put it into the current parameter helper
- String sIniFileForRefBuildID = FileHelper.appendPath(sPath, sSectionName + ".ini");
- IniFile aIniFileForRefBuildID = new IniFile(sIniFileForRefBuildID);
- String sRefBuildID = aIniFileForRefBuildID.getValue("global", "buildid");
- aIniFileForRefBuildID.close();
-
- _aParams.getTestParameters().put("RefBuildId", sRefBuildID);
-
- String sIniFile = FileHelper.appendPath(sPath, "index.ini");
- IniFile aIniFile = new IniFile(sIniFile);
- if (aIniFile.hasValue(sSectionName, "pages"))
- {
- // only which has 'pages' has also pictures
- int nPages = aIniFile.getIntValue(sSectionName, "pages", 0);
- String sJPEGSchema = aIniFile.getValue(sSectionName, "jpegschema");
- 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 sJPEGPath = FileHelper.getPath(sJPEGFilename);
- if (!sPath.equals(sJPEGPath))
- {
- GlobalLogWriter.println("Path where to find the index and where to file the JPEG pictures are not the same.");
- }
- File aFile = new File(sJPEGFilename);
- assure("File '" + sJPEGFilename + "' doesn't exists.", aFile.exists(), true);
- if (aFile.exists())
- {
- GlobalLogWriter.println("Page: " + i);
- checkOnePicture(sJPEGFilename, _sResult, _aParams);
- }
- }
- }
- else
- {
- GlobalLogWriter.println("The document '" + sSectionName + "' seems to have no picture representation.");
- }
-
- String sResultIniFile = FileHelper.appendPath(_sResult, sSectionName);
- evaluateResult(sResultIniFile, _aParams);
- }
-
- private void evaluateResult(String _sDocument, ParameterHelper _aParams)
- {
- String sResultIniFile = _sDocument + ".ini";
- File aFile = new File(sResultIniFile);
- assure("Result file doesn't exists " + sResultIniFile, aFile.exists());
-
- int good = 0;
- int bad = 0;
- int ugly = 0;
- int ok_status = 1; // 1=ok 2=bad 3=ugly
-
- IniFile aResultIniFile = new IniFile(sResultIniFile);
- int nPages = aResultIniFile.getIntValue("global", "pages", 0);
- for (int i = 0; i < nPages; i++)
- {
- String sCurrentPage = "page" + (i + 1);
- int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1);
- if (nPercent == 0)
- {
- good++;
- }
- else if (nPercent <= 5)
- {
- bad++;
- ok_status = 2;
- }
- else
- {
- ugly++;
- ok_status = 3;
- }
- }
-
- assure("Error: document doesn't contains pages", nPages > 0);
-
-// TODO: this information has to come out of the ini files
- String sStatusRunThrough = "PASSED, ";
- String sPassed = "OK";
-
- String sStatusMessage = "From " + nPages + " page(s) are: ";
- String sGood = "";
- String sBad = "";
- String sUgly = "";
-
- if (good > 0)
- {
- sGood = " good:=" + good;
- sStatusMessage += sGood;
- }
- if (bad > 0)
- {
- sBad = " bad:=" + bad;
- sStatusMessage += sBad;
- }
- if (ugly > 0)
- {
- sUgly = " ugly:=" + ugly;
- sStatusMessage += sUgly;
- }
-
- // Failure matrix
- // 0 1
- // ugly OK FAILED
- // bad OK
- // good OK
-
- if (ugly > 0)
- {
- sPassed = "FAILED";
- }
- else
- {
- if (bad > 0)
- {
- sPassed = "NEED A LOOK";
- }
- else
- {
- sPassed = "OK";
- }
- }
- sStatusRunThrough += sPassed;
- aResultIniFile.insertValue("global", "state", sStatusRunThrough);
- aResultIniFile.insertValue("global", "info", sStatusMessage);
- aResultIniFile.close();
-
- _aParams.getTestParameters().put("current_state", sStatusRunThrough);
- _aParams.getTestParameters().put("current_info", sStatusMessage);
- _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);
- }
-
- 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
- {
- String sResultFilenamePDF = sResultFilename.replace(".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.
- * @param _sDocumentName
- * @param _sResult
- * @param _aParams
- */
- private void compareJPEG(String _sDocumentName, String _sResult, ParameterHelper _aParams)
- {
- NameDPIPage aNameDPIPage = NameDPIPage.interpret(_sDocumentName);
-
- String sSourceBasename = FileHelper.getBasename(_sDocumentName);
- String sSourcePath = FileHelper.getPath(_sDocumentName);
- String sDestinationBasename = FileHelper.getBasename(_sResult);
- String sDestinationPath = FileHelper.getPath(_sResult);
-
- 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
- String sNewSourceBasename = "Original_" + sSourceBasename;
- String sSource = _sDocumentName;
- String sDestination = FileHelper.appendPath(sDestinationPath, sNewSourceBasename);
- FileHelper.copy(sSource, sDestination);
- sSourceBasename = sNewSourceBasename;
-
- JPEGCreator.convertToNearSameFileWithWidth340(sDestination);
- }
- String sDifferenceBasename = "Difference_between_" + FileHelper.getNameNoSuffix(sSourceBasename) + "_and_" + FileHelper.getNameNoSuffix(sDestinationBasename) + ".jpg";
-
- String sSource = FileHelper.appendPath(sDestinationPath, sSourceBasename);
- String sDestination = FileHelper.appendPath(sDestinationPath, sDestinationBasename);
- String sDifference = FileHelper.appendPath(sDestinationPath, sDifferenceBasename);
- int nErr = compareJPEG(sSource, sDestination, sDifference);
- if (nErr == 0 && FileHelper.exists(sDifference))
- {
- // check the difference, returns the count of different colors
- // this means, 1=only one color, no differences found.
- int nResult = identify(sDifference);
- int nPercentColorDiffer = 0;
-
- 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);
- }
- catch (java.io.IOException e)
- {
- GlobalLogWriter.println("Can't estimate the different colors. " + e.getMessage());
- }
- }
-
- // store the result in a result.ini file
- String sResultFile = FileHelper.appendPath(sDestinationPath, aNameDPIPage.Name + ".ini");
- int nPage = aNameDPIPage.Page;
- if (nPage < 0)
- {
- nPage = 0;
- }
- IniFile aResultIni = new IniFile(sResultFile);
-
- 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
- int nMaxPage = Math.max(nPage, aResultIni.getIntValue("global", "pages", 0));
- aResultIni.insertValue("global", "pages", nMaxPage);
-
- String sRefBuildId = (String) _aParams.getTestParameters().get("RefBuildId");
- if (sRefBuildId == null)
- {
- sRefBuildId = "";
- }
- aResultIni.insertValue("global", "refbuildid", sRefBuildId);
-
- aResultIni.insertValue("global", "diffdiff", "no");
- aResultIni.insertValue("global", "basename", aNameDPIPage.Name);
- aResultIni.insertValue("global", "dpi", aNameDPIPage.DPI);
-
- // write down flags for each page
- String sSection = "page" + nPage;
-
- 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");
- aResultIni.insertValue(sSection, "result", sResult);
-
- aResultIni.close();
- }
- }
-
- /**
- * count how much pixel differ and between Old or New and the Difference graphics
- *
- * First, count the old graphics, then the new graphics due to the fact both should be equal
- * it should be legal to take result from old or new. We take the graphics with less values.
- *
- * Second, count the difference graphics, now take the percent algorithm and
- * build a percent value, which contain the number of different pixels as a percent value
- *
- * Interpretation:
- * 0% there is no difference
- *
- * &lt;100% Take a look into the difference graphics, maybe the difference graphics shows
- * text like outlined or the text is little bit move left, right up or down.
- *
- * &gt;>100% Yes it's possible that there is a difference more than 100%, maybe a font problem
- * between old and new graphics. The font of the new graphics is little bit bigger,
- * so the pixel count between old graphics and new graphics is twice the more.
- *
- * @param _sOldGfx path & name to the jpeg file (1)
- * @param _sNewGfx path & name to the other jpeg file (2)
- * @param _sDiffGfx path & name to the new difference file which shows the difference between (1) and (2)
- * @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
- {
- 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);
-
- a.stop();
- GlobalLogWriter.println("Thread Time is: " + a.getTime());
-
- int nMinNotWhiteCount = Math.min(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
-
- // check if not zero
- if (nMinNotWhiteCount == 0)
- {
- nMinNotWhiteCount = Math.max(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
- if (nMinNotWhiteCount == 0)
- {
- nMinNotWhiteCount = 1;
- }
- }
-
- int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
- GlobalLogWriter.println("Graphics check, pixel based:" + nPercent + "% pixel differ ");
- return nPercent;
- }
-
- private static int compareJPEG(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
- {
- String sComposite = "composite";
- if (OSHelper.isWindows())
- {
- sComposite = "composite.exe";
- String sIMPath = (String) param.get("imagemagick.path");
- if (sIMPath != null)
- {
- sComposite = FileHelper.appendPath(sIMPath, sComposite);
- }
- }
-
- String[] sCommandArray =
- {
- sComposite,
- "-compose",
- "difference",
- _sOldGfx,
- _sNewGfx,
- _sDiffGfx
- };
-
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- 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())
- {
- JPEGCreator.convertToNearSameFileWithWidth340(_sDiffGfx);
- }
- }
- return nExitCode;
- }
-
- /**
- * wrapper for ImageMagick identify,
- * function checks how many different colors a picture contains.
- * 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";
-
- String sIdentify = "identify";
- if (OSHelper.isWindows())
- {
- sIdentify = "identify.exe";
- String sIMPath = (String) param.get("imagemagick.path");
- if (sIMPath != null)
- {
- sIdentify = FileHelper.appendPath(sIMPath, sIdentify);
- }
- }
-
- String[] sCommandArray =
- {
- sIdentify,
- "-format",
- sIM_Format,
- _sDiffGfx
- };
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- aHandler.executeSynchronously();
- 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)
- {
- sBack = sBack.substring(0, nIdx);
- }
-
- nResult = Integer.parseInt(sBack);
- }
- catch (java.lang.NumberFormatException e)
- {
- GlobalLogWriter.println("identify(): Number format exception");
- nResult = 0;
- }
- return nResult;
- }
-}
diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java
deleted file mode 100644
index b9570e9fe0a5..000000000000
--- a/qadevOOo/runner/graphical/JPEGCreator.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import helper.OSHelper;
-import helper.ProcessHandler;
-import helper.StringHelper;
-import java.io.File;
-
-public class JPEGCreator extends EnhancedComplexTestCase
-{
- @Override
- public String[] getTestMethodNames()
- {
- return new String[]{"PostscriptOrPDFToJPEG"};
- }
-
-
-
-
- public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException
- {
- GlobalLogWriter.println(" Document: " + _sDocumentName);
- GlobalLogWriter.println(" results: " + _sResult);
- String sJPEGNameSchema = createJPEG(_sDocumentName, "", _aParams);
-
- // store information only if jpeg files exists
- int nPages = countPages(sJPEGNameSchema);
- if (nPages > 0)
- {
- 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);
- 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);
- }
- }
-
-/**
- * Create a lot of smaller and nicer Pictures of the big fat pages.
- * Looks better
- */
- private void createSmallPictures(String _sJPEGSchema)
- {
- ParameterHelper aParam = new ParameterHelper(param);
- if (! aParam.createSmallPictures())
- {
- return;
- }
-
- if (_sJPEGSchema.length() > 0)
- {
- // TODO: if there doesn't exists a '%04d' in the schema we will return 9999 which is a little bit wrong here.
- for (int i=1;i<10000;i++)
- {
- String sJPEGFilename = getFilenameForJPEGSchema(_sJPEGSchema, i);
- if (FileHelper.exists(sJPEGFilename))
- {
- convertToNearSameFileWithWidth340(sJPEGFilename);
- }
- else
- {
- break; // stop file check
- }
- }
- }
- // return nPages;
- }
-
-/**
- * convert a picture to a new picture with 340 pixel width.
- */
-public static void convertToNearSameFileWithWidth340(String _sJPEGFilename)
-{
- ParameterHelper aParam = new ParameterHelper(param);
- if (! aParam.createSmallPictures())
- {
- return;
- }
- String sJPEGFilename = _sJPEGFilename.replaceAll("\\\\", "/");
- String sNewJPEGFilename;
- sNewJPEGFilename = sJPEGFilename.replace(".jpg", "_w340.jpg");
- convertToWidth340(sJPEGFilename, sNewJPEGFilename);
-}
-
- /**
- * convert chart2_Regression.ods.ps_180DPI_0001.jpg -filter Catrom -resize
-340x chart2_Regression.ods.ps_180DPI_0001_w340.jpg
-
-Point wie bisher
-Cubic schlecht, weil unscharf
-...
-Triangle ganz brauchbar (default?)
-Catrom am besten
-
- * @param _sFrom
- * @param _To
- */
-private static void convertToWidth340(String _sFrom, String _To)
-{
- String sConvertEXE = "convert";
- if (OSHelper.isLinuxIntel())
- {
- sConvertEXE = "convert";
- }
- if (OSHelper.isWindows())
- {
- // TODO!
- // HACK Hard coded!
- // 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 =
- {
- sConvertEXE,
- _sFrom,
- "-filter", "Catrom",
- "-resize", "340x",
- _To
- };
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- aHandler.executeSynchronously();
- aHandler.getExitCode();
-
- String sBack = aHandler.getOutputText();
- if (sBack.length() > 0)
- {
- GlobalLogWriter.println("'" + sBack + "'");
- }
-}
-
-/**
- * create out of a given Postscript/PDF _sFile a list of JPEGs, one for every page
- * @param _sFile
- * @param _sAdditional
- * @param _aParam
- * @return the schema of the first jpeg name
- */
- private String createJPEG(String _sFile, String _sAdditional, ParameterHelper _aParam)
- {
- if (_sFile.startsWith("file:///"))
- {
- _sFile = FileHelper.getSystemPathFromFileURL(_sFile);
- }
- File aFile = new File(_sFile);
- if (aFile.exists())
- {
- String sAbsFile = aFile.getAbsolutePath();
- if (!sAbsFile.equals(_sFile))
- {
- _sFile = sAbsFile;
- }
- }
- else
- {
- GlobalLogWriter.println("File: '" + _sFile + "' doesn't exist.");
- return "";
- }
- String sFileDir = FileHelper.getPath(_sFile);
- String sBasename = FileHelper.getBasename(_sFile);
-
- String sTmpDir = util.utils.getUsersTempDir();
- if (_aParam.getOutputPath() != null)
- {
- sTmpDir = _aParam.getOutputPath();
- }
-
- String sJPEGNameSchema = "";
- if (_sFile.toLowerCase().endsWith("ps") ||
- _sFile.toLowerCase().endsWith("prn") ||
- _sFile.toLowerCase().endsWith("pdf"))
- {
- // seems to be a Postscript of PDF file
-
- sJPEGNameSchema = createJPEGsFromPostscript(sTmpDir, sFileDir, sBasename, _aParam.getResolutionInDPI());
- }
- else if (_sFile.toLowerCase().endsWith("jpg") ||
- _sFile.toLowerCase().endsWith("jpeg"))
- {
- // do nothing, it's already a picture.
- return _sFile;
- }
- else
- {
- // we assume it's an office document.
- // Office files will not handled here, we need a PS or PDF file
- }
- return sJPEGNameSchema;
- }
-
- private String getJPEGName(String _sOutputPath, String _sBasename, int _nResolutionInDPI, String _sGS_PageOutput)
- {
- String sName = _sBasename + "_" + _nResolutionInDPI + "DPI_" + _sGS_PageOutput + ".jpg";
- String sJPEGName = FileHelper.appendPath(_sOutputPath, sName);
- return sJPEGName;
- }
-
- /**
- * Create via ghostscript (gs) from the reference file for every page a JPEG file
- *
- * MUST set:
- * m_sOutputPath, m_sReferenceFile, m_sReferencePath
- *
- * return exit code from gs command
- */
-
- private static final String m_sGS_PageOutput = "%04d";
-
- private String createJPEGsFromPostscript(String _sOutputPath, String _sSourcePath, String _sSourceFile, int _nResolutionInDPI)
- {
- FileHelper.makeDirectories("", _sOutputPath);
-
- String sJPEGNameSchema = getJPEGName(_sOutputPath, _sSourceFile, _nResolutionInDPI, m_sGS_PageOutput);
- String sPostscriptOrPDFFile = FileHelper.appendPath(_sSourcePath, _sSourceFile);
- String sGhostscriptEXE = "gs";
- 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[] sCommandArray =
- {
- sGhostscriptEXE,
- "-dNOPROMPT",
- "-dBATCH",
- "-sDEVICE=jpeg",
- "-r" + _nResolutionInDPI,
- "-dNOPAUSE",
- "-sOutputFile=" + sJPEGNameSchema,
- sPostscriptOrPDFFile
-
-
-
- };
-
-// TODO: gives ghostscript an error we can handle?
- ProcessHandler aHandler = new ProcessHandler(sCommandArray);
- boolean bBackValue = aHandler.executeSynchronously();
- assure("There seems to be a problem with ghostscript", bBackValue, true);
- int nExitCode = aHandler.getExitCode();
-
- if (nExitCode == 0)
- {
- // TODO: return a real filename, due to the fact we don't know how much files are created, maybe better to return a list
- int nPages = countPages(sJPEGNameSchema);
- if (nPages == 0)
- {
- // return only a valid schema name if there at least one page.
- sJPEGNameSchema = "";
- assure("Document '" + sPostscriptOrPDFFile + "' doesn't create pages.", false, true);
- }
- }
- else
- {
- assure("There seems to be a problem with ghostscript and '" + sPostscriptOrPDFFile + "' exit code: " + nExitCode, false, true);
- GlobalLogWriter.println("Warning: There seems to be a problem with '" + sGhostscriptEXE + "'...");
- }
-
- return sJPEGNameSchema; // sNewJPEGFilename;
- }
-
- public static String getFilenameForJPEGSchema(String _sJPEGSchema, int _nPage)
- {
- if (_nPage < 1 || _nPage > 9999)
- {
- return "";
- }
- final String sFilename = _sJPEGSchema.replace(m_sGS_PageOutput, StringHelper.createValueString(_nPage, 4));
- return sFilename;
- }
-
- /**
- * Return the number of really exists JPEG files
- * Give a JPEG Schema which contains something like '%04d' which will be converted by a number between 0001 and 9999 always
- * with leading '0' (zero)
- * @return number of really existing pages of a given JPEG schema
- */
- private int countPages(String _sJPEGSchema)
- {
- int nPages = 0;
- if (_sJPEGSchema.length() > 0)
- {
- // TODO: if there doesn't exists a '%04d' in the schema we will return 9999 which is a little bit wrong here.
- for (int i=1;i<10000;i++)
- {
- String sNewJPEGFilename = getFilenameForJPEGSchema(_sJPEGSchema, i);
- if (FileHelper.exists(sNewJPEGFilename))
- {
- nPages ++;
- }
- else
- {
- break; // stop file check
- }
- }
- }
- return nPages;
- }
-}
diff --git a/qadevOOo/runner/graphical/JPEGEvaluator.java b/qadevOOo/runner/graphical/JPEGEvaluator.java
deleted file mode 100644
index cddbde844e91..000000000000
--- a/qadevOOo/runner/graphical/JPEGEvaluator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class JPEGEvaluator extends EnhancedComplexTestCase
-{
- @Override
- public String[] getTestMethodNames()
- {
- return new String[]{"EvaluateResult"};
- }
-
- /**
- * test function.
- */
- public void EvaluateResult()
- {
- GlobalLogWriter.set(log);
- ParameterHelper aParam = new ParameterHelper(param);
-
- // run through all documents found in Inputpath
- foreachResultCreateHTML(aParam);
- }
-
- public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException
- {
- String sBasename = FileHelper.getBasename(_sDocument);
- String sResultIniFile = _sDocument + ".ini";
-
- HTMLResult aOutputter = new HTMLResult(_sResult, sBasename + ".html" );
- aOutputter.header(_sResult);
- aOutputter.indexSection(sBasename);
-
- IniFile aResultIniFile = new IniFile(sResultIniFile);
- String sStatusRunThrough = aResultIniFile.getValue("global", "state");
- String sStatusMessage = aResultIniFile.getValue("global", "info");
-
- String sHTMLFile = _aParams.getHTMLPrefix(); // "http://so-gfxcmp-lin/gfxcmp_ui/cw.php?inifile=";
- sHTMLFile += _sDocument + ".ini";
- aOutputter.indexLine(sHTMLFile, sBasename, sStatusRunThrough, sStatusMessage);
- aOutputter.close();
- }
-}
diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
deleted file mode 100644
index a909651bc5f0..000000000000
--- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.RandomAccessFile;
-import helper.ProcessHandler;
-import java.util.ArrayList;
-import helper.OSHelper;
-
-/**
- * This object gives all functionallity to print msoffice documents.
- * It also offers functions to check what type of document it is.
- * It handles *.doc as word documents and use word to print
- * *.xls as excel
- * *.ppt as powerpoint
- */
-public class MSOfficePostscriptCreator implements IOffice
-{
- private String m_sPrinterName; // within Windows the tools need a printer name;
-
- private void setPrinterName(String _s)
- {
- m_sPrinterName = _s;
- }
-
- private final ParameterHelper m_aParameterHelper;
- private String m_sDocumentName;
- private final String m_sResult;
-
- public MSOfficePostscriptCreator(ParameterHelper _aParam, String _sResult)
- {
- m_aParameterHelper = _aParam;
- m_sResult = _sResult;
- String sKillCommand = "C:/bin/kill.exe -9 winword;C:/bin/kill.exe -9 excel";
- _aParam.getTestParameters().put(util.PropertyName.APP_KILL_COMMAND, sKillCommand);
- }
-
- public void load(String _sDocumentName) throws OfficeException
- {
- m_sDocumentName = _sDocumentName;
-
- if (! isMSOfficeDocumentFormat(m_sDocumentName))
- {
- 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.println("USE MSOFFICE AS EXPORT FORMAT.");
- try
- {
- String sDocumentName = m_sDocumentName + ".ps";
- printToFileWithMSOffice(m_aParameterHelper,
- m_sDocumentName,
- m_sResult);
- File aFile = new File(sDocumentName);
- if (aFile.exists())
- {
- String sBasename = FileHelper.getBasename(sDocumentName);
- FileHelper.addBasenameToIndex(m_sResult, sBasename, "msoffice", "postscript", m_sDocumentName);
- }
- }
- catch(OfficeException e)
- {
- GlobalLogWriter.println(e.getMessage());
- throw new OfficeException("Exception caught. Problem with MSOffice printer methods.", e);
- }
- catch(java.io.IOException e)
- {
- GlobalLogWriter.println(e.getMessage());
- throw new OfficeException("IOException caught. Problem with MSOffice printer methods.", e);
- }
- }
-
- public void start() throws OfficeException
- {
- // we don't have an office to start
- }
-
- public void close() throws OfficeException
- {
- // we don't have an office to stop
- }
-
-
- private boolean isWordDocument(String _sSuffix)
- {
- return _sSuffix.toLowerCase().endsWith(".doc") ||
- _sSuffix.toLowerCase().endsWith(".rtf") ||
- _sSuffix.toLowerCase().endsWith(".dot");
- }
-
- private boolean isExcelDocument(String _sSuffix)
- {
- // xlt templates
- // xlw
- // xla addin
- return _sSuffix.toLowerCase().endsWith(".xls");
- }
-
- private boolean isPowerPointDocument(String _sSuffix)
- {
- return _sSuffix.toLowerCase().endsWith(".pps") ||
- _sSuffix.toLowerCase().endsWith(".ppt");
- }
-
- /**
- * returns true, if the given filename has a MS Office suffix.
- */
- 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 suffix is xml, return also true, but we can't decide if word or excel
- if (sDocumentSuffix.toLowerCase().endsWith(".xml")) {return true;}
- return false;
- }
-
-
-
-
- /**
- * print the given file (_sInputFile) to the file name (_sPrintFile)
- */
- private void printToFileWithMSOffice( ParameterHelper _aGTA,
- String _sInputFile,
- String _sPrintFilename) throws OfficeException, java.io.IOException
- {
- String sDocumentSuffix = FileHelper.getSuffix(_sInputFile);
-
- setPrinterName(_aGTA.getPrinterName());
-
- ArrayList<String> aStartCommand = new ArrayList<String>();
- if (isWordDocument(sDocumentSuffix))
- {
- aStartCommand = createWordPrintHelper();
- }
- else if (isExcelDocument(sDocumentSuffix))
- {
- aStartCommand = createExcelPrintHelper();
- }
- else if (isPowerPointDocument(sDocumentSuffix))
- {
- aStartCommand = createPowerPointPrintHelper();
- }
- else if (sDocumentSuffix.equalsIgnoreCase(".xml"))
- {
-// TODO: Open XML File and check if we need excel or word
- String sOfficeType = getOfficeType(_sInputFile);
-
- // special case, if xml we prefer word, but with DEFAULT_XML_FORMAT_APP=excel it's changeable.
- if (sOfficeType.equals("excel"))
- {
- aStartCommand = createExcelPrintHelper();
- }
- else if (sOfficeType.equals("word"))
- {
- aStartCommand = createWordPrintHelper();
- }
- else
- {
- return;
- }
- }
- else
- {
- GlobalLogWriter.println("No Microsoft Office document format found.");
-// TODO: use a better Exception!!!
- throw new WrongSuffixException("No Mircosoft Office document format found.");
- }
-
- if (!aStartCommand.isEmpty())
- {
- String sPrinterName = m_sPrinterName;
- if (sPrinterName == null)
- {
- sPrinterName = "";
- }
-
- aStartCommand.add(_sInputFile);
- aStartCommand.add(m_sPrinterName);
- aStartCommand.add(_sPrintFilename);
-
- realStartCommand(aStartCommand);
- }
- String sUserDir = System.getProperty("user.home");
- _aGTA.getPerformance().readWordValuesFromFile(FileHelper.appendPath(sUserDir, "msofficeloadtimes.txt"));
- FileHelper.createInfoFile(_sPrintFilename, _aGTA, "msoffice");
- TimeHelper.waitInSeconds(2, "Give Microsoft Office some time to print.");
- }
-
- private void realStartCommand(ArrayList<String> _aStartCommand) throws OfficeException
- {
- if (_aStartCommand.isEmpty())
- {
- throw new OfficeException/*WrongEnvironmentException*/("Given list is empty.");
- }
-
- try
- {
- // Convert the StartCommand ArrayList to a String List
- int nValues = _aStartCommand.size();
- String[] aList = new String[nValues];
- for (int i=0;i<nValues;i++)
- {
- String aStr = _aStartCommand.get(i);
- if (aStr == null)
- {
- aStr = "";
- }
- if (aStr.length() == 0)
- {
- aStr = "\"\"";
- }
- aList[i] = aStr;
- }
-
- // This is really the latest point where we can check if we are running within windows environment
- if (! OSHelper.isWindows())
- {
- // TODO: use a better Exception!!!
- throw new WrongEnvironmentException("We don't work within windows environment.");
- }
-
-
- ProcessHandler aHandler = new ProcessHandler(aList);
- aHandler.executeSynchronously();
- }
- catch (IndexOutOfBoundsException e)
- {
- throw new WrongEnvironmentException("Given list is too short.", e);
- }
- }
-
-
- private String getPerlExe()
- {
- final String sPerlExe = System.getProperty("perl.exe", "perl");
- return sPerlExe;
- }
-
- private ArrayList<String> createWordPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
-
- String sPrintViaWord = "printViaWord.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaWord);
- if (!aList.isEmpty())
- {
- return aList;
- }
-
- String sFileName = FileHelper.appendPath(sTmpPath, sPrintViaWord);
- File aFile = new File(sFileName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile);
-
- out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( "use Time::HiRes; " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Windows only.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE; " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Word'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: word_print.pl <Word file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " execl_print.pl c:\\book1.doc Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print 'Too less arguments.\\n'; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $startWordTime = Time::HiRes::time(); " + ls );
- out.write( "my $Word = Win32::OLE->new('Word.Application'); " + ls );
- out.write( "my $stopWordTime = Time::HiRes::time() - $startWordTime; " + ls );
- out.write( "# $Word->{'Visible'} = 1; # if you want to see what's going on " + ls );
- out.write( "# , ReadOnly => 1})" + ls );
- out.write(ls);
- out.write( "my $startLoadWordTime = Time::HiRes::time(); " + ls );
- out.write( "$Word->Documents->Open({Filename => $ARGV[0]}) " + ls );
- out.write( " || die('Unable to open document ', Win32::OLE->LastError()); " + ls );
- out.write( "my $stopLoadWordTime = Time::HiRes::time() - $startLoadWordTime; " + ls );
- out.write(ls);
- out.write( "my $startPrintWordTime = Time::HiRes::time(); " + ls);
- out.write( "my $oldActivePrinte = $Word->{ActivePrinter} ; " + ls );
- out.write( "$Word->{ActivePrinter} = $ARGV[1]; " + ls );
- out.write( "$Word->ActiveDocument->PrintOut({ " + ls );
- out.write( " Background => 0, " + ls );
- out.write( " Append => 0, " + ls );
- out.write( " Range => wdPrintAllDocument, " + ls );
- out.write( " Item => wdPrintDocumentContent, " + ls );
- out.write( " Copies => 1, " + ls );
- out.write( " PageType => wdPrintAllPages, " + ls );
- out.write( " PrintToFile => 1, " + ls );
- out.write( " OutputFileName => $ARGV[2] " + ls );
- out.write( " }); " + ls );
- out.write( "$Word->{ActivePrinter} = $oldActivePrinte; " + ls );
- out.write( "my $stopPrintWordTime = Time::HiRes::time() - $startPrintWordTime;" + ls);
-
- out.write( "# ActiveDocument.Close(SaveChanges:=WdSaveOptions.wdDoNotSaveChanges)" + ls );
- out.write( "my $sVersion = $Word->Application->Version();"+ls);
- out.write( "$Word->ActiveDocument->Close({SaveChanges => 0}); " + ls );
- out.write( "$Word->Quit(); " + ls );
-
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"WordVersion=$sVersion\\n\";" + ls);
- out.write( " print FILE \"WordStartTime=$stopWordTime\\n\";" + ls);
- out.write( " print FILE \"WordLoadTime=$stopLoadWordTime\\n\";" + ls);
- out.write( " print FILE \"WordPrintTime=$stopPrintWordTime\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add(getPerlExe());
- aList.add(sFileName);
- return aList;
- }
-
- // TODO: Maybe give a possibility to say where search the script from outside
-
- private ArrayList<String> searchLocalFile(String _sScriptName)
- {
- String userdir = System.getProperty("user.dir");
-
- ArrayList<String> aList = new ArrayList<String>();
- String sFileName = FileHelper.appendPath(userdir, _sScriptName);
- File aPerlScript = new File(sFileName);
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.println("Search for local existence of " + aPerlScript.getAbsolutePath());
- }
-
- if (aPerlScript.exists())
- {
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.println("OK, found it, use this instead the internal one.");
- }
-
- String sName = aPerlScript.getAbsolutePath();
- aList.add("perl");
- aList.add(sName);
- return aList;
- }
- return aList;
- }
-
- private ArrayList<String> createExcelPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
-
- String sPrintViaExcel = "printViaExcel.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaExcel);
- if (!aList.isEmpty())
- {
- return aList;
- }
- String sName = FileHelper.appendPath(sTmpPath, sPrintViaExcel);
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.println("No local found, create a perl script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile);
-
- 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 );
- out.write( "{ " + ls );
- out.write( " print \"Windows only.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE qw(in with); " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft Excel'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: printViaExcel.pl <Excel file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " execl_print.pl c:\\book1.xls Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV != 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Too less arguments.\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[0] $ARGV[0]\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[1] $ARGV[1]\\n\"; " + ls );
- out.write( " print STDERR \"ARGV[2] $ARGV[2]\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $Excel = Win32::OLE->GetActiveObject('Excel.Application') " + ls );
- out.write( " || Win32::OLE->new('Excel.Application', 'Quit'); # get already active Excel " + ls );
- out.write( " # application or open new " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "my $Book = $Excel->Workbooks->Open( $ARGV[0] ); " + ls );
- out.write( " $Book->PrintOut({Copies => 1, " + ls );
- out.write( " ActivePrinter => $ARGV[1], " + ls );
- out.write( " PrToFileName => $ARGV[2], " + ls );
- out.write( " Collate => 1 " + ls );
- out.write( " }); " + ls );
- out.write( "# Close worksheets without store changes" + ls );
- out.write( "# $Book->Close({SaveChanges => 0}); " + ls );
- out.write( "my $sVersion = $Excel->Application->Version();"+ls);
- out.write( "$Excel->Quit(); " + ls );
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"ExcelVersion=$sVersion\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out != null)
- out.close();
- }
-
- aList.add(getPerlExe());
- aList.add(sName);
- return aList;
- }
-
- private ArrayList<String> createPowerPointPrintHelper() throws java.io.IOException
- {
- // create a program in tmp file
- String sTmpPath = util.utils.getUsersTempDir();
- String ls = System.getProperty("line.separator");
-
- String sPrintViaPowerPoint = "printViaPowerPoint.pl";
-
- ArrayList<String> aList = searchLocalFile(sPrintViaPowerPoint);
- if (!aList.isEmpty())
- {
- return aList;
- }
- String sName = FileHelper.appendPath(sTmpPath, sPrintViaPowerPoint);
- if (FileHelper.isDebugEnabled())
- {
- GlobalLogWriter.println("No local found, create a script: " + sName);
- }
-
- File aFile = new File(sName);
- FileWriter out = null;
- try
- {
- out = new FileWriter(aFile);
-
- out.write( "eval 'exec perl -wS $0 $1 $2 ' " + ls );
- out.write( " if 0; " + ls );
- out.write( "use strict; " + ls );
- out.write( " " + ls );
- out.write( "if ( $^O ne \"MSWin32\") " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Windows only.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "use Win32::OLE qw(in with); " + ls );
- out.write( "use Win32::OLE::Const 'Microsoft PowerPoint'; " + ls );
- out.write( " " + ls );
- out.write( "# ------ usage ------ " + ls );
- out.write( "sub print_usage() " + ls );
- out.write( "{ " + ls );
- out.write( " print STDERR \"Usage: powerpoint_print.pl <PowerPoint file> <name of printer> <output file> .\\n " + ls );
- out.write( " Please use the same string for the name of the printer as you can find \\n " + ls );
- out.write( " under Start-Control Panel-Printer and Faxes \\n " + ls );
- out.write( " The name could look like the following line: \\n " + ls );
- out.write( " Apple LaserWriter II NT v47.0 \\n " + ls );
- out.write( " Sample command line: \\n " + ls );
- out.write( " powerpoint_print.pl c:\\book.ppt Apple LaserWriter II NT v47.0 c:\\output\\book.ps \\n\"; " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( "if ($#ARGV < 2) " + ls );
- out.write( "{ " + ls );
- out.write( " print \"Too less arguments.\\n\"; " + ls );
- out.write( " print_usage(); " + ls );
- out.write( " exit(1); " + ls );
- out.write( "} " + ls );
- out.write( " " + ls );
- out.write( "my $PowerPoint = Win32::OLE->GetActiveObject('PowerPoint.Application') " + ls );
- out.write( " || Win32::OLE->new('PowerPoint.Application', 'Quit'); # get already active Excel " + ls );
- out.write( " # application or open new " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " " + ls );
- out.write( " $PowerPoint->{'Visible'} = 1; " + ls );
- out.write( " my $Presentation = $PowerPoint->Presentations->Add; " + ls );
- out.write( " my $Presentation = $PowerPoint->Presentations->Open( $ARGV[0] ); " + ls );
- out.write( "# we can't change active printer in powerpoint " + ls );
- out.write( "# $Presentation->PrintOptions->{ActivePrinter} = $ARGV[1]; " + ls );
- out.write( " print \"Active printer is: \" . $Presentation->PrintOptions->{ActivePrinter} . \"\\n\"; " + ls );
- out.write( " $Presentation->PrintOptions->{PrintInBackground} = 0; " + ls );
- out.write( " # PrintColorType = 1 means print in color and PrintColorType = 2 means print in gray " + ls );
- out.write( " $Presentation->PrintOptions->{PrintColorType} = 1; " + ls );
- out.write( " " + ls );
- out.write( " $Presentation->PrintOut({PrintToFile => $ARGV[2]}); " + ls );
- out.write( " sleep 5; " + ls );
- out.write( " print \"Presentation has been printed\\n\"; " + ls );
- out.write( "my $sVersion = $Presentation->Application->Version();"+ls);
- out.write( " $PowerPoint->Quit(); " + ls );
-
- out.write( "local *FILE;" + ls);
- out.write( "if (open(FILE, \">$ENV{HOME}/msofficeloadtimes.txt\"))" + ls);
- out.write( "{" + ls);
- out.write( " print FILE \"name=$ARGV[0]\\n\";" + ls);
- out.write( " print FILE \"PowerPointVersion=$sVersion\\n\";" + ls);
-// out.write( " print FILE \"WordStartTime=$stopWordTime\\n\";" + ls);
-// out.write( " print FILE \"WordLoadTime=$stopLoadWordTime\\n\";" + ls);
-// out.write( " print FILE \"WordPrintTime=$stopPrintWordTime\\n\";" + ls);
- out.write( " close(FILE);" + ls);
- out.write( "}" + ls);
- }
- finally
- {
- if (out!= null)
- out.close();
- }
-
- aList.add(getPerlExe());
- aList.add(sName);
- return aList;
- }
-
- /**
- @param _sFilename a name to a ms office xml file
- @return 'word' or 'excel' or '' if type not known
- */
- private String getOfficeType(String _sFilename)
- {
- File aFile = new File(_sFilename);
- if (! aFile.exists())
- {
- GlobalLogWriter.println("couldn't find file " + _sFilename);
- return "";
- }
- RandomAccessFile aReader = null;
- String sOfficeType = "";
- try
- {
- aReader = new RandomAccessFile(aFile,"r");
- String aLine = "";
- while (aLine != null)
- {
- aLine = aReader.readLine();
- if (aLine != null)
- {
- aLine = aLine.trim();
- if ( (aLine.length() >= 2 ) &&
- (! aLine.startsWith("#")) &&
- (! aLine.startsWith(";")) )
- {
- int nIdx = aLine.indexOf("mso-application");
- if (nIdx > 0)
- {
- if (aLine.indexOf("Word.Document") > 0)
- {
- sOfficeType = "word";
- }
- else if (aLine.indexOf("Excel") > 0)
- {
- sOfficeType = "excel";
- }
- else
- {
- GlobalLogWriter.println("Unknown/unsupported data file: " + aLine);
- }
- }
- }
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- System.out.println("couldn't open file " + _sFilename);
- System.out.println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- System.out.println("Exception while reading file " + _sFilename);
- System.out.println("Message: " + ie.getMessage());
- }
- try
- {
- aReader.close();
- }
- catch (java.io.IOException ie)
- {
- System.out.println("Couldn't close file " + _sFilename);
- System.out.println("Message: " + ie.getMessage());
- }
- return sOfficeType;
- }
-
-}
diff --git a/qadevOOo/runner/graphical/Office.java b/qadevOOo/runner/graphical/Office.java
deleted file mode 100644
index 85785b2f3dad..000000000000
--- a/qadevOOo/runner/graphical/Office.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.util.ArrayList;
-
-public class Office implements IOffice
-{
- private final ParameterHelper m_aParameterHelper;
- private String m_sDocumentName;
- private final String m_sResult;
- private IOffice m_aOffice = null;
-
- public Office(ParameterHelper _aParam, String _sResult)
- {
- m_aParameterHelper = _aParam;
- m_sResult = _sResult;
-
- if (_aParam.getReferenceType().equalsIgnoreCase("ooo") ||
- _aParam.getReferenceType().equalsIgnoreCase("o3") ||
- _aParam.getReferenceType().equalsIgnoreCase("ps") ||
- _aParam.getReferenceType().equalsIgnoreCase("pdf"))
- {
- m_aOffice = new OpenOfficePostscriptCreator(_aParam, m_sResult);
- }
- else if (_aParam.getReferenceType().equalsIgnoreCase("msoffice"))
- {
- m_aOffice = new MSOfficePostscriptCreator(_aParam, m_sResult);
- }
- }
-
-
- /**
- * Load a document with an already started Office.
- */
- public void load(String _sDocumentName) throws OfficeException
- {
- m_sDocumentName = _sDocumentName;
- // check if given file is a picture, then do nothing
- String sDocumentSuffix = FileHelper.getSuffix(m_sDocumentName);
- if (sDocumentSuffix.toLowerCase().endsWith(".png") ||
- sDocumentSuffix.toLowerCase().endsWith(".gif") ||
- sDocumentSuffix.toLowerCase().endsWith(".jpg") ||
- sDocumentSuffix.toLowerCase().endsWith(".bmp"))
- {
- throw new OfficeException("The given document is not a document type.");
- }
-
- // TODO: we should start the office after we know if we really need an Office.
- if (m_aOffice != null)
- {
- if (sDocumentSuffix.toLowerCase().endsWith(".odb"))
- {
- if (m_aParameterHelper.getReferenceType().equalsIgnoreCase("msoffice"))
- {
- // we can't handle .odb with msoffice
- return;
- }
- // TODO: run through all documents which exists as reports in odb files
- OpenOfficeDatabaseReportExtractor aExtractor = new OpenOfficeDatabaseReportExtractor(m_aParameterHelper);
- ArrayList<String> aList = aExtractor.load(m_sDocumentName);
- if (aList != null)
- {
- // remove the whole section about the 'name'.odb there are no information we need
- // we will create a new one.
- String sIniFile = FileHelper.appendPath(m_sResult, "index.ini");
- IniFile aIniFile2 = new IniFile(sIniFile);
- String sSection = FileHelper.getBasename(_sDocumentName); // name of the odb file
- aIniFile2.removeSection(sSection);
- aIniFile2.close();
-
- for (int i=0; i<aList.size();i++)
- {
- String sDocumentName = aList.get(i);
- m_aOffice.load(sDocumentName);
- m_aOffice.storeAsPostscript();
-
-
- // foreach Report found in the .odb file, create an entry 'report'<number> in the original <name>.odb Section
- // so it is possible to run through all reports by the given .odb name
- IniFile aIniFile = new IniFile(sIniFile);
- int nFileCount = aIniFile.getIntValue(sSection, "reportcount", 0);
- String sValue = FileHelper.getBasename(sDocumentName); // name of the corresponding report
- aIniFile.insertValue(sSection, "report" + nFileCount, sValue);
- aIniFile.insertValue(sSection, "reportcount", nFileCount + 1);
- aIniFile.close();
- }
- }
- else
- {
- throw new OfficeException("Can't open the document " + m_sDocumentName);
- }
- }
- else
- {
- m_aOffice.load(_sDocumentName);
- }
- }
- }
-
- public void storeAsPostscript() throws OfficeException
- {
- if (m_aOffice != null)
- {
- if (m_sDocumentName.endsWith(".odb"))
- {
- // this has already be done by load() for odb files.
- }
- else
- {
- m_aOffice.storeAsPostscript();
- }
- }
- }
-
- public void start() throws OfficeException
- {
- if (m_aOffice != null)
- {
- m_aOffice.start();
- }
- }
-
- public void close() throws OfficeException
- {
- if (m_aOffice != null)
- {
- m_aOffice.close();
- }
- }
-
-}
diff --git a/qadevOOo/runner/graphical/OfficeException.java b/qadevOOo/runner/graphical/OfficeException.java
deleted file mode 100644
index 94c0d3ae942c..000000000000
--- a/qadevOOo/runner/graphical/OfficeException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-/**
- * Exception which occur if something goes wrong at load document.
- */
-
-public class OfficeException extends Exception
-{
- public OfficeException(String _aMessage)
- {
- super(_aMessage);
- }
-
- public OfficeException(String _aMessage, Throwable cause)
- {
- super(_aMessage, cause);
- }
-}
diff --git a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java b/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java
deleted file mode 100644
index 199b169c88af..000000000000
--- a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.frame.FrameSearchFlag;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XDesktop;
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XStorable;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.sdb.XOfficeDatabaseDocument;
-import com.sun.star.sdb.XReportDocumentsSupplier;
-import com.sun.star.sdb.application.XDatabaseDocumentUI;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-import com.sun.star.util.XCloseable;
-import complexlib.Assurance;
-import helper.PropertyHelper;
-import helper.URLHelper;
-import java.io.File;
-import java.util.ArrayList;
-
-class PropertySetHelper
-{
- XPropertySet m_xPropertySet;
- public PropertySetHelper(Object _aObj)
- {
- m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj);
- }
-
- /**
- get a property and don't convert it
- @param _sName the string name of the property
- @return the object value of the property without any conversion
- */
- public Object getPropertyValueAsObject(String _sName)
- {
- Object aObject = null;
-
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- System.out.println("ERROR: UnknownPropertyException caught. '" + _sName + "'");
- System.out.println("Message: " + e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- System.out.println("ERROR: WrappedTargetException caught.");
- System.out.println("Message: " + e.getMessage());
- }
- }
- return aObject;
- }
-}
-
-public class OpenOfficeDatabaseReportExtractor extends Assurance
-{
- private final ParameterHelper m_aParameterHelper;
-
- public OpenOfficeDatabaseReportExtractor(ParameterHelper _aParameter)
- {
- m_aParameterHelper = _aParameter;
- }
-
- private XDesktop m_xDesktop = null;
- private XDesktop getXDesktop()
- {
-
- if (m_xDesktop == null)
- {
- try
- {
- XInterface xInterface = (XInterface) getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop" );
- m_xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface);
- }
- catch (com.sun.star.uno.Exception e)
- {
- GlobalLogWriter.println("ERROR: uno.Exception caught");
- GlobalLogWriter.println("Message: " + e.getMessage());
- }
- }
- return m_xDesktop;
- }
-
- private void showElements(XNameAccess _xNameAccess)
- {
- if (_xNameAccess != null)
- {
- String[] sElementNames = _xNameAccess.getElementNames();
- for(int i=0;i<sElementNames.length; i++)
- {
- System.out.println("Value: [" + i + "] := " + sElementNames[i]);
- }
- }
- else
- {
- System.out.println("Warning: Given object is null.");
- }
- }
-
-
- private XMultiServiceFactory m_xMultiServiceFactory = null;
- private XMultiServiceFactory getMultiServiceFactory()
- {
- if (m_xMultiServiceFactory == null)
- {
- m_xMultiServiceFactory = m_aParameterHelper.getMultiServiceFactory();
- }
- return m_xMultiServiceFactory;
- }
-
- /**
- * This is the main test Function of current ReportDesignerTest
- */
- 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();
- File aOutputPath = new File(sOutputPath);
- aOutputPath.mkdirs();
-
- String sFilename = FileHelper.getBasename(_sDocument);
- String sDestinationFile = FileHelper.appendPath(sOutputPath, sFilename);
- FileHelper.copy(_sDocument, sDestinationFile);
-
- // now the fix reference of the AbsoluteReferenceFile should exist.
- assure("There exists no file: " + sDestinationFile, FileHelper.exists(sDestinationFile));
-
- String sFileURL = URLHelper.getFileURLFromSystemPath(sDestinationFile);
- GlobalLogWriter.println("File URL: " + sFileURL);
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
-
- XComponent xDocComponent = loadComponent(sFileURL, getXDesktop(), aPropertyList);
-
- GlobalLogWriter.println("Load done");
-
- ArrayList<String> aList = null;
- try
- {
- XOfficeDatabaseDocument xOfficeDBDoc = UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDocComponent);
-
- assure("can't access DatabaseDocument", xOfficeDBDoc != null);
-
- XModel xDBSource = UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
- Object aController = xDBSource.getCurrentController();
- assure("Controller of xOfficeDatabaseDocument is empty!", aController != null);
-
- XDatabaseDocumentUI aDBDocUI = UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
- aDBDocUI.connect();
- boolean isConnect = aDBDocUI.isConnected();
- if (isConnect)
- {
- GlobalLogWriter.println("Connection is true");
- }
- else
- {
- GlobalLogWriter.println("Connection is false");
- }
-
- XReportDocumentsSupplier xSupplier = UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
- XNameAccess xNameAccess = xSupplier.getReportDocuments();
- assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null);
-
- showElements(xNameAccess);
-
- Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
- assure("ActiveConnection is empty", aActiveConnectionObj != null);
-
- ArrayList<PropertyValue> aPropertyList2 = new ArrayList<PropertyValue>();
-
- PropertyValue aActiveConnection = new PropertyValue();
- aActiveConnection.Name = "ActiveConnection";
- aActiveConnection.Value = aActiveConnectionObj;
- aPropertyList2.add(aActiveConnection);
-
- aList = loadAndStoreReports(xNameAccess, aPropertyList2);
- createDBEntry();
- }
- catch(Exception e)
- {
- GlobalLogWriter.println("ERROR: Exception caught");
- GlobalLogWriter.println("Message: " + e.getMessage());
- }
-
- closeComponent(xDocComponent);
- return aList;
- }
-
- private String getDocumentPoolName()
- {
- return "AutogenReportDesignTest";
- }
-
- private void createDBEntry()
- {
- // try to connect the database
- String sDBConnection = (String)m_aParameterHelper.getTestParameters().get( convwatch.PropertyName.DB_CONNECTION_STRING );
- if (sDBConnection != null && sDBConnection.length() > 0)
- {
- GlobalLogWriter.println("DBConnection: " + sDBConnection);
-
- getOutputPath();
- getDocumentPoolName();
- TimeHelper.waitInSeconds(1, "wait for DB.");
- }
- }
-
- private ArrayList<String> loadAndStoreReports(XNameAccess _xNameAccess, ArrayList<PropertyValue> _aPropertyList)
- {
- ArrayList<String> aList = new ArrayList<String>();
- if (_xNameAccess != null)
- {
- String[] sElementNames = _xNameAccess.getElementNames();
- for(int i=0;i<sElementNames.length; i++)
- {
- String sReportName = sElementNames[i];
- XComponent xDoc = loadComponent(sReportName, _xNameAccess, _aPropertyList);
- if (xDoc != null)
- {
- String sDocumentPathName = storeComponent(sReportName, xDoc);
- aList.add(sDocumentPathName);
- closeComponent(xDoc);
- }
- else
- {
- System.out.println("Leave out maybe due to errors.");
- }
- // sBackPath contains the path where to find the extracted ODB Document
- }
- }
- return aList;
- }
-
- private String getFormatExtension(Object _xComponent)
- {
- String sExtension;
- XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
- if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
- {
- // calc
- sExtension = ".ods";
- }
- else if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
- {
- //writer
- sExtension = ".odt";
- }
- else
- {
- sExtension = ".UNKNOWN";
- }
- return sExtension;
- }
-
- private String m_sOutputPath = null;
-
- private String getOutputPath()
- {
- if (m_sOutputPath == null)
- {
- String sOutputPath = (String)m_aParameterHelper.getTestParameters().get( convwatch.PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
- sOutputPath = helper.StringHelper.removeQuoteIfExists(sOutputPath);
-
- sOutputPath = FileHelper.appendPath(sOutputPath, DateHelper.getDateTimeForFilename());
-
- File aOutputFile = new File(sOutputPath); // create the directory of the given output path
- aOutputFile.mkdirs();
- m_sOutputPath = sOutputPath;
- }
- return m_sOutputPath;
- }
-
- /*
- store given _xComponent under the given Name in DOC_COMPARATOR_INPUTPATH
- */
- private String storeComponent(String _sName, Object _xComponent)
- {
- String sOutputPath = getOutputPath();
-
- String sName = _sName + getFormatExtension(_xComponent);
- sOutputPath = FileHelper.appendPath(sOutputPath, sName);
-
- // we need the name and path
- String sBackPathName = sOutputPath;
-
- String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); // set some properties for storeAsURL
-
- PropertyValue aOverwrite = new PropertyValue(); // always overwrite already exist files
- aOverwrite.Name = "Overwrite";
- aOverwrite.Value = Boolean.TRUE;
- aPropertyList.add(aOverwrite);
-
- // store the document in an other directory
- XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _xComponent);
- if (aStorable != null)
- {
- GlobalLogWriter.println("store document as URL: '" + sOutputURL + "'");
- try
- {
- aStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- }
- catch (com.sun.star.io.IOException e)
- {
- GlobalLogWriter.println("ERROR: Exception caught");
- GlobalLogWriter.println("Can't write document URL: '" + sOutputURL + "'");
- GlobalLogWriter.println("Message: " + e.getMessage());
- }
- }
- return sBackPathName;
- }
-
- private XComponent loadComponent(String _sName, Object _xComponent, ArrayList<PropertyValue> _aPropertyList)
- {
- XComponent xDocComponent = null;
- XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );
-
- try
- {
- PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList);
- GlobalLogWriter.println("Load component: '" + _sName + "'");
- xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", FrameSearchFlag.ALL, aLoadProperties);
- GlobalLogWriter.println("Load component: '" + _sName + "' done");
- }
- catch (com.sun.star.io.IOException e)
- {
- 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.println("ERROR: Exception caught");
- GlobalLogWriter.println("Illegal Arguments given to loadComponentFromURL.");
- GlobalLogWriter.println("Message: " + e.getMessage());
- }
- return xDocComponent;
- }
-
- private void closeComponent(XComponent _xDoc)
- {
- // Close the document
- XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, _xDoc);
- try
- {
- xCloseable.close(true);
- }
- catch (com.sun.star.util.CloseVetoException e)
- {
- GlobalLogWriter.println("ERROR: CloseVetoException caught");
- GlobalLogWriter.println("CloseVetoException occurred Can't close document.");
- GlobalLogWriter.println("Message: " + e.getMessage());
- }
- }
-
-}
diff --git a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java
deleted file mode 100644
index efba9a86cfe8..000000000000
--- a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import com.sun.star.frame.FrameSearchFlag;
-import com.sun.star.util.XCloseable;
-import helper.OfficeProvider;
-import helper.OfficeWatcher;
-import java.util.ArrayList;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.frame.XDesktop;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.lang.XComponent;
-import com.sun.star.frame.XStorable;
-import com.sun.star.view.XPrintable;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.frame.XModel;
-import com.sun.star.uno.AnyConverter;
-
-import helper.URLHelper;
-import helper.PropertyHelper;
-import helper.OSHelper;
-
-import java.io.File;
-
-/**
- * This Object is to print a given document with OpenOffice.org / StarOffice
- * over the normal printer driver
- * or over it's pdf exporter
- */
-public class OpenOfficePostscriptCreator implements IOffice
-{
- private final ParameterHelper m_aParameterHelper;
- private final String m_sOutputURL;
- private String m_sBasename;
- private String m_sDocumentName;
- private XComponent m_aDocument;
-
- public OpenOfficePostscriptCreator(ParameterHelper _aParam, String _sResult)
- {
- m_aParameterHelper = _aParam;
- String sOutputURL = _sResult;
- if (! sOutputURL.startsWith("file:"))
- {
- sOutputURL = URLHelper.getFileURLFromSystemPath(_sResult);
- }
- m_sOutputURL = sOutputURL;
- m_aDocument = null;
- }
-
-
- public void load(String _sDocumentName) throws OfficeException
- {
- m_sDocumentName = _sDocumentName;
-
- String sInputFileURL = URLHelper.getFileURLFromSystemPath(m_sDocumentName);
- m_aDocument = loadFromURL(m_aParameterHelper, sInputFileURL);
- if (m_aDocument == null)
- {
- GlobalLogWriter.println("loadDocumentFromURL() failed with document: " + sInputFileURL);
- throw new OfficeException("load(): failed with document" + sInputFileURL);
- }
-
- m_sBasename = FileHelper.getBasename(m_sDocumentName);
- }
-
- public void storeAsPostscript() throws OfficeException
- {
- if (m_aDocument != null)
- {
- String sDocumentName = FileHelper.appendPath(m_sOutputURL, m_sBasename);
- if (m_aParameterHelper.getReferenceType().equalsIgnoreCase("ooo") ||
- m_aParameterHelper.getReferenceType().equalsIgnoreCase("o3") ||
- m_aParameterHelper.getReferenceType().equalsIgnoreCase("ps") )
- {
- String sPrintURL = sDocumentName + ".ps";
-
- impl_printToFileWithOOo(m_aParameterHelper, m_aDocument, sDocumentName, sPrintURL /*_sPrintFileURL*/);
- String sBasename = FileHelper.getBasename(sPrintURL);
- FileHelper.addBasenameToIndex(m_sOutputURL, sBasename, "OOo", "postscript", m_sDocumentName);
- }
- else if (m_aParameterHelper.getReferenceType().equalsIgnoreCase("pdf"))
- {
- String sPDFURL = sDocumentName + ".pdf";
- storeAsPDF(m_aParameterHelper, m_aDocument, sPDFURL);
-
- String sBasename = FileHelper.getBasename(sPDFURL);
- FileHelper.addBasenameToIndex(m_sOutputURL, sBasename, "pdf", "pdf-export", m_sDocumentName);
- }
- else
- {
- throw new OfficeException("unknown reference type");
- }
- GlobalLogWriter.println("Close document.");
- m_aDocument.dispose();
- }
- }
-
- public void start() throws OfficeException
- {
- startOffice();
- }
-
- public void close() throws OfficeException
- {
- stopOffice();
- }
-
-
-
-
-
- private void showProperty(PropertyValue _aValue)
- {
- String sName = _aValue.Name;
- String sValue;
- try
- {
- sValue = AnyConverter.toString(_aValue.Value);
- GlobalLogWriter.println("Property " + sName + ":=" + sValue);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- GlobalLogWriter.println("showProperty: can't convert a object to string. " + e.getMessage());
- }
- }
-
- /**
- * shows the FilterName and MediaType from the given XComponent
- */
- private String getDocumentType( XComponent _aDoc )
- {
- XModel xModel = UnoRuntime.queryInterface( XModel.class, _aDoc);
- PropertyValue[] aArgs = xModel.getArgs();
- for (int i=0;i<aArgs.length;i++)
- {
- PropertyValue aValue = aArgs[i];
- if (aValue.Name.equals("FilterName") ||
- aValue.Name.equals("MediaType"))
- {
- String sNameValue = "'" + aValue.Name + "' := '" + aValue.Value + "'";
- return sNameValue;
- }
- }
- return "";
- }
-
- private void showDocumentType( XComponent _aDoc )
- {
- String sNameValue = getDocumentType(_aDoc);
- GlobalLogWriter.println(" Property: '" + sNameValue);
- }
- /**
- * load a OpenOffice.org document from a given URL (_sInputURL)
- * the ParameterHelper 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.
- */
- private XComponent loadFromURL(ParameterHelper _aGTA,
- String _sInputURL)
- {
- XComponent aDoc = null;
- try
- {
- if (_aGTA.getMultiServiceFactory() == null)
- {
- GlobalLogWriter.println("MultiServiceFactory in GraphicalTestArgument not set.");
- return null;
- }
- Object oDsk = _aGTA.getMultiServiceFactory().createInstance("com.sun.star.frame.Desktop");
- XDesktop aDesktop = UnoRuntime.queryInterface(XDesktop.class, oDsk);
-
- if (aDesktop != null)
- {
- GlobalLogWriter.println("com.sun.star.frame.Desktop created.");
- // set here the loadComponentFromURL() properties
- // at the moment only 'Hidden' is set, so no window is opened at work
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
-
- // set all property values
- if (_aGTA.isHidden())
- {
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "Hidden";
- Arg.Value = Boolean.TRUE;
- aPropertyList.add(Arg);
- showProperty(Arg);
- }
- if (_aGTA.getImportFilterName() != null && _aGTA.getImportFilterName().length() > 0)
- {
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "FilterName";
- Arg.Value = _aGTA.getImportFilterName();
- aPropertyList.add(Arg);
- showProperty(Arg);
- }
- PropertyValue ReadOnly = new PropertyValue();
- ReadOnly.Name = "ReadOnly";
- ReadOnly.Value = Boolean.TRUE;
- aPropertyList.add(ReadOnly);
- showProperty(ReadOnly);
-
- GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
-
- XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
-
- // XComponent aDoc = null;
-
- _aGTA.getPerformance().startTime(PerformanceContainer.Load);
- aDoc = aCompLoader.loadComponentFromURL(_sInputURL, "_blank", FrameSearchFlag.ALL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList) );
- _aGTA.getPerformance().stopTime(PerformanceContainer.Load);
- if (aDoc != null)
- {
- 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.println(" Load document failed.");
- if (_aGTA.getImportFilterName() != null && _aGTA.getImportFilterName().length() > 0)
- {
- GlobalLogWriter.println(" Please check FilterName := '" + _aGTA.getImportFilterName() + "'");
- }
- GlobalLogWriter.println("");
- }
- }
- else
- {
- GlobalLogWriter.println("com.sun.star.frame.Desktop failed.");
- }
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.println("UNO Exception caught.");
- GlobalLogWriter.println("Message: " + e.getMessage());
- e.printStackTrace();
- }
- return aDoc;
- }
-
- private boolean exportToPDF(XComponent _xComponent, String _sDestinationName)
- {
- XServiceInfo xServiceInfo =
- UnoRuntime.queryInterface(
- XServiceInfo.class, _xComponent
- );
-
- ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>();
- PropertyValue aFiltername = new PropertyValue();
- aFiltername.Name = "FilterName";
- aFiltername.Value = getFilterName_forPDF(xServiceInfo);
- aPropertyList.add(aFiltername);
- showProperty(aFiltername);
- boolean bWorked = true;
-
-// TODO: TimeHelper.waitInSeconds(20, "Wait before storeToURL. Maybe helps due to layouting problems.");
- try
- {
- XStorable store =
- UnoRuntime.queryInterface(
- XStorable.class, _xComponent
- );
- store.storeToURL(_sDestinationName, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- }
- catch (com.sun.star.io.IOException e)
- {
- GlobalLogWriter.println("IO Exception caught.");
- GlobalLogWriter.println("Message: " + e.getMessage());
- bWorked = false;
- }
-
- return bWorked;
- }
-
-
- private String getFilterName_forPDF(XServiceInfo xServiceInfo)
- {
- String filterName = "";
-
- if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
- {
- //writer
- filterName = "writer_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
- {
- //calc
- filterName = "calc_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.drawing.DrawingDocument" ) )
- {
- //draw
- filterName = "draw_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.presentation.PresentationDocument" ) )
- {
- //impress
- filterName = "impress_pdf_Export";
- }
- else if (xServiceInfo.supportsService("com.sun.star.text.WebDocument"))
- {
- //html document
- filterName = "writer_web_pdf_Export";
- }
- else if ( xServiceInfo.supportsService("com.sun.star.text.GlobalDocument") )
- {
- //master document
- filterName = "writer_globaldocument_pdf_Export";
- }
- else if ( xServiceInfo.supportsService( "com.sun.star.formulaFormulaProperties" ) )
- {
- //math document
- filterName = "math_pdf_Export";
- }
-
- return filterName;
- }
-
-
-
- private boolean storeAsPDF(ParameterHelper _aGTA,
- XComponent _aDoc,
- String _sOutputURL) throws OfficeException
- {
- boolean bBack = true;
- _aGTA.getPerformance().startTime(PerformanceContainer.StoreAsPDF);
- bBack = exportToPDF(_aDoc, _sOutputURL);
- _aGTA.getPerformance().stopTime(PerformanceContainer.StoreAsPDF);
-
- if (!bBack)
- {
- GlobalLogWriter.println("Can't store document as PDF.");
- throw new OfficeException("Can't store document as PDF");
- }
- else
- {
- FileHelper.createInfoFile(_sOutputURL, _aGTA, "as pdf");
- }
- return bBack;
- }
-
-
- private boolean impl_printToFileWithOOo(ParameterHelper _aGTA,
- XComponent _aDoc,
- String _sOutputURL,
- String _sPrintFileURL)
- {
- boolean bBack = false;
- boolean bFailed = true; // always be a pessimist,
- if (_aDoc == null)
- {
- GlobalLogWriter.println("No document is given.");
- return bBack;
- }
-
- try
- {
- if (_sOutputURL != null)
- {
- if (isStoreAllowed())
- {
- // store the document in an other directory
- XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _aDoc);
- if (aStorable != null)
- {
- PropertyValue [] szEmptyArgs = new PropertyValue [0];
-
- GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Store document.");
- _aGTA.getPerformance().startTime(PerformanceContainer.Store);
- aStorable.storeAsURL(_sOutputURL, szEmptyArgs);
- _aGTA.getPerformance().stopTime(PerformanceContainer.Store);
-
- GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Store document done.");
- GlobalLogWriter.println("Reload stored file test.");
- XComponent aDoc = loadFromURL(_aGTA, _sOutputURL);
- if (aDoc == null)
- {
- GlobalLogWriter.println("Reload stored file test failed, can't reload file: " + _sOutputURL);
- }
- else
- {
- XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, aDoc);
- if (xClose != null)
- {
- xClose.close(true);
- }
- else
- {
- aDoc.dispose();
- }
- }
- }
- }
- else
- {
- // make sure to create the directory in
- String sOutputFilename = FileHelper.getSystemPathFromFileURL(_sOutputURL);
- String sOutputPath = FileHelper.getPath(sOutputFilename);
- File aFile = new File(sOutputPath);
- aFile.mkdirs();
- }
- }
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.println("UNO Exception caught.");
- GlobalLogWriter.println("Message: " + e.getMessage());
-
- e.printStackTrace();
- bBack = false;
- }
-
- try
- {
-
- // Change Pagesettings to DIN A4
-
- GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Print document.");
- XPrintable aPrintable = UnoRuntime.queryInterface( XPrintable.class, _aDoc);
- if (aPrintable != null)
- {
- // configure Office to allow to execute macos
-
-// TODO: We need a possibility to set the printer name also for StarOffice/OpenOffice
- if (OSHelper.isWindows())
- {
- if (_aGTA.getPrinterName() != null)
- {
- 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.println("Printername is not null, so set to " + _aGTA.getPrinterName());
- aPrintable.setPrinter(PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
- }
- }
-
- // set property values for XPrintable.print()
- // more can be found at "http://api.libreoffice.org/docs/common/ref/com/sun/star/view/PrintOptions.html"
-
- // If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
- 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 = UnoRuntime.queryInterface( XPropertySet.class, aSettings );
- xPropSet.setPropertyValue( "PrintAllSheets", Boolean.TRUE );
- GlobalLogWriter.println("PrintAllSheets := true");
- }
- }
-
- ArrayList<PropertyValue> aPrintProps = new ArrayList<PropertyValue>();
-
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "FileName";
- Arg.Value = _sPrintFileURL;
- aPrintProps.add(Arg);
- showProperty(Arg);
-
-
- // generate pages string
- if (!_aGTA.printAllPages())
- {
- String sPages = "";
- if (_aGTA.getMaxPages() > 0)
- {
- sPages = "1-" + _aGTA.getMaxPages();
- }
- if (_aGTA.getOnlyPages().length() != 0)
- {
- if (sPages.length() != 0)
- {
- sPages += ";";
- }
- sPages += String.valueOf(_aGTA.getOnlyPages());
- }
-
- Arg = new PropertyValue();
- Arg.Name = "Pages";
- Arg.Value = sPages;
- aPrintProps.add(Arg);
- showProperty(Arg);
- }
-
- _aGTA.getPerformance().startTime(PerformanceContainer.Print);
- aPrintable.print(PropertyHelper.createPropertyValueArrayFormArrayList(aPrintProps));
- TimeHelper.waitInSeconds(1, "Start waiting for print ready.");
-
- GlobalLogWriter.println("Wait until document is printed.");
- boolean isBusy = true;
- int nPrintCount = 0;
- while (isBusy)
- {
- PropertyValue[] aPrinterProps = aPrintable.getPrinter();
- int nPropIndex = 0;
- while (!"IsBusy".equals(aPrinterProps[nPropIndex].Name))
- {
- nPropIndex++;
- }
- isBusy = aPrinterProps[nPropIndex].Value.equals(Boolean.TRUE);
- TimeHelper.waitInSeconds(1, "is print ready?");
- nPrintCount++;
- if (nPrintCount > 3600)
- {
- // we will never wait >1h until print is ready!
- GlobalLogWriter.println("ERROR: Cancel print due to too long wait.");
- throw new com.sun.star.uno.Exception("Convwatch exception, wait too long for printing.");
- }
- }
- _aGTA.getPerformance().stopTime(PerformanceContainer.Print);
- GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Print document done.");
-
- // Create a .info file near the printed '.ps' or '.prn' file.
- FileHelper.createInfoFile(_sPrintFileURL, _aGTA);
- }
- else
- {
- GlobalLogWriter.println("Can't get XPrintable interface.");
- }
- bFailed = false;
- bBack = true;
- }
- catch ( com.sun.star.uno.Exception e )
- {
- // Some exception occurs.FAILED
- GlobalLogWriter.println("UNO Exception caught.");
- GlobalLogWriter.println("Message: " + e.getMessage());
-
- e.printStackTrace();
- bBack = false;
- }
-
- if (bFailed)
- {
- GlobalLogWriter.println("convwatch.OfficePrint: FAILED");
- }
- else
- {
- GlobalLogWriter.println("convwatch.OfficePrint: OK");
- }
- return bBack;
- }
-
-
-
-
-
- // TODO: move this away!
-
-
-
-
-
- private OfficeProvider m_aProvider = null;
- private void startOffice()
- {
- m_aParameterHelper.getTestParameters().put(util.PropertyName.DONT_BACKUP_USERLAYER, Boolean.TRUE);
-
- m_aParameterHelper.getPerformance().startTime(PerformanceContainer.OfficeStart);
- m_aProvider = new OfficeProvider();
- XMultiServiceFactory xMSF = (XMultiServiceFactory) m_aProvider.getManager(m_aParameterHelper.getTestParameters());
- m_aParameterHelper.getTestParameters().put("ServiceFactory", xMSF);
- m_aParameterHelper.getPerformance().stopTime(PerformanceContainer.OfficeStart);
-
- long nStartTime = m_aParameterHelper.getPerformance().getTime(PerformanceContainer.OfficeStart);
- m_aParameterHelper.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
-
- // 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.
- if (GlobalLogWriter.get().getWatcher() == null)
- {
- GlobalLogWriter.println("Set office watcher");
- OfficeWatcher aWatcher = (OfficeWatcher)m_aParameterHelper.getTestParameters().get("Watcher");
- GlobalLogWriter.get().setWatcher(aWatcher);
- }
- }
-
- private void stopOffice()
- {
- // Office shutdown
- if (m_aProvider != null)
- {
- String sAppExecCmd = (String)m_aParameterHelper.getTestParameters().get("AppExecutionCommand");
- if (sAppExecCmd != null && sAppExecCmd.length() > 0)
- {
- m_aProvider.closeExistingOffice(m_aParameterHelper.getTestParameters(), true);
- }
- }
- }
-
-
-
- private boolean isStoreAllowed()
- {
- return false;
- }
-
-}
-
diff --git a/qadevOOo/runner/graphical/ParameterHelper.java b/qadevOOo/runner/graphical/ParameterHelper.java
deleted file mode 100644
index 30d5aa89dd90..000000000000
--- a/qadevOOo/runner/graphical/ParameterHelper.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import lib.TestParameters;
-
-/**
- * This class object is more a Helper or Controller.
- * It stores information like:
- * - How to create a document (with a OpenOffice.org method, or with MS Word, or with OpenOffice.org as pdf)
- * - some more infos for OpenOffice.org method
- * - a service factory pointer
- * - if hidden mode should use
- * - target name
- *
- * - printer name
- *
- * - how to handle .xml files, which in Microsoft could be Excel or Word documents
- *
- * HOWTO USE:
- * For OOo,
- * create an ParameterHelper with a set of TestParameters
- * ParameterHelper a = new ParameterHelper(params);
- *
- * If you wish to use pdf export instead of normal printer output, set also the reference type to 'pdf'
- * a.setReferenceType("pdf");
- *
- *
- * For MS Office:
- * create a ParameterHelper and set the reference type to 'msoffice'
- * ParameterHelper a = new ParameterHelper(params);
- * a.setReferenceType("msoffice");
- *
- * within windows it's better to set also a printer name so it's simply possible to use for normal work the default printer
- * and for such tests with ConvWatch a extra printer.
- * a.setPrinterName("CrossOffice Printer");
- *
- */
-
-public class ParameterHelper
-{
- /*
- TODO:
- Possible reference types are currently
- // ooo
- // pdf
- // msoffice
- */
- private String m_sReferenceType = null;
-
- private String m_sPrinterName = null;
-
- private static final int m_nResolutionInDPI = 180;
-
- private String m_sInputPath = null;
- private String m_sOutputPath = null;
-
- private final TestParameters m_aCurrentParams;
-
- public ParameterHelper(TestParameters param)
- {
- m_aCurrentParams = param;
- }
-
-
- protected TestParameters getTestParameters()
- {
- return m_aCurrentParams;
- }
-
- /**
- * @return the input path, if given.
- */
- public String getInputPath()
- {
- if (m_sInputPath == null)
- {
- String sInputPath = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_INPUT_PATH );
- if (sInputPath == null || sInputPath.length() == 0)
- {
- GlobalLogWriter.println("Please set input path (path to documents) " + PropertyName.DOC_COMPARATOR_INPUT_PATH + "=path.");
- }
- else
- {
- m_sInputPath = helper.StringHelper.removeQuoteIfExists(sInputPath);
- }
- }
- return m_sInputPath;
- }
-
- public String getOutputPath()
- {
- if (m_sOutputPath == null)
- {
- String sOutputPath = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
- if (sOutputPath == null || sOutputPath.length() == 0)
- {
- GlobalLogWriter.println("Please set output path (path where to store document results) " + PropertyName.DOC_COMPARATOR_OUTPUT_PATH + "=path.");
- }
- else
- {
- m_sOutputPath = helper.StringHelper.removeQuoteIfExists(sOutputPath);
- }
- }
- return m_sOutputPath;
- }
-
- public boolean isIncludeSubDirectories()
- {
- boolean bIncludeSubdirectories = true;
- String sRECURSIVE = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_INCLUDE_SUBDIRS );
-// TODO: I need to get the boolean value with get("name") because, if it is not given getBool() returns
-// with a default of 'false' which is not very helpful if the default should be 'true'
-// maybe a getBoolean("name", true) could be a better choice.
- if (sRECURSIVE == null)
- {
- sRECURSIVE = "true";
- }
- if (sRECURSIVE.equalsIgnoreCase("no") ||
- sRECURSIVE.equalsIgnoreCase("false"))
- {
- bIncludeSubdirectories = false;
- }
- return bIncludeSubdirectories;
- }
-
- public String getReferenceType()
- {
- if (m_sReferenceType == null)
- {
- // REFERENCE_TYPE ----------
-
- String sReferenceType = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_REFERENCE_TYPE );
- if (sReferenceType == null || sReferenceType.length() == 0)
- {
- m_sReferenceType = "ps";
- }
- else
- {
- m_sReferenceType = sReferenceType;
- }
- }
- return m_sReferenceType;
- }
-
- public String getPrinterName()
- {
- if (m_sPrinterName == null)
- {
- // PRINTER_NAME ----------
-
- String sPrinterName = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_PRINTER_NAME );
- if (sPrinterName == null || sPrinterName.length() == 0)
- {
- m_sPrinterName = "";
- }
- else
- {
- m_sPrinterName = sPrinterName;
- }
- }
- return m_sPrinterName;
- }
-
- private PerformanceContainer m_aPerformanceContainer = null;
- /**
- * helper class for performance analyser features
- */
- public PerformanceContainer getPerformance()
- {
- if (m_aPerformanceContainer == null)
- {
- m_aPerformanceContainer = new PerformanceContainer();
- }
- return m_aPerformanceContainer;
- }
-
- /**
- * Helper function to get the buildid of the current used OpenOffice.org
- * out of the AppExecutionCommand the build ID
- */
- public String getBuildID()
- {
- String sAPP = (String)m_aCurrentParams.get(util.PropertyName.APP_EXECUTION_COMMAND);
-// TODO: here we need the getBuildID(string) method
- String sBuildID = BuildID.getBuildID(sAPP);
- return sBuildID;
- }
-
- /**
- * @return integer value, which contain resolution in DPI.
- */
- public int getResolutionInDPI()
- {
- return m_nResolutionInDPI;
- }
- // get methods
- public XMultiServiceFactory getMultiServiceFactory()
- {
- XMultiServiceFactory xMSF = m_aCurrentParams.getMSF();
-
- // check if MultiServiceFactory is given
- if (getReferenceType().equalsIgnoreCase("pdf") ||
- getReferenceType().equalsIgnoreCase("ps") ||
- getReferenceType().equalsIgnoreCase("ooo") ||
- getReferenceType().equalsIgnoreCase("o3") )
- {
- if (xMSF == null)
- {
- GlobalLogWriter.println("ERROR! MultiServiceFactory not given.");
- }
- }
- return xMSF;
- }
-
- // Hidden = true hiddes a used OpenOffice.org, all code is executed in the background
- // This parameter is not used for RefType: msoffice
- // boolean m_bHidden = true;
-
-
- public boolean isHidden()
- {
- // HIDDEN
-
- String sOfficeViewable = (String)m_aCurrentParams.get(PropertyName.OFFICE_VIEWABLE);
- if (sOfficeViewable != null)
- {
- return !(sOfficeViewable.toLowerCase().equals("yes") ||
- sOfficeViewable.toLowerCase().equals("true"));
- }
- return true; /* default: hidden */
- }
-
- // get/set for FilterName
- // get the right Filtername (internal Name) from
- // http://framework.openoffice.org/files/documents/25/897/filter_description.html
-
- private String m_sImportFilterName = "";
- private String m_sExportFilterName = "";
- public void setImportFilterName(String _sImportFilterName)
- {
- m_sImportFilterName = _sImportFilterName;
- }
- public String getImportFilterName()
- {
- return m_sImportFilterName;
- }
- public void setExportFilterName(String _sExportFilterName)
- {
- m_sExportFilterName = _sExportFilterName;
- }
- public String getExportFilterName()
- {
- return m_sExportFilterName;
- }
- private String m_sDocumentType = "";
- public void setDocumentType(String _sName)
- {
- m_sDocumentType = _sName;
- }
- public String getDocumentType()
- {
- return m_sDocumentType;
- }
-
-
- // Pages -------------------------------------------------------------------
-
- /**
- * @return the number of pages to be print
- */
- public int getMaxPages()
- {
- // default is 0 (print all pages)
- int nMaxPages = m_aCurrentParams.getInt( PropertyName.DOC_COMPARATOR_PRINT_MAX_PAGE );
- return nMaxPages;
- }
-
- /**
- * @return as string, which pages should be print, e.g. '1-4;6' here, page 1 to 4 and page 6.
- */
- public String getOnlyPages()
- {
- // default is null, there is no page which we want to print only.
- String sOnlyPage = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_PRINT_ONLY_PAGE);
- if (sOnlyPage == null)
- {
- sOnlyPage = "";
- }
- return sOnlyPage;
- }
-
- /**
- * @return true, if there should not print all pages at all, use getMaxPages() and or getOnlyPages() to get which pages to print
- */
- public boolean printAllPages()
- {
- return !((getMaxPages() > 0) || (getOnlyPages().length() != 0));
- }
-
- public boolean getOverwrite()
- {
- boolean bOverwrite = m_aCurrentParams.getBool( PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE);
- return bOverwrite;
- }
-
- private String m_sHTMLPrefix = null;
- public String getHTMLPrefix()
- {
- if (m_sHTMLPrefix == null)
- {
- String sPrefix = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX );
- if (sPrefix == null || sPrefix.length() == 0)
- {
- GlobalLogWriter.println("Please set html prefix " + PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX + "=prefix.");
- }
- else
- {
- m_sHTMLPrefix = sPrefix;
- }
- }
- return m_sHTMLPrefix;
- }
-
- public boolean createSmallPictures()
- {
- return !m_aCurrentParams.getBool(PropertyName.NO_SMALL_PICTURES);
- }
-
-}
diff --git a/qadevOOo/runner/graphical/PerformanceContainer.java b/qadevOOo/runner/graphical/PerformanceContainer.java
deleted file mode 100644
index 0ebda690f5c5..000000000000
--- a/qadevOOo/runner/graphical/PerformanceContainer.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.io.RandomAccessFile;
-
-
-public class PerformanceContainer {
- /*
- simple helper functions to start/stop a timer, to know how long a process need in milliseconds
- */
- private long getStartTime()
- {
- return System.currentTimeMillis();
- }
- public void setStartTime(long _nStartTime)
- {
- }
-
- /*
- return the time, which is done until last startTime()
- */
- private long meanTime(long _nCurrentTimer)
- {
- if (_nCurrentTimer == 0)
- {
- GlobalLogWriter.println("Forgotten to initialise a start timer.");
- return 0;
- }
- long nMeanTime = System.currentTimeMillis();
- return nMeanTime - _nCurrentTimer;
- }
-
- /*
- public long stopTimer()
- {
- if (m_nStartTime == 0)
- {
- System.out.println("Forgotten to initialise start timer.");
- return 0;
- }
- long nStopTime = System.currentTimeMillis();
- return nStopTime - m_nStartTime;
- }
- */
-
- final static int Load = 0;
- final static int Store = 1;
- final static int Print = 2;
- final static int OfficeStart = 3;
- final static int StoreAsPDF = 4;
- final static int OfficeStop = 5;
- final static int AllTime = 6;
- private final static int LAST_VALUE = 7; // THIS MUST BE ALWAYS THE LAST AND THE BIGGEST VALUE!
-
- private long m_nTime[];
- private String m_sMSOfficeVersion;
-
- public PerformanceContainer()
- {
- m_nTime = new long[LAST_VALUE];
- // @todo: is this need?
- for (int i=0;i<LAST_VALUE;i++)
- {
- m_nTime[i] = 0;
- }
- }
-
- public void setTime(int _nIndex, long _nValue)
- {
- m_nTime[_nIndex] = _nValue;
- }
- public long getTime(int _nIndex)
- {
- return m_nTime[_nIndex];
- }
-
- public void startTime(int _nIndex)
- {
- m_nTime[_nIndex] = getStartTime();
- }
-
- public void stopTime(int _nIndex)
- {
- m_nTime[_nIndex] = meanTime(m_nTime[_nIndex]);
- }
-
- public String getMSOfficeVersion()
- {
- return m_sMSOfficeVersion;
- }
-
- public void print(PrintStream out)
- {
- out.println("loadtime=" + m_nTime[ Load ]);
- out.println("storetime=" + m_nTime[ Store ]);
- out.println("printtime=" + m_nTime[ Print ]);
- out.println("officestarttime=" + m_nTime[ OfficeStart ]);
- out.println("officestoptime=" + m_nTime[ OfficeStop ]);
- out.println("storeaspdftime=" + m_nTime[ StoreAsPDF ]);
- out.println("alltime=" + m_nTime[ AllTime ]);
- }
-
- public void print(IniFile _aIniFile, String _sSection)
- {
- _aIniFile.insertValue(_sSection, "loadtime" , String.valueOf(m_nTime[ Load ]));
- _aIniFile.insertValue(_sSection, "storetime" , String.valueOf(m_nTime[ Store ]));
- _aIniFile.insertValue(_sSection, "printtime" , String.valueOf(m_nTime[ Print ]));
- _aIniFile.insertValue(_sSection, "officestarttime" , String.valueOf(m_nTime[ OfficeStart ]));
- _aIniFile.insertValue(_sSection, "officestoptime" , String.valueOf(m_nTime[ OfficeStop ]));
- _aIniFile.insertValue(_sSection, "storeaspdftime" , String.valueOf(m_nTime[ StoreAsPDF ]));
- _aIniFile.insertValue(_sSection, "alltime" , String.valueOf(m_nTime[ AllTime ]));
- }
-
- private static double stringToDouble(String _sStr)
- {
- double nValue = 0;
- try
- {
- nValue = Double.parseDouble( _sStr );
- }
- catch (NumberFormatException e)
- {
- GlobalLogWriter.println("Can't convert string to double " + _sStr);
- }
- return nValue;
- }
-
- private static long secondsToMilliSeconds(double _nSeconds)
- {
- return (long)(_nSeconds * 1000.0);
- }
-
- /*
- Helper function, which read some values from a given file
-
- sample of wordinfofile
- name=c:\doc-pool\wntmsci\samples\msoffice\word\LineSpacing.doc
- WordVersion=11.0
- WordStartTime=0.340490102767944
- WordLoadTime=0.650935888290405
- WordPrintTime=0.580835103988647
- */
- public void readWordValuesFromFile(String sFilename)
- {
- File aFile = new File(sFilename);
- if (! aFile.exists())
- {
- GlobalLogWriter.println("couldn't find file " + sFilename);
- return;
- }
-
- RandomAccessFile aRandomAccessFile = null;
- try
- {
- aRandomAccessFile = new RandomAccessFile(aFile,"r");
- String sLine = "";
- while (sLine != null)
- {
- sLine = aRandomAccessFile.readLine();
- if ( (sLine != null) &&
- (sLine.length() >= 2 ) &&
- (! sLine.startsWith("#")))
- {
- if (sLine.startsWith("WordStartTime="))
- {
- String sTime = sLine.substring(14);
- m_nTime[OfficeStart] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordLoadTime="))
- {
- String sTime = sLine.substring(13);
- m_nTime[Load] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordPrintTime="))
- {
- String sTime = sLine.substring(14);
- m_nTime[Print] = secondsToMilliSeconds(stringToDouble(sTime));
- }
- else if (sLine.startsWith("WordVersion="))
- {
- String sMSOfficeVersion = sLine.substring(12);
- m_sMSOfficeVersion = "Word:" + sMSOfficeVersion;
- }
- else if (sLine.startsWith("ExcelVersion="))
- {
- String sMSOfficeVersion = sLine.substring(13);
- m_sMSOfficeVersion = "Excel:" + sMSOfficeVersion;
- }
- else if (sLine.startsWith("PowerPointVersion="))
- {
- String sMSOfficeVersion = sLine.substring(18);
- m_sMSOfficeVersion = "PowerPoint:" + sMSOfficeVersion;
- }
- }
- }
- }
- catch (java.io.FileNotFoundException fne)
- {
- GlobalLogWriter.println("couldn't open file " + sFilename);
- GlobalLogWriter.println("Message: " + fne.getMessage());
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.println("Exception while reading file " + sFilename);
- GlobalLogWriter.println("Message: " + ie.getMessage());
- }
- try
- {
- aRandomAccessFile.close();
- }
- catch (java.io.IOException ie)
- {
- GlobalLogWriter.println("Couldn't close file " + sFilename);
- GlobalLogWriter.println("Message: " + ie.getMessage());
- }
- }
-
-}
diff --git a/qadevOOo/runner/graphical/PixelCounter.java b/qadevOOo/runner/graphical/PixelCounter.java
deleted file mode 100644
index e9220257a05c..000000000000
--- a/qadevOOo/runner/graphical/PixelCounter.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-
-
-abstract class CountPixel
-{
- protected int m_nCount = 0;
- public int getCount() {return m_nCount;}
- public abstract void count(int _nRGB);
-}
-
-
-class CountNotWhite extends CountPixel
-{
- @Override
- public void count(final int pixel)
- {
- // final int alpha = (pixel >> 24) & 0xff;
- final int blue = (pixel ) & 0xff;
- if (blue != 0xff)
- {
- ++m_nCount;
- return;
- }
- final int green = (pixel >> 8) & 0xff;
- if (green != 0xff)
- {
- ++m_nCount;
- return;
- }
- final int red = (pixel >> 16) & 0xff;
- if (red != 0xff)
- {
- ++m_nCount;
- return;
- }
- }
-}
-
-
-class CountNotBlack extends CountPixel
-{
- @Override
- public void count(final int pixel)
- {
- // final int alpha = (pixel >> 24) & 0xff;
- final int blue = (pixel ) & 0xff;
- if (blue != 0x00)
- {
- ++m_nCount;
- return;
- }
- final int green = (pixel >> 8) & 0xff;
- if (green != 0x00)
- {
- ++m_nCount;
- return;
- }
- final int red = (pixel >> 16) & 0xff;
- if (red != 0x00)
- {
- ++m_nCount;
- return;
- }
- }
-}
-
-
-class graphics_stuff
-{
- private static void countPixel(ImageHelper img, int _w, int _h, CountPixel _aPixelCounter)
- {
- for (int y = 0; y < _h; y++) {
- for (int x = 0; x < _w; x++) {
- _aPixelCounter.count(img.getPixel(x,y));
- }
- }
- }
- public static int countNotWhitePixel(ImageHelper _aImage)
- {
- final int w = _aImage.getWidth();
- final int h = _aImage.getHeight();
-
- CountPixel aCountNotWhite = new CountNotWhite();
- countPixel(_aImage, w, h, aCountNotWhite);
- return aCountNotWhite.getCount();
- }
-
- public static int countNotBlackPixel(ImageHelper _aImage)
- {
- final int w = _aImage.getWidth();
- final int h = _aImage.getHeight();
-
- CountPixel aCountNotBlack = new CountNotBlack();
- countPixel(_aImage, w, h, aCountNotBlack);
- return aCountNotBlack.getCount();
- }
-}
-
-
-
-public class PixelCounter {
-
- private int countNotWhitePixel(String _sFile)
- throws java.io.IOException
- {
- ImageHelper aImage = ImageHelper.createImageHelper(_sFile);
- final int nw = graphics_stuff.countNotWhitePixel(aImage);
- return nw;
- }
-
- private int countNotBlackPixel(String _sFile)
- throws java.io.IOException
- {
- ImageHelper aImage = ImageHelper.createImageHelper(_sFile);
- final int nw = graphics_stuff.countNotBlackPixel(aImage);
- return nw;
- }
-
- public static int countNotWhitePixelsFromImage(String _sFile)
- throws java.io.IOException
- {
- PixelCounter a = new PixelCounter();
- return a.countNotWhitePixel(_sFile);
- }
-
- public static int countNotBlackPixelsFromImage(String _sFile)
- throws java.io.IOException
- {
- PixelCounter a = new PixelCounter();
- return a.countNotBlackPixel(_sFile);
- }
-
-
-}
-
-
diff --git a/qadevOOo/runner/graphical/PostscriptCreator.java b/qadevOOo/runner/graphical/PostscriptCreator.java
deleted file mode 100644
index 6a27dea78eec..000000000000
--- a/qadevOOo/runner/graphical/PostscriptCreator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class PostscriptCreator extends EnhancedComplexTestCase
-{
-
- @Override
- public String[] getTestMethodNames()
- {
- return new String[]{"DocumentToPostscript"};
- }
-
- /**
- * test function.
- */
- public void DocumentToPostscript()
- {
- GlobalLogWriter.set(log);
- ParameterHelper aParam = new ParameterHelper(param);
-
- param.put(util.PropertyName.OFFICE_CLOSE_TIME_OUT, 2000);
- // run through all documents found in Inputpath
- foreachDocumentinInputPath(aParam);
- }
-
-
- public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException
- {
- GlobalLogWriter.println(" Document: " + _sDocumentName);
- GlobalLogWriter.println(" results: " + _sResult);
- IOffice aOffice = new Office(_aParams, _sResult);
-
- PerformanceContainer a = new PerformanceContainer();
- a.startTime(PerformanceContainer.AllTime);
-
- a.startTime(PerformanceContainer.OfficeStart);
- aOffice.start();
- a.stopTime(PerformanceContainer.OfficeStart);
-
- try
- {
- a.startTime(PerformanceContainer.Load);
- aOffice.load(_sDocumentName);
- a.stopTime(PerformanceContainer.Load);
-
- a.startTime(PerformanceContainer.Print);
- aOffice.storeAsPostscript();
- a.stopTime(PerformanceContainer.Print);
- }
- finally
- {
- a.startTime(PerformanceContainer.OfficeStop);
- aOffice.close();
- a.stopTime(PerformanceContainer.OfficeStop);
-
- a.stopTime(PerformanceContainer.AllTime);
-
- a.print( System.out );
- }
- }
-}
diff --git a/qadevOOo/runner/graphical/PropertyName.java b/qadevOOo/runner/graphical/PropertyName.java
deleted file mode 100644
index bb71f95c8ed5..000000000000
--- a/qadevOOo/runner/graphical/PropertyName.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public interface PropertyName
-{
- String DOC_COMPARATOR_INPUT_PATH = "DOC_COMPARATOR_INPUT_PATH";
- String DOC_COMPARATOR_OUTPUT_PATH = "DOC_COMPARATOR_OUTPUT_PATH";
- String DOC_COMPARATOR_REFERENCE_TYPE = "DOC_COMPARATOR_REFERENCE_CREATOR_TYPE";
- String DOC_COMPARATOR_PRINTER_NAME = "DOC_COMPARATOR_PRINTER_NAME";
- String DOC_COMPARATOR_INCLUDE_SUBDIRS = "DOC_COMPARATOR_INCLUDE_SUBDIRS";
- String DOC_COMPARATOR_PRINT_MAX_PAGE = "DOC_COMPARATOR_PRINT_MAX_PAGE";
- String DOC_COMPARATOR_PRINT_ONLY_PAGE = "DOC_COMPARATOR_PRINT_ONLY_PAGE";
-
- String DOC_COMPARATOR_OVERWRITE_REFERENCE = "DOC_COMPARATOR_OVERWRITE_REFERENCE";
-
- String DOC_COMPARATOR_HTML_OUTPUT_PREFIX = "DOC_COMPARATOR_HTML_OUTPUT_PREFIX";
-
-
- String OFFICE_VIEWABLE = "OFFICE_VIEWABLE";
-
- String NO_SMALL_PICTURES = "NoSmallPictures";
-}
diff --git a/qadevOOo/runner/graphical/TimeHelper.java b/qadevOOo/runner/graphical/TimeHelper.java
deleted file mode 100644
index 72809828ca0e..000000000000
--- a/qadevOOo/runner/graphical/TimeHelper.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-import java.util.Calendar;
-
-public class TimeHelper
-{
- /*
- wait a second the caller don't need to handle the interruptexception
- @param _nSeconds how long should we wait
- @param _sReason give a good reason, why we have to wait
- */
- static void waitInSeconds(int _nSeconds, String _sReason)
- {
- GlobalLogWriter.println("Wait 0.25 * " + _nSeconds + " sec. Reason: " + _sReason);
- try {
- java.lang.Thread.sleep(250L * _nSeconds);
- } catch (InterruptedException e2) {}
- }
-
- private int m_nSeconds;
- private int m_nMilliSeconds;
- private long m_nRealMilliSeconds;
-
- public void start()
- {
- Calendar cal = Calendar.getInstance();
- m_nSeconds = cal.get(Calendar.SECOND);
- m_nMilliSeconds = cal.get(Calendar.MILLISECOND);
- }
- public void stop()
- {
- Calendar cal = Calendar.getInstance();
- 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
deleted file mode 100644
index 647dfb750760..000000000000
--- a/qadevOOo/runner/graphical/Tolerance.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class Tolerance
-{
- private final int m_nTolerance;
- public Tolerance(int _nAccept)
- {
- m_nTolerance = _nAccept;
- }
- public int getAccept()
- {
- return m_nTolerance;
- }
-}
diff --git a/qadevOOo/runner/graphical/WrongEnvironmentException.java b/qadevOOo/runner/graphical/WrongEnvironmentException.java
deleted file mode 100644
index fe60de560f27..000000000000
--- a/qadevOOo/runner/graphical/WrongEnvironmentException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class WrongEnvironmentException extends OfficeException
-{
- public WrongEnvironmentException(String _aMessage)
- {
- super(_aMessage);
- }
- public WrongEnvironmentException(String _aMessage, Throwable cause)
- {
- super(_aMessage, cause);
- }
-}
diff --git a/qadevOOo/runner/graphical/WrongSuffixException.java b/qadevOOo/runner/graphical/WrongSuffixException.java
deleted file mode 100644
index 6140ace7447f..000000000000
--- a/qadevOOo/runner/graphical/WrongSuffixException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package graphical;
-
-public class WrongSuffixException extends OfficeException
-{
- public WrongSuffixException(String _aMessage)
- {
- super(_aMessage);
- }
-}
diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java
index e698d47104f3..72346a2e7dad 100644
--- a/qadevOOo/runner/helper/ConfigurationRead.java
+++ b/qadevOOo/runner/helper/ConfigurationRead.java
@@ -19,7 +19,6 @@ package helper;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.container.XHierarchicalNameAccess;
-import com.sun.star.container.XNameAccess;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyState;
@@ -71,21 +70,6 @@ public class ConfigurationRead {
this(xMSF, "org.openoffice.Setup");
}
-
-
-
- /**
- * Get the elements of the root node.
- * @return All elements of the root node.
- */
- public String[] getRootNodeNames() {
- XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, root);
- String[]names = xName.getElementNames();
- return names;
- }
-
-
-
/**
* Get contents of a node by its hierarchical name.
* @param name The hierarchical name of the node.
diff --git a/qadevOOo/runner/helper/InetTools.java b/qadevOOo/runner/helper/InetTools.java
deleted file mode 100644
index 1ab8a2fe68a9..000000000000
--- a/qadevOOo/runner/helper/InetTools.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package helper;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-
-// access the implementations via names
-import com.sun.star.util.XChangesBatch;
-
-import lib.TestParameters;
-
-
-public class InetTools {
- /**
- * Helper method: sets the HTTP-Proxy to values from
- * <code>lib.TestParameters</code>
- */
- public static boolean setHTTPProxy(TestParameters param){
- XMultiServiceFactory xMSF = param.getMSF();
- PropertyValue[] ProvArgs = new PropertyValue[1];
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "nodepath";
- Arg.Value = "/org.openoffice.Inet/Settings";
- ProvArgs[0] = Arg;
-
- try {
- Object oProvider = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider");
-
- XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface(
- XMultiServiceFactory.class,
- oProvider);
-
- Object oInet = oProviderMSF.createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationUpdateAccess",
- ProvArgs);
-
- XPropertySet oInetProps = UnoRuntime.queryInterface(
- XPropertySet.class, oInet);
-
- String HTTPProxyName = (String)param.get("HTTPProxyName");
- String HTTPProxyPort = (String)param.get("HTTPProxyPort");
-
- if ((HTTPProxyName == null) || (HTTPProxyPort == null)) {
- return false;
- }
-
- oInetProps.setPropertyValue("ooInetHTTPProxyName", HTTPProxyName);
- oInetProps.setPropertyValue("ooInetHTTPProxyPort", HTTPProxyPort);
- oInetProps.setPropertyValue("ooInetProxyType", Long.valueOf(2));
-
- XChangesBatch oSecureChange = UnoRuntime.queryInterface(
- XChangesBatch.class, oInet);
- oSecureChange.commitChanges();
- }
- catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
- }
- return true;
- }
-}
diff --git a/qadevOOo/runner/helper/OSHelper.java b/qadevOOo/runner/helper/OSHelper.java
index 212a01b1655c..242647153a50 100644
--- a/qadevOOo/runner/helper/OSHelper.java
+++ b/qadevOOo/runner/helper/OSHelper.java
@@ -47,9 +47,4 @@ public class OSHelper
System.getProperty("os.arch").equals("i386");
}
- public static boolean isUnix()
- {
- return isLinuxIntel() || isSolarisIntel() || isSolarisSparc();
- }
-
}
diff --git a/qadevOOo/runner/helper/ObjectInspectorModelImpl.java b/qadevOOo/runner/helper/ObjectInspectorModelImpl.java
deleted file mode 100644
index b0135cd84fe5..000000000000
--- a/qadevOOo/runner/helper/ObjectInspectorModelImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package helper;
-
-import com.sun.star.inspection.PropertyCategoryDescriptor;
-import com.sun.star.inspection.XObjectInspectorModel;
-
-/**
- * This is an implementation of <CODE>ObjectInspectorModel</CODE>.
- * @see com.sun.star.inspection.XObjectInspectorModel
- */
-public class ObjectInspectorModelImpl implements XObjectInspectorModel{
-
- /**
- * class variable which contains the implementations of
- * <CODE>PropertyCategoryDescriptor</CODE>
- * @see com.sun.star.inspection.PropertyCategoryDescriptor
- */
- PropertyCategoryDescriptor[] m_Categories;
-
- /**
- * class variable which contains the count of implementations of
- * <CODE>PropertyCategoryDescriptor</CODE>
- */
- int m_count;
-
- /**
- * Creates a new instance of ObjectInspectorModelImpl
- * For every count given in parameter <CODE>count</CODE> an
- * <CODE>PropertyCategoryDescriptor</CODE> was created an filled with valuable content.
- * @param count count of <CODE>PropertyCategoryDescriptor</CODE> to create
- */
- public ObjectInspectorModelImpl(int count) {
- m_count = count;
- m_Categories = new PropertyCategoryDescriptor[m_count];
- int CategoryMem = 0;
- int inCat = 0;
- for (int n=0; n < m_count; n++ ){
-
- m_Categories[n] = new PropertyCategoryDescriptor();
-
- int category = n / 2;
- inCat =(CategoryMem == category)? ++inCat: 1;
- CategoryMem = category;
-
- m_Categories[n].ProgrammaticName = "Category" + category;
- m_Categories[n].UIName = "Category" + category + "Number" + inCat;
- m_Categories[n].HelpURL = "h:" + n;
- }
- }
-
- /**
- * returns the catrgories
- * @return returns the catrgories
- */
- public PropertyCategoryDescriptor[] describeCategories() {
- return m_Categories;
- }
-
- /**
- * returns currently nothing
- * @return nothing
- */
- public Object[] getHandlerFactories() {
- return null;
- }
-
- /** determines whether the object inspector should have a help section
- @return false
- */
- public boolean getHasHelpSection() {
- return false;
- }
-
- /** returns minimum number of lines in the help text section.
- @return 3
- */
- public int getMinHelpTextLines() {
- return 3;
- }
-
- /** returns maximum number of lines in the help text section.
- @return 8
- */
- public int getMaxHelpTextLines() {
- return 8;
- }
-
- /** returns whether or not the inspector's UI should be read-only
- */
- public boolean getIsReadOnly() {
- return false;
- }
-
- /** sets the inspector's read-only state
- */
- public void setIsReadOnly( boolean _IsReadOnly ) {
- // not supported, and not used so far in our test cases
- }
-
- /**
- * retrieves an index in a global property ordering, for a given property name
- * @param UIName the property whose global order index should be retrieved
- * @return the global order index of PropertyName
- */
- public int getPropertyOrderIndex(String UIName) {
- int index = 0;
- for (int n=0; n < m_Categories.length; n++){
- if (m_Categories[n].UIName.equals(UIName)){
- index = n;
- break;
- }
- }
- return index;
- }
-
- }
diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java
index 9e0b352e55eb..9105a86b673b 100644
--- a/qadevOOo/runner/helper/ProcessHandler.java
+++ b/qadevOOo/runner/helper/ProcessHandler.java
@@ -119,7 +119,6 @@ public class ProcessHandler
private int exitValue = -1;
private boolean isFinished = false;
private boolean isStarted = false;
- private boolean mbTimedOut = false;
private long mTimeOut = 0;
private String stdInBuff = "";
private Pump stdout = null;
@@ -145,57 +144,6 @@ public class ProcessHandler
}
/**
- * Creates instance with specified external command
- * including parameters as an array.
- * Debug info and output
- * of external command is printed to stdout.
- */
- public ProcessHandler(String[] cmdLines)
- {
- this(null, null, null, null, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
- * Creates instance with specified external command
- * including parameters as an array, with environment
- * variables.
- * Debug info and output
- * of external command is printed to stdout.
- * @see java.lang.Runtime exec(String[], String[])
- */
- public ProcessHandler(String[] cmdLines, String[] envVars)
- {
- this(null, null, null, envVars, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
- * Creates instance with specified external command
- * including parameters as an array, with environment
- * variables. The command will be started in workDir.
- * Debug info and output
- * of external command is printed to stdout.
- */
- public ProcessHandler(String[] cmdLines, File workDir)
- {
- this(null, null, workDir, null, 0);
- cmdLineArray = cmdLines;
-
- }
-
- /**
- * Creates instance with specified external command and
- * log stream where debug info and output
- * of external command is printed out. The command will be started in workDir.
- */
- public ProcessHandler(String[] cmdLines, PrintWriter log, File workDir)
- {
- this(null, log, workDir, null, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
* Creates instance with specified external command and
* log stream where debug info and output
* of external command is printed out.
@@ -215,40 +163,6 @@ public class ProcessHandler
/**
* Creates instance with specified external command which
- * will be executed in the some work directory.
- * Debug info and output
- * of external commandis printed to stdout.
- */
- public ProcessHandler(String cmdLine, File workDir)
- {
- this(cmdLine, null, workDir, null, 0);
- }
-
- /**
- * Creates instance with specified external command which
- * will be executed in the some work directory.
- * Debug info and output printed in log stream.
- */
- public ProcessHandler(String cmdLine, PrintWriter log, File workDir)
- {
- this(cmdLine, log, workDir, null, 0);
- }
-
- /**
- * Creates instance with specified external command which
- * will be executed in the some work directory and
- * log stream where debug info and output
- * of external command is printed .
- * The specified environment variables are set for the new process.
- * If log stream is null, logging is printed to stdout.
- */
- public ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars)
- {
- this(cmdLine, log, workDir, envVars, 0);
- }
-
- /**
- * Creates instance with specified external command which
* will be executed in the some work directory and
*
* @param cmdLine the command to be executed
@@ -323,22 +237,6 @@ public class ProcessHandler
}
/**
- * If not equal 0, the time to maximal wait.
- */
- public void setProcessTimeout(int _n)
- {
- m_nProcessTimeout = _n;
- }
-
- /**
- * This command will call after ProcessTimeout is arrived.
- */
- public void setProcessKiller(String _s)
- {
- m_sProcessKiller = _s;
- }
-
- /**
* This method do an asynchronous execution of the commands. To avoid a interruption on long running processes
* caused by <CODE>OfficeWatcher</CODE>, the OfficeWatcher get frequently a ping.
* @see helper.OfficeWatcher
@@ -394,16 +292,6 @@ public class ProcessHandler
}
}
- public boolean isTimedOut()
- {
- return mbTimedOut;
- }
-
- private void setTimedOut(boolean bTimedOut)
- {
- mbTimedOut = bTimedOut;
- }
-
/**
* Executes the command and returns only when the process
* exits.
@@ -476,26 +364,6 @@ public class ProcessHandler
isStarted = false;
}
- /**
- * Returns the time in seconds since 1st January 1970
- */
- private static long getSystemTime()
- {
- final long nTime = System.currentTimeMillis();
- return nTime;
- }
- private long m_nExactStartTimeInMillisec;
-
- private void initialExactStartTime()
- {
- m_nExactStartTimeInMillisec = getSystemTime();
- }
-
- public long getProcessStartTime()
- {
- return m_nExactStartTimeInMillisec;
- }
-
private void showEnvVars()
{
if (envVars != null)
@@ -530,7 +398,6 @@ public class ProcessHandler
}
showEnvVars();
log.println("");
- initialExactStartTime();
initializeProcessKiller();
m_aProcess = runtime.exec(cmdLineArray, envVars);
}
@@ -650,7 +517,6 @@ public class ProcessHandler
}
if (timeout < 0)
{
- setTimedOut(true);
log.println("The process has timed out!");
}
}
diff --git a/qadevOOo/runner/helper/PropertyHelper.java b/qadevOOo/runner/helper/PropertyHelper.java
deleted file mode 100644
index b5391cd40823..000000000000
--- a/qadevOOo/runner/helper/PropertyHelper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package helper;
-
-import java.util.ArrayList;
-
-import com.sun.star.beans.PropertyValue;
-
-public class PropertyHelper
-{
- /**
- Create a PropertyValue[] from a ArrayList
- */
- public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList<PropertyValue> _aPropertyList)
- {
- // copy the whole PropertyValue List to an PropertyValue Array
- PropertyValue[] aSaveProperties;
-
- if (_aPropertyList == null)
- {
- aSaveProperties = new PropertyValue[0];
- }
- else
- {
- aSaveProperties = _aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]);
- }
- return aSaveProperties;
- }
-}
diff --git a/qadevOOo/runner/helper/SimpleMailSender.java b/qadevOOo/runner/helper/SimpleMailSender.java
deleted file mode 100644
index ecdcf214a0a7..000000000000
--- a/qadevOOo/runner/helper/SimpleMailSender.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package helper;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-
-public class SimpleMailSender {
- private String m_MailServer = "unknown";
- private String m_Sender = "unknown";
- private String m_Recipient = "unknown";
- private String m_Subject = "unknown";
- private String m_Message = "unknown";
-
-
- public String getMailServer() {
- return m_MailServer;
- }
-
- public void setMailServer(String server) {
- m_MailServer = server;
- }
-
- public String getSender() {
- return m_Sender;
- }
-
- public void setSender(String sender) {
- m_Sender = sender;
- }
-
- public String getRecipient() {
- return m_Recipient;
- }
-
- public void setRecipient(String recipient) {
- m_Recipient = recipient;
- }
-
- public String getSubject() {
- return m_Subject;
- }
-
- public void setSubject(String subject) {
- m_Subject = subject;
- }
-
- public String getMessage() {
- return m_Message;
- }
-
- public void setMessage(String msg) {
- m_Message = msg;
- }
-
- public void sendMail() {
- if (m_MailServer.equals ("unknown")) {
- System.out.println("No Mailserver given ... exiting");
- return;
- }
- if (m_Recipient.equals ("unknown")) {
- System.out.println("No Recipient given ... exiting");
- return;
- }
- sendMail(m_MailServer,m_Sender,m_Recipient,m_Subject,m_Message);
- }
-
- public void sendMail(String server, String sender,
- String recipient, String subject, String msg) {
- //setting member variables for reuse
- m_MailServer = server;
- m_Sender = sender;
- m_Recipient = recipient;
- m_Subject = subject;
- m_Message = msg;
-
- try {
- Socket socket = new Socket(m_MailServer, 25);
- BufferedReader input =
- new BufferedReader(new InputStreamReader(
- socket.getInputStream(), "8859_1"));
- BufferedWriter output =
- new BufferedWriter(new OutputStreamWriter(
- socket.getOutputStream(), "8859_1"));
-
- sendline(input, output, "HELO " + getHostName());
- sendline(input, output, "MAIL FROM: " + m_Sender);
- sendline(input, output, "RCPT TO: <" + m_Recipient + ">");
- sendline(input, output, "DATA");
- sendline(output, "MIME-Version: 1.0");
- sendline(output, "Subject: " + m_Subject);
- sendline(output, "From: " + m_Sender);
- sendline(output, "To: " + m_Recipient);
- sendline(output,
- "Content-Type: text/html; charset=\"us-ascii\"\r\n");
-
- // Send the body
- sendline(output, m_Message);
-
- sendline(input, output, ".");
- sendline(input, output, "QUIT");
- socket.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void sendline(BufferedReader input,
- BufferedWriter output, String line) {
- try {
- output.write(line + "\r\n");
- output.flush();
- line = input.readLine();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void sendline(BufferedWriter output, String line) {
- try {
- output.write(line + "\r\n");
- output.flush();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private String getHostName() {
- String hostname = "";
-
- try {
- InetAddress addr = InetAddress.getLocalHost();
-
- hostname = addr.getHostName();
- } catch (UnknownHostException e) {
- }
-
- return hostname;
- }
-}
diff --git a/qadevOOo/runner/lib/MultiMethodTest.java b/qadevOOo/runner/lib/MultiMethodTest.java
index aabd919054e3..e7bf886c3223 100644
--- a/qadevOOo/runner/lib/MultiMethodTest.java
+++ b/qadevOOo/runner/lib/MultiMethodTest.java
@@ -98,16 +98,6 @@ public class MultiMethodTest
private final ArrayList<String> methCalled = new ArrayList<String>(10);
/**
- * Disposes the test environment, which was corrupted by the test.
- *
- * @param tEnv the environment to dispose
- */
- public void disposeEnvironment(TestEnvironment tEnv)
- {
- disposeEnvironment();
- }
-
- /**
* Disposes the current test environment, which was corrupted by the test.
*
* @see #disposeEnvironment(TestEnvironment)
diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java
deleted file mode 100644
index 0e1f6ea242f1..000000000000
--- a/qadevOOo/runner/lib/Parameters.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package lib;
-
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.sun.star.beans.Property;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.XPropertySetInfo;
-import com.sun.star.beans.XPropertyChangeListener;
-import com.sun.star.beans.XVetoableChangeListener;
-import com.sun.star.beans.UnknownPropertyException;
-import com.sun.star.uno.Type;
-
-/**
- * Parameters is a container of String parameters.
- */
-public class Parameters implements XPropertySet {
- final private Map<String, Object> parameters;
- private final Parameters defaults;
- private Property[] props;
-
- public Parameters(Map<String, Object> params) {
- this (params, null);
- }
-
- private Parameters(Map<String, Object> params, Parameters defaultParams) {
- parameters = params;
- defaults = defaultParams;
- checkParameters(parameters);
-
- Set<String> paramSet = new HashSet<String>(parameters.keySet());
-
- if (defaults != null) {
- Set<String> defSet = defaults.toMap().keySet();
- paramSet.addAll(defSet);
- }
-
- props = new Property[paramSet.size()];
-
- int num = 0;
-
- for (Iterator<String> i = paramSet.iterator(); i.hasNext(); num++) {
- String name = i.next();
-
- props[num] = new Property(name, num, new Type(String.class), (short)0);
- }
- }
-
-
- public String get(String paramName) {
- Object res = parameters.get(paramName);
-
- if (res instanceof String)
- return (String)res;
-
- if (defaults != null)
- return defaults.get(paramName);
-
- return null;
- }
-
- public Object getPropertyValue(String name) {
- Object erg = parameters.get(name);
- if (erg == null && defaults != null)
- return defaults.getPropertyValue(name);
- return erg;
- }
-
- public void setPropertyValue(String name, Object value) {
- parameters.put(name, value);
- int size = props.length;
- Property[] addProps = new Property[size+1];
- System.arraycopy(props, 0, addProps, 0, size);
- addProps[size] = new Property(name, size, new Type(value.getClass()), (short)0);
- props = addProps;
- }
-
- public void addVetoableChangeListener(String name, XVetoableChangeListener l) {
- }
-
- public void removeVetoableChangeListener(String name, XVetoableChangeListener l) {
- }
-
- public void addPropertyChangeListener(String name, XPropertyChangeListener l) {
- }
-
- public void removePropertyChangeListener(String name, XPropertyChangeListener l) {
- }
-
- public XPropertySetInfo getPropertySetInfo() {
- return new XPropertySetInfo() {
- public Property[] getProperties() {
- return props;
- }
-
- public boolean hasPropertyByName(String name) {
- for (int i = 0; i < props.length; i++) {
- Property prop = props[i];
-
- if (prop.Name.equals(name)) {
- return true;
- }
- }
-
- return false;
- }
-
- public Property getPropertyByName(String name) throws UnknownPropertyException {
- for (int i = 0; i < props.length; i++) {
- Property prop = props[i];
-
- if (prop.Name.equals(name)) {
- return prop;
- }
- }
-
- throw new UnknownPropertyException(name);
- }
- };
- }
-
- private Map<String,Object> toMap() {
- return new HashMap<String,Object>(parameters) {
- };
- }
-
- private static void checkParameters(Map<String, Object> params) {
- for (Iterator<String> i = params.keySet().iterator(); i.hasNext();) {
- Object key = i.next();
-
- if (!(key instanceof String)) {
- throw new IllegalArgumentException(
- "Wrong key " + key + ", it should be of String type");
- }
- }
- }
-
-
-
-
-
-
-}
diff --git a/qadevOOo/runner/lib/SimpleStatus.java b/qadevOOo/runner/lib/SimpleStatus.java
index 631ecc5b2f2f..6866d7e7a24d 100644
--- a/qadevOOo/runner/lib/SimpleStatus.java
+++ b/qadevOOo/runner/lib/SimpleStatus.java
@@ -37,11 +37,6 @@ class SimpleStatus {
public final static int EXCEPTION = 3;
/**
- * The constant represents EXCLUDED runtime state.
- */
- public final static int EXCLUDED = 2;
-
- /**
* The constant represents SKIPPED runtime state.
*/
public final static int SKIPPED = 1;
@@ -84,8 +79,6 @@ class SimpleStatus {
this.runState = runState;
if ( runState == PASSED ) {
runStateString = "PASSED";
- } else if ( runState == EXCLUDED ) {
- runStateString = "EXCLUDED";
} else if ( runState == SKIPPED ) {
runStateString = "SKIPPED";
} else if ( runState == EXCEPTION ) {
diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java
index b2b76daa7935..5bf86fd86888 100644
--- a/qadevOOo/runner/lib/Status.java
+++ b/qadevOOo/runner/lib/Status.java
@@ -119,41 +119,10 @@ public class Status extends SimpleStatus {
}
/**
- * Checks whether the status runstate is skipped.
- */
- public boolean isSkipped() {
- return getRunState() == SKIPPED;
- }
-
- /**
- * Checks whether the status runstate is excluded.
- */
- public boolean isExcluded() {
- return getRunState() == EXCLUDED;
- }
-
- /**
- * Checks whether the status runstate is exception.
- */
- public boolean isException() {
- return getRunState() == EXCEPTION;
- }
-
- /**
* Checks whether the status state is failed.
*/
public boolean isFailed() {
return !getState();
}
- /**
- * Checks whether the status state is ok.
- */
- public boolean isOK() {
- return getState();
- }
-
- public String getDescription () {
- return getRunStateString();
- }
}
diff --git a/qadevOOo/runner/lib/TestResult.java b/qadevOOo/runner/lib/TestResult.java
index eb7a469cdc99..347455da524e 100644
--- a/qadevOOo/runner/lib/TestResult.java
+++ b/qadevOOo/runner/lib/TestResult.java
@@ -67,14 +67,6 @@ public class TestResult {
}
/**
- * @return methods available in the interface tested.
- */
- public String[] getTestedMethods() {
- return testedMethods.keySet().toArray(
- new String[testedMethods.size()]);
- }
-
- /**
* @return <tt>true</tt> if the method belongs to the interface tested,
* <tt>false</tt> otherwise.
*/
diff --git a/qadevOOo/runner/share/ComplexTest.java b/qadevOOo/runner/share/ComplexTest.java
index a7b2412e5685..d5eea53a10fc 100644
--- a/qadevOOo/runner/share/ComplexTest.java
+++ b/qadevOOo/runner/share/ComplexTest.java
@@ -24,7 +24,5 @@ public interface ComplexTest {
String[] getTestMethodNames();
- String getTestObjectName();
-
}
diff --git a/qadevOOo/runner/share/LogWriter.java b/qadevOOo/runner/share/LogWriter.java
index 9edc95407318..0da81654eae8 100644
--- a/qadevOOo/runner/share/LogWriter.java
+++ b/qadevOOo/runner/share/LogWriter.java
@@ -38,12 +38,7 @@ public interface LogWriter {
boolean summary(share.DescEntry entry);
- /**
- * Returns the <CODE>Watcher</CODE> which is associated with this logger
- * @see share.Watcher
- * @return the associated <CODE>Watcher</CODE>
- */
- Object getWatcher();
+
/**
* Set a <CODE>Watcher</CODE> to the <CODE>LogWriter</CODE>
diff --git a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java b/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java
deleted file mode 100644
index 120e72e10362..000000000000
--- a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package stats;
-
-import share.LogWriter;
-import java.text.DecimalFormat;
-import java.util.HashMap;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-/**
- *
- *
- */
-public class ComplexDataBaseOutProducer extends DataBaseOutProducer {
-
- /** Creates a new instance of ComplexDataBaseOutProducer */
- public ComplexDataBaseOutProducer(HashMap<String,String> param) {
- super(param);
- // do we have to write debug output?
- Object o = param.get("DebugIsActive");
- if (o != null) {
- if (o instanceof String) {
- String debug = (String)o;
- m_bDebug = (debug.equalsIgnoreCase("yes") || debug.equalsIgnoreCase("true"));
- }
-
- }
-
- String testBase = (String)mSqlInput.get("TestBase");
- String apiVersion = (String)mSqlInput.get("Version");
- String os = (String)mSqlInput.get("OperatingSystem");
- if (testBase == null || apiVersion == null || os == null) {
- System.err.println("The ComplexDataBaseOutProducer constructor needs this parameters to work correctly:");
- System.err.println("TestBase - " + testBase);
- System.err.println("Version - " + apiVersion);
- System.err.println("OperatingSystem - " + os);
- System.err.println("Add the missing parameter.");
- }
- int sep = testBase.indexOf('_');
- String testLanguage = testBase.substring(0,sep);
- testBase = testBase.substring(sep+1);
-
- // 2do fallback?
- String descriptionString = testLanguage+":"+ os +":"+testBase+":"+apiVersion;
- if (apiVersion != null)
- apiVersion = apiVersion.substring(0, 6);
-
- if (mSqlInput.get("date") == null) {
- // build date if it's not there
- Calendar cal = new GregorianCalendar();
- DecimalFormat dfmt = new DecimalFormat("00");
- String year = Integer.toString(cal.get(GregorianCalendar.YEAR));
- // month is starting with "0"
- String month = dfmt.format(cal.get(GregorianCalendar.MONTH) + 1);
- String day = dfmt.format(cal.get(GregorianCalendar.DATE));
- String dateString = year + "-" + month + "-" + day;
-
- mSqlInput.put("date", dateString);
- }
- mSqlInput.put("test_run_description", descriptionString);
- mSqlInput.put("api_version_name", apiVersion);
- setWriteableEntryTypes(new String[]{"unit", "method"});
- }
-
- /**
- * Prepare the database.
- * @parameter log A log writer
- * @return True, if everything worked.
- */
- @Override
- protected boolean prepareDataBase(LogWriter log) {
- executeSQLCommand("SELECT id AS \"test_run.id\", api_version_id, description, date FROM test_run" +
- " WHERE date = \"$date\" AND description = \"$test_run_description\";", true);
- String id = (String)mSqlInput.get("test_run.id");
- // create an entry for this test run
- if (id == null) {
- executeSQLCommand("SELECT id as api_version_id FROM api_version" +
- " WHERE version = \"$api_version_name\";", true);
- String api_version_id = (String)mSqlInput.get("api_version_id");
- // create an entry for this API
- if (api_version_id == null) {
- executeSQLCommand("INSERT api_version (api_name, version)" +
- " VALUES (\"soapi\", \"$api_version_name\")");
- executeSQLCommand("SELECT id as api_version_id FROM api_version" +
- " WHERE version = \"$api_version_name\";", true);
- }
- executeSQLCommand("INSERT test_run (api_version_id, description, date)" +
- " VALUES ($api_version_id, \"$test_run_description\", \"$date\");");
- executeSQLCommand("SELECT id AS \"test_run.id\", api_version_id, description, date FROM test_run" +
- " WHERE date = \"$date\" AND description = \"$test_run_description\";", true);
- }
- return true;
- }
-
- /**
- * Insert the result of the test of an entry into the database.
- * @parameter log A log writer
- * @return True, if everything worked.
- */
- @Override
- protected boolean insertEntry(LogWriter log) {
-
- if ( m_bDebug ) {
- System.out.println("DEBUG - ComplexDataBaseOutProducer: entry.id has to be null: " + (mSqlInput.get("entry.id")==null));
- System.out.println("DEBUG - ComplexDataBaseOutProducer: EntryLongName: " + mSqlInput.get("EntryLongName"));
- }
- executeSQLCommand("SELECT id as \"entry.id\", name as \"entry.name\" FROM entry WHERE name = \"$EntryLongName\";", true);
-
- if (mSqlInput.get("entry.id") == null) {
- if ( m_bDebug ) {
- System.out.println("DEBUG - ComplexDataBaseOutProducer: No entry.id found, this is a new entry in the database.");
- }
- executeSQLCommand("INSERT entry (name, type)" +
- " VALUES (\"$EntryLongName\", \"$EntryType\");");
- executeSQLCommand("SELECT id as \"entry.id\", name as \"entry.name\" FROM entry WHERE name = \"$EntryLongName\";", true);
- }
-
-
- executeSQLCommand("SELECT id as \"api_entry.id\", api_version_id as \"api_entry.api_version_id\", entry_id as \"api_entry.entry_id\" FROM api_entry" +
- " WHERE entry_id = $entry.id;", true);
- if (mSqlInput.get("api_entry.id") == null) {
- System.out.println("No api_entry.id found");
- executeSQLCommand("INSERT api_entry (entry_id, api_version_id)"+
- " VALUES ($entry.id, $api_version_id);");
- executeSQLCommand("SELECT id as \"api_entry.id\", api_version_id as \"api_entry.api_version_id\", entry_id as \"api_entry.entry_id\" FROM api_entry" +
- " WHERE entry_id = $entry.id;", true);
- }
-
-
- executeSQLCommand("SELECT status as \"test_state.status\" FROM test_state"+
- " WHERE test_run_id = $test_run.id AND entry_id = $entry.id;", true);
-
- String entryState = (String)mSqlInput.get("EntryState");
- String status = (String)mSqlInput.get("test_state.status");
-
- if (!entryState.equals("SKIPPED.FAILED")) { // occurs in case of misspellings: do not make an database entry.
- if (status == null) {
- executeSQLCommand("INSERT test_state (test_run_id, entry_id, status)"+
- " VALUES ($test_run.id, $entry.id, \"$EntryState\");");
- }
- else {
- executeSQLCommand("UPDATE test_state SET status = \"$EntryState\""+
- " where test_run_id =$test_run.id AND entry_id = $entry.id;");
- }
- }
- return true;
- }
-
- public Object getWatcher() {
- return null;
- }
-
- public void setWatcher(Object watcher) {
- }
-
-}
diff --git a/qadevOOo/runner/stats/DataBaseOutProducer.java b/qadevOOo/runner/stats/DataBaseOutProducer.java
deleted file mode 100644
index f362d7e7e498..000000000000
--- a/qadevOOo/runner/stats/DataBaseOutProducer.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package stats;
-
-import share.LogWriter;
-import share.DescEntry;
-
-import java.util.HashMap;
-
-public abstract class DataBaseOutProducer implements LogWriter {
- protected HashMap<String,Object> mSqlInput = null;
- private final HashMap<String, String[]> mSqlOutput = null;
- private String[] mWriteableEntryTypes = null;
- private SQLExecution mSqlExec;
- protected boolean m_bDebug = false;
-
-
- /** Creates a new instance of DataBaseOutProducer
- * @param param The HashMap with test parameters
- */
- public DataBaseOutProducer(HashMap<String,String> param) {
- mSqlInput = new HashMap<String,Object>();
- mSqlInput.putAll(param);
-
- Object o = param.get("DebugIsActive");
- String debug = null;
- if (o instanceof String)
- debug = (String)o;
- else
- debug = o.toString();
- if (debug != null && (debug.equalsIgnoreCase("true") || debug.equalsIgnoreCase("yes"))) {
- m_bDebug = true;
- }
- // set default for writeable entries: method
- setWriteableEntryTypes(new String[]{"method"});
- }
-
- /** initialization
- *
- */
- public boolean initialize(DescEntry entry, boolean active) {
- if (entry.UserDefinedParams != null)
- mSqlInput.putAll(entry.UserDefinedParams);
-
- String jdbcClass = (String)mSqlInput.get("JDBC");
- if (jdbcClass == null)
- jdbcClass = "org.gjt.mm.mysql.Driver";
- String dbURL = (String)mSqlInput.get("DataBaseURL");
- String user = (String)mSqlInput.get("User");
- String password = (String)mSqlInput.get("Password");
- if (user == null)
- user = (String)mSqlInput.get("OperatingSystem");
- if (password == null)
- password = user;
-
- mSqlExec = new SQLExecution(jdbcClass, dbURL, user, password, m_bDebug);
- mSqlExec.openConnection();
- prepareDataBase(entry.Logger);
- return true;
- }
-
- public boolean summary(DescEntry entry) {
- mSqlExec.openConnection();
- findTypeInEntryTree(entry, entry.Logger);
- mSqlExec.closeConnection();
- return true;
- }
-
- /**
- * Step recursively through the entry tree: write all entries of the
- * defined types to the database.
- * @param entry The description entry that is take as root
- * @param log The log writer
- */
- private boolean findTypeInEntryTree(DescEntry entry, LogWriter log) {
- boolean returnVal = true;
- if (isWriteableEntryType(entry)) {
- returnVal &= insertEntry(entry, log);
- }
-
- if (entry.SubEntryCount >0) {
- for (int i=0; i<entry.SubEntryCount; i++) {
- returnVal &= findTypeInEntryTree(entry.SubEntries[i], log);
- }
- }
- // if we are not on method leaf, exit here
- // insert one method result into database
- return returnVal;
- }
-
- /**
- * Insert this entrry to the database.
- * @param entry The entry to write.
- * @param log The log writer.
- */
- private boolean insertEntry(DescEntry entry, LogWriter log) {
- // copy the swlInput HashMap, so it can be reset easily for the next run
- HashMap<String,Object> copySqlInput = new HashMap<String,Object>();
- copySqlInput.putAll(mSqlInput);
- // put some stuff from entry in the HashMap
- mSqlInput.put("EntryLongName", entry.longName);
- mSqlInput.put("EntryName", entry.entryName);
- mSqlInput.put("EntryState", entry.State);
- mSqlInput.put("EntryType", entry.EntryType);
- boolean result = insertEntry(log);
- // reset the Hashtable
- mSqlInput = copySqlInput;
- return result;
-
- }
-
- /**
- * Set the writeable entry types: for example "method", "interface", etc.
- * All these entries are written to the database.
- * @param types A String array with all types that have to be written.
- */
- public void setWriteableEntryTypes(String[] types) {
- mWriteableEntryTypes = types;
- }
-
- /**
- * Is the entry of the writeable entry type?
- * @param entry The entry that is checked
- * @return True, if it is indeed a writeable entry.
- */
- private boolean isWriteableEntryType(DescEntry entry) {
- boolean result = false;
- for (int i=0; i<mWriteableEntryTypes.length; i++) {
- if (entry.EntryType.equals(mWriteableEntryTypes[i])) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- /**
- * Wrap the command of SQLExecution class for transparency.
- */
- protected boolean executeSQLCommand(String command, boolean mergeOutput) {
- return mSqlExec.executeSQLCommand(command, mSqlInput, mSqlOutput, mergeOutput);
- }
-
- /**
- * Wrap the command of SQLExecution class for transparency.
- */
- protected boolean executeSQLCommand(String command) {
- return mSqlExec.executeSQLCommand(command, mSqlInput, mSqlOutput);
- }
-
- /**
- * Method to print: empty here
- */
- public void println(String msg) {
- }
-
- /**
- * Prepare the database: executed once at the beginning.
- * Abstract method, so derived classes have to overwrite it.
- */
- protected abstract boolean prepareDataBase(LogWriter log);
-
- /**
- * Insert one entr into the database.
- * Abstract method, so derived classes have to overwrite it.
- */
- protected abstract boolean insertEntry(LogWriter log);
-}
diff --git a/qadevOOo/runner/stats/FatDataBaseOutProducer.java b/qadevOOo/runner/stats/FatDataBaseOutProducer.java
deleted file mode 100644
index 1843577b40d4..000000000000
--- a/qadevOOo/runner/stats/FatDataBaseOutProducer.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package stats;
-
-import java.text.DecimalFormat;
-import share.LogWriter;
-import java.util.HashMap;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-
-/**
- *
- */
-public class FatDataBaseOutProducer extends DataBaseOutProducer {
-
-
- /** Creates a new instance of APIDataBaseOutProducer */
- public FatDataBaseOutProducer(HashMap<String,String> param) {
- super(param);
- String testBase = (String)mSqlInput.get("TestBase");
- int sep = testBase.indexOf('_');
- String testLanguage = testBase.substring(0,sep);
- testBase = testBase.substring(sep+1);
- String apiVersion = (String)mSqlInput.get("Version");
- String descriptionString = testLanguage+":"+(String)mSqlInput.get("OperatingSystem")+":"+testBase+":"+apiVersion;
- apiVersion = apiVersion.substring(0, 6);
- // build date
- if (mSqlInput.get("Date") != null) {
- mSqlInput.put("date", mSqlInput.get("Date"));
- }
- if (mSqlInput.get("date") == null) {
- // build date if it's not there
- Calendar cal = new GregorianCalendar();
- DecimalFormat dfmt = new DecimalFormat("00");
- String year = Integer.toString(cal.get(GregorianCalendar.YEAR));
- // month is starting with "0"
- String month = dfmt.format(cal.get(GregorianCalendar.MONTH) + 1);
- String day = dfmt.format(cal.get(GregorianCalendar.DATE));
- String dateString = year + "-" + month + "-" + day;
-
- mSqlInput.put("date", dateString);
- }
-
- setWriteableEntryTypes(new String[]{"property", "method", "component", "interface", "service"});
-
- mSqlInput.put("test_run.description", descriptionString);
- mSqlInput.put("api_version_name", apiVersion);
- }
-
- @Override
- protected boolean prepareDataBase(LogWriter log) {
- executeSQLCommand("SHOW TABLES");
-
- executeSQLCommand("SELECT id AS \"test_run.id\", api_version_id, description, date FROM test_run" +
- " WHERE date = \"$date\" AND description = \"$test_run.description\";", true);
- String id = (String)mSqlInput.get("test_run.id");
- // create an entry for this test run
- if (id == null) {
- executeSQLCommand("SELECT id AS api_version_id FROM api_version" +
- " WHERE version = \"$api_version_name\";", true);
- String api_version_id = (String)mSqlInput.get("api_version_id");
- // create an entry for this API
- if (api_version_id == null) {
- executeSQLCommand("INSERT api_version (api_name, version)" +
- " VALUES (\"soapi\", \"$api_version_name\")");
- executeSQLCommand("SELECT id AS api_version_id FROM api_version" +
- " WHERE version = \"$api_version_name\";", true);
- }
- // complete entry for the test run
- executeSQLCommand("INSERT test_run (api_version_id, description, date)" +
- " VALUES ($api_version_id, \"$test_run.description\", \"$date\");");
- executeSQLCommand("SELECT test_run.id AS \"test_run.id\", api_version_id, description, date FROM test_run" +
- " WHERE date = \"$date\" AND description = \"$test_run.description\";", true);
- }
- return true;
- }
-
- @Override
- protected boolean insertEntry(LogWriter log) {
-
- executeSQLCommand("SELECT id AS \"entry.id\", name AS \"entry.name\" FROM entry WHERE name = \"$EntryLongName\";", true);
- if (mSqlInput.get("entry.id") == null) {
- executeSQLCommand("INSERT entry (name, type)" +
- " VALUES (\"$EntryLongName\", \"$EntryType\");");
- executeSQLCommand("SELECT id AS \"entry.id\", name AS \"entry.name\" FROM entry WHERE name = \"$EntryLongName\";", true);
- }
- executeSQLCommand("SELECT id AS \"api_entry.id\", api_version_id AS \"api_entry.api_version_id\", entry_id AS \"api_entry.entry_id\" FROM api_entry" +
- " WHERE entry_id = $entry.id;", true);
- if (mSqlInput.get("api_entry.id") == null) {
- executeSQLCommand("INSERT api_entry (entry_id, api_version_id)"+
- " VALUES ($entry.id, $api_version_id);");
- executeSQLCommand("SELECT id AS \"api_entry.id\", api_version_id AS \"api_entry.api_version_id\", entry_id AS \"api_entry.entry_id\" FROM api_entry" +
- " WHERE entry_id = $entry.id;", true);
- }
- executeSQLCommand("SELECT status AS \"test_state.status\" FROM test_state"+
- " WHERE test_run_id = $test_run.id AND entry_id = $entry.id;", true);
-
- String status = (String)mSqlInput.get("test_state.status");
- if (status == null) {
- executeSQLCommand("INSERT test_state (test_run_id, entry_id, status)"+
- " VALUES ($test_run.id, $entry.id, \"$EntryState\");");
- }
- else {
- if (!status.endsWith("OK")) {
- executeSQLCommand("UPDATE test_state SET status = \"$EntryState\""+
- " WHERE test_run_id = $test_run.id AND entry_id = $entry.id;");
- }
- }
- return true;
- }
-
- public Object getWatcher() {
- return null;
- }
-
- public void setWatcher(Object watcher) {
- }
-
-}
diff --git a/qadevOOo/runner/stats/FileLogWriter.java b/qadevOOo/runner/stats/FileLogWriter.java
deleted file mode 100644
index aebcb0fbf868..000000000000
--- a/qadevOOo/runner/stats/FileLogWriter.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package stats;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import share.LogWriter;
-
-import java.io.PrintWriter;
-import java.text.DecimalFormat;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class FileLogWriter extends PrintWriter implements LogWriter {
-
-
- HashMap<String, FileWriter> mFileWriters = null;
- boolean logging = false;
- share.DescEntry entry = null;
- share.Watcher ow = null;
-
- public FileLogWriter() {
- super(System.out);
- Calendar cal = new GregorianCalendar();
- DecimalFormat dfmt = new DecimalFormat("00");
- super.println("LOG> Log started " +
- dfmt.format(cal.get(Calendar.DAY_OF_MONTH)) + "." +
- dfmt.format(cal.get(Calendar.MONTH)) + "." +
- dfmt.format(cal.get(Calendar.YEAR)) + " - " +
- dfmt.format(cal.get(Calendar.HOUR_OF_DAY)) + ":" +
- dfmt.format(cal.get(Calendar.MINUTE)) + ":" +
- dfmt.format(cal.get(Calendar.SECOND)));
- super.flush();
- }
-
- public boolean initialize(share.DescEntry entry, boolean logging) {
- this.logging = logging;
- this.entry = entry;
- return true;
- }
-
-
- public void addFileLog(String filePath){
- FileWriter fileWriter = null;
- try{
- try{
- if(mFileWriters == null)
- mFileWriters = new HashMap<String, FileWriter>();
- fileWriter = new FileWriter(filePath);
- mFileWriters.put(filePath, fileWriter);
- }finally{
- if (fileWriter != null)
- fileWriter.close();
- }
- }catch(IOException e ){
- e.printStackTrace(this);
- }
- }
-
-
- public void removeFileLog(String filePath){
- if(filePath != null)
- mFileWriters.remove(filePath);
- }
-
-
- @Override
- public void println(String msg) {
-
- this.ow = (share.Watcher) entry.UserDefinedParams.get("Watcher");
-
- if (ow != null) {
- ow.ping();
- }
- if (logging) {
-
- // logoutput to console
- super.println("LOG> "+msg);
- super.flush();
-
- //logoutput to file
- if(mFileWriters != null && mFileWriters.size() > 0){
- try{
- FileWriter fw = null;
- Iterator<FileWriter> iter = mFileWriters.values().iterator();
- while(iter.hasNext()){
- fw = iter.next();
- fw.write("LOG> " + msg + "\n");
- fw.flush();
- }
- }catch(IOException e ){
- e.printStackTrace(this);
- }
- }
- }
- }
-
- public boolean summary(share.DescEntry entry) {
- String header = "***** State for "+entry.longName+" ******";
- System.out.println(header);
- if (entry.hasErrorMsg) {
- System.out.println(entry.ErrorMsg);
- System.out.println("Whole "+entry.EntryType+": "+entry.State);
- } else {
- System.out.println("Whole "+entry.EntryType+": "+entry.State);
- }
- for (int i=0;i<header.length();i++) {
- System.out.print("*");
- }
- System.out.println("");
- return true;
- }
-
- public Object getWatcher() {
- return this.ow;
- }
-
- public void setWatcher(Object watcher) {
- entry.UserDefinedParams.put("Watcher", watcher);
- }
-
-}
diff --git a/qadevOOo/runner/stats/InternalLogWriter.java b/qadevOOo/runner/stats/InternalLogWriter.java
index 5c2d165a167d..d9a0a2de067c 100644
--- a/qadevOOo/runner/stats/InternalLogWriter.java
+++ b/qadevOOo/runner/stats/InternalLogWriter.java
@@ -106,10 +106,6 @@ public class InternalLogWriter extends PrintWriter
return message;
}
- public Object getWatcher() {
- return null;
- }
-
public void setWatcher(Object watcher) {
}
diff --git a/qadevOOo/runner/stats/SQLExecution.java b/qadevOOo/runner/stats/SQLExecution.java
deleted file mode 100644
index 487716c0e8c6..000000000000
--- a/qadevOOo/runner/stats/SQLExecution.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package stats;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.Statement;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- *
- */
-public class SQLExecution {
-
- private Connection mConnection = null;
- private Statement mStatement = null;
- private final String mJdbcClass;
- private final String mDbURL;
- private final String mUser;
- private final String mPassword;
- private boolean m_bConnectionOpen = false;
- private boolean m_bDebug = false;
-
-
- /** Creates a new instance of SQLExecution
- * @param jdbcClass The jdbc class for the connection.
- * @param dbUrl The url of the database.
- * @param user The user for connecting the database.
- * @param password The password of throws user.
- */
- public SQLExecution(String jdbcClass, String dbUrl, String user, String password) {
- mJdbcClass = jdbcClass;
- mUser = user;
- mPassword = password;
- mDbURL = dbUrl;
- }
-
- /** Creates a new instance of SQLExecution with additional debug output.
- * @param jdbcClass The jdbc class for the connection.
- * @param dbUrl The url of the database.
- * @param user The user for connecting the database.
- * @param password The password of throws user.
- * @param debug Write debug information, if true.
- */
- public SQLExecution(String jdbcClass, String dbUrl, String user, String password, boolean debug) {
- mJdbcClass = jdbcClass;
- mUser = user;
- mPassword = password;
- mDbURL = dbUrl;
- m_bDebug = debug;
- }
-
- /**
- * Open a connection to the DataBase
- * @return True, if no error occurred.
- */
- public boolean openConnection() {
- if(m_bConnectionOpen) return true;
- try {
- Class.forName(mJdbcClass);
- } catch (ClassNotFoundException e) {
- System.err.println("Couldn't find jdbc driver : " + e.getMessage());
- return false;
- }
-
- try {
- // establish database connection
- mConnection = DriverManager.getConnection(
- mDbURL, mUser, mPassword);
- mStatement = mConnection.createStatement();
- }
- catch(java.sql.SQLException e) {
- System.err.println("Couldn't establish a connection: " + e.getMessage());
- return false;
- }
- m_bConnectionOpen = true;
- return true;
- }
-
- /**
- * Close the connection to the DataBase
- * @return True, if no error occurred.
- */
- public boolean closeConnection() {
- if (!m_bConnectionOpen) return true;
- try {
- // close database connection
- mStatement.close();
- mConnection.close();
- }
- catch(java.sql.SQLException e) {
- System.err.println("Couldn't close the connection: " + e.getMessage());
- return false;
- }
- m_bConnectionOpen = false;
- return true;
- }
-
- /**
- * Execute an sql command.
- * @param command The command to execute.
- * @param sqlInput Input values for the command.
- * @param sqlOutput The results of the command are put in this HashMap.
- * @return True, if no error occurred.
- */
- public boolean executeSQLCommand(String command, HashMap<String,Object> sqlInput, HashMap<String, String[]> sqlOutput)
- throws IllegalArgumentException {
- return executeSQLCommand(command, sqlInput, sqlOutput, false);
- }
-
- /**
- * Execute an sql command.
- * @param command The command to execute.
- * @param sqlInput Input values for the command.
- * @param sqlOutput The results of the command are put in this HashMap.
- * @param mergeOutputIntoInput The output of the result is put into the
- * sqlInput HashMap.
- * @return True, if no error occurred.
- */
- public boolean executeSQLCommand(String command, HashMap<String,Object> sqlInput, HashMap<String, String[]> sqlOutput, boolean mergeOutputIntoInput)
- throws IllegalArgumentException {
- if (sqlOutput == null) {
- sqlOutput = new HashMap<String, String[]>();
- // this has to be true, so the user of this method gets a return
- mergeOutputIntoInput = true;
- if (sqlInput == null) {
- System.out.println("sqlInput and sqlOutput are null: cannot return the results of the sql command.");
- return false;
- }
- }
- ArrayList<String> sqlCommand = new ArrayList<String>();
- sqlCommand.add("");
- boolean update = false;
- // synchronize all "$varname" occurrences in the command string with
- // values from input
- StringTokenizer token = new StringTokenizer(command, " ");
- while (token.hasMoreTokens()) {
- String originalKey = token.nextToken();
- // search for keys, beginning with "$"
- int index = originalKey.indexOf('$');
- if (index != -1) {
- // found key
- String pre = "";
- pre = originalKey.substring(0,index);
- // generate key: remove "$"
- String key = originalKey.substring(index+1);
- String post = "";
- // remove any endings the key might have
- while (key.endsWith(",") || key.endsWith("\'") ||
- key.endsWith(";") || key.endsWith(")") ||
- key.endsWith("\"")) {
- post = key.substring(key.length()-1) + post;
- key = key.substring(0, key.length()-1);
- }
- // look for key in the Hashtable
- if (sqlInput.containsKey(key)) {
- // is there a value for the key?
- Object in = sqlInput.get(key);
- if (in instanceof String[]) {
- // value is a String[]
- String[]vals = (String[])in;
- if (vals.length != sqlCommand.size() && sqlCommand.size() > 1) {
- // size of this array and previous array(s) does not match
- throw new IllegalArgumentException("The key '" + key + "' in command \n'"
- + command + "'\n has not the same value count as the keys before.");
- }
- // build up the commands
- boolean addNewVals = (sqlCommand.size() == 1);
- for (int i=0; i<vals.length; i++) {
- String value = checkForQuotationMarks(vals[i]);
- // add the values
- if (addNewVals && i!=0) {
- // all values until now were of type String, not String[], so now new values have to be added.
- sqlCommand.add(i, sqlCommand.get(0) + " " + pre + value + post);
- }
- else {
- // we already have vals.length commands (or are at the first command), so just add.
- sqlCommand.set(i, sqlCommand.get(i) + " " + pre + value + post);
- }
- }
- }
- else {
- // value is a String: no other possibility
- String value = checkForQuotationMarks((String)sqlInput.get(key));
- for (int i=0; i<sqlCommand.size(); i++) {
- sqlCommand.set(i, sqlCommand.get(i) + " " + pre + value + post);
- }
- }
- }
- else {
- // no input value found
- throw new IllegalArgumentException ("The key '" + key + "' in command \n'"
- + command + "'\n does not exist in the input values.");
- }
- }
- else {
- // token is not a key, just add it
- for (int i=0; i<sqlCommand.size(); i++)
- sqlCommand.set(i, sqlCommand.get(i) + " " + originalKey);
- if (originalKey.equalsIgnoreCase("update") ||
- originalKey.equalsIgnoreCase("delete") ||
- originalKey.equalsIgnoreCase("insert")) {
- update = true;
- }
-
- }
- }
- for (int i=0;i<sqlCommand.size(); i++) {
- execute(sqlCommand.get(i), sqlOutput, update);
- // merge output with input
- if (!update && mergeOutputIntoInput) {
- for (Map.Entry<String, String[]> entry : sqlOutput.entrySet()) {
- String key = entry.getKey();
- String[] val = entry.getValue();
- if (val != null && val.length != 0) {
- if (val.length == 1)
- sqlInput.put(key, val[0]);
- else
- sqlInput.put(key, val);
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Execute any SQL command.
- * @param command The command.
- * @param update If true, it is a update/alter command instead of an select
- * command
- * @param output A HashMap with the result.
- */
- private void execute(String command, HashMap<String, String[]> output, boolean update) {
- if (m_bDebug)
- System.out.println("Debug - SQLExecution - execute Command: " + command);
-
- ResultSet sqlResult = null;
- try {
- try {
- if (update) {
- // make an update
- mStatement.executeUpdate(command);
- }
- else {
- // make a select: collect the result
- sqlResult = mStatement.executeQuery(command);
- ResultSetMetaData sqlRSMeta = sqlResult.getMetaData();
- int columnCount = sqlRSMeta.getColumnCount();
- String[] columnNames = new String[columnCount];
- int countRows = 0;
- boolean goThroughRowsTheFirstTime = true;
- for(int i=1; i<=columnCount; i++) {
- columnNames[i-1] = sqlRSMeta.getColumnName(i);
- // initialize output
- ArrayList<String> v = new ArrayList<String>();
-
- sqlResult.beforeFirst();
- while (sqlResult.next()) {
- String value = sqlResult.getString(i);
- v.add(value);
- // the first time: count rows
- if (goThroughRowsTheFirstTime)
- countRows++;
- }
- // rows are counted
- if (goThroughRowsTheFirstTime)
- goThroughRowsTheFirstTime = false;
-
- // put result in output HashMap
- String[]s = new String[countRows];
- s = v.toArray(s);
- output.put(columnNames[i-1], s);
- if (m_bDebug) {
- if (i == 1) {
- System.out.print("Debug - SQLExecution - Command returns: ");
- System.out.print("row: " + columnNames[i-1] + " vals: ");
- }
- for (int j=0; j<s.length; j++)
- System.out.print(s[j] + " ");
- if (i == columnCount - 1)
- System.out.println();
- }
- }
- }
- } finally {
- if (sqlResult != null)
- sqlResult.close();
- }
- } catch (java.sql.SQLException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Replace <"> with <''> in the value Strings, or the command will fail.
- * @param checkString The String that is checked: a part of the command
- * @return The String, cleared of all quotation marks.
- */
- private String checkForQuotationMarks(String checkString) {
- String returnString = checkString;
- int quotIndex = 0;
- while ((quotIndex = returnString.indexOf('\"')) != -1) {
- String firstHalf = returnString.substring(0, quotIndex);
- String secondHalf = returnString.substring(quotIndex+1);
- returnString = firstHalf + "\'\'" + secondHalf;
- }
- return returnString;
- }
-
-}
diff --git a/qadevOOo/runner/stats/SimpleFileOutProducer.java b/qadevOOo/runner/stats/SimpleFileOutProducer.java
deleted file mode 100644
index e8d572ecb657..000000000000
--- a/qadevOOo/runner/stats/SimpleFileOutProducer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package stats;
-
-import share.LogWriter;
-import java.io.File;
-import java.io.FileWriter;
-
-public class SimpleFileOutProducer implements LogWriter {
-
-
- /** initialization, here a filename might be given
- * or a dbUrL
- */
- public boolean initialize(share.DescEntry entry, boolean active) {
- return true;
- }
-
- /** Method to print
- */
- public void println(String msg) {
-
- }
-
- /** will mostly be used by outproducers to sum up
- * the information, maybe write them to a db
- */
- public boolean summary(share.DescEntry entry) {
- FileWriter out = null;
- try {
- try {
- String outpath = (String) entry.UserDefinedParams.get("OutputPath");
- if (outpath==null) {
- System.out.println("## Parameter OutputPath isn't defined using default");
- return summary_default(entry);
- }
- String FileName = entry.longName + ".out";
- if (!entry.EntryType.equals("component")) {
- FileName = entry.longName.substring(0,
- entry.longName.indexOf(':')) + ".out";
- }
- util.utils.make_Directories("",outpath);
- File outputFile = new File(outpath, FileName);
- out = new FileWriter(outputFile.toString(),true);
- String ls = System.getProperty("line.separator");
- String date = new java.util.Date().toString();
- String header = "***** State for "+entry.longName+"( "+ date +" ) ******";
- out.write(header+ls);
- if (entry.hasErrorMsg) {
- out.write(entry.ErrorMsg+ls);
- out.write("Whole "+entry.EntryType+": "+entry.State+ls);
- } else {
- out.write("Whole "+entry.EntryType+": "+entry.State+ls);
- }
- String bottom="";
- for (int i=0;i<header.length();i++) {
- bottom += "*";
- }
- out.write(bottom+ls);
- out.write(""+ls);
- } finally {
- if (out != null)
- out.close();
- }
- } catch (java.io.IOException e) {
- }
- return true;
- }
-
- public boolean summary_default(share.DescEntry entry) {
- String header = "***** State for "+entry.longName+" ******";
- System.out.println(header);
- if (entry.hasErrorMsg) {
- System.out.println(entry.ErrorMsg);
- System.out.println("Whole "+entry.EntryType+": "+entry.State);
- } else {
- System.out.println("Whole "+entry.EntryType+": "+entry.State);
- }
- for (int i=0;i<header.length();i++) {
- System.out.print("*");
- }
- System.out.println("");
- return true;
- }
-
- public Object getWatcher() {
- return null;
- }
-
- public void setWatcher(Object watcher) {
- }
-
-}
diff --git a/qadevOOo/runner/stats/SimpleLogWriter.java b/qadevOOo/runner/stats/SimpleLogWriter.java
index 46e0e69a5c25..46e18527bdd2 100644
--- a/qadevOOo/runner/stats/SimpleLogWriter.java
+++ b/qadevOOo/runner/stats/SimpleLogWriter.java
@@ -84,10 +84,6 @@ public class SimpleLogWriter extends PrintWriter implements LogWriter {
return true;
}
- public Object getWatcher() {
- return this.ow;
- }
-
public void setWatcher(Object watcher)
{
if (watcher != null)
diff --git a/qadevOOo/runner/stats/SimpleOutProducer.java b/qadevOOo/runner/stats/SimpleOutProducer.java
index 656e83c795fc..93ca0503cc01 100644
--- a/qadevOOo/runner/stats/SimpleOutProducer.java
+++ b/qadevOOo/runner/stats/SimpleOutProducer.java
@@ -55,10 +55,6 @@ public class SimpleOutProducer implements LogWriter {
return true;
}
- public Object getWatcher() {
- return null;
- }
-
public void setWatcher(Object watcher) {
}
diff --git a/qadevOOo/runner/util/BasicMacroTools.java b/qadevOOo/runner/util/BasicMacroTools.java
deleted file mode 100644
index ead35dd78b40..000000000000
--- a/qadevOOo/runner/util/BasicMacroTools.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package util;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.frame.XController;
-import com.sun.star.frame.XDispatch;
-import com.sun.star.frame.XDispatchProvider;
-import com.sun.star.frame.XFrame;
-import com.sun.star.frame.XModel;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.script.XLibraryContainer;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.*;
-import com.sun.star.util.URL;
-import com.sun.star.util.XURLTransformer;
-
-
-
-public class BasicMacroTools {
- private final XDispatchProvider mDispProv;
- private final XMultiServiceFactory mMSF;
- private final XURLTransformer mParser;
- private final XNameAccess mLCxNA; //LibraryContainer::XNameAccess
- private final XLibraryContainer mLCxLC; //LibraryContainer::XLibraryContainer
-
- /*
- *While initializing the Basic Libraries will be appendend to the Document
- */
- public BasicMacroTools(XMultiServiceFactory msf, XModel xModel,
- XComponent xDoc) throws java.lang.Exception {
- mMSF = msf;
- mDispProv = makeDispatchProvider(xModel);
- mParser = makeParser(mMSF);
-
- Object DocLibCont = null;
-
- try {
- XPropertySet xDocProps = UnoRuntime.queryInterface(
- XPropertySet.class, xDoc);
- DocLibCont = xDocProps.getPropertyValue("BasicLibraries");
- } catch (com.sun.star.uno.Exception e) {
- throw new Exception(
- "Couldn't get BasicLibraries-Container from document", e);
- }
-
- mLCxNA = UnoRuntime.queryInterface(XNameAccess.class,
- DocLibCont);
-
- mLCxLC = UnoRuntime.queryInterface(
- XLibraryContainer.class, DocLibCont);
- }
-
- /*
- * While initializing the Basic Libraries will be appendend to the Office
- */
- public BasicMacroTools(XMultiServiceFactory msf, XModel xModel)
- throws java.lang.Exception {
- mMSF = msf;
- mDispProv = makeDispatchProvider(xModel);
- mParser = makeParser(mMSF);
-
- Object ASLC = null;
-
- try {
- ASLC = mMSF.createInstance(
- "com.sun.star.script.ApplicationScriptLibraryContainer");
- } catch (com.sun.star.uno.Exception e) {
- throw new Exception("Couldn't create ApplicationScriptLibraryContainer", e);
- }
-
- mLCxNA = UnoRuntime.queryInterface(XNameAccess.class,
- ASLC);
-
- mLCxLC = UnoRuntime.queryInterface(
- XLibraryContainer.class, ASLC);
- }
-
- private static XDispatchProvider makeDispatchProvider(XModel aModel)
- throws java.lang.Exception {
- XController xController = aModel.getCurrentController();
- XFrame xFrame = xController.getFrame();
-
- if (xFrame == null) {
- throw new Exception("Could not create DispatchProvider");
- }
-
- return UnoRuntime.queryInterface(
- XDispatchProvider.class, xFrame);
- }
-
- private static XURLTransformer makeParser(XMultiServiceFactory mMSF)
- throws java.lang.Exception {
- return UnoRuntime.queryInterface(
- XURLTransformer.class, mMSF.createInstance(
- "com.sun.star.util.URLTransformer"));
- }
-
- public void loadLibrary(String LibraryName, String LibraryURL)
- throws java.lang.Exception {
- try {
- appendLibrary(LibraryName, LibraryURL);
- } catch (java.lang.Exception e) {
- throw new Exception("Could not append Library " + LibraryName, e);
- }
-
- try {
- mLCxLC.loadLibrary(LibraryName);
- } catch (com.sun.star.container.NoSuchElementException e) {
- throw new Exception("Could not load Library " + LibraryName, e);
- } catch (com.sun.star.lang.WrappedTargetException e) {
- throw new Exception("Could not load Library " + LibraryName, e);
- }
- }
-
- private void appendLibrary(String LibraryName, String LibraryURL)
- throws java.lang.Exception {
- try {
- removeLibrary(LibraryName);
- } catch (java.lang.Exception e) {
- }
-
- try {
- mLCxLC.createLibraryLink(LibraryName, LibraryURL, false);
- } catch (com.sun.star.container.ElementExistException e) {
- throw new Exception("Library " + LibraryName + "already exists.", e);
- } catch (com.sun.star.lang.IllegalArgumentException e) {
- throw new Exception("Could not link Basic library " + LibraryName, e);
- }
- }
-
- public void removeLibrary(String LibraryName) throws java.lang.Exception {
- if (mLCxNA.hasByName(LibraryName)) {
- try {
- mLCxLC.removeLibrary(LibraryName);
- } catch (com.sun.star.container.NoSuchElementException e) {
- throw new Exception("Could not remove Basic library " + LibraryName + ", Library does not exist", e);
- } catch (com.sun.star.lang.WrappedTargetException e) {
- throw new Exception("Could not remove Basic library " + LibraryName, e);
- }
- }
- }
-
- public void runMarco(String MacroName) throws java.lang.Exception {
- URL[] aParseURL = new URL[1];
- aParseURL[0] = new URL();
- aParseURL[0].Complete = "macro://./" + MacroName; //Standard.Stock.GetSymbol('micro','')";
- mParser.parseStrict(aParseURL);
-
- URL aURL = aParseURL[0];
- XDispatch xDispatcher = mDispProv.queryDispatch(aURL, "", 0);
-
- if (xDispatcher != null) {
- xDispatcher.dispatch(aURL, null);
- } else {
- throw new Exception("Could not run Macro " + MacroName);
- }
- }
-
- /**
- * Set the given <CODE>secureURL</CODE> as secure URL for marco execution.
- * The macros of documents located in <CODE>secureURL</CODE> will be executed
- * automatically.
- * @param xMSF the XMultiServiceFactory
- * @param secureURL the URL the documet is located
- * @throws java.lang.Exception throws this exception on any error
- */
- public static void addSecureBasicMarcosURL(XMultiServiceFactory xMSF, String secureURL)
- throws Exception {
-
- secureURL = utils.getFullURL(secureURL);
-
- // configure Office to allow to execute macos
- PropertyValue[] ProvArgs = new PropertyValue [1];
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "nodepath";
- Arg.Value = "/org.openoffice.Office.Common/Security";
- ProvArgs[0] = Arg;
-
- Object oProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider");
-
-
- XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oProvider);
-
- Object oSecure = oProviderMSF.createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationUpdateAccess",
- ProvArgs);
-
- XPropertySet oSecureProps = UnoRuntime.queryInterface(XPropertySet.class, oSecure);
-
- Object oScripting = oSecureProps.getPropertyValue("Scripting");
- XPropertySet oScriptingSettings = UnoRuntime.queryInterface(XPropertySet.class, oScripting);
-
- oScriptingSettings.setPropertyValue("SecureURL", new String[]{secureURL});
- oScriptingSettings.setPropertyValue("OfficeBasic", Integer.valueOf(2));
-
- XChangesBatch oSecureChange = UnoRuntime.queryInterface(XChangesBatch.class, oSecure);
- oSecureChange.commitChanges();
- }
-}
diff --git a/qadevOOo/runner/util/BookmarkDsc.java b/qadevOOo/runner/util/BookmarkDsc.java
index 3f4b8943b714..95d6a57f2d1c 100644
--- a/qadevOOo/runner/util/BookmarkDsc.java
+++ b/qadevOOo/runner/util/BookmarkDsc.java
@@ -36,11 +36,6 @@ public class BookmarkDsc extends InstDescr {
initBookmark();
}
- public BookmarkDsc( String name ) {
- this.name = name;
- initBookmark();
- }
-
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/ControlDsc.java b/qadevOOo/runner/util/ControlDsc.java
deleted file mode 100644
index 736fe01b0351..000000000000
--- a/qadevOOo/runner/util/ControlDsc.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * Describes a Control to be inserted in a container
- */
-
-public class ControlDsc extends InstDescr {
-
- private String name;
- static final String ifcName = "com.sun.star.form.XFormComponent";
- String service = "com.sun.star.form.component.CommandButton";
-
- public ControlDsc( String kind ) {
- service="com.sun.star.form.component."+kind;
- initControl();
- }
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getIfcName() {
- return ifcName;
- }
- @Override
- public String getService() {
- return service;
- }
-
- private void initControl() {
- try {
- ifcClass = Class.forName( ifcName );
- }
- catch( ClassNotFoundException cnfE ) {
- }
- }
- @Override
- public XInterface createInstance( XMultiServiceFactory docMSF ) {
-
- Object SrvObj = null;
- try {
- SrvObj = docMSF.createInstance( service );
- }
- catch( com.sun.star.uno.Exception cssuE ){
- }
-
- XInterface Control = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj );
-
- return Control;
-
- }
-}
diff --git a/qadevOOo/runner/util/FootnoteDsc.java b/qadevOOo/runner/util/FootnoteDsc.java
index dc0574157324..3fc082a3de62 100644
--- a/qadevOOo/runner/util/FootnoteDsc.java
+++ b/qadevOOo/runner/util/FootnoteDsc.java
@@ -36,11 +36,6 @@ public class FootnoteDsc extends InstDescr {
initFootnote();
}
- public FootnoteDsc( String name ) {
- this.name = name;
- initFootnote();
- }
-
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java
index 644a2530c5e5..7a069de899e7 100644
--- a/qadevOOo/runner/util/FrameDsc.java
+++ b/qadevOOo/runner/util/FrameDsc.java
@@ -46,12 +46,6 @@ public class FrameDsc extends InstDescr {
initFrame();
}
- public FrameDsc( String FrameName, int nHeight, int nWidth ) {
- name = FrameName;
- height = nHeight;
- width = nWidth;
- initFrame();
- }
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/InstDescr.java b/qadevOOo/runner/util/InstDescr.java
index 7b349b0f8427..7b7098be6867 100644
--- a/qadevOOo/runner/util/InstDescr.java
+++ b/qadevOOo/runner/util/InstDescr.java
@@ -31,12 +31,6 @@ abstract public class InstDescr {
protected abstract String getName();
/**
- * the method getIfcClass
- */
- public Class<?> getIfcClass() {
- return ifcClass;
- }
- /**
* the method getService
*/
protected abstract String getService();
diff --git a/qadevOOo/runner/util/ParagraphDsc.java b/qadevOOo/runner/util/ParagraphDsc.java
index 318ada2e0e5b..e4c73a6969a3 100644
--- a/qadevOOo/runner/util/ParagraphDsc.java
+++ b/qadevOOo/runner/util/ParagraphDsc.java
@@ -37,11 +37,6 @@ public class ParagraphDsc extends InstDescr {
initParagraph();
}
- public ParagraphDsc( String name ) {
- this.name = name;
- initParagraph();
- }
-
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/ReferenceMarkDsc.java b/qadevOOo/runner/util/ReferenceMarkDsc.java
deleted file mode 100644
index 82f8c3ffc7e4..000000000000
--- a/qadevOOo/runner/util/ReferenceMarkDsc.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.text.XTextContent;
-
-/**
- * the class ReferenceMarkDsc
- */
-public class ReferenceMarkDsc extends InstDescr {
-
- private static final String service = "com.sun.star.text.ReferenceMark";
- private static final String ifcName = "com.sun.star.text.XTextContent";
- private String name = null;
-
-
- public ReferenceMarkDsc() {
- initReferenceMark();
- }
-
- public ReferenceMarkDsc( String name ) {
- this.name = name;
- initReferenceMark();
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getIfcName() {
- return ifcName;
- }
-
- @Override
- public String getService() {
- return service;
- }
-
- private void initReferenceMark() {
- try {
- ifcClass = Class.forName( ifcName );
- }
- catch( ClassNotFoundException cnfE ) {
- }
- }
- @Override
- public XInterface createInstance( XMultiServiceFactory docMSF ) {
- Object ServiceObj = null;
-
- try {
- ServiceObj = docMSF.createInstance( service );
- }
- catch( com.sun.star.uno.Exception cssuE ){
- }
- XTextContent RM = (XTextContent)UnoRuntime.queryInterface( ifcClass,
- ServiceObj );
- return RM;
- }
-} \ No newline at end of file
diff --git a/qadevOOo/runner/util/StyleFamilyDsc.java b/qadevOOo/runner/util/StyleFamilyDsc.java
deleted file mode 100644
index daef8b563401..000000000000
--- a/qadevOOo/runner/util/StyleFamilyDsc.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * the class StyleFamilyDsc
- */
-public class StyleFamilyDsc extends InstDescr {
-
- private String name;
- static final String ifcName = "com.sun.star.style.XStyle";
- String service = "com.sun.star.style.CharacterStyle";
-
- public StyleFamilyDsc( String kind ) {
- service = "com.sun.star.style." + kind;
- initStyleFamily();
- }
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getIfcName() {
- return ifcName;
- }
- @Override
- public String getService() {
- return service;
- }
-
- private void initStyleFamily() {
- try {
- ifcClass = Class.forName( ifcName );
- }
- catch( ClassNotFoundException cnfE ) {
- }
- }
- @Override
- public XInterface createInstance( XMultiServiceFactory docMSF ) {
-
-
- Object SrvObj = null;
- try {
- SrvObj = docMSF.createInstance( service );
- }
- catch( com.sun.star.uno.Exception cssuE ){
- }
-
- XInterface StyleFamily = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj );
-
- return StyleFamily;
-
- }
-}
diff --git a/qadevOOo/runner/util/TableDsc.java b/qadevOOo/runner/util/TableDsc.java
index 905e117879c9..09dd50d1200f 100644
--- a/qadevOOo/runner/util/TableDsc.java
+++ b/qadevOOo/runner/util/TableDsc.java
@@ -43,12 +43,6 @@ public class TableDsc extends InstDescr {
initTable();
}
- public TableDsc( String TableName, int nRows, int nColumns ) {
- name = TableName;
- rows = nRows;
- columns = nColumns;
- initTable();
- }
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/TextSectionDsc.java b/qadevOOo/runner/util/TextSectionDsc.java
index 814d59c147f1..5478b4c59d34 100644
--- a/qadevOOo/runner/util/TextSectionDsc.java
+++ b/qadevOOo/runner/util/TextSectionDsc.java
@@ -36,11 +36,6 @@ public class TextSectionDsc extends InstDescr {
initTextSection();
}
- public TextSectionDsc( String name ) {
- this.name = name;
- initTextSection();
- }
-
@Override
public String getName() {
return name;
diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java
index 48ed314e0b00..73603622063c 100644
--- a/qadevOOo/runner/util/UITools.java
+++ b/qadevOOo/runner/util/UITools.java
@@ -205,26 +205,6 @@ public class UITools {
}
}
- /**
- * returns the message of a Basic-MessageBox
- * @return the message of a Basic-MessageBox
- * @throws java.lang.Exception if something fail
- */
- public String getMsgBoxText()
- throws java.lang.Exception
- {
- try{
- XAccessibleContext xMessage =AccessibilityTools.getAccessibleObjectForRole(mXRoot,
- AccessibleRole.LABEL);
-
- XInterface xMessageInterface = UnoRuntime.queryInterface(XInterface.class, xMessage);
-
- return getString(xMessageInterface);
- } catch (Exception e) {
- throw new Exception("Could not get message from Basic-MessageBox:", e);
- }
- }
-
/**
* Prints the accessible tree to the <CODE>logWriter</CODE> only if <CODE>debugIsActive</CODE>
* is set to <CODE>true</CODE>
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index f814f1a6b9b2..87cc2e712cc6 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -800,8 +800,6 @@ public class ValueChanger {
Class<?> enumClass = oldValue.getClass();
Field[] flds = enumClass.getFields();
- newValue = null;
-
for (int i = 0; i < flds.length; i++) {
if (Enum.class.equals(flds[i].getType().getSuperclass())) {
diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java
index bc989da981e6..24438008b8a1 100644
--- a/qadevOOo/runner/util/XMLTools.java
+++ b/qadevOOo/runner/util/XMLTools.java
@@ -51,15 +51,6 @@ public class XMLTools {
*/
public AttributeList() {}
- /**
- * Constructs a list which will report to <code>log</code>
- * specified about each <code>XDocumentHandler</code> method
- * call.
- */
- public AttributeList(PrintWriter log) {
- this.log = log ;
- }
-
private AttributeList(XAttributeList list) {
if (list == null) return ;
for (short i = 0; i < list.getLength(); i++) {
@@ -468,20 +459,6 @@ public class XMLTools {
/**
* Creates a tag with the name specified, which must have an
- * attribute with name specified. The value of this attribute
- * doesn't make sense.
- * @param tagName The name of the tag.
- * @param attrName The name of attribute which must be contained
- * in the tag.
- */
- public Tag(String tagName, String attrName) {
- name = tagName ;
- attrList = new String[1][3] ;
- attrList[0][0] = attrName ;
- }
-
- /**
- * Creates a tag with the name specified, which must have an
* attribute with the value specified. The type of value
* assumed to be 'CDATA'.
* @param tagName The name of the tag.
@@ -498,43 +475,6 @@ public class XMLTools {
}
/**
- * Creates a tag with the name specified, which must have
- * attributes specified. The value of thesee attributes
- * doesn't make sense.
- * @param tagName The name of the tag.
- * @param attrNames Array with names of attributes which must
- * be contained in the tag.
- */
- public Tag(String tagName, String[] attrNames) {
- name = tagName ;
- attrList = new String[attrNames.length][3] ;
- for (int i = 0; i < attrNames.length; i++) {
- attrList[i][0] = attrNames[i] ;
- }
- }
-
- /**
- * Creates a tag with the name specified, which must have an
- * attributes with their values specified. The type of all values
- * assumed to be 'CDATA'.
- * @param tagName The name of the tag.
- * @param attrValues An array with attribute names and their values.
- * <code>attrValues[N][0]</code> element contains the name of Nth
- * attribute, and <code>attrValues[N][1]</code> element contains
- * value of Nth attribute, if value is <code>null</code> then the
- * attribute value can be any.
- */
- public Tag(String tagName, String[][] attrValues) {
- name = tagName ;
- attrList = new String[attrValues.length][3] ;
- for (int i = 0; i < attrValues.length; i++) {
- attrList[i][0] = attrValues[i][0] ;
- attrList[i][1] = "CDATA" ;
- attrList[i][2] = attrValues[i][1] ;
- }
- }
-
- /**
* Gets tag String description.
*/
@Override
diff --git a/qadevOOo/runner/util/compare/DocComparator.java b/qadevOOo/runner/util/compare/DocComparator.java
deleted file mode 100644
index f46e46a6012d..000000000000
--- a/qadevOOo/runner/util/compare/DocComparator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util.compare;
-
-import java.io.IOException;
-
-public interface DocComparator {
-
- boolean isReferenceExistent() throws IOException;
-
- boolean isDiffReferenceExistent() throws IOException;
-
- boolean compareDiff() throws IOException;
-
-}
diff --git a/qadevOOo/runner/util/compare/DocComparatorFactory.java b/qadevOOo/runner/util/compare/DocComparatorFactory.java
deleted file mode 100644
index 470cb0376368..000000000000
--- a/qadevOOo/runner/util/compare/DocComparatorFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util.compare;
-
-import lib.TestParameters;
-
-public class DocComparatorFactory
-{
- /**
- * @param s is a name like 'ooo' 'pdf' or 'msoffice'
- * @return a new DocComparator Object
- */
- static public DocComparator createComparator(String s, TestParameters aParams) throws IllegalArgumentException
- {
- if (s.equalsIgnoreCase("gfx") || s.equalsIgnoreCase("graphical"))
- {
- return GraphicalComparator.getInstance(aParams);
- }
- else if (s.equalsIgnoreCase("pdf"))
- {
- throw new IllegalArgumentException("PDF not implemented yet.");
- }
- else
- {
- throw new IllegalArgumentException("DocComparator for '" + s + "' not supported!");
- }
-
- // unreachable: return null;
- }
-
-}
diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java
deleted file mode 100644
index 3e91dd04d280..000000000000
--- a/qadevOOo/runner/util/compare/GraphicalComparator.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package util.compare;
-
-import convwatch.GraphicalDifferenceCheck;
-import convwatch.GraphicalTestArguments;
-import convwatch.DirectoryHelper;
-import convwatch.FileHelper;
-
-import lib.TestParameters;
-import java.io.IOException;
-
-import convwatch.ConvWatchException;
-
-class GraphicalComparator implements DocComparator
-{
- private final GraphicalTestArguments m_aArguments;
-
- protected GraphicalComparator(TestParameters aParams)
- {
- m_aArguments = new GraphicalTestArguments(aParams);
- }
-
- /**
- * @return an instance of this object, but only it's interface
- */
- static DocComparator getInstance(TestParameters aParams)
- {
- // setting the default test parameter
- // TEST aParams
- GraphicalComparator a = new GraphicalComparator(aParams);
- return a;
- }
-
-
-
- /**
- * build a new file from _sEntry by
- * replacing the path equals to _sInputPath with _sReferencePath and replace it's suffix by _sNewSuffix.
- * If _sInputPath is empty, replace the whole path by _sReferencePath.
- */
- private String createSpecialFile(String _sEntry, String _sInputPath, String _sReferencePath, String _sNewSuffix)
- {
- String fs = System.getProperty("file.separator");
- String sNewSubDir = "";
- if (_sInputPath.length() > 0)
- {
- sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(_sEntry, _sInputPath);
- }
- String sNameNoSuffix = FileHelper.getNameNoSuffix(FileHelper.getBasename(_sEntry));
-
- // add the sub path to the difference path
- String sNewReferencePath;
- if (sNewSubDir.length() > 0)
- {
- sNewReferencePath = _sReferencePath + fs + sNewSubDir;
- }
- else
- {
- sNewReferencePath = _sReferencePath;
- }
- // add the difference name
- sNewReferencePath += fs + sNameNoSuffix + _sNewSuffix;
- return sNewReferencePath;
- }
-
- private boolean isReferenceOrDiffExistent(String _sNewSuffix)
- {
- boolean isExistent = false;
-
- // LLA? What if sReferencePath is a directory, but directory is empty? is the result then true or false;
-
- // wir muessen durch den InputPath durch und dann fuer jedes Dokument prufen, ob im angegebenen ReferencePath eine Reference existiert.
- String sInputPath = m_aArguments.getInputPath();
- if (FileHelper.isDir(sInputPath))
- {
- Object[] aList = DirectoryHelper.traverse(sInputPath, FileHelper.getFileFilter(), m_aArguments.includeSubDirectories());
- for (int i=0;i<aList.length;i++)
- {
- // get document + path
- String sEntry = (String)aList[i];
- String sNewReferencePath = createSpecialFile(sEntry, sInputPath, m_aArguments.getReferencePath(), _sNewSuffix);
- // split path from document path which only is equal to sInputPath (sub path)
- if (FileHelper.exists(sNewReferencePath))
- {
- isExistent = true;
- }
- }
- }
- else
- {
- // sInputPath is a file
- String sNewReferencePath = createSpecialFile(sInputPath, "", m_aArguments.getReferencePath(), _sNewSuffix);
- if (FileHelper.exists(sNewReferencePath))
- {
- isExistent = true;
- }
- }
- return isExistent;
- }
-
- /**
- * REFERENCE_PATH must set to directory/file, where the reference (*.prn files) (should) exist
- */
- public boolean isReferenceExistent()
- {
- return isReferenceOrDiffExistent(".prn");
- }
-
- /**
- * INPUT_PATH must set, to directory/file, where the documents exist.
- * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) will create.
- */
- public void createReference() throws IOException
- {
- // woher kommt das TestDocument
- // INPUT_PATH
- // wohin
- // REFERENCE_PATH
- // mit was (Reference Application)
- // AppExecutionCmd
- try
- {
- String referenceInputPath = null;
- if(m_aArguments.getReferenceInputPath() == null)
- {
- GraphicalDifferenceCheck.createReferences(m_aArguments.getInputPath(), m_aArguments.getReferencePath(), m_aArguments);
- }
- else
- {
- referenceInputPath = m_aArguments.getReferenceInputPath();
- GraphicalDifferenceCheck.createReferences(referenceInputPath, m_aArguments.getReferencePath(), m_aArguments);
- }
- }
- catch (ConvWatchException e)
- {
- // wrap it to IOException
- java.io.IOException ex2 = new java.io.IOException(e.getMessage());
- ex2.initCause(e);
- throw ex2;
- }
- }
-
- /**
- * INPUT_PATH must set, to directory/file, where the documents exist.
- * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) will create.
- * OUTPUT_PATH must set to a directory, there the whole ouptut will create
- */
- public boolean compare() throws IOException
- {
- try
- {
- if (FileHelper.isDebugEnabled())
- {
- System.err.println(" Inputpath: '" + m_aArguments.getInputPath() + "'");
- System.err.println(" Outputpath: '" + m_aArguments.getOutputPath() + "'");
- System.err.println("Referencepath: '" + m_aArguments.getReferencePath() + "'");
- }
- return GraphicalDifferenceCheck.check(m_aArguments.getInputPath(), m_aArguments.getOutputPath(), m_aArguments.getReferencePath(), m_aArguments);
- }
- catch(ConvWatchException e)
- {
- // wrap it to IOException
- if (FileHelper.isDebugEnabled())
- {
- System.err.println("Exception caught");
- System.err.println(" Inputpath: '" + m_aArguments.getInputPath() + "'");
- System.err.println(" Outputpath: '" + m_aArguments.getOutputPath() + "'");
- System.err.println("Referencepath: '" + m_aArguments.getReferencePath() + "'");
- }
- java.io.IOException ex2 = new java.io.IOException(e.getMessage());
- ex2.initCause(e);
- throw ex2;
- }
- }
-
- /**
- *
- * INPUT_PATH must set to the original documents the directory structure is taken to see if the references exist in the DIFF_PATH
- * DIFF_PATH must set to the diff references
- */
- public boolean isDiffReferenceExistent() throws IOException
- {
- return isReferenceOrDiffExistent(".prn.diff0001.jpg");
- }
-
- /**
- * INPUT_PATH must set, to directory/file, where the documents exist.
- * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) exists.
- * OUTPUT_PATH must set to a directory, where the whole ouptut will create. Here the diffReference will create.
- * At the momemt it's not possible to say only where the diffreferences will create.
- */
- public void createDiffReference() throws IOException
- {
- // this is the same like compareDiff(), but trash the result.
- compareDiff();
- }
-
- /**
- * INPUT_PATH must set, to directory/file, where the documents exist.
- * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) exists.
- * OUTPUT_PATH must set to a directory, where the whole ouptut will create.
- * DIFF_PATH must set to a directory, where the older difference references exist, it's possible to set this to the same as REFERENCE_PATH
- * but this is not the default and will not automatically set.
- */
- public boolean compareDiff() throws IOException
- {
- try
- {
- return GraphicalDifferenceCheck.check(m_aArguments.getInputPath(), m_aArguments.getOutputPath(), m_aArguments.getReferencePath(), m_aArguments.getDiffPath(), m_aArguments);
- }
- catch(ConvWatchException e)
- {
- // wrap it to IOException
- java.io.IOException ex2 = new java.io.IOException(e.getMessage());
- ex2.initCause(e);
- throw ex2;
- }
- }
-
-}
diff --git a/qadevOOo/runner/util/compare/PDFComparator.java b/qadevOOo/runner/util/compare/PDFComparator.java
deleted file mode 100644
index edd7e7ea1908..000000000000
--- a/qadevOOo/runner/util/compare/PDFComparator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package util.compare;
-
-import lib.TestParameters;
-
-class PDFComparator extends GraphicalComparator
-{
- protected PDFComparator(TestParameters aParams)
- {
- super(aParams);
- }
-
- static DocComparator getInstance(TestParameters aParams)
- {
- aParams.put(convwatch.PropertyName.DOC_COMPARATOR_REFERENCE_TYPE, "pdf");
- PDFComparator a = new PDFComparator(aParams);
- return a;
- }
-
-}
-
diff --git a/qadevOOo/runner/util/db/DatabaseDocument.java b/qadevOOo/runner/util/db/DatabaseDocument.java
index 4b8228f316a1..8ad6d770155c 100644
--- a/qadevOOo/runner/util/db/DatabaseDocument.java
+++ b/qadevOOo/runner/util/db/DatabaseDocument.java
@@ -44,11 +44,6 @@ public class DatabaseDocument
m_storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
}
- public DataSource getDataSource()
- {
- return m_dataSource;
- }
-
public XOfficeDatabaseDocument getDatabaseDocument()
{
return m_databaseDocument;
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 3fe4f2b64e5a..76d1666f248d 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -193,24 +193,7 @@ public class utils {
return fulldocURL;
}
- /**
- *
- * This method creates folders needed
- *
- */
- public static void make_Directories(String first, String path) {
- String already_done = null;
- String fs = System.getProperty("file.separator");
- StringTokenizer path_tokenizer = new StringTokenizer(path, fs, false);
- already_done = first;
- while (path_tokenizer.hasMoreTokens()) {
- String part = path_tokenizer.nextToken();
- File new_dir = new File(already_done + File.separatorChar + part);
- already_done = new_dir.toString();
- //create the directory
- new_dir.mkdirs();
- }
- }
+