Search in sources :

Example 36 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class RSQLFilterDialectTest method testIsnullOperatorBool.

@Test
public void testIsnullOperatorBool() throws Exception {
    MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>();
    queryParams.add("filter", "title=isnull=true");
    FilterExpression expression = dialect.parseGlobalExpression("/book", queryParams, NO_VERSION);
    assertEquals("book.title ISNULL []", expression.toString());
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) OrFilterExpression(com.yahoo.elide.core.filter.expression.OrFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 37 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class RSQLFilterDialectTest method testInOperator.

@Test
public void testInOperator() throws Exception {
    MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>();
    queryParams.add("filter", "title=in=Hemingway");
    FilterExpression expression = dialect.parseGlobalExpression("/book", queryParams, NO_VERSION);
    assertEquals("book.title IN [Hemingway]", expression.toString());
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) OrFilterExpression(com.yahoo.elide.core.filter.expression.OrFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 38 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class RSQLFilterDialectTest method testOutOperator.

@Test
public void testOutOperator() throws Exception {
    MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>();
    queryParams.add("filter", "title=out=Hemingway");
    FilterExpression expression = dialect.parseGlobalExpression("/book", queryParams, NO_VERSION);
    assertEquals("NOT (book.title IN [Hemingway])", expression.toString());
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) OrFilterExpression(com.yahoo.elide.core.filter.expression.OrFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 39 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class RSQLFilterDialectTest method testInInsensitiveOperator.

@Test
public void testInInsensitiveOperator() throws Exception {
    MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>();
    queryParams.add("filter", "title=ini=Hemingway");
    FilterExpression expression = dialect.parseGlobalExpression("/book", queryParams, NO_VERSION);
    assertEquals("book.title IN_INSENSITIVE [Hemingway]", expression.toString());
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) OrFilterExpression(com.yahoo.elide.core.filter.expression.OrFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 40 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class RSQLFilterDialectWithFIQLCompliantStrategyTest method testNotnullOperatorBool.

@Test
public void testNotnullOperatorBool() throws Exception {
    MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>();
    queryParams.add("filter", "title=isnull=false");
    FilterExpression expression = dialect.parseGlobalExpression("/book", queryParams, NO_VERSION);
    assertEquals("book.title NOTNULL []", expression.toString());
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Aggregations

FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)214 Test (org.junit.jupiter.api.Test)161 OrFilterExpression (com.yahoo.elide.core.filter.expression.OrFilterExpression)91 AndFilterExpression (com.yahoo.elide.core.filter.expression.AndFilterExpression)72 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)49 FilterPredicate (com.yahoo.elide.core.filter.predicates.FilterPredicate)46 Path (com.yahoo.elide.core.Path)44 Query (com.yahoo.elide.datastores.aggregation.query.Query)42 Argument (com.yahoo.elide.core.request.Argument)39 SQLUnitTest (com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest)39 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)34 SQLTable (com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable)34 HashMap (java.util.HashMap)29 Book (example.Book)28 NotFilterExpression (com.yahoo.elide.core.filter.expression.NotFilterExpression)24 EntityProjection (com.yahoo.elide.core.request.EntityProjection)22 Date (java.util.Date)21 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)20 Day (com.yahoo.elide.datastores.aggregation.timegrains.Day)19 HashSet (java.util.HashSet)18