// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.models.Autoscale;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.VirtualNetworkProfile;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ComputeProfileTests {
    @Test
    public void testDeserialize() {
        ComputeProfile model =
            BinaryData
                .fromString(
                    "{\"roles\":[{\"name\":\"vyevcciqi\",\"minInstanceCount\":720964194,\"targetInstanceCount\":1574404612,\"VMGroupName\":\"bwjzr\",\"autoscale\":{},\"hardwareProfile\":{\"vmSize\":\"ispe\"},\"osProfile\":{},\"virtualNetworkProfile\":{\"id\":\"kufubljo\",\"subnet\":\"qeof\"},\"dataDisksGroups\":[],\"scriptActions\":[],\"encryptDataDisks\":false}]}")
                .toObject(ComputeProfile.class);
        Assertions.assertEquals("vyevcciqi", model.roles().get(0).name());
        Assertions.assertEquals(720964194, model.roles().get(0).minInstanceCount());
        Assertions.assertEquals(1574404612, model.roles().get(0).targetInstanceCount());
        Assertions.assertEquals("bwjzr", model.roles().get(0).vMGroupName());
        Assertions.assertEquals("ispe", model.roles().get(0).hardwareProfile().vmSize());
        Assertions.assertEquals("kufubljo", model.roles().get(0).virtualNetworkProfile().id());
        Assertions.assertEquals("qeof", model.roles().get(0).virtualNetworkProfile().subnet());
        Assertions.assertEquals(false, model.roles().get(0).encryptDataDisks());
    }

    @Test
    public void testSerialize() {
        ComputeProfile model =
            new ComputeProfile()
                .withRoles(
                    Arrays
                        .asList(
                            new Role()
                                .withName("vyevcciqi")
                                .withMinInstanceCount(720964194)
                                .withTargetInstanceCount(1574404612)
                                .withVMGroupName("bwjzr")
                                .withAutoscaleConfiguration(new Autoscale())
                                .withHardwareProfile(new HardwareProfile().withVmSize("ispe"))
                                .withOsProfile(new OsProfile())
                                .withVirtualNetworkProfile(
                                    new VirtualNetworkProfile().withId("kufubljo").withSubnet("qeof"))
                                .withDataDisksGroups(Arrays.asList())
                                .withScriptActions(Arrays.asList())
                                .withEncryptDataDisks(false)));
        model = BinaryData.fromObject(model).toObject(ComputeProfile.class);
        Assertions.assertEquals("vyevcciqi", model.roles().get(0).name());
        Assertions.assertEquals(720964194, model.roles().get(0).minInstanceCount());
        Assertions.assertEquals(1574404612, model.roles().get(0).targetInstanceCount());
        Assertions.assertEquals("bwjzr", model.roles().get(0).vMGroupName());
        Assertions.assertEquals("ispe", model.roles().get(0).hardwareProfile().vmSize());
        Assertions.assertEquals("kufubljo", model.roles().get(0).virtualNetworkProfile().id());
        Assertions.assertEquals("qeof", model.roles().get(0).virtualNetworkProfile().subnet());
        Assertions.assertEquals(false, model.roles().get(0).encryptDataDisks());
    }
}
