@Override
protected NodeStatusReporter newNodeStatusReporter() {
return new NodeStatusReporter() {
@Override
public synchronized NodeStatus computeStatus() {
return new NodeStatus(new ValidationResult[]{new ValidationResult("sample", Status.OK, "msg")}, new Date());
}
};
}
@Override
protected int getPeriod(final String prefix) {
return 100;
}
});
assertEquals(0, store.statuses().size());
Thread.sleep(250);
store.shutdown();
final Map<String,NodeStatus> statuses = store.statuses();
assertEquals(1, statuses.size());
assertTrue(statuses.containsKey("test"));
final ValidationResult[] results = statuses.get("test").getResults();
assertEquals(1, results.length);
final ValidationResult validationResult = results[0];
assertEquals("sample", validationResult.getName());
assertEquals("msg", validationResult.getMessage());
assertEquals(Status.OK, validationResult.getStatus());
}