Search in sources :

Example 6 with ConfigurationContent

use of com.microsoft.azure.sdk.iot.service.ConfigurationContent in project azure-iot-sdk-java by Azure.

the class ConfigurationContentTest method ToParserSuccess.

// Tests_SRS_SERVICE_SDK_JAVA_CONFIGURATION_CONTENT_34_003: [This function shall return a configuration parser instance with the same modules content and device content as this object.]
@Test
public void ToParserSuccess() {
    // arrange
    Map<String, Map<String, Object>> mc = new HashMap<String, Map<String, Object>>() {

        {
            put("mproperty", new HashMap<String, Object>() {

                {
                    put("abc", "123");
                    put("cde", "456");
                }
            });
        }
    };
    Map<String, Object> dc = new HashMap<String, Object>() {

        {
            put("dproperty", new HashMap<String, Integer>() {

                {
                    put("c", 3);
                    put("d", 4);
                }
            });
        }
    };
    ConfigurationContent cc = new ConfigurationContent();
    // act
    ConfigurationContentParser parser = cc.toConfigurationContentParser();
    // assert
    assertEquals(cc.getDeviceContent(), parser.getDeviceContent());
    assertEquals(cc.getModulesContent(), parser.getModulesContent());
}
Also used : HashMap(java.util.HashMap) ConfigurationContent(com.microsoft.azure.sdk.iot.service.ConfigurationContent) Map(java.util.Map) HashMap(java.util.HashMap) ConfigurationContentParser(com.microsoft.azure.sdk.iot.deps.serializer.ConfigurationContentParser) Test(org.junit.Test)

Aggregations

ConfigurationContent (com.microsoft.azure.sdk.iot.service.ConfigurationContent)6 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 Configuration (com.microsoft.azure.sdk.iot.service.Configuration)2 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)2 Map (java.util.Map)2 IntegrationTest (tests.integration.com.microsoft.azure.sdk.iot.helpers.IntegrationTest)2 ContinuousIntegrationTest (tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations.ContinuousIntegrationTest)2 IotHubTest (tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations.IotHubTest)2 StandardTierHubOnlyTest (tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations.StandardTierHubOnlyTest)2 ConfigurationContentParser (com.microsoft.azure.sdk.iot.deps.serializer.ConfigurationContentParser)1 Device (com.microsoft.azure.sdk.iot.service.Device)1 RegistryManager (com.microsoft.azure.sdk.iot.service.RegistryManager)1 IotHubBadFormatException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubBadFormatException)1 IotHubException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubException)1 IOException (java.io.IOException)1