use of tests.support.Support_TestProvider in project robovm by robovm.
the class KeyStore2Test method setUp.
/**
* Sets up the fixture, for example, open a network connection. This method
* is called before a test is executed.
*/
protected void setUp() throws Exception {
super.setUp();
support_TestProvider = new Support_TestProvider();
Security.addProvider(support_TestProvider);
}
use of tests.support.Support_TestProvider in project robovm by robovm.
the class Security2Test method test_removeProviderLjava_lang_String.
/**
* java.security.Security#removeProvider(java.lang.String)
*/
public void test_removeProviderLjava_lang_String() {
// Test for method void
// java.security.Security.removeProvider(java.lang.String)
Provider test = new Support_TestProvider();
Provider entrust = new Support_ProviderTrust();
try {
// Make sure provider not already loaded. Should do nothing
// if not already loaded.
Security.removeProvider(test.getName());
// Now add it
int addResult = Security.addProvider(test);
assertTrue("Failed to add provider", addResult != -1);
Security.removeProvider(test.getName());
assertNull("the provider TestProvider is found after it was removed", Security.getProvider(test.getName()));
// Make sure entrust provider not already loaded. Should do nothing
// if not already loaded.
Security.removeProvider(entrust.getName());
// Now add entrust
addResult = Security.addProvider(entrust);
assertTrue("Failed to add provider", addResult != -1);
Security.removeProvider(entrust.getName());
for (Provider provider : Security.getProviders()) {
assertTrue("the provider entrust is found after it was removed", provider.getName() != entrust.getName());
}
} finally {
// Tidy up - the following calls do nothing if the providers were
// already removed above.
Security.removeProvider(test.getName());
Security.removeProvider(entrust.getName());
}
}
Aggregations