use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.
the class SearchCondConverterTest method or.
@Test
public void or() {
String fiql = new UserFiqlSearchConditionBuilder().is("fullname").equalTo("*o*", "*i*", "*ini").query();
assertEquals("fullname==*o*,fullname==*i*,fullname==*ini", fiql);
fiql = new UserFiqlSearchConditionBuilder().is("fullname").equalTo("*o*").or("fullname").equalTo("*i*").or("fullname").equalTo("*ini").query();
assertEquals("fullname==*o*,fullname==*i*,fullname==*ini", fiql);
AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
fullnameLeafCond1.setSchema("fullname");
fullnameLeafCond1.setExpression("%o%");
AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
fullnameLeafCond2.setSchema("fullname");
fullnameLeafCond2.setExpression("%i%");
AttributeCond fullnameLeafCond3 = new AttributeCond(AttributeCond.Type.LIKE);
fullnameLeafCond3.setSchema("fullname");
fullnameLeafCond3.setExpression("%ini");
SearchCond orCond = SearchCond.getOrCond(SearchCond.getLeafCond(fullnameLeafCond1), SearchCond.getOrCond(SearchCond.getLeafCond(fullnameLeafCond2), SearchCond.getLeafCond(fullnameLeafCond3)));
assertEquals(orCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.
the class SearchCondConverterTest method nieq.
@Test
public void nieq() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").notEqualTolIgnoreCase("rossini").query();
assertEquals("username!~rossini", fiql);
AnyCond attrCond = new AnyCond(AttributeCond.Type.IEQ);
attrCond.setSchema("username");
attrCond.setExpression("rossini");
SearchCond simpleCond = SearchCond.getNotLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.
the class SearchCondConverterTest method nilike.
@Test
public void nilike() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").notEqualTolIgnoreCase("ros*").query();
assertEquals("username!~ros*", fiql);
AttributeCond attrCond = new AnyCond(AttributeCond.Type.ILIKE);
attrCond.setSchema("username");
attrCond.setExpression("ros%");
SearchCond simpleCond = SearchCond.getNotLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.
the class SearchCondConverterTest method groups.
@Test
public void groups() {
String fiql = new UserFiqlSearchConditionBuilder().inGroups("e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed").query();
assertEquals(SpecialAttr.GROUPS + "==e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed", fiql);
MembershipCond groupCond = new MembershipCond();
groupCond.setGroup("e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed");
SearchCond simpleCond = SearchCond.getLeafCond(groupCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.
the class SearchCondConverterTest method resources.
@Test
public void resources() {
String fiql = new UserFiqlSearchConditionBuilder().hasResources("resource-ldap").query();
assertEquals(SpecialAttr.RESOURCES + "==resource-ldap", fiql);
ResourceCond resCond = new ResourceCond();
resCond.setResourceKey("resource-ldap");
SearchCond simpleCond = SearchCond.getLeafCond(resCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Aggregations