TestConsumerPlugin shouldn't register its service on transport clients

Original commit: elastic/x-pack-elasticsearch@c9baa72a4b
This commit is contained in:
Igor Motov 2014-10-30 18:20:02 -04:00
parent 34679d3e47
commit a107b5d70a
2 changed files with 14 additions and 6 deletions

View File

@ -43,7 +43,7 @@ public class LicensesServiceClusterRestartTest extends AbstractLicensesIntegrati
private ImmutableSettings.Builder nodeSettingsBuilder(int nodeOrdinal) {
return ImmutableSettings.settingsBuilder()
//.put(super.nodeSettings(nodeOrdinal))
.put(super.nodeSettings(nodeOrdinal))
.put("gateway.type", "local")
.put("plugins.load_classpath_plugins", false)
.put("node.data", true)
@ -58,10 +58,10 @@ public class LicensesServiceClusterRestartTest extends AbstractLicensesIntegrati
wipeAllLicenses();
}
@Test @Ignore
@Test
public void testClusterRestart() throws Exception {
logger.info("--> starting 1 node");
internalCluster().startNode(nodeSettingsBuilder(0));
internalCluster().startNode();
ensureGreen();
final List<ESLicense> esLicenses = generateAndPutLicense();

View File

@ -5,7 +5,8 @@
*/
package org.elasticsearch.license.plugin;
import org.elasticsearch.common.collect.ImmutableSet;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -15,11 +16,14 @@ import java.util.Collection;
public class TestConsumerPlugin extends AbstractPlugin {
private final boolean isClient;
private final Settings settings;
@Inject
public TestConsumerPlugin(Settings settings) {
this.settings = settings;
this.settings = settings;
this.isClient = DiscoveryNode.clientNode(settings);
}
@Override
@ -35,6 +39,10 @@ public class TestConsumerPlugin extends AbstractPlugin {
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
return ImmutableSet.<Class<? extends LifecycleComponent>>of(TestPluginService.class);
Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
if (!isClient) {
services.add(TestPluginService.class);
}
return services;
}
}