use of org.apache.synapse.commons.evaluators.source.SourceTextRetriever 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");
}
}
use of org.apache.synapse.commons.evaluators.source.SourceTextRetriever 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");
}
}
use of org.apache.synapse.commons.evaluators.source.SourceTextRetriever 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");
}
}
use of org.apache.synapse.commons.evaluators.source.SourceTextRetriever in project wso2-synapse by wso2.
the class EqualBuilderTest method testURLEqual2.
public void testURLEqual2() {
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");
}
}
use of org.apache.synapse.commons.evaluators.source.SourceTextRetriever 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");
}
}
Aggregations