use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.
the class ProvisioningConnectionStringTest method getSharedAccessKeySucceeded.
/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_006: [The getSharedAccessKey shall return the stored sharedAccessKey.] */
@Test
public void getSharedAccessKeySucceeded() {
// arrange
ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
// act
String result = provisioningConnectionString.getSharedAccessKey();
// assert
assertEquals(VALID_SHARED_ACCESS_KEY_PROPERTY_NAME, result);
}
use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.
the class ProvisioningConnectionStringTest method setSharedAccessKeySucceeded.
/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_010: [The setSharedAccessKey shall update the sharedAccessKey by the provided one.] */
@Test
public void setSharedAccessKeySucceeded() {
// arrange
ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
final String newValue = "newSharedAccessKey";
// act
Deencapsulation.invoke(provisioningConnectionString, "setSharedAccessKey", newValue);
// assert
assertEquals(newValue, provisioningConnectionString.getSharedAccessKey());
}
use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.
the class ProvisioningConnectionStringTest method getAuthenticationMethodSucceeded.
/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_004: [The getAuthenticationMethod shall return the stored authenticationMethod.] */
@Test
public void getAuthenticationMethodSucceeded() {
// arrange
ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
// act
AuthenticationMethod result = provisioningConnectionString.getAuthenticationMethod();
// assert
assertEquals(mockedAuthenticationMethod, result);
}
use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.
the class ProvisioningConnectionStringTest method setSharedAccessSignatureSucceeded.
/* Tests_SRS_PROVISIONINGCONNECTIONSTRING_21_011: [The setSharedAccessSignature shall update the sharedAccessSignature by the provided one.] */
@Test
public void setSharedAccessSignatureSucceeded() {
// arrange
ProvisioningConnectionString provisioningConnectionString = buildProvisioningConnectionString();
final String newValue = "newSharedAccessSignature";
// act
Deencapsulation.invoke(provisioningConnectionString, "setSharedAccessSignature", newValue);
// assert
assertEquals(newValue, provisioningConnectionString.getSharedAccessSignature());
}
use of com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString in project azure-iot-sdk-java by Azure.
the class ServiceAuthenticationWithSharedAccessPolicyKeyTest method populateSetTokenToNull.
/* Tests_SRS_SERVICE_AUTHENTICATION_WITH_SHARED_ACCESS_POLICY_KEY_21_006: [The populateWithAuthenticationProperties shall set the access token to null.] */
@Test
public void populateSetTokenToNull() {
// arrange
final String policyName = "validPolicyName";
final String key = "validKey";
final ProvisioningConnectionString provisioningConnectionString = mockedProvisioningConnectionString;
Object authenticationMethodResult = Deencapsulation.newInstance("com.microsoft.azure.sdk.iot.provisioning.service.auth.ServiceAuthenticationWithSharedAccessPolicyKey", new Class[] { String.class, String.class }, policyName, key);
// act
Deencapsulation.invoke(authenticationMethodResult, "populateWithAuthenticationProperties", new Class[] { ProvisioningConnectionString.class }, provisioningConnectionString);
// assert
new Verifications() {
{
Deencapsulation.invoke(mockedProvisioningConnectionString, "setSharedAccessSignature", new Class[] { String.class }, (String) null);
times = 1;
}
};
}
Aggregations