Search in sources :

Example 61 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond 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));
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) ResourceCond(org.apache.syncope.core.persistence.api.dao.search.ResourceCond) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 62 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond in project syncope by apache.

the class SearchCondConverterTest method and.

@Test
public void and() {
    String fiql = new UserFiqlSearchConditionBuilder().is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query();
    assertEquals("fullname==*o*;fullname==*i*", 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%");
    SearchCond andCond = SearchCond.getAndCond(SearchCond.getLeafCond(fullnameLeafCond1), SearchCond.getLeafCond(fullnameLeafCond2));
    assertEquals(andCond, SearchCondConverter.convert(fiql));
}
Also used : AttributeCond(org.apache.syncope.core.persistence.api.dao.search.AttributeCond) UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 63 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond in project syncope by apache.

the class SearchCondConverterTest method privileges.

@Test
public void privileges() {
    String fiql = new UserFiqlSearchConditionBuilder().withPrivileges("postMighty").query();
    assertEquals(SpecialAttr.PRIVILEGES + "==postMighty", fiql);
    PrivilegeCond privilegeCond = new PrivilegeCond();
    privilegeCond.setPrivilege("postMighty");
    SearchCond simpleCond = SearchCond.getLeafCond(privilegeCond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) PrivilegeCond(org.apache.syncope.core.persistence.api.dao.search.PrivilegeCond) Test(org.junit.jupiter.api.Test)

Example 64 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond in project syncope by apache.

the class SearchCondConverterTest method dynRealms.

@Test
public void dynRealms() {
    String dynRealm = UUID.randomUUID().toString();
    String fiql = new UserFiqlSearchConditionBuilder().inDynRealms(dynRealm).query();
    assertEquals(SpecialAttr.DYNREALMS + "==" + dynRealm, fiql);
    DynRealmCond dynRealmCond = new DynRealmCond();
    dynRealmCond.setDynRealm(dynRealm);
    SearchCond simpleCond = SearchCond.getLeafCond(dynRealmCond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) DynRealmCond(org.apache.syncope.core.persistence.api.dao.search.DynRealmCond) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 65 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond in project syncope by apache.

the class SearchCondConverterTest method member.

@Test
public void member() {
    String fiql = new GroupFiqlSearchConditionBuilder().withMembers("rossini").query();
    assertEquals(SpecialAttr.MEMBER + "==rossini", fiql);
    MemberCond mcond = new MemberCond();
    mcond.setMember("rossini");
    SearchCond simpleCond = SearchCond.getLeafCond(mcond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Also used : GroupFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder) MemberCond(org.apache.syncope.core.persistence.api.dao.search.MemberCond) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Aggregations

SearchCond (org.apache.syncope.core.persistence.api.dao.search.SearchCond)74 Test (org.junit.jupiter.api.Test)55 AttributeCond (org.apache.syncope.core.persistence.api.dao.search.AttributeCond)30 AnyCond (org.apache.syncope.core.persistence.api.dao.search.AnyCond)26 AbstractTest (org.apache.syncope.core.persistence.jpa.AbstractTest)25 User (org.apache.syncope.core.persistence.api.entity.user.User)20 UserFiqlSearchConditionBuilder (org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder)17 MembershipCond (org.apache.syncope.core.persistence.api.dao.search.MembershipCond)12 OrderByClause (org.apache.syncope.core.persistence.api.dao.search.OrderByClause)11 ArrayList (java.util.ArrayList)10 Group (org.apache.syncope.core.persistence.api.entity.group.Group)10 List (java.util.List)8 AnyTypeCond (org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond)8 AssignableCond (org.apache.syncope.core.persistence.api.dao.search.AssignableCond)7 MemberCond (org.apache.syncope.core.persistence.api.dao.search.MemberCond)7 Collections (java.util.Collections)6 Collectors (java.util.stream.Collectors)6 SyncopeConstants (org.apache.syncope.common.lib.SyncopeConstants)6 RelationshipCond (org.apache.syncope.core.persistence.api.dao.search.RelationshipCond)6 ResourceCond (org.apache.syncope.core.persistence.api.dao.search.ResourceCond)6