Search in sources :

Example 1 with SessionSummary

use of org.apache.cassandra.streaming.SessionSummary in project cassandra by apache.

the class SerializationsTest method testSyncCompleteWrite.

private void testSyncCompleteWrite() throws IOException {
    InetAddressAndPort src = InetAddressAndPort.getByNameOverrideDefaults("127.0.0.2", PORT);
    InetAddressAndPort dest = InetAddressAndPort.getByNameOverrideDefaults("127.0.0.3", PORT);
    // sync success
    List<SessionSummary> summaries = new ArrayList<>();
    summaries.add(new SessionSummary(src, dest, Lists.newArrayList(new StreamSummary(TableId.fromUUID(UUIDGen.getTimeUUID()), 5, 100)), Lists.newArrayList(new StreamSummary(TableId.fromUUID(UUIDGen.getTimeUUID()), 500, 10))));
    SyncResponse success = new SyncResponse(DESC, src, dest, true, summaries);
    // sync fail
    SyncResponse fail = new SyncResponse(DESC, src, dest, false, Collections.emptyList());
    testRepairMessageWrite("service.SyncComplete.bin", SyncResponse.serializer, success, fail);
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) ArrayList(java.util.ArrayList) StreamSummary(org.apache.cassandra.streaming.StreamSummary) SessionSummary(org.apache.cassandra.streaming.SessionSummary)

Example 2 with SessionSummary

use of org.apache.cassandra.streaming.SessionSummary 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

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