Search in sources :

Example 1 with TestMVStore

use of org.h2.test.store.TestMVStore in project h2database by h2database.

the class TestAll method testUnit.

private void testUnit() {
    // mv store
    addTest(new TestCacheConcurrentLIRS());
    addTest(new TestCacheLIRS());
    addTest(new TestCacheLongKeyLIRS());
    addTest(new TestConcurrentLinkedList());
    addTest(new TestDataUtils());
    addTest(new TestFreeSpace());
    addTest(new TestKillProcessWhileWriting());
    addTest(new TestMVRTree());
    addTest(new TestMVStore());
    addTest(new TestMVStoreBenchmark());
    addTest(new TestMVStoreStopCompact());
    addTest(new TestMVStoreTool());
    addTest(new TestMVTableEngine());
    addTest(new TestObjectDataType());
    addTest(new TestRandomMapOps());
    addTest(new TestSpinLock());
    addTest(new TestStreamStore());
    addTest(new TestTransactionStore());
    // unit
    addTest(new TestAnsCompression());
    addTest(new TestAutoReconnect());
    addTest(new TestBinaryArithmeticStream());
    addTest(new TestBitStream());
    addTest(new TestBnf());
    addTest(new TestCache());
    addTest(new TestCharsetCollator());
    addTest(new TestClearReferences());
    addTest(new TestCollation());
    addTest(new TestCompress());
    addTest(new TestConnectionInfo());
    addTest(new TestDataPage());
    addTest(new TestDateIso8601());
    addTest(new TestExit());
    addTest(new TestFile());
    addTest(new TestFileLock());
    addTest(new TestFtp());
    addTest(new TestIntArray());
    addTest(new TestIntIntHashMap());
    addTest(new TestIntPerfectHash());
    addTest(new TestJmx());
    addTest(new TestMathUtils());
    addTest(new TestMode());
    addTest(new TestModifyOnWrite());
    addTest(new TestOldVersion());
    addTest(new TestObjectDeserialization());
    addTest(new TestMultiThreadedKernel());
    addTest(new TestOverflow());
    addTest(new TestPageStore());
    addTest(new TestPageStoreCoverage());
    addTest(new TestPerfectHash());
    addTest(new TestPgServer());
    addTest(new TestReader());
    addTest(new TestRecovery());
    addTest(new TestScriptReader());
    addTest(new RecoverLobTest());
    addTest(createTest("org.h2.test.unit.TestServlet"));
    addTest(new TestSecurity());
    addTest(new TestShell());
    addTest(new TestSort());
    addTest(new TestStreams());
    addTest(new TestStringUtils());
    addTest(new TestTimeStampWithTimeZone());
    addTest(new TestTraceSystem());
    addTest(new TestUpgrade());
    addTest(new TestUsingIndex());
    addTest(new TestUtils());
    addTest(new TestValue());
    addTest(new TestValueHashMap());
    addTest(new TestWeb());
    runAddedTests();
    // serial
    addTest(new TestDate());
    addTest(new TestDateTimeUtils());
    addTest(new TestCluster());
    addTest(new TestConcurrent());
    addTest(new TestFileLockSerialized());
    addTest(new TestFileLockProcess());
    addTest(new TestFileSystem());
    addTest(new TestNetUtils());
    addTest(new TestPattern());
    addTest(new TestTools());
    addTest(new TestSampleApps());
    addTest(new TestStringCache());
    addTest(new TestValueMemory());
    runAddedTests(1);
}
Also used : TestPageStoreCoverage(org.h2.test.unit.TestPageStoreCoverage) TestDateIso8601(org.h2.test.unit.TestDateIso8601) RecoverLobTest(org.h2.test.recover.RecoverLobTest) TestMVTableEngine(org.h2.test.store.TestMVTableEngine) TestPgServer(org.h2.test.unit.TestPgServer) TestValueMemory(org.h2.test.unit.TestValueMemory) TestKillProcessWhileWriting(org.h2.test.store.TestKillProcessWhileWriting) TestExit(org.h2.test.unit.TestExit) TestMode(org.h2.test.unit.TestMode) TestPageStore(org.h2.test.unit.TestPageStore) TestSort(org.h2.test.unit.TestSort) TestUtils(org.h2.test.unit.TestUtils) TestOldVersion(org.h2.test.unit.TestOldVersion) TestObjectDeserialization(org.h2.test.unit.TestObjectDeserialization) TestCompress(org.h2.test.unit.TestCompress) TestCluster(org.h2.test.db.TestCluster) TestCharsetCollator(org.h2.test.unit.TestCharsetCollator) TestFileLockSerialized(org.h2.test.unit.TestFileLockSerialized) TestMVStoreBenchmark(org.h2.test.store.TestMVStoreBenchmark) TestFileLock(org.h2.test.unit.TestFileLock) TestIntArray(org.h2.test.unit.TestIntArray) TestCacheLongKeyLIRS(org.h2.test.store.TestCacheLongKeyLIRS) TestOverflow(org.h2.test.unit.TestOverflow) TestModifyOnWrite(org.h2.test.unit.TestModifyOnWrite) TestPattern(org.h2.test.unit.TestPattern) TestValueHashMap(org.h2.test.unit.TestValueHashMap) TestReader(org.h2.test.unit.TestReader) TestNetUtils(org.h2.test.unit.TestNetUtils) TestObjectDataType(org.h2.test.store.TestObjectDataType) TestDataPage(org.h2.test.unit.TestDataPage) TestWeb(org.h2.test.server.TestWeb) TestTraceSystem(org.h2.test.unit.TestTraceSystem) TestClearReferences(org.h2.test.unit.TestClearReferences) TestUpgrade(org.h2.test.db.TestUpgrade) TestStreamStore(org.h2.test.store.TestStreamStore) TestTransactionStore(org.h2.test.store.TestTransactionStore) TestConnectionInfo(org.h2.test.unit.TestConnectionInfo) TestTools(org.h2.test.unit.TestTools) TestStreams(org.h2.test.unit.TestStreams) TestFile(org.h2.test.unit.TestFile) TestSampleApps(org.h2.test.unit.TestSampleApps) TestCacheConcurrentLIRS(org.h2.test.store.TestCacheConcurrentLIRS) TestConcurrent(org.h2.test.store.TestConcurrent) TestFtp(org.h2.test.unit.TestFtp) TestStringUtils(org.h2.test.unit.TestStringUtils) TestSpinLock(org.h2.test.store.TestSpinLock) TestDataUtils(org.h2.test.store.TestDataUtils) TestUsingIndex(org.h2.test.db.TestUsingIndex) TestRandomMapOps(org.h2.test.store.TestRandomMapOps) TestValue(org.h2.test.unit.TestValue) TestIntPerfectHash(org.h2.test.unit.TestIntPerfectHash) TestMVStore(org.h2.test.store.TestMVStore) TestMathUtils(org.h2.test.unit.TestMathUtils) TestRecovery(org.h2.test.unit.TestRecovery) TestTimeStampWithTimeZone(org.h2.test.unit.TestTimeStampWithTimeZone) TestFileLockProcess(org.h2.test.unit.TestFileLockProcess) TestMultiThreadedKernel(org.h2.test.db.TestMultiThreadedKernel) TestFreeSpace(org.h2.test.store.TestFreeSpace) TestDateTimeUtils(org.h2.test.unit.TestDateTimeUtils) TestMVRTree(org.h2.test.store.TestMVRTree) TestSecurity(org.h2.test.unit.TestSecurity) TestMVStoreTool(org.h2.test.store.TestMVStoreTool) TestIntIntHashMap(org.h2.test.unit.TestIntIntHashMap) TestBnf(org.h2.test.unit.TestBnf) TestCacheLIRS(org.h2.test.store.TestCacheLIRS) TestAutoReconnect(org.h2.test.unit.TestAutoReconnect) TestBinaryArithmeticStream(org.h2.test.unit.TestBinaryArithmeticStream) TestCollation(org.h2.test.unit.TestCollation) TestJmx(org.h2.test.unit.TestJmx) TestPerfectHash(org.h2.test.unit.TestPerfectHash) TestAnsCompression(org.h2.test.unit.TestAnsCompression) TestShell(org.h2.test.unit.TestShell) TestStringCache(org.h2.test.unit.TestStringCache) TestConcurrentLinkedList(org.h2.test.store.TestConcurrentLinkedList) TestCache(org.h2.test.unit.TestCache) TestDate(org.h2.test.unit.TestDate) TestMVStoreStopCompact(org.h2.test.store.TestMVStoreStopCompact) TestBitStream(org.h2.test.unit.TestBitStream) TestScriptReader(org.h2.test.unit.TestScriptReader) TestFileSystem(org.h2.test.unit.TestFileSystem)

Example 2 with TestMVStore

use of org.h2.test.store.TestMVStore in project h2database by h2database.

the class TestReorderWrites method testMVStore.

private void testMVStore() {
    FilePathReorderWrites fs = FilePathReorderWrites.register();
    String fileName = "reorder:memFS:test.mv";
    try {
        for (int i = 0; i < 1000; i++) {
            log(i + " --------------------------------");
            // this test is not interested in power off failures during
            // initial creation
            fs.setPowerOffCountdown(0, 0);
            // release the static data this test generates
            FileUtils.delete("memFS:test.mv");
            FileUtils.delete("memFS:test.mv.copy");
            MVStore store = new MVStore.Builder().fileName(fileName).autoCommitDisabled().open();
            // store.setRetentionTime(10);
            Map<Integer, byte[]> map = store.openMap("data");
            map.put(-1, new byte[1]);
            store.commit();
            store.getFileStore().sync();
            Random r = new Random(i);
            int stop = 4 + r.nextInt(20);
            log("countdown start");
            fs.setPowerOffCountdown(stop, i);
            try {
                for (int j = 1; j < 100; j++) {
                    Map<Integer, Integer> newMap = store.openMap("d" + j);
                    newMap.put(j, j * 10);
                    int key = r.nextInt(10);
                    int len = 10 * r.nextInt(1000);
                    if (r.nextBoolean()) {
                        map.remove(key);
                    } else {
                        map.put(key, new byte[len]);
                    }
                    log("op " + j + ": ");
                    store.commit();
                    switch(r.nextInt(10)) {
                        case 0:
                            log("op compact");
                            store.compact(100, 10 * 1024);
                            break;
                        case 1:
                            log("op compactMoveChunks");
                            store.compactMoveChunks();
                            log("op compactMoveChunks done");
                            break;
                    }
                }
                // write has to fail at some point
                fail();
            } catch (IllegalStateException e) {
                log("stop " + e + ", cause: " + e.getCause());
            // expected
            }
            try {
                store.close();
            } catch (IllegalStateException e) {
                // expected
                store.closeImmediately();
            }
            log("verify");
            fs.setPowerOffCountdown(100, 0);
            if (LOG) {
                MVStoreTool.dump(fileName, true);
            }
            store = new MVStore.Builder().fileName(fileName).autoCommitDisabled().open();
            map = store.openMap("data");
            if (!map.containsKey(-1)) {
                fail("key not found, size=" + map.size() + " i=" + i);
            } else {
                assertEquals("i=" + i, 1, map.get(-1).length);
            }
            for (int j = 0; j < 100; j++) {
                Map<Integer, Integer> newMap = store.openMap("d" + j);
                newMap.get(j);
            }
            map.keySet();
            store.close();
        }
    } finally {
        // release the static data this test generates
        FileUtils.delete("memFS:test.mv");
        FileUtils.delete("memFS:test.mv.copy");
    }
}
Also used : MVStore(org.h2.mvstore.MVStore) Random(java.util.Random) FilePathReorderWrites(org.h2.test.utils.FilePathReorderWrites)

Aggregations

Random (java.util.Random)1 MVStore (org.h2.mvstore.MVStore)1 TestCluster (org.h2.test.db.TestCluster)1 TestMultiThreadedKernel (org.h2.test.db.TestMultiThreadedKernel)1 TestUpgrade (org.h2.test.db.TestUpgrade)1 TestUsingIndex (org.h2.test.db.TestUsingIndex)1 RecoverLobTest (org.h2.test.recover.RecoverLobTest)1 TestWeb (org.h2.test.server.TestWeb)1 TestCacheConcurrentLIRS (org.h2.test.store.TestCacheConcurrentLIRS)1 TestCacheLIRS (org.h2.test.store.TestCacheLIRS)1 TestCacheLongKeyLIRS (org.h2.test.store.TestCacheLongKeyLIRS)1 TestConcurrent (org.h2.test.store.TestConcurrent)1 TestConcurrentLinkedList (org.h2.test.store.TestConcurrentLinkedList)1 TestDataUtils (org.h2.test.store.TestDataUtils)1 TestFreeSpace (org.h2.test.store.TestFreeSpace)1 TestKillProcessWhileWriting (org.h2.test.store.TestKillProcessWhileWriting)1 TestMVRTree (org.h2.test.store.TestMVRTree)1 TestMVStore (org.h2.test.store.TestMVStore)1 TestMVStoreBenchmark (org.h2.test.store.TestMVStoreBenchmark)1 TestMVStoreStopCompact (org.h2.test.store.TestMVStoreStopCompact)1