Search in sources :

Example 1 with PrismParser

use of com.evolveum.midpoint.prism.PrismParser in project midpoint by Evolveum.

the class TestParseMappingConst method testParseSerialize.

@Test
public void testParseSerialize() throws Exception {
    displayTestTitle("testParseSerialize");
    PrismContext prismContext = getPrismContext();
    PrismParser parser = prismContext.parserFor(getFile());
    PrismPropertyValue<MappingType> mappingPval = parser.parseItemValue();
    System.out.println("\nmappingPval:\n" + mappingPval.debugDump(1));
    PrismSerializer<RootXNode> xserializer = prismContext.xnodeSerializer();
    RootXNode xnode = xserializer.root(new QName("dummy")).serialize(mappingPval);
    System.out.println("\nSerialized xnode:\n" + xnode.debugDump(1));
    MapXNode xexpression = (MapXNode) ((MapXNode) xnode.getSubnode()).get(new QName("expression"));
    ListXNode xconstList = (ListXNode) xexpression.get(new QName("const"));
    XNode xconst = xconstList.get(0);
    if (!(xconst instanceof PrimitiveXNode<?>)) {
        AssertJUnit.fail("const is not primitive: " + xconst);
    }
}
Also used : MappingType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType) ListXNode(com.evolveum.midpoint.prism.xnode.ListXNode) PrimitiveXNode(com.evolveum.midpoint.prism.xnode.PrimitiveXNode) PrismContext(com.evolveum.midpoint.prism.PrismContext) QName(javax.xml.namespace.QName) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) XNode(com.evolveum.midpoint.prism.xnode.XNode) PrimitiveXNode(com.evolveum.midpoint.prism.xnode.PrimitiveXNode) ListXNode(com.evolveum.midpoint.prism.xnode.ListXNode) MapXNode(com.evolveum.midpoint.prism.xnode.MapXNode) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) PrismParser(com.evolveum.midpoint.prism.PrismParser) MapXNode(com.evolveum.midpoint.prism.xnode.MapXNode) Test(org.testng.annotations.Test)

Aggregations

PrismContext (com.evolveum.midpoint.prism.PrismContext)1 PrismParser (com.evolveum.midpoint.prism.PrismParser)1 ListXNode (com.evolveum.midpoint.prism.xnode.ListXNode)1 MapXNode (com.evolveum.midpoint.prism.xnode.MapXNode)1 PrimitiveXNode (com.evolveum.midpoint.prism.xnode.PrimitiveXNode)1 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 XNode (com.evolveum.midpoint.prism.xnode.XNode)1 MappingType (com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType)1 QName (javax.xml.namespace.QName)1 Test (org.testng.annotations.Test)1