use of com.microsoft.azure.sdk.iot.service.auth.AuthenticationMechanism in project azure-iot-sdk-java by Azure.
the class AuthenticationMechanismTest method secondaryThumbprintPropertyWorks.
// Tests_SRS_AUTHENTICATION_MECHANISM_34_016: [This function shall set this object's secondary thumbprint to the provided value.]
// Tests_SRS_AUTHENTICATION_MECHANISM_34_021: [This function shall return the secondary thumbprint of this object.]
// Tests_SRS_AUTHENTICATION_MECHANISM_34_018: [This function shall set this object's authentication type to SelfSigned.]
@Test
public void secondaryThumbprintPropertyWorks() {
// arrange
AuthenticationMechanism actualAuthentication = new AuthenticationMechanism(AuthenticationType.CERTIFICATE_AUTHORITY);
// act
actualAuthentication.setSecondaryThumbprint(expectedSecondaryThumbprint);
// assert
assertEquals(expectedSecondaryThumbprint, actualAuthentication.getSecondaryThumbprint());
assertEquals(AuthenticationType.SELF_SIGNED, actualAuthentication.getAuthenticationType());
}
use of com.microsoft.azure.sdk.iot.service.auth.AuthenticationMechanism in project azure-iot-sdk-java by Azure.
the class AuthenticationMechanismTest method primaryThumbprintPropertiesWorks.
// Tests_SRS_AUTHENTICATION_MECHANISM_34_015: [This function shall set this object's primary thumbprint to the provided value.]
// Tests_SRS_AUTHENTICATION_MECHANISM_34_020: [This function shall return the primary thumbprint of this object.]
// Tests_SRS_AUTHENTICATION_MECHANISM_34_017: [This function shall set this object's authentication type to SelfSigned.]
@Test
public void primaryThumbprintPropertiesWorks() {
// arrange
AuthenticationMechanism actualAuthentication = new AuthenticationMechanism(AuthenticationType.CERTIFICATE_AUTHORITY);
// act
actualAuthentication.setPrimaryThumbprint(expectedPrimaryThumbprint);
actualAuthentication.setSecondaryThumbprint(expectedSecondaryThumbprint);
// assert
assertEquals(expectedSecondaryThumbprint, actualAuthentication.getSecondaryThumbprint());
assertEquals(expectedPrimaryThumbprint, actualAuthentication.getPrimaryThumbprint());
assertEquals(AuthenticationType.SELF_SIGNED, actualAuthentication.getAuthenticationType());
}
use of com.microsoft.azure.sdk.iot.service.auth.AuthenticationMechanism in project azure-iot-sdk-java by Azure.
the class AuthenticationMechanismTest method testSASAuthenticationTypeConstructor.
// Tests_SRS_AUTHENTICATION_MECHANISM_34_024: [If the provided authentication type is SAS, a symmetric key will be generated, but no thumbprint will be generated.]
@Test
public void testSASAuthenticationTypeConstructor() {
// act
AuthenticationMechanism sasAuth = new AuthenticationMechanism(AuthenticationType.SAS);
// assert
assertNotNull(sasAuth.getSymmetricKey());
assertNull(sasAuth.getPrimaryThumbprint());
assertNull(sasAuth.getSecondaryThumbprint());
}
use of com.microsoft.azure.sdk.iot.service.auth.AuthenticationMechanism in project azure-iot-sdk-java by Azure.
the class AuthenticationMechanismTest method testCertificateAuthorityAuthenticationTypeConstructor.
// Tests_SRS_AUTHENTICATION_MECHANISM_34_022: [If the provided authentication type is certificate authority signed, no thumbprint or symmetric key will be generated.]
@Test
public void testCertificateAuthorityAuthenticationTypeConstructor() {
// act
AuthenticationMechanism authenticationCASigned = new AuthenticationMechanism(AuthenticationType.CERTIFICATE_AUTHORITY);
// assert
assertNull(authenticationCASigned.getSymmetricKey());
assertNull(authenticationCASigned.getPrimaryThumbprint());
assertNull(authenticationCASigned.getSecondaryThumbprint());
assertEquals(AuthenticationType.CERTIFICATE_AUTHORITY, authenticationCASigned.getAuthenticationType());
}
Aggregations