use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class CertificationTest method test230ModifyAllLevels.
@Test
public void test230ModifyAllLevels() throws Exception {
OperationResult result = new OperationResult("test230ModifyAllLevels");
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_NAME).replace(new PolyString("Campaign 2", "campaign 2")).item(F_STATE).replace(IN_REMEDIATION).item(F_CASE, 2, F_CURRENT_STAGE_OUTCOME).replace(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NO_RESPONSE).item(F_CASE, 2, AccessCertificationCaseType.F_STAGE_NUMBER).replace(400).item(F_CASE, 1, F_WORK_ITEM, 1, F_OUTPUT).replace(new AbstractWorkItemOutputType().outcome(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED).comment("low")).asItemDeltas();
executeAndCheckModification(modifications, result, 1);
checksCountsStandard(result);
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class LookupTableTest method test210ModifyRowProperties.
@Test
public void test210ModifyRowProperties() throws Exception {
OperationResult result = new OperationResult("test210ModifyRowProperties");
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(LookupTableType.class, prismContext).item(F_ROW, 1, F_KEY).replace("key 1").item(F_ROW, 2, F_VALUE).replace().item(F_ROW, 3, F_LABEL).replace(new PolyString("label 3")).item(F_ROW, 3, F_LAST_CHANGE_TIMESTAMP).replace(XmlTypeConverter.createXMLGregorianCalendar(new Date(99, 10, 10))).asItemDeltas();
executeAndCheckModification(modifications, result, 0, Arrays.asList("key 1", "2 key"));
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class LookupTableTest method test230ModifyTableAndRow.
@Test
public void test230ModifyTableAndRow() throws Exception {
OperationResult result = new OperationResult("test230ModifyTableAndRow");
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(LookupTableType.class, prismContext).item(F_NAME).replace(new PolyString("Table 111", "table 111")).item(F_ROW, 2, F_KEY).replace("key 2").asItemDeltas();
executeAndCheckModification(modifications, result, 1, Arrays.asList("key 2"));
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class UserProfileServiceMock method findByUsername.
private PrismObject<UserType> findByUsername(String username, OperationResult result) throws SchemaException, ObjectNotFoundException {
PolyString usernamePoly = new PolyString(username);
ObjectQuery query = ObjectQueryUtil.createNormNameQuery(usernamePoly, prismContext);
LOGGER.trace("Looking for user, query:\n" + query.debugDump());
List<PrismObject<UserType>> list = repositoryService.searchObjects(UserType.class, query, null, result);
LOGGER.trace("Users found: {}.", (list != null ? list.size() : 0));
if (list == null || list.size() != 1) {
return null;
}
return list.get(0);
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class AbstractIntegrationTest method assertShadowCommon.
protected void assertShadowCommon(PrismObject<ShadowType> shadow, String oid, String username, ResourceType resourceType, QName objectClass, final MatchingRule<String> nameMatchingRule, boolean requireNormalizedIdentfiers, boolean useMatchingRuleForShadowName) throws SchemaException {
assertShadow(shadow);
if (oid != null) {
assertEquals("Shadow OID mismatch (prism)", oid, shadow.getOid());
}
ShadowType resourceObjectShadowType = shadow.asObjectable();
if (oid != null) {
assertEquals("Shadow OID mismatch (jaxb)", oid, resourceObjectShadowType.getOid());
}
assertEquals("Shadow objectclass", objectClass, resourceObjectShadowType.getObjectClass());
assertEquals("Shadow resourceRef OID", resourceType.getOid(), shadow.asObjectable().getResourceRef().getOid());
PrismContainer<Containerable> attributesContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
assertNotNull("Null attributes in shadow for " + username, attributesContainer);
assertFalse("Empty attributes in shadow for " + username, attributesContainer.isEmpty());
if (useMatchingRuleForShadowName) {
MatchingRule<PolyString> polyMatchingRule = new MatchingRule<PolyString>() {
@Override
public QName getName() {
return nameMatchingRule.getName();
}
@Override
public boolean isSupported(QName xsdType) {
return nameMatchingRule.isSupported(xsdType);
}
@Override
public boolean match(PolyString a, PolyString b) throws SchemaException {
return nameMatchingRule.match(a.getOrig(), b.getOrig());
}
@Override
public boolean matchRegex(PolyString a, String regex) throws SchemaException {
return nameMatchingRule.matchRegex(a.getOrig(), regex);
}
@Override
public PolyString normalize(PolyString original) throws SchemaException {
return new PolyString(nameMatchingRule.normalize(original.getOrig()));
}
};
PrismAsserts.assertPropertyValueMatch(shadow, ShadowType.F_NAME, polyMatchingRule, PrismTestUtil.createPolyString(username));
} else {
PrismAsserts.assertPropertyValue(shadow, ShadowType.F_NAME, PrismTestUtil.createPolyString(username));
}
RefinedResourceSchema rSchema = RefinedResourceSchemaImpl.getRefinedSchema(resourceType);
ObjectClassComplexTypeDefinition ocDef = rSchema.findObjectClassDefinition(objectClass);
if (ocDef.getSecondaryIdentifiers().isEmpty()) {
ResourceAttributeDefinition idDef = ocDef.getPrimaryIdentifiers().iterator().next();
PrismProperty<String> idProp = attributesContainer.findProperty(idDef.getName());
assertNotNull("No primary identifier (" + idDef.getName() + ") attribute in shadow for " + username, idProp);
if (nameMatchingRule == null) {
assertEquals("Unexpected primary identifier in shadow for " + username, username, idProp.getRealValue());
} else {
if (requireNormalizedIdentfiers) {
assertEquals("Unexpected primary identifier in shadow for " + username, nameMatchingRule.normalize(username), idProp.getRealValue());
} else {
PrismAsserts.assertEquals("Unexpected primary identifier in shadow for " + username, nameMatchingRule, username, idProp.getRealValue());
}
}
} else {
ResourceAttributeDefinition idSecDef = ocDef.getSecondaryIdentifiers().iterator().next();
PrismProperty<String> idProp = attributesContainer.findProperty(idSecDef.getName());
assertNotNull("No secondary identifier (" + idSecDef.getName() + ") attribute in shadow for " + username, idProp);
if (nameMatchingRule == null) {
assertEquals("Unexpected secondary identifier in shadow for " + username, username, idProp.getRealValue());
} else {
if (requireNormalizedIdentfiers) {
assertEquals("Unexpected secondary identifier in shadow for " + username, nameMatchingRule.normalize(username), idProp.getRealValue());
} else {
PrismAsserts.assertEquals("Unexpected secondary identifier in shadow for " + username, nameMatchingRule, username, idProp.getRealValue());
}
}
}
}
Aggregations