clean upo runner.lib.TestParameters
- remove unused fields - make all external code go through the get(XXX) methods instead of also using the default values - remove default values declarations and inline them, since they are now unnecessary. Change-Id: Idc875fbd133de90044647f3e3b1feb225d81a643
This commit is contained in:
@@ -23,6 +23,7 @@ import com.sun.star.io.NotConnectedException;
|
||||
import com.sun.star.io.XInputStream;
|
||||
|
||||
import helper.StreamSimulator;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@@ -30,8 +31,10 @@ import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import lib.TestParameters;
|
||||
import share.LogWriter;
|
||||
import util.PropertyName;
|
||||
import util.utils;
|
||||
|
||||
|
||||
@@ -181,7 +184,7 @@ public class Helper {
|
||||
ArrayList<String> content = new ArrayList<String>();
|
||||
BufferedReader br;
|
||||
String line;
|
||||
if ( m_param.DebugIsActive ) {
|
||||
if ( m_param.getBool(PropertyName.DEBUG_IS_ACTIVE) ) {
|
||||
System.out.println("Looking for "+csvFileName);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ public class CfgParser
|
||||
|
||||
public void getIniParameters(TestParameters param)
|
||||
{
|
||||
debug = param.DebugIsActive;
|
||||
debug = param.getBool(PropertyName.DEBUG_IS_ACTIVE);
|
||||
Properties cfg = null;
|
||||
if (iniFile.equals(""))
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class CfgParser
|
||||
}
|
||||
}
|
||||
|
||||
debug = param.DebugIsActive;
|
||||
debug = param.getBool(PropertyName.DEBUG_IS_ACTIVE);
|
||||
|
||||
//check for platform dependent parameters
|
||||
//this would have a $OperatingSystem as prefix
|
||||
|
@@ -130,7 +130,7 @@ public class UnoProvider implements AppProvider {
|
||||
"/" + unorcName;
|
||||
}
|
||||
unorcName = utils.getFullURL(unorcName);
|
||||
if (param.DebugIsActive) {
|
||||
if (param.getBool(PropertyName.DEBUG_IS_ACTIVE)) {
|
||||
System.out.println("UnoUcr: " + unorcName);
|
||||
}
|
||||
return unorcName;
|
||||
@@ -148,7 +148,7 @@ public class UnoProvider implements AppProvider {
|
||||
base.indexOf("program")+7);
|
||||
|
||||
sysbindir = utils.getFullURL(sysbindir);
|
||||
if (param.DebugIsActive) {
|
||||
if (param.getBool(PropertyName.DEBUG_IS_ACTIVE)) {
|
||||
System.out.println("SysBinDir: " + sysbindir);
|
||||
}
|
||||
return sysbindir;
|
||||
|
@@ -38,72 +38,12 @@ public class TestParameters extends HashMap<String,Object> {
|
||||
* The ConnectionString for Office Connection<br>
|
||||
* default is 'socket,host=localhost,port=8100'
|
||||
*/
|
||||
public String ConnectionString = "socket,host=localhost,port=8100";
|
||||
|
||||
/**
|
||||
* The AppProvider contains the Application Provider<br>
|
||||
* to control the ServiceFactory.
|
||||
*/
|
||||
public Object AppProvider = null;
|
||||
|
||||
/**
|
||||
* The Process contains the Process handler<br>
|
||||
* to control the Application.
|
||||
*/
|
||||
public Object ProcessHandler = null;
|
||||
|
||||
/**
|
||||
* The AppExecutionCmd contains the full qualified<br>
|
||||
* command to an Application to be started.
|
||||
*/
|
||||
public String AppExecutionCommand = "";
|
||||
|
||||
/**
|
||||
* If this parameter is <CODE>true</CODE> the <CODE>OfficeProvider</CODE> tries
|
||||
* to get the URL to the binary of the office and to fill the
|
||||
* <CODE>AppExecutionCommand</CODE> with useful content if needet
|
||||
*/
|
||||
public boolean AutoRestart = false;
|
||||
|
||||
/**
|
||||
* Short wait time for the Office: default is 500 milliseconds
|
||||
*/
|
||||
public int ShortWait = 500;
|
||||
|
||||
/**
|
||||
* The OfficeProvider contains the full qualified
|
||||
* class that provides a connection to StarOffice<br>
|
||||
* default is helper.OfficeProvider
|
||||
*/
|
||||
public String OfficeProvider = "helper.OfficeProvider";
|
||||
|
||||
/**
|
||||
* The Testbase to be executed by the runner<br>
|
||||
* default is 'java_fat'
|
||||
*/
|
||||
public String TestBase = "java_fat";
|
||||
|
||||
/**
|
||||
* The ServiceFactory to create instances
|
||||
*/
|
||||
public Object ServiceFactory;
|
||||
|
||||
/**
|
||||
* The Path to the component description
|
||||
*/
|
||||
public String DescriptionPath;
|
||||
private static final String DefaultConnectionString = "socket,host=localhost,port=8100";
|
||||
|
||||
/**
|
||||
* The Path to the test documents that are loaded during the test <br>
|
||||
*/
|
||||
public String TestDocumentPath="unknown";
|
||||
|
||||
/**
|
||||
* 'true' is a log should be written, 'false' elsewhere <br>
|
||||
* these will be provided by the testcases<br>
|
||||
* default is true
|
||||
*/
|
||||
public boolean LoggingIsActive = true;
|
||||
private static final String DefaultTestDocumentPath = "unknown";
|
||||
|
||||
/**
|
||||
* 'true' is a debug information should be written, 'false' elsewhere
|
||||
@@ -111,43 +51,7 @@ public class TestParameters extends HashMap<String,Object> {
|
||||
* Debug information will always be written on standard out.<br>
|
||||
* default is true
|
||||
*/
|
||||
public boolean DebugIsActive = false;
|
||||
|
||||
/**
|
||||
* This parameter contains the test job to be executed<br>
|
||||
* by the framework
|
||||
*/
|
||||
public Object TestJob;
|
||||
|
||||
/**
|
||||
* This parameter contains the class used<br>
|
||||
* for Logging
|
||||
*/
|
||||
public String LogWriter="stats.SimpleLogWriter";
|
||||
|
||||
/**
|
||||
* This parameter contains the class used<br>
|
||||
* for Logging
|
||||
*/
|
||||
public String OutProducer="stats.SimpleOutProducer";
|
||||
|
||||
/**
|
||||
* This parameter contains the timeout used<br>
|
||||
* by the watcher
|
||||
*/
|
||||
public Integer TimeOut = new Integer(3000000);
|
||||
|
||||
/**
|
||||
* This parameter contains the timeout used<br>
|
||||
* by the complex tests
|
||||
*/
|
||||
public Integer ThreadTimeOut = new Integer(3000000);
|
||||
|
||||
/**
|
||||
* This parameter contains the time which the office could use to close for
|
||||
* itself before it is destroyed. Default is 15000 ms
|
||||
*/
|
||||
public Integer OfficeCloseTimeOut = new Integer(15000);
|
||||
private boolean DebugIsActive = false;
|
||||
|
||||
/**
|
||||
* Wrapper around "get()" with some debug output
|
||||
@@ -240,28 +144,28 @@ public class TestParameters extends HashMap<String,Object> {
|
||||
put(PropertyName.PIPE_CONNECTION_STRING,PipeConnectionString);
|
||||
put(PropertyName.USE_PIPE_CONNECTION, Boolean.TRUE);
|
||||
}
|
||||
put(PropertyName.CONNECTION_STRING,ConnectionString);
|
||||
put(PropertyName.TEST_BASE,TestBase);
|
||||
put(PropertyName.TEST_DOCUMENT_PATH,TestDocumentPath);
|
||||
put(PropertyName.LOGGING_IS_ACTIVE,LoggingIsActive?Boolean.TRUE:Boolean.FALSE);
|
||||
put(PropertyName.DEBUG_IS_ACTIVE,DebugIsActive?Boolean.TRUE:Boolean.FALSE);
|
||||
put(PropertyName.OUT_PRODUCER,OutProducer);
|
||||
put(PropertyName.SHORT_WAIT,new Integer(ShortWait));
|
||||
put(PropertyName.OFFICE_PROVIDER,OfficeProvider);
|
||||
put(PropertyName.LOG_WRITER,LogWriter);
|
||||
put(PropertyName.APP_EXECUTION_COMMAND,AppExecutionCommand);
|
||||
put(PropertyName.TIME_OUT,TimeOut);
|
||||
put(PropertyName.THREAD_TIME_OUT,ThreadTimeOut);
|
||||
put(PropertyName.AUTO_RESTART,AutoRestart?Boolean.TRUE:Boolean.FALSE);
|
||||
put(PropertyName.OFFICE_CLOSE_TIME_OUT, OfficeCloseTimeOut);
|
||||
put(PropertyName.CONNECTION_STRING, DefaultConnectionString);
|
||||
put(PropertyName.TEST_BASE, "java_fat");
|
||||
put(PropertyName.TEST_DOCUMENT_PATH, DefaultTestDocumentPath);
|
||||
put(PropertyName.LOGGING_IS_ACTIVE, Boolean.TRUE);
|
||||
put(PropertyName.DEBUG_IS_ACTIVE, Boolean.valueOf(DebugIsActive));
|
||||
put(PropertyName.OUT_PRODUCER, "stats.SimpleOutProducer");
|
||||
put(PropertyName.SHORT_WAIT, new Integer(500));
|
||||
put(PropertyName.OFFICE_PROVIDER, "helper.OfficeProvider");
|
||||
put(PropertyName.LOG_WRITER, "stats.SimpleLogWriter");
|
||||
put(PropertyName.APP_EXECUTION_COMMAND, "");
|
||||
put(PropertyName.TIME_OUT, new Integer(3000000));
|
||||
put(PropertyName.THREAD_TIME_OUT, new Integer(3000000));
|
||||
put(PropertyName.AUTO_RESTART, Boolean.FALSE);
|
||||
put(PropertyName.OFFICE_CLOSE_TIME_OUT, new Integer(15000));
|
||||
|
||||
// get the operating system
|
||||
put(PropertyName.OPERATING_SYSTEM, getSOCompatibleOSName());
|
||||
|
||||
//For compatibility Reasons
|
||||
put("CNCSTR",ConnectionString);
|
||||
put("DOCPTH",TestDocumentPath);
|
||||
System.setProperty("DOCPTH",TestDocumentPath);
|
||||
put("CNCSTR", DefaultConnectionString);
|
||||
put("DOCPTH", DefaultTestDocumentPath);
|
||||
System.setProperty("DOCPTH", DefaultTestDocumentPath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,6 +28,7 @@ import lib.TestParameters;
|
||||
import share.LogWriter;
|
||||
import stats.InternalLogWriter;
|
||||
import util.DynamicClassLoader;
|
||||
import util.PropertyName;
|
||||
import base.TestBase;
|
||||
|
||||
import com.sun.star.beans.NamedValue;
|
||||
@@ -77,8 +78,8 @@ public class RunnerService implements XJob, XServiceInfo,
|
||||
|
||||
|
||||
// take the standard log writer
|
||||
String standardLogWriter = param.LogWriter;
|
||||
String standardOutProducer = param.OutProducer;
|
||||
String standardLogWriter = (String) param.get(PropertyName.LOG_WRITER);
|
||||
String standardOutProducer = (String) param.get(PropertyName.OUT_PRODUCER);
|
||||
|
||||
ClParser cli = new ClParser();
|
||||
|
||||
@@ -116,9 +117,6 @@ public class RunnerService implements XJob, XServiceInfo,
|
||||
|
||||
param.put("ServiceFactory", xMSF);
|
||||
|
||||
param.ServiceFactory = xMSF; //(XMultiServiceFactory)
|
||||
// appProvider.getManager(param);
|
||||
|
||||
log.println("TestJob: "+param.get("TestJob"));
|
||||
|
||||
TestBase toExecute = (TestBase)dcl.getInstance("base.java_fat_service");
|
||||
|
@@ -24,6 +24,8 @@ package util;
|
||||
public interface PropertyName {
|
||||
/**
|
||||
* parameter name: "AppExecutionCommand"
|
||||
* The AppExecutionCmd contains the full qualified<br>
|
||||
* command to an Application to be started.
|
||||
*/
|
||||
final public static String APP_EXECUTION_COMMAND = "AppExecutionCommand";
|
||||
/**
|
||||
@@ -39,6 +41,8 @@ public interface PropertyName {
|
||||
|
||||
/**
|
||||
* parameter name: "TestBase"
|
||||
* The Testbase to be executed by the runner<br>
|
||||
* default is 'java_fat'
|
||||
*/
|
||||
final public static String TEST_BASE = "TestBase";
|
||||
/**
|
||||
@@ -47,6 +51,9 @@ public interface PropertyName {
|
||||
final public static String TEST_DOCUMENT_PATH = "TestDocumentPath";
|
||||
/**
|
||||
* parameter name: "LoggingIsActive"
|
||||
* 'true' is a log should be written, 'false' elsewhere <br>
|
||||
* these will be provided by the testcases<br>
|
||||
* default is true
|
||||
*/
|
||||
final public static String LOGGING_IS_ACTIVE = "LoggingIsActive";
|
||||
/**
|
||||
@@ -55,14 +62,20 @@ public interface PropertyName {
|
||||
final public static String DEBUG_IS_ACTIVE = "DebugIsActive";
|
||||
/**
|
||||
* parameter name: "OutProduceer"
|
||||
* This parameter contains the class used<br>
|
||||
* for Logging
|
||||
*/
|
||||
final public static String OUT_PRODUCER = "OutProducer";
|
||||
/**
|
||||
* parameter name: "ShortWait"
|
||||
* Short wait time for the Office: default is 500 milliseconds
|
||||
*/
|
||||
final public static String SHORT_WAIT= "ShortWait";
|
||||
/**
|
||||
* internal only, no parameter
|
||||
* The OfficeProvider contains the full qualified
|
||||
* class that provides a connection to StarOffice<br>
|
||||
* default is helper.OfficeProvider
|
||||
*/
|
||||
final public static String OFFICE_PROVIDER = "OfficeProvider";
|
||||
/**
|
||||
@@ -71,19 +84,27 @@ public interface PropertyName {
|
||||
final public static String OFFICE_WATCHER = "Watcher";
|
||||
/**
|
||||
* internal only, no parameter
|
||||
* This parameter contains the class used<br>
|
||||
* for Logging
|
||||
*/
|
||||
final public static String LOG_WRITER = "LogWriter";
|
||||
/**
|
||||
* parameter name: "TimeOut"<p>
|
||||
* time out given in milli seconds
|
||||
* This parameter contains the timeout used<br>
|
||||
* by the watcher
|
||||
*/
|
||||
final public static String TIME_OUT = "TimeOut";
|
||||
/**
|
||||
* parameter name: "ThreadTimeOut"
|
||||
* This parameter contains the timeout used<br>
|
||||
* by the complex tests
|
||||
*/
|
||||
final public static String THREAD_TIME_OUT = "ThreadTimeOut";
|
||||
/**
|
||||
* parameter name: "OfficeCloseTimeOut"
|
||||
* This parameter contains the time which the office could use to close for
|
||||
* itself before it is destroyed. Default is 15000 ms
|
||||
*/
|
||||
final public static String OFFICE_CLOSE_TIME_OUT = "OfficeCloseTimeOut";
|
||||
/**
|
||||
@@ -92,6 +113,10 @@ public interface PropertyName {
|
||||
final public static String OPERATING_SYSTEM = "OperatingSystem";
|
||||
/**
|
||||
* parameter name: "AutoRestart"
|
||||
* If this parameter is <CODE>true</CODE> the <CODE>OfficeProvider</CODE> tries
|
||||
* to get the URL to the binary of the office and to fill the
|
||||
* <CODE>AppExecutionCommand</CODE> with useful content if needed.
|
||||
* Default is false.
|
||||
*/
|
||||
final public static String AUTO_RESTART = "AutoRestart";
|
||||
/**
|
||||
|
Reference in New Issue
Block a user