コード例 #1
0
    @Test
    public void collectValues_A$_TimeoutWithDefaultValues() throws Exception {
        HttpGetToStringMultiLane multiLane = new HttpGetToStringMultiLane();
        HttpGetToStringAction httpGet = new HttpGetToStringAction("http://localhost:8881/", 1);
        multiLane.start("req-1", httpGet, "Unavailable");
        multiLane.start("req-2", httpGet, "Unavailable");

        Map<String, String> values = multiLane.collectValues();
        assertThat(values.get("req-1"), is(equalTo("Unavailable")));
        assertThat(values.get("req-2"), is(equalTo("Unavailable")));
    }
コード例 #2
0
    @Test
    public void collect_A$_TimeoutWithDefaultValues() throws Exception {
        HttpGetToStringMultiLane multiLane = new HttpGetToStringMultiLane();
        HttpGetToStringAction httpGet = new HttpGetToStringAction("http://localhost:8881/", 1);
        multiLane.start("req-1", httpGet, "Unavailable");
        multiLane.start("req-2", httpGet, "Unavailable");

        Map<String, Either<Throwable, String>> results = multiLane.collect();
        assertThat(results.size(), is(equalTo(2)));
        assertThat(results.get("req-1").isLeft(), is(true));
        assertThat(results.get("req-2").isLeft(), is(true));
    }
コード例 #3
0
    @Test
    public void collect_A$() throws Exception {
        HttpGetToStringMultiLane multiLane = new HttpGetToStringMultiLane();
        HttpGetToStringAction httpGet = new HttpGetToStringAction("http://localhost:8881/?v=abc", 1000);
        multiLane.start("req-1", httpGet);
        multiLane.start("req-2", httpGet);

        Map<String, Either<Throwable, String>> results = multiLane.collect();
        assertThat(results.size(), is(equalTo(2)));
        assertThat(results.get("req-1").right().getOrElse(""), is(equalTo("abc")));
        assertThat(results.get("req-2").right().getOrElse(""), is(equalTo("abc")));
    }
コード例 #4
0
    @Test
    public void collectValues_A$() throws Exception {
        HttpGetToStringMultiLane multiLane = new HttpGetToStringMultiLane();
        HttpGetToStringAction httpGet1 = new HttpGetToStringAction("http://localhost:8881/?v=bcd", 3000);
        HttpGetToStringAction httpGet2 = new HttpGetToStringAction("http://localhost:8881/?v=cde", 3000);
        multiLane.start("req-1", httpGet1);
        multiLane.start("req-2", httpGet2);

        Map<String, String> result = multiLane.collectValues();

        assertThat(result.get("req-1"), is(equalTo("bcd")));
        assertThat(result.get("req-2"), is(equalTo("cde")));
    }
コード例 #5
0
    @Test
    public void collectValues_A$_SameAction() throws Exception {
        HttpGetToStringMultiLane multiLane = new HttpGetToStringMultiLane();
        HttpGetToStringAction httpGet = new HttpGetToStringAction("http://localhost:8881/?v=bcd", 1000);
        multiLane.start("req-1", httpGet);
        multiLane.start("req-2", httpGet);

        Map<String, String> values = multiLane.collectValues();
        assertThat(values.size(), is(equalTo(2)));

        assertThat(values.get("req-1"), is(equalTo("bcd")));
        assertThat(values.get("req-2"), is(equalTo("bcd")));
    }