use of org.apache.cassandra.repair.SyncNodePair in project cassandra by apache.
the class SerializationsTest method testSyncCompleteRead.
@Test
public void testSyncCompleteRead() throws IOException {
if (EXECUTE_WRITES)
testSyncCompleteWrite();
InetAddressAndPort src = InetAddressAndPort.getByNameOverrideDefaults("127.0.0.2", PORT);
InetAddressAndPort dest = InetAddressAndPort.getByNameOverrideDefaults("127.0.0.3", PORT);
SyncNodePair nodes = new SyncNodePair(src, dest);
try (FileInputStreamPlus in = getInput("service.SyncComplete.bin")) {
// success
SyncResponse message = SyncResponse.serializer.deserialize(in, getVersion());
assert DESC.equals(message.desc);
System.out.println(nodes);
System.out.println(message.nodes);
assert nodes.equals(message.nodes);
assert message.success;
// fail
message = SyncResponse.serializer.deserialize(in, getVersion());
assert DESC.equals(message.desc);
assert nodes.equals(message.nodes);
assert !message.success;
}
}
use of org.apache.cassandra.repair.SyncNodePair in project cassandra by apache.
the class RepairMessageSerializationsTest method syncCompleteMessage.
@Test
public void syncCompleteMessage() throws IOException {
InetAddressAndPort src = InetAddressAndPort.getByName("127.0.0.2");
InetAddressAndPort dst = InetAddressAndPort.getByName("127.0.0.3");
List<SessionSummary> summaries = new ArrayList<>();
summaries.add(new SessionSummary(src, dst, Lists.newArrayList(new StreamSummary(TableId.fromUUID(UUIDGen.getTimeUUID()), 5, 100)), Lists.newArrayList(new StreamSummary(TableId.fromUUID(UUIDGen.getTimeUUID()), 500, 10))));
SyncResponse msg = new SyncResponse(buildRepairJobDesc(), new SyncNodePair(src, dst), true, summaries);
serializeRoundTrip(msg, SyncResponse.serializer);
}
Aggregations