// Path: src/main/java/com/bazoud/elasticsearch/plugin/river/git/GitRiverPlugin.java
// public static final String RIVER_TYPE = "git";


import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.AdminClient;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchAdminClient;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchClient;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchIndex;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchNode;
import com.github.tlrx.elasticsearch.test.support.junit.runners.ElasticsearchRunner;
import static com.bazoud.elasticsearch.plugin.river.git.GitRiverPlugin.RIVER_TYPE;
import static java.lang.Thread.currentThread;
import static java.lang.Thread.sleep;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
        gitRepository = currentThread().getContextClassLoader()
            .getResource("git_tests_junit")
            .toURI()
            .toString();
    }

    @Test
    @ElasticsearchIndex(indexName = RIVER_KEYWORD)
    public void test00CreateIndex() {
        // Checks if the index has been created
        IndicesExistsResponse existResponse = adminClient.indices()
            .prepareExists(RIVER_KEYWORD)
            .execute().actionGet();

        Assert.assertTrue("Index must exist", existResponse.isExists());
    }

    @Test
    @ElasticsearchIndex(indexName = RIVER_KEYWORD)
    public void test10IndexingFromRevision() throws IOException {
        // Index a new document
        Map<String, Object> json = new HashMap<String, Object>();
        json.put("name", "git_repo_tests");
        json.put("uri", gitRepository);
        json.put("working_dir", "./target/river-workingdir_" + UUID.randomUUID().toString());
        json.put("issue_regex", "#(\\d*)");
        json.put("indexing_diff", false);

        XContentBuilder builder = jsonBuilder()
            .startObject()
// Path: src/main/java/com/bazoud/elasticsearch/plugin/river/git/GitRiverPlugin.java
// public static final String RIVER_TYPE = "git";


// Path: src/test/java/com/bazoud/elasticsearch/river/git/GitRiverTest.java
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.AdminClient;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchAdminClient;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchClient;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchIndex;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchNode;
import com.github.tlrx.elasticsearch.test.support.junit.runners.ElasticsearchRunner;
import static com.bazoud.elasticsearch.plugin.river.git.GitRiverPlugin.RIVER_TYPE;
import static java.lang.Thread.currentThread;
import static java.lang.Thread.sleep;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;

        gitRepository = currentThread().getContextClassLoader()
            .getResource("git_tests_junit")
            .toURI()
            .toString();
    }

    @Test
    @ElasticsearchIndex(indexName = RIVER_KEYWORD)
    public void test00CreateIndex() {
        // Checks if the index has been created
        IndicesExistsResponse existResponse = adminClient.indices()
            .prepareExists(RIVER_KEYWORD)
            .execute().actionGet();

        Assert.assertTrue("Index must exist", existResponse.isExists());
    }

    @Test
    @ElasticsearchIndex(indexName = RIVER_KEYWORD)
    public void test10IndexingFromRevision() throws IOException {
        // Index a new document
        Map<String, Object> json = new HashMap<String, Object>();
        json.put("name", "git_repo_tests");
        json.put("uri", gitRepository);
        json.put("working_dir", "./target/river-workingdir_" + UUID.randomUUID().toString());
        json.put("issue_regex", "#(\\d*)");
        json.put("indexing_diff", false);

        XContentBuilder builder = jsonBuilder()
            .startObject()
            .field("type", RIVER_TYPE)