Skip to content

Commit

Permalink
tests for MID-6742
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Jan 26, 2021
1 parent efddbc1 commit d55aa3e
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 0 deletions.
Expand Up @@ -197,6 +197,9 @@ public class TestConsistencyMechanism extends AbstractModelIntegrationTest {
private static final String USER_DISCOVERY_FILENAME = TEST_DIR + "user-discovery.xml";
private static final String USER_DISCOVERY_OID = "c0c010c0-d34d-b33f-f00d-111112226666";

private static final String USER_TRAINEE_FILENAME = TEST_DIR + "user-trainee.xml";
private static final String USER_TRAINEE_OID = "c0c010c0-0000-b33f-f00d-111112226666";

private static final String USER_ABOMBA_FILENAME = TEST_DIR + "user-abomba.xml";
private static final String USER_ABOMBA_OID = "c0c010c0-d34d-b33f-f00d-016016111111";

Expand Down Expand Up @@ -2280,7 +2283,50 @@ public void test284ModifyObjectAssignToGroupCommunicationProblem() throws Except
//TODO: check on user if it was processed successfully (add this check also to previous (30) test..
}

@Test
public void test300addAccountTrainee() throws Exception {
given();
openDJController.assumeRunning();

when();
addObject(new File(USER_TRAINEE_FILENAME));

then();
PrismObject<UserType> userAfter = getUser(USER_TRAINEE_OID);
assertUser(userAfter, " After ").assertName("trainee").assertLinks(1);

}

//MID-6742
@Test
public void test310modifyAccountTraineeCommunicationProblem() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();

openDJController.assumeStopped();

when();
modifyObjectReplaceProperty(UserType.class, USER_TRAINEE_OID, UserType.F_NAME, ModelExecuteOptions.create(prismContext).reconcile(), task, result, createPolyString("trainee01"));

then();
// assertResultStatus(result, OperationResultStatus.IN_PROGRESS);
PrismObject<UserType> userAfter = getUser(USER_TRAINEE_OID);
assertUser(userAfter, " After ").assertName("trainee01");

String accountOid = assertOneAccountRef(userAfter);

assertRepoShadow(accountOid)
.hasUnfinishedPendingOperations()
.pendingOperations()
.assertOperations(1)
.modifyOperation()
.display()
.assertAttemptNumber(1)
.delta()
.assertModify()
.assertHasModification(ItemPath.create(ShadowType.F_ATTRIBUTES, LDAP_ATTRIBUTE_DN));
}

//TODO: enable after notify failure will be implemented..
@Test(enabled = false)
Expand Down
98 changes: 98 additions & 0 deletions testing/story/src/test/resources/consistency/resource-opendj.xml
Expand Up @@ -615,6 +615,104 @@

</objectType>

<objectType>
<kind>account</kind>
<intent>student</intent>
<displayName>Account</displayName>
<objectClass>ri:inetOrgPerson</objectClass>
<attribute>
<c:ref>ri:dn</c:ref>
<matchingRule xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3">mr:distinguishedName</matchingRule>
<outbound>
<strength>strong</strength>
<source>
<c:path>$focus/name</c:path>
</source>
<expression>
<script>
<code>
basic.composeDnWithSuffix('uid', name, 'ou=People,dc=example,dc=com')
</code>
</script>
</expression>
</outbound>
</attribute>
<attribute>
<c:ref>ri:cn</c:ref>
<limitations>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</limitations>
<matchingRule xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3">mr:stringIgnoreCase</matchingRule>
<outbound>
<strength>strong</strength>
<source>
<c:path>nickName</c:path>
</source>
</outbound>
</attribute>
<attribute>
<c:ref>ri:sn</c:ref>
<limitations>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</limitations>
<outbound>
<strength>strong</strength>
<source>
<c:path>familyName</c:path>
</source>
</outbound>
</attribute>
<attribute>
<c:ref>ri:givenName</c:ref>
<limitations>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</limitations>
<outbound>
<strength>strong</strength>
<source>
<c:path>givenName</c:path>
</source>
</outbound>
</attribute>
<attribute>
<c:ref>ri:uid</c:ref>
<matchingRule xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3">mr:stringIgnoreCase</matchingRule>
<outbound>
<strength>weak</strength>
<source>
<c:path>name</c:path>
</source>
</outbound>
</attribute>
<attribute>
<c:ref>ri:mail</c:ref>
<matchingRule xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3">mr:stringIgnoreCase</matchingRule>
<limitations>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</limitations>
<outbound>
<strength>strong</strength>
<source>
<c:path>emailAddress</c:path>
</source>
</outbound>
</attribute>
<iteration>
<maxIterations>5</maxIterations>
</iteration>
<activation>
<administrativeStatus>
<outbound>
<strength>strong</strength>
</outbound>
</administrativeStatus>
</activation>
</objectType>

<objectType>
<kind>entitlement</kind>
<intent>ldapGroup</intent>
Expand Down
35 changes: 35 additions & 0 deletions testing/story/src/test/resources/consistency/user-trainee.xml
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2021 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<i:user oid="c0c010c0-0000-b33f-f00d-111112226666"
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:i='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
>
<c:name>trainee</c:name>
<i:fullName>Student Trainee</i:fullName>
<i:givenName>Student</i:givenName>
<i:familyName>Trainee</i:familyName>
<i:nickName>tstudent</i:nickName>

<i:credentials>
<i:password>
<i:value>
<i:clearValue>piranhaDogs</i:clearValue>
</i:value>
</i:password>
</i:credentials>

<assignment>
<construction>
<resourceRef oid="ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff"/>
<kind>account</kind>
<intent>student</intent>
</construction>
</assignment>
</i:user>

0 comments on commit d55aa3e

Please sign in to comment.