Search in sources :

Example 16 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder 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 17 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder 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 18 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder 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 19 with UserFiqlSearchConditionBuilder

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

Aggregations

UserFiqlSearchConditionBuilder (org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder)19 Test (org.junit.jupiter.api.Test)18 SearchCond (org.apache.syncope.core.persistence.api.dao.search.SearchCond)17 AttributeCond (org.apache.syncope.core.persistence.api.dao.search.AttributeCond)8 AnyCond (org.apache.syncope.core.persistence.api.dao.search.AnyCond)6 AnyObjectFiqlSearchConditionBuilder (org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder)2 CompleteCondition (org.apache.cxf.jaxrs.ext.search.client.CompleteCondition)1 SyncopeProperty (org.apache.syncope.common.lib.search.SyncopeProperty)1 DynRealmCond (org.apache.syncope.core.persistence.api.dao.search.DynRealmCond)1 MembershipCond (org.apache.syncope.core.persistence.api.dao.search.MembershipCond)1 PrivilegeCond (org.apache.syncope.core.persistence.api.dao.search.PrivilegeCond)1 RelationshipCond (org.apache.syncope.core.persistence.api.dao.search.RelationshipCond)1 RelationshipTypeCond (org.apache.syncope.core.persistence.api.dao.search.RelationshipTypeCond)1 ResourceCond (org.apache.syncope.core.persistence.api.dao.search.ResourceCond)1 RoleCond (org.apache.syncope.core.persistence.api.dao.search.RoleCond)1