Search in sources :

Example 21 with ProvisioningConnectionString

use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.

the class ProvisioningConnectionStringTest method getSharedAccessKeyNameSucceeded.

/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_005: [The getSharedAccessKeyName shall return the stored sharedAccessKeyName.] */
@Test
public void getSharedAccessKeyNameSucceeded() {
    // arrange
    ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
    // act
    String result = provisioningConnectionString.getSharedAccessKeyName();
    // assert
    assertEquals(VALID_SHARED_ACCESS_KEY_NAME_PROPERTY_NAME, result);
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) Test(org.junit.Test)

Example 22 with ProvisioningConnectionString

use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.

the class ProvisioningConnectionStringTest method getUserStringSucceeded.

/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_001: [The getUserString shall serialize the object properties to a string using the following format: SharedAccessKeyName@SAS.root.deviceProvisioningServiceName] */
@Test
public void getUserStringSucceeded() {
    // arrange
    ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
    // act
    String result = provisioningConnectionString.getUserString();
    // assert
    assertEquals(VALID_SHARED_ACCESS_KEY_NAME_PROPERTY_NAME + "@SAS.root." + VALID_DEVICE_PROVISIONING_SERVICE_NAME, result);
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) Test(org.junit.Test)

Example 23 with ProvisioningConnectionString

use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.

the class ProvisioningConnectionStringTest method getHostNameSucceeded.

/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_008: [The getHostName shall return the stored hostName.] */
@Test
public void getHostNameSucceeded() {
    // arrange
    ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
    // act
    String result = provisioningConnectionString.getHostName();
    // assert
    assertEquals(VALID_HOST_NAME_PROPERTY_NAME, result);
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) Test(org.junit.Test)

Example 24 with ProvisioningConnectionString

use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.

the class ProvisioningConnectionStringTest method setSharedAccessKeyNameSucceeded.

/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_009: [The setSharedAccessKeyName shall update the sharedAccessKeyName by the provided one.] */
@Test
public void setSharedAccessKeyNameSucceeded() {
    // arrange
    ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
    final String newValue = "newSharedAccessKeyName";
    // act
    Deencapsulation.invoke(provisioningConnectionString, "setSharedAccessKeyName", newValue);
    // assert
    assertEquals(newValue, provisioningConnectionString.getSharedAccessKeyName());
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) Test(org.junit.Test)

Example 25 with ProvisioningConnectionString

use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.

the class ProvisioningConnectionStringTest method getDeviceProvisioningServiceNameSucceeded.

/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_003: [The getDeviceProvisioningServiceName shall return the stored deviceProvisioningServiceName.] */
@Test
public void getDeviceProvisioningServiceNameSucceeded() {
    // arrange
    ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
    // act
    String result = provisioningConnectionString.getDeviceProvisioningServiceName();
    // assert
    assertEquals(VALID_DEVICE_PROVISIONING_SERVICE_NAME, result);
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) Test(org.junit.Test)

Aggregations

ProvisioningConnectionString (com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString)48 Test (org.junit.Test)47 Expectations (mockit.Expectations)7 AuthenticationMethod (com.microsoft.azure.sdk.iot.provisioning.service.auth.AuthenticationMethod)5 ProvisioningSasToken (com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningSasToken)4 Verifications (mockit.Verifications)4 Base64.encodeBase64String (org.apache.commons.codec.binary.Base64.encodeBase64String)3 ContractApiHttp (com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp)1 URLEncoder (java.net.URLEncoder)1 Mac (javax.crypto.Mac)1 SecretKeySpec (javax.crypto.spec.SecretKeySpec)1