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 $
|
|
|
|
* $Revision: 1.14 $
|
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 base.TestBase;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
import com.sun.star.bridge.XUnoUrlResolver;
|
2003-11-18 15:12:39 +00:00
|
|
|
import com.sun.star.connection.XConnection;
|
|
|
|
import com.sun.star.connection.XConnector;
|
|
|
|
import com.sun.star.lang.XMultiComponentFactory;
|
|
|
|
import com.sun.star.lang.XMultiServiceFactory;
|
2003-01-27 15:27:53 +00:00
|
|
|
import com.sun.star.uno.UnoRuntime;
|
2003-11-18 15:12:39 +00:00
|
|
|
import com.sun.star.uno.XComponentContext;
|
2003-01-27 15:27:53 +00:00
|
|
|
import com.sun.star.uno.XInterface;
|
|
|
|
import com.sun.star.uno.XNamingService;
|
|
|
|
|
|
|
|
import helper.APIDescGetter;
|
2003-10-06 11:37:22 +00:00
|
|
|
import helper.AppProvider;
|
2003-11-18 15:12:39 +00:00
|
|
|
import helper.OfficeProvider;
|
|
|
|
|
|
|
|
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.Status;
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
public class java_fat implements TestBase {
|
|
|
|
public static boolean debug = false;
|
2004-01-05 17:42:20 +00:00
|
|
|
public static boolean keepdocument = false;
|
2004-04-21 11:42:57 +00:00
|
|
|
public static boolean logging = true;
|
2005-11-02 16:40:33 +00:00
|
|
|
public static boolean newOffice = false;
|
2004-11-02 10:07:13 +00:00
|
|
|
private DynamicClassLoader dcl = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
public boolean executeTest(lib.TestParameters param) {
|
2004-11-02 10:07:13 +00:00
|
|
|
dcl = new DynamicClassLoader();
|
2003-10-06 11:37:22 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
DescGetter dg = new APIDescGetter();
|
|
|
|
String job = (String) param.get("TestJob");
|
2003-11-18 15:12:39 +00:00
|
|
|
String ExclusionFile = (String) param.get("ExclusionList");
|
|
|
|
Vector exclusions = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
boolean retValue = true;
|
2003-10-06 11:37:22 +00:00
|
|
|
debug = param.getBool("DebugIsActive");
|
2004-04-21 11:42:57 +00:00
|
|
|
logging = param.getBool("LoggingIsActive");
|
2004-01-05 17:42:20 +00:00
|
|
|
keepdocument = param.getBool("KeepDocument");
|
2005-11-02 16:40:33 +00:00
|
|
|
newOffice = param.getBool(util.PropertyName.NEW_OFFICE_INSTANCE);
|
2004-01-05 17:42:20 +00:00
|
|
|
if (keepdocument) System.setProperty("KeepDocument","true");
|
2003-11-18 15:12:39 +00:00
|
|
|
if (ExclusionFile != null) {
|
|
|
|
exclusions = getExclusionList(ExclusionFile,debug);
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
//get Job-Descriptions
|
2004-04-21 11:42:57 +00:00
|
|
|
System.out.println("Getting Descriptions for Job: " + job);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
DescEntry[] entries = dg.getDescriptionFor(job,
|
2003-11-18 15:12:39 +00:00
|
|
|
(String) param.get(
|
|
|
|
"DescriptionPath"),
|
|
|
|
debug);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2004-04-21 11:42:57 +00:00
|
|
|
System.out.println();
|
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
if (entries == null) {
|
2004-11-02 10:07:13 +00:00
|
|
|
System.out.println("Couldn't get Description for Job: " + job);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2005-11-02 16:40:33 +00:00
|
|
|
AppProvider office = startOffice(param);
|
|
|
|
|
|
|
|
boolean firstRun = true;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
for (int l = 0; l < entries.length; l++) {
|
|
|
|
if (entries[l] == null) {
|
2003-01-27 15:27:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entries[l].hasErrorMsg) {
|
|
|
|
System.out.println(entries[l].ErrorMsg);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-11-02 16:40:33 +00:00
|
|
|
if (!firstRun && newOffice){
|
|
|
|
if (!office.closeExistingOffice(param, true)){
|
|
|
|
office.disposeManager(param);
|
|
|
|
}
|
|
|
|
startOffice(param);
|
|
|
|
}
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
// XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager(
|
|
|
|
// param);
|
|
|
|
|
|
|
|
XMultiServiceFactory msf = (XMultiServiceFactory) param.getMSF();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
if (msf == null) {
|
|
|
|
retValue = false;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +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
|
|
|
|
|
|
|
DescEntry entry = entries[l];
|
|
|
|
|
|
|
|
//get some helper classes
|
|
|
|
Summarizer sumIt = new Summarizer();
|
|
|
|
|
|
|
|
TestCase tCase = null;
|
|
|
|
|
|
|
|
try {
|
2003-11-18 15:12:39 +00:00
|
|
|
tCase = (TestCase) dcl.getInstance("mod._" +
|
|
|
|
entry.entryName);
|
2003-01-27 15:27:53 +00:00
|
|
|
} catch (java.lang.IllegalArgumentException ie) {
|
2003-11-18 15:12:39 +00:00
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
2003-02-14 08:10:44 +00:00
|
|
|
} catch (java.lang.NoClassDefFoundError ie) {
|
2003-11-18 15:12:39 +00:00
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tCase == null) {
|
2003-11-18 15:12:39 +00:00
|
|
|
sumIt.summarizeDown(entry, entry.ErrorMsg);
|
|
|
|
|
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.UserDefinedParams = param;
|
2004-04-21 11:42:57 +00:00
|
|
|
sumObj.initialize(entry, logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
sumObj.summary(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println("Creating: " + tCase.getObjectName());
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
LogWriter log = (LogWriter) dcl.getInstance(
|
2003-11-18 15:12:39 +00:00
|
|
|
(String) param.get("LogWriter"));
|
2004-04-21 11:42:57 +00:00
|
|
|
log.initialize(entry, logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.UserDefinedParams = param;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
TestEnvironment tEnv = null;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
try {
|
|
|
|
tCase.setLogWriter((PrintWriter) log);
|
|
|
|
tCase.initializeTestCase(param);
|
|
|
|
tEnv = tCase.getTestEnvironment(param);
|
|
|
|
} catch (Exception e) {
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println("Exception while creating " +
|
|
|
|
tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
2004-07-23 09:42:29 +00:00
|
|
|
e.printStackTrace ();
|
2003-01-27 15:27:53 +00:00
|
|
|
tEnv = null;
|
2003-02-14 08:10:44 +00:00
|
|
|
} catch (java.lang.UnsatisfiedLinkError e) {
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println("Exception while creating " +
|
|
|
|
tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
2003-02-14 08:10:44 +00:00
|
|
|
tEnv = null;
|
|
|
|
} catch (java.lang.NoClassDefFoundError e) {
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println("Exception while creating " +
|
|
|
|
tCase.getObjectName());
|
|
|
|
System.out.println("Message " + e.getMessage());
|
2003-02-14 08:10:44 +00:00
|
|
|
tEnv = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-02-14 08:10:44 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
if (tEnv == null) {
|
2003-11-18 15:12:39 +00:00
|
|
|
sumIt.summarizeDown(entry,
|
|
|
|
"Couldn't create " +
|
|
|
|
tCase.getObjectName());
|
|
|
|
|
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.UserDefinedParams = param;
|
2004-04-21 11:42:57 +00:00
|
|
|
sumObj.initialize(entry, logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
sumObj.summary(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
System.out.println(tCase.getObjectName() + " recreated ");
|
|
|
|
|
|
|
|
for (int j = 0; j < entry.SubEntryCount; j++) {
|
2003-01-27 15:27:53 +00:00
|
|
|
if (!entry.SubEntries[j].isToTest) {
|
2003-11-18 15:12:39 +00:00
|
|
|
Summarizer.summarizeDown(entry.SubEntries[j],
|
|
|
|
"not part of the job");
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
if (( exclusions != null ) && (exclusions.contains(entry.SubEntries[j].longName))) {
|
|
|
|
Summarizer.summarizeDown(entry.SubEntries[j],
|
|
|
|
"known issue");
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("running: " +
|
|
|
|
entry.SubEntries[j].entryName);
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
LogWriter ifclog = (LogWriter) dcl.getInstance(
|
2003-11-18 15:12:39 +00:00
|
|
|
(String) param.get("LogWriter"));
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2004-04-21 11:42:57 +00:00
|
|
|
ifclog.initialize(entry.SubEntries[j], logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.SubEntries[j].UserDefinedParams = param;
|
|
|
|
entry.SubEntries[j].Logger = ifclog;
|
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
if ((tEnv == null) || tEnv.isDisposed()) {
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
|
|
|
|
"AppProvider");
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
if (ph != null) {
|
2003-10-06 11:37:22 +00:00
|
|
|
office.closeExistingOffice(param, true);
|
2003-01-27 15:27:53 +00:00
|
|
|
shortWait(5000);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
tEnv = getEnv(entry, param);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MultiMethodTest ifc = null;
|
|
|
|
lib.TestResult res = null;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2004-11-02 10:07:13 +00:00
|
|
|
// run the interface test twice if it failed.
|
|
|
|
int countInterfaceTestRun = 0;
|
|
|
|
boolean finished = false;
|
|
|
|
while (!finished) {
|
|
|
|
try {
|
|
|
|
countInterfaceTestRun++;
|
|
|
|
finished = true;
|
|
|
|
res = executeInterfaceTest(entry.SubEntries[j], tEnv, param);
|
|
|
|
} catch (IllegalArgumentException iae) {
|
|
|
|
System.out.println("Couldn't load class " +
|
|
|
|
entry.SubEntries[j].entryName);
|
|
|
|
System.out.println("**** " + iae.getMessage() + " ****");
|
|
|
|
Summarizer.summarizeDown(entry.SubEntries[j],
|
|
|
|
iae.getMessage());
|
|
|
|
} catch (java.lang.NoClassDefFoundError iae) {
|
|
|
|
System.out.println("Couldn't load class " +
|
|
|
|
entry.SubEntries[j].entryName);
|
|
|
|
System.out.println("**** " + iae.getMessage() + " ****");
|
|
|
|
Summarizer.summarizeDown(entry.SubEntries[j],
|
|
|
|
iae.getMessage());
|
|
|
|
} catch (java.lang.RuntimeException e) {
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
|
|
|
|
"AppProvider");
|
|
|
|
|
|
|
|
if (ph != null) {
|
|
|
|
office.closeExistingOffice(param, true);
|
|
|
|
shortWait(5000);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2004-11-02 10:07:13 +00:00
|
|
|
tEnv = getEnv(entry, param);
|
|
|
|
if (countInterfaceTestRun < 2) {
|
|
|
|
finished = false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Summarizer.summarizeDown(entry.SubEntries[j],
|
|
|
|
e.toString()+".FAILED");
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
}
|
2004-11-02 10:07:13 +00:00
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
if (res != null) {
|
2003-11-18 15:12:39 +00:00
|
|
|
for (int k = 0; k < entry.SubEntries[j].SubEntryCount; k++) {
|
|
|
|
if (res.hasMethod(
|
|
|
|
entry.SubEntries[j].SubEntries[k].entryName)) {
|
|
|
|
entry.SubEntries[j].SubEntries[k].State = res.getStatusFor(
|
|
|
|
entry.SubEntries[j].SubEntries[k].entryName)
|
|
|
|
.toString();
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
sumIt.summarizeUp(entry.SubEntries[j]);
|
|
|
|
|
2003-12-11 10:31:00 +00:00
|
|
|
LogWriter sumIfc = OutProducerFactory.createOutProducer(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
entry.SubEntries[j].UserDefinedParams = param;
|
2004-04-21 11:42:57 +00:00
|
|
|
sumIfc.initialize(entry.SubEntries[j], logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
sumIfc.summary(entry.SubEntries[j]);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
try {
|
2004-01-05 17:42:20 +00:00
|
|
|
if (!keepdocument) tCase.cleanupTestCase(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
} catch (Exception e) {
|
2003-02-14 08:10:44 +00:00
|
|
|
System.out.println("couldn't cleanup");
|
2003-11-18 15:12:39 +00:00
|
|
|
} catch (java.lang.NoClassDefFoundError e) {
|
2003-02-14 08:10:44 +00:00
|
|
|
System.out.println("couldn't cleanup");
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
sumIt.summarizeUp(entry);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
LogWriter sumObj = OutProducerFactory.createOutProducer(param);
|
|
|
|
|
2004-04-21 11:42:57 +00:00
|
|
|
sumObj.initialize(entry, logging);
|
2003-01-27 15:27:53 +00:00
|
|
|
sumObj.summary(entry);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
if (entries.length > 1) {
|
|
|
|
System.out.println();
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
int counter = 0;
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println(
|
|
|
|
"Failures that appeared during scenario execution:");
|
|
|
|
|
|
|
|
for (int i = 0; i < entries.length; i++) {
|
|
|
|
if (!entries[i].State.endsWith("OK")) {
|
|
|
|
System.out.println("\t " + entries[i].longName);
|
2003-01-27 15:27:53 +00:00
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
System.out.println(counter + " of " + entries.length +
|
|
|
|
" tests failed");
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
|
|
|
|
"AppProvider");
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
if (ph != null) {
|
2003-10-06 11:37:22 +00:00
|
|
|
office.closeExistingOffice(param, true);
|
2003-01-27 15:27:53 +00:00
|
|
|
shortWait(5000);
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
return retValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected 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);
|
|
|
|
|
|
|
|
AppProvider office = startOffice(param);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
TestCase tCase = null;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
try {
|
2003-11-18 15:12:39 +00:00
|
|
|
tCase = (TestCase) dcl.getInstance("mod._" + entry.entryName);
|
2003-10-06 11:37:22 +00:00
|
|
|
} catch (java.lang.IllegalArgumentException ie) {
|
2003-11-18 15:12:39 +00:00
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
2003-10-06 11:37:22 +00:00
|
|
|
} catch (java.lang.NoClassDefFoundError ie) {
|
2003-11-18 15:12:39 +00:00
|
|
|
entry.ErrorMsg = ie.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
2003-10-06 11:37:22 +00:00
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2003-11-18 15:12:39 +00:00
|
|
|
System.out.println("Creating: " + tCase.getObjectName());
|
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
LogWriter log = (LogWriter) dcl.getInstance(
|
2003-11-18 15:12:39 +00:00
|
|
|
(String) param.get("LogWriter"));
|
2004-04-21 11:42:57 +00:00
|
|
|
log.initialize(entry, logging);
|
2003-10-06 11:37:22 +00:00
|
|
|
entry.UserDefinedParams = param;
|
|
|
|
tCase.setLogWriter((PrintWriter) log);
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
TestEnvironment tEnv = null;
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
try {
|
|
|
|
tCase.initializeTestCase(param);
|
|
|
|
tEnv = tCase.getTestEnvironment(param);
|
|
|
|
} catch (com.sun.star.lang.DisposedException de) {
|
|
|
|
System.out.println("Office disposed");
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
|
|
|
|
"AppProvider");
|
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
if (ph != null) {
|
|
|
|
office.closeExistingOffice(param, true);
|
|
|
|
shortWait(5000);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2003-10-06 11:37:22 +00:00
|
|
|
} catch (lib.StatusException e) {
|
|
|
|
System.out.println(e.getMessage());
|
2003-11-18 15:12:39 +00:00
|
|
|
|
|
|
|
helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
|
|
|
|
"AppProvider");
|
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
if (ph != null) {
|
|
|
|
office.closeExistingOffice(param, true);
|
|
|
|
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
|
|
|
entry.ErrorMsg = e.getMessage();
|
|
|
|
entry.hasErrorMsg = true;
|
|
|
|
}
|
2003-11-18 15:12:39 +00:00
|
|
|
|
2003-10-06 11:37:22 +00:00
|
|
|
return tEnv;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void shortWait(int millis) {
|
|
|
|
try {
|
|
|
|
Thread.sleep(millis);
|
2003-11-18 15:12:39 +00:00
|
|
|
} catch (java.lang.InterruptedException ie) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Vector getExclusionList(String url, boolean debug) {
|
|
|
|
Vector entryList = new Vector();
|
|
|
|
String line = "#";
|
|
|
|
BufferedReader exclusion = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
exclusion = new BufferedReader(new FileReader(url));
|
|
|
|
} catch (java.io.FileNotFoundException fnfe) {
|
|
|
|
if (debug) {
|
|
|
|
System.out.println("Couldn't find file " + url);
|
|
|
|
}
|
|
|
|
|
|
|
|
return entryList;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (line != null) {
|
|
|
|
try {
|
|
|
|
if (!line.startsWith("#")) {
|
|
|
|
entryList.add(line);
|
|
|
|
}
|
|
|
|
|
|
|
|
line = exclusion.readLine();
|
|
|
|
} catch (java.io.IOException ioe) {
|
|
|
|
if (debug) {
|
|
|
|
System.out.println(
|
|
|
|
"Exception while reading exclusion list");
|
|
|
|
}
|
|
|
|
|
|
|
|
return entryList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
exclusion.close();
|
|
|
|
} catch (java.io.IOException ioe) {
|
|
|
|
if (debug) {
|
|
|
|
System.out.println("Couldn't close file " + url);
|
|
|
|
}
|
|
|
|
|
|
|
|
return entryList;
|
|
|
|
}
|
|
|
|
|
|
|
|
return entryList;
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
2004-11-02 10:07:13 +00:00
|
|
|
|
|
|
|
private TestResult executeInterfaceTest(
|
|
|
|
DescEntry entry, TestEnvironment tEnv, TestParameters param)
|
|
|
|
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
|
|
|
|
|
|
|
private AppProvider startOffice(lib.TestParameters param){
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
param.put("ServiceFactory", msf);
|
|
|
|
|
|
|
|
return office;
|
|
|
|
}
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|