|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2020 the original author or authors. |
| 2 | + * Copyright 2016-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
40 | 40 | * @author Janne Valkealahti
|
41 | 41 | * @author Christian Tzolov
|
42 | 42 | * @author Ilayaperumal Gopinathan
|
| 43 | + * @author Glenn Renfro |
43 | 44 | */
|
44 | 45 | public class DeploymentPropertiesUtilsTests {
|
45 | 46 |
|
@@ -131,8 +132,6 @@ public void testDeploymentPropertiesParsing2() {
|
131 | 132 | assertTrue(props.contains("a=b"));
|
132 | 133 |
|
133 | 134 | props = DeploymentPropertiesUtils.parseArgumentList("a=b c=d ", " ");
|
134 |
| - System.out.println(">" +props.get(0)+"<"); |
135 |
| - System.out.println(">" +props.get(1)+"<"); |
136 | 135 |
|
137 | 136 | assertTrue(props.contains("a=b"));
|
138 | 137 | assertTrue(props.contains("c=d"));
|
@@ -160,6 +159,44 @@ public void parseArgumentTestsWithQuotes() {
|
160 | 159 | assertTrue(props.contains("--foo=bar"));
|
161 | 160 | }
|
162 | 161 |
|
| 162 | + @Test |
| 163 | + public void parseArgumentTestsWithMultipleQuotes() { |
| 164 | + |
| 165 | + List<String> props = DeploymentPropertiesUtils.parseArgumentList("arg2=\"Argument 2\" arg3=val3", " "); |
| 166 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 167 | + assertTrue(props.contains("arg3=val3")); |
| 168 | + |
| 169 | + props = DeploymentPropertiesUtils.parseArgumentList("arg0=val0 arg1=val1 arg2=\"Argument 2\" arg3=val3", " "); |
| 170 | + assertTrue(props.contains("arg0=val0")); |
| 171 | + assertTrue(props.contains("arg1=val1")); |
| 172 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 173 | + assertTrue(props.contains("arg3=val3")); |
| 174 | + |
| 175 | + props = DeploymentPropertiesUtils.parseArgumentList("-arg1=val1 arg2=\"Argument 2\" arg3=val3", " "); |
| 176 | + assertTrue(props.contains("-arg1=val1")); |
| 177 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 178 | + assertTrue(props.contains("arg3=val3")); |
| 179 | + |
| 180 | + props = DeploymentPropertiesUtils.parseArgumentList("-arg1=val1 arg2=\"Argument 2\" arg3=val3 arg4=\"Argument 4\"", " "); |
| 181 | + assertTrue(props.contains("-arg1=val1")); |
| 182 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 183 | + assertTrue(props.contains("arg3=val3")); |
| 184 | + assertTrue(props.contains("arg4=\"Argument 4\"")); |
| 185 | + |
| 186 | + props = DeploymentPropertiesUtils.parseArgumentList("-arg1=val1 arg2=\"Argument 2\" arg3=\"val3\" arg4=\"Argument 4\"", " "); |
| 187 | + assertTrue(props.contains("-arg1=val1")); |
| 188 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 189 | + assertTrue(props.contains("arg3=\"val3\"")); |
| 190 | + assertTrue(props.contains("arg4=\"Argument 4\"")); |
| 191 | + |
| 192 | + props = DeploymentPropertiesUtils.parseArgumentList("-arg1=\"val1\" arg2=\"Argument 2\" arg3=\"val3\" arg4=\"Argument 4\"", " "); |
| 193 | + assertTrue(props.contains("-arg1=\"val1\"")); |
| 194 | + assertTrue(props.contains("arg2=\"Argument 2\"")); |
| 195 | + assertTrue(props.contains("arg3=\"val3\"")); |
| 196 | + assertTrue(props.contains("arg4=\"Argument 4\"")); |
| 197 | + |
| 198 | + } |
| 199 | + |
163 | 200 | @Test
|
164 | 201 | public void testLongDeploymentPropertyValues() {
|
165 | 202 | Map<String, String> props = DeploymentPropertiesUtils
|
|
0 commit comments