DcIgnoredConfigListener extends AbstractHealthCheckConfigListener<String[]> { @Override protected void doOnChange(String[] oldValue, String[] newValue) { Pair<Set<String>, Set<String>> delAndAdd = getDiff(oldValue, newValue); for(String dcId : delAndAdd.getKey()) { metaChangeManager.startIfPossible(dcId); } for(String dcId : delAndAdd.getValue()) { metaChangeManager.ignore(dcId); } }  @Override List<String> supportsKeys();  }
@Test public void testDoOnChange() { listener.doOnChange(new String[]{"FRA-AWS"}, new String[]{"NULL"}); Mockito.verify(metaChangeManager, times(1)).startIfPossible("FRA-AWS"); Mockito.verify(metaChangeManager, times(1)).ignore("NULL"); }
@Test public void testDoOnChangeWithUpdateOnly() { listener.doOnChange(new String[]{}, new String[]{"FRA-AWS"}); Mockito.verify(metaChangeManager, times(1)).ignore("FRA-AWS"); Mockito.verify(metaChangeManager, Mockito.never()).startIfPossible(anyString()); }
@Test public void testDoOnChangeWithRemoveOldOnly() { listener.doOnChange(new String[]{"FRA-AWS"}, new String[]{}); Mockito.verify(metaChangeManager, Mockito.never()).ignore(anyString()); Mockito.verify(metaChangeManager, times(1)).startIfPossible(anyString()); }