use of com.microsoft.azure.sdk.iot.device.auth.IotHubX509HardwareAuthenticationProvider in project azure-iot-sdk-java by Azure.
the class IotHubX509HardwareIotHubAuthenticationProviderTest method getSSLContextThrowsIOExceptionIfExceptionEncountered.
// Tests_SRS_IOTHUBX509HARDWAREAUTHENTICATION_34_004: [If the security provider throws a SecurityProviderException while generating an SSLContext, this function shall throw an IOException.]
@Test(expected = IOException.class)
public void getSSLContextThrowsIOExceptionIfExceptionEncountered() throws SecurityProviderException, IOException, TransportException {
// arrange
IotHubAuthenticationProvider authentication = new IotHubX509HardwareAuthenticationProvider(hostname, gatewayHostname, deviceId, moduleId, mockSecurityProviderX509);
new NonStrictExpectations() {
{
mockSecurityProviderX509.getSSLContext();
result = new SecurityProviderException("");
}
};
// act
authentication.getSSLContext();
}
use of com.microsoft.azure.sdk.iot.device.auth.IotHubX509HardwareAuthenticationProvider in project azure-iot-sdk-java by Azure.
the class IotHubX509HardwareIotHubAuthenticationProviderTest method setPathToCertificateThrows.
// Tests_SRS_IOTHUBX509HARDWAREAUTHENTICATION_34_006: [This function shall throw an UnsupportedOperationException.]
@Test(expected = UnsupportedOperationException.class)
public void setPathToCertificateThrows() {
// arrange
IotHubAuthenticationProvider auth = new IotHubX509HardwareAuthenticationProvider(hostname, gatewayHostname, deviceId, moduleId, mockSecurityProviderX509);
// act
auth.setPathToIotHubTrustedCert("any string");
}
use of com.microsoft.azure.sdk.iot.device.auth.IotHubX509HardwareAuthenticationProvider in project azure-iot-sdk-java by Azure.
the class IotHubX509HardwareIotHubAuthenticationProviderTest method constructorSuccess.
// Tests_SRS_IOTHUBX509HARDWAREAUTHENTICATION_34_001: [This function shall save the provided security provider.]
@Test
public void constructorSuccess() {
// act
IotHubAuthenticationProvider authentication = new IotHubX509HardwareAuthenticationProvider(hostname, gatewayHostname, deviceId, moduleId, mockSecurityProviderX509);
// assert
SecurityProvider actualSecurityProvider = Deencapsulation.getField(authentication, "securityProviderX509");
assertEquals(mockSecurityProviderX509, actualSecurityProvider);
}
use of com.microsoft.azure.sdk.iot.device.auth.IotHubX509HardwareAuthenticationProvider in project azure-iot-sdk-java by Azure.
the class IotHubX509HardwareIotHubAuthenticationProviderTest method cannotSetNewDefaultCertIfConstructedWithSSLContext.
// Tests_SRS_IOTHUBX509AUTHENTICATION_34_033: [If this object was created using a constructor that takes an SSLContext, this function shall throw an UnsupportedOperationException.]
@Test(expected = UnsupportedOperationException.class)
public void cannotSetNewDefaultCertIfConstructedWithSSLContext() {
// arrange
IotHubAuthenticationProvider authentication = new IotHubX509HardwareAuthenticationProvider(hostname, gatewayHostname, deviceId, moduleId, mockSecurityProviderX509);
// act
authentication.setIotHubTrustedCert("any string");
}
use of com.microsoft.azure.sdk.iot.device.auth.IotHubX509HardwareAuthenticationProvider in project azure-iot-sdk-java by Azure.
the class IotHubX509HardwareIotHubAuthenticationProviderTest method setCertificateThrows.
// Tests_SRS_IOTHUBX509HARDWAREAUTHENTICATION_34_007: [This function shall throw an UnsupportedOperationException.]
@Test(expected = UnsupportedOperationException.class)
public void setCertificateThrows() {
// arrange
IotHubAuthenticationProvider auth = new IotHubX509HardwareAuthenticationProvider(hostname, gatewayHostname, deviceId, moduleId, mockSecurityProviderX509);
// act
auth.setIotHubTrustedCert("any string");
}
Aggregations