@Test public void enableNewAddtionalFeatureWhenHostSupports() { createCommandWithAddtionalFeature(); when(clusterDao.get(any(Guid.class))).thenReturn(createClusterWithNoCpuName()); when(clusterDao.getByName(anyString())).thenReturn(createClusterWithNoCpuName()); cpuExists(); cpuFlagsNotMissing(); allQueriesForVms(); clusterHasVds(); when(clusterFeatureDao.getSupportedFeaturesByClusterId(any(Guid.class))) .thenReturn(Collections.EMPTY_SET); when(hostFeatureDao.getSupportedHostFeaturesByHostId(any(Guid.class))) .thenReturn(new HashSet(Arrays.asList("TEST_FEATURE"))); assertTrue(cmd.validate()); }
@Test public void enableNewAddtionalFeatureWhenHostDoesnotSupport() { createCommandWithAddtionalFeature(); when(clusterDao.get(any(Guid.class))).thenReturn(createClusterWithNoCpuName()); when(clusterDao.getByName(anyString())).thenReturn(createClusterWithNoCpuName()); cpuExists(); cpuFlagsNotMissing(); allQueriesForVms(); clusterHasVds(); when(clusterFeatureDao.getSupportedFeaturesByClusterId(any(Guid.class))) .thenReturn(Collections.EMPTY_SET); when(hostFeatureDao.getSupportedHostFeaturesByHostId(any(Guid.class))) .thenReturn(Collections.EMPTY_SET); validateFailedWithReason( EngineMessage.CLUSTER_CANNOT_UPDATE_SUPPORTED_FEATURES_WITH_LOWER_HOSTS); }