Kaydet (Commit) b9975229 authored tarafından Oliver Bolte's avatar Oliver Bolte

INTEGRATION: CWS qadev16 (1.6.12); FILE MERGED

2004/03/10 09:39:39 sw 1.6.12.1: #i24566#
üst fc69474e
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ClParser.java,v $ * $RCSfile: ClParser.java,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change:$Date: 2003-11-18 16:14:09 $ * last change:$Date: 2004-03-19 14:29:03 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -58,51 +58,59 @@ ...@@ -58,51 +58,59 @@
* *
* *
************************************************************************/ ************************************************************************/
package helper; package helper;
import lib.TestParameters;
import java.util.Properties; import java.util.Properties;
import lib.TestParameters;
/** /**
* This class parses commandline Argument and stores <br> * This class parses commandline Argument and stores <br>
* them into TestParameter * them into TestParameter
*/ */
public class ClParser { public class ClParser {
/* /*
* Parses the commandline argument and puts them<br> * Parses the commandline argument and puts them<br>
* into the TestParameters * into the TestParameters
*/ */
public void getCommandLineParameter(TestParameters param,String[] args) { public void getCommandLineParameter(TestParameters param, String[] args) {
Properties mapping = getMapping(); Properties mapping = getMapping();
boolean isTestJob = false; boolean isTestJob = false;
for (int i=0; i<args.length;) {
String pName = getParameterFor(mapping,args[i]).trim(); for (int i = 0; i < args.length;) {
String pName = getParameterFor(mapping, args[i]).trim();
String pValue = ""; String pValue = "";
if (pName.equals("TestJob")) { if (pName.equals("TestJob")) {
pValue = args[i].trim()+" "+args[i+1].trim(); if (args.length > (i + 1)) {
i+=2; pValue = args[i].trim() + " " + args[i + 1].trim();
} i += 2;
else{ } else {
if (i+1<args.length) { pValue = args[i].trim() + " unknown";
pValue = args[i+1].trim(); i += 2;
}
} else {
if ((i + 1) < args.length) {
pValue = args[i + 1].trim();
if (pValue.startsWith("-")) { if (pValue.startsWith("-")) {
i++; i++;
pValue="yes"; pValue = "yes";
} } else {
else { i += 2;
i+=2;
} }
if (pName.equals("TestDocumentPath")) { if (pName.equals("TestDocumentPath")) {
System.setProperty("DOCPTH",pValue); System.setProperty("DOCPTH", pValue);
} }
} } else {
else { pValue = "yes";
pValue="yes";
i++; i++;
} }
} }
param.put(pName,pValue);
param.put(pName, pValue);
} }
} }
...@@ -110,40 +118,43 @@ public class ClParser { ...@@ -110,40 +118,43 @@ public class ClParser {
* This method returns the path to a Configuration file <br> * This method returns the path to a Configuration file <br>
* if defined as command line parameter, an empty String elsewhere * if defined as command line parameter, an empty String elsewhere
*/ */
public String getIniPath(String[] args) { public String getIniPath(String[] args) {
String iniFile=""; String iniFile = "";
for (int i=0;i<args.length;i++) {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-ini")) { if (args[i].equals("-ini")) {
iniFile=args[i+1]; iniFile = args[i + 1];
} }
} }
return iniFile; return iniFile;
} }
/* /*
* This method maps commandline Parameters to TestParameters * This method maps commandline Parameters to TestParameters
*/ */
protected Properties getMapping() { protected Properties getMapping() {
Properties map = new Properties(); Properties map = new Properties();
map.setProperty("-cs","ConnectionString"); map.setProperty("-cs", "ConnectionString");
map.setProperty("-tb","TestBase"); map.setProperty("-tb", "TestBase");
map.setProperty("-tdoc","TestDocumentPath"); map.setProperty("-tdoc", "TestDocumentPath");
map.setProperty("-objdsc","DescriptionPath"); map.setProperty("-objdsc", "DescriptionPath");
map.setProperty("-cmd","AppExecutionCommand"); map.setProperty("-cmd", "AppExecutionCommand");
map.setProperty("-o","TestJob"); map.setProperty("-o", "TestJob");
map.setProperty("-sce","TestJob"); map.setProperty("-sce", "TestJob");
map.setProperty("-aca", "AdditionalConnectionArguments"); map.setProperty("-aca", "AdditionalConnectionArguments");
map.setProperty("-xcl", "ExclusionList"); map.setProperty("-xcl", "ExclusionList");
return map; return map;
} }
protected String getParameterFor(Properties map, String name) { protected String getParameterFor(Properties map, String name) {
String ret = map.getProperty(name); String ret = map.getProperty(name);
if (ret == null) { if (ret == null) {
ret = name.substring(1); ret = name.substring(1);
} }
return ret; return ret;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment