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());
}
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());
}
Aggregations