use of com.microsoft.azure.sdk.iot.service.FeedbackReceiver in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method close_receiver_null_without_deviceId.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_006: [The function shall throw IOException if the member AMQPReceive object has not been initialized]
// Assert
@Test(expected = IOException.class)
public void close_receiver_null_without_deviceId() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol);
Deencapsulation.setField(feedbackReceiver, "amqpReceive", null);
// Act
feedbackReceiver.close();
}
use of com.microsoft.azure.sdk.iot.service.FeedbackReceiver in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method open_async_without_deviceId.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_011: [The function shall create an async wrapper around the open() function call]
@Test
public void open_async_without_deviceId() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol);
// Assert
new Expectations() {
{
amqpReceive.open();
feedbackReceiver.open();
}
};
// Act
CompletableFuture<Void> completableFuture = feedbackReceiver.openAsync();
completableFuture.get();
}
use of com.microsoft.azure.sdk.iot.service.FeedbackReceiver in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method constructor_input_sasToken_empty.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_001: [The constructor shall throw IllegalArgumentException if any the input string is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_input_sasToken_empty() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "";
String deviceId = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol, deviceId);
}
use of com.microsoft.azure.sdk.iot.service.FeedbackReceiver in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method close_async.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_012: [The function shall create an async wrapper around the close() function call]
@Test
public void close_async() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "xxx";
String deviceId = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol, deviceId);
// Assert
new Expectations() {
{
amqpReceive.close();
feedbackReceiver.close();
}
};
// Act
CompletableFuture<Void> completableFuture = feedbackReceiver.closeAsync();
completableFuture.get();
}
use of com.microsoft.azure.sdk.iot.service.FeedbackReceiver in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method constructor_input_hostName_null_without_deviceId.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_001: [The constructor shall throw IllegalArgumentException if any the input string is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_input_hostName_null_without_deviceId() throws Exception {
// Arrange
String hostName = null;
String userName = "xxx";
String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Aggregations