use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondConverterTest method ieq.
@Test
public void ieq() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").equalToIgnoreCase("rossini").query();
assertEquals("username=~rossini", fiql);
AnyCond attrCond = new AnyCond(AttributeCond.Type.IEQ);
attrCond.setSchema("username");
attrCond.setExpression("rossini");
SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondConverterTest method eq.
@Test
public void eq() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").equalTo("rossini").query();
assertEquals("username==rossini", fiql);
AnyCond attrCond = new AnyCond(AttributeCond.Type.EQ);
attrCond.setSchema("username");
attrCond.setExpression("rossini");
SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondConverterTest method like.
@Test
public void like() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").equalTo("ros*").query();
assertEquals("username==ros*", fiql);
AttributeCond attrCond = new AnyCond(AttributeCond.Type.LIKE);
attrCond.setSchema("username");
attrCond.setExpression("ros%");
SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondVisitor method createAttributeCond.
private AttributeCond createAttributeCond(final String schema) {
AttributeCond attributeCond = SearchableFields.contains(schema) ? new AnyCond() : new AttributeCond();
attributeCond.setSchema(schema);
return attributeCond;
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class AnySearchTest method searchByKey.
@Test
public void searchByKey() {
AnyCond idLeafCond = new AnyCond(AnyCond.Type.EQ);
idLeafCond.setSchema("id");
idLeafCond.setExpression("74cd8ece-715a-44a4-a736-e17b46c4e7e6");
SearchCond searchCondition = SearchCond.getLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
List<User> users = searchDAO.search(searchCondition, AnyTypeKind.USER);
assertNotNull(users);
assertEquals(1, users.size());
assertEquals("74cd8ece-715a-44a4-a736-e17b46c4e7e6", users.iterator().next().getKey());
}
Aggregations