public void testAppStoppedAndEntityNullBeforeStarting() { // AbstractApplication has default logic to ensure service is not up if it hasn't been started, // (this can be removed by updating the problem indicator associated with the SERVICE_STATE_ACTUAL sensor) assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, false); // and from that it imputes stopped state assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); // TestEntity has no such indicators however assertAttributeEquals(entity, Attributes.SERVICE_UP, null); assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, null); }
assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true); assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); ImmutableSet.<Lifecycle>of()); assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); assertAttributeEquals(app, Attributes.SERVICE_UP, true); assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true); assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertAttributeEquals(entity, Attributes.SERVICE_UP, true); assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
public void testAllUpAndRunningAfterStart() { app.start(ImmutableList.<Location>of()); assertAttributeEquals(app, Attributes.SERVICE_UP, true); assertAttributeEquals(entity, Attributes.SERVICE_UP, true); // above should be immediate, entity should then derive RUNNING from expected state, and then so should app from children assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); }
public void testStopsNicelyToo() { app.start(ImmutableList.<Location>of()); assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); app.stop(); assertAttributeEquals(app, Attributes.SERVICE_UP, false); assertAttributeEquals(entity, Attributes.SERVICE_UP, false); // above should be immediate, app and entity should then derive STOPPED from the expected state assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); }
assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, null); ServiceProblemsLogic.updateProblemsIndicator(entity, INDICATOR_KEY_1, "We're pretending to block service state also"); assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
public void testTwoIndicatorsAreBetterThanOne() { // if we set a not up indicator, entity service up should become false ServiceNotUpLogic.updateNotUpIndicator(entity, INDICATOR_KEY_1, "We're pretending to block service up"); assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); ServiceNotUpLogic.updateNotUpIndicator(entity, INDICATOR_KEY_2, "We're also pretending to block service up"); ServiceNotUpLogic.clearNotUpIndicator(entity, INDICATOR_KEY_1); // clearing one indicator is not sufficient assertAttributeEquals(entity, Attributes.SERVICE_UP, false); // but it does not become true when both are cleared ServiceNotUpLogic.clearNotUpIndicator(entity, INDICATOR_KEY_2); assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); }