Skip to content

Commit

Permalink
Stop creating malformed cases for "add" manual op
Browse files Browse the repository at this point in the history
When adding objects on manual resources, malformed targetRef's were
present in cases being created. This is now fixed.

This resolves MID-7986.
  • Loading branch information
mederly committed Jul 1, 2022
1 parent b2fcedf commit 52e4e37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,12 @@ public void test099TestConnection() throws Exception {

@Test
public void test100AssignWillRoleOne() throws Exception {
final String TEST_NAME = "test100AssignWillRoleOne";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();

// The count will be checked only after propagation was run, so we can address both direct and grouping cases
rememberCounter(InternalCounters.CONNECTOR_MODIFICATION_COUNT);

Expand All @@ -694,6 +700,11 @@ public void test100AssignWillRoleOne() throws Exception {
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 0, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_CONFIGURATION_COUNT, 0, 1);
assertSteadyResources();

CaseType aCase = repositoryService
.getObject(CaseType.class, willLastCaseOid, null, result)
.asObjectable();
assertNull("Malformed targetRef is present in the manual provisioning case", aCase.getTargetRef());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ private PrismObject<CaseType> addCase(String operation, String description, Stri

caseType.setObjectRef(new ObjectReferenceType().oid(resourceOid).type(ResourceType.COMPLEX_TYPE));

caseType.setTargetRef(new ObjectReferenceType().oid(shadowOid).targetName(shadowName).type(ShadowType.COMPLEX_TYPE));
if (shadowOid != null) {
caseType.setTargetRef(
new ObjectReferenceType()
.oid(shadowOid)
.targetName(shadowName)
.type(ShadowType.COMPLEX_TYPE));
}

if (task != null) {
if (isCaseOperationTask(task)) {
Expand Down

0 comments on commit 52e4e37

Please sign in to comment.