Search in sources :

Example 1 with ParameterTextRetriever

use of org.apache.synapse.commons.evaluators.source.ParameterTextRetriever in project wso2-synapse by wso2.

the class MatchBuilderTest method testParameterMatch.

public void testParameterMatch() {
    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");
    }
}
Also used : ParameterTextRetriever(org.apache.synapse.commons.evaluators.source.ParameterTextRetriever) SourceTextRetriever(org.apache.synapse.commons.evaluators.source.SourceTextRetriever) MatchEvaluator(org.apache.synapse.commons.evaluators.MatchEvaluator)

Example 2 with ParameterTextRetriever

use of org.apache.synapse.commons.evaluators.source.ParameterTextRetriever in project wso2-synapse by wso2.

the class EqualBuilderTest method testParameterEqual.

public void testParameterEqual() {
    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");
    }
}
Also used : ParameterTextRetriever(org.apache.synapse.commons.evaluators.source.ParameterTextRetriever) SourceTextRetriever(org.apache.synapse.commons.evaluators.source.SourceTextRetriever) EqualEvaluator(org.apache.synapse.commons.evaluators.EqualEvaluator)

Aggregations

ParameterTextRetriever (org.apache.synapse.commons.evaluators.source.ParameterTextRetriever)2 SourceTextRetriever (org.apache.synapse.commons.evaluators.source.SourceTextRetriever)2 EqualEvaluator (org.apache.synapse.commons.evaluators.EqualEvaluator)1 MatchEvaluator (org.apache.synapse.commons.evaluators.MatchEvaluator)1