Examples of ExportResponse


Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * Either one of the parameters 'output_cmd' or 'output_file' is required.
     */
    @Test
    public void testNoCommandOrFile() throws IOException {
        ExportResponse response = executeExportRequest("{\"fields\": [\"name\"]}");
        assertEquals(2, response.getShardFailures().length);
        assertTrue(response.getShardFailures()[0].reason().contains(
                "'output_cmd' or 'output_file' has not been defined"));
        assertTrue(response.getShardFailures()[1].reason().contains(
                "'output_cmd' or 'output_file' has not been defined"));
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * The parameter 'fields' is required.
     */
    @Test
    public void testNoExportFields() {
        ExportResponse response = executeExportRequest("{\"output_cmd\": \"cat\"}");

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

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * Invalid parameters lead to an error response.
     */
    @Test
    public void testBadParserArgument() {
        ExportResponse response = executeExportRequest(
                "{\"output_cmd\": \"cat\", \"fields\": [\"name\"], \"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

        super(NAME);
    }

    @Override
    public ExportResponse newResponse() {
        return new ExportResponse();
    }
View Full Code Here

Examples of crate.elasticsearch.action.export.ExportResponse

     * command, the exit code of the process and the process' standard out and
     * standard error logs (first 8K) of every shard result.
     */
    @Test
    public void testSingleOutputCommand() {
        ExportResponse response = executeExportRequest(
                "{\"output_cmd\": \"cat\", \"fields\": [\"name\"]}");

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

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * The 'output_cmd' parameter can also be a list of arguments.
     */
    @Test
    public void testOutputCommandList() {
        ExportResponse response = executeExportRequest(
                "{\"output_cmd\": [\"/bin/sh\", \"-c\", \"cat\"], \"fields\": [\"name\"]}");

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

Examples of crate.elasticsearch.action.export.ExportResponse

    /**
     * The gzip compression will also work on output commands.
     */
    @Test
    public void testOutputCommandWithGZIP() {
        ExportResponse response = executeExportRequest(
                "{\"output_cmd\": [\"/bin/sh\", \"-c\", \"gunzip\"], \"fields\": [\"name\"], \"compression\": \"gzip\"}");

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

Examples of crate.elasticsearch.action.export.ExportResponse

        String filename_0 = "/tmp/" + clusterName + ".0.users.export";
        String filename_1 = "/tmp/" + clusterName + ".1.users.export";
        new File(filename_0).delete();
        new File(filename_1).delete();

        ExportResponse response = executeExportRequest(
                "{\"output_file\": \"/tmp/${cluster}.${shard}.${index}.export\", \"fields\": [\"name\", \"_id\"]}");

        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

        String filename_0 = "/tmp/" + clusterName + ".0.users.zipexport.gz";
        String filename_1 = "/tmp/" + clusterName + ".1.users.zipexport.gz";
        new File(filename_0).delete();
        new File(filename_1).delete();

        ExportResponse response = executeExportRequest(
                "{\"output_file\": \"/tmp/${cluster}.${shard}.${index}.zipexport.gz\", \"fields\": [\"name\", \"_id\"], \"compression\": \"gzip\"}");

        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

    /**
     * Only one parameter of the two 'output_file' or 'output_cmd' can be used.
     */
    @Test
    public void testOutputFileAndOutputCommand() {
        ExportResponse response = executeExportRequest(
                "{\"output_file\": \"/filename\", \"output_cmd\": \"cat\", \"fields\": [\"name\"]}");

        List<Map<String, Object>> infos = getExports(response);
        assertEquals(0, infos.size());
        assertEquals(0, infos.size());
        assertEquals(2, response.getShardFailures().length);
        assertTrue(response.getShardFailures()[0].reason().contains(
                "Concurrent definition of 'output_cmd' and 'output_file'"));
        assertTrue(response.getShardFailures()[1].reason().contains(
                "Concurrent definition of 'output_cmd' and 'output_file'"));

    }
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.