Search in sources :

Example 1 with SyncNodePair

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;
    }
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) FileInputStreamPlus(org.apache.cassandra.io.util.FileInputStreamPlus) SyncNodePair(org.apache.cassandra.repair.SyncNodePair) Test(org.junit.Test)

Example 2 with SyncNodePair

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);
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) ArrayList(java.util.ArrayList) SyncNodePair(org.apache.cassandra.repair.SyncNodePair) StreamSummary(org.apache.cassandra.streaming.StreamSummary) SessionSummary(org.apache.cassandra.streaming.SessionSummary) Test(org.junit.Test)

Aggregations

InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)2 SyncNodePair (org.apache.cassandra.repair.SyncNodePair)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 FileInputStreamPlus (org.apache.cassandra.io.util.FileInputStreamPlus)1 SessionSummary (org.apache.cassandra.streaming.SessionSummary)1 StreamSummary (org.apache.cassandra.streaming.StreamSummary)1