Examples of SubstringEvaluator


Examples of org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator

    @Test
    public void testNonIndexedAttributes() throws Exception
    {
        SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "walk", null );
        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
        IndexEntry<String, String> indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 5L ) );
        assertTrue( evaluator.evaluate( indexEntry ) );
        indexEntry.setId( Strings.getUUID( 3L ) );
        indexEntry.setEntry( null );
        assertFalse( evaluator.evaluate( indexEntry ) );
        indexEntry.setId( Strings.getUUID( 6L ) );
        indexEntry.setEntry( null );
        assertFalse( evaluator.evaluate( indexEntry ) );

        node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "wa", null );
        evaluator = new SubstringEvaluator( node, store, schemaManager );
        indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 5L ) );
        indexEntry.setEntry( store.fetch( Strings.getUUID( 5L ) ) );
        assertTrue( evaluator.evaluate( indexEntry ) );

        node = new SubstringNode( schemaManager.getAttributeType( "searchGuide" ), "j", null );
        evaluator = new SubstringEvaluator( node, store, schemaManager );
        indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 6L ) );
        indexEntry.setEntry( store.fetch( Strings.getUUID( 6L ) ) );
        assertFalse( evaluator.evaluate( indexEntry ) );

        node = new SubstringNode( schemaManager.getAttributeType( "st" ), "j", null );
        evaluator = new SubstringEvaluator( node, store, schemaManager );
        indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 6L ) );
        indexEntry.setEntry( store.fetch( Strings.getUUID( 6L ) ) );
        assertFalse( evaluator.evaluate( indexEntry ) );

        node = new SubstringNode( schemaManager.getAttributeType( "name" ), "j", null );
        evaluator = new SubstringEvaluator( node, store, schemaManager );
        indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 6L ) );
        indexEntry.setEntry( store.fetch( Strings.getUUID( 6L ) ) );
        assertTrue( evaluator.evaluate( indexEntry ) );

        node = new SubstringNode( schemaManager.getAttributeType( "name" ), "s", null );
        evaluator = new SubstringEvaluator( node, store, schemaManager );
        indexEntry = new IndexEntry<String, String>();
        indexEntry.setId( Strings.getUUID( 6L ) );
        indexEntry.setEntry( store.fetch( Strings.getUUID( 6L ) ) );
        assertTrue( evaluator.evaluate( indexEntry ) );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.