Security.getProviders(m);
fail("No expected InvalidParameterException");
} catch (InvalidParameterException e) {
}
Provider p = new MyProvider();
try {
Security.addProvider(p);
m.clear();
m.put("MyService.MyAlgorithm", "");
m.put("MessageDigest.SHA-1", "");
assertTrue("MyService.MyAlgorithm", Arrays.equals(
new Provider[] { p }, Security.getProviders(m)));
m.clear();
m.put("MyService.MyAlgorithm KeySize", "512");
m.put("MessageDigest.SHA-1", "");
assertTrue("MyService.MyAlgorithm KeySize:512", Arrays.equals(
new Provider[] { p }, Security.getProviders(m)));
m.clear();
m.put("MyService.MyAlgorithm KeySize", "1025");
m.put("MessageDigest.SHA-1", "");
assertNull("MyService.MyAlgorithm KeySize:1025", Security
.getProviders(m));
// attribute name and value are case insensitive
m.clear();
m.put("MyService.MyAlgorithm imPLementedIn", "softWARE");
assertTrue(Arrays.equals(new Provider[] { p }, Security
.getProviders(m)));
m.clear();
m.put("MyService.MyAlgorithm ATTribute", "attributeVALUE");
assertTrue(Arrays.equals(new Provider[] { p }, Security
.getProviders(m)));
// Regression for HARMONY-2761
m.clear();
m.put("MyService.NoKeySize KeySize", "512");
assertNull("No KeySize attribute", Security.getProviders(m));
m.clear();
m.put("MyService.NoImplementedIn ImplementedIn", "Software");
assertNull("No ImplementedIn attribute", Security.getProviders(m));
m.clear();
m.put("ABCService.NoAttribute Attribute", "ABC");
assertNull(Security.getProviders(m));
} finally { //clean up
Security.removeProvider(p.getName());
}
}