diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-02-26 09:12:06 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-02-26 09:12:06 +0100 |
commit | 5e444ba5af219de555edeeb78aeeaaaae9fd8335 (patch) | |
tree | 3d5d8ca68b9c11c76631f228e8ca8edcac0334ca /clustercontroller-standalone | |
parent | 3777557b0069026d0ba5ace3ff66fca6c7354d92 (diff) |
Nonfunctional changes only
Diffstat (limited to 'clustercontroller-standalone')
3 files changed, 31 insertions, 7 deletions
diff --git a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerConfigFetcherTest.java b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerConfigFetcherTest.java index 15af9bd2c8c..1a1fe9603bf 100644 --- a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerConfigFetcherTest.java +++ b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerConfigFetcherTest.java @@ -1,7 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.standalone; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + public class ClusterControllerConfigFetcherTest extends ClusterControllerTest { + + @Test public void testSimple() throws Exception { setFleetControllerConfigProperty(); setSlobrokConfigProperty(); @@ -16,6 +23,7 @@ public class ClusterControllerConfigFetcherTest extends ClusterControllerTest { configFetcher.close(); } + @Test public void testInitialConfigFailure() throws Exception { setFleetControllerConfigProperty(); setSlobrokConfigProperty(); @@ -35,6 +43,7 @@ public class ClusterControllerConfigFetcherTest extends ClusterControllerTest { } } + @Test public void testConfigUpdate() throws Exception { setFleetControllerConfigProperty(); setSlobrokConfigProperty(); @@ -49,4 +58,5 @@ public class ClusterControllerConfigFetcherTest extends ClusterControllerTest { }; configFetcher.updated(1000); } + } diff --git a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerTest.java b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerTest.java index acd06e27b13..805a5d49330 100644 --- a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerTest.java +++ b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/ClusterControllerTest.java @@ -2,7 +2,8 @@ package com.yahoo.vespa.clustercontroller.standalone; import com.yahoo.vdslib.distribution.Distribution; -import junit.framework.TestCase; +import org.junit.After; +import org.junit.Before; import java.io.File; import java.io.FileWriter; @@ -10,7 +11,8 @@ import java.io.IOException; import java.util.Map; import java.util.TreeMap; -public abstract class ClusterControllerTest extends TestCase { +public abstract class ClusterControllerTest { + private final Map<String, String> overriddenProperties = new TreeMap<>(); private File tempDirectory; @@ -28,12 +30,12 @@ public abstract class ClusterControllerTest extends TestCase { return f; } - @Override + @Before public void setUp() throws Exception { tempDirectory = createTemporaryDirectory(); } - @Override + @After public void tearDown() { for (Map.Entry<String, String> e : overriddenProperties.entrySet()) { if (e.getValue() == null) { @@ -93,4 +95,5 @@ public abstract class ClusterControllerTest extends TestCase { addDistributionConfig(); addZookeepersConfig(); } + } diff --git a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/StandAloneClusterControllerTest.java b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/StandAloneClusterControllerTest.java index 0f20ccb8f9b..f2ff9576548 100644 --- a/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/StandAloneClusterControllerTest.java +++ b/clustercontroller-standalone/src/test/java/com/yahoo/vespa/clustercontroller/standalone/StandAloneClusterControllerTest.java @@ -1,6 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.standalone; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + public class StandAloneClusterControllerTest extends ClusterControllerTest { abstract class Runner implements Runnable { @@ -19,6 +25,7 @@ public class StandAloneClusterControllerTest extends ClusterControllerTest { public abstract void attemptRun() throws Exception; } + @Test public void testSimpleStartStop() throws Exception { setupConfig(); ClusterControllerConfigFetcher configFetcher = new ClusterControllerConfigFetcher(); @@ -28,12 +35,13 @@ public class StandAloneClusterControllerTest extends ClusterControllerTest { controller.stop(); } + @Test public void testShortRun() throws Exception { setupConfig(); ClusterControllerConfigFetcher configFetcher = new ClusterControllerConfigFetcher() { int counter = 0; @Override - public boolean updated(long timeoutMillis) throws Exception { + public boolean updated(long timeoutMillis) { return (++counter % 2 == 0); } @Override @@ -66,30 +74,33 @@ public class StandAloneClusterControllerTest extends ClusterControllerTest { assertNull(r.exception); } + @Test public void testFailStart() throws Exception { setupConfig(); ClusterControllerConfigFetcher configFetcher = new ClusterControllerConfigFetcher(); StandAloneClusterController controller = new StandAloneClusterController(configFetcher) { @Override - public void start() throws Exception { + public void start() { throw new RuntimeException("Foo"); } }; StandAloneClusterController.runApplication(controller); } + @Test public void testFailRun() throws Exception { setupConfig(); ClusterControllerConfigFetcher configFetcher = new ClusterControllerConfigFetcher(); StandAloneClusterController controller = new StandAloneClusterController(configFetcher) { @Override - public void run() throws Exception { + public void run() { throw new RuntimeException("Foo"); } }; StandAloneClusterController.runApplication(controller); } + @Test public void testCallMainToGetCoverage() throws Exception { tearDown(); setProperty("config.id", "file:non-existing"); |