Search in sources :

Example 1 with NodePair

use of org.apache.cassandra.repair.NodePair in project cassandra by apache.

the class SerializationsTest method testSyncCompleteRead.

@Test
public void testSyncCompleteRead() throws IOException {
    if (EXECUTE_WRITES)
        testSyncCompleteWrite();
    InetAddress src = InetAddress.getByAddress(new byte[] { 127, 0, 0, 2 });
    InetAddress dest = InetAddress.getByAddress(new byte[] { 127, 0, 0, 3 });
    NodePair nodes = new NodePair(src, dest);
    try (DataInputStreamPlus in = getInput("service.SyncComplete.bin")) {
        // success
        RepairMessage message = RepairMessage.serializer.deserialize(in, getVersion());
        assert message.messageType == RepairMessage.Type.SYNC_COMPLETE;
        assert DESC.equals(message.desc);
        assert nodes.equals(((SyncComplete) message).nodes);
        assert ((SyncComplete) message).success;
        // fail
        message = RepairMessage.serializer.deserialize(in, getVersion());
        assert message.messageType == RepairMessage.Type.SYNC_COMPLETE;
        assert DESC.equals(message.desc);
        assert nodes.equals(((SyncComplete) message).nodes);
        assert !((SyncComplete) message).success;
        // MessageOuts
        for (int i = 0; i < 2; i++) assert MessageIn.read(in, getVersion(), -1) != null;
    }
}
Also used : NodePair(org.apache.cassandra.repair.NodePair) DataInputStreamPlus(org.apache.cassandra.io.util.DataInputPlus.DataInputStreamPlus) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 2 with NodePair

use of org.apache.cassandra.repair.NodePair in project cassandra by apache.

the class RepairMessageSerializationsTest method syncCompleteMessage.

@Test
public void syncCompleteMessage() throws IOException {
    InetAddress src = InetAddress.getByName("127.0.0.2");
    InetAddress dst = InetAddress.getByName("127.0.0.3");
    SyncComplete msg = new SyncComplete(buildRepairJobDesc(), new NodePair(src, dst), true);
    serializeRoundTrip(msg, SyncComplete.serializer);
}
Also used : NodePair(org.apache.cassandra.repair.NodePair) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Aggregations

InetAddress (java.net.InetAddress)2 NodePair (org.apache.cassandra.repair.NodePair)2 Test (org.junit.Test)2 DataInputStreamPlus (org.apache.cassandra.io.util.DataInputPlus.DataInputStreamPlus)1