use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive 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.transport.amqps.AmqpFileUploadNotificationReceive in project azure-iot-sdk-java by Azure.
the class AmqpFileUploadNotificationReceiveTest method onFeedbackReceivedCallFlowOk.
// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_010: [The function shall parse the received Json string to FeedbackBath object]
@Test
public void onFeedbackReceivedCallFlowOk(@Mocked FileUploadNotification mockedNotification) {
// Arrange
final String hostName = "aaa";
final String userName = "bbb";
final String sasToken = "ccc";
final String jsonData = "[]";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
AmqpFileUploadNotificationReceive amqpFileUploadNotificationReceive = new AmqpFileUploadNotificationReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
// Act
amqpFileUploadNotificationReceive.onFeedbackReceived(jsonData);
//assert
new Verifications() {
{
mockNotificationParser.getBlobName();
times = 1;
mockNotificationParser.getBlobSizeInBytesTag();
times = 1;
mockNotificationParser.getBlobUri();
times = 1;
mockNotificationParser.getDeviceId();
times = 1;
mockNotificationParser.getEnqueuedTimeUtc();
times = 1;
mockNotificationParser.getLastUpdatedTime();
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive in project azure-iot-sdk-java by Azure.
the class AmqpFileUploadNotificationReceiveTest method onReactorInitCallFlowAndInitOk.
// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_002: [The event handler shall set the member AmqpsReceiveHandler object to handle the given connection events]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_003: [The function shall create an AmqpsReceiveHandler object to handle reactor events]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_004: [The function shall invalidate the member AmqpsReceiveHandler object]
@Test
public void onReactorInitCallFlowAndInitOk() throws IOException {
// Arrange
final String hostName = "aaa";
final String userName = "bbb";
final String sasToken = "ccc";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
AmqpFileUploadNotificationReceive amqpFileUploadNotificationReceive = new AmqpFileUploadNotificationReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
amqpFileUploadNotificationReceive.open();
// Assert
new Expectations() {
{
reactor = event.getReactor();
connection = reactor.connection(Deencapsulation.getField(amqpFileUploadNotificationReceive, "amqpReceiveHandler"));
}
};
// Act
amqpFileUploadNotificationReceive.onReactorInit(event);
// Assert
assertNotNull(Deencapsulation.getField(amqpFileUploadNotificationReceive, "amqpReceiveHandler"));
// Clean up
amqpFileUploadNotificationReceive.close();
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive 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, mockedProxyOptions, mockedSslContext);
new Verifications() {
{
new AmqpFileUploadNotificationReceive(anyString, anyString, anyString, iotHubServiceClientProtocol, (ProxyOptions) any, (SSLContext) any);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive in project azure-iot-sdk-java by Azure.
the class AmqpFileUploadNotificationReceiveTest method receiveExceptionThrow.
// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_008: [The function shall throw IOException if the send handler object is not initialized]
// Assert
@Test(expected = IOException.class)
public void receiveExceptionThrow() throws IOException, InterruptedException {
// Arrange
final String hostName = "aaa";
final String userName = "bbb";
final String sasToken = "ccc";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
int timeoutMs = 1;
AmqpFileUploadNotificationReceive amqpFileUploadNotificationReceive = new AmqpFileUploadNotificationReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
// Act
amqpFileUploadNotificationReceive.receive(timeoutMs);
}
Aggregations