use of com.microsoft.azure.sdk.iot.service.IotHubConnectionString in project azure-iot-sdk-java by Azure.
the class IotHubConnectionStringTest method getUrlModuleDeviceNameNull.
// Tests_SRS_SERVICE_SDK_JAVA_IOTHUBCONNECTIONSTRING_28_001: [The function shall throw IllegalArgumentException if the deviceId string is empty or null]
// assert
@Test(expected = IllegalArgumentException.class)
public void getUrlModuleDeviceNameNull() throws IOException, IllegalArgumentException {
// arrange
final String deviceId = null;
final String moduleId = "somemodule";
final String iotHubName = "b.c.d";
final String hostName = "HOSTNAME." + iotHubName;
final String sharedAccessKeyName = "ACCESSKEYNAME";
final String policyName = "SharedAccessKey";
final String sharedAccessKey = "1234567890abcdefghijklmnopqrstvwxyz=";
final String connectionString = "HostName=" + hostName + ";SharedAccessKeyName=" + sharedAccessKeyName + ";" + policyName + "=" + sharedAccessKey;
final IotHubConnectionString iotHubConnectionString = IotHubConnectionStringBuilder.createConnectionString(connectionString);
// act
iotHubConnectionString.getUrlModule(deviceId, moduleId);
}
use of com.microsoft.azure.sdk.iot.service.IotHubConnectionString in project azure-iot-sdk-java by Azure.
the class IotHubConnectionStringTest method getUrlDeviceDeviceNameNull.
// Tests_SRS_SERVICE_SDK_JAVA_IOTHUBCONNECTIONSTRING_12_002: [The function shall throw IllegalArgumentException if the input string is empty or null]
// assert
@Test(expected = IllegalArgumentException.class)
public void getUrlDeviceDeviceNameNull() throws IOException, IllegalArgumentException {
// arrange
final String deviceId = null;
final String iotHubName = "b.c.d";
final String hostName = "HOSTNAME." + iotHubName;
final String sharedAccessKeyName = "ACCESSKEYNAME";
final String policyName = "SharedAccessKey";
final String sharedAccessKey = "1234567890abcdefghijklmnopqrstvwxyz=";
final String connectionString = "HostName=" + hostName + ";SharedAccessKeyName=" + sharedAccessKeyName + ";" + policyName + "=" + sharedAccessKey;
final IotHubConnectionString iotHubConnectionString = IotHubConnectionStringBuilder.createConnectionString(connectionString);
// act
iotHubConnectionString.getUrlDevice(deviceId);
}
use of com.microsoft.azure.sdk.iot.service.IotHubConnectionString in project azure-iot-sdk-java by Azure.
the class IotHubConnectionStringTest method getUrlModuleOnDeviceDeviceNameEmpty.
// Tests_SRS_SERVICE_SDK_JAVA_IOTHUBCONNECTIONSTRING_28_008: [The function shall throw IllegalArgumentException if the moduleId string is empty or null]
// assert
@Test(expected = IllegalArgumentException.class)
public void getUrlModuleOnDeviceDeviceNameEmpty() throws IOException, IllegalArgumentException {
// arrange
final String deviceId = "";
final String iotHubName = "b.c.d";
final String hostName = "HOSTNAME." + iotHubName;
final String sharedAccessKeyName = "ACCESSKEYNAME";
final String policyName = "SharedAccessKey";
final String sharedAccessKey = "1234567890abcdefghijklmnopqrstvwxyz=";
final String connectionString = "HostName=" + hostName + ";SharedAccessKeyName=" + sharedAccessKeyName + ";" + policyName + "=" + sharedAccessKey;
final IotHubConnectionString iotHubConnectionString = IotHubConnectionStringBuilder.createConnectionString(connectionString);
// act
iotHubConnectionString.getUrlModulesOnDevice(deviceId);
}
use of com.microsoft.azure.sdk.iot.service.IotHubConnectionString in project azure-iot-sdk-java by Azure.
the class IotHubConnectionStringTest method getUrlTwinThrowsOnNullDeviceID.
@Test(expected = IllegalArgumentException.class)
public void getUrlTwinThrowsOnNullDeviceID() throws IOException, IllegalArgumentException {
// arrange
final String iotHubName = "b.c.d";
final String hostName = "HOSTNAME." + iotHubName;
final String sharedAccessKeyName = "ACCESSKEYNAME";
final String policyName = "SharedAccessKey";
final String sharedAccessKey = "1234567890abcdefghijklmnopqrstvwxyz=";
final String connectionString = "HostName=" + hostName + ";SharedAccessKeyName=" + sharedAccessKeyName + ";" + policyName + "=" + sharedAccessKey;
final String deviceId = null;
final IotHubConnectionString iotHubConnectionString = IotHubConnectionStringBuilder.createConnectionString(connectionString);
// act
iotHubConnectionString.getUrlTwin(deviceId).toString();
}
use of com.microsoft.azure.sdk.iot.service.IotHubConnectionString in project azure-iot-sdk-java by Azure.
the class IotHubConnectionStringTest method getUrlConfigurationListMaxCountZero.
// Tests_SRS_SERVICE_SDK_JAVA_IOTHUBCONNECTIONSTRING_28_006: [The constructor shall throw NullPointerException if the input integer is 0]
// assert
@Test(expected = IllegalArgumentException.class)
public void getUrlConfigurationListMaxCountZero() throws IOException, IllegalArgumentException {
// arrange
Integer maxCount = 0;
final String iotHubName = "b.c.d";
final String hostName = "HOSTNAME." + iotHubName;
final String sharedAccessKeyName = "ACCESSKEYNAME";
final String policyName = "SharedAccessKey";
final String sharedAccessKey = "1234567890abcdefghijklmnopqrstvwxyz=";
final String connectionString = "HostName=" + hostName + ";SharedAccessKeyName=" + sharedAccessKeyName + ";" + policyName + "=" + sharedAccessKey;
final IotHubConnectionString iotHubConnectionString = IotHubConnectionStringBuilder.createConnectionString(connectionString);
// act
iotHubConnectionString.getUrlConfigurationsList(maxCount);
}
Aggregations