Package org.apache.synapse.commons.evaluators.source

Examples of org.apache.synapse.commons.evaluators.source.SourceTextRetriever


        String input = "<equal type=\"header\" source=\"" + SOURCE +
                "\" value=\"" + VALUE + "\"/>";

        try {
            EqualEvaluator eval = (EqualEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof HeaderTextRetriever);
            assertEquals(txtRtvr.getSource(), SOURCE);
            assertEquals(eval.getValue(), VALUE);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here


        String input = "<equal type=\"param\" source=\"" + SOURCE +
                "\" value=\"" + VALUE + "\"/>";

        try {
            EqualEvaluator eval = (EqualEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof ParameterTextRetriever);
            assertEquals(((ParameterTextRetriever) txtRtvr).getSource(), SOURCE);
            assertEquals(eval.getValue(), VALUE);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
View Full Code Here

    public void testURLEqual() {
        String input = "<equal type=\"url\" value=\"" + VALUE + "\"/>";

        try {
            EqualEvaluator eval = (EqualEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof URLTextRetriever);
            assertEquals(eval.getValue(), VALUE);
            assertNull(txtRtvr.getSource());
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

        String input = "<equal type=\"url\" value=\"" + VALUE + "\"" +
                " source=\"" + FRAGMENT + "\"/>";

        try {
            EqualEvaluator eval = (EqualEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof URLTextRetriever);
            assertEquals(eval.getValue(), VALUE);
            assertEquals(txtRtvr.getSource(), FRAGMENT);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

        String input = "<match type=\"header\" source=\"" + SOURCE +
                "\" regex=\"" + REGEX + "\"/>";

        try {
            MatchEvaluator eval = (MatchEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof HeaderTextRetriever);
            assertEquals(txtRtvr.getSource(), SOURCE);
            assertEquals(eval.getRegex().pattern(), REGEX);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

        String input = "<match type=\"param\" source=\"" + SOURCE +
                "\" regex=\"" + REGEX + "\"/>";

        try {
            MatchEvaluator eval = (MatchEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof ParameterTextRetriever);
            assertEquals(txtRtvr.getSource(), SOURCE);
            assertEquals(eval.getRegex().pattern(), REGEX);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

    public void testURLMatch() {
        String input = "<match type=\"url\" regex=\"" + REGEX + "\"/>";

        try {
            MatchEvaluator eval = (MatchEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof URLTextRetriever);
            assertEquals(eval.getRegex().pattern(), REGEX);
            assertNull(txtRtvr.getSource());
        } catch (Exception e) {
            e.printStackTrace();
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

        String input = "<match type=\"url\" regex=\"" + REGEX + "\" source=\"" +
                FRAGMENT +"\"/>";

        try {
            MatchEvaluator eval = (MatchEvaluator) fac.create(AXIOMUtil.stringToOM(input));
            SourceTextRetriever txtRtvr = eval.getTextRetriever();
            assertTrue(txtRtvr instanceof URLTextRetriever);
            assertEquals(eval.getRegex().pattern(), REGEX);
            assertEquals(txtRtvr.getSource(), FRAGMENT);
        } catch (Exception e) {
            fail("Error while parsing the input XML");
        }
    }
View Full Code Here

*/
public class MatchFactory extends TextProcessingEvaluatorFactory {

    public Evaluator create(OMElement e) throws EvaluatorException {
        MatchEvaluator equal = new MatchEvaluator();
        SourceTextRetriever textRetriever = getSourceTextRetriever(e);
        equal.setTextRetriever(textRetriever);

        OMAttribute regExAttr = e.getAttribute(new QName(EvaluatorConstants.REGEX));
        if (regExAttr == null) {
            handleException(EvaluatorConstants.REGEX + " attribute is required");
View Full Code Here

*/
public class EqualFactory extends TextProcessingEvaluatorFactory {

    public Evaluator create(OMElement e) throws EvaluatorException {
        EqualEvaluator equal = new EqualEvaluator();
        SourceTextRetriever textRetriever = getSourceTextRetriever(e);
        equal.setTextRetriever(textRetriever);

        OMAttribute valueAttr = e.getAttribute(new QName(EvaluatorConstants.VALUE));

        if (valueAttr == null) {
View Full Code Here

TOP

Related Classes of org.apache.synapse.commons.evaluators.source.SourceTextRetriever

Copyright © 2018 www.massapicom. 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.