Search in sources :

Example 6 with X509ThumbprintParser

use of com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser in project azure-iot-sdk-java by Azure.

the class X509ThumbprintParserTest method testToJson.

// Tests_SRS_X509ThumbprintParser_34_007: [This method shall return a json representation of this.]
@Test
public void testToJson() {
    // arrange
    String expectedJson = "{\"primaryThumbprint\":\"" + SAMPLE_THUMBPRINT1 + "\",\"secondaryThumbprint\":\"" + SAMPLE_THUMBPRINT2 + "\"}";
    X509ThumbprintParser parser = new X509ThumbprintParser(SAMPLE_THUMBPRINT1, SAMPLE_THUMBPRINT2);
    // act
    String actualJson = parser.toJson();
    // assert
    assertEquals(expectedJson, actualJson);
}
Also used : X509ThumbprintParser(com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser) Test(org.junit.Test)

Example 7 with X509ThumbprintParser

use of com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser in project azure-iot-sdk-java by Azure.

the class X509ThumbprintParserTest method testFromJson.

// Tests_SRS_X509ThumbprintParser_34_009: [The parser shall create and return an instance of a X509ThumbprintParser object based off the provided json.]
@Test
public void testFromJson() {
    // arrange
    String json = "{\"primaryThumbprint\":\"" + SAMPLE_THUMBPRINT1 + "\",\"secondaryThumbprint\":\"" + SAMPLE_THUMBPRINT2 + "\"}";
    // act
    X509ThumbprintParser parser = new X509ThumbprintParser(json);
    // assert
    String actualPrimaryThumbprint = Deencapsulation.getField(parser, "primaryThumbprint");
    String actualSecondaryThumbprint = Deencapsulation.getField(parser, "secondaryThumbprint");
    assertEquals(SAMPLE_THUMBPRINT1, actualPrimaryThumbprint);
    assertEquals(SAMPLE_THUMBPRINT2, actualSecondaryThumbprint);
}
Also used : X509ThumbprintParser(com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser) Test(org.junit.Test)

Aggregations

X509ThumbprintParser (com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser)7 Test (org.junit.Test)5 AuthenticationParser (com.microsoft.azure.sdk.iot.deps.serializer.AuthenticationParser)3 ExportImportDeviceParser (com.microsoft.azure.sdk.iot.deps.serializer.ExportImportDeviceParser)2 SymmetricKeyParser (com.microsoft.azure.sdk.iot.deps.serializer.SymmetricKeyParser)2 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 Device (com.microsoft.azure.sdk.iot.service.Device)1 Module (com.microsoft.azure.sdk.iot.service.Module)1