use of org.apache.synapse.commons.evaluators.Evaluator in project wso2-synapse by wso2.
the class ConditionFactory method createCondition.
public Condition createCondition(OMElement ruleElement) throws EvaluatorException {
Condition r = new Condition();
OMAttribute priorityAtt = ruleElement.getAttribute(new QName(EvaluatorConstants.PRIORITY));
if (priorityAtt != null) {
int p = Integer.parseInt(priorityAtt.getAttributeValue());
r.setPriority(p);
}
OMElement ce = ruleElement.getFirstElement();
EvaluatorFactory ef = EvaluatorFactoryFinder.getInstance().findEvaluatorFactory(ce.getLocalName());
if (ef == null) {
handleException("Invalid configuration element: " + ce.getLocalName());
return null;
}
Evaluator evaluator = ef.create(ce);
r.setEvaluator(evaluator);
return r;
}
use of org.apache.synapse.commons.evaluators.Evaluator in project wso2-synapse by wso2.
the class MatchSerializerTest method testURLMatchSerializer2.
public void testURLMatchSerializer2() {
String input = "<match xmlns=\"http://ws.apache.org/ns/synapse\" type=\"url\" regex=\"http://foo.org\" source=\"protocol\"/>";
try {
Evaluator eval = fac.create(AXIOMUtil.stringToOM(input));
OMElement output = serializer.serialize(null, eval);
assertXMLEqual(input, output.toString());
} catch (Exception e) {
fail("Error while parsing the input XML");
}
}
use of org.apache.synapse.commons.evaluators.Evaluator in project wso2-synapse by wso2.
the class EqualSerializerTest method testURLEqualSerializer2.
public void testURLEqualSerializer2() {
String input = "<equal xmlns=\"http://ws.apache.org/ns/synapse\" type=\"url\" value=\"http://foo.org\" source=\"protocol\"/>";
try {
Evaluator eval = fac.create(AXIOMUtil.stringToOM(input));
OMElement output = serializer.serialize(null, eval);
assertXMLEqual(input, output.toString());
} catch (Exception e) {
fail("Error while parsing the input XML");
}
}
use of org.apache.synapse.commons.evaluators.Evaluator in project wso2-synapse by wso2.
the class EqualSerializerTest method testHeaderEqualSerializer.
public void testHeaderEqualSerializer() {
String input = "<equal xmlns=\"http://ws.apache.org/ns/synapse\" type=\"header\" source=\"foo\" value=\"bar\"/>";
try {
Evaluator eval = fac.create(AXIOMUtil.stringToOM(input));
OMElement output = serializer.serialize(null, eval);
assertXMLEqual(input, output.toString());
} catch (Exception e) {
fail("Error while parsing the input XML");
}
}
use of org.apache.synapse.commons.evaluators.Evaluator in project wso2-synapse by wso2.
the class EqualSerializerTest method testParameterEqualSerializer.
public void testParameterEqualSerializer() {
String input = "<equal xmlns=\"http://ws.apache.org/ns/synapse\" type=\"param\" source=\"foo\" value=\"bar\"/>";
try {
Evaluator eval = fac.create(AXIOMUtil.stringToOM(input));
OMElement output = serializer.serialize(null, eval);
assertXMLEqual(input, output.toString());
} catch (Exception e) {
fail("Error while parsing the input XML");
}
}
Aggregations