use of io.aeron.archive.Catalog in project Aeron by real-logic.
the class CatalogTest method growCatalogShouldNotExceedMaxCatalogCapacity.
@Test
void growCatalogShouldNotExceedMaxCatalogCapacity() {
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, null, segmentFileBuffer)) {
final long maxCatalogCapacity = CAPACITY * 1024;
catalog.growCatalog(maxCatalogCapacity, (int) (maxCatalogCapacity - 10_000));
assertEquals(maxCatalogCapacity, catalog.capacity());
}
}
use of io.aeron.archive.Catalog in project Aeron by real-logic.
the class CatalogTest method shouldReloadExistingIndex.
@Test
void shouldReloadExistingIndex() {
try (Catalog catalog = new Catalog(archiveDir, clock)) {
verifyRecordingForId(catalog, recordingOneId, 160, 6, 1, "channelG", "sourceA");
verifyRecordingForId(catalog, recordingTwoId, 160, 7, 2, "channelH", "sourceV");
verifyRecordingForId(catalog, recordingThreeId, 352, 8, 3, "channelThatIsVeryLongAndShouldNotBeTruncated", "source can also be a very very very long String and it will not be truncated even " + "if gets very very long");
}
}
use of io.aeron.archive.Catalog in project Aeron by real-logic.
the class CatalogTest method extendRecordingShouldUpdateChecksum.
@Test
void extendRecordingShouldUpdateChecksum() {
final Checksum checksum = crc32();
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, checksum, segmentFileBuffer)) {
final long recordingId = catalog.addNewRecording(0L, 0L, 0, SEGMENT_LENGTH, TERM_LENGTH, MTU_LENGTH, 6, 1, "channelNew", "channelNew?tag=X", "sourceX");
assertChecksum(catalog, recordingId, 1691549102);
catalog.extendRecording(recordingId, 555, 13, 31);
assertChecksum(catalog, recordingId, -1694749833);
}
}
use of io.aeron.archive.Catalog in project Aeron by real-logic.
the class CatalogTest method shouldAppendToExistingIndex.
@Test
void shouldAppendToExistingIndex() {
final long newRecordingId;
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, () -> 3L, null, segmentFileBuffer)) {
newRecordingId = catalog.addNewRecording(0L, 0L, 0, SEGMENT_LENGTH, TERM_LENGTH, MTU_LENGTH, 9, 4, "channelJ", "channelJ?tag=f", "sourceN");
}
try (Catalog catalog = new Catalog(archiveDir, clock)) {
verifyRecordingForId(catalog, recordingOneId, 160, 6, 1, "channelG", "sourceA");
verifyRecordingForId(catalog, newRecordingId, 160, 9, 4, "channelJ", "sourceN");
}
}
use of io.aeron.archive.Catalog in project Aeron by real-logic.
the class CatalogTest method recordingStoppedShouldUpdateChecksum.
@Test
void recordingStoppedShouldUpdateChecksum() {
final Checksum checksum = crc32();
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, checksum, segmentFileBuffer)) {
assertChecksum(catalog, recordingOneId, 0);
catalog.recordingStopped(recordingOneId, 140, 231723682323L);
assertChecksum(catalog, recordingOneId, 1656993099);
}
}
Aggregations