use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.
the class AmqpDeviceOperationsTest method openLinksThrowsOnSessionNull.
@Test(expected = IllegalArgumentException.class)
public void openLinksThrowsOnSessionNull() throws IOException, IllegalArgumentException {
// Arrange
AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
new NonStrictExpectations() {
{
}
};
// Act
amqpDeviceOperation.openLinks(null);
// assert
}
use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.
the class AmqpDeviceOperationsTest method isRecieverLinkTagFalseSucceeds.
@Test
public void isRecieverLinkTagFalseSucceeds() throws IOException, IllegalArgumentException {
// Arrange
AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
// Act
boolean result = amqpDeviceOperation.isReceiverLinkTag("");
// assert
Assert.assertFalse(result);
}
use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.
the class AmqpDeviceOperationsTest method sendMessageSuccess.
@Test
public void sendMessageSuccess() throws IOException, IllegalArgumentException {
// Arrange
AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
Deencapsulation.setField(amqpDeviceOperation, "senderLink", mockedSenderLink);
new NonStrictExpectations() {
{
mockedSenderLink.delivery((byte[]) any);
}
};
byte[] tag = new byte[10];
byte[] data = new byte[10];
// Act
amqpDeviceOperation.sendMessage(tag, data, 128, 0);
// assert
}
use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.
the class AmqpDeviceOperationsTest method closeLinksSuccess.
@Test
public void closeLinksSuccess() throws IOException, IllegalArgumentException {
// Arrange
AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
Deencapsulation.setField(amqpDeviceOperation, "receiverLink", mockedReceiverLink);
Deencapsulation.setField(amqpDeviceOperation, "senderLink", mockedSenderLink);
new NonStrictExpectations() {
{
mockedReceiverLink.close();
mockedSenderLink.close();
}
};
// Act
amqpDeviceOperation.closeLinks();
// assert
}
use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations in project azure-iot-sdk-java by Azure.
the class AmqpDeviceOperationsTest method openLinksSucceeds.
@Test
public void openLinksSucceeds() throws IOException, IllegalArgumentException {
// Arrange
AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
new NonStrictExpectations() {
{
mockedSession.receiver(anyString);
result = mockedReceiverLink;
mockedReceiverLink.setProperties((Map<Symbol, Object>) any);
mockedReceiverLink.open();
mockedSession.sender(anyString);
result = mockedSenderLink;
mockedSenderLink.setProperties((Map<Symbol, Object>) any);
mockedSenderLink.open();
}
};
// Act
amqpDeviceOperation.openLinks(mockedSession);
// assert
}
Aggregations