Search in sources :

Example 11 with SearchCond

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

the class SearchCondConverterTest method type.

@Test
public void type() {
    String fiql = new AnyObjectFiqlSearchConditionBuilder("PRINTER").query();
    assertEquals(SpecialAttr.TYPE + "==PRINTER", fiql);
    AnyTypeCond acond = new AnyTypeCond();
    acond.setAnyTypeKey("PRINTER");
    SearchCond simpleCond = SearchCond.getLeafCond(acond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
Also used : AnyTypeCond(org.apache.syncope.core.persistence.api.dao.search.AnyTypeCond) AnyObjectFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 12 with SearchCond

use of org.apache.syncope.core.persistence.api.dao.search.SearchCond 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)

Example 13 with SearchCond

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

the class SearchCondConverterTest method isNotNull.

@Test
public void isNotNull() {
    String fiql = new UserFiqlSearchConditionBuilder().is("loginDate").notNullValue().query();
    assertEquals("loginDate!=" + SpecialAttr.NULL, fiql);
    AttributeCond attrCond = new AttributeCond(AttributeCond.Type.ISNOTNULL);
    attrCond.setSchema("loginDate");
    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) Test(org.junit.jupiter.api.Test)

Example 14 with SearchCond

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

the class SearchCondConverterTest method relationshipTypes.

@Test
public void relationshipTypes() {
    String fiql = new UserFiqlSearchConditionBuilder().inRelationshipTypes("type1").query();
    assertEquals(SpecialAttr.RELATIONSHIP_TYPES + "==type1", fiql);
    RelationshipTypeCond relationshipCond = new RelationshipTypeCond();
    relationshipCond.setRelationshipTypeKey("type1");
    SearchCond simpleCond = SearchCond.getLeafCond(relationshipCond);
    assertEquals(simpleCond, SearchCondConverter.convert(fiql));
    fiql = new AnyObjectFiqlSearchConditionBuilder("PRINTER").inRelationshipTypes("neighborhood").query();
    assertEquals(SpecialAttr.RELATIONSHIP_TYPES + "==neighborhood;" + SpecialAttr.TYPE + "==PRINTER", fiql);
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) RelationshipTypeCond(org.apache.syncope.core.persistence.api.dao.search.RelationshipTypeCond) AnyObjectFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) Test(org.junit.jupiter.api.Test)

Example 15 with SearchCond

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

the class SearchCondConverterTest method isNull.

@Test
public void isNull() {
    String fiql = new UserFiqlSearchConditionBuilder().is("loginDate").nullValue().query();
    assertEquals("loginDate==" + SpecialAttr.NULL, fiql);
    AttributeCond attrCond = new AttributeCond(AttributeCond.Type.ISNULL);
    attrCond.setSchema("loginDate");
    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) 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