@Test public void multiple_node_state_transitions_emit_multiple_node_state_events() { final EventFixture fixture = EventFixture.createForNodes(3) .clusterStateBefore("distributor:3 storage:3 .1.s:d") .clusterStateAfter("distributor:3 .2.s:d storage:3 .0.s:r"); final List<Event> events = fixture.computeEventDiff(); assertThat(events.size(), equalTo(3)); assertThat(events, hasItem(allOf( eventForNode(distributorNode(2)), nodeEventWithDescription("Altered node state in cluster state from 'U' to 'D'")))); assertThat(events, hasItem(allOf( eventForNode(storageNode(0)), nodeEventWithDescription("Altered node state in cluster state from 'U' to 'R'")))); assertThat(events, hasItem(allOf( eventForNode(storageNode(1)), nodeEventWithDescription("Altered node state in cluster state from 'D' to 'U'")))); }
public static List<Event> computeEventDiff(final Params params) { final List<Event> events = new ArrayList<>(); emitPerNodeDiffEvents(createBaselineParams(params), events); emitWholeClusterDiffEvent(createBaselineParams(params), events); emitDerivedBucketSpaceStatesDiffEvents(params, events); return events; }
EventDiffCalculator { public static List<Event> computeEventDiff(final Params params) { final List<Event> events = new ArrayList<>(); emitPerNodeDiffEvents(createBaselineParams(params), events); emitWholeClusterDiffEvent(createBaselineParams(params), events); emitDerivedBucketSpaceStatesDiffEvents(params, events); return events; } }
EventDiffCalculator { public static List<Event> computeEventDiff(final Params params) { final List<Event> events = new ArrayList<>(); emitPerNodeDiffEvents(createBaselineParams(params), events); emitWholeClusterDiffEvent(createBaselineParams(params), events); emitDerivedBucketSpaceStatesDiffEvents(params, events); return events; }  }
EventDiffCalculator { public static List<Event> computeEventDiff(final Params params) { final List<Event> events = new ArrayList<>(); emitPerNodeDiffEvents(createBaselineParams(params), events); emitWholeClusterDiffEvent(createBaselineParams(params), events); emitDerivedBucketSpaceStatesDiffEvents(params, events); return events; }  static Params params(); static List<Event> computeEventDiff(final Params params); }
EventDiffCalculator { public static List<Event> computeEventDiff(final Params params) { final List<Event> events = new ArrayList<>(); emitPerNodeDiffEvents(createBaselineParams(params), events); emitWholeClusterDiffEvent(createBaselineParams(params), events); emitDerivedBucketSpaceStatesDiffEvents(params, events); return events; }  static Params params(); static List<Event> computeEventDiff(final Params params);  }