Search in sources :

Example 1 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusResponseFinalized.

@Test
public void handleStatusResponseFinalized() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    session.setState(FINALIZE_PROMISED);
    sessions.handleStatusResponse(PARTICIPANT1, new StatusResponse(sessionID, FINALIZED));
    Assert.assertEquals(FINALIZED, session.getState());
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 2 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusResponseNoSession.

@Test
public void handleStatusResponseNoSession() throws Exception {
    UUID sessionID = UUIDGen.getTimeUUID();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    sessions.handleStatusResponse(PARTICIPANT1, new StatusResponse(sessionID, FINALIZE_PROMISED));
    Assert.assertNull(sessions.getSession(sessionID));
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 3 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusRequestNoSession.

@Test
public void handleStatusRequestNoSession() throws Exception {
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    sessions.sentMessages.clear();
    UUID sessionID = UUIDGen.getTimeUUID();
    sessions.handleStatusRequest(PARTICIPANT2, new StatusRequest(sessionID));
    assertNoMessagesSent(sessions, PARTICIPANT1);
    assertMessagesSent(sessions, PARTICIPANT2, new StatusResponse(sessionID, FAILED));
    assertNoMessagesSent(sessions, PARTICIPANT3);
}
Also used : StatusRequest(org.apache.cassandra.repair.messages.StatusRequest) StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 4 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessions method handleStatusRequest.

public void handleStatusRequest(InetAddress from, StatusRequest request) {
    logger.debug("received {} from {}", request, from);
    UUID sessionID = request.sessionID;
    LocalSession session = getSession(sessionID);
    if (session == null) {
        logger.warn("Received status response message for unknown session {}", sessionID);
        sendMessage(from, new StatusResponse(sessionID, FAILED));
    } else {
        sendMessage(from, new StatusResponse(sessionID, session.getState()));
    }
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID)

Example 5 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusRequest.

@Test
public void handleStatusRequest() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    Assert.assertEquals(PREPARED, session.getState());
    sessions.sentMessages.clear();
    sessions.handleStatusRequest(PARTICIPANT2, new StatusRequest(sessionID));
    assertNoMessagesSent(sessions, PARTICIPANT1);
    assertMessagesSent(sessions, PARTICIPANT2, new StatusResponse(sessionID, PREPARED));
    assertNoMessagesSent(sessions, PARTICIPANT3);
}
Also used : StatusRequest(org.apache.cassandra.repair.messages.StatusRequest) StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)7 StatusResponse (org.apache.cassandra.repair.messages.StatusResponse)7 AbstractRepairTest (org.apache.cassandra.repair.AbstractRepairTest)6 Test (org.junit.Test)6 StatusRequest (org.apache.cassandra.repair.messages.StatusRequest)2