@Test void subscribeExistingDevice() { when(this.messageMetadata.getDeviceIdentification()).thenReturn("test-metadata-device-id"); final MqttDevice device = mock(MqttDevice.class); when(this.mqttDeviceRepository.findByDeviceIdentification( this.messageMetadata.getDeviceIdentification())).thenReturn(device); when(this.mqttClientAdapterFactory.create(eq(device), eq(this.messageMetadata), eq(this.instance))).thenReturn( this.mqttClientAdapter); this.instance.subscribe(this.messageMetadata); verify(this.mqttClientAdapter).connect(); }
public void subscribe(final MessageMetadata messageMetadata) { final MqttDevice device = this.getOrCreateDevice(messageMetadata); final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this); mqttClientAdapter.connect(); }
SubscriptionService implements MqttClientEventHandler { public void subscribe(final MessageMetadata messageMetadata) { final MqttDevice device = this.getOrCreateDevice(messageMetadata); final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this); mqttClientAdapter.connect(); } }
SubscriptionService implements MqttClientEventHandler { public void subscribe(final MessageMetadata messageMetadata) { final MqttDevice device = this.getOrCreateDevice(messageMetadata); final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this); mqttClientAdapter.connect(); } 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 { public void subscribe(final MessageMetadata messageMetadata) { final MqttDevice device = this.getOrCreateDevice(messageMetadata); final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this); mqttClientAdapter.connect(); } 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 { public void subscribe(final MessageMetadata messageMetadata) { final MqttDevice device = this.getOrCreateDevice(messageMetadata); final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this); mqttClientAdapter.connect(); } 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);  }