Package org.mule.module.xml.transformer

Examples of org.mule.module.xml.transformer.JXPathExtractor.transform()


        final JXPathExtractor extractor = createObject(JXPathExtractor.class);
        final String expression = "/root/node";
        extractor.setExpression(expression);
        // just make code coverage tools happy
        assertEquals("Wrong expression returned.", expression, extractor.getExpression());
        final Object objResult = extractor.transform(TEST_XML_SINGLE_RESULT);
        assertNotNull(objResult);
        String result = (String)objResult;
        assertEquals("Wrong value extracted.", "value1", result);
    }
View Full Code Here


    public void testMultipleResults() throws Exception
    {
        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node");
        extractor.setSingleResult(false);
        final Object objResult = extractor.transform(TEST_XML_MULTI_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 3, results.size());
        assertEquals("Wrong value returned.", "value1", results.get(0));
        assertEquals("Wrong value returned.", "value2", results.get(1));
View Full Code Here

        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node");
        extractor.setSingleResult(false);
        extractor.setOutputType(JXPathExtractor.OUTPUT_TYPE_NODE);
       
        final Object objResult = extractor.transform(TEST_XML_MULTI_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 3, results.size());
        assertTrue(results.get(0) instanceof Node);
    }
View Full Code Here

    public void testMultipleResultsNested() throws Exception
    {
        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node[*]/*/text()");
        extractor.setSingleResult(false);
        final Object objResult = extractor.transform(TEST_XML_MULTI_NESTED_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 4, results.size());
        assertEquals("Wrong value returned.", "val1", results.get(0));
        assertEquals("Wrong value returned.", "val2", results.get(1));
View Full Code Here

        final JXPathExtractor extractor = createObject(JXPathExtractor.class);
        final String expression = "/root/node";
        extractor.setExpression(expression);
        // just make code coverage tools happy
        assertEquals("Wrong expression returned.", expression, extractor.getExpression());
        final Object objResult = extractor.transform(TEST_XML_SINGLE_RESULT);
        assertNotNull(objResult);
        String result = (String)objResult;
        assertEquals("Wrong value extracted.", "value1", result);
    }
View Full Code Here

    public void testMultipleResults() throws Exception
    {
        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node");
        extractor.setSingleResult(false);
        final Object objResult = extractor.transform(TEST_XML_MULTI_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 3, results.size());
        assertEquals("Wrong value returned.", "value1", results.get(0));
        assertEquals("Wrong value returned.", "value2", results.get(1));
View Full Code Here

        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node");
        extractor.setSingleResult(false);
        extractor.setOutputType(JXPathExtractor.OUTPUT_TYPE_NODE);
       
        final Object objResult = extractor.transform(TEST_XML_MULTI_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 3, results.size());
        assertTrue(results.get(0) instanceof Node);
    }
View Full Code Here

    public void testMultipleResultsNested() throws Exception
    {
        JXPathExtractor extractor = createObject(JXPathExtractor.class);
        extractor.setExpression("/root/node[*]/*/text()");
        extractor.setSingleResult(false);
        final Object objResult = extractor.transform(TEST_XML_MULTI_NESTED_RESULTS);
        assertNotNull(objResult);
        List results = (List)objResult;
        assertEquals("Wrong number of results returned.", 4, results.size());
        assertEquals("Wrong value returned.", "val1", results.get(0));
        assertEquals("Wrong value returned.", "val2", results.get(1));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.