Package org.elasticsearch.cluster.metadata

Examples of org.elasticsearch.cluster.metadata.MetaData.uuid()


        assertThat(resource, notNullValue());
        Path dst = tmp.resolve("global-3.st");
        Files.copy(resource, dst);
        MetaData read = format.read(dst.toFile(), 3);
        assertThat(read, notNullValue());
        assertThat(read.uuid(), equalTo("3O1tDF1IRB6fSJ-GrTMUtg"));
        // indices are empty since they are serialized separately
    }

    public void testReadWriteState() throws IOException {
        File[] dirs = new File[randomIntBetween(1, 5)];
View Full Code Here


        }
        final File dir1 = randomFrom(dirs);
        final long v = randomInt(10);

        MetaData meta = randomMeta();
        String uuid = meta.uuid();

        // write a first state file in the old format
        final File dir2 = randomFrom(dirs);
        MetaData meta2 = randomMeta();
        assertFalse(meta2.uuid().equals(uuid));
View Full Code Here

        String uuid = meta.uuid();

        // write a first state file in the old format
        final File dir2 = randomFrom(dirs);
        MetaData meta2 = randomMeta();
        assertFalse(meta2.uuid().equals(uuid));
        try (XContentBuilder xcontentBuilder = XContentFactory.contentBuilder(format.format(), new FileOutputStream(new File(new File(dir2, MetaDataStateFormat.STATE_DIR_NAME), LocalGatewayMetaState.GLOBAL_STATE_FILE_PREFIX + v)))) {
            xcontentBuilder.startObject();
            MetaData.Builder.toXContent(randomMeta(), xcontentBuilder, params);
            xcontentBuilder.endObject();
        }
View Full Code Here

        // write a second state file in the new format but with the same version
        format.write(meta, LocalGatewayMetaState.GLOBAL_STATE_FILE_PREFIX, v, dir1);

        MetaData state = MetaDataStateFormat.loadLatestState(logger, format, LocalGatewayMetaState.GLOBAL_STATE_FILE_PATTERN, "foobar", dirs);
        assertThat(state.uuid(), equalTo(uuid));
    }

    @Test
    public void testLoadState() throws IOException {
        final ToXContent.Params params = ToXContent.EMPTY_PARAMS;
View Full Code Here

        List<File> dirList = Arrays.asList(dirs);
        Collections.shuffle(dirList, getRandom());
        MetaData loadedMetaData = MetaDataStateFormat.loadLatestState(logger, format, LocalGatewayMetaState.GLOBAL_STATE_FILE_PATTERN, "foobar", dirList.toArray(new File[0]));
        MetaData latestMetaData = meta.get(numStates-1);
        assertThat(loadedMetaData.uuid(), not(equalTo("_na_")));
        assertThat(loadedMetaData.uuid(), equalTo(latestMetaData.uuid()));
        ImmutableOpenMap<String,IndexMetaData> indices = loadedMetaData.indices();
        assertThat(indices.size(), equalTo(latestMetaData.indices().size()));
        for (IndexMetaData original : latestMetaData) {
            IndexMetaData deserialized = indices.get(original.getIndex());
            assertThat(deserialized, notNullValue());
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.