use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestParseTaskBulkAction2 method testParseTaskFileToXNode.
@Test
public void testParseTaskFileToXNode() throws Exception {
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
RootXNode node = prismContext.parserFor(TASK_FILE).xml().parseToXNode();
// THEN
System.out.println("Parsed task (XNode):");
System.out.println(node.debugDump());
System.out.println("XML -> XNode -> JSON:\n" + prismContext.jsonSerializer().serialize(node));
System.out.println("XML -> XNode -> YAML:\n" + prismContext.yamlSerializer().serialize(node));
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestBasicPerformance method test340ParseXNode.
@Test
public void test340ParseXNode() throws Exception {
PrismObject<UserType> jack = getJack();
RootXNode xnode = getPrismContext().xnodeSerializer().serialize(jack);
measure("parse.xnode.prism", "parse XNode", () -> getPrismContext().parserFor(xnode).parse());
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestParseScriptOutput method testNamespaces.
@Test
public void testNamespaces() throws Exception {
String file = MiscUtil.readFile(getFile());
RootXNode xnode = getPrismContext().parserFor(file).parseToXNode();
System.out.println("XNode:\n" + xnode.debugDump());
String serialized = getPrismContext().xmlSerializer().serialize(xnode);
System.out.println("XML: " + serialized);
final String common_3 = "http://midpoint.evolveum.com/xml/ns/public/common/common-3";
int count = StringUtils.countMatches(serialized, common_3);
// temporarily set from 2 to 3 (some XML weirdness in Xerces 2.12/Xalan 2.7.2); see MID-5661
assertEquals("Wrong # of occurrences of '" + common_3 + "' in serialized form", 2, count);
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class PrismTestUtil method displaySearchFilterType.
public static void displaySearchFilterType(SearchFilterType filterType) throws SchemaException {
MapXNode mapXNode = filterType.getFilterClauseXNode();
String dumpX = mapXNode.debugDump();
LOGGER.info(dumpX);
System.out.println(dumpX);
String dumpXml = prismContext.xmlSerializer().serialize(new RootXNode(new QName("query"), mapXNode));
System.out.println(dumpXml);
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class PrismParserImpl method doParseAnyValueAsJAXBElement.
@SuppressWarnings("unchecked")
<T> JAXBElement<T> doParseAnyValueAsJAXBElement() throws IOException, SchemaException {
RootXNode root = getLexicalProcessor().read(source, context);
T real = doParseRealValue(null, root);
return real != null ? new JAXBElement<>(root.getRootElementName(), (Class<T>) real.getClass(), real) : null;
}
Aggregations