diff --git a/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java b/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java index 7e9658e1dd3..6813a209157 100755 --- a/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java +++ b/engine/schema/src/test/java/com/cloud/network/as/AutoScaleVmProfileVOTest.java @@ -17,6 +17,7 @@ package com.cloud.network.as; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -42,14 +43,14 @@ public class AutoScaleVmProfileVOTest { public void testCounterParamsForUpdate() { AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO(); - Map> counterParamList = new HashMap<>(); - counterParamList.put("0", new HashMap<>() {{ put("name", "snmpcommunity"); put("value", "public"); }}); - counterParamList.put("1", new HashMap<>() {{ put("name", "snmpport"); put("value", "161"); }}); + Map> counterParamList = new LinkedHashMap<>(); + counterParamList.put("0", new LinkedHashMap<>() {{ put("name", "snmpcommunity"); put("value", "public"); }}); + counterParamList.put("1", new LinkedHashMap<>() {{ put("name", "snmpport"); put("value", "161"); }}); profile.setCounterParamsForUpdate(counterParamList); Assert.assertEquals("snmpcommunity=public&snmpport=161", profile.getCounterParamsString()); + List> counterParams = profile.getCounterParams(); - List> counterParams = profile.getCounterParams(); Assert.assertEquals(2, counterParams.size()); Assert.assertEquals("snmpcommunity", counterParams.get(0).first()); Assert.assertEquals("public", counterParams.get(0).second()); @@ -69,10 +70,17 @@ public class AutoScaleVmProfileVOTest { List> otherDeployParamsList = profile.getOtherDeployParamsList(); Assert.assertEquals(2, otherDeployParamsList.size()); - Assert.assertEquals("serviceofferingid", otherDeployParamsList.get(0).first()); - Assert.assertEquals("a7fb50f6-01d9-11ed-8bc1-77f8f0228926", otherDeployParamsList.get(0).second()); - Assert.assertEquals("rootdisksize", otherDeployParamsList.get(1).first()); - Assert.assertEquals("10", otherDeployParamsList.get(1).second()); + Assert.assertTrue(containsPair(otherDeployParamsList, "serviceofferingid", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926")); + Assert.assertTrue(containsPair(otherDeployParamsList, "rootdisksize", "10")); + } + + private boolean containsPair(List> list, String key, String value) { + for (Pair pair : list) { + if (key.equals(pair.first()) && value.equals(pair.second())) { + return true; + } + } + return false; } @Test