Merge branch 'enhancement/node_client_setting_removal'
Original commit: elastic/x-pack-elasticsearch@31af38c4c9
This commit is contained in:
commit
99af2d60d3
|
@ -7,8 +7,8 @@ package org.elasticsearch.license.plugin;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionModule;
|
import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
|
@ -44,13 +44,8 @@ public class Licensing {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Licensing(Settings settings) {
|
public Licensing(Settings settings) {
|
||||||
if (DiscoveryNode.clientNode(settings)) {
|
this.transportClient = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||||
// Enable plugin only on node clients
|
isEnabled = transportClient == false;
|
||||||
this.isEnabled = "node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
|
||||||
} else {
|
|
||||||
this.isEnabled = true;
|
|
||||||
}
|
|
||||||
transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(NetworkModule module) {
|
public void onModule(NetworkModule module) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
package org.elasticsearch.license.plugin.consumer;
|
package org.elasticsearch.license.plugin.consumer;
|
||||||
|
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -21,12 +21,7 @@ public abstract class TestConsumerPluginBase extends Plugin {
|
||||||
private final boolean isEnabled;
|
private final boolean isEnabled;
|
||||||
|
|
||||||
public TestConsumerPluginBase(Settings settings) {
|
public TestConsumerPluginBase(Settings settings) {
|
||||||
if (DiscoveryNode.clientNode(settings)) {
|
this.isEnabled = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())) == false;
|
||||||
// Enable plugin only on node clients
|
|
||||||
this.isEnabled = "node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
|
||||||
} else {
|
|
||||||
this.isEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.marvel.agent.exporter;
|
package org.elasticsearch.marvel.agent.exporter;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -16,6 +14,9 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all monitoring documents.
|
* Base class for all monitoring documents.
|
||||||
|
@ -107,23 +108,20 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||||
private String transportAddress;
|
private String transportAddress;
|
||||||
private String ip;
|
private String ip;
|
||||||
private String name;
|
private String name;
|
||||||
private ImmutableOpenMap<String, String> attributes;
|
private Map<String, String> attributes;
|
||||||
|
|
||||||
public Node(String uuid, String host, String transportAddress, String ip, String name,
|
public Node(String uuid, String host, String transportAddress, String ip, String name,
|
||||||
ImmutableOpenMap<String, String> attributes) {
|
Map<String, String> attributes) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.transportAddress = transportAddress;
|
this.transportAddress = transportAddress;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (attributes == null) {
|
||||||
ImmutableOpenMap.Builder<String, String> builder = ImmutableOpenMap.builder();
|
this.attributes = new HashMap<>();
|
||||||
if (attributes != null) {
|
} else {
|
||||||
for (ObjectObjectCursor<String, String> entry : attributes) {
|
this.attributes = Collections.unmodifiableMap(attributes);
|
||||||
builder.put(entry.key.intern(), entry.value.intern());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.attributes = builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Node(StreamInput in) throws IOException {
|
public Node(StreamInput in) throws IOException {
|
||||||
|
@ -133,11 +131,10 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||||
ip = in.readOptionalString();
|
ip = in.readOptionalString();
|
||||||
name = in.readOptionalString();
|
name = in.readOptionalString();
|
||||||
int size = in.readVInt();
|
int size = in.readVInt();
|
||||||
ImmutableOpenMap.Builder<String, String> attributes = ImmutableOpenMap.builder(size);
|
this.attributes = new HashMap<>();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
attributes.put(in.readOptionalString(), in.readOptionalString());
|
attributes.put(in.readString(), in.readString());
|
||||||
}
|
}
|
||||||
this.attributes = attributes.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUUID() {
|
public String getUUID() {
|
||||||
|
@ -160,7 +157,7 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableOpenMap<String, String> getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +171,8 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||||
builder.field(Fields.NAME, getName());
|
builder.field(Fields.NAME, getName());
|
||||||
|
|
||||||
builder.startObject(Fields.ATTRIBUTES);
|
builder.startObject(Fields.ATTRIBUTES);
|
||||||
for (ObjectObjectCursor<String, String> attr : getAttributes()) {
|
for (Map.Entry<String, String> entry : getAttributes().entrySet()) {
|
||||||
builder.field(attr.key, attr.value);
|
builder.field(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
return builder.endObject();
|
return builder.endObject();
|
||||||
|
@ -190,9 +187,9 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||||
out.writeOptionalString(name);
|
out.writeOptionalString(name);
|
||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
out.writeVInt(attributes.size());
|
out.writeVInt(attributes.size());
|
||||||
for (ObjectObjectCursor<String, String> entry : attributes) {
|
for (Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||||
out.writeOptionalString(entry.key);
|
out.writeString(entry.getKey());
|
||||||
out.writeOptionalString(entry.value);
|
out.writeString(entry.getValue());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out.writeVInt(0);
|
out.writeVInt(0);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.marvel.agent.resolver.cluster;
|
package org.elasticsearch.marvel.agent.resolver.cluster;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -14,6 +13,7 @@ import org.elasticsearch.marvel.agent.collector.cluster.DiscoveryNodeMonitoringD
|
||||||
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
|
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class DiscoveryNodeResolver extends MonitoringIndexNameResolver.Data<DiscoveryNodeMonitoringDoc> {
|
public class DiscoveryNodeResolver extends MonitoringIndexNameResolver.Data<DiscoveryNodeMonitoringDoc> {
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ public class DiscoveryNodeResolver extends MonitoringIndexNameResolver.Data<Disc
|
||||||
builder.field(Fields.TRANSPORT_ADDRESS, node.getAddress().toString());
|
builder.field(Fields.TRANSPORT_ADDRESS, node.getAddress().toString());
|
||||||
|
|
||||||
builder.startObject(Fields.ATTRIBUTES);
|
builder.startObject(Fields.ATTRIBUTES);
|
||||||
for (ObjectObjectCursor<String, String> attr : node.getAttributes()) {
|
for (Map.Entry<String, String> entry : node.getAttributes().entrySet()) {
|
||||||
builder.field(attr.key, attr.value);
|
builder.field(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
builder.field(Fields.ID, node.getId());
|
builder.field(Fields.ID, node.getId());
|
||||||
|
|
|
@ -7,13 +7,14 @@ package org.elasticsearch.marvel.action;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
|
||||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.marvel.agent.exporter.MonitoringDoc;
|
import org.elasticsearch.marvel.agent.exporter.MonitoringDoc;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -78,7 +79,7 @@ public class MonitoringBulkDocTests extends ESTestCase {
|
||||||
String ip = null;
|
String ip = null;
|
||||||
String transportAddress = null;
|
String transportAddress = null;
|
||||||
String host = null;
|
String host = null;
|
||||||
ImmutableOpenMap<String, String> attributes = null;
|
Map<String, String> attributes = null;
|
||||||
|
|
||||||
if (frequently()) {
|
if (frequently()) {
|
||||||
uuid = randomAsciiOfLength(5);
|
uuid = randomAsciiOfLength(5);
|
||||||
|
@ -91,14 +92,11 @@ public class MonitoringBulkDocTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
if (rarely()) {
|
if (rarely()) {
|
||||||
int nbAttributes = randomIntBetween(0, 5);
|
int nbAttributes = randomIntBetween(0, 5);
|
||||||
|
attributes = new HashMap<>();
|
||||||
ImmutableOpenMap.Builder<String, String> builder = ImmutableOpenMap.builder();
|
|
||||||
for (int i = 0; i < nbAttributes; i++) {
|
for (int i = 0; i < nbAttributes; i++) {
|
||||||
builder.put("key#" + i, String.valueOf(i));
|
attributes.put("key#" + i, String.valueOf(i));
|
||||||
}
|
}
|
||||||
attributes = builder.build();
|
|
||||||
}
|
}
|
||||||
return new MonitoringDoc.Node(uuid, host, transportAddress, ip, name, attributes);
|
return new MonitoringDoc.Node(uuid, host, transportAddress, ip, name, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
@ -88,7 +90,7 @@ public class TransportMonitoringBulkActionTests extends ESTestCase {
|
||||||
clusterService = new ClusterService(Settings.EMPTY, null, new ClusterSettings(Settings.EMPTY,
|
clusterService = new ClusterService(Settings.EMPTY, null, new ClusterSettings(Settings.EMPTY,
|
||||||
ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), threadPool,
|
ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), threadPool,
|
||||||
new ClusterName(TransportMonitoringBulkActionTests.class.getName()));
|
new ClusterName(TransportMonitoringBulkActionTests.class.getName()));
|
||||||
clusterService.setLocalNode(new DiscoveryNode("node", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
clusterService.setLocalNode(new DiscoveryNode("node", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
clusterService.setNodeConnectionsService(new NodeConnectionsService(Settings.EMPTY, null, null) {
|
clusterService.setNodeConnectionsService(new NodeConnectionsService(Settings.EMPTY, null, null) {
|
||||||
@Override
|
@Override
|
||||||
public void connectToAddedNodes(ClusterChangedEvent event) {
|
public void connectToAddedNodes(ClusterChangedEvent event) {
|
||||||
|
|
|
@ -7,13 +7,17 @@ package org.elasticsearch.marvel.agent.exporter;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
|
||||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.DummyTransportAddress;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -96,7 +100,7 @@ public class MonitoringDocTests extends ESTestCase {
|
||||||
String ip = null;
|
String ip = null;
|
||||||
String transportAddress = null;
|
String transportAddress = null;
|
||||||
String host = null;
|
String host = null;
|
||||||
ImmutableOpenMap<String, String> attributes = null;
|
Map<String, String> attributes = null;
|
||||||
|
|
||||||
if (frequently()) {
|
if (frequently()) {
|
||||||
uuid = randomAsciiOfLength(5);
|
uuid = randomAsciiOfLength(5);
|
||||||
|
@ -109,25 +113,24 @@ public class MonitoringDocTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
if (rarely()) {
|
if (rarely()) {
|
||||||
int nbAttributes = randomIntBetween(0, 5);
|
int nbAttributes = randomIntBetween(0, 5);
|
||||||
|
attributes = new HashMap<>();
|
||||||
ImmutableOpenMap.Builder<String, String> builder = ImmutableOpenMap.builder();
|
|
||||||
for (int i = 0; i < nbAttributes; i++) {
|
for (int i = 0; i < nbAttributes; i++) {
|
||||||
builder.put("key#" + i, String.valueOf(i));
|
attributes.put("key#" + i, String.valueOf(i));
|
||||||
}
|
}
|
||||||
attributes = builder.build();
|
|
||||||
}
|
}
|
||||||
return new MonitoringDoc.Node(uuid, host, transportAddress, ip, name, attributes);
|
return new MonitoringDoc.Node(uuid, host, transportAddress, ip, name, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DiscoveryNode newRandomDiscoveryNode() {
|
private DiscoveryNode newRandomDiscoveryNode() {
|
||||||
ImmutableOpenMap.Builder<String, String> attributes = ImmutableOpenMap.builder();
|
Map<String, String> attributes = new HashMap<>();
|
||||||
if (rarely()) {
|
if (rarely()) {
|
||||||
int nbAttributes = randomIntBetween(0, 5);
|
int nbAttributes = randomIntBetween(0, 5);
|
||||||
for (int i = 0; i < nbAttributes; i++) {
|
for (int i = 0; i < nbAttributes; i++) {
|
||||||
attributes.put("key#" + i, String.valueOf(i));
|
attributes.put("key#" + i, String.valueOf(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Set<DiscoveryNode.Role> roles = new HashSet<>(randomSubsetOf(Arrays.asList(DiscoveryNode.Role.values())));
|
||||||
return new DiscoveryNode(randomAsciiOfLength(5), randomAsciiOfLength(3), randomAsciiOfLength(3), randomAsciiOfLength(3),
|
return new DiscoveryNode(randomAsciiOfLength(5), randomAsciiOfLength(3), randomAsciiOfLength(3), randomAsciiOfLength(3),
|
||||||
DummyTransportAddress.INSTANCE, attributes.build(), randomVersion(random()));
|
DummyTransportAddress.INSTANCE, attributes, roles, randomVersion(random()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,8 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.dataTemplateName;
|
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.dataTemplateName;
|
||||||
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.indexTemplateName;
|
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.indexTemplateName;
|
||||||
|
@ -449,14 +451,14 @@ public class HttpExporterTests extends MarvelIntegTestCase {
|
||||||
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
||||||
doc.setClusterUUID(internalCluster().getClusterName());
|
doc.setClusterUUID(internalCluster().getClusterName());
|
||||||
doc.setTimestamp(System.currentTimeMillis());
|
doc.setTimestamp(System.currentTimeMillis());
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setRecoveryResponse(new RecoveryResponse());
|
doc.setRecoveryResponse(new RecoveryResponse());
|
||||||
return doc;
|
return doc;
|
||||||
} else {
|
} else {
|
||||||
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
||||||
doc.setClusterUUID(internalCluster().getClusterName());
|
doc.setClusterUUID(internalCluster().getClusterName());
|
||||||
doc.setTimestamp(System.currentTimeMillis());
|
doc.setTimestamp(System.currentTimeMillis());
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterState(ClusterState.PROTO);
|
doc.setClusterState(ClusterState.PROTO);
|
||||||
doc.setStatus(ClusterHealthStatus.GREEN);
|
doc.setStatus(ClusterHealthStatus.GREEN);
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -37,6 +37,8 @@ import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.dataTemplateName;
|
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.dataTemplateName;
|
||||||
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.indexTemplateName;
|
import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.indexTemplateName;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
|
@ -197,14 +199,14 @@ public class LocalExporterTests extends MarvelIntegTestCase {
|
||||||
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
||||||
doc.setClusterUUID(internalCluster().getClusterName());
|
doc.setClusterUUID(internalCluster().getClusterName());
|
||||||
doc.setTimestamp(System.currentTimeMillis());
|
doc.setTimestamp(System.currentTimeMillis());
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setRecoveryResponse(new RecoveryResponse());
|
doc.setRecoveryResponse(new RecoveryResponse());
|
||||||
return doc;
|
return doc;
|
||||||
} else {
|
} else {
|
||||||
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(MonitoredSystem.ES.getSystem(), Version.CURRENT.toString());
|
||||||
doc.setClusterUUID(internalCluster().getClusterName());
|
doc.setClusterUUID(internalCluster().getClusterName());
|
||||||
doc.setTimestamp(System.currentTimeMillis());
|
doc.setTimestamp(System.currentTimeMillis());
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterState(ClusterState.PROTO);
|
doc.setClusterState(ClusterState.PROTO);
|
||||||
doc.setStatus(ClusterHealthStatus.GREEN);
|
doc.setStatus(ClusterHealthStatus.GREEN);
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.elasticsearch.marvel.agent.exporter.MonitoringDoc;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class DataResolverTests extends MonitoringIndexNameResolverTestCase {
|
public class DataResolverTests extends MonitoringIndexNameResolverTestCase {
|
||||||
|
@ -30,7 +32,7 @@ public class DataResolverTests extends MonitoringIndexNameResolverTestCase {
|
||||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ import org.joda.time.format.DateTimeFormat;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||||
import static org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver.DELIMITER;
|
import static org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver.DELIMITER;
|
||||||
import static org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver.PREFIX;
|
import static org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver.PREFIX;
|
||||||
|
@ -39,7 +41,8 @@ public class TimestampedResolverTests extends MonitoringIndexNameResolverTestCas
|
||||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode(randomAsciiOfLength(5), DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode(randomAsciiOfLength(5), DummyTransportAddress.INSTANCE,
|
||||||
|
emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,10 @@ import org.elasticsearch.common.transport.DummyTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.marvel.MonitoredSystem;
|
import org.elasticsearch.marvel.MonitoredSystem;
|
||||||
import org.elasticsearch.marvel.action.MonitoringBulkDoc;
|
import org.elasticsearch.marvel.action.MonitoringBulkDoc;
|
||||||
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
|
|
||||||
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCase;
|
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCase;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ public class MonitoringBulkResolverTests extends MonitoringIndexNameResolverTest
|
||||||
MonitoringBulkDoc doc = new MonitoringBulkDoc(MonitoredSystem.KIBANA.getSystem(), Version.CURRENT.toString());
|
MonitoringBulkDoc doc = new MonitoringBulkDoc(MonitoredSystem.KIBANA.getSystem(), Version.CURRENT.toString());
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setType("kibana_stats");
|
doc.setType("kibana_stats");
|
||||||
doc.setSource(new BytesArray("{\"field1\" : \"value1\"}"));
|
doc.setSource(new BytesArray("{\"field1\" : \"value1\"}"));
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -20,6 +20,8 @@ import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCa
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class ClusterInfoResolverTests extends MonitoringIndexNameResolverTestCase<ClusterInfoMonitoringDoc, ClusterInfoResolver> {
|
public class ClusterInfoResolverTests extends MonitoringIndexNameResolverTestCase<ClusterInfoMonitoringDoc, ClusterInfoResolver> {
|
||||||
|
@ -39,7 +41,7 @@ public class ClusterInfoResolverTests extends MonitoringIndexNameResolverTestCas
|
||||||
ClusterInfoMonitoringDoc doc = new ClusterInfoMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
ClusterInfoMonitoringDoc doc = new ClusterInfoMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setVersion(randomFrom(Version.V_2_0_0, Version.CURRENT).toString());
|
doc.setVersion(randomFrom(Version.V_2_0_0, Version.CURRENT).toString());
|
||||||
doc.setLicense(licenseBuilder.build());
|
doc.setLicense(licenseBuilder.build());
|
||||||
doc.setClusterName(randomAsciiOfLength(5));
|
doc.setClusterName(randomAsciiOfLength(5));
|
||||||
|
|
|
@ -15,6 +15,8 @@ import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCa
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ public class ClusterStateNodeResolverTests extends
|
||||||
ClusterStateNodeMonitoringDoc doc = new ClusterStateNodeMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
ClusterStateNodeMonitoringDoc doc = new ClusterStateNodeMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setNodeId(UUID.randomUUID().toString());
|
doc.setNodeId(UUID.randomUUID().toString());
|
||||||
doc.setStateUUID(UUID.randomUUID().toString());
|
doc.setStateUUID(UUID.randomUUID().toString());
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -20,6 +20,8 @@ import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCa
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -30,11 +32,12 @@ public class ClusterStateResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
ClusterStateMonitoringDoc doc = new ClusterStateMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setStatus(randomFrom(ClusterHealthStatus.values()));
|
doc.setStatus(randomFrom(ClusterHealthStatus.values()));
|
||||||
|
|
||||||
DiscoveryNode masterNode = new DiscoveryNode("master", new LocalTransportAddress("master"), Version.CURRENT);
|
DiscoveryNode masterNode = new DiscoveryNode("master", new LocalTransportAddress("master"),
|
||||||
DiscoveryNode otherNode = new DiscoveryNode("other", new LocalTransportAddress("other"), Version.CURRENT);
|
emptyMap(), emptySet(), Version.CURRENT);
|
||||||
|
DiscoveryNode otherNode = new DiscoveryNode("other", new LocalTransportAddress("other"), emptyMap(), emptySet(), Version.CURRENT);
|
||||||
DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(masterNode).put(otherNode).masterNodeId(masterNode.id()).build();
|
DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(masterNode).put(otherNode).masterNodeId(masterNode.id()).build();
|
||||||
ClusterState clusterState = ClusterState.builder(new ClusterName("test")).nodes(discoveryNodes).build();
|
ClusterState clusterState = ClusterState.builder(new ClusterName("test")).nodes(discoveryNodes).build();
|
||||||
doc.setClusterState(clusterState);
|
doc.setClusterState(clusterState);
|
||||||
|
|
|
@ -50,6 +50,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -60,7 +62,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
ClusterStatsMonitoringDoc doc = new ClusterStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
ClusterStatsMonitoringDoc doc = new ClusterStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterStats(randomClusterStats());
|
doc.setClusterStats(randomClusterStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,8 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
*/
|
*/
|
||||||
private ClusterStatsResponse randomClusterStats() {
|
private ClusterStatsResponse randomClusterStats() {
|
||||||
ClusterStatsNodeResponse[] responses = {
|
ClusterStatsNodeResponse[] responses = {
|
||||||
new ClusterStatsNodeResponse(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT),
|
new ClusterStatsNodeResponse(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE,
|
||||||
|
emptyMap(), emptySet(), Version.CURRENT),
|
||||||
ClusterHealthStatus.GREEN, randomNodeInfo(), randomNodeStats(), randomShardStats())
|
ClusterHealthStatus.GREEN, randomNodeInfo(), randomNodeStats(), randomShardStats())
|
||||||
};
|
};
|
||||||
return new ClusterStatsResponse(Math.abs(randomLong()), ClusterName.DEFAULT, UUID.randomUUID().toString(), responses);
|
return new ClusterStatsResponse(Math.abs(randomLong()), ClusterName.DEFAULT, UUID.randomUUID().toString(), responses);
|
||||||
|
@ -104,7 +107,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
BoundTransportAddress transportAddress = new BoundTransportAddress(new TransportAddress[]{DummyTransportAddress.INSTANCE},
|
BoundTransportAddress transportAddress = new BoundTransportAddress(new TransportAddress[]{DummyTransportAddress.INSTANCE},
|
||||||
DummyTransportAddress.INSTANCE);
|
DummyTransportAddress.INSTANCE);
|
||||||
return new NodeInfo(Version.CURRENT, org.elasticsearch.Build.CURRENT,
|
return new NodeInfo(Version.CURRENT, org.elasticsearch.Build.CURRENT,
|
||||||
new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT), Collections.emptyMap(),
|
new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT), emptyMap(),
|
||||||
Settings.EMPTY, DummyOsInfo.INSTANCE, new ProcessInfo(randomInt(), randomBoolean()), JvmInfo.jvmInfo(),
|
Settings.EMPTY, DummyOsInfo.INSTANCE, new ProcessInfo(randomInt(), randomBoolean()), JvmInfo.jvmInfo(),
|
||||||
new ThreadPoolInfo(Collections.singletonList(new ThreadPool.Info("test_threadpool", ThreadPool.ThreadPoolType.FIXED, 5))),
|
new ThreadPoolInfo(Collections.singletonList(new ThreadPool.Info("test_threadpool", ThreadPool.ThreadPoolType.FIXED, 5))),
|
||||||
new TransportInfo(transportAddress, Collections.emptyMap()), new HttpInfo(transportAddress, randomLong()),
|
new TransportInfo(transportAddress, Collections.emptyMap()), new HttpInfo(transportAddress, randomLong()),
|
||||||
|
@ -122,7 +125,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
};
|
};
|
||||||
Map<Index, List<IndexShardStats>> statsByShard = new HashMap<>();
|
Map<Index, List<IndexShardStats>> statsByShard = new HashMap<>();
|
||||||
statsByShard.put(index, Collections.singletonList(new IndexShardStats(new ShardId(index, 0), randomShardStats())));
|
statsByShard.put(index, Collections.singletonList(new IndexShardStats(new ShardId(index, 0), randomShardStats())));
|
||||||
return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT), 0,
|
return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT), 0,
|
||||||
new NodeIndicesStats(new CommonStats(), statsByShard), null, null, null, null,
|
new NodeIndicesStats(new CommonStats(), statsByShard), null, null, null, null,
|
||||||
new FsInfo(0, pathInfo), null, null, null, null, null, null);
|
new FsInfo(0, pathInfo), null, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -30,9 +32,9 @@ public class IndexRecoveryResolverTests extends MonitoringIndexNameResolverTestC
|
||||||
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
IndexRecoveryMonitoringDoc doc = new IndexRecoveryMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
DiscoveryNode localNode = new DiscoveryNode("foo", DummyTransportAddress.INSTANCE, Version.CURRENT);
|
DiscoveryNode localNode = new DiscoveryNode("foo", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT);
|
||||||
Map<String, java.util.List<RecoveryState>> shardRecoveryStates = new HashMap<>();
|
Map<String, java.util.List<RecoveryState>> shardRecoveryStates = new HashMap<>();
|
||||||
shardRecoveryStates.put("test", Collections.singletonList(new RecoveryState(new ShardId("test", "uuid", 0), true,
|
shardRecoveryStates.put("test", Collections.singletonList(new RecoveryState(new ShardId("test", "uuid", 0), true,
|
||||||
RecoveryState.Type.STORE, localNode, localNode)));
|
RecoveryState.Type.STORE, localNode, localNode)));
|
||||||
|
|
|
@ -34,6 +34,8 @@ import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCa
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase
|
||||||
IndexStatsMonitoringDoc doc = new IndexStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
IndexStatsMonitoringDoc doc = new IndexStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setIndexStats(randomIndexStats());
|
doc.setIndexStats(randomIndexStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +59,7 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase
|
||||||
public void testIndexStatsResolver() throws Exception {
|
public void testIndexStatsResolver() throws Exception {
|
||||||
IndexStatsMonitoringDoc doc = newMarvelDoc();
|
IndexStatsMonitoringDoc doc = newMarvelDoc();
|
||||||
doc.setTimestamp(1437580442979L);
|
doc.setTimestamp(1437580442979L);
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
IndexStatsResolver resolver = newResolver();
|
IndexStatsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -38,6 +38,8 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
IndicesStatsMonitoringDoc doc = new IndicesStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
IndicesStatsMonitoringDoc doc = new IndicesStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setIndicesStats(randomIndicesStats());
|
doc.setIndicesStats(randomIndicesStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +64,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
IndicesStatsMonitoringDoc doc = newMarvelDoc();
|
IndicesStatsMonitoringDoc doc = newMarvelDoc();
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(1437580442979L);
|
doc.setTimestamp(1437580442979L);
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
IndicesStatsResolver resolver = newResolver();
|
IndicesStatsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.elasticsearch.test.VersionUtils;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class DiscoveryNodeResolverTests extends MonitoringIndexNameResolverTestCase<DiscoveryNodeMonitoringDoc, DiscoveryNodeResolver> {
|
public class DiscoveryNodeResolverTests extends MonitoringIndexNameResolverTestCase<DiscoveryNodeMonitoringDoc, DiscoveryNodeResolver> {
|
||||||
|
@ -27,9 +28,9 @@ public class DiscoveryNodeResolverTests extends MonitoringIndexNameResolverTestC
|
||||||
DiscoveryNodeMonitoringDoc doc = new DiscoveryNodeMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
DiscoveryNodeMonitoringDoc doc = new DiscoveryNodeMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setNode(new DiscoveryNode(randomAsciiOfLength(3), UUID.randomUUID().toString(),
|
doc.setNode(new DiscoveryNode(randomAsciiOfLength(3), UUID.randomUUID().toString(),
|
||||||
DummyTransportAddress.INSTANCE, emptyMap(),
|
DummyTransportAddress.INSTANCE, emptyMap(), emptySet(),
|
||||||
VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), Version.CURRENT)));
|
VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), Version.CURRENT)));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.IndexNotFoundException;
|
import org.elasticsearch.index.IndexNotFoundException;
|
||||||
import org.elasticsearch.marvel.MarvelSettings;
|
import org.elasticsearch.marvel.MarvelSettings;
|
||||||
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
||||||
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.search.aggregations.Aggregation;
|
import org.elasticsearch.search.aggregations.Aggregation;
|
||||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||||
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
|
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
|
||||||
|
@ -63,7 +64,8 @@ public class MultiNodesStatsTests extends MarvelIntegTestCase {
|
||||||
n = randomIntBetween(1, 2);
|
n = randomIntBetween(1, 2);
|
||||||
logger.debug("--> starting {} client only nodes", n);
|
logger.debug("--> starting {} client only nodes", n);
|
||||||
InternalTestCluster.Async<List<String>> clientNodes = internalCluster().startNodesAsync(n,
|
InternalTestCluster.Async<List<String>> clientNodes = internalCluster().startNodesAsync(n,
|
||||||
settingsBuilder().put("node.client", true).build());
|
settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||||
|
.put(Node.NODE_INGEST_SETTING.getKey(), false).build());
|
||||||
clientNodes.get();
|
clientNodes.get();
|
||||||
nodes += n;
|
nodes += n;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
|
||||||
NodeStatsMonitoringDoc doc = new NodeStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
NodeStatsMonitoringDoc doc = new NodeStatsMonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2));
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setNodeMaster(randomBoolean());
|
doc.setNodeMaster(randomBoolean());
|
||||||
doc.setNodeId(UUID.randomUUID().toString());
|
doc.setNodeId(UUID.randomUUID().toString());
|
||||||
doc.setDiskThresholdDeciderEnabled(randomBoolean());
|
doc.setDiskThresholdDeciderEnabled(randomBoolean());
|
||||||
|
@ -132,7 +134,7 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
|
||||||
new ThreadPoolStats.Stats(ThreadPool.Names.SEARCH, 0, 0, 0, 0, 0, 0),
|
new ThreadPoolStats.Stats(ThreadPool.Names.SEARCH, 0, 0, 0, 0, 0, 0),
|
||||||
new ThreadPoolStats.Stats(InternalWatchExecutor.THREAD_POOL_NAME, 0, 0, 0, 0, 0, 0)
|
new ThreadPoolStats.Stats(InternalWatchExecutor.THREAD_POOL_NAME, 0, 0, 0, 0, 0, 0)
|
||||||
);
|
);
|
||||||
return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT), 0,
|
return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT), 0,
|
||||||
new NodeIndicesStats(new CommonStats(), statsByShard), OsProbe.getInstance().osStats(),
|
new NodeIndicesStats(new CommonStats(), statsByShard), OsProbe.getInstance().osStats(),
|
||||||
ProcessProbe.getInstance().processStats(), JvmStats.jvmStats(),
|
ProcessProbe.getInstance().processStats(), JvmStats.jvmStats(),
|
||||||
new ThreadPoolStats(threadPoolStats),
|
new ThreadPoolStats(threadPoolStats),
|
||||||
|
|
|
@ -19,6 +19,8 @@ import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCa
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<ShardMonitoringDoc, ShardsResolver> {
|
public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<ShardMonitoringDoc, ShardsResolver> {
|
||||||
|
@ -29,7 +31,7 @@ public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<Sha
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(Math.abs(randomLong()));
|
doc.setTimestamp(Math.abs(randomLong()));
|
||||||
doc.setClusterStateUUID(UUID.randomUUID().toString());
|
doc.setClusterStateUUID(UUID.randomUUID().toString());
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
ShardRouting shardRouting = ShardRouting.newUnassigned(new Index(randomAsciiOfLength(5), UUID.randomUUID().toString()),
|
ShardRouting shardRouting = ShardRouting.newUnassigned(new Index(randomAsciiOfLength(5), UUID.randomUUID().toString()),
|
||||||
randomIntBetween(0, 5), null, randomBoolean(), new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
|
randomIntBetween(0, 5), null, randomBoolean(), new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
|
||||||
|
@ -46,7 +48,7 @@ public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<Sha
|
||||||
|
|
||||||
final String clusterStateUUID = UUID.randomUUID().toString();
|
final String clusterStateUUID = UUID.randomUUID().toString();
|
||||||
doc.setClusterStateUUID(clusterStateUUID);
|
doc.setClusterStateUUID(clusterStateUUID);
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
ShardsResolver resolver = newResolver();
|
ShardsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -21,10 +21,10 @@ public class SSLModule extends AbstractShieldModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure(boolean clientMode) {
|
protected void configure(boolean clientMode) {
|
||||||
bind(ClientSSLService.class).asEagerSingleton();
|
bind(ClientSSLService.class).asEagerSingleton();
|
||||||
if (!clientMode) {
|
if (clientMode) {
|
||||||
bind(ServerSSLService.class).asEagerSingleton();
|
|
||||||
} else {
|
|
||||||
bind(ServerSSLService.class).toProvider(Providers.<ServerSSLService>of(null));
|
bind(ServerSSLService.class).toProvider(Providers.<ServerSSLService>of(null));
|
||||||
|
} else {
|
||||||
|
bind(ServerSSLService.class).asEagerSingleton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package org.elasticsearch.shield.support;
|
package org.elasticsearch.shield.support;
|
||||||
|
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.shield.Shield;
|
import org.elasticsearch.shield.Shield;
|
||||||
|
@ -21,7 +22,7 @@ public abstract class AbstractShieldModule extends AbstractModule {
|
||||||
|
|
||||||
public AbstractShieldModule(Settings settings) {
|
public AbstractShieldModule(Settings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.clientMode = !"node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
this.clientMode = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||||
this.shieldEnabled = Shield.enabled(settings);
|
this.shieldEnabled = Shield.enabled(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
|
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||||
|
@ -102,9 +102,8 @@ public class ServerTransportFilterIntegrationTests extends ShieldIntegTestCase {
|
||||||
.put("path.home", createTempDir())
|
.put("path.home", createTempDir())
|
||||||
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
|
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
|
||||||
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
||||||
.put("node.client", true)
|
|
||||||
.build();
|
.build();
|
||||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Arrays.asList(XPackPlugin.class))) {
|
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Collections.singletonList(XPackPlugin.class))) {
|
||||||
node.start();
|
node.start();
|
||||||
assertGreenClusterState(node.client());
|
assertGreenClusterState(node.client());
|
||||||
}
|
}
|
||||||
|
@ -135,9 +134,9 @@ public class ServerTransportFilterIntegrationTests extends ShieldIntegTestCase {
|
||||||
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
||||||
.put("discovery.initial_state_timeout", "2s")
|
.put("discovery.initial_state_timeout", "2s")
|
||||||
.put("path.home", createTempDir())
|
.put("path.home", createTempDir())
|
||||||
.put("node.client", true)
|
.put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||||
.build();
|
.build();
|
||||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Arrays.asList(XPackPlugin.class))) {
|
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Collections.singletonList(XPackPlugin.class))) {
|
||||||
node.start();
|
node.start();
|
||||||
|
|
||||||
// assert that node is not connected by waiting for the timeout
|
// assert that node is not connected by waiting for the timeout
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.elasticsearch.xpack;
|
||||||
import org.elasticsearch.SpecialPermission;
|
import org.elasticsearch.SpecialPermission;
|
||||||
import org.elasticsearch.action.ActionModule;
|
import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.network.NetworkModule;
|
import org.elasticsearch.common.network.NetworkModule;
|
||||||
|
@ -194,7 +195,7 @@ public class XPackPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean transportClientMode(Settings settings) {
|
public static boolean transportClientMode(Settings settings) {
|
||||||
return !"node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
return TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTribeNode(Settings settings) {
|
public static boolean isTribeNode(Settings settings) {
|
||||||
|
|
Loading…
Reference in New Issue