public void onConfigUpdate(@Observes final RuleConfigUpdated configUpdated) { if (configUpdated != null && configUpdated.getContainerSpecKey() != null && configUpdated.getContainerSpecKey().equals(containerSpec)) { setup(containerSpec, configUpdated.getRuleConfig()); } else { logger.warn("Illegal event argument."); } }
public void onRuleConfigUpdate(@Observes final RuleConfigUpdated configUpdate) { if (configUpdate != null && configUpdate.getRuleConfig() != null && configUpdate.getReleasedId() != null) { setRuleConfig(configUpdate.getRuleConfig(), configUpdate.getReleasedId().getVersion()); } else { logger.warn("Illegal event argument."); } }
@Test public void testOnConfigUpdate() { final RuleConfigUpdated ruleConfigUpdated = new RuleConfigUpdated(); ruleConfigUpdated.setContainerSpecKey(containerSpec); ruleConfigUpdated.setRuleConfig(ruleConfig); presenter.setup(containerSpec, ruleConfig); presenter.onConfigUpdate(ruleConfigUpdated); verify(view, times(2)).setContent(anyString(), anyString(), any(State.class), any(State.class), any(State.class), any(State.class)); }
@Test public void testOnRuleConfigUpdate() { final RuleConfigUpdated ruleConfigUpdated = new RuleConfigUpdated(); ruleConfigUpdated.setRuleConfig(ruleConfig); ruleConfigUpdated.setReleasedId(releaseId); final Long poolInterval = 1l; when(ruleConfig.getPollInterval()).thenReturn(poolInterval); presenter.onRuleConfigUpdate(ruleConfigUpdated); verify(view).setContent(eq(String.valueOf(poolInterval)), anyString(), any(State.class), any(State.class), any(State.class), any(State.class)); }
@Test public void testOnConfigUpdateNoUpdate() { final RuleConfigUpdated ruleConfigUpdated = new RuleConfigUpdated(); ruleConfigUpdated.setContainerSpecKey(new ContainerSpecKey()); ruleConfigUpdated.setRuleConfig(new RuleConfig()); presenter.setup(containerSpec, ruleConfig); presenter.onConfigUpdate(ruleConfigUpdated); verify(view).setContent(anyString(), anyString(), any(State.class), any(State.class), any(State.class), any(State.class)); }