Search in sources :

Example 1 with AmqpDeviceOperations

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method initLinkSenderSuccess.

@Test
public void initLinkSenderSuccess() throws IOException, IllegalArgumentException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    new NonStrictExpectations() {

        {
            mockedLink.getName();
            result = TEST_SENDER_LINK_NAME;
            new Target();
            result = mockedTarget;
            mockedTarget.setAddress(anyString);
            mockedLink.setTarget(mockedTarget);
            mockedLink.setSenderSettleMode(SenderSettleMode.UNSETTLED);
        }
    };
    // Act
    amqpDeviceOperation.initLink(mockedLink);
// assert
}
Also used : Target(org.apache.qpid.proton.amqp.messaging.Target) AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 2 with AmqpDeviceOperations

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method isRecieverLinkTagTrueSucceeds.

@Test
public void isRecieverLinkTagTrueSucceeds() throws IOException, IllegalArgumentException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    // Act
    boolean result = amqpDeviceOperation.isReceiverLinkTag(TEST_RECEIVER_LINK_NAME);
    // assert
    Assert.assertTrue(result);
}
Also used : AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) Test(org.junit.Test)

Example 3 with AmqpDeviceOperations

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method ReceiverMessageFromLinkReturnNullOnLinkNameEmpty.

@Test
public void ReceiverMessageFromLinkReturnNullOnLinkNameEmpty() throws IOException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    new NonStrictExpectations() {

        {
        }
    };
    // Act
    AmqpMessage result = amqpDeviceOperation.receiverMessageFromLink("");
    // assert
    Assert.assertNull(result);
}
Also used : AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) NonStrictExpectations(mockit.NonStrictExpectations) AmqpMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage) Test(org.junit.Test)

Example 4 with AmqpDeviceOperations

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method initLinkReceiverSuccess.

@Test
public void initLinkReceiverSuccess() throws IOException, IllegalArgumentException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    new NonStrictExpectations() {

        {
            mockedLink.getName();
            result = TEST_RECEIVER_LINK_NAME;
            mockedTarget.setAddress(anyString);
            mockedLink.setTarget(mockedTarget);
            mockedLink.setSenderSettleMode(SenderSettleMode.UNSETTLED);
        }
    };
    // Act
    amqpDeviceOperation.initLink(mockedLink);
// assert
}
Also used : AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 5 with AmqpDeviceOperations

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method initLinkThrowOnLinkNull.

@Test(expected = IllegalArgumentException.class)
public void initLinkThrowOnLinkNull() throws IOException, IllegalArgumentException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    // Act
    amqpDeviceOperation.initLink(null);
// assert
}
Also used : AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) Test(org.junit.Test)

Aggregations

AmqpDeviceOperations (com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations)15 Test (org.junit.Test)15 NonStrictExpectations (mockit.NonStrictExpectations)12 AmqpMessage (com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage)5 IOException (java.io.IOException)1 Symbol (org.apache.qpid.proton.amqp.Symbol)1 Target (org.apache.qpid.proton.amqp.messaging.Target)1