use of org.apache.syncope.common.lib.types.ConnectorCapability in project syncope by apache.
the class ConnectorITCase method history.
@Test
public void history() {
List<ConnInstanceHistoryConfTO> history = connectorHistoryService.list("74141a3b-0762-4720-a4aa-fc3e374ef3ef");
assertNotNull(history);
int pre = history.size();
ConnInstanceTO ldapConn = connectorService.read("74141a3b-0762-4720-a4aa-fc3e374ef3ef", null);
String originalDisplayName = ldapConn.getDisplayName();
Set<ConnectorCapability> originalCapabilities = new HashSet<>(ldapConn.getCapabilities());
ConnConfProperty originalConfProp = SerializationUtils.clone(ldapConn.getConf("maintainPosixGroupMembership").get());
assertEquals(1, originalConfProp.getValues().size());
assertEquals("false", originalConfProp.getValues().get(0));
ldapConn.setDisplayName(originalDisplayName + " modified");
ldapConn.getCapabilities().clear();
ldapConn.getConf("maintainPosixGroupMembership").get().getValues().set(0, "true");
connectorService.update(ldapConn);
ldapConn = connectorService.read("74141a3b-0762-4720-a4aa-fc3e374ef3ef", null);
assertNotEquals(originalDisplayName, ldapConn.getDisplayName());
assertNotEquals(originalCapabilities, ldapConn.getCapabilities());
assertNotEquals(originalConfProp, ldapConn.getConf("maintainPosixGroupMembership"));
history = connectorHistoryService.list("74141a3b-0762-4720-a4aa-fc3e374ef3ef");
assertEquals(pre + 1, history.size());
connectorHistoryService.restore(history.get(0).getKey());
ldapConn = connectorService.read("74141a3b-0762-4720-a4aa-fc3e374ef3ef", null);
assertEquals(originalDisplayName, ldapConn.getDisplayName());
assertEquals(originalCapabilities, ldapConn.getCapabilities());
assertEquals(originalConfProp, ldapConn.getConf("maintainPosixGroupMembership").get());
}
Aggregations