Skip to content

Commit

Permalink
Add (failing) test for MID-8145
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Sep 30, 2022
1 parent 0d8b7dd commit 1baa0ad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package com.evolveum.midpoint.provisioning.ucf.impl.connid;

import static com.evolveum.midpoint.schema.constants.SchemaConstants.RI_ACCOUNT_OBJECT_CLASS;

import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.AssertJUnit.*;

import java.util.ArrayList;
Expand All @@ -17,8 +19,6 @@

import com.evolveum.midpoint.provisioning.ucf.api.*;

import com.evolveum.midpoint.schema.constants.MidPointConstants;

import org.springframework.test.context.ContextConfiguration;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -336,6 +336,35 @@ private void checkUcfShadow(PrismObject<ShadowType> shadow, ResourceObjectClassD
assertFalse("Empty attributes in shadow " + shadow, attributes.isEmpty());
}

/** MID-8145 */
@Test
public void test060GetByUidWithNameHint() throws Exception {
given();
UcfExecutionContext ctx = createExecutionContext();
OperationResult result = createOperationResult();

ResourceObjectClassDefinition accountDefinition =
resourceSchema.findObjectClassDefinitionRequired(RI_ACCOUNT_OBJECT_CLASS);
//noinspection unchecked
ResourceAttribute<String> uid =
(ResourceAttribute<String>) accountDefinition.getPrimaryIdentifiers().iterator().next().instantiate();
uid.setRealValue("jack");
//noinspection unchecked
ResourceAttribute<String> name =
(ResourceAttribute<String>) accountDefinition.getSecondaryIdentifiers().iterator().next().instantiate();
name.setRealValue("jack");
ResourceObjectIdentification identification =
new ResourceObjectIdentification(accountDefinition, List.of(uid), List.of(name));

when("getting account by UID");
PrismObject<ShadowType> shadow = cc.fetchObject(identification, null, ctx, result);

then("account is retrieved OK");
displayDumpable("shadow retrieved", shadow);
assertThat(shadow).as("shadow").isNotNull();
checkUcfShadow(shadow, accountDefinition);
}

@Test
public void test100FetchEmptyChanges() throws Exception {
OperationResult result = createOperationResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<icfc:resultsHandlerConfiguration>
<icfc:enableNormalizingResultsHandler>false</icfc:enableNormalizingResultsHandler>
<icfc:enableFilteredResultsHandler>false</icfc:enableFilteredResultsHandler>
<icfc:enableFilteredResultsHandler>true</icfc:enableFilteredResultsHandler> <!-- MID-8145 -->
<icfc:enableAttributesToGetSearchResultsHandler>false</icfc:enableAttributesToGetSearchResultsHandler>
</icfc:resultsHandlerConfiguration>

Expand Down

0 comments on commit 1baa0ad

Please sign in to comment.