ts.assertReceivedOnNext(Arrays.asList("{\"false\":1}", "{\"false\":2}", "{\"false\":2}", "{\"false\":2}", "{\"false\":1,\"true\":1}", "{\"true\":2}"));
}
@Test
public void testFields() {
TestScheduler scheduler = new TestScheduler();
TestSubject<GroupedObservable<InstanceKey, Map<String, Object>>> stream = TestSubject.create(scheduler);
AtomicInteger numGroups = new AtomicInteger();
TestSubscriber<Object> ts = new TestSubscriber<>();
StreamAggregator.aggregateGroupedStreams(stream).flatMap(commandGroup -> {
numGroups.incrementAndGet();
return commandGroup.map(data -> {
validateNumber(data, "reportingHosts");
validateAggregateString(data, "type");
validateString(data, "name");
validateAggregateString(data, "group");
validateNull(data, "currentTime");
validateAggregateString(data, "isCircuitBreakerOpen");
validateNumber(data, "errorPercentage");
validateNumber(data, "errorCount");
validateNumber(data, "requestCount");
validateNumber(data, "rollingCountCollapsedRequests");
validateNumber(data, "rollingCountExceptionsThrown");
validateNumber(data, "rollingCountFailure");
validateNumber(data, "rollingCountFallbackFailure");
validateNumber(data, "rollingCountFallbackRejection");
validateNumber(data, "rollingCountFallbackSuccess");
validateNumber(data, "rollingCountResponsesFromCache");
validateNumber(data, "rollingCountSemaphoreRejected");
validateNumber(data, "rollingCountShortCircuited");
validateNumber(data, "rollingCountSuccess");
validateNumber(data, "rollingCountThreadPoolRejected");
validateNumber(data, "rollingCountTimeout");
validateNumber(data, "currentConcurrentExecutionCount");
validateNumber(data, "latencyExecute_mean");
validateNumberList(data, "latencyExecute");
validateNumber(data, "latencyTotal_mean");
validateNumberList(data, "latencyTotal");
validateAggregateString(data, "propertyValue_circuitBreakerRequestVolumeThreshold");
validateAggregateString(data, "propertyValue_circuitBreakerSleepWindowInMilliseconds");
validateAggregateString(data, "propertyValue_circuitBreakerErrorThresholdPercentage");
validateAggregateString(data, "propertyValue_circuitBreakerForceOpen");
validateAggregateString(data, "propertyValue_executionIsolationStrategy");
validateAggregateString(data, "propertyValue_executionIsolationThreadTimeoutInMilliseconds");
validateAggregateString(data, "propertyValue_executionIsolationThreadInterruptOnTimeout");
validateAggregateString(data, "propertyValue_executionIsolationSemaphoreMaxConcurrentRequests");
validateAggregateString(data, "propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests");
validateAggregateString(data, "propertyValue_requestCacheEnabled");
validateAggregateString(data, "propertyValue_requestLogEnabled");
validateAggregateString(data, "propertyValue_metricsRollingStatisticalWindowInMilliseconds");
return data.get("name");
});
}).subscribe(ts);
stream.onNext(getCinematchCommandInstanceStream(12345, scheduler), 0);
stream.onNext(getCinematchCommandInstanceStream(23456, scheduler), 0);
stream.onCompleted(100);
scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);
ts.awaitTerminalEvent();
System.out.println("---------> OnErrorEvents: " + ts.getOnErrorEvents());
if (ts.getOnErrorEvents().size() > 0) {