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 com.sun.star.io.XInputStream;
|
||||||
|
|
||||||
import helper.StreamSimulator;
|
import helper.StreamSimulator;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
@@ -30,8 +31,10 @@ import java.util.Iterator;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import lib.TestParameters;
|
import lib.TestParameters;
|
||||||
import share.LogWriter;
|
import share.LogWriter;
|
||||||
|
import util.PropertyName;
|
||||||
import util.utils;
|
import util.utils;
|
||||||
|
|
||||||
|
|
||||||
@@ -181,7 +184,7 @@ public class Helper {
|
|||||||
ArrayList<String> content = new ArrayList<String>();
|
ArrayList<String> content = new ArrayList<String>();
|
||||||
BufferedReader br;
|
BufferedReader br;
|
||||||
String line;
|
String line;
|
||||||
if ( m_param.DebugIsActive ) {
|
if ( m_param.getBool(PropertyName.DEBUG_IS_ACTIVE) ) {
|
||||||
System.out.println("Looking for "+csvFileName);
|
System.out.println("Looking for "+csvFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ public class CfgParser
|
|||||||
|
|
||||||
public void getIniParameters(TestParameters param)
|
public void getIniParameters(TestParameters param)
|
||||||
{
|
{
|
||||||
debug = param.DebugIsActive;
|
debug = param.getBool(PropertyName.DEBUG_IS_ACTIVE);
|
||||||
Properties cfg = null;
|
Properties cfg = null;
|
||||||
if (iniFile.equals(""))
|
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
|
//check for platform dependent parameters
|
||||||
//this would have a $OperatingSystem as prefix
|
//this would have a $OperatingSystem as prefix
|
||||||
|
@@ -130,7 +130,7 @@ public class UnoProvider implements AppProvider {
|
|||||||
"/" + unorcName;
|
"/" + unorcName;
|
||||||
}
|
}
|
||||||
unorcName = utils.getFullURL(unorcName);
|
unorcName = utils.getFullURL(unorcName);
|
||||||
if (param.DebugIsActive) {
|
if (param.getBool(PropertyName.DEBUG_IS_ACTIVE)) {
|
||||||
System.out.println("UnoUcr: " + unorcName);
|
System.out.println("UnoUcr: " + unorcName);
|
||||||
}
|
}
|
||||||
return unorcName;
|
return unorcName;
|
||||||
@@ -148,7 +148,7 @@ public class UnoProvider implements AppProvider {
|
|||||||
base.indexOf("program")+7);
|
base.indexOf("program")+7);
|
||||||
|
|
||||||
sysbindir = utils.getFullURL(sysbindir);
|
sysbindir = utils.getFullURL(sysbindir);
|
||||||
if (param.DebugIsActive) {
|
if (param.getBool(PropertyName.DEBUG_IS_ACTIVE)) {
|
||||||
System.out.println("SysBinDir: " + sysbindir);
|
System.out.println("SysBinDir: " + sysbindir);
|
||||||
}
|
}
|
||||||
return sysbindir;
|
return sysbindir;
|
||||||
|
@@ -38,72 +38,12 @@ public class TestParameters extends HashMap<String,Object> {
|
|||||||
* The ConnectionString for Office Connection<br>
|
* The ConnectionString for Office Connection<br>
|
||||||
* default is 'socket,host=localhost,port=8100'
|
* default is 'socket,host=localhost,port=8100'
|
||||||
*/
|
*/
|
||||||
public String ConnectionString = "socket,host=localhost,port=8100";
|
private static final String DefaultConnectionString = "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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Path to the test documents that are loaded during the test <br>
|
* The Path to the test documents that are loaded during the test <br>
|
||||||
*/
|
*/
|
||||||
public String TestDocumentPath="unknown";
|
private static final String DefaultTestDocumentPath = "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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'true' is a debug information should be written, 'false' elsewhere
|
* '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>
|
* Debug information will always be written on standard out.<br>
|
||||||
* default is true
|
* default is true
|
||||||
*/
|
*/
|
||||||
public boolean DebugIsActive = false;
|
private 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper around "get()" with some debug output
|
* 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.PIPE_CONNECTION_STRING,PipeConnectionString);
|
||||||
put(PropertyName.USE_PIPE_CONNECTION, Boolean.TRUE);
|
put(PropertyName.USE_PIPE_CONNECTION, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
put(PropertyName.CONNECTION_STRING,ConnectionString);
|
put(PropertyName.CONNECTION_STRING, DefaultConnectionString);
|
||||||
put(PropertyName.TEST_BASE,TestBase);
|
put(PropertyName.TEST_BASE, "java_fat");
|
||||||
put(PropertyName.TEST_DOCUMENT_PATH,TestDocumentPath);
|
put(PropertyName.TEST_DOCUMENT_PATH, DefaultTestDocumentPath);
|
||||||
put(PropertyName.LOGGING_IS_ACTIVE,LoggingIsActive?Boolean.TRUE:Boolean.FALSE);
|
put(PropertyName.LOGGING_IS_ACTIVE, Boolean.TRUE);
|
||||||
put(PropertyName.DEBUG_IS_ACTIVE,DebugIsActive?Boolean.TRUE:Boolean.FALSE);
|
put(PropertyName.DEBUG_IS_ACTIVE, Boolean.valueOf(DebugIsActive));
|
||||||
put(PropertyName.OUT_PRODUCER,OutProducer);
|
put(PropertyName.OUT_PRODUCER, "stats.SimpleOutProducer");
|
||||||
put(PropertyName.SHORT_WAIT,new Integer(ShortWait));
|
put(PropertyName.SHORT_WAIT, new Integer(500));
|
||||||
put(PropertyName.OFFICE_PROVIDER,OfficeProvider);
|
put(PropertyName.OFFICE_PROVIDER, "helper.OfficeProvider");
|
||||||
put(PropertyName.LOG_WRITER,LogWriter);
|
put(PropertyName.LOG_WRITER, "stats.SimpleLogWriter");
|
||||||
put(PropertyName.APP_EXECUTION_COMMAND,AppExecutionCommand);
|
put(PropertyName.APP_EXECUTION_COMMAND, "");
|
||||||
put(PropertyName.TIME_OUT,TimeOut);
|
put(PropertyName.TIME_OUT, new Integer(3000000));
|
||||||
put(PropertyName.THREAD_TIME_OUT,ThreadTimeOut);
|
put(PropertyName.THREAD_TIME_OUT, new Integer(3000000));
|
||||||
put(PropertyName.AUTO_RESTART,AutoRestart?Boolean.TRUE:Boolean.FALSE);
|
put(PropertyName.AUTO_RESTART, Boolean.FALSE);
|
||||||
put(PropertyName.OFFICE_CLOSE_TIME_OUT, OfficeCloseTimeOut);
|
put(PropertyName.OFFICE_CLOSE_TIME_OUT, new Integer(15000));
|
||||||
|
|
||||||
// get the operating system
|
// get the operating system
|
||||||
put(PropertyName.OPERATING_SYSTEM, getSOCompatibleOSName());
|
put(PropertyName.OPERATING_SYSTEM, getSOCompatibleOSName());
|
||||||
|
|
||||||
//For compatibility Reasons
|
//For compatibility Reasons
|
||||||
put("CNCSTR",ConnectionString);
|
put("CNCSTR", DefaultConnectionString);
|
||||||
put("DOCPTH",TestDocumentPath);
|
put("DOCPTH", DefaultTestDocumentPath);
|
||||||
System.setProperty("DOCPTH",TestDocumentPath);
|
System.setProperty("DOCPTH", DefaultTestDocumentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -28,6 +28,7 @@ import lib.TestParameters;
|
|||||||
import share.LogWriter;
|
import share.LogWriter;
|
||||||
import stats.InternalLogWriter;
|
import stats.InternalLogWriter;
|
||||||
import util.DynamicClassLoader;
|
import util.DynamicClassLoader;
|
||||||
|
import util.PropertyName;
|
||||||
import base.TestBase;
|
import base.TestBase;
|
||||||
|
|
||||||
import com.sun.star.beans.NamedValue;
|
import com.sun.star.beans.NamedValue;
|
||||||
@@ -77,8 +78,8 @@ public class RunnerService implements XJob, XServiceInfo,
|
|||||||
|
|
||||||
|
|
||||||
// take the standard log writer
|
// take the standard log writer
|
||||||
String standardLogWriter = param.LogWriter;
|
String standardLogWriter = (String) param.get(PropertyName.LOG_WRITER);
|
||||||
String standardOutProducer = param.OutProducer;
|
String standardOutProducer = (String) param.get(PropertyName.OUT_PRODUCER);
|
||||||
|
|
||||||
ClParser cli = new ClParser();
|
ClParser cli = new ClParser();
|
||||||
|
|
||||||
@@ -116,9 +117,6 @@ public class RunnerService implements XJob, XServiceInfo,
|
|||||||
|
|
||||||
param.put("ServiceFactory", xMSF);
|
param.put("ServiceFactory", xMSF);
|
||||||
|
|
||||||
param.ServiceFactory = xMSF; //(XMultiServiceFactory)
|
|
||||||
// appProvider.getManager(param);
|
|
||||||
|
|
||||||
log.println("TestJob: "+param.get("TestJob"));
|
log.println("TestJob: "+param.get("TestJob"));
|
||||||
|
|
||||||
TestBase toExecute = (TestBase)dcl.getInstance("base.java_fat_service");
|
TestBase toExecute = (TestBase)dcl.getInstance("base.java_fat_service");
|
||||||
|
@@ -24,6 +24,8 @@ package util;
|
|||||||
public interface PropertyName {
|
public interface PropertyName {
|
||||||
/**
|
/**
|
||||||
* parameter name: "AppExecutionCommand"
|
* 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";
|
final public static String APP_EXECUTION_COMMAND = "AppExecutionCommand";
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +41,8 @@ public interface PropertyName {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* parameter name: "TestBase"
|
* parameter name: "TestBase"
|
||||||
|
* The Testbase to be executed by the runner<br>
|
||||||
|
* default is 'java_fat'
|
||||||
*/
|
*/
|
||||||
final public static String TEST_BASE = "TestBase";
|
final public static String TEST_BASE = "TestBase";
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +51,9 @@ public interface PropertyName {
|
|||||||
final public static String TEST_DOCUMENT_PATH = "TestDocumentPath";
|
final public static String TEST_DOCUMENT_PATH = "TestDocumentPath";
|
||||||
/**
|
/**
|
||||||
* parameter name: "LoggingIsActive"
|
* 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";
|
final public static String LOGGING_IS_ACTIVE = "LoggingIsActive";
|
||||||
/**
|
/**
|
||||||
@@ -55,14 +62,20 @@ public interface PropertyName {
|
|||||||
final public static String DEBUG_IS_ACTIVE = "DebugIsActive";
|
final public static String DEBUG_IS_ACTIVE = "DebugIsActive";
|
||||||
/**
|
/**
|
||||||
* parameter name: "OutProduceer"
|
* parameter name: "OutProduceer"
|
||||||
|
* This parameter contains the class used<br>
|
||||||
|
* for Logging
|
||||||
*/
|
*/
|
||||||
final public static String OUT_PRODUCER = "OutProducer";
|
final public static String OUT_PRODUCER = "OutProducer";
|
||||||
/**
|
/**
|
||||||
* parameter name: "ShortWait"
|
* parameter name: "ShortWait"
|
||||||
|
* Short wait time for the Office: default is 500 milliseconds
|
||||||
*/
|
*/
|
||||||
final public static String SHORT_WAIT= "ShortWait";
|
final public static String SHORT_WAIT= "ShortWait";
|
||||||
/**
|
/**
|
||||||
* internal only, no parameter
|
* 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";
|
final public static String OFFICE_PROVIDER = "OfficeProvider";
|
||||||
/**
|
/**
|
||||||
@@ -71,19 +84,27 @@ public interface PropertyName {
|
|||||||
final public static String OFFICE_WATCHER = "Watcher";
|
final public static String OFFICE_WATCHER = "Watcher";
|
||||||
/**
|
/**
|
||||||
* internal only, no parameter
|
* internal only, no parameter
|
||||||
|
* This parameter contains the class used<br>
|
||||||
|
* for Logging
|
||||||
*/
|
*/
|
||||||
final public static String LOG_WRITER = "LogWriter";
|
final public static String LOG_WRITER = "LogWriter";
|
||||||
/**
|
/**
|
||||||
* parameter name: "TimeOut"<p>
|
* parameter name: "TimeOut"<p>
|
||||||
* time out given in milli seconds
|
* time out given in milli seconds
|
||||||
|
* This parameter contains the timeout used<br>
|
||||||
|
* by the watcher
|
||||||
*/
|
*/
|
||||||
final public static String TIME_OUT = "TimeOut";
|
final public static String TIME_OUT = "TimeOut";
|
||||||
/**
|
/**
|
||||||
* parameter name: "ThreadTimeOut"
|
* parameter name: "ThreadTimeOut"
|
||||||
|
* This parameter contains the timeout used<br>
|
||||||
|
* by the complex tests
|
||||||
*/
|
*/
|
||||||
final public static String THREAD_TIME_OUT = "ThreadTimeOut";
|
final public static String THREAD_TIME_OUT = "ThreadTimeOut";
|
||||||
/**
|
/**
|
||||||
* parameter name: "OfficeCloseTimeOut"
|
* 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";
|
final public static String OFFICE_CLOSE_TIME_OUT = "OfficeCloseTimeOut";
|
||||||
/**
|
/**
|
||||||
@@ -92,6 +113,10 @@ public interface PropertyName {
|
|||||||
final public static String OPERATING_SYSTEM = "OperatingSystem";
|
final public static String OPERATING_SYSTEM = "OperatingSystem";
|
||||||
/**
|
/**
|
||||||
* parameter name: "AutoRestart"
|
* 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";
|
final public static String AUTO_RESTART = "AutoRestart";
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user