/** *
*/
@Before publicvoid before()
{
param = new TestParameters();
} /** *ExecutetheAPItestsinsideoftheOffice.IftheOfficecrashes,it *willberestartedandthejobwillcontinueaftertheonethatcausedthecrash.
*/
@Test publicvoid checkAPI() {
System.out.println("Start with test"); // if test is idle for 5 minutes, assume that it hangs and kill it.
XMultiServiceFactory xMSF = getMSF();
Object oObj = null; try {
oObj = xMSF.createInstance("org.openoffice.RunnerService");
} catch(com.sun.star.uno.Exception e) {
fail("Could not create Instance of 'org.openoffice.RunnerService'");
}
assertNotNull("Cannot create 'org.openoffice.RunnerService'", oObj);
// get the parameters for the internal test final NamedValue[] internalParams = new NamedValue[3];
internalParams[0] = new NamedValue();
internalParams[0].Name = "-OutProducer";
internalParams[0].Value = "stats.SimpleFileOutProducer";
internalParams[1] = new NamedValue();
internalParams[1].Name = "-OutputPath";
internalParams[1].Value = "/dev/null";
// do we have test jobs? final PropertyValue[] props = new PropertyValue[1];
props[0] = new PropertyValue();
props[0].Value = "sw.SwXTextTable";
try {
erg = (String)xJob.execute(internalParams);
} catch(Throwable t) { // restart and go on with test!!
t.printStackTrace();
fail("Test run '" + (String)props[i].Value +"' could not be executed: Office crashed and is killed!");
xMSF = null;
ProcessHandler handler = (ProcessHandler)param.get("AppProvider");
handler.kill();
util.utils.pause(10000);
OfficeProvider op = new OfficeProvider(); try {
xMSF = (XMultiServiceFactory)op.getManager(param);
param.put("ServiceFactory",xMSF);
oObj = xMSF.createInstance("org.openoffice.RunnerService");
} catch(com.sun.star.uno.Exception e) {
fail("Could not create Instance of 'org.openoffice.RunnerService'");
} catch (UnsupportedEncodingException e) {
fail("Could not get Manager'");
}
}
System.out.println(erg);
String processedErg = parseResult(erg);
assertTrue("Run '" + (String)props[i].Value + "' has result '" + processedErg + "'", processedErg == null);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.