Examples of ExportResponse


Examples of crate.elasticsearch.action.export.ExportResponse

     * Without any given payload the dump endpoint will export to the default location
     * ``dump`` within the data folder of each node
     */
    public void testNoOption() throws IOException {
        deleteDefaultDir();
        ExportResponse response = executeDumpRequest();

        List<Map<String, Object>> infos = getExports(response);
        assertEquals(2, infos.size());
        Map<String, Object> shard_0 = infos.get(0);
        Map<String, Object> shard_1 = infos.get(1);
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * Invalid parameters lead to an error response.
     */
    @Test
    public void testBadParserArgument() {
        ExportResponse response = executeDumpRequest(
                "{\"badparam\":\"somevalue\"}");

        List<Map<String, Object>> infos = getExports(response);
        assertEquals(0, infos.size());
        assertEquals(2, response.getShardFailures().length);
        assertTrue(response.getShardFailures()[0].reason().contains(
                "No parser for element [badparam]"));
        assertTrue(response.getShardFailures()[1].reason().contains(
                "No parser for element [badparam]"));
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * The target directory must exist
     */
    @Test
    public void testDirMustExist() {
        ExportResponse response = executeDumpRequest(
                "{\"directory\": \"/tmp/doesnotexist\"}");
        List<Map<String, Object>> infos = getExports(response);
        assertEquals(0, infos.size());
        assertEquals(2, response.getShardFailures().length);
        assertTrue(response.getShardFailures()[0].reason().contains(
                "Target folder /tmp/doesnotexist does not exist"));
        assertTrue(response.getShardFailures()[1].reason().contains(
                "Target folder /tmp/doesnotexist does not exist"));
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

        new File(filename_0 + ".settings").delete();
        new File(filename_1 + ".settings").delete();
        new File(filename_0 + ".mapping").delete();
        new File(filename_1 + ".mapping").delete();

        ExportResponse response = executeDumpRequest(
                "{\"directory\": \"/tmp\"}");

        List<Map<String, Object>> infos = getExports(response);
        assertEquals(2, infos.size());
        Map<String, Object> shard_0 = infos.get(0);
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

            dumpDir.delete();
        }
        dumpDir.mkdir();

        // initial dump to target directory
        ExportResponse response = executeDumpRequest(
                "{\"directory\": \"/tmp/forceDump\"}");

        List<Map<String, Object>> infos = getExports(response);

        assertEquals(2, infos.size());
        assertEquals(0, response.getShardFailures().length);

        // second attempt to dump will fail
        response = executeDumpRequest(
                "{\"directory\": \"/tmp/forceDump\"}");

        infos = getExports(response);
        assertEquals(0, infos.size());
        assertEquals(2, response.getShardFailures().length);

        // if force_overwrite == true a second dump will succeed
        response = executeDumpRequest(
                "{\"directory\": \"/tmp/forceDump\", \"force_overwrite\":true}");

        infos = getExports(response);
        assertEquals(2, infos.size());
        assertEquals(0, response.getShardFailures().length);
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

        // Do dump request
        String source = "{\"force_overwrite\": true, \"directory\":\"/tmp/multipleNodes\"}";
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source(source);
        ExportResponse response = esSetup.client().execute(
                DumpAction.INSTANCE, exportRequest).actionGet();

        // The two shard results are from different nodes and have no failures
        assertEquals(0, response.getFailedShards());
        List<Map<String, Object>> infos = getExports(response);
        assertNotSame(infos.get(0).get("node_id"), infos.get(1).get("node_id"));
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

        String clusterName = esSetup.client().admin().cluster().prepareHealth().
                setWaitForGreenStatus().execute().actionGet().getClusterName();
        String filename_0 = "/tmp/query/" + clusterName + "_users_0.json.gz";
        String filename_1 = "/tmp/query/" + clusterName + "_users_1.json.gz";
        ExportResponse response = executeDumpRequest(
                "{\"directory\": \"/tmp/query\", \"query\": {\"match\": {\"name\":\"bus\"}}}");

        assertEquals(0, response.getFailedShards());
        List<Map<String, Object>> infos = getExports(response);
        assertEquals(2, infos.size());

        List<String> lines_0 = readLinesFromGZIP(filename_0);
        assertEquals(0, lines_0.size());
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

     * Helper method to delete an already existing dump directory
     */
    private void deleteDefaultDir() {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"dump\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
            for (Map<String, String> map : list) {
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

     * @param directory
     */
    private void makeNodeDataLocationDirectories(String directory) {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"" + directory + "\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
            for (Map<String, String> map : list) {
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

     * Helper method to delete an already existing dump directory
     */
    private void deleteDefaultDir() {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"dump\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
            for (Map<String, String> map : list) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.