use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithNotEqualsNode.
@Test
public void parseWithNotEqualsNode() {
AbstractNode testAST = new NotEqualsNode(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 parseEntityReferenceNode.
@Test
public void parseEntityReferenceNode() {
DocumentReference documentReference = new DocumentReference("xwiki", "Main", "WebHome");
when(serializer.serialize(documentReference)).thenReturn("xwiki:Main.WebHome");
AbstractNode testAST = new EntityReferenceNode(documentReference);
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(":entity_e9f8294b0de086574bed923c45695bc8afc27d3ede9c35ed44db8d2100929de4", result.getQuery());
assertEquals("xwiki:Main.WebHome", result.getQueryParameters().get("entity_e9f8294b0de086574bed923c45695bc8afc27d3ede9c35ed44db8d2100929de4"));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithAndNode.
@Test
public void parseWithAndNode() {
AbstractNode testAST = value(TEST_VALUE_1).eq(value(TEST_VALUE_2)).and(value(TEST_VALUE_1).eq(value(TEST_VALUE_2)));
assertEquals(String.format("(:%s = :%s) AND (:%s = :%s)", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER, 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 parseWithInListOfReadEventsNode.
@Test
public void parseWithInListOfReadEventsNode() {
DocumentReference user = new DocumentReference("xwiki", "XWiki", "userA");
when(serializer.serialize(user)).thenReturn("xwiki:XWiki.UserA");
AbstractNode testAST = new NotNode(new InListOfReadEventsNode(user));
ExpressionNodeToHQLConverter.HQLQuery result = parser.parse(testAST);
assertEquals(" NOT (" + "event IN (select status.activityEvent from ActivityEventStatusImpl status " + "where status.activityEvent = event and status.entityId = :userStatusRead " + "and status.read = true))", result.getQuery());
assertEquals("xwiki:XWiki.UserA", result.getQueryParameters().get("userStatusRead"));
}
use of org.xwiki.notifications.filters.expression.generics.AbstractNode in project xwiki-platform by xwiki.
the class ExpressionNodeToHQLConverterTest method parseWithOrNode.
@Test
public void parseWithOrNode() {
AbstractNode testAST = value(TEST_VALUE_1).eq(value(TEST_VALUE_2)).or(value(TEST_VALUE_1).eq(value(TEST_VALUE_2)));
assertEquals(String.format("(:%s = :%s) OR (:%s = :%s)", TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER, TEST_VALUE_1_IDENTIFIER, TEST_VALUE_2_IDENTIFIER), parser.parse(testAST).getQuery());
}
Aggregations