use of akka.persistence.SelectedSnapshot in project controller by opendaylight.
the class LocalSnapshotStoreTest method testDoLoadAsyncWithAkkaSerializedSnapshot.
@Test
public void testDoLoadAsyncWithAkkaSerializedSnapshot() throws IOException {
SnapshotSerializer snapshotSerializer = new SnapshotSerializer((ExtendedActorSystem) system);
String name = toSnapshotName(PERSISTENCE_ID, 1, 1000);
try (FileOutputStream fos = new FileOutputStream(new File(SNAPSHOT_DIR, name))) {
fos.write(snapshotSerializer.toBinary(new Snapshot("one")));
}
SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 1, 1000);
TestKit probe = new TestKit(system);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID, SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
Option<SelectedSnapshot> possibleSnapshot = result.snapshot();
assertEquals("SelectedSnapshot present", TRUE, possibleSnapshot.nonEmpty());
assertEquals("SelectedSnapshot metadata", metadata, possibleSnapshot.get().metadata());
assertEquals("SelectedSnapshot snapshot", "one", possibleSnapshot.get().snapshot());
}
use of akka.persistence.SelectedSnapshot in project controller by opendaylight.
the class LocalSnapshotStoreTest method testDoLoadAsyncWithNoSnapshots.
@Test
public void testDoLoadAsyncWithNoSnapshots() throws IOException {
TestKit probe = new TestKit(system);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID, SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
Option<SelectedSnapshot> possibleSnapshot = result.snapshot();
assertEquals("SelectedSnapshot present", FALSE, possibleSnapshot.nonEmpty());
}
Aggregations