Package org.apache.syncope.common.search

Examples of org.apache.syncope.common.search.AttributableCond


        assertEquals(1L, matchingUsers.iterator().next().getId().longValue());
    }

    @Test
    public void searchByRolenameAndId() {
        final AttributableCond rolenameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
        rolenameLeafCond.setSchema("name");
        rolenameLeafCond.setExpression("root");

        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
        idRightCond.setSchema("id");
        idRightCond.setExpression("2");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(rolenameLeafCond),
                NodeCond.getLeafCond(idRightCond));

        assertTrue(searchCondition.isValid());
View Full Code Here


        assertEquals(1L, matchingRoles.iterator().next().getId().longValue());
    }

    @Test
    public void searchByUsernameAndFullname() {
        final AttributableCond usernameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
        usernameLeafCond.setSchema("username");
        usernameLeafCond.setExpression("rossini");

        final AttributeCond idRightCond = new AttributeCond(AttributeCond.Type.LIKE);
        idRightCond.setSchema("fullname");
        idRightCond.setExpression("Giuseppe V%");
View Full Code Here

        assertEquals(2, matchingUsers.size());
    }

    @Test
    public void searchById() {
        AttributableCond idLeafCond = new AttributableCond(AttributableCond.Type.LT);
        idLeafCond.setSchema("id");
        idLeafCond.setExpression("2");

        NodeCond searchCondition = NodeCond.getLeafCond(idLeafCond);
        assertTrue(searchCondition.isValid());

        List<SyncopeUser> users =
                searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
                        AttributableUtil.getInstance(AttributableType.USER));

        assertNotNull(users);
        assertEquals(1, users.size());
        assertEquals(1L, users.iterator().next().getId().longValue());

        idLeafCond = new AttributableCond(AttributableCond.Type.LT);
        idLeafCond.setSchema("id");
        idLeafCond.setExpression("4");

        searchCondition = NodeCond.getNotLeafCond(idLeafCond);
        assertTrue(searchCondition.isValid());

        users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
View Full Code Here

        assertTrue(found);
    }

    @Test
    public void issue242() {
        final AttributableCond cond = new AttributableCond(AttributeCond.Type.LIKE);
        cond.setSchema("id");
        cond.setExpression("test%");

        final NodeCond searchCondition = NodeCond.getLeafCond(cond);
        assertTrue(searchCondition.isValid());

        final List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
View Full Code Here

        assertTrue(users.isEmpty());
    }

    @Test
    public void issueSYNCOPE46() {
        AttributableCond cond = new AttributableCond(AttributeCond.Type.LIKE);
        cond.setSchema("username");
        cond.setExpression("%ossin%");

        NodeCond searchCondition = NodeCond.getLeafCond(cond);
        assertTrue(searchCondition.isValid());

        List<SyncopeUser> users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
View Full Code Here

    @Test
    public void issueSYNCOPE433() {
        AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
        isNullCond.setSchema("loginDate");

        AttributableCond likeCond = new AttributableCond(AttributeCond.Type.LIKE);
        likeCond.setSchema("username");
        likeCond.setExpression("%ossin%");

        NodeCond searchCond = NodeCond.getOrCond(NodeCond.getLeafCond(isNullCond), NodeCond.getLeafCond(likeCond));

        Integer count = searchDAO.count(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCond,
                AttributableUtil.getInstance(AttributableType.USER));
View Full Code Here

        assertEquals(1, users.size());
    }

    @Test
    public void searchByUsernameAndId() {
        final AttributableCond usernameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
        usernameLeafCond.setSchema("username");
        usernameLeafCond.setExpression("rossini");

        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
        idRightCond.setSchema("id");
        idRightCond.setExpression("2");

        final NodeCond searchCondition = NodeCond.getOrCond(NodeCond.getLeafCond(usernameLeafCond),
                NodeCond.getLeafCond(idRightCond));

        final List<SyncopeUser> matchingUsers = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
View Full Code Here

        assertEquals(1L, matchingUsers.iterator().next().getId().longValue());
    }

    @Test
    public void searchByRolenameAndId() {
        final AttributableCond rolenameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
        rolenameLeafCond.setSchema("name");
        rolenameLeafCond.setExpression("root");

        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
        idRightCond.setSchema("id");
        idRightCond.setExpression("2");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(rolenameLeafCond),
                NodeCond.getLeafCond(idRightCond));

        assertTrue(searchCondition.isValid());
View Full Code Here

        assertEquals(1L, matchingRoles.iterator().next().getId().longValue());
    }

    @Test
    public void searchByUsernameAndFullname() {
        final AttributableCond usernameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
        usernameLeafCond.setSchema("username");
        usernameLeafCond.setExpression("rossini");

        final AttributeCond idRightCond = new AttributeCond(AttributeCond.Type.LIKE);
        idRightCond.setSchema("fullname");
        idRightCond.setExpression("Giuseppe V%");
View Full Code Here

        assertEquals(2, matchingUsers.size());
    }

    @Test
    public void searchById() {
        AttributableCond idLeafCond = new AttributableCond(AttributableCond.Type.LT);
        idLeafCond.setSchema("id");
        idLeafCond.setExpression("2");

        NodeCond searchCondition = NodeCond.getLeafCond(idLeafCond);
        assertTrue(searchCondition.isValid());

        List<SyncopeUser> users =
                searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
                AttributableUtil.getInstance(AttributableType.USER));

        assertNotNull(users);
        assertEquals(1, users.size());
        assertEquals(1L, users.iterator().next().getId().longValue());

        idLeafCond = new AttributableCond(AttributableCond.Type.LT);
        idLeafCond.setSchema("id");
        idLeafCond.setExpression("4");

        searchCondition = NodeCond.getNotLeafCond(idLeafCond);
        assertTrue(searchCondition.isValid());

        users = searchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition,
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.search.AttributableCond

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.