Package jdbm

Source Code of jdbm.TestIssues

package jdbm;


import jdbm.htree.HTree;
import jdbm.htree.HTreeMap;
import jdbm.recman.TestCaseWithTestFile;

import java.io.IOException;

public class TestIssues extends TestCaseWithTestFile{


    /*
    test this issue
    http://code.google.com/p/jdbm2/issues/detail?id=2
     */
    public void testHTreeClear() throws IOException {
        final RecordManager recman = newRecordManager();
        final HTree tree = HTree.createInstance(recman);
        recman.setNamedObject("test", tree.getRecid());
        final HTreeMap<String,String> treeMap = tree.asMap();

        for (int i = 0; i < 1001; i++) {
            treeMap.put(String.valueOf(i),String.valueOf(i));
        }
        recman.commit();
        System.out.println("finished adding");

        treeMap.clear();
        recman.commit();
        System.out.println("finished clearing");
        assertTrue(treeMap.isEmpty());
    }


    public void testBTreeClear() throws IOException {
        final RecordManager recman = newRecordManager();
        final PrimaryTreeMap<String,String> treeMap = recman.treeMap("test");

        for (int i = 0; i < 1001; i++) {
            treeMap.put(String.valueOf(i),String.valueOf(i));
        }
        recman.commit();
        System.out.println("finished adding");

        treeMap.clear();
        recman.commit();
        System.out.println("finished clearing");
        assertTrue(treeMap.isEmpty());
    }
}
TOP

Related Classes of jdbm.TestIssues

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.