Remove DummyTransportAddress (elastic/elasticsearch#2048)
this is a partner PR to elastic/elasticsearchelastic/elasticsearch#17811 Original commit: elastic/x-pack-elasticsearch@1db11e4340
This commit is contained in:
parent
bd0cf521aa
commit
8cc49b5b30
|
@ -19,7 +19,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.settings.ClusterSettings;
|
import org.elasticsearch.common.settings.ClusterSettings;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||||
import org.elasticsearch.discovery.DiscoverySettings;
|
import org.elasticsearch.discovery.DiscoverySettings;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -90,7 +90,8 @@ public class TransportMonitoringBulkActionTests extends ESTestCase {
|
||||||
clusterService = new ClusterService(Settings.builder().put("cluster.name",
|
clusterService = new ClusterService(Settings.builder().put("cluster.name",
|
||||||
TransportMonitoringBulkActionTests.class.getName()).build(),
|
TransportMonitoringBulkActionTests.class.getName()).build(),
|
||||||
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), threadPool);
|
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), threadPool);
|
||||||
clusterService.setLocalNode(new DiscoveryNode("node", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
clusterService.setLocalNode(new DiscoveryNode("node", LocalTransportAddress.buildUnique(), 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) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
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.LocalTransportAddress;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -130,7 +130,7 @@ public class MonitoringDocTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<DiscoveryNode.Role> roles = new HashSet<>(randomSubsetOf(Arrays.asList(DiscoveryNode.Role.values())));
|
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), LocalTransportAddress.buildUnique(),
|
||||||
DummyTransportAddress.INSTANCE, attributes, roles, randomVersion(random()));
|
attributes, roles, randomVersion(random()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||||
|
@ -439,14 +439,14 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
|
||||||
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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterState(ClusterState.PROTO);
|
doc.setClusterState(ClusterState.PROTO);
|
||||||
doc.setStatus(ClusterHealthStatus.GREEN);
|
doc.setStatus(ClusterHealthStatus.GREEN);
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||||
|
@ -198,14 +198,14 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
|
||||||
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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterState(ClusterState.PROTO);
|
doc.setClusterState(ClusterState.PROTO);
|
||||||
doc.setStatus(ClusterHealthStatus.GREEN);
|
doc.setStatus(ClusterHealthStatus.GREEN);
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.xpack.monitoring.agent.exporter.MonitoringDoc;
|
import org.elasticsearch.xpack.monitoring.agent.exporter.MonitoringDoc;
|
||||||
|
@ -31,7 +31,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
||||||
|
@ -40,7 +40,7 @@ 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,
|
doc.setSourceNode(new DiscoveryNode(randomAsciiOfLength(5), LocalTransportAddress.buildUnique(),
|
||||||
emptyMap(), emptySet(), Version.CURRENT));
|
emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver.bulk;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
||||||
import org.elasticsearch.xpack.monitoring.action.MonitoringBulkDoc;
|
import org.elasticsearch.xpack.monitoring.action.MonitoringBulkDoc;
|
||||||
|
@ -39,7 +39,7 @@ public class MonitoringBulkDataResolverTests extends MonitoringIndexNameResolver
|
||||||
|
|
||||||
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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver.bulk;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
||||||
import org.elasticsearch.xpack.monitoring.action.MonitoringBulkDoc;
|
import org.elasticsearch.xpack.monitoring.action.MonitoringBulkDoc;
|
||||||
|
@ -41,7 +41,7 @@ public class MonitoringBulkTimestampedResolverTests
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
|
||||||
import org.elasticsearch.cluster.ClusterName;
|
import org.elasticsearch.cluster.ClusterName;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.license.core.License;
|
import org.elasticsearch.license.core.License;
|
||||||
|
@ -42,7 +42,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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));
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver.cluster;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.ClusterStateNodeMonitoringDoc;
|
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.ClusterStateNodeMonitoringDoc;
|
||||||
import org.elasticsearch.xpack.monitoring.agent.exporter.MonitoringTemplateUtils;
|
import org.elasticsearch.xpack.monitoring.agent.exporter.MonitoringTemplateUtils;
|
||||||
|
@ -28,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
|
||||||
import org.elasticsearch.common.transport.LocalTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.ClusterStateMonitoringDoc;
|
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.ClusterStateMonitoringDoc;
|
||||||
|
@ -32,7 +31,7 @@ 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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setStatus(randomFrom(ClusterHealthStatus.values()));
|
doc.setStatus(randomFrom(ClusterHealthStatus.values()));
|
||||||
|
|
||||||
DiscoveryNode masterNode = new DiscoveryNode("master", new LocalTransportAddress("master"),
|
DiscoveryNode masterNode = new DiscoveryNode("master", new LocalTransportAddress("master"),
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
@ -63,7 +63,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setClusterStats(randomClusterStats());
|
doc.setClusterStats(randomClusterStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
*/
|
*/
|
||||||
private ClusterStatsResponse randomClusterStats() {
|
private ClusterStatsResponse randomClusterStats() {
|
||||||
List<ClusterStatsNodeResponse> responses = Collections.singletonList(
|
List<ClusterStatsNodeResponse> responses = Collections.singletonList(
|
||||||
new ClusterStatsNodeResponse(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE,
|
new ClusterStatsNodeResponse(new DiscoveryNode("node_0", LocalTransportAddress.buildUnique(),
|
||||||
emptyMap(), emptySet(), Version.CURRENT),
|
emptyMap(), emptySet(), Version.CURRENT),
|
||||||
ClusterHealthStatus.GREEN, randomNodeInfo(), randomNodeStats(), randomShardStats())
|
ClusterHealthStatus.GREEN, randomNodeInfo(), randomNodeStats(), randomShardStats())
|
||||||
);
|
);
|
||||||
|
@ -106,10 +106,10 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
* @return a random {@link NodeInfo} used to resolve a monitoring document.
|
* @return a random {@link NodeInfo} used to resolve a monitoring document.
|
||||||
*/
|
*/
|
||||||
private NodeInfo randomNodeInfo() {
|
private NodeInfo randomNodeInfo() {
|
||||||
BoundTransportAddress transportAddress = new BoundTransportAddress(new TransportAddress[]{DummyTransportAddress.INSTANCE},
|
BoundTransportAddress transportAddress = new BoundTransportAddress(new TransportAddress[]{LocalTransportAddress.buildUnique()},
|
||||||
DummyTransportAddress.INSTANCE);
|
LocalTransportAddress.buildUnique());
|
||||||
return new NodeInfo(Version.CURRENT, org.elasticsearch.Build.CURRENT,
|
return new NodeInfo(Version.CURRENT, org.elasticsearch.Build.CURRENT,
|
||||||
new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT),
|
new DiscoveryNode("node_0", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT),
|
||||||
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()),
|
||||||
|
@ -127,7 +127,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, emptyMap(), emptySet(), Version.CURRENT), 0,
|
return new NodeStats(new DiscoveryNode("node_0", LocalTransportAddress.buildUnique(), 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, null, pathInfo), null, null, null, null, null, null);
|
new FsInfo(0, null, pathInfo), null, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver.indices;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.shard.ShardId;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.indices.recovery.RecoveryState;
|
import org.elasticsearch.indices.recovery.RecoveryState;
|
||||||
|
@ -32,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
DiscoveryNode localNode = new DiscoveryNode("foo", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT);
|
DiscoveryNode localNode = new DiscoveryNode("foo", LocalTransportAddress.buildUnique(), 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)));
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
||||||
|
@ -45,7 +45,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setIndexStats(randomIndexStats());
|
doc.setIndexStats(randomIndexStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase
|
||||||
public void testIndexStatsResolver() throws Exception {
|
public void testIndexStatsResolver() throws Exception {
|
||||||
IndexStatsMonitoringDoc doc = newMonitoringDoc();
|
IndexStatsMonitoringDoc doc = newMonitoringDoc();
|
||||||
doc.setTimestamp(1437580442979L);
|
doc.setTimestamp(1437580442979L);
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
IndexStatsResolver resolver = newResolver();
|
IndexStatsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
||||||
|
@ -49,7 +49,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
doc.setIndicesStats(randomIndicesStats());
|
doc.setIndicesStats(randomIndicesStats());
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa
|
||||||
IndicesStatsMonitoringDoc doc = newMonitoringDoc();
|
IndicesStatsMonitoringDoc doc = newMonitoringDoc();
|
||||||
doc.setClusterUUID(randomAsciiOfLength(5));
|
doc.setClusterUUID(randomAsciiOfLength(5));
|
||||||
doc.setTimestamp(1437580442979L);
|
doc.setTimestamp(1437580442979L);
|
||||||
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
IndicesStatsResolver resolver = newResolver();
|
IndicesStatsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.monitoring.agent.resolver.node;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.test.VersionUtils;
|
import org.elasticsearch.test.VersionUtils;
|
||||||
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.DiscoveryNodeMonitoringDoc;
|
import org.elasticsearch.xpack.monitoring.agent.collector.cluster.DiscoveryNodeMonitoringDoc;
|
||||||
|
@ -28,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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(), emptySet(),
|
LocalTransportAddress.buildUnique(), emptyMap(), emptySet(),
|
||||||
VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), Version.CURRENT)));
|
VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), Version.CURRENT)));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
||||||
|
@ -59,7 +59,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), 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());
|
||||||
|
@ -133,7 +133,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, emptyMap(), emptySet(), Version.CURRENT), 0,
|
return new NodeStats(new DiscoveryNode("node_0", LocalTransportAddress.buildUnique(), 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),
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.shard.ShardId;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
|
@ -31,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(new Index(randomAsciiOfLength(5), UUID.randomUUID().toString()),
|
ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(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));
|
||||||
|
@ -48,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, emptyMap(), emptySet(), Version.CURRENT));
|
doc.setSourceNode(new DiscoveryNode("id", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT));
|
||||||
|
|
||||||
ShardsResolver resolver = newResolver();
|
ShardsResolver resolver = newResolver();
|
||||||
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
|
||||||
|
|
|
@ -17,20 +17,20 @@ import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.inject.util.Providers;
|
import org.elasticsearch.common.inject.util.Providers;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
import org.elasticsearch.threadpool.TestThreadPool;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
import org.elasticsearch.transport.Transport;
|
||||||
|
import org.elasticsearch.transport.TransportMessage;
|
||||||
import org.elasticsearch.xpack.security.InternalClient;
|
import org.elasticsearch.xpack.security.InternalClient;
|
||||||
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail.State;
|
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail.State;
|
||||||
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
||||||
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
||||||
import org.elasticsearch.xpack.security.user.SystemUser;
|
import org.elasticsearch.xpack.security.user.SystemUser;
|
||||||
import org.elasticsearch.xpack.security.user.User;
|
import org.elasticsearch.xpack.security.user.User;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
|
||||||
import org.elasticsearch.threadpool.TestThreadPool;
|
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
|
||||||
import org.elasticsearch.transport.Transport;
|
|
||||||
import org.elasticsearch.transport.TransportMessage;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public class IndexAuditTrailMutedTests extends ESTestCase {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
transport = mock(Transport.class);
|
transport = mock(Transport.class);
|
||||||
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { DummyTransportAddress.INSTANCE },
|
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { LocalTransportAddress.buildUnique() },
|
||||||
DummyTransportAddress.INSTANCE));
|
LocalTransportAddress.buildUnique()));
|
||||||
|
|
||||||
threadPool = new TestThreadPool("index audit trail tests");
|
threadPool = new TestThreadPool("index audit trail tests");
|
||||||
transportClient = TransportClient.builder().settings(Settings.EMPTY).build();
|
transportClient = TransportClient.builder().settings(Settings.EMPTY).build();
|
||||||
|
|
|
@ -21,21 +21,11 @@ import org.elasticsearch.common.inject.util.Providers;
|
||||||
import org.elasticsearch.common.network.NetworkAddress;
|
import org.elasticsearch.common.network.NetworkAddress;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
|
||||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||||
import org.elasticsearch.common.transport.LocalTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.xpack.security.Security;
|
|
||||||
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail.Message;
|
|
||||||
import org.elasticsearch.xpack.security.transport.netty.SecurityNettyTransport;
|
|
||||||
import org.elasticsearch.xpack.security.user.SystemUser;
|
|
||||||
import org.elasticsearch.xpack.security.user.User;
|
|
||||||
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
|
||||||
import org.elasticsearch.xpack.security.crypto.InternalCryptoService;
|
|
||||||
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
|
||||||
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||||
|
@ -46,6 +36,15 @@ import org.elasticsearch.transport.Transport;
|
||||||
import org.elasticsearch.transport.TransportInfo;
|
import org.elasticsearch.transport.TransportInfo;
|
||||||
import org.elasticsearch.transport.TransportMessage;
|
import org.elasticsearch.transport.TransportMessage;
|
||||||
import org.elasticsearch.transport.TransportRequest;
|
import org.elasticsearch.transport.TransportRequest;
|
||||||
|
import org.elasticsearch.xpack.security.Security;
|
||||||
|
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail.Message;
|
||||||
|
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
||||||
|
import org.elasticsearch.xpack.security.crypto.InternalCryptoService;
|
||||||
|
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
||||||
|
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
||||||
|
import org.elasticsearch.xpack.security.transport.netty.SecurityNettyTransport;
|
||||||
|
import org.elasticsearch.xpack.security.user.SystemUser;
|
||||||
|
import org.elasticsearch.xpack.security.user.User;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
import org.joda.time.format.ISODateTimeFormat;
|
import org.joda.time.format.ISODateTimeFormat;
|
||||||
|
@ -64,12 +63,12 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
||||||
|
import static org.elasticsearch.test.InternalTestCluster.clusterName;
|
||||||
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.DAILY;
|
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.DAILY;
|
||||||
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.HOURLY;
|
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.HOURLY;
|
||||||
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.MONTHLY;
|
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.MONTHLY;
|
||||||
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.WEEKLY;
|
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.WEEKLY;
|
||||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
|
||||||
import static org.elasticsearch.test.InternalTestCluster.clusterName;
|
|
||||||
import static org.hamcrest.Matchers.contains;
|
import static org.hamcrest.Matchers.contains;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -255,8 +254,8 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
Settings settings = builder.put(settings(rollover, includes, excludes)).build();
|
Settings settings = builder.put(settings(rollover, includes, excludes)).build();
|
||||||
logger.info("--> settings: [{}]", settings.getAsMap().toString());
|
logger.info("--> settings: [{}]", settings.getAsMap().toString());
|
||||||
Transport transport = mock(Transport.class);
|
Transport transport = mock(Transport.class);
|
||||||
BoundTransportAddress boundTransportAddress = new BoundTransportAddress(new TransportAddress[]{DummyTransportAddress.INSTANCE},
|
BoundTransportAddress boundTransportAddress = new BoundTransportAddress(new TransportAddress[]{ remoteHostAddress()},
|
||||||
DummyTransportAddress.INSTANCE);
|
remoteHostAddress());
|
||||||
when(transport.boundAddress()).thenReturn(boundTransportAddress);
|
when(transport.boundAddress()).thenReturn(boundTransportAddress);
|
||||||
threadPool = new TestThreadPool("index audit trail tests");
|
threadPool = new TestThreadPool("index audit trail tests");
|
||||||
enqueuedMessage = new SetOnce<>();
|
enqueuedMessage = new SetOnce<>();
|
||||||
|
@ -279,7 +278,7 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
assertAuditMessage(hit, "transport", "anonymous_access_denied");
|
assertAuditMessage(hit, "transport", "anonymous_access_denied");
|
||||||
Map<String, Object> sourceMap = hit.sourceAsMap();
|
Map<String, Object> sourceMap = hit.sourceAsMap();
|
||||||
if (message instanceof RemoteHostMockMessage) {
|
if (message instanceof RemoteHostMockMessage) {
|
||||||
assertEquals(remoteHostAddress(), sourceMap.get("origin_address"));
|
assertEquals(remoteHostAddress().toString(), sourceMap.get("origin_address"));
|
||||||
} else {
|
} else {
|
||||||
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
||||||
}
|
}
|
||||||
|
@ -316,7 +315,7 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
assertAuditMessage(hit, "transport", "authentication_failed");
|
assertAuditMessage(hit, "transport", "authentication_failed");
|
||||||
|
|
||||||
if (message instanceof RemoteHostMockMessage) {
|
if (message instanceof RemoteHostMockMessage) {
|
||||||
assertEquals(remoteHostAddress(), sourceMap.get("origin_address"));
|
assertEquals(remoteHostAddress().toString(), sourceMap.get("origin_address"));
|
||||||
} else {
|
} else {
|
||||||
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
||||||
}
|
}
|
||||||
|
@ -336,7 +335,7 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
assertAuditMessage(hit, "transport", "authentication_failed");
|
assertAuditMessage(hit, "transport", "authentication_failed");
|
||||||
Map<String, Object> sourceMap = hit.sourceAsMap();
|
Map<String, Object> sourceMap = hit.sourceAsMap();
|
||||||
if (message instanceof RemoteHostMockMessage) {
|
if (message instanceof RemoteHostMockMessage) {
|
||||||
assertEquals(remoteHostAddress(), sourceMap.get("origin_address"));
|
assertEquals(remoteHostAddress().toString(), sourceMap.get("origin_address"));
|
||||||
} else {
|
} else {
|
||||||
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
||||||
}
|
}
|
||||||
|
@ -391,7 +390,7 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
Map<String, Object> sourceMap = hit.sourceAsMap();
|
Map<String, Object> sourceMap = hit.sourceAsMap();
|
||||||
|
|
||||||
if (message instanceof RemoteHostMockMessage) {
|
if (message instanceof RemoteHostMockMessage) {
|
||||||
assertEquals(remoteHostAddress(), sourceMap.get("origin_address"));
|
assertEquals(remoteHostAddress().toString(), sourceMap.get("origin_address"));
|
||||||
} else {
|
} else {
|
||||||
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
assertEquals("local[local_host]", sourceMap.get("origin_address"));
|
||||||
}
|
}
|
||||||
|
@ -621,8 +620,8 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
DateTime dateTime = ISODateTimeFormat.dateTimeParser().withZoneUTC().parseDateTime((String) sourceMap.get("@timestamp"));
|
DateTime dateTime = ISODateTimeFormat.dateTimeParser().withZoneUTC().parseDateTime((String) sourceMap.get("@timestamp"));
|
||||||
assertThat(dateTime.isBefore(DateTime.now(DateTimeZone.UTC)), is(true));
|
assertThat(dateTime.isBefore(DateTime.now(DateTimeZone.UTC)), is(true));
|
||||||
|
|
||||||
assertThat(DummyTransportAddress.INSTANCE.getHost(), equalTo(sourceMap.get("node_host_name")));
|
assertThat(remoteHostAddress().getHost(), equalTo(sourceMap.get("node_host_name")));
|
||||||
assertThat(DummyTransportAddress.INSTANCE.getAddress(), equalTo(sourceMap.get("node_host_address")));
|
assertThat(remoteHostAddress().getAddress(), equalTo(sourceMap.get("node_host_address")));
|
||||||
|
|
||||||
assertEquals(layer, sourceMap.get("layer"));
|
assertEquals(layer, sourceMap.get("layer"));
|
||||||
assertEquals(type, sourceMap.get("event_type"));
|
assertEquals(type, sourceMap.get("event_type"));
|
||||||
|
@ -636,13 +635,13 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
|
|
||||||
private static class RemoteHostMockMessage extends TransportMessage {
|
private static class RemoteHostMockMessage extends TransportMessage {
|
||||||
RemoteHostMockMessage() throws Exception {
|
RemoteHostMockMessage() throws Exception {
|
||||||
remoteAddress(DummyTransportAddress.INSTANCE);
|
remoteAddress(remoteHostAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RemoteHostMockTransportRequest extends TransportRequest {
|
private static class RemoteHostMockTransportRequest extends TransportRequest {
|
||||||
RemoteHostMockTransportRequest() throws Exception {
|
RemoteHostMockTransportRequest() throws Exception {
|
||||||
remoteAddress(DummyTransportAddress.INSTANCE);
|
remoteAddress(remoteHostAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,8 +737,8 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
|
||||||
return actionGet.getStatus();
|
return actionGet.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String remoteHostAddress() throws Exception {
|
private static LocalTransportAddress remoteHostAddress() {
|
||||||
return DummyTransportAddress.INSTANCE.toString();
|
return new LocalTransportAddress("_remote_host_");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.inject.util.Providers;
|
import org.elasticsearch.common.inject.util.Providers;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||||
import org.elasticsearch.test.rest.FakeRestRequest;
|
import org.elasticsearch.test.rest.FakeRestRequest;
|
||||||
|
@ -49,8 +49,8 @@ public class IndexAuditTrailUpdateMappingTests extends SecurityIntegTestCase {
|
||||||
Settings settings = Settings.builder().put("xpack.security.audit.index.rollover", rollover.name().toLowerCase(Locale.ENGLISH))
|
Settings settings = Settings.builder().put("xpack.security.audit.index.rollover", rollover.name().toLowerCase(Locale.ENGLISH))
|
||||||
.put("path.home", createTempDir()).build();
|
.put("path.home", createTempDir()).build();
|
||||||
Transport transport = mock(Transport.class);
|
Transport transport = mock(Transport.class);
|
||||||
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { DummyTransportAddress.INSTANCE },
|
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { LocalTransportAddress.buildUnique() },
|
||||||
DummyTransportAddress.INSTANCE));
|
LocalTransportAddress.buildUnique()));
|
||||||
auditor = new IndexAuditTrail(settings, transport, Providers.of(internalClient()), threadPool,
|
auditor = new IndexAuditTrail(settings, transport, Providers.of(internalClient()), threadPool,
|
||||||
mock(ClusterService.class));
|
mock(ClusterService.class));
|
||||||
|
|
||||||
|
|
|
@ -13,22 +13,21 @@ import org.elasticsearch.common.component.Lifecycle;
|
||||||
import org.elasticsearch.common.network.NetworkAddress;
|
import org.elasticsearch.common.network.NetworkAddress;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
|
||||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||||
import org.elasticsearch.common.transport.LocalTransportAddress;
|
import org.elasticsearch.common.transport.LocalTransportAddress;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
import org.elasticsearch.xpack.security.user.SystemUser;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.security.user.User;
|
import org.elasticsearch.transport.Transport;
|
||||||
|
import org.elasticsearch.transport.TransportMessage;
|
||||||
import org.elasticsearch.xpack.security.audit.logfile.CapturingLogger.Level;
|
import org.elasticsearch.xpack.security.audit.logfile.CapturingLogger.Level;
|
||||||
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
import org.elasticsearch.xpack.security.authc.AuthenticationToken;
|
||||||
import org.elasticsearch.xpack.security.rest.RemoteHostHeader;
|
import org.elasticsearch.xpack.security.rest.RemoteHostHeader;
|
||||||
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
||||||
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.xpack.security.user.SystemUser;
|
||||||
import org.elasticsearch.transport.Transport;
|
import org.elasticsearch.xpack.security.user.User;
|
||||||
import org.elasticsearch.transport.TransportMessage;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -115,8 +114,8 @@ public class LoggingAuditTrailTests extends ESTestCase {
|
||||||
.build();
|
.build();
|
||||||
transport = mock(Transport.class);
|
transport = mock(Transport.class);
|
||||||
when(transport.lifecycleState()).thenReturn(Lifecycle.State.STARTED);
|
when(transport.lifecycleState()).thenReturn(Lifecycle.State.STARTED);
|
||||||
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { DummyTransportAddress.INSTANCE },
|
when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { LocalTransportAddress.buildUnique() },
|
||||||
DummyTransportAddress.INSTANCE));
|
LocalTransportAddress.buildUnique()));
|
||||||
prefix = LoggingAuditTrail.resolvePrefix(settings, transport);
|
prefix = LoggingAuditTrail.resolvePrefix(settings, transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue