mirror of
https://github.com/apache/activemq.git
synced 2025-02-20 17:05:07 +00:00
apply patch for: https://issues.apache.org/jira/browse/AMQ-4158
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1415870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
321d9ef310
commit
81c167b205
@ -37,6 +37,7 @@ import org.apache.activemq.store.kahadb.disk.page.Transaction;
|
|||||||
import org.apache.activemq.store.kahadb.disk.util.LongMarshaller;
|
import org.apache.activemq.store.kahadb.disk.util.LongMarshaller;
|
||||||
import org.apache.activemq.store.kahadb.disk.util.StringMarshaller;
|
import org.apache.activemq.store.kahadb.disk.util.StringMarshaller;
|
||||||
import org.apache.activemq.store.kahadb.disk.util.VariableMarshaller;
|
import org.apache.activemq.store.kahadb.disk.util.VariableMarshaller;
|
||||||
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
this.index.unload(tx);
|
this.index.unload(tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testPruning() throws Exception {
|
public void testPruning() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
|
|
||||||
@ -130,6 +132,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testIteration() throws Exception {
|
public void testIteration() throws Exception {
|
||||||
createPageFileAndIndex(500);
|
createPageFileAndIndex(500);
|
||||||
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
||||||
@ -149,7 +152,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
// BTree should iterate it in sorted order.
|
// BTree should iterate it in sorted order.
|
||||||
int counter=0;
|
int counter=0;
|
||||||
for (Iterator<Map.Entry<String,Long>> i = index.iterator(tx); i.hasNext();) {
|
for (Iterator<Map.Entry<String,Long>> i = index.iterator(tx); i.hasNext();) {
|
||||||
Map.Entry<String,Long> entry = (Map.Entry<String,Long>)i.next();
|
Map.Entry<String,Long> entry = i.next();
|
||||||
assertEquals(key(counter),entry.getKey());
|
assertEquals(key(counter),entry.getKey());
|
||||||
assertEquals(counter,(long)entry.getValue());
|
assertEquals(counter,(long)entry.getValue());
|
||||||
counter++;
|
counter++;
|
||||||
@ -159,7 +162,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testVisitor() throws Exception {
|
public void testVisitor() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
||||||
@ -177,9 +180,11 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
// BTree should iterate it in sorted order.
|
// BTree should iterate it in sorted order.
|
||||||
|
|
||||||
index.visit(tx, new BTreeVisitor<String, Long>(){
|
index.visit(tx, new BTreeVisitor<String, Long>(){
|
||||||
|
@Override
|
||||||
public boolean isInterestedInKeysBetween(String first, String second) {
|
public boolean isInterestedInKeysBetween(String first, String second) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void visit(List<String> keys, List<Long> values) {
|
public void visit(List<String> keys, List<Long> values) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -189,7 +194,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testRandomRemove() throws Exception {
|
public void testRandomRemove() throws Exception {
|
||||||
|
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
@ -231,6 +236,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=300000)
|
||||||
public void testRandomAddRemove() throws Exception {
|
public void testRandomAddRemove() throws Exception {
|
||||||
|
|
||||||
createPageFileAndIndex(1024);
|
createPageFileAndIndex(1024);
|
||||||
@ -273,6 +279,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testRemovePattern() throws Exception {
|
public void testRemovePattern() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
BTreeIndex<String,Long> index = ((BTreeIndex<String,Long>)this.index);
|
||||||
@ -319,9 +326,10 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
assertNull(index.getLast(tx));
|
assertNull(index.getLast(tx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testLargeValue() throws Exception {
|
public void testLargeValue() throws Exception {
|
||||||
//System.setProperty("maxKahaDBTxSize", "" + (1024*1024*1024));
|
//System.setProperty("maxKahaDBTxSize", "" + (1024*1024*1024));
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
//pf.setEnablePageCaching(false);
|
//pf.setEnablePageCaching(false);
|
||||||
pf.load();
|
pf.load();
|
||||||
@ -366,8 +374,9 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testLargeValueOverflow() throws Exception {
|
public void testLargeValueOverflow() throws Exception {
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
pf.load();
|
pf.load();
|
||||||
@ -422,8 +431,9 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testIndexRepeatFillClearIncrementingPageReuse() throws Exception {
|
public void testIndexRepeatFillClearIncrementingPageReuse() throws Exception {
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.load();
|
pf.load();
|
||||||
|
|
||||||
@ -467,11 +477,12 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testListIndexConsistancyOverTime() throws Exception {
|
public void testListIndexConsistancyOverTime() throws Exception {
|
||||||
|
|
||||||
final int NUM_ITERATIONS = 50;
|
final int NUM_ITERATIONS = 50;
|
||||||
|
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
//pf.setEnablePageCaching(false);
|
//pf.setEnablePageCaching(false);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
@ -553,6 +564,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
static class HashSetStringMarshaller extends VariableMarshaller<HashSet<String>> {
|
static class HashSetStringMarshaller extends VariableMarshaller<HashSet<String>> {
|
||||||
final static HashSetStringMarshaller INSTANCE = new HashSetStringMarshaller();
|
final static HashSetStringMarshaller INSTANCE = new HashSetStringMarshaller();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void writePayload(HashSet<String> object, DataOutput dataOut) throws IOException {
|
public void writePayload(HashSet<String> object, DataOutput dataOut) throws IOException {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oout = new ObjectOutputStream(baos);
|
ObjectOutputStream oout = new ObjectOutputStream(baos);
|
||||||
@ -564,6 +576,7 @@ public class BTreeIndexTest extends IndexTestSupport {
|
|||||||
dataOut.write(data);
|
dataOut.write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HashSet<String> readPayload(DataInput dataIn) throws IOException {
|
public HashSet<String> readPayload(DataInput dataIn) throws IOException {
|
||||||
int dataLen = dataIn.readInt();
|
int dataLen = dataIn.readInt();
|
||||||
byte[] data = new byte[dataLen];
|
byte[] data = new byte[dataLen];
|
||||||
|
@ -24,6 +24,8 @@ import junit.framework.TestCase;
|
|||||||
import org.apache.activemq.store.kahadb.disk.page.PageFile;
|
import org.apache.activemq.store.kahadb.disk.page.PageFile;
|
||||||
import org.apache.activemq.store.kahadb.disk.page.Transaction;
|
import org.apache.activemq.store.kahadb.disk.page.Transaction;
|
||||||
import org.apache.activemq.util.IOHelper;
|
import org.apache.activemq.util.IOHelper;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test a HashIndex
|
* Test a HashIndex
|
||||||
@ -37,28 +39,26 @@ public abstract class IndexTestSupport extends TestCase {
|
|||||||
protected PageFile pf;
|
protected PageFile pf;
|
||||||
protected Transaction tx;
|
protected Transaction tx;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @throws java.lang.Exception
|
@After
|
||||||
* @see junit.framework.TestCase#setUp()
|
public void tearDown() throws Exception {
|
||||||
*/
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
directory = new File(IOHelper.getDefaultDataDirectory() + System.currentTimeMillis());
|
|
||||||
IOHelper.delete(directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
if( pf!=null ) {
|
if( pf!=null ) {
|
||||||
pf.unload();
|
pf.unload();
|
||||||
pf.delete();
|
pf.delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getDirectory() {
|
||||||
if (directory != null) {
|
if (directory != null) {
|
||||||
IOHelper.delete(directory);
|
IOHelper.delete(directory);
|
||||||
}
|
}
|
||||||
|
directory = new File(IOHelper.getDefaultDataDirectory() + System.currentTimeMillis());
|
||||||
|
IOHelper.delete(directory);
|
||||||
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createPageFileAndIndex(int pageSize) throws Exception {
|
protected void createPageFileAndIndex(int pageSize) throws Exception {
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(pageSize);
|
pf.setPageSize(pageSize);
|
||||||
pf.load();
|
pf.load();
|
||||||
tx = pf.tx();
|
tx = pf.tx();
|
||||||
@ -67,6 +67,7 @@ public abstract class IndexTestSupport extends TestCase {
|
|||||||
|
|
||||||
abstract protected Index<String, Long> createIndex() throws Exception;
|
abstract protected Index<String, Long> createIndex() throws Exception;
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testIndex() throws Exception {
|
public void testIndex() throws Exception {
|
||||||
createPageFileAndIndex(500);
|
createPageFileAndIndex(500);
|
||||||
this.index.load(tx);
|
this.index.load(tx);
|
||||||
|
@ -36,6 +36,7 @@ import org.apache.activemq.store.kahadb.disk.util.Sequence;
|
|||||||
import org.apache.activemq.store.kahadb.disk.util.SequenceSet;
|
import org.apache.activemq.store.kahadb.disk.util.SequenceSet;
|
||||||
import org.apache.activemq.store.kahadb.disk.util.StringMarshaller;
|
import org.apache.activemq.store.kahadb.disk.util.StringMarshaller;
|
||||||
import org.apache.activemq.store.kahadb.disk.util.VariableMarshaller;
|
import org.apache.activemq.store.kahadb.disk.util.VariableMarshaller;
|
||||||
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -64,6 +65,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testSize() throws Exception {
|
public void testSize() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
|
|
||||||
@ -98,6 +100,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testPut() throws Exception {
|
public void testPut() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
|
|
||||||
@ -130,6 +133,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testAddFirst() throws Exception {
|
public void testAddFirst() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
|
|
||||||
@ -155,7 +159,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
counter--;
|
counter--;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (iterator.hasNext() && count < counter) {
|
while (iterator.hasNext() && count < counter) {
|
||||||
Map.Entry<String, Long> entry = (Map.Entry<String, Long>) iterator.next();
|
Map.Entry<String, Long> entry = iterator.next();
|
||||||
assertEquals(key(count), entry.getKey());
|
assertEquals(key(count), entry.getKey());
|
||||||
assertEquals(count, (long) entry.getValue());
|
assertEquals(count, (long) entry.getValue());
|
||||||
count++;
|
count++;
|
||||||
@ -163,6 +167,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testPruning() throws Exception {
|
public void testPruning() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
|
|
||||||
@ -212,6 +217,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testIterationAddFirst() throws Exception {
|
public void testIterationAddFirst() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
||||||
@ -229,7 +235,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Iterator<Map.Entry<String, Long>> i = index.iterator(tx); i.hasNext(); ) {
|
for (Iterator<Map.Entry<String, Long>> i = index.iterator(tx); i.hasNext(); ) {
|
||||||
Map.Entry<String, Long> entry = (Map.Entry<String, Long>) i.next();
|
Map.Entry<String, Long> entry = i.next();
|
||||||
assertEquals(key(counter), entry.getKey());
|
assertEquals(key(counter), entry.getKey());
|
||||||
assertEquals(counter, (long) entry.getValue());
|
assertEquals(counter, (long) entry.getValue());
|
||||||
counter++;
|
counter++;
|
||||||
@ -245,7 +251,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testIteration() throws Exception {
|
public void testIteration() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
||||||
@ -263,7 +269,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Iterator<Map.Entry<String, Long>> i = index.iterator(tx); i.hasNext(); ) {
|
for (Iterator<Map.Entry<String, Long>> i = index.iterator(tx); i.hasNext(); ) {
|
||||||
Map.Entry<String, Long> entry = (Map.Entry<String, Long>) i.next();
|
Map.Entry<String, Long> entry = i.next();
|
||||||
assertEquals(key(counter), entry.getKey());
|
assertEquals(key(counter), entry.getKey());
|
||||||
assertEquals(counter, (long) entry.getValue());
|
assertEquals(counter, (long) entry.getValue());
|
||||||
counter++;
|
counter++;
|
||||||
@ -274,6 +280,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testRandomRemove() throws Exception {
|
public void testRandomRemove() throws Exception {
|
||||||
|
|
||||||
createPageFileAndIndex(4*1024);
|
createPageFileAndIndex(4*1024);
|
||||||
@ -298,6 +305,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testRemovePattern() throws Exception {
|
public void testRemovePattern() throws Exception {
|
||||||
createPageFileAndIndex(100);
|
createPageFileAndIndex(100);
|
||||||
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
ListIndex<String, Long> index = ((ListIndex<String, Long>) this.index);
|
||||||
@ -311,6 +319,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
index.remove(tx, key(1566));
|
index.remove(tx, key(1566));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testLargeAppendRemoveTimed() throws Exception {
|
public void testLargeAppendRemoveTimed() throws Exception {
|
||||||
createPageFileAndIndex(1024*4);
|
createPageFileAndIndex(1024*4);
|
||||||
ListIndex<String, Long> listIndex = ((ListIndex<String, Long>) this.index);
|
ListIndex<String, Long> listIndex = ((ListIndex<String, Long>) this.index);
|
||||||
@ -345,8 +354,9 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
return min + (int)(Math.random() * ((max - min) + 1));
|
return min + (int)(Math.random() * ((max - min) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testLargeValueOverflow() throws Exception {
|
public void testLargeValueOverflow() throws Exception {
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.setEnablePageCaching(false);
|
pf.setEnablePageCaching(false);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
@ -429,11 +439,12 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
return "key:" + nf.format(i);
|
return "key:" + nf.format(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testListIndexConsistencyOverTime() throws Exception {
|
public void testListIndexConsistencyOverTime() throws Exception {
|
||||||
|
|
||||||
final int NUM_ITERATIONS = 100;
|
final int NUM_ITERATIONS = 100;
|
||||||
|
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.setEnablePageCaching(false);
|
pf.setEnablePageCaching(false);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
@ -496,11 +507,12 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testListLargeDataAddWithReverseRemove() throws Exception {
|
public void testListLargeDataAddWithReverseRemove() throws Exception {
|
||||||
|
|
||||||
final int NUM_ITERATIONS = 100;
|
final int NUM_ITERATIONS = 100;
|
||||||
|
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.setEnablePageCaching(false);
|
pf.setEnablePageCaching(false);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
@ -568,7 +580,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
final int NUM_ITERATIONS = 200;
|
final int NUM_ITERATIONS = 200;
|
||||||
final int RANGE = 200000;
|
final int RANGE = 200000;
|
||||||
|
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.load();
|
pf.load();
|
||||||
tx = pf.tx();
|
tx = pf.tx();
|
||||||
@ -599,11 +611,12 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
LOG.info("duration: " + (System.currentTimeMillis() - start));
|
LOG.info("duration: " + (System.currentTimeMillis() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=60000)
|
||||||
public void testListLargeDataAddAndNonSequentialRemove() throws Exception {
|
public void testListLargeDataAddAndNonSequentialRemove() throws Exception {
|
||||||
|
|
||||||
final int NUM_ITERATIONS = 100;
|
final int NUM_ITERATIONS = 100;
|
||||||
|
|
||||||
pf = new PageFile(directory, getClass().getName());
|
pf = new PageFile(getDirectory(), getClass().getName());
|
||||||
pf.setPageSize(4*1024);
|
pf.setPageSize(4*1024);
|
||||||
pf.setEnablePageCaching(false);
|
pf.setEnablePageCaching(false);
|
||||||
pf.setWriteBatchSize(1);
|
pf.setWriteBatchSize(1);
|
||||||
@ -681,6 +694,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
static class HashSetStringMarshaller extends VariableMarshaller<HashSet<String>> {
|
static class HashSetStringMarshaller extends VariableMarshaller<HashSet<String>> {
|
||||||
final static HashSetStringMarshaller INSTANCE = new HashSetStringMarshaller();
|
final static HashSetStringMarshaller INSTANCE = new HashSetStringMarshaller();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void writePayload(HashSet<String> object, DataOutput dataOut) throws IOException {
|
public void writePayload(HashSet<String> object, DataOutput dataOut) throws IOException {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oout = new ObjectOutputStream(baos);
|
ObjectOutputStream oout = new ObjectOutputStream(baos);
|
||||||
@ -692,6 +706,7 @@ public class ListIndexTest extends IndexTestSupport {
|
|||||||
dataOut.write(data);
|
dataOut.write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public HashSet<String> readPayload(DataInput dataIn) throws IOException {
|
public HashSet<String> readPayload(DataInput dataIn) throws IOException {
|
||||||
int dataLen = dataIn.readInt();
|
int dataLen = dataIn.readInt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user