fix test identified by errorprone

This commit is contained in:
Pearl Dsilva 2026-01-13 17:21:38 -05:00
parent ff5902cceb
commit f42149960e
3 changed files with 19 additions and 5 deletions

View File

@ -19,7 +19,6 @@ package com.cloud.agent.manager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;

View File

@ -44,8 +44,15 @@ public class AutoScaleVmProfileVOTest {
AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO(); AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO();
Map<String, LinkedHashMap<String, String>> counterParamList = new LinkedHashMap<>(); Map<String, LinkedHashMap<String, String>> counterParamList = new LinkedHashMap<>();
counterParamList.put("0", new LinkedHashMap<>() {{ put("name", "snmpcommunity"); put("value", "public"); }}); LinkedHashMap<String, String> param0 = new LinkedHashMap<>();
counterParamList.put("1", new LinkedHashMap<>() {{ put("name", "snmpport"); put("value", "161"); }}); param0.put("name", "snmpcommunity");
param0.put("value", "public");
counterParamList.put("0", param0);
LinkedHashMap<String, String> param1 = new LinkedHashMap<>();
param1.put("name", "snmpport");
param1.put("value", "161");
counterParamList.put("1", param1);
profile.setCounterParamsForUpdate(counterParamList); profile.setCounterParamsForUpdate(counterParamList);
Assert.assertEquals("snmpcommunity=public&snmpport=161", profile.getCounterParamsString()); Assert.assertEquals("snmpcommunity=public&snmpport=161", profile.getCounterParamsString());
@ -63,8 +70,15 @@ public class AutoScaleVmProfileVOTest {
AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO(); AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO();
Map<String, HashMap<String, String>> otherDeployParamsMap = new HashMap<>(); Map<String, HashMap<String, String>> otherDeployParamsMap = new HashMap<>();
otherDeployParamsMap.put("0", new HashMap<>() {{ put("name", "serviceofferingid"); put("value", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926"); }}); HashMap<String, String> deployParam0 = new HashMap<>();
otherDeployParamsMap.put("1", new HashMap<>() {{ put("name", "rootdisksize"); put("value", "10"); }}); deployParam0.put("name", "serviceofferingid");
deployParam0.put("value", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926");
otherDeployParamsMap.put("0", deployParam0);
HashMap<String, String> deployParam1 = new HashMap<>();
deployParam1.put("name", "rootdisksize");
deployParam1.put("value", "10");
otherDeployParamsMap.put("1", deployParam1);
profile.setOtherDeployParamsForUpdate(otherDeployParamsMap); profile.setOtherDeployParamsForUpdate(otherDeployParamsMap);

View File

@ -363,6 +363,7 @@ public class SystemVmTemplateRegistrationTest {
systemVmTemplateRegistration.validateTemplates(list); systemVmTemplateRegistration.validateTemplates(list);
} }
@Test
public void testValidateTemplates_downloadableFileNotFound() { public void testValidateTemplates_downloadableFileNotFound() {
CPU.CPUArch arch = SystemVmTemplateRegistration.DOWNLOADABLE_TEMPLATE_ARCH_TYPES.get(0); CPU.CPUArch arch = SystemVmTemplateRegistration.DOWNLOADABLE_TEMPLATE_ARCH_TYPES.get(0);
List<Pair<Hypervisor.HypervisorType, CPU.CPUArch>> list = new ArrayList<>(); List<Pair<Hypervisor.HypervisorType, CPU.CPUArch>> list = new ArrayList<>();