Skip to content

Commit

Permalink
MID-8824: Fixed use of incorrect types in deltas in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydamage committed Sep 18, 2023
1 parent 027bc98 commit 4b8319f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import java.io.IOException;

import com.evolveum.midpoint.test.util.TestUtil;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
Expand Down Expand Up @@ -46,7 +48,7 @@ public void testModifyObjectSetAdditionalName() throws Exception {
// GIVEN
ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class,
MappingTestEvaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, "Jackie");
MappingTestEvaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Jackie"));
delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_NUMBER, "321");

MappingImpl<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(
Expand All @@ -69,7 +71,7 @@ public void testModifyObjectSetAdditionalNameFalse() throws Exception {
// GIVEN
ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class,
MappingTestEvaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, "Jackie");
MappingTestEvaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Jackie"));
delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_NUMBER, "321");

PrismObject<UserType> userOld = evaluator.getUserOld();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testControlReplaceSingleValue() throws Exception {

ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, MappingTestEvaluator.USER_OLD_OID,
UserType.F_ADDITIONAL_NAME, "Jackie");
UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Jackie"));
delta.addModificationReplaceProperty(UserType.F_SUBTYPE, "321");

MappingImpl<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping =
Expand Down Expand Up @@ -101,7 +101,7 @@ public void testControlReplaceMultiValue() throws Exception {

ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, MappingTestEvaluator.USER_OLD_OID,
UserType.F_ADDITIONAL_NAME, "Jackie");
UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Jackie"));
delta.addModificationReplaceProperty(UserType.F_SUBTYPE, "991", "992");

MappingImpl<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping =
Expand Down Expand Up @@ -137,7 +137,7 @@ public void testReplaceMixedMultiValue() throws Exception {

ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, MappingTestEvaluator.USER_OLD_OID,
UserType.F_ADDITIONAL_NAME, "Jackie");
UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Jackie"));
delta.addModificationReplaceProperty(UserType.F_SUBTYPE, "X91", "992", "Y93", "994");

String shortTestName = getTestNameShort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public void testScriptSystemVariablesConditionTrueToFalse(String filename) throw
// GIVEN
ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID,
evaluator.toPath("name"), "Jack");
evaluator.toPath("name"), PolyString.fromOrig("Jack"));
delta.addModificationDeleteProperty(evaluator.toPath("subtype"), "CAPTAIN");

String shortTestName = getTestNameShort();
Expand Down Expand Up @@ -501,7 +501,7 @@ public void testNpeFalseToTrue() throws Exception {
// GIVEN
ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID,
UserType.F_ADDITIONAL_NAME, "Captain Sparrow");
UserType.F_ADDITIONAL_NAME, PolyString.fromOrig("Captain Sparrow"));

String shortTestName = getTestNameShort();
MappingImpl<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1761,8 +1761,8 @@ public void test314RemovePasswordFail() throws Exception {
private void setPasswordMinOccurs(Integer value, Task task, OperationResult result) throws CommonException {
ObjectDelta<SecurityPolicyType> delta = prismContext.deltaFor(SecurityPolicyType.class)
.item(SecurityPolicyType.F_CREDENTIALS, CredentialsPolicyType.F_PASSWORD, PasswordCredentialsPolicyType.F_MIN_OCCURS)
.replace(value)
.asObjectDeltaCast(getSecurityPolicyOid());
.replace(value != null ? value.toString() : null)
.asObjectDelta(getSecurityPolicyOid());
executeChanges(delta, null, task, result);
}

Expand Down

0 comments on commit 4b8319f

Please sign in to comment.