Search in sources :

Example 1 with UcfSyncToken

use of com.evolveum.midpoint.provisioning.ucf.api.UcfSyncToken in project midpoint by Evolveum.

the class TestUcfDummy method test100FetchEmptyChanges.

@Test
public void test100FetchEmptyChanges() throws Exception {
    OperationResult result = createOperationResult();
    ResourceObjectClassDefinition accountDefinition = resourceSchema.findObjectClassDefinitionRequired(ACCOUNT_OBJECT_CLASS_NAME);
    // WHEN
    UcfSyncToken lastToken = cc.fetchCurrentToken(accountDefinition, null, result);
    assertNotNull("No last sync token", lastToken);
    System.out.println("Token:");
    System.out.println(lastToken);
    // WHEN
    CollectingChangeListener handler = new CollectingChangeListener();
    cc.fetchChanges(accountDefinition, lastToken, null, null, null, handler, result);
    AssertJUnit.assertEquals(0, handler.getChanges().size());
}
Also used : UcfSyncToken(com.evolveum.midpoint.provisioning.ucf.api.UcfSyncToken) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 2 with UcfSyncToken

use of com.evolveum.midpoint.provisioning.ucf.api.UcfSyncToken in project midpoint by Evolveum.

the class TestUcfDummy method test101FetchAddChange.

@Test
public void test101FetchAddChange() throws Exception {
    OperationResult result = createOperationResult();
    ResourceObjectClassDefinition accountDefinition = resourceSchema.findObjectClassDefinitionRequired(ACCOUNT_OBJECT_CLASS_NAME);
    UcfSyncToken lastToken = cc.fetchCurrentToken(accountDefinition, null, result);
    assertNotNull("No last sync token", lastToken);
    // Add account to the resource
    dummyResource.setSyncStyle(DummySyncStyle.DUMB);
    DummyAccount newAccount = new DummyAccount("blackbeard");
    newAccount.addAttributeValues("fullname", "Edward Teach");
    newAccount.setEnabled(true);
    newAccount.setPassword("shiverMEtimbers");
    dummyResource.addAccount(newAccount);
    // WHEN
    CollectingChangeListener handler = new CollectingChangeListener();
    cc.fetchChanges(accountDefinition, lastToken, null, null, null, handler, result);
    List<UcfLiveSyncChange> changes = handler.getChanges();
    AssertJUnit.assertEquals(1, changes.size());
    UcfLiveSyncChange change = changes.get(0);
    assertNotNull("null change", change);
    PrismObject<ShadowType> resourceObject = change.getResourceObject();
    assertNotNull("null current resource object", resourceObject);
    PrismAsserts.assertParentConsistency(resourceObject);
    Collection<ResourceAttribute<?>> identifiers = change.getIdentifiers();
    assertNotNull("null identifiers", identifiers);
    assertFalse("empty identifiers", identifiers.isEmpty());
}
Also used : UcfLiveSyncChange(com.evolveum.midpoint.provisioning.ucf.api.UcfLiveSyncChange) UcfSyncToken(com.evolveum.midpoint.provisioning.ucf.api.UcfSyncToken) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Aggregations

UcfSyncToken (com.evolveum.midpoint.provisioning.ucf.api.UcfSyncToken)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Test (org.testng.annotations.Test)2 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)1 UcfLiveSyncChange (com.evolveum.midpoint.provisioning.ucf.api.UcfLiveSyncChange)1