use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder in project azure-iot-sdk-java by Azure.
the class UrlPathBuilderTest method generateSasTokenUrlThrowsOnNullRegID.
// SRS_UrlPathBuilder_25_005: [ This method shall throw IllegalArgumentException if the registration id is null or empty. ]
@Test(expected = IllegalArgumentException.class)
public void generateSasTokenUrlThrowsOnNullRegID() throws IOException {
// arrange
UrlPathBuilder urlPathBuilder = new UrlPathBuilder(TEST_HOST_NAME, TEST_SCOPE, ProvisioningDeviceClientTransportProtocol.HTTPS);
// act
urlPathBuilder.generateSasTokenUrl(null);
}
use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder in project azure-iot-sdk-java by Azure.
the class UrlPathBuilderTest method generateSasTokenUrlThrowsOnEmptyRegID.
@Test(expected = IllegalArgumentException.class)
public void generateSasTokenUrlThrowsOnEmptyRegID() throws IOException {
// arrange
UrlPathBuilder urlPathBuilder = new UrlPathBuilder(TEST_HOST_NAME, TEST_SCOPE, ProvisioningDeviceClientTransportProtocol.HTTPS);
// act
urlPathBuilder.generateSasTokenUrl("");
}
use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder in project azure-iot-sdk-java by Azure.
the class UrlPathBuilderTest method generateRegisterUrlHttpSucceeds.
// SRS_UrlPathBuilder_25_008: [ This method shall create a String using the following format: HTTP - https://<HostName>/<Scope>/registrations/<Registration ID>/register?api-version=<Service API Version> MQTT - TBD AMQP - TBD ]
@Test
public void generateRegisterUrlHttpSucceeds() throws IOException {
// arrange
// https://testHostName/testScope/registrations/testRegistrationId/register?api-version=2017-08-31-preview
final String expectedUrl = "https://" + TEST_HOST_NAME + "/" + TEST_SCOPE + "/registrations/" + TEST_REGISTRATION_ID + "/register?api-version=" + SERVICE_API_VERSION;
UrlPathBuilder urlPathBuilder = new UrlPathBuilder(TEST_HOST_NAME, TEST_SCOPE, ProvisioningDeviceClientTransportProtocol.HTTPS);
// act
String generateRequestUrl = urlPathBuilder.generateRegisterUrl(TEST_REGISTRATION_ID);
// assert
assertEquals(expectedUrl, generateRequestUrl);
}
use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder in project azure-iot-sdk-java by Azure.
the class UrlPathBuilderTest method generateSasTokenUrlSucceeds.
// SRS_UrlPathBuilder_25_006: [ This method shall create a String using the following format after Url Encoding: <scopeid>/registrations/<registrationId> ]
@Test
public void generateSasTokenUrlSucceeds() throws IOException {
// arrange
// testScope/registrations/testRegistrationId
final String expectedSasTokenUrl = TEST_SCOPE + "/registrations/" + TEST_REGISTRATION_ID;
UrlPathBuilder urlPathBuilder = new UrlPathBuilder(TEST_HOST_NAME, TEST_SCOPE, ProvisioningDeviceClientTransportProtocol.HTTPS);
// act
String sastokenUrl = urlPathBuilder.generateSasTokenUrl(TEST_REGISTRATION_ID);
// assert
assertEquals(expectedSasTokenUrl, sastokenUrl);
}
use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder in project azure-iot-sdk-java by Azure.
the class UrlPathBuilderTest method generateRequestUrlHttpThrowsOnEmptyOpID.
@Test(expected = IllegalArgumentException.class)
public void generateRequestUrlHttpThrowsOnEmptyOpID() throws IOException {
// arrange
UrlPathBuilder urlPathBuilder = new UrlPathBuilder(TEST_HOST_NAME, TEST_SCOPE, ProvisioningDeviceClientTransportProtocol.HTTPS);
// act
urlPathBuilder.generateRequestUrl(TEST_REGISTRATION_ID, "");
}
Aggregations