Skip to content

Commit 032d899

Browse files
Add a test for security provider run time registration.
1 parent bcc8d2e commit 032d899

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/services/SecurityServiceTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ public void duringSetup(final DuringSetupAccess access) {
6363
}
6464
}
6565

66+
/**
67+
* This test ensures that the list of security providers is populated at run time, and not at
68+
* build time.
69+
*/
70+
@Test
71+
public void testSecurityProviderRuntimeRegistration() {
72+
Provider notRegistered = Security.getProvider("no-op-provider");
73+
Assert.assertNull("Provider is registered.", notRegistered);
74+
75+
Security.addProvider(new NoOpProvider());
76+
77+
Provider registered = Security.getProvider("no-op-provider");
78+
Assert.assertNotNull("Provider is not registered.", registered);
79+
}
80+
6681
/**
6782
* Tests that native-image generation doesn't run into an issue (like NPE) if the application
6883
* uses a java.security.Provider.Service which isn't part of the services shipped in the JDK.

0 commit comments

Comments
 (0)