Package org.elasticsearch.river.twitter.test.helper

Examples of org.elasticsearch.river.twitter.test.helper.HttpClientResponse


    private void launchTest(XContentBuilder river, final Integer numDocs, boolean removeRiver)
            throws IOException, InterruptedException {
        logger.info("  -> Checking internet working");
        new HttpClient("www.elasticsearch.org", 80).request("/");
        HttpClientResponse response = new HttpClient("www.elasticsearch.org", 80).request("/");
        Assert.assertThat(response.errorCode(), is(200));

        logger.info("  -> Create river");
        try {
            createIndex(getDbName());
        } catch (IndexAlreadyExistsException e) {
            // No worries. We already created the index before
        }
        index("_river", getDbName(), "_meta", river);

        logger.info("  -> Wait for some docs");
        assertThat(awaitBusy(new Predicate<Object>() {
            public boolean apply(Object obj) {
                try {
                    refresh();
                    CountResponse response = client().prepareCount(getDbName()).get();
                    logger.info("  -> got {} docs in {} index", response.getCount(), getDbName());
                    return response.getCount() >= numDocs;
                } catch (IndexMissingException e) {
                    return false;
                }
            }
        }, 5, TimeUnit.MINUTES), equalTo(true));
View Full Code Here

TOP

Related Classes of org.elasticsearch.river.twitter.test.helper.HttpClientResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.