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
.HashMap
;
23 import lib
.TestParameters
;
24 import util
.PropertyName
;
27 * This class parses commandline Argument and stores <br>
28 * them into TestParameter
33 * Parses the commandline argument and puts them<br>
34 * into the TestParameters
37 public void getCommandLineParameter(TestParameters param
, String
[] args
)
39 for (int i
= 0; i
< args
.length
;)
41 String pName
= getParameterFor(args
[i
]).trim();
43 if (pName
.equals("TestJob"))
45 if (args
.length
> (i
+ 1))
47 pValue
= args
[i
].trim() + " " + args
[i
+ 1].trim();
52 pValue
= args
[i
].trim() + " unknown";
58 if ((i
+ 1) < args
.length
)
60 pValue
= args
[i
+ 1].trim();
62 if (pValue
.startsWith("-"))
67 else if (pValue
.startsWith("'"))
70 while (!pValue
.endsWith("'"))
73 pValue
= pValue
+ " " + args
[i
].trim();
76 pValue
= pValue
.replace("'", "");
84 if (pName
.equals("TestDocumentPath"))
87 "DOCPTH", new File(pValue
).getAbsolutePath());
89 else if (pName
.equals(PropertyName
.SRC_ROOT
))
91 System
.setProperty(pName
, pValue
);
102 param
.put(pName
, pValue
);
107 * Map command-line Parameters to TestParameters
109 private static final java
.util
.Map
<String
,String
> COMMAND_LINE_OPTION_TO_TEST_PARAMETER
= new HashMap
<String
,String
>();
111 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-cs", "ConnectionString");
112 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-tb", "TestBase");
113 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-tdoc", "TestDocumentPath");
114 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-objdsc", "DescriptionPath");
115 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-cmd", "AppExecutionCommand");
116 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-o", "TestJob");
117 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-sce", "TestJob");
118 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-p", "TestJob");
119 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-aca", "AdditionalConnectionArguments");
120 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-xcl", "ExclusionList");
121 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-debug", "DebugIsActive");
122 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-log", "LoggingIsActive");
123 COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.put("-dbout", "DataBaseOut");
126 private String
getParameterFor(String name
)
128 String ret
= COMMAND_LINE_OPTION_TO_TEST_PARAMETER
.get(name
);
132 ret
= name
.substring(1);