Search in sources :

Example 51 with Settings

use of org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpPublishFilteringMatchingAnd.

public void testIpPublishFilteringMatchingAnd() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx._publish_ip", "192.1.1.54").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(AND, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 52 with Settings

use of org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpBindFilteringNotMatchingOr.

public void testIpBindFilteringNotMatchingOr() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 53 with Settings

use of org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpBindFilteringNotMatchingAnd.

public void testIpBindFilteringNotMatchingAnd() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(AND, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(false));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 54 with Settings

use of org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpBindFilteringMatchingOr.

public void testIpBindFilteringMatchingOr() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54").put("xxx.tag", "A").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 55 with Settings

use of org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpPublishFilteringMatchingOr.

public void testIpPublishFilteringMatchingOr() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx._publish_ip", "192.1.1.54").put("xxx.tag", "A").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Aggregations

Settings (org.elasticsearch.common.settings.Settings)874 IndexSettings (org.elasticsearch.index.IndexSettings)112 Path (java.nio.file.Path)91 IOException (java.io.IOException)83 ClusterState (org.elasticsearch.cluster.ClusterState)76 IndexMetaData (org.elasticsearch.cluster.metadata.IndexMetaData)72 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)68 HashMap (java.util.HashMap)66 ArrayList (java.util.ArrayList)65 Version (org.elasticsearch.Version)63 Environment (org.elasticsearch.env.Environment)63 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)61 Test (org.junit.Test)60 Map (java.util.Map)55 Index (org.elasticsearch.index.Index)55 Matchers.containsString (org.hamcrest.Matchers.containsString)54 List (java.util.List)45 ThreadPool (org.elasticsearch.threadpool.ThreadPool)41 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)37 MetaData (org.elasticsearch.cluster.metadata.MetaData)36