use of io.jans.orm.search.filter.Filter in project jans by JanssenProject.
the class CouchbaseFilterConverterTest method checkMultivaluedLowerFilters.
@Test
public void checkMultivaluedLowerFilters() throws SearchException {
Filter userUidFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter("uid"), "test").multiValued();
ConvertedExpression expressionUserUid = simpleConverter.convertToCouchbaseFilter(userUidFilter, null, null);
String queryUserUid = toSelectSQL(expressionUserUid);
assertEquals(queryUserUid, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY uid_ IN uid SATISFIES LOWER(uid_) = \"test\" END");
}
use of io.jans.orm.search.filter.Filter in project jans by JanssenProject.
the class CouchbaseFilterConverterTest method checkMultivaluedLeFilters.
@Test
public void checkMultivaluedLeFilters() throws SearchException {
// LE -- String
Filter filterLe1 = Filter.createLessOrEqualFilter("uid", "test").multiValued();
ConvertedExpression expressionLe1 = simpleConverter.convertToCouchbaseFilter(filterLe1, null, null);
String queryLe1 = toSelectSQL(expressionLe1);
assertEquals(queryLe1, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY uid_ IN uid SATISFIES uid_ <= \"test\" END");
// LE -- Integer
Filter filterLe2 = Filter.createLessOrEqualFilter("age", 23).multiValued();
ConvertedExpression expressionLe2 = simpleConverter.convertToCouchbaseFilter(filterLe2, null, null);
String queryLe2 = toSelectSQL(expressionLe2);
assertEquals(queryLe2, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY age_ IN age SATISFIES age_ <= 23 END");
// LE -- Long
Filter filterLe3 = Filter.createLessOrEqualFilter("age", 23L).multiValued();
ConvertedExpression expressionLe3 = simpleConverter.convertToCouchbaseFilter(filterLe3, null, null);
String queryLe3 = toSelectSQL(expressionLe3);
assertEquals(queryLe3, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY age_ IN age SATISFIES age_ <= 23 END");
// LE -- Date
Filter filterLe4 = Filter.createLessOrEqualFilter("added", getUtcDateFromMillis(1608130698398L)).multiValued();
ConvertedExpression expressionLe4 = simpleConverter.convertToCouchbaseFilter(filterLe4, null, null);
String queryLe4 = toSelectSQL(expressionLe4);
assertEquals(queryLe4, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY added_ IN added SATISFIES added_ <= \"Wed Dec 16 14:58:18 UTC 2020\" END");
// LE -- Date
Filter filterLe5 = Filter.createLessOrEqualFilter("added", getUtcDateFromMillis(1608130698398L)).multiValued(3);
ConvertedExpression expressionLe5 = simpleConverter.convertToCouchbaseFilter(filterLe5, null, null);
String queryLe5 = toSelectSQL(expressionLe5);
assertEquals(queryLe5, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ANY added_ IN added SATISFIES added_ <= \"Wed Dec 16 14:58:18 UTC 2020\" END");
}
use of io.jans.orm.search.filter.Filter in project jans by JanssenProject.
the class CouchbaseFilterConverterTest method checkOrFilters.
@Test
public void checkOrFilters() throws SearchException {
Filter filterEq1 = Filter.createEqualityFilter("uid", "test");
Filter filterPresence1 = Filter.createPresenceFilter("mail");
Filter filterLe1 = Filter.createLessOrEqualFilter("age", 23);
Filter filterOr1 = Filter.createORFilter(filterPresence1, filterEq1, filterLe1);
ConvertedExpression expressionAnd1 = simpleConverter.convertToCouchbaseFilter(filterOr1, null, null);
String queryAnd1 = toSelectSQL(expressionAnd1);
assertEquals(queryAnd1, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ( mail IS NOT MISSING OR ( ( uid = \"test\" ) OR ( \"test\" IN uid ) ) OR age <= 23 )");
}
use of io.jans.orm.search.filter.Filter in project jans by JanssenProject.
the class CouchbaseFilterConverterTest method checkLeFilters.
@Test
public void checkLeFilters() throws SearchException {
// LE -- String
Filter filterLe1 = Filter.createLessOrEqualFilter("uid", "test");
ConvertedExpression expressionLe1 = simpleConverter.convertToCouchbaseFilter(filterLe1, null, null);
String queryLe1 = toSelectSQL(expressionLe1);
assertEquals(queryLe1, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE uid <= \"test\"");
// LE -- Integer
Filter filterLe2 = Filter.createLessOrEqualFilter("age", 23);
ConvertedExpression expressionLe2 = simpleConverter.convertToCouchbaseFilter(filterLe2, null, null);
String queryLe2 = toSelectSQL(expressionLe2);
assertEquals(queryLe2, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE age <= 23");
// LE -- Long
Filter filterLe3 = Filter.createLessOrEqualFilter("age", 23L);
ConvertedExpression expressionLe3 = simpleConverter.convertToCouchbaseFilter(filterLe3, null, null);
String queryLe3 = toSelectSQL(expressionLe3);
assertEquals(queryLe3, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE age <= 23");
// LE -- Date
Filter filterLe4 = Filter.createLessOrEqualFilter("added", getUtcDateFromMillis(1608130698398L));
ConvertedExpression expressionLe4 = simpleConverter.convertToCouchbaseFilter(filterLe4, null, null);
String queryLe4 = toSelectSQL(expressionLe4);
assertEquals(queryLe4, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE added <= \"Wed Dec 16 14:58:18 UTC 2020\"");
}
use of io.jans.orm.search.filter.Filter in project jans by JanssenProject.
the class CouchbaseFilterConverterTest method checkAndFilters.
@Test
public void checkAndFilters() throws SearchException {
Filter filterEq1 = Filter.createEqualityFilter("uid", "test");
Filter filterPresence1 = Filter.createPresenceFilter("mail");
Filter filterLe1 = Filter.createLessOrEqualFilter("age", 23);
Filter filterAnd1 = Filter.createANDFilter(filterPresence1, filterEq1, filterLe1);
ConvertedExpression expressionAnd1 = simpleConverter.convertToCouchbaseFilter(filterAnd1, null, null);
String queryAnd1 = toSelectSQL(expressionAnd1);
assertEquals(queryAnd1, "SELECT jans_doc.* FROM `jans` AS jans_doc WHERE ( mail IS NOT MISSING AND ( ( uid = \"test\" ) OR ( \"test\" IN uid ) ) AND age <= 23 )");
}
Aggregations