public void TestOneFile() { HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); Logger.Console.Verbose = VerboseLevel.All; MemoryPoolTest.TestMemoryLeak(); ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); SortedTreeTable <HistorianKey, HistorianValue> master = CreateTable(); SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); } using (SortedTreeTableReadSnapshot <HistorianKey, HistorianValue> masterRead = master.BeginRead()) { SortedTreeScannerBase <HistorianKey, HistorianValue> masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); TreeStreamSequential <HistorianKey, HistorianValue> masterScanSequential = masterScan.TestSequential(); using (SequentialReaderStream <HistorianKey, HistorianValue> sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list)) { TreeStreamSequential <HistorianKey, HistorianValue> scanner = sequencer.TestSequential(); int count = 0; while (scanner.Read(key1, value1)) { count++; if (!masterScanSequential.Read(key2, value2)) { throw new Exception(); } if (!key1.IsEqualTo(key2)) { throw new Exception(); } if (!value1.IsEqualTo(value2)) { throw new Exception(); } } if (masterScan.Read(key2, value2)) { throw new Exception(); } } } list.Dispose(); master.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void TestTwoIdenticalFiles() { MemoryPoolTest.TestMemoryLeak(); ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); var master = CreateTable(); var table1 = CreateTable(); var table2 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); AddData(table2, 100, 100, 100); using (var editor = list.AcquireEditLock()) { editor.Add(table1); editor.Add(table2); } using (var masterRead = master.BeginRead()) { var masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); var masterScanSequential = masterScan.TestSequential(); using (var sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list)) { var scanner = sequencer.TestSequential(); while (scanner.Read(key1, value1)) { if (!masterScanSequential.Read(key2, value2)) { throw new Exception(); } if (!key1.IsEqualTo(key2)) { throw new Exception(); } if (!value1.IsEqualTo(value2)) { throw new Exception(); } } if (masterScan.Read(key2, value2)) { throw new Exception(); } } } list.Dispose(); master.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void TestOneFile() { HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); Logger.Console.Verbose = VerboseLevel.All; MemoryPoolTest.TestMemoryLeak(); ArchiveList<HistorianKey, HistorianValue> list = new ArchiveList<HistorianKey, HistorianValue>(null); var master = CreateTable(); var table1 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); using (var editor = list.AcquireEditLock()) { editor.Add(table1); } using (var masterRead = master.BeginRead()) { var masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); var masterScanSequential = masterScan.TestSequential(); using (var sequencer = new SequentialReaderStream<HistorianKey, HistorianValue>(list)) { var scanner = sequencer.TestSequential(); int count = 0; while (scanner.Read(key1, value1)) { count++; if (!masterScanSequential.Read(key2, value2)) throw new Exception(); if (!key1.IsEqualTo(key2)) throw new Exception(); if (!value1.IsEqualTo(value2)) throw new Exception(); } if (masterScan.Read(key2, value2)) throw new Exception(); } } list.Dispose(); master.Dispose(); MemoryPoolTest.TestMemoryLeak(); }