Search in sources :

Example 1 with ClientManager

use of org.apache.rocketmq.iot.connection.client.ClientManager in project rocketmq-externals by apache.

the class MqttPingreqMessageHandlerTest method setup.

@Before
public void setup() {
    clientManager = Mockito.mock(ClientManager.class);
    ctx = Mockito.mock(ChannelHandlerContext.class);
    client = Mockito.spy(new MqttClient());
    client.setConnected(true);
    handler = new MqttPingreqMessageHandler();
    Mockito.when(client.getCtx()).thenReturn(ctx);
}
Also used : MqttClient(org.apache.rocketmq.iot.protocol.mqtt.data.MqttClient) ClientManager(org.apache.rocketmq.iot.connection.client.ClientManager) MqttPingreqMessageHandler(org.apache.rocketmq.iot.protocol.mqtt.handler.downstream.impl.MqttPingreqMessageHandler) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Before(org.junit.Before)

Example 2 with ClientManager

use of org.apache.rocketmq.iot.connection.client.ClientManager in project rocketmq-externals by apache.

the class AbstractMqttMessageHandlerTest method setup.

@Before
public void setup() {
    subscriptionStore = Mockito.mock(SubscriptionStore.class);
    clientManager = Mockito.mock(ClientManager.class);
    client = Mockito.spy(new MqttClient());
    initMessageHandler();
    mockHandler = new MockHandler(messageHandler);
    embeddedChannel = new EmbeddedChannel(mockHandler);
    initMessage();
    mock();
    Mockito.when(client.getCtx()).thenReturn(embeddedChannel.pipeline().context(mockHandler));
}
Also used : MqttClient(org.apache.rocketmq.iot.protocol.mqtt.data.MqttClient) SubscriptionStore(org.apache.rocketmq.iot.storage.subscription.SubscriptionStore) ClientManager(org.apache.rocketmq.iot.connection.client.ClientManager) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Before(org.junit.Before)

Aggregations

ClientManager (org.apache.rocketmq.iot.connection.client.ClientManager)2 MqttClient (org.apache.rocketmq.iot.protocol.mqtt.data.MqttClient)2 Before (org.junit.Before)2 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 MqttPingreqMessageHandler (org.apache.rocketmq.iot.protocol.mqtt.handler.downstream.impl.MqttPingreqMessageHandler)1 SubscriptionStore (org.apache.rocketmq.iot.storage.subscription.SubscriptionStore)1