Search in sources :

Example 1 with NotNode

use of org.xwiki.notifications.filters.expression.NotNode 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());
}
Also used : NotNode(org.xwiki.notifications.filters.expression.NotNode) AbstractNode(org.xwiki.notifications.filters.expression.generics.AbstractNode) StringValueNode(org.xwiki.notifications.filters.expression.StringValueNode) EqualsNode(org.xwiki.notifications.filters.expression.EqualsNode) NotEqualsNode(org.xwiki.notifications.filters.expression.NotEqualsNode) Test(org.junit.Test)

Example 2 with NotNode

use of org.xwiki.notifications.filters.expression.NotNode 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"));
}
Also used : NotNode(org.xwiki.notifications.filters.expression.NotNode) AbstractNode(org.xwiki.notifications.filters.expression.generics.AbstractNode) InListOfReadEventsNode(org.xwiki.notifications.filters.internal.status.InListOfReadEventsNode) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 NotNode (org.xwiki.notifications.filters.expression.NotNode)2 AbstractNode (org.xwiki.notifications.filters.expression.generics.AbstractNode)2 DocumentReference (org.xwiki.model.reference.DocumentReference)1 EqualsNode (org.xwiki.notifications.filters.expression.EqualsNode)1 NotEqualsNode (org.xwiki.notifications.filters.expression.NotEqualsNode)1 StringValueNode (org.xwiki.notifications.filters.expression.StringValueNode)1 InListOfReadEventsNode (org.xwiki.notifications.filters.internal.status.InListOfReadEventsNode)1