Package crate.elasticsearch.action.import_.parser

Examples of crate.elasticsearch.action.import_.parser.ImportParseException


                        "{\"d\": {\"_timestamp\": {\"enabled\": true, \"store\": \"yes\"}}}"));

        long now = new Date().getTime();
        long ttl = 1867329687097L - now;
        String path = getClass().getResource("/importdata/import_4").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\"}");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(1, imports.size());
        Map<String, Object> nodeInfo = imports.get(0);
        assertNotNull(nodeInfo.get("node_id"));
        assertTrue(Long.valueOf(nodeInfo.get("took").toString()) > 0);
View Full Code Here


     */
    @Test
    public void testMultipleFilesAndMultipleNodes() {
        setUpSecondNode();
        String path = getClass().getResource("/importdata/import_5").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\"}");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(2, imports.size());

        String result = "\\[\\{file_name=(.*)/importdata/import_5/import_5_[ab].json, successes=1, failures=0\\}, \\{file_name=(.*)import_5_[ab].json, successes=1, failures=0\\}\\]";
        Map<String, Object> nodeInfo = imports.get(0);
View Full Code Here

     * The failures are counted correctly.
     */
    @Test
    public void testFailures() {
        String path = getClass().getResource("/importdata/import_6").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\"}");
        List<Map<String, Object>> imports = getImports(response);
        Map<String, Object> nodeInfo = imports.get(0);
        assertNotNull(nodeInfo.get("node_id"));
        assertTrue(Long.valueOf(nodeInfo.get("took").toString()) > 0);
        assertTrue(nodeInfo.get("imported_files").toString().matches(
View Full Code Here

     * importing.
     */
    @Test
    public void testCompression() {
        String path = getClass().getResource("/importdata/import_7").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"compression\":\"gzip\"}");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(1, imports.size());
        Map<String, Object> nodeInfo = imports.get(0);
        assertNotNull(nodeInfo.get("node_id"));
        assertTrue(Long.valueOf(nodeInfo.get("took").toString()) > 0);
View Full Code Here

        esSetup.execute(deleteAll(), createIndex("users").withSettings(
                fromClassPath("essetup/settings/test_a.json")).withMapping("d",
                        fromClassPath("essetup/mappings/test_a.json")));

        // run import with relative directory
        ImportResponse response = executeImportRequest("{\"directory\": \"myExport\"}");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(2, imports.size());
        String regex = "\\[\\{file_name=(.*)/nodes/(\\d)/myExport/export.(\\d).users.json, successes=1, failures=0\\}\\]";
        assertTrue(imports.get(0).get("imported_files").toString().matches(regex));
        assertTrue(imports.get(1).get("imported_files").toString().matches(regex));
View Full Code Here

     * The other files are not imported.
     */
    @Test
    public void testFilePattern() {
        String path = getClass().getResource("/importdata/import_8").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"file_pattern\": \"index_test_(.*).json\"}");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(1, imports.size());
        Map<String, Object> nodeInfo = imports.get(0);
        List imported = (List) nodeInfo.get("imported_files");
        assertTrue(imported.size() == 1);
View Full Code Here

     * A bad regex pattern leads to a failure response.
     */
    @Test
    public void testBadFilePattern() {
        String path = getClass().getResource("/importdata/import_8").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"file_pattern\": \"(.*(d|||\"}");
        List<Map<String, Object>> failures = getImportFailures(response);
        assertEquals(1, failures.size());
        assertTrue(failures.toString().contains("PatternSyntaxException: Unclosed group near index"));
    }
View Full Code Here

    }

    @Test
    public void testSettingsNotFound() {
        String path = getClass().getResource("/importdata/import_1").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"settings\": true}");
        List<Map<String, Object>> failures = getImportFailures(response);
        assertTrue(failures.get(0).get("reason").toString().matches(
                "(.*)Settings file (.*)/importdata/import_1/import_1.json.settings could not be found.(.*)"));
    }
View Full Code Here

    }

    @Test
    public void testMappingsWithoutIndex() {
        String path = getClass().getResource("/importdata/import_9").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"mappings\": true}");
        List<Map<String, Object>> failures = getImportFailures(response);
        assertEquals(1, failures.size());
        assertTrue(failures.get(0).get("reason").toString().contains("Unable to create mapping. Index index1 missing."));
    }
View Full Code Here

    @Test
    public void testMappingNotFound() {
        esSetup.execute(createIndex("index1"));
        String path = getClass().getResource("/importdata/import_1").getPath();
        ImportResponse response = executeImportRequest("{\"directory\": \"" + path + "\", \"mappings\": true}");
        List<Map<String, Object>> failures = getImportFailures(response);
        assertTrue(failures.get(0).get("reason").toString().matches(
                "(.*)Mapping file (.*)/importdata/import_1/import_1.json.mapping could not be found.(.*)"));
    }
View Full Code Here

TOP

Related Classes of crate.elasticsearch.action.import_.parser.ImportParseException

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.