Search in sources :

Example 11 with AmqpSend

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

the class AmqpSendTest method constructor_checks_if_userName_empty.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_001: [The constructor shall throw IllegalArgumentException if any of the input parameter is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_checks_if_userName_empty() {
    // Arrange
    String hostName = "aaa";
    String userName = "";
    String sasToken = "ccc";
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    // Act
    AmqpSend amqpSend = new AmqpSend(hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Also used : AmqpSend(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend) IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) Test(org.junit.Test)

Example 12 with AmqpSend

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

the class AmqpSendTest method constructor_checks_if_sasToken_empty.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_001: [The constructor shall throw IllegalArgumentException if any of the input parameter is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_checks_if_sasToken_empty() {
    // Arrange
    String hostName = "aaa";
    String userName = "bbb";
    String sasToken = "";
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    // Act
    AmqpSend amqpSend = new AmqpSend(hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Also used : AmqpSend(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend) IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) Test(org.junit.Test)

Example 13 with AmqpSend

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

the class AmqpSendTest method constructor_checks_if_hostName_empty.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_001: [The constructor shall throw IllegalArgumentException if any of the input parameter is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_checks_if_hostName_empty() {
    // Arrange
    String hostName = "";
    String userName = "bbb";
    String sasToken = "ccc";
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    // Act
    AmqpSend amqpSend = new AmqpSend(hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Also used : AmqpSend(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend) IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) Test(org.junit.Test)

Example 14 with AmqpSend

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

the class AmqpSendTest method onReactorInit_creates_SendHandler.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_003: [The event handler shall set the member AmqpsSendHandler object to handle the given connection events]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_004: [The event handler shall create an AmqpsSendHandler object to handle reactor events]
@Test
public void onReactorInit_creates_SendHandler() throws IOException {
    // Arrange
    String hostName = "aaa";
    String userName = "bbb";
    String sasToken = "ccc";
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    AmqpSend amqpSend = new AmqpSend(hostName, userName, sasToken, iotHubServiceClientProtocol);
    amqpSend.open();
    // Assert
    new Expectations() {

        {
            reactor = event.getReactor();
            connection = reactor.connection(Deencapsulation.getField(amqpSend, "amqpSendHandler"));
        }
    };
    // Act
    amqpSend.onReactorInit(event);
}
Also used : Expectations(mockit.Expectations) AmqpSend(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend) IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) Test(org.junit.Test)

Example 15 with AmqpSend

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

the class AmqpSendTest method constructor_checks_if_sasToken_null.

// Tests_SRS_SERVICE_SDK_JAVA_AMQPSEND_12_001: [The constructor shall throw IllegalArgumentException if any of the input parameter is null or empty]
// Assert
@Test(expected = IllegalArgumentException.class)
public void constructor_checks_if_sasToken_null() {
    // Arrange
    String hostName = "aaa";
    String userName = "bbb";
    String sasToken = null;
    IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
    // Act
    AmqpSend amqpSend = new AmqpSend(hostName, userName, sasToken, iotHubServiceClientProtocol);
}
Also used : AmqpSend(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend) IotHubServiceClientProtocol(com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol) Test(org.junit.Test)

Aggregations

IotHubServiceClientProtocol (com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol)15 AmqpSend (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSend)15 Test (org.junit.Test)15 Expectations (mockit.Expectations)4 Message (com.microsoft.azure.sdk.iot.service.Message)3 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)1 ServiceClient (com.microsoft.azure.sdk.iot.service.ServiceClient)1 IotHubServiceSasToken (com.microsoft.azure.sdk.iot.service.auth.IotHubServiceSasToken)1 AmqpSendHandler (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSendHandler)1