use of co.rsk.db.importer.provider.index.data.BootstrapDataIndex in project rskj by rsksmart.
the class BootstrapIndexCandidateSelectorTest method getMaximumCommonHeightDataOneEntry.
@Test(expected = BootstrapImportException.class)
public void getMaximumCommonHeightDataOneEntry() {
List<String> keys = Arrays.asList("key1", "key2");
BootstrapIndexCandidateSelector indexMCH = new BootstrapIndexCandidateSelector(keys, 2);
List<BootstrapDataIndex> indexes = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries = new ArrayList<>();
entries.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
indexes.add(new BootstrapDataIndex(entries));
indexMCH.getHeightData(indexes);
}
use of co.rsk.db.importer.provider.index.data.BootstrapDataIndex in project rskj by rsksmart.
the class BootstrapIndexCandidateSelectorTest method getMaximumCommonHeightDataTwoEntries.
@Test
public void getMaximumCommonHeightDataTwoEntries() {
List<String> keys = Arrays.asList("key1", "key2");
BootstrapIndexCandidateSelector indexMCH = new BootstrapIndexCandidateSelector(keys, 2);
List<BootstrapDataIndex> indexes = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries2 = new ArrayList<>();
entries.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries2.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
indexes.add(new BootstrapDataIndex(entries));
indexes.add(new BootstrapDataIndex(entries2));
BootstrapIndexCandidateSelector.HeightCandidate heightCandidate = indexMCH.getHeightData(indexes);
assertEquals(1, heightCandidate.getHeight());
}
use of co.rsk.db.importer.provider.index.data.BootstrapDataIndex in project rskj by rsksmart.
the class BootstrapIndexCandidateSelectorTest method getMaximumCommonHeightDataManyEntries.
@Test
public void getMaximumCommonHeightDataManyEntries() {
List<String> keys = Arrays.asList("key1", "key2", "keys3");
BootstrapIndexCandidateSelector indexMCH = new BootstrapIndexCandidateSelector(keys, 2);
List<BootstrapDataIndex> indexes = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries2 = new ArrayList<>();
ArrayList<BootstrapDataEntry> entries3 = new ArrayList<>();
entries.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries2.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries3.add(new BootstrapDataEntry(1, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries.add(new BootstrapDataEntry(2, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries2.add(new BootstrapDataEntry(2, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
entries3.add(new BootstrapDataEntry(2, "", "dbPath", "hash", new BootstrapDataSignature("r", "s")));
indexes.add(new BootstrapDataIndex(entries));
indexes.add(new BootstrapDataIndex(entries2));
indexes.add(new BootstrapDataIndex(entries3));
BootstrapIndexCandidateSelector.HeightCandidate heightCandidate = indexMCH.getHeightData(indexes);
assertEquals(heightCandidate.getHeight(), 2L);
}
Aggregations