use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method constructorInputUserNameNull.
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructorInputUserNameNull() throws Exception {
// Arrange
final String hostName = "xxx";
final String userName = null;
final String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method closeCallReceiverClose.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_006: [ The function shall call close() on the member AmqpFileUploadNotificationReceive object ]
@Test
public void closeCallReceiverClose() 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
fileUploadNotificationReceiver.close();
// Assert
new Verifications() {
{
amqpFileUploadNotificationReceive.close();
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method receiveAsync.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_012: [ The function shall create an async wrapper around the receive() function call using the default timeout ]
@Test
public void receiveAsync() 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<FileUploadNotification> completableFuture = fileUploadNotificationReceiver.receiveAsync();
completableFuture.get();
// Assert
new Verifications() {
{
amqpFileUploadNotificationReceive.receive(Deencapsulation.getField(fileUploadNotificationReceiver, "DEFAULT_TIMEOUT_MS"));
times = 1;
fileUploadNotificationReceiver.receive();
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method constructorInputSasTokenNull.
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructorInputSasTokenNull() throws Exception {
// Arrange
final String hostName = "xxx";
final String userName = "xxx";
final String sasToken = null;
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
// Act
FileUploadNotificationReceiver fileUploadNotificationReceiver = Deencapsulation.newInstance(FileUploadNotificationReceiver.class, hostName, userName, sasToken, iotHubServiceClientProtocol);
}
use of com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol in project azure-iot-sdk-java by Azure.
the class FileUploadNotificationReceiverTest method receiveWithTimeoutCallReceiveTimeout.
// Tests_SRS_SERVICE_SDK_JAVA_FILEUPLOADNOTIFICATIONRECEIVER_25_009: [ The function shall call receive() on the member AmqpFileUploadNotificationReceive object and return with the result ]
@Test
public void receiveWithTimeoutCallReceiveTimeout() 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
fileUploadNotificationReceiver.receive(timeoutMs);
// Assert
new Verifications() {
{
amqpFileUploadNotificationReceive.receive(timeoutMs);
times = 1;
}
};
}
Aggregations