From 824257d3684a4d73895fbf6fd124ea815277c3f6 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Thu, 29 Jan 2026 22:38:41 -0500 Subject: [PATCH] fix test --- .../com/cloud/utils/db/GenericDaoBase.java | 4 +-- .../vmware/VmwareDatacenterApiUnitTest.java | 26 +++++-------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java index 535fa032d23..fedc7d7cd7a 100644 --- a/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java +++ b/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java @@ -2061,8 +2061,8 @@ public abstract class GenericDaoBase extends Compone } } if(attr == null) { - logger.warn(String.format("Failed to find attribute in the entity %s to map column %s.%s (%s)", - ClassUtils.getUserClass(entity).getSimpleName(), tableName, columnName)); + logger.warn("Failed to find attribute in the entity {} to map column {}.{}", + ClassUtils.getUserClass(entity).getSimpleName(), tableName, columnName); } else { setField(entity, attr.field, rs, index); } diff --git a/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java b/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java index ca29b94878b..d72522d3a79 100644 --- a/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java +++ b/plugins/hypervisors/vmware/src/test/java/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java @@ -240,17 +240,13 @@ public class VmwareDatacenterApiUnitTest { closeable.close(); } - //@Test(expected = InvalidParameterValueException.class) - @Test - @Ignore + @Test(expected = InvalidParameterValueException.class) public void testAddVmwareDcToInvalidZone() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(addCmd.getZoneId()).thenReturn(2L); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } - //@Test(expected = ResourceInUseException.class) - @Test - @Ignore + @Test(expected = ResourceInUseException.class) public void testAddVmwareDcToZoneWithClusters() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(_clusterDao.listByZoneId(1L)).thenReturn(clusterList); _vmwareDatacenterService.addVmwareDatacenter(addCmd); @@ -269,47 +265,37 @@ public class VmwareDatacenterApiUnitTest { } //@Test(expected = ResourceInUseException.class) - @Test @Ignore public void testAddVmwareDcToZoneWithVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(_vmwareDcDao.getVmwareDatacenterByNameAndVcenter(vmwareDcName, vCenterHost)).thenReturn(vmwareDcs); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } - //@Test(expected = InvalidParameterValueException.class) - @Test - @Ignore + @Test(expected = InvalidParameterValueException.class) public void testAddVmwareDcWithNullUser() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(addCmd.getUsername()).thenReturn(null); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } - //@Test(expected = InvalidParameterValueException.class) - @Test - @Ignore + @Test(expected = InvalidParameterValueException.class) public void testAddVmwareDcWithNullPassword() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(addCmd.getPassword()).thenReturn(null); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } - //@Test(expected = InvalidParameterValueException.class) - @Test - @Ignore + @Test(expected = InvalidParameterValueException.class) public void testAddVmwareDcWithNullUrl() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(addCmd.getVcenter()).thenReturn(null); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } - //@Test(expected = InvalidParameterValueException.class) - @Test - @Ignore + @Test(expected = InvalidParameterValueException.class) public void testAddVmwareDcWithNullDcName() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(addCmd.getName()).thenReturn(null); _vmwareDatacenterService.addVmwareDatacenter(addCmd); } //@Test(expected = CloudRuntimeException.class) - @Test @Ignore public void testReAddVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception { Mockito.when(_vmwareDcZoneMapDao.findByZoneId(1L)).thenReturn(dcZoneMap);