Search in sources :

Example 1 with MergableCustomMetaData1

use of org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1 in project elasticsearch by elastic.

the class TribeIT method testMergingRemovedCustomMetaData.

public void testMergingRemovedCustomMetaData() throws Exception {
    removeCustomMetaData(cluster1, MergableCustomMetaData1.TYPE);
    removeCustomMetaData(cluster2, MergableCustomMetaData1.TYPE);
    MergableCustomMetaData1 customMetaData1 = new MergableCustomMetaData1("a");
    MergableCustomMetaData1 customMetaData2 = new MergableCustomMetaData1("b");
    try (Releasable tribeNode = startTribeNode()) {
        assertNodes(ALL);
        putCustomMetaData(cluster1, customMetaData1);
        putCustomMetaData(cluster2, customMetaData2);
        assertCustomMetaDataUpdated(internalCluster(), customMetaData2);
        removeCustomMetaData(cluster2, customMetaData2.getWriteableName());
        assertCustomMetaDataUpdated(internalCluster(), customMetaData1);
    }
}
Also used : MergableCustomMetaData1(org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1) Releasable(org.elasticsearch.common.lease.Releasable)

Example 2 with MergableCustomMetaData1

use of org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1 in project elasticsearch by elastic.

the class TribeIT method testMergingMultipleCustomMetaData.

public void testMergingMultipleCustomMetaData() throws Exception {
    removeCustomMetaData(cluster1, MergableCustomMetaData1.TYPE);
    removeCustomMetaData(cluster2, MergableCustomMetaData1.TYPE);
    MergableCustomMetaData1 firstCustomMetaDataType1 = new MergableCustomMetaData1(randomAsciiOfLength(10));
    MergableCustomMetaData1 secondCustomMetaDataType1 = new MergableCustomMetaData1(randomAsciiOfLength(10));
    MergableCustomMetaData2 firstCustomMetaDataType2 = new MergableCustomMetaData2(randomAsciiOfLength(10));
    MergableCustomMetaData2 secondCustomMetaDataType2 = new MergableCustomMetaData2(randomAsciiOfLength(10));
    List<MergableCustomMetaData1> mergedCustomMetaDataType1 = Arrays.asList(firstCustomMetaDataType1, secondCustomMetaDataType1);
    List<MergableCustomMetaData2> mergedCustomMetaDataType2 = Arrays.asList(firstCustomMetaDataType2, secondCustomMetaDataType2);
    Collections.sort(mergedCustomMetaDataType1, (cm1, cm2) -> cm2.getData().compareTo(cm1.getData()));
    Collections.sort(mergedCustomMetaDataType2, (cm1, cm2) -> cm2.getData().compareTo(cm1.getData()));
    try (Releasable tribeNode = startTribeNode()) {
        assertNodes(ALL);
        // test putting multiple custom md types propagates to tribe
        putCustomMetaData(cluster1, firstCustomMetaDataType1);
        putCustomMetaData(cluster1, firstCustomMetaDataType2);
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType1);
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType2);
        // test multiple same type custom md is merged and propagates to tribe
        putCustomMetaData(cluster2, secondCustomMetaDataType1);
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType2);
        assertCustomMetaDataUpdated(internalCluster(), mergedCustomMetaDataType1.get(0));
        // test multiple same type custom md is merged and propagates to tribe
        putCustomMetaData(cluster2, secondCustomMetaDataType2);
        assertCustomMetaDataUpdated(internalCluster(), mergedCustomMetaDataType1.get(0));
        assertCustomMetaDataUpdated(internalCluster(), mergedCustomMetaDataType2.get(0));
        // test removing custom md is propagates to tribe
        removeCustomMetaData(cluster2, secondCustomMetaDataType1.getWriteableName());
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType1);
        assertCustomMetaDataUpdated(internalCluster(), mergedCustomMetaDataType2.get(0));
        removeCustomMetaData(cluster2, secondCustomMetaDataType2.getWriteableName());
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType1);
        assertCustomMetaDataUpdated(internalCluster(), firstCustomMetaDataType2);
    }
}
Also used : MergableCustomMetaData1(org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1) MergableCustomMetaData2(org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData2) Releasable(org.elasticsearch.common.lease.Releasable)

Example 3 with MergableCustomMetaData1

use of org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1 in project elasticsearch by elastic.

the class TribeIT method testMergingCustomMetaData.

public void testMergingCustomMetaData() throws Exception {
    removeCustomMetaData(cluster1, MergableCustomMetaData1.TYPE);
    removeCustomMetaData(cluster2, MergableCustomMetaData1.TYPE);
    MergableCustomMetaData1 customMetaData1 = new MergableCustomMetaData1(randomAsciiOfLength(10));
    MergableCustomMetaData1 customMetaData2 = new MergableCustomMetaData1(randomAsciiOfLength(10));
    List<MergableCustomMetaData1> customMetaDatas = Arrays.asList(customMetaData1, customMetaData2);
    Collections.sort(customMetaDatas, (cm1, cm2) -> cm2.getData().compareTo(cm1.getData()));
    final MergableCustomMetaData1 tribeNodeCustomMetaData = customMetaDatas.get(0);
    try (Releasable tribeNode = startTribeNode()) {
        assertNodes(ALL);
        putCustomMetaData(cluster1, customMetaData1);
        assertCustomMetaDataUpdated(internalCluster(), customMetaData1);
        putCustomMetaData(cluster2, customMetaData2);
        assertCustomMetaDataUpdated(internalCluster(), tribeNodeCustomMetaData);
    }
}
Also used : MergableCustomMetaData1(org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1) Releasable(org.elasticsearch.common.lease.Releasable)

Aggregations

Releasable (org.elasticsearch.common.lease.Releasable)3 MergableCustomMetaData1 (org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData1)3 MergableCustomMetaData2 (org.elasticsearch.tribe.TribeServiceTests.MergableCustomMetaData2)1