Search in sources :

Example 71 with Message

use of org.openkilda.messaging.Message in project open-kilda by telstra.

the class HeartBeatTest method got_heart_beat_event.

@Then("^got at least (\\d+) heart beat event$")
public void got_heart_beat_event(int expect) throws Throwable {
    int beatsCount = 0;
    for (ConsumerRecord<String, String> record : heartBeatConsumer.poll(500)) {
        Message raw = MAPPER.readValue(record.value(), Message.class);
        if (raw instanceof HeartBeat) {
            beatsCount += 1;
        }
    }
    System.out.println(String.format("Got %d heart beats.", beatsCount));
    assertTrue(String.format("Actual heart beats count is %d, expect more than %d", beatsCount, expect), expect <= beatsCount);
}
Also used : HeartBeat(org.openkilda.messaging.HeartBeat) Message(org.openkilda.messaging.Message) Then(cucumber.api.java.en.Then)

Aggregations

Message (org.openkilda.messaging.Message)71 CommandMessage (org.openkilda.messaging.command.CommandMessage)55 InfoMessage (org.openkilda.messaging.info.InfoMessage)55 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)29 Test (org.junit.Test)25 IOException (java.io.IOException)11 Values (org.apache.storm.tuple.Values)10 CtrlRequest (org.openkilda.messaging.ctrl.CtrlRequest)6 CtrlResponse (org.openkilda.messaging.ctrl.CtrlResponse)6 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)6 CommandData (org.openkilda.messaging.command.CommandData)5 RequestData (org.openkilda.messaging.ctrl.RequestData)5 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)5 CommandWithReplyToMessage (org.openkilda.messaging.command.CommandWithReplyToMessage)4 DumpStateResponseData (org.openkilda.messaging.ctrl.DumpStateResponseData)4 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 BaseInstallFlow (org.openkilda.messaging.command.flow.BaseInstallFlow)3 FlowCreateRequest (org.openkilda.messaging.command.flow.FlowCreateRequest)3 FlowGetRequest (org.openkilda.messaging.command.flow.FlowGetRequest)3