|
From: Bryan T. <tho...@us...> - 2007-04-18 17:29:26
|
Update of /cvsroot/cweb/bigdata/src/test/com/bigdata/btree In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23060/src/test/com/bigdata/btree Modified Files: TestAll.java TestRestartSafe.java Added Files: TestRemoveAll.java Log Message: testing SAIL and lubm, including adding BTree#removeAll(), touching up some inferences, making it possible to load different RDF interchange formats, and adding JOIN ordering based on the sesame optimizer and the actual triple pattern selectivity in the data. Index: TestRestartSafe.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/btree/TestRestartSafe.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestRestartSafe.java 13 Apr 2007 15:04:17 -0000 1.1 --- TestRestartSafe.java 18 Apr 2007 17:29:20 -0000 1.2 *************** *** 159,162 **** --- 159,164 ---- /** + * Test basic btree is restart safe, including a test of + * {@link BTree#removeAll()} * * @throws IOException *************** *** 205,208 **** --- 207,211 ---- * restart, re-opening the same file. */ + final long addr2; { *************** *** 216,220 **** assertSameIterator(new Object[] { v1, v2, v3, v4, v5, v6, v7, v8 }, btree.entryIterator()); ! journal.closeAndDelete(); --- 219,250 ---- assertSameIterator(new Object[] { v1, v2, v3, v4, v5, v6, v7, v8 }, btree.entryIterator()); ! ! // remove all entries by replacing the root node. ! ! btree.removeAll(); ! ! assertTrue(btree.dump(Level.DEBUG,System.err)); ! ! assertSameIterator( new Object[]{}, btree.entryIterator() ); ! ! addr2 = btree.write(); ! ! journal.commit(); ! ! } ! ! /* ! * restart, re-opening the same file. ! */ ! { ! ! journal = reopenStore(journal); ! ! final BTree btree = BTree.load(journal, addr2); ! ! assertTrue(btree.dump(Level.DEBUG,System.err)); ! ! assertSameIterator( new Object[]{}, btree.entryIterator() ); ! journal.closeAndDelete(); *************** *** 247,251 **** { ! final BTree btree = new MyBTree(journal, 3, UUID.randomUUID(), SimpleEntry.Serializer.INSTANCE); --- 277,281 ---- { ! final BTree btree = new MyBTree(journal, m, UUID.randomUUID(), SimpleEntry.Serializer.INSTANCE); --- NEW FILE: TestRemoveAll.java --- /** The Notice below must appear in each file of the Source Code of any copy you distribute of the Licensed Product. Contributors to any Modifications may add their own copyright notices to identify their own contributions. License: The contents of this file are subject to the CognitiveWeb Open Source License Version 1.1 (the License). You may not copy or use this file, in either source code or executable form, except in compliance with the License. You may obtain a copy of the License from http://www.CognitiveWeb.org/legal/license/ Software distributed under the License is distributed on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyrights: Portions created by or assigned to CognitiveWeb are Copyright (c) 2003-2003 CognitiveWeb. All Rights Reserved. Contact information for CognitiveWeb is available at http://www.CognitiveWeb.org Portions Copyright (c) 2002-2003 Bryan Thompson. Acknowledgements: Special thanks to the developers of the Jabber Open Source License 1.0 (JOSL), from which this License was derived. This License contains terms that differ from JOSL. Special thanks to the CognitiveWeb Open Source Contributors for their suggestions and support of the Cognitive Web. Modifications: */ /* * Created on Apr 17, 2007 */ package com.bigdata.btree; import org.apache.log4j.Level; /** * Test suite for {@link BTree#removeAll()}. * * @see TestRestartSafe#test_restartSafe01() * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ public class TestRemoveAll extends AbstractBTreeTestCase { /** * */ public TestRemoveAll() { } /** * @param name */ public TestRemoveAll(String name) { super(name); } /** * */ public void test_removeAll() { final int m = 3; BTree btree = getBTree( m ); SimpleEntry v1 = new SimpleEntry(1); SimpleEntry v2 = new SimpleEntry(2); SimpleEntry v3 = new SimpleEntry(3); SimpleEntry v4 = new SimpleEntry(4); SimpleEntry v5 = new SimpleEntry(5); SimpleEntry v6 = new SimpleEntry(6); SimpleEntry v7 = new SimpleEntry(7); SimpleEntry v8 = new SimpleEntry(8); Object[] values = new Object[]{v5,v6,v7,v8,v3,v4,v2,v1}; { byte[][] keys = new byte[][] { new byte[] { 5 }, new byte[] { 6 }, new byte[] { 7 }, new byte[] { 8 }, new byte[] { 3 }, new byte[] { 4 }, new byte[] { 2 }, new byte[] { 1 } }; btree.insert(new BatchInsert(values.length, keys, values)); assertTrue(btree.dump(Level.DEBUG,System.err)); assertSameIterator(new Object[] { v1, v2, v3, v4, v5, v6, v7, v8 }, btree.entryIterator()); btree.removeAll(); assertTrue(btree.dump(Level.DEBUG,System.err)); assertSameIterator(new Object[] {}, btree.entryIterator()); } } } Index: TestAll.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/btree/TestAll.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestAll.java 16 Apr 2007 10:02:49 -0000 1.4 --- TestAll.java 18 Apr 2007 17:29:20 -0000 1.5 *************** *** 138,141 **** --- 138,143 ---- // test iterator semantics. suite.addTestSuite( TestIterators.class ); + // test delete semantics (also see the isolation package). + suite.addTestSuite( TestRemoveAll.class ); // test contract for BTree#touch(node) w/o IO. suite.addTestSuite( TestTouch.class ); |