Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliult committed Oct 21, 2024
1 parent 9df3e99 commit 8397a39
Show file tree
Hide file tree
Showing 2 changed files with 382 additions and 163 deletions.
169 changes: 105 additions & 64 deletions closed/test/jdk/openj9/internal/security/TestProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,71 +54,112 @@ public class TestProperties {

private static Stream<Arguments> patternMatches_expectedExitValue1() {
return Stream.of(
// Test base profile - misspell properties
Arguments.of("Test-Profile.Base",
// // Test profile - base profile misspell properties
// Arguments.of("Test-Profile.Base",
// System.getProperty("test.src") + "/property-java.security",
// " The property names: RestrictedSecurity.Test-Profile.Base.tls.disabledAlgorithmsWrongTypo " +
// "in profile RestrictedSecurity.Test-Profile.Base \\(or a base profile\\) are not recognized"),
// // Test profile - extenstion profile misspell properties
// Arguments.of("Test-Profile.Extended_1",
// System.getProperty("test.src") + "/property-java.security",
// "The property names: RestrictedSecurity.Test-Profile.Extended_1.desc.nameWrongTypo, " +
// "RestrictedSecurity.Test-Profile.Extended_1.jce.providerWrongTypo in profile " +
// "RestrictedSecurity.Test-Profile.Extended_1 \\(or a base profile\\) are not recognized"),
// // Test profile - extension profile from another extension profile misspell properties
// Arguments.of("Test-Profile.Extended_2",
// System.getProperty("test.src") + "/property-java.security",
// "The property names: RestrictedSecurity.Test-Profile.Extended_2.jce.providerWrongTypo " +
// "in profile RestrictedSecurity.Test-Profile.Extended_2 \\(or a base profile\\) are not recognized"),
// // Test profile - profile not exist
// Arguments.of("Test-Profile.NotExist",
// System.getProperty("test.src") + "/property-java.security",
// "Test-Profile.NotExist is not present in the java.security file."),
// Test profile - Multi Default profile
Arguments.of("Test-Profile-MultiDefault.Extension",
System.getProperty("test.src") + "/property-java.security",
" The property names: RestrictedSecurity.Test-Profile.Base.tls.disabledAlgorithmsWrongTypo " +
"in profile RestrictedSecurity.Test-Profile.Base \\(or a base profile\\) are not recognized"),
// Test extended profile - misspell properties
Arguments.of("Test-Profile.Extended_1",
System.getProperty("test.src") + "/property-java.security",
"The property names: RestrictedSecurity.Test-Profile.Extended_1.desc.nameWrongTypo, " +
"RestrictedSecurity.Test-Profile.Extended_1.jce.providerWrongTypo.3 in profile " +
"RestrictedSecurity.Test-Profile.Extended_1 \\(or a base profile\\) are not recognized"),
// Test extended profile from another extended profile - misspell properties
Arguments.of("Test-Profile.Extended_2",
System.getProperty("test.src") + "/property-java.security",
"The property names: RestrictedSecurity.Test-Profile.Extended_2.jce.providerWrongTypo.13 " +
"in profile RestrictedSecurity.Test-Profile.Extended_2 \\(or a base profile\\) are not recognized"),
// Test profile - profile not exist
Arguments.of("Test-Profile.NotExist",
System.getProperty("test.src") + "/property-java.security",
"Test-Profile.NotExist is not present in the java.security file."),
// Test profile - multi default profile
Arguments.of("Test-Profile.MultiDefault",
System.getProperty("test.src") + "/property-java.security",
"Multiple default RestrictedSecurity profiles for Test-Profile.MultiDefault"),
// Test profile - no default profile
Arguments.of("Test-Profile.NoDefault",
System.getProperty("test.src") + "/property-java.security",
"No default RestrictedSecurity profile was found for Test-Profile.NoDefault"),
// Test extended profile - base profile not exist
Arguments.of("Test-Profile.Extended_3",
System.getProperty("test.src") + "/property-java.security",
"Test-Profile.Extended_3 that is supposed to extend Test-Profile.BaseNotExist is not present " +
"in the java.security file or any appended files"),
// Test extended profile - base profile not full profile name
Arguments.of("Test-Profile.Extended_4",
System.getProperty("test.src") + "/property-java.security",
"Test-Profile.Extended_4 that is supposed to extend BaseNotFullProfileName is not a full profile name"),
// Test profile - base profile without hash value
Arguments.of("Test-Profile.BaseWithoutHash",
System.getProperty("test.src") + "/property-java.security",
"Test-Profile.BaseWithoutHash is a base profile, so a hash value is mandatory"),
// Test profile - incorrect definition of hash value
Arguments.of("Test-Profile.Hash_1",
System.getProperty("test.src") + "/property-java.security",
"Incorrect definition of hash value for Test-Profile.Hash_1"),
// Test profile - incorrect hash value
Arguments.of("Test-Profile.Hash_2",
System.getProperty("test.src") + "/property-java.security",
"Hex produced from profile is not the same is a base profile, so a hash value is mandatory"),
// Test property not appendable
Arguments.of("Test-Profile.SetProperty_1",
System.getProperty("test.src") + "/property-java.security",
"Property jdkSecureRandomProvider is not appendable"),
// Test property does not exist in parent profile, cannot append
Arguments.of("Test-Profile.SetProperty_2",
System.getProperty("test.src") + "/property-java.security",
"Property jdkTlsDisabledNamedCurves does not exist in parent profile. Cannot append"),
// Test property does not exist in parent profile, cannot remove
Arguments.of("Test-Profile.SetProperty_3",
System.getProperty("test.src") + "/property-java.security",
"Property jdkTlsLegacyAlgorithms does not exist in parent profile. Cannot remove"),
// Test property value is not in existing values
Arguments.of("Test-Profile.SetProperty_4",
System.getProperty("test.src") + "/property-java.security",
"Value TestDisabledlgorithms is not in existing values")
"Multiple default RestrictedSecurity profiles for Test-Profile-MultiDefault.Extension")
// // Test profile - no default profile
// Arguments.of("Test-Profile.NoDefault",
// System.getProperty("test.src") + "/property-java.security",
// "No default RestrictedSecurity profile was found for Test-Profile.NoDefault"),
// // Test extended profile - base profile not exist
// Arguments.of("Test-Profile.Extended_3",
// System.getProperty("test.src") + "/property-java.security",
// "Test-Profile.Extended_3 that is supposed to extend Test-Profile.BaseNotExist is not present " +
// "in the java.security file or any appended files"),
// // Test extended profile - base profile not full profile name
// Arguments.of("Test-Profile.Extended_4",
// System.getProperty("test.src") + "/property-java.security",
// "Test-Profile.Extended_4 that is supposed to extend BaseNotFullProfileName is not a full profile name"),
// // Test profile - base profile without hash value
// Arguments.of("Test-Profile.BaseWithoutHash",
// System.getProperty("test.src") + "/property-java.security",
// "Test-Profile.BaseWithoutHash is a base profile, so a hash value is mandatory"),
// // Test profile - incorrect definition of hash value
// Arguments.of("Test-Profile.Hash_1",
// System.getProperty("test.src") + "/property-java.security",
// "Incorrect definition of hash value for Test-Profile.Hash_1"),
// // Test profile - incorrect hash value
// Arguments.of("Test-Profile.Hash_2",
// System.getProperty("test.src") + "/property-java.security",
// "Hex produced from profile is not the same is a base profile, so a hash value is mandatory"),
// // Test property not appendable
// Arguments.of("Test-Profile.SetProperty_1",
// System.getProperty("test.src") + "/property-java.security",
// "Property jdkSecureRandomProvider is not appendable"),
// // Test property does not exist in parent profile, cannot append
// Arguments.of("Test-Profile.SetProperty_2",
// System.getProperty("test.src") + "/property-java.security",
// "Property jdkTlsDisabledNamedCurves does not exist in parent profile. Cannot append"),
// // Test property does not exist in parent profile, cannot remove
// Arguments.of("Test-Profile.SetProperty_3",
// System.getProperty("test.src") + "/property-java.security",
// "Property jdkTlsLegacyAlgorithms does not exist in parent profile. Cannot remove"),
// // Test property value is not in existing values
// Arguments.of("Test-Profile.SetProperty_4",
// System.getProperty("test.src") + "/property-java.security",
// "Value TestDisabledlgorithms is not in existing values"),
// // Test profile - policy sunset
// Arguments.of("Test-Profile.PolicySunset",
// System.getProperty("test.src") + "/property-java.security",
// "Restricted security policy expired"),
// // Test profile - policy sunset format
// Arguments.of("Test-Profile.PolicySunsetFormat",
// System.getProperty("test.src") + "/property-java.security",
// "Restricted security policy sunset date is incorrect, the correct format is yyyy-MM-dd"),
// // Test profile - secure random check
// Arguments.of("Test-Profile.SecureRandomCheck",
// System.getProperty("test.src") + "/property-java.security",
// "Restricted security mode secure random is missing"),
// // Test profile - constraint check 1
// Arguments.of("Test-Profile.Constraint_1",
// System.getProperty("test.src") + "/property-java.security",
// "Incorrect constraint definition for provider"),
// // Test profile - constraint check 2
// Arguments.of("Test-Profile.Constraint_2",
// System.getProperty("test.src") + "/property-java.security",
// "Incorrect constraint definition for provider"),
// // Test profile - constraint check 3
// Arguments.of("Test-Profile.Constraint_3",
// System.getProperty("test.src") + "/property-java.security",
// "Incorrect constraint definition for provider"),
// // Test profile - constraint attributes check
// Arguments.of("Test-Profile.Constraint_Attributes",
// System.getProperty("test.src") + "/property-java.security",
// "Constraint attributes format is incorrect"),
// // Test profile - Constraint Changed 1
// Arguments.of("Test-Profile.ConstraintChanged_1_Extension",
// System.getProperty("test.src") + "/property-java.security",
// "Cannot append or remove constraints since the provider (.*?) " +
// "wasn't in this position in the profile extended"),
// // Test profile - Constraint Changed 2
// Arguments.of("Test-Profile.ConstraintChanged_2_Extension",
// System.getProperty("test.src") + "/property-java.security",
// "Constraint (.*?) is not part of existing constraints"),
// // Test profile - Constraint Changed 3
// Arguments.of("Test-Profile.ConstraintChanged_3_Base",
// System.getProperty("test.src") + "/property-java.security",
// "You cannot add or remove to provider (.*?). This is the base profile.")
);
}

Expand Down
Loading

0 comments on commit 8397a39

Please sign in to comment.