Search in sources :

Example 1 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.

the class SearchCondConverterTest method ilike.

@Test
public void ilike() {
    String fiql = new UserFiqlSearchConditionBuilder().is("username").equalToIgnoreCase("ros*").query();
    assertEquals("username=~ros*", fiql);
    AttributeCond attrCond = new AnyCond(AttributeCond.Type.ILIKE);
    attrCond.setSchema("username");
    attrCond.setExpression("ros%");
    SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
    assertEquals(simpleCond, 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) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) Test(org.junit.jupiter.api.Test)

Example 2 with UserFiqlSearchConditionBuilder

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

Example 3 with UserFiqlSearchConditionBuilder

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

Example 4 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder in project syncope by apache.

the class SearchCondConverterTest method relationships.

@Test
public void relationships() {
    String fiql = new UserFiqlSearchConditionBuilder().inRelationships("ca20ffca-1305-442f-be9a-3723a0cd88ca").query();
    assertEquals(SpecialAttr.RELATIONSHIPS + "==ca20ffca-1305-442f-be9a-3723a0cd88ca", fiql);
    RelationshipCond relationshipCond = new RelationshipCond();
    relationshipCond.setAnyObject("ca20ffca-1305-442f-be9a-3723a0cd88ca");
    SearchCond simpleCond = SearchCond.getLeafCond(relationshipCond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) RelationshipCond(org.apache.syncope.core.persistence.api.dao.search.RelationshipCond) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 5 with UserFiqlSearchConditionBuilder

use of org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder 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));
}
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) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) 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