Search in sources :

Example 41 with AmqpsTransport

use of com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsTransport in project azure-iot-sdk-java by Azure.

the class AmqpsTransportTest method isEmptyReturnsTrue.

// Tests_SRS_AMQPSTRANSPORT_15_035: [The function shall return true if the waiting list,
// in progress list and callback list are all empty, and false otherwise.]
@Test
public void isEmptyReturnsTrue() throws IOException {
    AmqpsTransport transport = new AmqpsTransport(mockConfig, false);
    Boolean isEmpty = transport.isEmpty();
    Assert.assertTrue(isEmpty);
}
Also used : AmqpsTransport(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsTransport) Test(org.junit.Test)

Example 42 with AmqpsTransport

use of com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsTransport in project azure-iot-sdk-java by Azure.

the class AmqpsTransportTest method messageReceivedAddsTheMessageToTheListOfMessagesToBeProcessed.

// Tests_SRS_AMQPSTRANSPORT_15_034: [The message received is added to the list of messages to be processed.]
@Test
public void messageReceivedAddsTheMessageToTheListOfMessagesToBeProcessed() throws IOException {
    new NonStrictExpectations() {

        {
            new AmqpsIotHubConnection(mockConfig, false);
            result = mockConnection;
        }
    };
    AmqpsTransport transport = new AmqpsTransport(mockConfig, false);
    transport.open();
    Queue<AmqpsMessage> receivedMessages = new LinkedBlockingQueue<>();
    receivedMessages.add(mockAmqpsMessage);
    receivedMessages.add(mockAmqpsMessage);
    Deencapsulation.setField(transport, "receivedMessages", receivedMessages);
    transport.messageReceived(mockAmqpsMessage);
    Assert.assertTrue(receivedMessages.size() == 3);
}
Also used : AmqpsIotHubConnection(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection) AmqpsTransport(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsTransport) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) AmqpsMessage(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage) Test(org.junit.Test)

Aggregations

AmqpsTransport (com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsTransport)42 Test (org.junit.Test)42 AmqpsIotHubConnection (com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection)25 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)16 IotHubOutboundPacket (com.microsoft.azure.sdk.iot.device.transport.IotHubOutboundPacket)15 HashMap (java.util.HashMap)11 AmqpsMessage (com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage)10 IotHubCallbackPacket (com.microsoft.azure.sdk.iot.device.transport.IotHubCallbackPacket)6 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)5 State (com.microsoft.azure.sdk.iot.device.transport.State)3 MessageImpl (org.apache.qpid.proton.message.impl.MessageImpl)3 LinkedList (java.util.LinkedList)2 LinkedBlockingDeque (java.util.concurrent.LinkedBlockingDeque)2 Queue (java.util.Queue)1 ApplicationProperties (org.apache.qpid.proton.amqp.messaging.ApplicationProperties)1