Created
January 26, 2016 12:21
-
-
Save s1monw/4df9b2b9f4f63438a078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/MarvelShieldIntegration.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/MarvelShieldIntegration.java | |
index 88135c2..1fa81fd 100644 | |
--- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/MarvelShieldIntegration.java | |
+++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/MarvelShieldIntegration.java | |
@@ -18,6 +18,7 @@ | |
package org.elasticsearch.marvel.shield; | |
import org.elasticsearch.ElasticsearchException; | |
+import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.inject.Inject; | |
import org.elasticsearch.common.inject.Injector; | |
import org.elasticsearch.common.settings.Settings; | |
@@ -35,12 +36,15 @@ public class MarvelShieldIntegration { | |
private final boolean enabled; | |
private final AuthenticationService authcService; | |
private final ShieldSettingsFilter settingsFilter; | |
+ private final Injector injector; | |
@Inject | |
public MarvelShieldIntegration(Settings settings, Injector injector) { | |
enabled = enabled(settings); | |
authcService = enabled ? injector.getInstance(AuthenticationService.class) : null; | |
settingsFilter = enabled ? injector.getInstance(ShieldSettingsFilter.class) : null; | |
+ this.injector = injector; | |
+ | |
} | |
public void bindInternalMarvelUser() { | |
@@ -63,4 +67,9 @@ public class MarvelShieldIntegration { | |
return ShieldPlugin.shieldEnabled(settings); | |
} | |
+ public Client getClient() { | |
+ return injector.getInstance(Client.class); | |
+ } | |
+ | |
+ | |
} | |
diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java | |
index 3ebbdb6..323d4c9 100644 | |
--- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java | |
+++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java | |
@@ -78,11 +78,11 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase { | |
public SecuredClient securedClient() { | |
MarvelShieldIntegration integration = internalCluster().getInstance(MarvelShieldIntegration.class); | |
- return new SecuredClient(client(), integration); | |
+ return new SecuredClient(integration.getClient(), integration); | |
} | |
public SecuredClient securedClient(String nodeId) { | |
- MarvelShieldIntegration integration = internalCluster().getInstance(MarvelShieldIntegration.class); | |
+ MarvelShieldIntegration integration = internalCluster().getInstance(MarvelShieldIntegration.class,nodeId); | |
return new SecuredClient(client(nodeId), integration); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment