Search in sources :

Example 1 with ConnectorCapability

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());
}
Also used : ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ConnectorCapability(org.apache.syncope.common.lib.types.ConnectorCapability) ConnInstanceHistoryConfTO(org.apache.syncope.common.lib.to.ConnInstanceHistoryConfTO) ConnConfProperty(org.apache.syncope.common.lib.types.ConnConfProperty) GuardedString(org.identityconnectors.common.security.GuardedString) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Aggregations

HashSet (java.util.HashSet)1 ConnInstanceHistoryConfTO (org.apache.syncope.common.lib.to.ConnInstanceHistoryConfTO)1 ConnInstanceTO (org.apache.syncope.common.lib.to.ConnInstanceTO)1 ConnConfProperty (org.apache.syncope.common.lib.types.ConnConfProperty)1 ConnectorCapability (org.apache.syncope.common.lib.types.ConnectorCapability)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 Test (org.junit.jupiter.api.Test)1