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
}
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);
}
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);
}
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
}
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
}
Aggregations