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 9638f45 commit 3875791
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 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 @@ -12,6 +12,7 @@
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import javax.xml.datatype.XMLGregorianCalendar;

import com.evolveum.midpoint.prism.PrismContainer;
Expand Down Expand Up @@ -1761,7 +1762,7 @@ 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)
.replace(value != null ? value.toString() : null)
.asObjectDelta(getSecurityPolicyOid());
executeChanges(delta, null, task, result);
}
Expand Down

0 comments on commit 3875791

Please sign in to comment.