use of io.joynr.messaging.mqtt.statusmetrics.MqttStatusReceiver in project joynr by bmwcarit.
the class MqttPahoClientTest method testClientNotifiesStatusReceiverAboutShutdownDisconnect.
@Test
public void testClientNotifiesStatusReceiverAboutShutdownDisconnect() throws Exception {
final MqttStatusReceiver mqttStatusReceiver = mock(MqttStatusReceiver.class);
final JoynrMqttClient mqttClient = createMqttClientWithoutSubscription(false, mqttStatusReceiver);
verify(mqttStatusReceiver).notifyConnectionStatusChanged(MqttStatusReceiver.ConnectionStatus.CONNECTED);
mqttClient.shutdown();
verify(mqttStatusReceiver).notifyConnectionStatusChanged(MqttStatusReceiver.ConnectionStatus.NOT_CONNECTED);
}
use of io.joynr.messaging.mqtt.statusmetrics.MqttStatusReceiver in project joynr by bmwcarit.
the class MqttPahoClientTest method testClientNotifiesStatusReceiverAboutBrokerDisconnect.
// This test was disabled, because it runs perfectly on a local machine but not in the CI.
// Further investigations are required to stabilize this test.
@Test
@Ignore
public void testClientNotifiesStatusReceiverAboutBrokerDisconnect() throws Exception {
final MqttStatusReceiver mqttStatusReceiver = mock(MqttStatusReceiver.class);
@SuppressWarnings("unused") final JoynrMqttClient mqttClient = createMqttClientWithoutSubscription(false, mqttStatusReceiver);
verify(mqttStatusReceiver).notifyConnectionStatusChanged(MqttStatusReceiver.ConnectionStatus.CONNECTED);
stopBroker();
Thread.sleep(1000);
verify(mqttStatusReceiver).notifyConnectionStatusChanged(MqttStatusReceiver.ConnectionStatus.NOT_CONNECTED);
startBroker();
Thread.sleep(2000);
verify(mqttStatusReceiver, times(2)).notifyConnectionStatusChanged(MqttStatusReceiver.ConnectionStatus.CONNECTED);
}
use of io.joynr.messaging.mqtt.statusmetrics.MqttStatusReceiver in project joynr by bmwcarit.
the class JeeIntegrationBeanTest method testJoynrStatusMetricsObjectIsUsedAsJoynrStatusReceiver.
@Test
public void testJoynrStatusMetricsObjectIsUsedAsJoynrStatusReceiver() {
Injector joynrInjector = joynrIntegrationBean.getJoynrInjector();
MqttStatusReceiver mqttStatusReceiver = joynrInjector.getInstance(MqttStatusReceiver.class);
StatusReceiver statusReceiver = joynrInjector.getInstance(StatusReceiver.class);
assertNotNull(joynrStatusMetrics);
// We cannot compare these objects directly using the == operator. The reason is that the joynrStatusMetrics object is
// wrapped by a java proxy. Therefore the objects are different. However, the toString() method is called on the
// underlying object.
assertEquals(mqttStatusReceiver.toString(), joynrStatusMetrics.toString());
assertEquals(statusReceiver.toString(), joynrStatusMetrics.toString());
}
Aggregations