Skip to content

Commit

Permalink
Adapt TestProjector to recent clockwork changes
Browse files Browse the repository at this point in the history
The "focus old" is now reloaded upon clockwork start.
  • Loading branch information
mederly committed May 17, 2022
1 parent fabcae3 commit c3abcd6
Showing 1 changed file with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,23 @@ public void test275DeleteUserBarbossaAssignmentBrethren() throws Exception {
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);

modifyUserReplace(USER_BARBOSSA_OID, UserType.F_ORGANIZATION, task, result, PrismTestUtil.createPolyString(ORG_BRETHREN_INDUCED_ORGANIZATION));
// @formatter:off
repositoryService.modifyObject(
UserType.class,
USER_BARBOSSA_OID,
prismContext.deltaFor(UserType.class)
.item(UserType.F_ORGANIZATION)
.replace(PrismTestUtil.createPolyString(ORG_BRETHREN_INDUCED_ORGANIZATION))
.item(UserType.F_ASSIGNMENT)
.add(new AssignmentType()
.targetRef(ORG_BRETHREN_OID, OrgType.COMPLEX_TYPE))
.asItemDeltas(),
result);
// @formatter:on

LensContext<UserType> context = createUserLensContext();
PrismObject<UserType> focus = repositoryService.getObject(UserType.class, USER_BARBOSSA_OID, null, result);
ObjectDelta<UserType> addAssignmentDelta = createAssignmentUserDelta(USER_BARBOSSA_OID, ORG_BRETHREN_OID,
OrgType.COMPLEX_TYPE, null, null, true);
addAssignmentDelta.applyTo(focus);
fillContextWithFocus(context, focus);

fillContextWithAccount(context, ACCOUNT_HBARBOSSA_DUMMY_OID, task, result);

addFocusDeltaToContext(context, createAssignmentUserDelta(USER_BARBOSSA_OID, ORG_BRETHREN_OID,
Expand Down Expand Up @@ -759,6 +768,19 @@ public void test275DeleteUserBarbossaAssignmentBrethren() throws Exception {
assertEquals(SynchronizationPolicyDecision.KEEP, accContext.getSynchronizationPolicyDecision());

assertSerializable(context);

// Delete the assignment, to restore the environment for further tests
// @formatter:off
executeChanges(
prismContext.deltaFor(UserType.class)
.item(UserType.F_ASSIGNMENT)
.delete(new AssignmentType()
.targetRef(ORG_BRETHREN_OID, OrgType.COMPLEX_TYPE))
.asObjectDelta(USER_BARBOSSA_OID),
null,
task,
result);
// @formatter:on
}

@Test
Expand Down

0 comments on commit c3abcd6

Please sign in to comment.