Search in sources :

Example 11 with AmqpFileUploadNotificationReceive

use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive in project azure-iot-sdk-java by Azure.

the class AmqpFileUploadNotificationReceiveTest method amqpFileUploadNotificationReceiveInitOk.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVE_25_001: [The constructor shall copy all input parameters to private member variables for event processing]
@Test
public void amqpFileUploadNotificationReceiveInitOk() {
    // Arrange
    final String hostName = "aaa";
    final String userName = "bbb";
    final String sasToken = "ccc";
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    // Act
    AmqpFileUploadNotificationReceive amqpFileUploadNotificationReceive = new AmqpFileUploadNotificationReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
    final String _hostName = Deencapsulation.getField(amqpFileUploadNotificationReceive, "hostName");
    final String _userName = Deencapsulation.getField(amqpFileUploadNotificationReceive, "userName");
    final String _sasToken = Deencapsulation.getField(amqpFileUploadNotificationReceive, "sasToken");
    // Assert
    assertEquals(hostName, _hostName);
    assertEquals(userName, _userName);
    assertEquals(sasToken, _sasToken);
}
Also used : IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) AmqpFileUploadNotificationReceive(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive) Test(org.junit.Test)

Example 12 with AmqpFileUploadNotificationReceive

use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive in project azure-iot-sdk-java by Azure.

the class AmqpFileUploadNotificationReceiveTest method receiveCreatesNewHandlerEachCall.

@Test
public void receiveCreatesNewHandlerEachCall(@Mocked AmqpFileUploadNotificationReceivedHandler mockHandler) 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.open();
    amqpFileUploadNotificationReceive.receive(timeoutMs);
    AmqpFileUploadNotificationReceivedHandler handler = Deencapsulation.getField(amqpFileUploadNotificationReceive, "amqpReceiveHandler");
    amqpFileUploadNotificationReceive.receive(timeoutMs);
    AmqpFileUploadNotificationReceivedHandler handler2 = Deencapsulation.getField(amqpFileUploadNotificationReceive, "amqpReceiveHandler");
    // Assert
    assertNotEquals(handler, handler2);
}
Also used : IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) AmqpFileUploadNotificationReceivedHandler(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceivedHandler) AmqpFileUploadNotificationReceive(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive) Test(org.junit.Test)

Aggregations

IotHubServiceClientProtocol (com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol)12 AmqpFileUploadNotificationReceive (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive)12 Test (org.junit.Test)12 Verifications (mockit.Verifications)4 Expectations (mockit.Expectations)3 FileUploadNotificationReceiver (com.microsoft.azure.sdk.iot.service.FileUploadNotificationReceiver)2 AmqpFileUploadNotificationReceivedHandler (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceivedHandler)1