2003-01-27 15:27:53 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* $RCSfile: java_fat.java,v $
|
2008-09-30 07:44:27 +00:00
|
|
|
* $Revision: 1.15.2.1 $
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
2008-04-10 06:02:07 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-01-27 15:27:53 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
package base;
|
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
import com.sun.star.lang.XMultiServiceFactory;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
import helper.APIDescGetter;
|
2003-10-06 11:37:22 +00:00
|
|
|
import helper.AppProvider;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.FileReader;
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
|
|
|
|
import java.util.Vector;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
import lib.MultiMethodTest;
|
|
|
|
import lib.TestCase;
|
|
|
|
import lib.TestEnvironment;
|
|
|
|
import lib.TestParameters;
|
2004-11-02 10:07:13 +00:00
|
|
|
import lib.TestResult;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
import share.DescEntry;
|
|
|
|
import share.DescGetter;
|
2003-01-27 15:27:53 +00:00
|
|
|
import share.LogWriter;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
import stats.OutProducerFactory;
|
2003-01-27 15:27:53 +00:00
|
|
|
import stats.Summarizer;
|
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
import util.DynamicClassLoader;
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* this class handles tests written in java and running on a fat Office
|
|
|
|
*/
|
2009-07-06 10:30:52 +00:00
|
|
|
public class java_fat implements TestBase
|
|
|
|
{
|
2008-06-13 11:43:02 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private static boolean debug = false;
|
|
|
|
private static boolean keepdocument = false;
|
|
|
|
private static boolean logging = true;
|
|
|
|
private static boolean newOffice = false;
|
2004-11-02 10:07:13 +00:00
|
|
|
private DynamicClassLoader dcl = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private lib.TestParameters m_aParams;
|
|
|
|
private AppProvider m_aOffice;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
public boolean executeTest(lib.TestParameters param)
|
|
|
|
{
|
|
|
|
m_aParams = param;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
dcl = new DynamicClassLoader();
|
2004-04-21 11:42:57 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
DescGetter dg = new APIDescGetter();
|
|
|
|
String job = (String) param.get("TestJob");
|
|
|
|
String ExclusionFile = (String) param.get("ExclusionList");
|
|
|
|
Vector exclusions = null;
|
|
|
|
boolean retValue = true;
|
|
|
|
debug = param.getBool("DebugIsActive");
|
|
|
|
logging = param.getBool("LoggingIsActive");
|
|
|
|
keepdocument = param.getBool("KeepDocument");
|
|
|
|
newOffice = param.getBool(util.PropertyName.NEW_OFFICE_INSTANCE);
|
|
|
|
if (keepdocument)
|
|
|
|
{
|
|
|
|
System.setProperty("KeepDocument", "true");
|
|
|
|
}
|
|
|
|
if (ExclusionFile != null)
|
|
|
|
{
|
|
|
|
exclusions = getExclusionList(ExclusionFile, debug);
|
|
|
|
}
|
|
|
|
//get Job-Descriptions
|
|
|
|
System.out.println("Getting Descriptions for Job: " + job);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
String sDescriptionPath = (String) param.get("DescriptionPath");
|
|
|
|
DescEntry[] entries = dg.getDescriptionFor(job, sDescriptionPath, debug);
|
|
|
|
|
|
|
|
// System.out.println();
|
|
|
|
|
|
|
|
if (entries == null)
|
|
|
|
{
|
|
|
|
System.out.println("Couldn't get Description for Job: " + job);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2005-11-02 16:40:33 +00:00
|
|
|
// String officeProviderName = (String) param.get("OfficeProvider");
|
|
|
|
// AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);
|
|
|
|
//
|
|
|
|
// if (office == null) {
|
|
|
|
// System.out.println("ERROR: Wrong parameter 'OfficeProvider', " +
|
|
|
|
// " it cannot be instantiated.");
|
|
|
|
// System.exit(-1);
|
|
|
|
// }
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
m_aOffice = startOffice(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
boolean firstRun = true;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
for (int l = 0; l < entries.length; l++)
|
|
|
|
{
|
|
|
|
if (entries[l] == null)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (entries[l].hasErrorMsg)
|
|
|
|
{
|
|
|
|
System.out.println(entries[l].ErrorMsg);
|
|
|
|
retValue = false;
|
|
|
|
continue;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (!firstRun && newOffice)
|
|
|
|
{
|
|
|
|
if (!m_aOffice.closeExistingOffice(param, true))
|
|
|
|
{
|
|
|
|
m_aOffice.disposeManager(param);
|
|
|
|
}
|
|
|
|
startOffice(param);
|
2005-11-02 16:40:33 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
firstRun = false;
|
2005-11-02 16:40:33 +00:00
|
|
|
|
|
|
|
// XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager(
|
|
|
|
// param);
|
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
XMultiServiceFactory msf = (XMultiServiceFactory) param.getMSF();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (msf == null)
|
|
|
|
{
|
|
|
|
retValue = false;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2005-11-02 16:40:33 +00:00
|
|
|
// param.put("ServiceFactory", msf);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
DescEntry entry = entries[l];
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
//get some helper classes
|
|
|
|
Summarizer sumIt = new Summarizer();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
TestCase tCase = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
tCase = (TestCase) dcl.getInstance("mod._" + entry.entryName);
|
|
|
|
}
|
|
|
|
catch (java.lang.IllegalArgumentException ie)
|
|
|
|
{
|
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
|
|
|
}
|
|
|
|
catch (java.lang.NoClassDefFoundError ie)
|
|
|
|
{
|
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
|
|
|
}
|
2008-06-13 11:43:02 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (tCase == null)
|
|
|
|
{
|
|
|
|
Summarizer.summarizeDown(entry, entry.ErrorMsg);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
|
|
|
entry.UserDefinedParams = param;
|
|
|
|
sumObj.initialize(entry, logging);
|
|
|
|
sumObj.summary(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (debug)
|
|
|
|
{
|
|
|
|
System.out.println("sleeping 5 seconds..");
|
|
|
|
}
|
|
|
|
util.utils.shortWait(5000);
|
2003-02-14 08:10:44 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
System.out.println("Creating: " + entry.entryName);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter log = (LogWriter) dcl.getInstance((String) param.get("LogWriter"));
|
|
|
|
log.initialize(entry, logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.UserDefinedParams = param;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
TestEnvironment tEnv = null;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
tCase.setLogWriter((PrintWriter) log);
|
|
|
|
tCase.initializeTestCase(param);
|
|
|
|
tEnv = tCase.getTestEnvironment(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
System.out.println("Exception while creating " + tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
|
|
|
e.printStackTrace();
|
|
|
|
tEnv = null;
|
|
|
|
}
|
|
|
|
catch (java.lang.UnsatisfiedLinkError e)
|
|
|
|
{
|
|
|
|
System.out.println("Exception while creating " + tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
|
|
|
tEnv = null;
|
|
|
|
}
|
|
|
|
catch (java.lang.NoClassDefFoundError e)
|
|
|
|
{
|
|
|
|
System.out.println("Exception while creating " + tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
|
|
|
tEnv = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tEnv == null)
|
|
|
|
{
|
|
|
|
Summarizer.summarizeDown(entry, "Couldn't create " + tCase.getObjectName());
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
|
|
|
entry.UserDefinedParams = param;
|
|
|
|
sumObj.initialize(entry, logging);
|
|
|
|
sumObj.summary(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
System.out.println(tCase.getObjectName() + " recreated ");
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
for (int j = 0; j < entry.SubEntryCount; j++)
|
|
|
|
{
|
|
|
|
DescEntry aSubEntry = entry.SubEntries[j];
|
|
|
|
if (!aSubEntry.isToTest)
|
|
|
|
{
|
|
|
|
Summarizer.summarizeDown(aSubEntry, "not part of the job");
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if ((exclusions != null) && (exclusions.contains(aSubEntry.longName)))
|
|
|
|
{
|
|
|
|
Summarizer.summarizeDown(aSubEntry, "known issue");
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
continue;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
System.out.println("running: '" + aSubEntry.entryName + "'");
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter ifclog = (LogWriter) dcl.getInstance( (String) param.get("LogWriter"));
|
|
|
|
|
|
|
|
ifclog.initialize(aSubEntry, logging);
|
|
|
|
aSubEntry.UserDefinedParams = param;
|
|
|
|
aSubEntry.Logger = ifclog;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if ((tEnv == null) || tEnv.isDisposed())
|
|
|
|
{
|
|
|
|
closeExistingOffice();
|
2004-11-02 10:07:13 +00:00
|
|
|
tEnv = getEnv(entry, param);
|
2009-07-06 10:30:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MultiMethodTest ifc = null;
|
|
|
|
lib.TestResult res = null;
|
|
|
|
|
|
|
|
// run the interface test twice if it failed.
|
|
|
|
int countInterfaceTestRun = 0;
|
|
|
|
boolean finished = false;
|
|
|
|
while (!finished)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
countInterfaceTestRun++;
|
|
|
|
finished = true;
|
|
|
|
res = executeInterfaceTest(aSubEntry, tEnv, param);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException iae)
|
|
|
|
{
|
|
|
|
System.out.println("Couldn't load class " + aSubEntry.entryName);
|
|
|
|
System.out.println("**** " + iae.getMessage() + " ****");
|
|
|
|
Summarizer.summarizeDown(aSubEntry, iae.getMessage());
|
|
|
|
}
|
|
|
|
catch (java.lang.NoClassDefFoundError iae)
|
|
|
|
{
|
|
|
|
System.out.println("Couldn't load class " + aSubEntry.entryName);
|
|
|
|
System.out.println("**** " + iae.getMessage() + " ****");
|
|
|
|
Summarizer.summarizeDown(aSubEntry, iae.getMessage());
|
|
|
|
}
|
|
|
|
catch (java.lang.RuntimeException e)
|
|
|
|
{
|
|
|
|
closeExistingOffice();
|
|
|
|
tEnv = getEnv(entry, param);
|
|
|
|
if (countInterfaceTestRun < 2)
|
|
|
|
{
|
|
|
|
finished = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Summarizer.summarizeDown(aSubEntry, e.toString() + ".FAILED");
|
|
|
|
}
|
2004-11-02 10:07:13 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
if (res != null)
|
|
|
|
{
|
|
|
|
for (int k = 0; k < aSubEntry.SubEntryCount; k++)
|
|
|
|
{
|
|
|
|
DescEntry aSubSubEntry = aSubEntry.SubEntries[k];
|
|
|
|
if (res.hasMethod( aSubSubEntry.entryName))
|
|
|
|
{
|
|
|
|
aSubSubEntry.State = res.getStatusFor(aSubSubEntry.entryName).toString();
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
sumIt.summarizeUp(aSubEntry);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter sumIfc = OutProducerFactory.createOutProducer(param);
|
|
|
|
aSubEntry.UserDefinedParams = param;
|
|
|
|
sumIfc.initialize(aSubEntry, logging);
|
|
|
|
sumIfc.summary(aSubEntry);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (!keepdocument)
|
|
|
|
{
|
|
|
|
tCase.cleanupTestCase(param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
System.out.println("couldn't cleanup");
|
|
|
|
}
|
|
|
|
catch (java.lang.NoClassDefFoundError e)
|
|
|
|
{
|
|
|
|
System.out.println("couldn't cleanup");
|
2008-06-13 11:43:02 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
sumIt.summarizeUp(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
2003-10-06 11:37:22 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
sumObj.initialize(entry, logging);
|
|
|
|
sumObj.summary(entry);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (entries.length > 0)
|
|
|
|
{
|
|
|
|
System.out.println();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
int counter = 0;
|
|
|
|
System.out.println("Failures that appeared during scenario execution:");
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
for (int i = 0; i < entries.length; i++)
|
|
|
|
{
|
|
|
|
if (!entries[i].State.endsWith("OK"))
|
|
|
|
{
|
|
|
|
System.out.println("\t " + entries[i].longName);
|
|
|
|
counter++;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
System.out.println(counter + " of " + entries.length + " tests failed");
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
closeExistingOffice();
|
|
|
|
return retValue;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private TestEnvironment getEnv(DescEntry entry, TestParameters param)
|
|
|
|
{
|
2005-11-02 16:40:33 +00:00
|
|
|
// if (dcl == null)
|
|
|
|
// dcl = new DynamicClassLoader();
|
|
|
|
// String officeProviderName = (String) param.get("OfficeProvider");
|
|
|
|
// AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);
|
|
|
|
//
|
|
|
|
// if (office == null) {
|
|
|
|
// System.out.println("ERROR: Wrong parameter 'OfficeProvider', " +
|
|
|
|
// " it cannot be instantiated.");
|
|
|
|
// System.exit(-1);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager(
|
|
|
|
// param);
|
|
|
|
//
|
|
|
|
// if (msf == null) {
|
|
|
|
// return null;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// param.put("ServiceFactory", msf);
|
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
// AppProvider office = startOffice(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
TestCase tCase = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
tCase = (TestCase) dcl.getInstance("mod._" + entry.entryName);
|
|
|
|
}
|
|
|
|
catch (java.lang.IllegalArgumentException ie)
|
|
|
|
{
|
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
|
|
|
}
|
|
|
|
catch (java.lang.NoClassDefFoundError ie)
|
|
|
|
{
|
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
System.out.println("Creating: " + entry.entryName);
|
2008-06-13 11:43:02 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
entry.UserDefinedParams = param;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
LogWriter log = (LogWriter) dcl.getInstance((String) param.get("LogWriter"));
|
|
|
|
log.initialize(entry, logging);
|
|
|
|
tCase.setLogWriter((PrintWriter) log);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
TestEnvironment tEnv = null;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
tCase.initializeTestCase(param);
|
|
|
|
tEnv = tCase.getTestEnvironment(param);
|
|
|
|
}
|
|
|
|
catch (com.sun.star.lang.DisposedException de)
|
|
|
|
{
|
|
|
|
System.out.println("Office disposed");
|
|
|
|
closeExistingOffice();
|
|
|
|
}
|
|
|
|
catch (lib.StatusException e)
|
|
|
|
{
|
|
|
|
System.out.println(e.getMessage());
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
closeExistingOffice();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
entry.ErrorMsg = e.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
return tEnv;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private void closeExistingOffice()
|
|
|
|
{
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) m_aParams.get("AppProvider");
|
|
|
|
|
|
|
|
if (ph != null)
|
|
|
|
{
|
|
|
|
m_aOffice.closeExistingOffice(m_aParams, true);
|
2003-10-06 11:37:22 +00:00
|
|
|
shortWait(5000);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private void shortWait(int millis)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Thread.sleep(millis);
|
|
|
|
}
|
|
|
|
catch (java.lang.InterruptedException ie)
|
|
|
|
{
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
|
|
|
|
private Vector getExclusionList(String url, boolean debug)
|
|
|
|
{
|
|
|
|
Vector entryList = new Vector();
|
|
|
|
String line = "#";
|
|
|
|
BufferedReader exclusion = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
exclusion = new BufferedReader(new FileReader(url));
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
catch (java.io.FileNotFoundException fnfe)
|
|
|
|
{
|
|
|
|
if (debug)
|
|
|
|
{
|
|
|
|
System.out.println("Couldn't find file " + url);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
return entryList;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (line != null)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (!line.startsWith("#") && (line.length() > 1))
|
|
|
|
{
|
|
|
|
entryList.add(line.trim());
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
line = exclusion.readLine();
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
catch (java.io.IOException ioe)
|
|
|
|
{
|
|
|
|
if (debug)
|
|
|
|
{
|
|
|
|
System.out.println("Exception while reading exclusion list");
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
return entryList;
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
exclusion.close();
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2009-07-06 10:30:52 +00:00
|
|
|
catch (java.io.IOException ioe)
|
|
|
|
{
|
|
|
|
if (debug)
|
|
|
|
{
|
|
|
|
System.out.println("Couldn't close file " + url);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
return entryList;
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return entryList;
|
|
|
|
}
|
|
|
|
|
2004-11-02 10:07:13 +00:00
|
|
|
private TestResult executeInterfaceTest(
|
2008-06-13 11:43:02 +00:00
|
|
|
DescEntry entry, TestEnvironment tEnv, TestParameters param)
|
2009-07-06 10:30:52 +00:00
|
|
|
throws IllegalArgumentException, java.lang.NoClassDefFoundError
|
|
|
|
{
|
|
|
|
MultiMethodTest ifc = (MultiMethodTest) dcl.getInstance(entry.entryName);
|
|
|
|
return ifc.run(entry, tEnv, param);
|
|
|
|
}
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
private AppProvider startOffice(lib.TestParameters param)
|
|
|
|
{
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (dcl == null)
|
|
|
|
{
|
|
|
|
dcl = new DynamicClassLoader();
|
|
|
|
}
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
String officeProviderName = (String) param.get("OfficeProvider");
|
|
|
|
AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (office == null)
|
|
|
|
{
|
|
|
|
System.out.println("ERROR: Wrong parameter 'OfficeProvider', " + " it cannot be instantiated.");
|
|
|
|
System.exit(-1);
|
|
|
|
}
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager(param);
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
if (msf != null)
|
|
|
|
{
|
|
|
|
param.put("ServiceFactory", msf);
|
|
|
|
}
|
2005-11-02 16:40:33 +00:00
|
|
|
|
2009-07-06 10:30:52 +00:00
|
|
|
return office;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|