|
33 | 33 | import org.junit.jupiter.params.provider.Arguments; |
34 | 34 | import org.junit.jupiter.params.provider.MethodSource; |
35 | 35 |
|
| 36 | +import java.io.File; |
36 | 37 | import java.security.Provider; |
37 | 38 | import java.security.Security; |
38 | 39 |
|
|
43 | 44 |
|
44 | 45 | public class TestProperties { |
45 | 46 |
|
46 | | - static String fileSep = java.io.File.pathSeparator; |
| 47 | + static String fileSep = File.pathSeparator; |
47 | 48 |
|
48 | 49 | private static Stream<Arguments> patternMatches_expectedExitValue0() { |
49 | 50 | return Stream.of( |
@@ -166,21 +167,31 @@ private static Stream<Arguments> patternMatches_expectedExitValue1() { |
166 | 167 | ); |
167 | 168 | } |
168 | 169 |
|
169 | | - private static Stream<Arguments> patternMatches_PropertiesList() { |
| 170 | + private static Stream<Arguments> patternMatches_propertiesList() { |
170 | 171 | return Stream.of( |
| 172 | + // "-Djava.security.propertiesList=" test 1: the profile in propertyListA-java.security |
| 173 | + // extends the profile in the main java.security file, which lists 4 providers. |
171 | 174 | Arguments.of("Test-Profile-Property-List.A", |
172 | 175 | System.getProperty("test.src") + "/propertyListA-java.security", |
173 | 176 | "(?s)(?=.*OpenJCEPlusFIPS)(?=.*Sun)(?=.*SunJSSE)(?=.*SunEC)", |
174 | 177 | 0), |
| 178 | + // "-Djava.security.propertiesList=" test 2: The profile in propertyListB-java.security |
| 179 | + // extends the profile in propertyListA-java.security, which in turn extends the profile |
| 180 | + // in the main java.security file, listing 5 providers. |
175 | 181 | Arguments.of("Test-Profile-Property-List.B", |
176 | 182 | System.getProperty("test.src") + "/propertyListA-java.security" + fileSep |
177 | 183 | + System.getProperty("test.src") + "/propertyListB-java.security", |
178 | 184 | "(?s)(?=.*OpenJCEPlusFIPS)(?=.*Sun)(?=.*SunJSSE)(?=.*SunEC)(?=.*SunJCE)", |
179 | 185 | 0), |
| 186 | + // "-Djava.security.propertiesList=" test 3: The profile in propertyListB-java.security |
| 187 | + // extends the profile in propertyListA-java.security, which in turn extends the main |
| 188 | + // java.security profile, but propertyListB-java.security file is missing. |
180 | 189 | Arguments.of("Test-Profile-Property-List.B", |
181 | 190 | System.getProperty("test.src") + "/propertyListB-java.security", |
182 | 191 | "is not present in the java.security file or any appended files", |
183 | 192 | 1), |
| 193 | + // "-Djava.security.propertiesList=" test 4: The -Djava.security.propertiesList option |
| 194 | + // does not support using a leading '=' prefix. |
184 | 195 | Arguments.of("Test-Profile-Property-List.A", |
185 | 196 | "=" + System.getProperty("test.src") + "/propertyListA-java.security", |
186 | 197 | "java.security.propertiesList does not support '=' prefix", |
@@ -215,8 +226,8 @@ public void shouldContain_expectedExitValue1(String customprofile, String securi |
215 | 226 | } |
216 | 227 |
|
217 | 228 | @ParameterizedTest |
218 | | - @MethodSource("patternMatches_PropertiesList") |
219 | | - public void shouldContain_PropertiesList(String customprofile, String securityPropertyFileList, |
| 229 | + @MethodSource("patternMatches_propertiesList") |
| 230 | + public void shouldContain_propertiesList(String customprofile, String securityPropertyFileList, |
220 | 231 | String expected, int exitValue) throws Exception { |
221 | 232 | OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJava( |
222 | 233 | "-Dsemeru.fips=true", |
|
0 commit comments