use of org.apache.syncope.core.persistence.api.dao.search.AttributeCond in project syncope by apache.
the class SearchCondConverterTest method issueSYNCOPE1223.
@Test
public void issueSYNCOPE1223() {
String fiql = new UserFiqlSearchConditionBuilder().is("ctype").equalTo("ou=sample%252Co=isp").query();
AttributeCond cond = new AttributeCond(AttributeCond.Type.EQ);
cond.setSchema("ctype");
cond.setExpression("ou=sample,o=isp");
assertEquals(SearchCond.getLeafCond(cond), SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AttributeCond in project syncope by apache.
the class AnySearchTest method groupMatch.
@Test
public void groupMatch() {
Group group = groupDAO.find("37d15e4c-cdc1-460b-a591-8505c8133806");
assertNotNull(group);
AttributeCond attrCond = new AttributeCond();
attrCond.setSchema("show");
attrCond.setType(AttributeCond.Type.ISNOTNULL);
assertTrue(searchDAO.matches(group, SearchCond.getLeafCond(attrCond)));
}
use of org.apache.syncope.core.persistence.api.dao.search.AttributeCond in project syncope by apache.
the class AnySearchTest method issueSYNCOPE929.
@Test
public void issueSYNCOPE929() {
AttributeCond rossiniCond = new AttributeCond(AttributeCond.Type.EQ);
rossiniCond.setSchema("surname");
rossiniCond.setExpression("Rossini");
AttributeCond genderCond = new AttributeCond(AttributeCond.Type.EQ);
genderCond.setSchema("gender");
genderCond.setExpression("M");
SearchCond orCond = SearchCond.getOrCond(SearchCond.getLeafCond(rossiniCond), SearchCond.getLeafCond(genderCond));
AttributeCond belliniCond = new AttributeCond(AttributeCond.Type.EQ);
belliniCond.setSchema("surname");
belliniCond.setExpression("Bellini");
SearchCond searchCond = SearchCond.getAndCond(orCond, SearchCond.getLeafCond(belliniCond));
List<User> users = searchDAO.search(searchCond, AnyTypeKind.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
use of org.apache.syncope.core.persistence.api.dao.search.AttributeCond in project syncope by apache.
the class AnySearchTest method searchByUsernameAndFullname.
@Test
public void searchByUsernameAndFullname() {
AnyCond usernameLeafCond = new AnyCond(AnyCond.Type.EQ);
usernameLeafCond.setSchema("username");
usernameLeafCond.setExpression("rossini");
AttributeCond idRightCond = new AttributeCond(AttributeCond.Type.LIKE);
idRightCond.setSchema("fullname");
idRightCond.setExpression("Giuseppe V%");
SearchCond searchCondition = SearchCond.getOrCond(SearchCond.getLeafCond(usernameLeafCond), SearchCond.getLeafCond(idRightCond));
List<User> matchingUsers = searchDAO.search(searchCondition, AnyTypeKind.USER);
assertNotNull(matchingUsers);
assertEquals(2, matchingUsers.size());
}
use of org.apache.syncope.core.persistence.api.dao.search.AttributeCond in project syncope by apache.
the class AnySearchTest method issueSYNCOPE433.
@Test
public void issueSYNCOPE433() {
AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
isNullCond.setSchema("loginDate");
AnyCond likeCond = new AnyCond(AttributeCond.Type.LIKE);
likeCond.setSchema("username");
likeCond.setExpression("%ossin%");
SearchCond searchCond = SearchCond.getOrCond(SearchCond.getLeafCond(isNullCond), SearchCond.getLeafCond(likeCond));
Integer count = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCond, AnyTypeKind.USER);
assertNotNull(count);
assertTrue(count > 0);
}
Aggregations