Search in sources :

Example 6 with AnyCond

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

use of org.apache.syncope.core.persistence.api.dao.search.AnyCond 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 8 with AnyCond

use of org.apache.syncope.core.persistence.api.dao.search.AnyCond 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 9 with AnyCond

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

the class SearchCondVisitor method createAttributeCond.

private AttributeCond createAttributeCond(final String schema) {
    AttributeCond attributeCond = SearchableFields.contains(schema) ? new AnyCond() : new AttributeCond();
    attributeCond.setSchema(schema);
    return attributeCond;
}
Also used : AttributeCond(org.apache.syncope.core.persistence.api.dao.search.AttributeCond) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond)

Example 10 with AnyCond

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

the class AnySearchTest method searchByKey.

@Test
public void searchByKey() {
    AnyCond idLeafCond = new AnyCond(AnyCond.Type.EQ);
    idLeafCond.setSchema("id");
    idLeafCond.setExpression("74cd8ece-715a-44a4-a736-e17b46c4e7e6");
    SearchCond searchCondition = SearchCond.getLeafCond(idLeafCond);
    assertTrue(searchCondition.isValid());
    List<User> users = searchDAO.search(searchCondition, AnyTypeKind.USER);
    assertNotNull(users);
    assertEquals(1, users.size());
    assertEquals("74cd8ece-715a-44a4-a736-e17b46c4e7e6", users.iterator().next().getKey());
}
Also used : User(org.apache.syncope.core.persistence.api.entity.user.User) 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) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

AnyCond (org.apache.syncope.core.persistence.api.dao.search.AnyCond)25 SearchCond (org.apache.syncope.core.persistence.api.dao.search.SearchCond)20 Test (org.junit.jupiter.api.Test)16 AttributeCond (org.apache.syncope.core.persistence.api.dao.search.AttributeCond)11 AbstractTest (org.apache.syncope.core.persistence.jpa.AbstractTest)10 UserFiqlSearchConditionBuilder (org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder)6 User (org.apache.syncope.core.persistence.api.entity.user.User)6 OrderByClause (org.apache.syncope.core.persistence.api.dao.search.OrderByClause)3 Group (org.apache.syncope.core.persistence.api.entity.group.Group)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)2 RealmTO (org.apache.syncope.common.lib.to.RealmTO)2 Realm (org.apache.syncope.core.persistence.api.entity.Realm)2 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)2 Annotation (java.lang.annotation.Annotation)1 ManagementFactory (java.lang.management.ManagementFactory)1 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)1