2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import java
.util
.Properties
;
23 import lib
.TestParameters
;
24 import util
.PropertyName
;
28 * This class parses commandline Argument and stores <br>
29 * them into TestParameter
34 * Parses the commandline argument and puts them<br>
35 * into the TestParameters
38 public void getCommandLineParameter(TestParameters param
, String
[] args
)
40 Properties mapping
= getMapping();
42 for (int i
= 0; i
< args
.length
;)
44 String pName
= getParameterFor(mapping
, args
[i
]).trim();
46 if (pName
.equals("TestJob"))
48 if (args
.length
> (i
+ 1))
50 pValue
= args
[i
].trim() + " " + args
[i
+ 1].trim();
55 pValue
= args
[i
].trim() + " unknown";
61 if ((i
+ 1) < args
.length
)
63 pValue
= args
[i
+ 1].trim();
65 if (pValue
.startsWith("-"))
70 else if (pValue
.startsWith("'"))
73 while (!pValue
.endsWith("'"))
76 pValue
= pValue
+ " " + args
[i
].trim();
79 pValue
= utils
.replaceAll13(pValue
, "'", "");
87 if (pName
.equals("TestDocumentPath"))
90 "DOCPTH", new File(pValue
).getAbsolutePath());
92 else if (pName
.equals(PropertyName
.SRC_ROOT
))
94 System
.setProperty(pName
, pValue
);
105 param
.put(pName
, pValue
);
110 * This method returns the path to a Configuration file <br>
111 * if defined as command line parameter, an empty String elsewhere
113 public String
getIniPath(String
[] args
)
117 for (int i
= 0; i
< args
.length
; i
++)
119 if (args
[i
].equals("-ini"))
121 iniFile
= args
[i
+ 1];
130 * This method returns the path to a Configuration file <br>
131 * if defined as command line parameter, an empty String elsewhere
133 public String
getRunnerIniPath(String
[] args
)
137 for (int i
= 0; i
< args
.length
; i
++)
139 if (args
[i
].equals("-runnerini"))
141 iniFile
= args
[i
+ 1];
150 * This method maps commandline Parameters to TestParameters
152 protected Properties
getMapping()
154 Properties map
= new Properties();
155 map
.setProperty("-cs", "ConnectionString");
156 map
.setProperty("-tb", "TestBase");
157 map
.setProperty("-tdoc", "TestDocumentPath");
158 map
.setProperty("-objdsc", "DescriptionPath");
159 map
.setProperty("-cmd", "AppExecutionCommand");
160 map
.setProperty("-o", "TestJob");
161 map
.setProperty("-sce", "TestJob");
162 map
.setProperty("-p", "TestJob");
163 map
.setProperty("-aca", "AdditionalConnectionArguments");
164 map
.setProperty("-xcl", "ExclusionList");
165 map
.setProperty("-debug", "DebugIsActive");
166 map
.setProperty("-log", "LoggingIsActive");
167 map
.setProperty("-dbout", "DataBaseOut");
168 map
.setProperty("-nca", "NoCwsAttach");
173 protected String
getParameterFor(Properties map
, String name
)
175 String ret
= map
.getProperty(name
);
179 ret
= name
.substring(1);