use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithInNode.
@Test
public void parseWithInNode() {
AbstractNode testAST = new InNode(new PropertyValueNode(EventProperty.PAGE), Arrays.asList(new StringValueNode(TEST_VALUE_1), new StringValueNode(TEST_VALUE_2)));
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(String.format("event.page IN (:%s, :%s)", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER), result.getQuery());
assertEquals(TEST_VALUE_1, result.getQueryParameters().get(TEST_VALUE_1_IDENTIFIER));
assertEquals(TEST_VALUE_2, result.getQueryParameters().get(TEST_VALUE_2_IDENTIFIER));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithNotNode.
@Test
public void parseWithNotNode() {
AbstractNode testAST = new NotNode(new EqualsNode(new StringValueNode(TEST_VALUE_1), new StringValueNode(TEST_VALUE_2)));
assertEquals(String.format(" NOT (:%s = :%s)", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER), parser.parse(testAST).getQuery());
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithEqualsNode.
@Test
public void parseWithEqualsNode() {
AbstractNode testAST = new EqualsNode(new StringValueNode(TEST_VALUE_1), new StringValueNode(TEST_VALUE_2));
assertEquals(String.format(":%s = :%s", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER), parser.parse(testAST).getQuery());
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithOrderBy.
@Test
public void parseWithOrderBy() {
AbstractNode testAST = new OrderByNode(new EqualsNode(new PropertyValueNode(EventProperty.SPACE), new PropertyValueNode(EventProperty.PAGE)), new PropertyValueNode(EventProperty.DATE), OrderByNode.Order.ASC);
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals("event.space = event.page ORDER BY event.date ASC", result.getQuery());
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithStartsWithNode.
@Test
public void parseWithStartsWithNode() {
AbstractNode testAST = new StartsWith(new StringValueNode(TEST_VALUE_1), new StringValueNode(TEST_VALUE_2));
assertEquals(String.format(":%s LIKE concat(:%s, '%%') ESCAPE '!'", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER), parser.parse(testAST).getQuery());
}
Aggregations