Search in sources :

Example 1 with EventHandlerType

use of com.evolveum.midpoint.prism.foo.EventHandlerType in project midpoint by Evolveum.

the class AbstractLexicalProcessorTest method testParseEventHandler.

// The following is not supported now (and probably won't be in the future).
// Enable it if that changes.
@Test(enabled = false)
public void testParseEventHandler() throws Exception {
    final String TEST_NAME = "testParseEventHandler";
    displayTestTitle(TEST_NAME);
    // GIVEN
    LexicalProcessor lexicalProcessor = createParser();
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN (parse to xnode)
    RootXNode xnode = lexicalProcessor.read(getFileSource(EVENT_HANDLER_FILE_BASENAME), ParsingContext.createDefault());
    System.out.println("XNode after parsing:");
    System.out.println(xnode.debugDump());
    // WHEN (parse to prism)
    EventHandlerType eventHandlerType = prismContext.parserFor(xnode).parseRealValue(EventHandlerChainType.class);
    //		EventHandlerType eventHandlerType = prismContext.getBeanConverter().unmarshall((MapXNode) , EventHandlerChainType.class,
    //				ParsingContext.createDefault());
    // THEN
    System.out.println("Parsed object:");
    System.out.println(eventHandlerType);
    // WHEN2 (marshalling)
    MapXNode marshalled = (MapXNode) (prismContext.xnodeSerializer().serializeRealValue(eventHandlerType).getSubnode());
    System.out.println("XNode after unmarshalling and marshalling back:");
    System.out.println(marshalled.debugDump());
}
Also used : EventHandlerType(com.evolveum.midpoint.prism.foo.EventHandlerType) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) MapXNode(com.evolveum.midpoint.prism.xnode.MapXNode) Test(org.testng.annotations.Test)

Aggregations

EventHandlerType (com.evolveum.midpoint.prism.foo.EventHandlerType)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 MapXNode (com.evolveum.midpoint.prism.xnode.MapXNode)1 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 Test (org.testng.annotations.Test)1