use of org.apache.samza.storage.blobstore.index.serde.SnapshotIndexSerde in project samza by apache.
the class TestSnapshotIndexSerde method testSnapshotIndexSerde.
@Test
public void testSnapshotIndexSerde() throws IOException {
// create local and remote snapshots
String local = "[a, b, c/1, d/1/2]";
String remote = "[a, b, z, c/1/2, e/1]";
Path localSnapshot = BlobStoreTestUtil.createLocalDir(local);
DirIndex dirIndex = BlobStoreTestUtil.createDirIndex(remote);
SnapshotMetadata snapshotMetadata = new SnapshotMetadata(CheckpointId.create(), "job", "123", "task", "store");
SnapshotIndex testRemoteSnapshot = new SnapshotIndex(System.currentTimeMillis(), snapshotMetadata, dirIndex, Optional.empty());
SnapshotIndexSerde snapshotIndexSerde = new SnapshotIndexSerde();
byte[] serialized = snapshotIndexSerde.toBytes(testRemoteSnapshot);
SnapshotIndex deserialized = snapshotIndexSerde.fromBytes(serialized);
Assert.assertNotNull(deserialized);
Assert.assertEquals(deserialized, testRemoteSnapshot);
}
Aggregations