ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(this, MASTER_NODE); return (BrooklynNode)Iterables.getOnlyElement(masters);
ServiceProblemsLogic.clearProblemsIndicator(this, "children"); buckets.put(name, bucket);
@Test(groups="Integration") // Has a 1 second wait public void testOnFailureDelayFromProblemAndRecover() throws Exception { e1.enrichers().add(EnricherSpec.create(ServiceFailureDetector.class) .configure(ServiceFailureDetector.SERVICE_ON_FIRE_STABILIZATION_DELAY, Duration.ONE_SECOND) .configure(ServiceFailureDetector.ENTITY_RECOVERED_STABILIZATION_DELAY, Duration.ONE_SECOND)); // Set the entity to healthy e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); EntityAsserts.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); // Make the entity fail; won't set on-fire for 1s but will publish FAILED immediately. ServiceStateLogic.ServiceProblemsLogic.updateProblemsIndicator(e1, "test", "foo"); EntityAsserts.assertAttributeEqualsContinually(ImmutableMap.of("timeout", 100), e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); assertEquals(e1.getAttribute(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING); EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // Now recover: will publish RUNNING immediately, but has 1s stabilisation for RECOVERED ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertEquals(events.size(), 1, "events="+events); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 2, "events="+events); }
ServiceProblemsLogic.clearProblemsIndicator(this, START); ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application starting"); ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(this, START.getName());
ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null);
ServiceProblemsLogic.clearProblemsIndicator(this, START); ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application starting"); ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(this, START.getName());
ServiceProblemsLogic.clearProblemsIndicator(entity, INDICATOR_KEY_1); assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
ServiceProblemsLogic.clearProblemsIndicator(this, START); try { doStart();
@Test public void testNotifiedOfRecoveryFromProblems() throws Exception { e1.enrichers().add(EnricherSpec.create(ServiceFailureDetector.class)); e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); // Make the entity fail ServiceProblemsLogic.updateProblemsIndicator(e1, "test", "foo"); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // And make the entity recover ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 2, "events="+events); EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); }
@Override public void update() { try { Task<?> task = updateAsync(); if (task != null) task.getUnchecked(); ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(this, "update"); } catch (Exception e) { ServiceStateLogic.ServiceProblemsLogic.updateProblemsIndicator(this, "update", "update failed with: "+Exceptions.collapseText(e)); throw Exceptions.propagate(e); } }
@Override public void update() { try { Task<?> task = updateAsync(); if (task != null) task.getUnchecked(); ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(this, "update"); } catch (Exception e) { ServiceStateLogic.ServiceProblemsLogic.updateProblemsIndicator(this, "update", "update failed with: "+Exceptions.collapseText(e)); throw Exceptions.propagate(e); } }