// -----------------------------------------------------------------------------
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;
SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
if (aGTA.shouldOfficeStart())
{
if (OSHelper.isWindows())
{
aSemaphore.P(aSemaphore.getSemaphoreFile());
}
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");
Object aWatcher = param.get("Watcher");
GlobalLogWriter.get().setWatcher(aWatcher);
// initializeWatcher(param);
String sStatusRunThrough = "";
String sStatusMessage = "";
try
{
DB.startFile(aGTA.getDBInfoString(), _sInputFile);
// better was:
// load document
// create postscript from document
// check file
GraphicalDifferenceCheck.checkOneFile(_sInputFile, _sOutputPath, _sReferencePath, _sDiffPath, aGTA);
sStatusRunThrough = "PASSED, OK";
DB.finishedFile(aGTA.getDBInfoString(), _sInputFile);
}
catch(ConvWatchCancelException e)
{
assure(e.getMessage(), false, true);
sStatusRunThrough = "CANCELLED, FAILED";
sStatusMessage = e.getMessage();
DB.reallyfailedFile(aGTA.getDBInfoString(), _sInputFile);
}
catch(ConvWatchException e)
{
assure(e.getMessage(), false, true);
sStatusMessage = e.getMessage();
sStatusRunThrough = "PASSED, FAILED";
DB.failedFile(aGTA.getDBInfoString(), _sInputFile);
}
catch(com.sun.star.lang.DisposedException e)
{
assure(e.getMessage(), false, true);
sStatusMessage = e.getMessage();
sStatusRunThrough = "FAILED, FAILED";
DB.reallyfailedFile(aGTA.getDBInfoString(), _sInputFile);
}
// Office shutdown
if (aProvider != null)
{
aProvider.closeExistingOffice(param, true);
if (OSHelper.isWindows())
{
aSemaphore.V(aSemaphore.getSemaphoreFile());
aSemaphore.sleep(6);
// wait some time maybe an other process will take the semaphore
// I know, this is absolutly dirty, but the whole convwatch is dirty and need a big cleanup.
}
}
// -------------------- 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("----------------------------------------------------------------------");