fix test issues identified by errorprone

This commit is contained in:
Pearl Dsilva 2026-01-13 20:01:18 -05:00
parent f42149960e
commit 4d5f819413
21 changed files with 70 additions and 72 deletions

View File

@ -182,36 +182,36 @@ public class ServerResourceBaseTest {
@Test
public void defineResourceNetworkInterfacesTestUseXenbr0WhenPrivateNetworkInterfaceNotConfigured() {
Map<String, Object> params = createParamsMap(null, "cloudbr1", "cloudbr2", "cloudbr3");
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
verifyAndAssertNetworkInterfaces("xenbr0", "cloudbr1", "cloudbr2", "cloudbr3");
verifyAndAssertNetworkInterfaces(mockedNetUtils, "xenbr0", "cloudbr1", "cloudbr2", "cloudbr3");
}
}
@Test
public void defineResourceNetworkInterfacesTestUseXenbr1WhenPublicNetworkInterfaceNotConfigured() {
Map<String, Object> params = createParamsMap("cloudbr0", null, "cloudbr2", "cloudbr3");
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
verifyAndAssertNetworkInterfaces("cloudbr0", "xenbr1", "cloudbr2", "cloudbr3");
verifyAndAssertNetworkInterfaces(mockedNetUtils, "cloudbr0", "xenbr1", "cloudbr2", "cloudbr3");
}
}
@Test
public void defineResourceNetworkInterfacesTestUseConfiguredNetworkInterfaces() {
Map<String, Object> params = createParamsMap("cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
verifyAndAssertNetworkInterfaces("cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
verifyAndAssertNetworkInterfaces(mockedNetUtils, "cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
}
}
@ -224,9 +224,8 @@ public class ServerResourceBaseTest {
return result;
}
private void verifyAndAssertNetworkInterfaces(String... expectedResults) {
Mockito.verify(NetUtils.class, Mockito.times(4));
NetUtils.getNetworkInterface(keyCaptor.capture());
private void verifyAndAssertNetworkInterfaces(MockedStatic<NetUtils> mockedNetUtils, String... expectedResults) {
mockedNetUtils.verify(() -> NetUtils.getNetworkInterface(keyCaptor.capture()), Mockito.times(4));
List<String> keys = keyCaptor.getAllValues();
for (int i = 0; i < expectedResults.length; i++) {

View File

@ -40,6 +40,7 @@ import org.apache.logging.log4j.LogManager;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import com.google.common.io.Files;
@ -248,6 +249,7 @@ public class HypervDirectConnectResourceTest {
Assert.assertTrue(ans.getDetails(), ans.getResult());
}
@Ignore
public final void testStartupCommand() {
StartupRoutingCommand defaultStartRoutCmd =
new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.Hyperv, RouterPrivateIpStrategy.HostLocal);
@ -278,6 +280,7 @@ public class HypervDirectConnectResourceTest {
}
// @Test
@Ignore
public final void testJson() {
StartupStorageCommand sscmd = null;
com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo("test123", "192.168.0.1", "c:\\", "c:\\", StoragePoolType.Filesystem, 100L, 50L);

View File

@ -65,7 +65,7 @@ public class ConnectionTest extends Connection {
logger.debug("methodresponse call: " + method + " - " + params);
logger.trace("methodresponse reply: " + result);
}
if (result == null && multiRes.size() >= 0) {
if (result == null && !multiRes.isEmpty()) {
result = getResult();
logger.debug("getresult call: " + method + " - " + params);
logger.trace("getresult reply: " + result);

View File

@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
public class NtpTest {
@ -42,6 +43,7 @@ public class NtpTest {
+ "</data>\n"
+ "</array>\n");
@Ignore
public void testGetNtp() throws Ovm3ResourceException {
con.setResult(results.getNil());
results.basicBooleanTest(nTp.getDetails());

View File

@ -231,7 +231,6 @@ public class BrocadeVcsGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
@ -291,7 +290,6 @@ public class BrocadeVcsGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");

View File

@ -180,7 +180,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT", "VXLAN"}));
when(physnet.getId()).thenReturn(NETWORK_ID);
mock(NiciraNvpDeviceVO.class);
when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
final NetworkOffering offering = mock(NetworkOffering.class);
@ -203,7 +202,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"VLAN"}));
when(physnet.getId()).thenReturn(NETWORK_ID);
mock(NiciraNvpDeviceVO.class);
when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
final NetworkOffering offering = mock(NetworkOffering.class);
@ -263,7 +261,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
@ -318,7 +315,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
@ -377,7 +373,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
@ -432,7 +427,6 @@ public class NiciraNvpGuestNetworkGuruTest {
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
final NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");

View File

@ -273,8 +273,6 @@ public class NiciraNvpApiIT {
}
}
UUID.randomUUID().toString();
// Test CRUD for Nat Rules
SourceNatRule snr = new SourceNatRule();
snr.setToSourceIpAddressMin("192.168.10.10");

View File

@ -34,6 +34,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@ -136,6 +137,7 @@ public class LdapDirectoryServerConnectionTest {
}
// @Test
@Ignore
public void testEmbeddedLdapAvailable() {
try {
List<LdapUser> usahs = ldapManager.getUsers(1L);
@ -157,6 +159,7 @@ public class LdapDirectoryServerConnectionTest {
}
// @Test
@Ignore
public void testUserCreation() {
LdapConnection connection = new LdapNetworkConnection( "localhost", 10389 );
try {

View File

@ -68,6 +68,7 @@ public class LdapUnboundidZapdotConnectionTest {
}
@Test
@SuppressWarnings("BanJNDI")
public void testDirContext() throws Exception {
// Test using the good ol' JDNI-LDAP integration
@ -78,7 +79,9 @@ public class LdapUnboundidZapdotConnectionTest {
dirContext.search(DOMAIN_DSN, "(objectClass=person)", searchControls);
assertEquals(24, Iterators.size(Iterators.forEnumeration(resultNamingEnumeration)));
}
@Test
@SuppressWarnings("BanJNDI")
public void testContext() throws Exception {
// Another test using the good ol' JDNI-LDAP integration, this time with the Context interface

View File

@ -456,6 +456,7 @@ public class QueryManagerImplTest {
Assert.assertTrue(CollectionUtils.isNotEmpty(result));
}
@Test
public void testListAffectedVmsForScopeChange() {
Long clusterId = 1L;
Long poolId = 2L;

View File

@ -449,6 +449,7 @@ public class ConfigurationManagerImplTest {
Assert.assertNotNull(offering);
}
@Test
public void testValidateInvalidConfiguration() {
Mockito.doReturn(null).when(configDao).findByName(Mockito.anyString());
String msg = configurationManagerImplSpy.validateConfigurationValue("test.config.name", "testvalue", ConfigKey.Scope.Global.toString());

View File

@ -553,9 +553,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void passEncRootProvidedHostSupportingEncryptionTest() {
HostVO host = new HostVO("host");
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "true");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
host.setDetails(hostDetails);
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
@ -578,9 +577,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void failEncRootProvidedHostNotSupportingEncryptionTest() {
HostVO host = new HostVO("host");
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "false");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
host.setDetails(hostDetails);
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
@ -603,9 +601,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void passNoEncRootProvidedHostNotSupportingEncryptionTest() {
HostVO host = new HostVO("host");
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "false");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
host.setDetails(hostDetails);
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
@ -627,9 +624,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void passNoEncRootProvidedHostSupportingEncryptionTest() {
HostVO host = new HostVO("host");
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "true");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
host.setDetails(hostDetails);
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
@ -651,9 +647,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void passEncRootLastHostSupportingEncryptionTest() {
HostVO host = Mockito.spy(new HostVO("host"));
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "true");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
host.setDetails(hostDetails);
Mockito.when(host.getStatus()).thenReturn(Status.Up);
@ -681,9 +676,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void failEncRootLastHostNotSupportingEncryptionTest() {
HostVO host = Mockito.spy(new HostVO("host"));
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "false");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
host.setDetails(hostDetails);
Mockito.when(host.getStatus()).thenReturn(Status.Up);
@ -707,9 +701,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void passEncRootPlannerHostSupportingEncryptionTest() {
HostVO host = Mockito.spy(new HostVO("host"));
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "true");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
host.setDetails(hostDetails);
Mockito.when(host.getStatus()).thenReturn(Status.Up);
@ -732,9 +725,8 @@ public class DeploymentPlanningManagerImplTest {
@Test
public void failEncRootPlannerHostSupportingEncryptionTest() {
HostVO host = Mockito.spy(new HostVO("host"));
Map<String, String> hostDetails = new HashMap<>() {{
put(Host.HOST_VOLUME_ENCRYPTION, "false");
}};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
host.setDetails(hostDetails);
Mockito.when(host.getStatus()).thenReturn(Status.Up);
@ -758,11 +750,8 @@ public class DeploymentPlanningManagerImplTest {
public void findSuitablePoolsForVolumesTest() throws Exception {
Long diskOfferingId = 1L;
HostVO host = Mockito.spy(new HostVO("host"));
Map<String, String> hostDetails = new HashMap<>() {
{
put(Host.HOST_VOLUME_ENCRYPTION, "true");
}
};
Map<String, String> hostDetails = new HashMap<>();
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
host.setDetails(hostDetails);
Mockito.when(host.getStatus()).thenReturn(Status.Up);
@ -851,9 +840,8 @@ public class DeploymentPlanningManagerImplTest {
StoragePool pool = new StoragePoolVO();
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<>() {{
put(vol1, List.of(pool));
}};
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<>();
suitableVolumeStoragePools.put(vol1, List.of(pool));
Pair<Map<Volume, List<StoragePool>>, List<Volume>> suitable = new Pair<>(suitableVolumeStoragePools, volumes);
@ -881,9 +869,8 @@ public class DeploymentPlanningManagerImplTest {
ArgumentMatchers.anyInt()
);
Map<Volume, StoragePool> suitableVolumeStoragePoolMap = new HashMap<>() {{
put(vol1, pool);
}};
Map<Volume, StoragePool> suitableVolumeStoragePoolMap = new HashMap<>();
suitableVolumeStoragePoolMap.put(vol1, pool);
Mockito.doReturn(true).when(_dpm).hostCanAccessSPool(ArgumentMatchers.any(Host.class), ArgumentMatchers.any(StoragePool.class));
Pair<Host, Map<Volume, StoragePool>> potentialResources = new Pair<>(host, suitableVolumeStoragePoolMap);

View File

@ -417,7 +417,10 @@ public class AutoScaleManagerImplTest {
when(asPolicyDao.persist(any(AutoScalePolicyVO.class))).thenReturn(asScaleUpPolicyMock);
userDataDetails.put("0", new HashMap<>() {{ put("key1", "value1"); put("key2", "value2"); }});
HashMap<String, String> userDataMap = new HashMap<>();
userDataMap.put("key1", "value1");
userDataMap.put("key2", "value2");
userDataDetails.put("0", userDataMap);
Mockito.doReturn(userDataFinal).when(userVmMgr).finalizeUserData(any(), any(), any());
Mockito.doReturn(userDataFinal).when(userDataMgr).validateUserData(eq(userDataFinal), nullable(BaseCmd.HTTPMethod.class));
}

View File

@ -58,6 +58,7 @@ import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@ -255,6 +256,7 @@ public class HypervisorTemplateAdapterTest {
}
//@Test
@Ignore
public void testEmitDeleteEventUuid() throws InterruptedException, ExecutionException {
//All the mocks required for this test to work.
ImageStoreEntity store = mock(ImageStoreEntity.class);

View File

@ -106,6 +106,7 @@ import org.apache.cloudstack.test.utils.SpringUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
@ -251,6 +252,7 @@ public class TemplateManagerImplTest {
templateManager.verifyTemplateId(1L);
}
@Ignore
public void testVerifyTemplateIdOfNonSystemTemplate() {
templateManager.verifyTemplateId(1L);
}

View File

@ -319,11 +319,10 @@ public class DomainManagerImplTest {
@Test
public void validateNetworkDomainTestNullNetworkDomainDoesNotCallVerifyDomainName() {
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
Mockito.when(NetUtils.verifyDomainName(Mockito.anyString())).thenReturn(true);
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
mockedNetUtils.when(() -> NetUtils.verifyDomainName(Mockito.anyString())).thenReturn(true);
domainManager.validateNetworkDomain(null);
Mockito.verify(NetUtils.class, Mockito.never());
NetUtils.verifyDomainName(Mockito.anyString());
mockedNetUtils.verify(() -> NetUtils.verifyDomainName(Mockito.anyString()), Mockito.never());
}
}

View File

@ -1677,6 +1677,7 @@ public class UserVmManagerImplTest {
userVmManagerImpl.validateStrictHostTagCheck(vm, destinationHostVO);
}
@Test
public void testGetRootVolumeSizeForVmRestore() {
VMTemplateVO template = Mockito.mock(VMTemplateVO.class);
Mockito.when(template.getSize()).thenReturn(10L * GiB_TO_BYTES);

View File

@ -81,6 +81,7 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@ -348,6 +349,7 @@ public class UserVmManagerTest {
// Test scaleVm for Stopped vm.
//@Test(expected=InvalidParameterValueException.class)
@Ignore
public void testScaleVMF3() throws Exception {
ScaleVMCmd cmd = new ScaleVMCmd();
@ -389,6 +391,7 @@ public class UserVmManagerTest {
}
// Test scaleVm for Running vm. Full positive test.
@Ignore
public void testScaleVMF4() throws Exception {
ScaleVMCmd cmd = new ScaleVMCmd();

View File

@ -384,10 +384,9 @@ public class VMSnapshotManagerTest {
@Test
public void testUpgradeUserVmServiceOffering() throws ConcurrentOperationException, ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException {
Map<String, String> details = new HashMap<String, String>() {{
put(userVmDetailCpuNumber.getName(), userVmDetailCpuNumber.getValue());
put(userVmDetailMemory.getName(), userVmDetailMemory.getValue());
}};
Map<String, String> details = new HashMap<>();
details.put(userVmDetailCpuNumber.getName(), userVmDetailCpuNumber.getValue());
details.put(userVmDetailMemory.getName(), userVmDetailMemory.getValue());
when(_userVmManager.upgradeVirtualMachine(TEST_VM_ID, SERVICE_OFFERING_ID, details)).thenReturn(true);
_vmSnapshotMgr.upgradeUserVmServiceOffering(userVm, SERVICE_OFFERING_ID, details);

View File

@ -155,7 +155,7 @@ public class RouterDeploymentDefinitionTest extends RouterDeploymentDefinitionTe
// Assert
verify(mockNwDao, times(1)).acquireInLockTable(NW_ID_1, 600);
assertNotNull(LOCK_NOT_CORRECTLY_GOT, deployment.tableLockId);
assertEquals(LOCK_NOT_CORRECTLY_GOT, NW_ID_1, NW_ID_1, deployment.tableLockId.longValue());
assertEquals(LOCK_NOT_CORRECTLY_GOT, NW_ID_1, deployment.tableLockId);
}
@Test(expected = ConcurrentOperationException.class)

View File

@ -870,7 +870,7 @@ public class HypervisorHostHelper {
private static boolean areBoolPoliciesDifferent(BoolPolicy currentPolicy, BoolPolicy newPolicy) {
return eitherObjectNull(currentPolicy, newPolicy) ||
(newPolicy != null && newPolicy.isValue() != currentPolicy.isValue());
(newPolicy != null && !newPolicy.isValue().equals(currentPolicy.isValue()));
}
private static boolean areDVSSecurityPoliciesDifferent(DVSSecurityPolicy currentSecurityPolicy, DVSSecurityPolicy newSecurityPolicy) {
@ -889,9 +889,9 @@ public class HypervisorHostHelper {
private static boolean areDVSMacManagementPoliciesDifferent(DVSMacManagementPolicy currentMacManagementPolicy, DVSMacManagementPolicy newMacManagementPolicy) {
return eitherObjectNull(currentMacManagementPolicy, newMacManagementPolicy) ||
(newMacManagementPolicy != null &&
(currentMacManagementPolicy.isAllowPromiscuous() != newMacManagementPolicy.isAllowPromiscuous() ||
currentMacManagementPolicy.isForgedTransmits() != newMacManagementPolicy.isForgedTransmits() ||
currentMacManagementPolicy.isMacChanges() != newMacManagementPolicy.isMacChanges() ||
(!currentMacManagementPolicy.isAllowPromiscuous().equals(newMacManagementPolicy.isAllowPromiscuous()) ||
!currentMacManagementPolicy.isForgedTransmits().equals(newMacManagementPolicy.isForgedTransmits()) ||
!currentMacManagementPolicy.isMacChanges().equals(newMacManagementPolicy.isMacChanges()) ||
areDVSMacLearningPoliciesDifferent(currentMacManagementPolicy.getMacLearningPolicy(), newMacManagementPolicy.getMacLearningPolicy())));
}