use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestIteration method test732DarkVioletAddBarbossa.
/*
* Create yet another account with fullname barbossa. We already have two barbossa users,
* so the next one is barbossa.2. But there is a post-iteration condition that refuses that
* name. It also refuses barbossa.3. So the result should be barbossa.4.
* MID-3338
*/
@Test
public void test732DarkVioletAddBarbossa() throws Exception {
// GIVEN
dummyAuditService.clear();
DummyAccount account = new DummyAccount("YA" + USER_BARBOSSA_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, USER_BARBOSSA_USERNAME);
// WHEN
when();
displayValue("Adding dummy account", account.debugDump());
getDummyResource(RESOURCE_DUMMY_DARK_VIOLET_NAME).addAccount(account);
waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true);
// THEN
then();
assertUserNick(USER_BARBOSSA_USERNAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_USERNAME + ".1");
assertUserNick("YA" + USER_BARBOSSA_USERNAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_USERNAME + ".4");
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestIteration method test290AlfredConflictNoShadowSyncBackAdd.
// as with jupiter, but ADD instead of ASSIGN account
@Test
public void test290AlfredConflictNoShadowSyncBackAdd() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
dummyAuditService.clear();
// Make sure there is a conflicting account and NO shadow for it
DummyAccount account = new DummyAccount("Alfred Hitchcock");
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, "alfred");
getDummyResource(RESOURCE_DUMMY_FUCHSIA_NAME).addAccount(account);
PrismObject<UserType> userAlfred = PrismTestUtil.parseObject(USER_ALFRED_FILE);
PrismObject<ShadowType> accountAlfred = PrismTestUtil.parseObject(ACCOUNT_ALFRED_FILE);
ObjectReferenceType linkRef = new ObjectReferenceType();
linkRef.asReferenceValue().setObject(accountAlfred);
userAlfred.asObjectable().getLinkRef().add(linkRef);
ObjectDelta<UserType> delta = DeltaFactory.Object.createAddDelta(userAlfred);
// WHEN
when();
executeChanges(delta, null, task, result);
// THEN
then();
assertSuccess(result, 2);
// alfred
PrismObject<UserType> userAlfredAfter = findUserByUsername(USER_ALFRED_NAME);
display("User after change execution", userAlfredAfter);
assertUser(userAlfredAfter, null, USER_ALFRED_NAME, "Alfred Hitchcock", "Alfred", "Hitchcock", null);
String accountOid = getSingleLinkOid(userAlfredAfter);
// Check shadow
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
display("Account shadow from repo", accountShadow);
assertAccountShadowRepo(accountShadow, accountOid, "Alfred Hitchcock", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Check account
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
assertAccountShadowModel(accountModel, accountOid, "Alfred Hitchcock", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Check account in dummy resource (actually, the fullname attribute does not exist but it's OK)
assertDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, "Alfred Hitchcock", null, true);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestIteration method test282RenamePeterNoShadowSync.
/**
* Same as test280 (conflict with no shadow with rename), but including synchronization.
*/
@Test
public void test282RenamePeterNoShadowSync() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
PrismObject<UserType> userPeter = createUser("peter", "Peter Crenshaw", true);
addObject(userPeter);
String userPeterOid = userPeter.getOid();
// Make sure there is a conflicting account and NO shadow for it
// will conflict after rename
DummyAccount account = new DummyAccount("Pete Crenshaw");
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, "pete0");
getDummyResource(RESOURCE_DUMMY_FUCHSIA_NAME).addAccount(account);
// preconditions
assertNoDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, "Peter Crenshaw");
// conflicting account (pete0)
assertDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, "Pete Crenshaw", null, true);
// prepare change
ObjectDelta<UserType> objectDelta = createAccountAssignmentUserDelta(userPeterOid, RESOURCE_DUMMY_FUCHSIA_OID, "default", true);
objectDelta.addModification(createUserPropertyReplaceModification(UserType.F_NAME, new PolyString("pete")));
objectDelta.addModification(createUserPropertyReplaceModification(UserType.F_FULL_NAME, new PolyString("Pete Crenshaw")));
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<>();
deltas.add(objectDelta);
// WHEN
when();
modelService.executeChanges(deltas, null, task, result);
// THEN
then();
PrismObject<UserType> userPeteAfter = getUser(userPeterOid);
display("User after change execution", userPeteAfter);
assertUser(userPeteAfter, userPeterOid, "pete", "Pete Crenshaw", null, null, null);
String accountOid = getSingleLinkOid(userPeteAfter);
// Check shadow & account
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
display("Account shadow from repo", accountShadow);
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
display("Account shadow from model", accountModel);
assertAccountShadowRepo(accountShadow, accountOid, "Pete Crenshaw1", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
assertAccountShadowModel(accountModel, accountOid, "Pete Crenshaw1", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Now check the other (newly created) user, pete0
PrismObject<UserType> userPete0 = findUserByUsername("pete0");
display("Newly created pete0 user", userPete0);
assertUser(userPete0, null, "pete0", "Pete Crenshaw", null, null, null);
String accountOidP0 = getSingleLinkOid(userPete0);
// Check shadow
PrismObject<ShadowType> accountShadowP0 = repositoryService.getObject(ShadowType.class, accountOidP0, null, result);
display("Account shadow from repo (pete0)", accountShadowP0);
assertAccountShadowRepo(accountShadowP0, accountOidP0, "Pete Crenshaw", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Check account
PrismObject<ShadowType> accountModelP0 = modelService.getObject(ShadowType.class, accountOidP0, null, task, result);
display("Account shadow from model (pete0)", accountModelP0);
assertAccountShadowModel(accountModelP0, accountOidP0, "Pete Crenshaw", getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// accounts on the resource
// pete0
assertDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, "Pete Crenshaw", null, true);
assertDummyAccountAttribute(RESOURCE_DUMMY_FUCHSIA_NAME, "Pete Crenshaw", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, "pete0");
// pete
assertDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, "Pete Crenshaw1", null, true);
assertDummyAccountAttribute(RESOURCE_DUMMY_FUCHSIA_NAME, "Pete Crenshaw1", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, "pete");
assertNoDummyAccount(RESOURCE_DUMMY_PINK_NAME, "peter");
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestIteration method test764DarkVioletModifyMatusalemFullName.
/**
* Rename to an identifier that is taken. New random iterationToken is expected.
*/
@Test
public void test764DarkVioletModifyMatusalemFullName() throws Exception {
// GIVEN
dummyAuditService.clear();
DummyAccount account = getDummyResource(RESOURCE_DUMMY_DARK_VIOLET_NAME).getAccountByUsername(ACCOUNT_MATUSALEM_USERNAME);
// WHEN
when();
account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, RON_FULLNAME);
waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true);
// THEN
then();
displayAllUsers();
assertNoUserNick(ACCOUNT_MATUSALEM_USERNAME, RUM_FULLNAME);
String iterationTokenMatusalem = lookupIterationTokenByAdditionalName(ACCOUNT_MATUSALEM_USERNAME);
assertUserNick(ACCOUNT_MATUSALEM_USERNAME, RON_FULLNAME, RON_FULLNAME + iterationTokenMatusalem);
assertNoUserNick(ACCOUNT_DIPLOMATICO_USERNAME, RUM_FULLNAME + iterationTokenDiplomatico);
assertUserNick(ACCOUNT_MILLONARIO_USERNAME, RON_FULLNAME, RON_FULLNAME, "Northern Peru");
assertNoUserNick(ACCOUNT_MILLONARIO_USERNAME, RUM_FULLNAME + iterationTokenMillonario);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestIteration method test260JupiterConflictNoShadowSyncBack.
/**
* Doing the same as test240 (conflict without pre-existing shadow -> surprising the model with AlreadyExists,
* causing re-running given wave in model. But this time doing this on resource that has synchronization
* defined (fuchsia).
* <p>
* test260: first case - existing account corresponds to user being created
* <p>
* 1) manually create account Jupiter Jones (no shadow!), description = "jupiter"
* 2) create user Jupiter Jones (name = jupiter)
* <p>
* Create account operation should fail, account should be synchronized back to repo (creating the user!), and
* model should clean it up somehow...
*/
@Test
public void test260JupiterConflictNoShadowSyncBack() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
dummyAuditService.clear();
// Make sure there is a conflicting account and NO shadow for it
// Jupiter Jones
DummyAccount account = new DummyAccount(ACCOUNT_JUPITER_DUMMY_FUCHSIA_USERNAME);
account.setEnabled(true);
// jupiter
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, USER_JUPITER_NAME);
getDummyResource(RESOURCE_DUMMY_FUCHSIA_NAME).addAccount(account);
PrismObject<UserType> userJupiter = PrismTestUtil.parseObject(USER_JUPITER_FILE);
// WHEN
when();
executeChanges(DeltaFactory.Object.createAddDelta(userJupiter), null, task, result);
// THEN
then();
assertSuccess(result, 2);
// jupiter
PrismObject<UserType> userJupiterAfter = findUserByUsername(USER_JUPITER_NAME);
display("User after change execution", userJupiterAfter);
assertUserJupiter(userJupiterAfter);
jupiterUserOid = userJupiterAfter.getOid();
String accountOid = getSingleLinkOid(userJupiterAfter);
// Check shadow
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
display("Account shadow from repo", accountShadow);
assertAccountShadowRepo(accountShadow, accountOid, ACCOUNT_JUPITER_DUMMY_FUCHSIA_USERNAME, getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Check account
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
assertAccountShadowModel(accountModel, accountOid, ACCOUNT_JUPITER_DUMMY_FUCHSIA_USERNAME, getDummyResourceType(RESOURCE_DUMMY_FUCHSIA_NAME));
// Check account in dummy resource (actually, the fullname attribute does not exist but it's OK)
assertDummyAccount(RESOURCE_DUMMY_FUCHSIA_NAME, ACCOUNT_JUPITER_DUMMY_FUCHSIA_USERNAME, null, true);
// TODO Check audit
displayDumpable("Audit", dummyAuditService);
}
Aggregations