use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithLesserThanNode.
@Test
public void parseWithLesserThanNode() {
AbstractNode testAST = new LesserThanNode(new PropertyValueNode(EventProperty.DATE), new StringValueNode(TEST_VALUE_1));
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(String.format("event.date <= :%s", TEST_VALUE_1_IDENTIFIER), result.getQuery());
assertEquals(TEST_VALUE_1, result.getQueryParameters().get(TEST_VALUE_1_IDENTIFIER));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithGreaterThanNode.
@Test
public void parseWithGreaterThanNode() {
AbstractNode testAST = new GreaterThanNode(new PropertyValueNode(EventProperty.DATE), new StringValueNode(TEST_VALUE_1));
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(String.format("event.date >= :%s", TEST_VALUE_1_IDENTIFIER), result.getQuery());
assertEquals(TEST_VALUE_1, result.getQueryParameters().get(TEST_VALUE_1_IDENTIFIER));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseDateNode.
@Test
public void parseDateNode() {
Date date = new Date(0);
AbstractNode testAST = new DateValueNode(date);
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(":date_688218ea2b05763819a1e155109e4bf1e8921dd72e8b43d4c89c89133d4a5357", result.getQuery());
assertEquals(date, result.getQueryParameters().get("date_688218ea2b05763819a1e155109e4bf1e8921dd72e8b43d4c89c89133d4a5357"));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class TestExpressionToString method test.
@Test
public void test() throws Exception {
AbstractNode node = new AndNode(new OrNode(new EqualsNode(new PropertyValueNode(EventProperty.WIKI), new StringValueNode("value1")), new NotEqualsNode(new PropertyValueNode(EventProperty.SPACE), new StringValueNode("value2"))), new NotNode(new StartsWith(new PropertyValueNode(EventProperty.PAGE), new StringValueNode("value3%"))));
assertEquals("((WIKI = \"value1\" OR SPACE <> \"value2\") AND NOT (PAGE STARTS WITH \"value3%\"))", node.toString());
}
Aggregations