diff options
Diffstat (limited to 'clustercontroller-apps')
3 files changed, 18 insertions, 18 deletions
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java index b04f04abfb6..caad5f7fd29 100644 --- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java +++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterController.java @@ -43,7 +43,7 @@ public class ClusterController extends AbstractComponent } - public void setOptions(String clusterName, FleetControllerOptions options, Metric metricImpl) throws Exception { + public void setOptions(FleetControllerOptions options, Metric metricImpl) throws Exception { metricWrapper.updateMetricImplementation(metricImpl); if (options.zooKeeperServerAddress != null && !"".equals(options.zooKeeperServerAddress)) { // Wipe this path ... it's unclear why @@ -54,13 +54,13 @@ public class ClusterController extends AbstractComponent curator.framework().create().creatingParentsIfNeeded().forPath(path); } synchronized (controllers) { - FleetController controller = controllers.get(clusterName); + FleetController controller = controllers.get(options.clusterName); if (controller == null) { StatusHandler.ContainerStatusPageServer statusPageServer = new StatusHandler.ContainerStatusPageServer(); controller = FleetController.create(options, statusPageServer, metricWrapper); - controllers.put(clusterName, controller); - status.put(clusterName, statusPageServer); + controllers.put(options.clusterName, controller); + status.put(options.clusterName, statusPageServer); } else { controller.updateOptions(options, 0); } diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java index 5ce8f20bced..ad65435c770 100644 --- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java +++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java @@ -32,7 +32,7 @@ public class ClusterControllerClusterConfigurer { configure(slobroksConfig); configure(zookeepersConfig); if (controller != null) { - controller.setOptions(options.clusterName, options, metricImpl); + controller.setOptions(options, metricImpl); } } diff --git a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerTest.java b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerTest.java index b86d9a561d3..f4df8a4e2a3 100644 --- a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerTest.java +++ b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerTest.java @@ -1,8 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Doesn't really test cluster controller, but runs some lines of code. - * System tests verifies that container can load it.. - */ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.apps.clustercontroller; import com.yahoo.jdisc.Metric; @@ -13,14 +9,18 @@ import org.junit.Test; import java.util.Map; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +/** + * Doesn't really test cluster controller, but runs some lines of code. + * System tests verifies that container can load it.. + */ public class ClusterControllerTest { private FleetControllerOptions options = new FleetControllerOptions("storage"); - private Metric metric = new Metric() { + private final Metric metric = new Metric() { @Override public void set(String s, Number number, Context context) {} @Override @@ -42,13 +42,13 @@ public class ClusterControllerTest { // Cluster controller object keeps state and should never be remade, so should // inject nothing ClusterController cc = new ClusterController(); - cc.setOptions("storage", options, metric); - cc.setOptions("storage", options, metric); + cc.setOptions(options, metric); + cc.setOptions(options, metric); cc.getFleetControllers(); cc.getAll(); - assertTrue(cc.get("storage") != null); - assertFalse(cc.get("music") != null); + assertNotNull(cc.get("storage")); + assertNull(cc.get("music")); cc.deconstruct(); } @@ -59,7 +59,7 @@ public class ClusterControllerTest { throw new Exception("Foo"); } }; - cc.setOptions("storage", options, metric); + cc.setOptions(options, metric); cc.deconstruct(); } |