activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1409621 [2/2] - in /activemq/trunk: activemq-amq-store/src/test/java/org/apache/activemq/kaha/ activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/ activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/async/ activemq-a...
Date Thu, 15 Nov 2012 00:36:56 GMT
Added: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedListTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedListTest.java?rev=1409621&view=auto
==============================================================================
--- activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedListTest.java
(added)
+++ activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedListTest.java
Thu Nov 15 00:36:53 2012
@@ -0,0 +1,316 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.kaha.impl.index;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.activemq.kaha.StoreEntry;
+import org.apache.activemq.kaha.impl.data.Item;
+
+/**
+ * 
+ */
+public class VMIndexLinkedListTest extends TestCase {
+    static final int NUMBER = 30;
+    private IndexItem root;
+    private List<IndexItem> testData = new ArrayList<IndexItem>();
+    private IndexLinkedList list;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        IndexItem item = new IndexItem();
+        list = createList(item);
+        this.root = list.getRoot();
+        
+        for (int i = 0; i < NUMBER; i++) {
+            item = createIndex(list,i);
+            testData.add(item);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        testData.clear();
+        list = null;
+    }
+    
+    IndexItem createIndex(IndexLinkedList list,int offset) throws IOException {
+        IndexItem result =  new IndexItem();
+        result.setOffset(offset);
+        return result;
+    }
+    protected IndexLinkedList createList(IndexItem root) throws IOException {
+        return new VMIndexLinkedList(root);
+    }
+    
+    protected void addToList(IndexLinkedList list,IndexItem item) throws IOException {
+        list.add(item);
+    }
+    
+    protected void insertToList(IndexLinkedList list,int pos,IndexItem item) throws IOException
{
+        list.add(pos, item);
+    }
+    
+    protected void insertFirst(IndexLinkedList list,IndexItem item) throws IOException {
+        list.addFirst(item);
+    }
+    
+    protected synchronized void remove(IndexLinkedList list,IndexItem item) throws IOException
{
+        IndexItem root = list.getRoot();
+        IndexItem prev = list.getPrevEntry(item);
+        IndexItem next = list.getNextEntry(item);
+        list.remove(item);
+    }
+    
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.getFirst()'
+     */
+    public void testGetFirst() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        assertNotNull(list.getFirst());
+        assertTrue(list.getFirst().equals(testData.get(0)));
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.getLast()'
+     */
+    public void testGetLast() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        assertTrue(list.getLast() == testData.get(testData.size() - 1));
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.removeFirst()'
+     */
+    public void testRemoveFirst() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        assertTrue(list.removeFirst().equals(testData.get(0)));
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.removeLast()'
+     */
+    public void testRemoveLast() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        assertTrue(list.removeLast().equals(testData.get(testData.size() - 1)));
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.addFirst(IndexItem)'
+     */
+    public void testAddFirst() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            insertFirst(list, testData.get(i));
+        }
+        int count = 0;
+        for (int i = testData.size() - 1; i >= 0; i--) {
+            assertTrue(testData.get(i).equals(list.get(count++)));
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.addLast(IndexItem)'
+     */
+    public void testAddLast() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            assertTrue(testData.get(i).equals(list.get(i)));
+        }
+    }
+
+    /*
+     * test method for 'org.apache.activemq.kaha.impl.VMIndexLinkedList.size()'
+     */
+    public void testSize() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+            assertTrue(list.size() == i + 1);
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.isEmpty()'
+     */
+    public void testIsEmpty() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+            assertTrue(list.size() == i + 1);
+        }
+        list.clear();
+        assertTrue(list.isEmpty());
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.add(IndexItem)'
+     */
+    public void testAddIndexItem() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            assertTrue(testData.get(i).equals(list.get(i)));
+        }
+    }
+
+    /*
+     * test method for 'org.apache.activemq.kaha.impl.VMIndexLinkedList.clear()'
+     */
+    public void testClear() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+            assertTrue(list.size() == i + 1);
+        }
+        list.clear();
+        assertTrue(list.isEmpty());
+    }
+
+    /*
+     * test method for 'org.apache.activemq.kaha.impl.VMIndexLinkedList.add(int,
+     * IndexItem)'
+     */
+    public void testAddIntIndexItem() throws IOException {
+        for (int i = 0; i < this.testData.size(); i++) {
+            insertToList(list, i, testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            assertTrue(testData.get(i).equals(list.get(i)));
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.remove(int)'
+     */
+    public void testRemoveInt() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            insertToList(list, i, testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            list.remove(0);
+        }
+        assertTrue(list.isEmpty());
+        for (int i = 0; i < testData.size(); i++) {
+            insertToList(list, i, testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            list.remove(list.size() - 1);
+        }
+        assertTrue(list.isEmpty());
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.indexOf(IndexItem)'
+     */
+    public void testIndexOf() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            assertTrue(list.indexOf(testData.get(i)) == i);
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.getNextEntry(IndexItem)'
+     */
+    public void testGetNextEntry() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        IndexItem next = list.getFirst();
+        int count = 0;
+        while (next != null) {
+            assertTrue(next.equals(testData.get(count++)));
+            next = list.getNextEntry(next);
+            assertTrue(next == null || !next.equals(root));
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.getPrevEntry(IndexItem)'
+     */
+    public void testGetPrevEntry() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        IndexItem next = list.getLast();
+        int count = testData.size() - 1;
+        while (next != null) {
+            assertTrue(next.equals(testData.get(count--)));
+            next = list.getPrevEntry(next);
+            assertTrue(next == null || !next.equals(root));
+        }
+    }
+
+    /*
+     * test method for
+     * 'org.apache.activemq.kaha.impl.VMIndexLinkedList.remove(IndexItem)'
+     */
+    public void testRemoveIndexItem() throws IOException {
+        for (int i = 0; i < testData.size(); i++) {
+            addToList(list,testData.get(i));
+        }
+        for (int i = 0; i < testData.size(); i++) {
+            list.remove(testData.get(i));
+            assertTrue(list.size() == testData.size() - i - 1);
+        }
+    }
+    
+    public void testAddRemove() throws IOException {
+        IndexItem a = createIndex(list,0);
+        addToList(list, a);
+        IndexItem b = createIndex(list,1);
+        addToList(list, b);
+        IndexItem c = createIndex(list,2);
+        addToList(list, c);
+        IndexItem d = createIndex(list,3);
+        addToList(list, d);
+        remove(list, d);
+        assertTrue(list.getLast().equals(c));
+        assertTrue(list.getNextEntry(b).equals(c));
+        remove(list, b);
+        assertTrue(list.getNextEntry(a).equals(c));
+        assertTrue(list.getLast().equals(c));
+        
+    }
+}

Propchange: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/VMIndexLinkedListTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashIndexBenchMark.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashIndexBenchMark.java?rev=1409621&view=auto
==============================================================================
--- activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashIndexBenchMark.java
(added)
+++ activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashIndexBenchMark.java
Thu Nov 15 00:36:53 2012
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.kaha.impl.index.hash;
+
+import java.io.File;
+
+import org.apache.activemq.kaha.Store;
+import org.apache.activemq.kaha.impl.index.Index;
+import org.apache.activemq.kaha.impl.index.IndexBenchmark;
+import org.apache.activemq.kaha.impl.index.hash.HashIndex;
+
+public class HashIndexBenchMark extends IndexBenchmark {
+
+    @Override
+    protected Index createIndex(File root, String name) throws Exception {
+        HashIndex index = new HashIndex(root, name, indexManager);
+        index.setNumberOfBins(12);
+        index.setPageSize(32 * 1024);
+        index.setKeyMarshaller(Store.STRING_MARSHALLER);
+        return index;
+    }
+
+}

Propchange: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashIndexBenchMark.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java?rev=1409621&view=auto
==============================================================================
--- activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java
(added)
+++ activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java
Thu Nov 15 00:36:53 2012
@@ -0,0 +1,153 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.kaha.impl.index.hash;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicLong;
+import junit.framework.TestCase;
+import org.apache.activemq.kaha.Store;
+import org.apache.activemq.kaha.impl.index.IndexItem;
+import org.apache.activemq.kaha.impl.index.IndexManager;
+import org.apache.activemq.util.IOHelper;
+
+/**
+ * Test a HashIndex
+ */
+public class HashTest extends TestCase {
+
+    private static final int COUNT = 10000;
+
+    private HashIndex hashIndex;
+
+    private File directory;
+
+    private IndexManager indexManager;
+
+    /**
+     * @throws java.lang.Exception
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        directory = new File(IOHelper.getDefaultDataDirectory());
+        IOHelper.mkdirs(directory);
+        IOHelper.deleteChildren(directory);
+        indexManager = new IndexManager(directory, "im-hash-test", "rw", null,
+                new AtomicLong());
+        this.hashIndex = new HashIndex(directory, "testHash", indexManager);
+        this.hashIndex.setNumberOfBins(12);
+        this.hashIndex.setPageSize(32 * 1024);
+        this.hashIndex.setKeyMarshaller(Store.STRING_MARSHALLER);
+    }
+
+    public void testHashIndex() throws Exception {
+        doTest(300);
+        hashIndex.clear();
+        hashIndex.unload();
+        doTest(600);
+        hashIndex.clear();
+        hashIndex.unload();
+        doTest(128);
+    }
+
+    public void doTest(int pageSize) throws Exception {
+        String keyRoot = "key:";
+        hashIndex.setPageSize(pageSize);
+        this.hashIndex.load();
+        doInsert(keyRoot);
+        this.hashIndex.unload();
+        this.hashIndex.load();
+        checkRetrieve(keyRoot);
+        doRemove(keyRoot);
+        this.hashIndex.unload();
+        this.hashIndex.load();
+        doInsert(keyRoot);
+        doRemoveHalf(keyRoot);
+        doInsertHalf(keyRoot);
+        this.hashIndex.unload();
+        this.hashIndex.load();
+        checkRetrieve(keyRoot);
+        this.hashIndex.unload();
+    }
+
+    void doInsert(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem value = indexManager.createNewIndex();
+            indexManager.storeIndex(value);
+            hashIndex.store(keyRoot + i, value);
+        }
+    }
+
+    void checkRetrieve(String keyRoot) throws IOException {
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem) hashIndex.get(keyRoot + i);
+            assertNotNull(item);
+        }
+    }
+
+    void doRemoveHalf(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            if (i % 2 == 0) {
+                hashIndex.remove(keyRoot + i);
+            }
+
+        }
+    }
+
+    void doInsertHalf(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            if (i % 2 == 0) {
+                IndexItem value = indexManager.createNewIndex();
+                indexManager.storeIndex(value);
+                hashIndex.store(keyRoot + i, value);
+            }
+        }
+    }
+
+    void doRemove(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            hashIndex.remove(keyRoot + i);
+        }
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem) hashIndex.get(keyRoot + i);
+            assertNull(item);
+        }
+    }
+
+    void doRemoveBackwards(String keyRoot) throws Exception {
+        for (int i = COUNT - 1; i >= 0; i--) {
+            hashIndex.remove(keyRoot + i);
+        }
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem) hashIndex.get(keyRoot + i);
+            assertNull(item);
+        }
+    }
+
+    /**
+     * @throws java.lang.Exception
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        File[] files = directory.listFiles();
+        for (File file : files) {
+            file.delete();
+        }
+    }
+}

Propchange: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/hash/HashTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java?rev=1409621&view=auto
==============================================================================
--- activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java
(added)
+++ activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java
Thu Nov 15 00:36:53 2012
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.kaha.impl.index.tree;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicLong;
+
+import junit.framework.TestCase;
+import org.apache.activemq.kaha.Store;
+import org.apache.activemq.kaha.impl.index.IndexItem;
+import org.apache.activemq.kaha.impl.index.IndexManager;
+
+/**
+ * Test a TreeIndex
+ */
+public class TreeTest extends TestCase {
+
+    private static final int COUNT = 55;
+    private TreeIndex tree;
+    private File directory;
+    private IndexManager indexManager;
+    private boolean dumpTree;
+
+    /**
+     * @throws java.lang.Exception
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        directory = new File("activemq-data");
+        directory.mkdirs();
+        indexManager = new IndexManager(directory, "im-test", "rw", null,new AtomicLong());
+        this.tree = new TreeIndex(directory, "testTree", indexManager);
+        this.tree.setKeyMarshaller(Store.STRING_MARSHALLER);
+    }
+
+    public void testTreeWithCaching() throws Exception {
+        this.tree.setEnablePageCaching(true);
+        // doTest();
+    }
+
+    public void testTreeWithoutCaching() throws Exception {
+        this.tree.setEnablePageCaching(false);
+        // doTest();
+    }
+
+    public void doTest() throws Exception {
+        // doTest(300);
+        // tree.clear();
+        // tree.unload();
+        // count = 55 - this fails
+        doTest(600);
+        // tree.clear();
+        // tree.unload();
+        // doTest(1024*16);
+    }
+
+    public void doTest(int pageSize) throws Exception {
+        String keyRoot = "key:";
+        tree.setPageSize(pageSize);
+        this.tree.load();
+        // doInsert(keyRoot);
+        // checkRetrieve(keyRoot);
+        // doRemove(keyRoot);
+        doInsert(keyRoot);
+        doRemoveBackwards(keyRoot);
+    }
+
+    void doInsert(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem value = indexManager.createNewIndex();
+            indexManager.storeIndex(value);
+            tree.store(keyRoot + i, value);
+        }
+    }
+
+    void checkRetrieve(String keyRoot) throws IOException {
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem)tree.get(keyRoot + i);
+            assertNotNull(item);
+        }
+    }
+
+    void doRemove(String keyRoot) throws Exception {
+        for (int i = 0; i < COUNT; i++) {
+            tree.remove(keyRoot + i);
+            // System.out.println("Removed " + keyRoot+i);
+            // tree.getRoot().dump();
+            // System.out.println("");
+        }
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem)tree.get(keyRoot + i);
+            assertNull(item);
+        }
+    }
+
+    void doRemoveBackwards(String keyRoot) throws Exception {
+        for (int i = COUNT - 1; i >= 0; i--) {
+            tree.remove(keyRoot + i);
+            System.out.println("BACK Removed " + keyRoot + i);
+            tree.getRoot().dump();
+            System.out.println("");
+        }
+        for (int i = 0; i < COUNT; i++) {
+            IndexItem item = (IndexItem)tree.get(keyRoot + i);
+            assertNull(item);
+        }
+    }
+
+    /**
+     * @throws java.lang.Exception
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        File[] files = directory.listFiles();
+        for (File file : files) {
+            file.delete();
+        }
+    }
+}

Propchange: activemq/trunk/activemq-amq-store/src/test/java/org/apache/activemq/kaha/impl/index/tree/TreeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message