Package org.apache.directory.server.xdbm.search.cursor

Examples of org.apache.directory.server.xdbm.search.cursor.NotCursor


        ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
        Evaluator<? extends ExprNode> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
            schemaManager );
        notNode.addNode( exprNode );

        NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
        cursor.beforeFirst();

        Set<String> set = new HashSet<String>();

        while ( cursor.next() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.next() );
        assertFalse( cursor.available() );

        cursor.afterLast();

        set.clear();

        while ( cursor.previous() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.previous() );
        assertFalse( cursor.available() );

        try
        {
            cursor.get();
            fail( "should fail with InvalidCursorPositionException" );
        }
        catch ( InvalidCursorPositionException ice )
        {
        }

        try
        {
            cursor.after( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        try
        {
            cursor.before( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        cursor.close();
    }
View Full Code Here


        ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
        Evaluator<? extends ExprNode> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
            schemaManager );
        notNode.addNode( exprNode );

        NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
        cursor.beforeFirst();

        Set<String> set = new HashSet<String>();

        while ( cursor.next() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.next() );
        assertFalse( cursor.available() );

        cursor.afterLast();

        set.clear();

        while ( cursor.previous() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.previous() );
        assertFalse( cursor.available() );

        try
        {
            cursor.get();
            fail( "should fail with InvalidCursorPositionException" );
        }
        catch ( InvalidCursorPositionException ice )
        {
        }

        try
        {
            cursor.after( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        try
        {
            cursor.before( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        cursor.close();
    }
View Full Code Here

        ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
        Evaluator<? extends ExprNode> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
            schemaManager );
        notNode.addNode( exprNode );

        NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
        cursor.beforeFirst();

        Set<String> set = new HashSet<String>();

        while ( cursor.next() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.next() );
        assertFalse( cursor.available() );

        cursor.afterLast();

        set.clear();

        while ( cursor.previous() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.previous() );
        assertFalse( cursor.available() );

        try
        {
            cursor.get();
            fail( "should fail with InvalidCursorPositionException" );
        }
        catch ( InvalidCursorPositionException ice )
        {
        }

        try
        {
            cursor.after( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        try
        {
            cursor.before( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        cursor.close();
    }
View Full Code Here

        ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
        Evaluator<? extends ExprNode> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
            schemaManager );
        notNode.addNode( exprNode );

        NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
        cursor.beforeFirst();

        Set<String> set = new HashSet<String>();

        while ( cursor.next() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.next() );
        assertFalse( cursor.available() );

        cursor.afterLast();

        set.clear();

        while ( cursor.previous() )
        {
            assertTrue( cursor.available() );
            set.add( cursor.get().getId() );
            assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
        }

        assertEquals( 5, set.size() );
        assertTrue( set.contains( Strings.getUUID( 1L ) ) );
        assertTrue( set.contains( Strings.getUUID( 2L ) ) );
        assertTrue( set.contains( Strings.getUUID( 3L ) ) );
        assertTrue( set.contains( Strings.getUUID( 4L ) ) );
        assertTrue( set.contains( Strings.getUUID( 7L ) ) );

        assertFalse( cursor.previous() );
        assertFalse( cursor.available() );

        try
        {
            cursor.get();
            fail( "should fail with InvalidCursorPositionException" );
        }
        catch ( InvalidCursorPositionException ice )
        {
        }

        try
        {
            cursor.after( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        try
        {
            cursor.before( new IndexEntry<String, String>() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        cursor.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.xdbm.search.cursor.NotCursor

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.