@Test void onConnect() { final MqttDevice device = new MqttDevice(); final String topic1 = "topic1"; final String topic2 = "topic2"; device.setTopics(String.join(",", topic1, topic2)); when(this.mqttClientAdapter.getDevice()).thenReturn(device); final Mqtt3ConnAck ack = mock(Mqtt3ConnAck.class); final Throwable throwable = null; this.instance.onConnect(this.mqttClientAdapter, ack, throwable); verify(this.mqttClientAdapter).subscribe(topic1, DEFAULT_QOS); verify(this.mqttClientAdapter).subscribe(topic2, DEFAULT_QOS); }
@Override public void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack, final Throwable throwable) { if (throwable == null) { this.onConnectSuccess(mqttClientAdapter, ack); } else { LOG.info(String.format("Client connect failed for device:%s", mqttClientAdapter.getMessageMetadata().getDeviceIdentification()), throwable); } }
SubscriptionService implements MqttClientEventHandler { @Override public void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack, final Throwable throwable) { if (throwable == null) { this.onConnectSuccess(mqttClientAdapter, ack); } else { LOG.info(String.format("Client connect failed for device:%s", mqttClientAdapter.getMessageMetadata().getDeviceIdentification()), throwable); } } }
SubscriptionService implements MqttClientEventHandler { @Override public void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack, final Throwable throwable) { if (throwable == null) { this.onConnectSuccess(mqttClientAdapter, ack); } else { LOG.info(String.format("Client connect failed for device:%s", mqttClientAdapter.getMessageMetadata().getDeviceIdentification()), throwable); } } SubscriptionService(final MqttDeviceRepository mqttDeviceRepository,
            final MqttClientAdapterFactory mqttClientAdapterFactory,
            final OutboundOsgpCoreResponseMessageSender outboundOsgpCoreResponseMessageSender,
            @Value("#{new Integer('${mqtt.broker.defaultPort}')}") final int defaultPort,
            @Value("${mqtt.broker.defaultTopics}") final String defaultTopics,
            @Value("${mqtt.broker.defaultQos}") final String defaultQos); }
SubscriptionService implements MqttClientEventHandler { @Override public void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack, final Throwable throwable) { if (throwable == null) { this.onConnectSuccess(mqttClientAdapter, ack); } else { LOG.info(String.format("Client connect failed for device:%s", mqttClientAdapter.getMessageMetadata().getDeviceIdentification()), throwable); } } SubscriptionService(final MqttDeviceRepository mqttDeviceRepository,
            final MqttClientAdapterFactory mqttClientAdapterFactory,
            final OutboundOsgpCoreResponseMessageSender outboundOsgpCoreResponseMessageSender,
            @Value("#{new Integer('${mqtt.broker.defaultPort}')}") final int defaultPort,
            @Value("${mqtt.broker.defaultTopics}") final String defaultTopics,
            @Value("${mqtt.broker.defaultQos}") final String defaultQos); void subscribe(final MessageMetadata messageMetadata); @Override void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack,
            final Throwable throwable); @Override void onSubscribe(final MqttClientAdapter mqttClientAdapter, final Mqtt3SubAck subAck,
            final Throwable throwable); @Override void onReceive(final MqttClientAdapter mqttClientAdapter, final byte[] payloadAsBytes); }
SubscriptionService implements MqttClientEventHandler { @Override public void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack, final Throwable throwable) { if (throwable == null) { this.onConnectSuccess(mqttClientAdapter, ack); } else { LOG.info(String.format("Client connect failed for device:%s", mqttClientAdapter.getMessageMetadata().getDeviceIdentification()), throwable); } } SubscriptionService(final MqttDeviceRepository mqttDeviceRepository,
            final MqttClientAdapterFactory mqttClientAdapterFactory,
            final OutboundOsgpCoreResponseMessageSender outboundOsgpCoreResponseMessageSender,
            @Value("#{new Integer('${mqtt.broker.defaultPort}')}") final int defaultPort,
            @Value("${mqtt.broker.defaultTopics}") final String defaultTopics,
            @Value("${mqtt.broker.defaultQos}") final String defaultQos); void subscribe(final MessageMetadata messageMetadata); @Override void onConnect(final MqttClientAdapter mqttClientAdapter, final Mqtt3ConnAck ack,
            final Throwable throwable); @Override void onSubscribe(final MqttClientAdapter mqttClientAdapter, final Mqtt3SubAck subAck,
            final Throwable throwable); @Override void onReceive(final MqttClientAdapter mqttClientAdapter, final byte[] payloadAsBytes);  }