Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -42,14 +43,14 @@ public class AutoScaleVmProfileVOTest {
public void testCounterParamsForUpdate() {
AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO();

Map<String, HashMap<String, String>> 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<String, LinkedHashMap<String, String>> 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<Pair<String, String>> counterParams = profile.getCounterParams();

List<Pair<String, String>> counterParams = profile.getCounterParams();
Assert.assertEquals(2, counterParams.size());
Assert.assertEquals("snmpcommunity", counterParams.get(0).first());
Assert.assertEquals("public", counterParams.get(0).second());
Expand All @@ -69,10 +70,17 @@ public void tstSetOtherDeployParamsForUpdate() {

List<Pair<String, String>> 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<Pair<String, String>> list, String key, String value) {
for (Pair<String, String> pair : list) {
if (key.equals(pair.first()) && value.equals(pair.second())) {
return true;
}
}
return false;
}

@Test
Expand Down