use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class JAXBUtilTest method testUnmarshallerIso88592.
@Test
public void testUnmarshallerIso88592() throws JAXBException, SchemaException, FileNotFoundException {
// GIVEN
UserType user = JaxbTestUtil.getInstance().unmarshalElement(new File("src/test/resources/util/user-8859-2.xml"), UserType.class).getValue();
// WHEN
PolyStringType fullname = user.getFullName();
// THEN
assertTrue("National characters incorrectly decoded", "Jožko Nováčik".equals(fullname.getOrig()));
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class JAXBUtilTest method testUnmarshallerStringIso88592.
@Test
public void testUnmarshallerStringIso88592() throws JAXBException, SchemaException {
// GIVEN
String s = "<?xml version='1.0' encoding='iso-8859-2'?> " + "<user oid='deadbeef-c001-f00d-1111-222233330001'" + " xmlns:t='http://prism.evolveum.com/xml/ns/public/types-3'" + " xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'>" + " <fullName><t:orig>Jožko Nováčik</t:orig><t:norm>jozko novacik</t:norm></fullName>" + "</user>";
UserType user = JaxbTestUtil.getInstance().unmarshalElement(s, UserType.class).getValue();
// WHEN
PolyStringType fullname = user.getFullName();
// THEN
assertTrue("Diacritics correctly decoded", "Jožko Nováčik".equals(fullname.getOrig()));
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class JAXBUtilTest method testUnmarshallerStringUtf8.
@Test
public void testUnmarshallerStringUtf8() throws JAXBException, SchemaException {
// GIVEN
String s = "<?xml version='1.0' encoding='utf-8'?> " + "<user oid='deadbeef-c001-f00d-1111-222233330001'" + " xmlns:t='http://prism.evolveum.com/xml/ns/public/types-3'" + " xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'>" + " <fullName><t:orig>Jožko Nováčik</t:orig><t:norm>jozko novacik</t:norm></fullName>" + "</user>";
UserType user = JaxbTestUtil.getInstance().unmarshalElement(s, UserType.class).getValue();
// WHEN
PolyStringType fullname = user.getFullName();
// THEN
assertTrue("Diacritics correctly decoded", "Jožko Nováčik".equals(fullname.getOrig()));
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class ModelClientUtil method createPolyStringType.
public static PolyStringType createPolyStringType(String string, Document doc) {
PolyStringType polyStringType = new PolyStringType();
polyStringType.getContent().add(string);
return polyStringType;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class ImportAccountsFromResourceTaskHandler method launch.
/**
* Launch an import. Calling this method will start import in a new
* thread, possibly on a different node.
*/
public void launch(ResourceType resource, QName objectclass, Task task, OperationResult parentResult) {
LOGGER.info("Launching import from resource {} as asynchronous task", ObjectTypeUtil.toShortString(resource));
OperationResult result = parentResult.createSubresult(ImportAccountsFromResourceTaskHandler.class.getName() + ".launch");
result.addParam("resource", resource);
result.addParam("objectclass", objectclass);
// TODO
// Set handler URI so we will be called back
task.setHandlerUri(HANDLER_URI);
// Readable task name
PolyStringType polyString = new PolyStringType("Import from resource " + resource.getName());
task.setName(polyString);
// Set reference to the resource
task.setObjectRef(ObjectTypeUtil.createObjectRef(resource));
try {
PrismProperty<?> objectclassProp = objectclassPropertyDefinition.instantiate();
objectclassProp.setRealValue(objectclass);
task.setExtensionProperty(objectclassProp);
// just to be sure (if the task was already persistent)
task.savePendingModifications(result);
// task.modify(modifications, result);
} catch (ObjectNotFoundException e) {
LOGGER.error("Task object not found, expecting it to exist (task {})", task, e);
result.recordFatalError("Task object not found", e);
throw new IllegalStateException("Task object not found, expecting it to exist", e);
} catch (ObjectAlreadyExistsException e) {
LOGGER.error("Task object wasn't updated (task {})", task, e);
result.recordFatalError("Task object wasn't updated", e);
throw new IllegalStateException("Task object wasn't updated", e);
} catch (SchemaException e) {
LOGGER.error("Error dealing with schema (task {})", task, e);
result.recordFatalError("Error dealing with schema", e);
throw new IllegalStateException("Error dealing with schema", e);
}
// Switch task to background. This will start new thread and call
// the run(task) method.
// Note: the thread may be actually started on a different node
taskManager.switchToBackground(task, result);
result.setBackgroundTaskOid(task.getOid());
result.computeStatus("Import launch failed");
LOGGER.trace("Import from resource {} switched to background, control thread returning with task {}", ObjectTypeUtil.toShortString(resource), task);
}
Aggregations