Package org.apache.directory.mavibot.btree.serializer

Examples of org.apache.directory.mavibot.btree.serializer.StringSerializer


    /**
     * Creates a 2 level depth tree of full pages
     */
    private BTree<Integer, String> createTwoLevelBTreeFullLeaves() throws IOException
    {
        BTree<Integer, String> btree = new BTree<Integer, String>( "test", new IntSerializer(), new StringSerializer() );
        btree.setPageSize( 4 );

        // Create a tree with 5 children containing 4 elements each. The tree is full.
        int[] keys = new int[]
            { 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 19, 20 };
View Full Code Here


    /**
     * Creates a 2 level depth tree of half full pages
     */
    private BTree<Integer, String> createTwoLevelBTreeHalfFullLeaves() throws IOException
    {
        BTree<Integer, String> btree = new BTree<Integer, String>( "test", new IntSerializer(), new StringSerializer() );
        btree.setPageSize( 4 );

        // Create a tree with 5 children containing 4 elements each. The tree is full.
        int[] keys = new int[]
            { 1, 2, 17, 18, 13, 14, 9, 10, 5, 6, 3 };
View Full Code Here

    private BTree<Integer, String> createMultiLevelBTreeLeavesHalfFull() throws IOException
    {
        // Create a BTree with pages containing 4 elements
        int pageSize = 4;

        BTree<Integer, String> btree = new BTree<Integer, String>( "test", new IntSerializer(), new StringSerializer(),
            pageSize );

        Node<Integer, String> root = new Node<Integer, String>( btree, 1L, pageSize );

        // Create the tree with 3 levels, all the leaves containing only N/2 elements
View Full Code Here

        int n = 0;
        int nbElems = 500000;
        long delta = System.currentTimeMillis();

        // Create a BTree with 5 million entries
        BTree<Long, String> btree = new BTree<Long, String>( "test", new LongSerializer(), new StringSerializer() );
        btree.setPageSize( 32 );

        for ( int i = 0; i < nbElems; i++ )
        {
            Long key = ( long ) random.nextLong();
View Full Code Here

     */
    @Test
    public void testBrowseForwardBackwardExtremes() throws Exception
    {
        // Create a BTree with pages containing 4 elements
        BTree<Integer, String> btree = new BTree<Integer, String>( "test", new IntSerializer(), new StringSerializer() );
        btree.setPageSize( 4 );

        for ( int i = 8; i < 13; i++ )
        {
            String strValue = "V" + i;
View Full Code Here

     * @throws IOException If the creation failed
     */
    @BeforeClass
    public static void setup() throws IOException
    {
        btree = new BTree<Long, String>( "test", new LongSerializer(), new StringSerializer() );
    }
View Full Code Here

        long l1 = System.currentTimeMillis();
        int n = 0;
        long delta = l1;
        int nbElems = 100000;

        BTree<Long, String> btree = new BTree<Long, String>( "test", new LongSerializer(), new StringSerializer() );
        btree.setPageSize( 32 );

        for ( int i = 0; i < nbElems; i++ )
        {
            Long key = ( long ) random.nextLong();
View Full Code Here

    {
        // Create a BTree with pages containing 8 elements
        String path = tempFolder.getRoot().getCanonicalPath();

        BTree<Integer, String> btree = new BTree<Integer, String>( "test", path, new IntSerializer(),
            new StringSerializer() );
        btree.setPageSize( 8 );

        File journal = btree.getJournal();
        File data = btree.getFile();

        try
        {
            // Inject the values
            for ( int value : sortedValues )
            {
                String strValue = "V" + value;

                btree.insert( value, strValue );
            }

            // The journal must be full
            assertTrue( journal.length() > 0 );

            // Now, flush the btree
            btree.flush();

            // The journal must be empty
            assertEquals( 0, journal.length() );

            // Load the data into a new tree
            BTree<Integer, String> btreeLoaded = new BTree<Integer, String>( "test", path, new IntSerializer(),
                new StringSerializer() );
            btree.setPageSize( 8 );

            TupleCursor<Integer, String> cursor1 = btree.browse();
            TupleCursor<Integer, String> cursor2 = btree.browse();
View Full Code Here

        File dataFile = new File( data100K );
        BTree<Long, String> btree = new BTree<Long, String>(
            "test",
            dataFile.getParent(),
            new LongSerializer(),
            new StringSerializer() );
        btree.setPageSize( 32 );
    }
View Full Code Here

     * Create a btree
     */
    @Before
    public void setup() throws IOException
    {
        btree = new BTree<Long, String>( "test", new LongSerializer(), new StringSerializer() );
        btree.setPageSize( 8 );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.mavibot.btree.serializer.StringSerializer

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.