Skip to content

Commit e7505b3

Browse files
committed
Update test case
1 parent 3d470d7 commit e7505b3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

closed/test/jdk/openj9/internal/security/TestProperties.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import jdk.test.lib.process.OutputAnalyzer;
4343
import jdk.test.lib.process.ProcessTools;
4444

45+
import org.junit.jupiter.api.Assumptions;
46+
4547
public class TestProperties {
4648

4749
private static Stream<Arguments> patternMatches_expectedExitValue0() {
@@ -227,6 +229,11 @@ public void shouldContain_expectedExitValue1(String customprofile, String securi
227229
@MethodSource("patternMatches_propertiesList")
228230
public void shouldContain_propertiesList(String customprofile, String securityPropertyFileList,
229231
String expected, int exitValue) throws Exception {
232+
// Skip tests if OpenJCEPlusFIPS is not available.
233+
boolean hasOpenJCEPlus = isProviderPresent("OpenJCEPlusFIPS");
234+
Assumptions.assumeTrue(hasOpenJCEPlus,
235+
"Skipping: OpenJCEPlus provider is not present in this runtime.");
236+
230237
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJava(
231238
"-Dsemeru.fips=true",
232239
"-Dsemeru.customprofile=" + customprofile,
@@ -236,6 +243,15 @@ public void shouldContain_propertiesList(String customprofile, String securityPr
236243
outputAnalyzer.shouldHaveExitValue(exitValue).shouldMatch(expected);
237244
}
238245

246+
private boolean isProviderPresent(String providerName) {
247+
for (Provider p : Security.getProviders()) {
248+
if (p.getName().equalsIgnoreCase(providerName)) {
249+
return true;
250+
}
251+
}
252+
return false;
253+
}
254+
239255
public static void main(String[] args) {
240256
// Something to trigger "properties" debug output.
241257
try {

0 commit comments

Comments
 (0)