forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanTests.java
More file actions
37 lines (27 loc) · 1 KB
/
ScanTests.java
File metadata and controls
37 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package rx;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import rx.EventStream.Event;
import rx.util.functions.Action1;
import rx.util.functions.Func2;
public class ScanTests {
@Test
public void testUnsubscribeScan() {
EventStream.getEventStream("HTTP-ClusterB", 20)
.scan(new HashMap<String, String>(), new Func2<Map<String, String>, Event, Map<String, String>>() {
@Override
public Map<String, String> call(Map<String, String> accum, Event perInstanceEvent) {
accum.put("instance", perInstanceEvent.instanceId);
return accum;
}
})
.take(10)
.toBlockingObservable().forEach(new Action1<Map<String, String>>() {
@Override
public void call(Map<String, String> v) {
System.out.println(v);
}
});
}
}