Search in sources :

Example 1 with TraceType

use of org.apache.cassandra.tracing.Tracing.TraceType in project cassandra by apache.

the class MessageTest method testBuilder.

@Test
public void testBuilder() {
    long id = 1;
    InetAddressAndPort from = FBUtilities.getLocalAddressAndPort();
    long createAtNanos = approxTime.now();
    long expiresAtNanos = createAtNanos + TimeUnit.SECONDS.toNanos(1);
    TraceType traceType = TraceType.QUERY;
    UUID traceSession = UUID.randomUUID();
    Message<NoPayload> msg = Message.builder(Verb._TEST_1, noPayload).withId(1).from(from).withCreatedAt(createAtNanos).withExpiresAt(expiresAtNanos).withFlag(MessageFlag.CALL_BACK_ON_FAILURE).withParam(TRACE_TYPE, TraceType.QUERY).withParam(TRACE_SESSION, traceSession).build();
    assertEquals(id, msg.id());
    assertEquals(from, msg.from());
    assertEquals(createAtNanos, msg.createdAtNanos());
    assertEquals(expiresAtNanos, msg.expiresAtNanos());
    assertTrue(msg.callBackOnFailure());
    assertFalse(msg.trackRepairedData());
    assertEquals(traceType, msg.traceType());
    assertEquals(traceSession, msg.traceSession());
    assertNull(msg.forwardTo());
    assertNull(msg.respondTo());
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) TraceType(org.apache.cassandra.tracing.Tracing.TraceType) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)1 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)1 TraceType (org.apache.cassandra.tracing.Tracing.TraceType)1 Test (org.junit.Test)1