Search in sources :

Example 1 with HeaderTextRetriever

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

the class MatchBuilderTest method testHeaderMatch.

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

Example 2 with HeaderTextRetriever

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

the class EqualBuilderTest method testHeaderEqual.

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

Aggregations

HeaderTextRetriever (org.apache.synapse.commons.evaluators.source.HeaderTextRetriever)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