use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method constructorSaveProperties.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_002: [** The constructor shall create a new instance of AmqpFileUploadNotificationReceive object **]**
@Test
public void constructorSaveProperties() throws Exception {
// Arrange
final String hostName = "aaa";
final String userName = "bbb";
final String sasToken = "ccc";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
new Verifications() {
{
new AmqpFileUploadNotificationReceive(anyString, anyString, anyString, iotHubServiceClientProtocol);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method receiveWithTimeoutReceiverNull.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_008: [ The function shall throw IOException if the member AmqpFileUploadNotificationReceive object has not been initialized ]
// Assert
@Test(expected = IOException.class)
public void receiveWithTimeoutReceiverNull() throws Exception {
// Arrange
long timeoutMs = 1000;
final String hostName = "xxx";
final String userName = "xxx";
final String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
Deencapsulation.setField(fileUploadNotificationReceiver, "amqpFileUploadNotificationReceive", null);
// Act
fileUploadNotificationReceiver.receive(timeoutMs);
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method receiveWithTimeoutAsync.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_013: [ The function shall create an async wrapper around the receive(long timeoutMs) function call ]
@Test
public void receiveWithTimeoutAsync() throws Exception {
// Arrange
long timeoutMs = 1000;
final String hostName = "xxx";
final String userName = "xxx";
final String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
// Act
CompletableFuture<FileUploadNotification> completableFuture = fileUploadNotificationReceiver.receiveAsync(timeoutMs);
completableFuture.get();
// Assert
new Verifications() {
{
amqpFileUploadNotificationReceive.receive(timeoutMs);
times = 1;
fileUploadNotificationReceiver.receive(anyLong);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method closeAsync.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_011: [ The function shall create an async wrapper around the close() function call ]
@Test
public void closeAsync() throws Exception {
// Arrange
final String hostName = "xxx";
final String userName = "xxx";
final String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
// Act
CompletableFuture<Void> completableFuture = fileUploadNotificationReceiver.closeAsync();
completableFuture.get();
// Assert
new Verifications() {
{
amqpFileUploadNotificationReceive.close();
times = 1;
fileUploadNotificationReceiver.close();
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method constructorInputUserNameEmpty.
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructorInputUserNameEmpty() throws Exception {
// Arrange
final String hostName = "xxx";
final String userName = "";
final String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Aggregations