Skip to content

Commit

Permalink
fix conntests (polyString as primary identifier)
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Mar 4, 2024
1 parent e9ee9c6 commit 8bdba5d
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition;

import org.apache.commons.lang3.mutable.MutableInt;
Expand Down Expand Up @@ -922,7 +923,12 @@ public void test290ModifyUserBarbossaRename() throws Exception {
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
display("Repo shadow after rename", repoShadow);

String repoPrimaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), String.class);
PolyString primaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), PolyString.class);
String repoPrimaryIdentifier = null;
if (primaryIdentifier != null) {
repoPrimaryIdentifier = primaryIdentifier.getOrig();
}

if ("dn".equals(getPrimaryIdentifierAttributeName())) {
assertEquals("Entry DN (primary identifier) was not updated in the shadow", toAccountDn(USER_CPTBARBOSSA_USERNAME).toLowerCase(), repoPrimaryIdentifier);
} else {
Expand Down Expand Up @@ -969,7 +975,12 @@ public void test292ModifyUserBarbossaRenameCapitalized() throws Exception {
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
display("Repo shadow after rename", repoShadow);

String repoPrimaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), String.class);
PolyString primaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), PolyString.class);
String repoPrimaryIdentifier = null;
if (primaryIdentifier != null) {
repoPrimaryIdentifier = primaryIdentifier.getOrig();
}

if ("dn".equals(getPrimaryIdentifierAttributeName())) {
assertEquals("Entry DN (primary identifier) was not updated in the shadow", toAccountDn(USER_CPTBARBOSSA_USERNAME).toLowerCase(), repoPrimaryIdentifier);
} else {
Expand Down Expand Up @@ -1274,7 +1285,12 @@ public void test314ModifyUserBarbossaRenameBack() throws Exception {
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
display("Repo shadow after rename", repoShadow);

String repoPrimaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), String.class);
PolyString primaryIdentifier = getAttributeValue(repoShadow, getPrimaryIdentifierAttributeQName(), PolyString.class);
String repoPrimaryIdentifier = null;
if (primaryIdentifier != null) {
repoPrimaryIdentifier = primaryIdentifier.getOrig();
}

if ("dn".equals(getPrimaryIdentifierAttributeName())) {
assertEquals("Entry DN (primary identifier) was not updated in the shadow", toAccountDn(USER_BARBOSSA_USERNAME).toLowerCase(), repoPrimaryIdentifier);
} else {
Expand Down

0 comments on commit 8bdba5d

Please sign in to comment.