@Test public void canConvertAppendEntriesToAndFromProtobuf() throws Exception { List<Entry> entries = Lists.newArrayList(new Entry("bar".getBytes(), 12), new Entry("baz".getBytes(), 12)); AppendEntries pojo = new AppendEntries(12, "foo", 13, 14, 15, entries); RaftProto.AppendEntries proto = RaftProto.AppendEntries.newBuilder() .setTerm(12) .setLeaderId("foo") .setPrevLogIndex(13) .setPrevLogTerm(14) .setCommitIndex(15) .addEntries(RaftEntry.Entry.newBuilder() .setTerm(12) .setCommand(ByteString.copyFromUtf8("bar")) .build()) .addEntries(RaftEntry.Entry.newBuilder() .setTerm(12) .setCommand(ByteString.copyFromUtf8("baz")) .build()) .build(); assertThat(ProtoUtils.convert(pojo)).isEqualTo(proto); assertThat(ProtoUtils.convert(proto)).isEqualTo(pojo); }
public static Entry convert(RaftEntry.Entry input) { return new Entry(input.getCommand().toByteArray(), input.getTerm()); }
ProtoUtils { public static Entry convert(RaftEntry.Entry input) { return new Entry(input.getCommand().toByteArray(), input.getTerm()); } }
ProtoUtils { public static Entry convert(RaftEntry.Entry input) { return new Entry(input.getCommand().toByteArray(), input.getTerm()); }  }
ProtoUtils { public static Entry convert(RaftEntry.Entry input) { return new Entry(input.getCommand().toByteArray(), input.getTerm()); }  static Entry convert(RaftEntry.Entry input); static RaftEntry.Entry convert(Entry input); static RequestVote convert(RaftProto.RequestVote request); static RaftProto.RequestVoteResponse convert(RequestVoteResponse requestVoteResponse); static RequestVoteResponse convert(RaftProto.RequestVoteResponse requestVoteResponse); static AppendEntries convert(RaftProto.AppendEntries request); static RaftProto.AppendEntries convert(AppendEntries request); static RaftProto.AppendEntriesResponse convert(AppendEntriesResponse response); static AppendEntriesResponse convert(RaftProto.AppendEntriesResponse response); static RaftProto.RequestVote convert(RequestVote request); }
ProtoUtils { public static Entry convert(RaftEntry.Entry input) { return new Entry(input.getCommand().toByteArray(), input.getTerm()); }  static Entry convert(RaftEntry.Entry input); static RaftEntry.Entry convert(Entry input); static RequestVote convert(RaftProto.RequestVote request); static RaftProto.RequestVoteResponse convert(RequestVoteResponse requestVoteResponse); static RequestVoteResponse convert(RaftProto.RequestVoteResponse requestVoteResponse); static AppendEntries convert(RaftProto.AppendEntries request); static RaftProto.AppendEntries convert(AppendEntries request); static RaftProto.AppendEntriesResponse convert(AppendEntriesResponse response); static AppendEntriesResponse convert(RaftProto.AppendEntriesResponse response); static RaftProto.RequestVote convert(RequestVote request); static Function<? super RaftProto.AppendEntriesResponse, ? extends AppendEntriesResponse> convertAppendResponse; static Function<? super RaftProto.RequestVoteResponse, ? extends RequestVoteResponse> convertVoteResponse; }