@Test public void testSimple() { InstallSnapshotRpc rpc = new InstallSnapshotRpc(); rpc.setLastIndex(3); rpc.setLastTerm(2); rpc.setOffset(0); byte[] data = "test".getBytes(); rpc.setData(data); rpc.setDone(true); MemorySnapshotBuilder builder = new MemorySnapshotBuilder(rpc); MemorySnapshot snapshot = builder.build(); Assert.assertEquals(3, snapshot.getLastIncludedIndex()); Assert.assertEquals(2, snapshot.getLastIncludedTerm()); Assert.assertArrayEquals(data, snapshot.getData()); }
@Override public MemorySnapshot build() { return new MemorySnapshot(lastIncludedIndex, lastIncludedTerm, output.toByteArray(), lastConfig); }
MemorySnapshotBuilder extends AbstractSnapshotBuilder<MemorySnapshot> { @Override public MemorySnapshot build() { return new MemorySnapshot(lastIncludedIndex, lastIncludedTerm, output.toByteArray(), lastConfig); } }
MemorySnapshotBuilder extends AbstractSnapshotBuilder<MemorySnapshot> { @Override public MemorySnapshot build() { return new MemorySnapshot(lastIncludedIndex, lastIncludedTerm, output.toByteArray(), lastConfig); } MemorySnapshotBuilder(InstallSnapshotRpc firstRpc); }
MemorySnapshotBuilder extends AbstractSnapshotBuilder<MemorySnapshot> { @Override public MemorySnapshot build() { return new MemorySnapshot(lastIncludedIndex, lastIncludedTerm, output.toByteArray(), lastConfig); } MemorySnapshotBuilder(InstallSnapshotRpc firstRpc); @Override MemorySnapshot build(); @Override void close(); }
MemorySnapshotBuilder extends AbstractSnapshotBuilder<MemorySnapshot> { @Override public MemorySnapshot build() { return new MemorySnapshot(lastIncludedIndex, lastIncludedTerm, output.toByteArray(), lastConfig); } MemorySnapshotBuilder(InstallSnapshotRpc firstRpc); @Override MemorySnapshot build(); @Override void close();  }