@Override
protected <T extends ManageableSecurity> void assertSecurity(final Class<T> securityClass, final T security) {
normalizeSecurity (security);
s_logger.debug("Testing {} instance {}", securityClass, security.hashCode());
final UniqueId uniqueId = putSecurity(security);
assertNotNull(uniqueId);
s_logger.debug("UID = {}", uniqueId);
Security sec;
// retrieve by unique identifier
sec = getSecurity(uniqueId);
normalizeSecurity(sec);
assertEquals(security, sec);
ExternalIdBundle bundle = null;
if (security.getExternalIdBundle().size() > 0) {
final Iterator<ExternalId> iterator = security.getExternalIdBundle().iterator();
bundle = ExternalIdBundle.EMPTY;
// retrieve with one identifier
ExternalId id = iterator.next();
bundle = bundle.withExternalId(id);
sec = getSecurity(bundle);
normalizeSecurity(sec);
assertEquals(security, sec);
// retrieve with one valid and one incorrect identifier
sec = getSecurity(Arrays.asList(id, ExternalId.of("FOO", "BAR")));
normalizeSecurity(sec);
assertEquals(security, sec);
// retrieve with exact bundle
sec = getSecurity(security.getExternalIdBundle());
normalizeSecurity(sec);
assertEquals(security, sec);
}
final String originalName = security.getName ();
final String newName = "UPDATED " + originalName;
security.setName(newName);
final UniqueId newUniqueId = updateSecurity (security);
assertNotNull(newUniqueId);
s_logger.debug("New UID = {}", newUniqueId);
assertEquals(false, uniqueId.equals(newUniqueId));
// retrieve with original uniqueId - gets original
sec = getSecurity(uniqueId);