use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestParseScriptOutput method testParseToXNode.
@Test
public void testParseToXNode() throws Exception {
String file = MiscUtil.readFile(getFile());
System.out.println("Original text:\n" + file);
RootXNode xnode = getPrismContext().parserFor(file).parseToXNode();
System.out.println("XNode:\n" + xnode.debugDump());
System.out.println("source -> XNode -> JSON:\n" + getPrismContext().jsonSerializer().serialize(xnode));
System.out.println("source -> XNode -> YAML:\n" + getPrismContext().yamlSerializer().serialize(xnode));
System.out.println("source -> XNode -> XML:\n" + getPrismContext().xmlSerializer().serialize(xnode));
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestParseScriptingExpressionXsiType method testYamlSerialization.
@Test
public void testYamlSerialization() throws Exception {
String file = MiscUtil.readFile(getFile());
System.out.println("Original text:\n" + file);
RootXNode xnode = getPrismContext().parserFor(file).parseToXNode();
System.out.println("XNode:\n" + xnode.debugDump());
String yaml = getPrismContext().yamlSerializer().serialize(xnode);
System.out.println("source -> XNode -> YAML:\n" + yaml);
PrismValue value = getPrismContext().parserFor(yaml).parseItemValue();
assertPrismPropertyValueLocal((PrismPropertyValue<ExpressionPipelineType>) value);
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class PerfTestPrismObjectSize method generateTestObject.
private static final RootXNode generateTestObject(int count, int conflicts, boolean withIds) throws SchemaException, IOException {
@NotNull PrismObject<UserType> baseObject = getJack();
@NotNull RootXNode rootNode = getPrismContext().xnodeSerializer().serialize(baseObject);
MapXNodeImpl user = (MapXNodeImpl) rootNode.getSubnode();
ListXNodeImpl assignments = new ListXNodeImpl();
int unique = count - conflicts;
List<String> uuids = generateUUIDs(unique);
for (int i = 0; i < unique; i++) {
assignments.add(createXNodeAssignment(uuids.get(i), withIds ? i : -1));
}
for (int i = 0; i < conflicts; i++) {
int id = unique - 1 - i;
assignments.add(createXNodeAssignment(uuids.get(id), withIds ? id : -1));
}
user.put(UserType.F_ASSIGNMENT, assignments);
return rootNode;
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class PerfTestPrismObjectSize method fromXnodeToPrism.
@Test(dataProvider = "combinationsConflicts")
public void fromXnodeToPrism(ContainerTestParams config) throws Exception {
RootXNode input = config.testObject();
PrismParserNoIO parser = getPrismContext().parserFor(input);
String monitorId = monitorName("parse.prism", config.monitorId());
String note = "Measures unmarshalling of Prism Objects from XNodes. Test parameters: " + config;
measure(monitorId, note, parser::parse);
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class PerfTestPrismObjectSize method fromXnodeToFile.
@Test(dataProvider = "combinations")
public void fromXnodeToFile(ContainerTestParams config) throws Exception {
RootXNode input = config.testObject();
for (String format : FILE_FORMATS) {
PrismSerializer<String> serializer = getPrismContext().serializerFor(format);
String monitorId = monitorName("serialize.xnode", config.monitorId(), format);
String note = "Measures serialization from xnode to data stream. Test parameters: " + config;
measure(monitorId, note, () -> serializer.serialize(input));
}
}
Aggregations