aboutsummaryrefslogtreecommitdiffstats
path: root/zkfacade
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-07-12 15:34:27 +0200
committerGitHub <noreply@github.com>2021-07-12 15:34:27 +0200
commitad255a9f8b2a2cc23d3c0079e87af6878f6176b3 (patch)
tree7103a4dfeb73af45bd46eba8a28eeb47f05f5398 /zkfacade
parent2f69a54cc50e0604cd3748ee18fb33f8fd525bd0 (diff)
parent65e8e5f0c61bacaad1301dce436f677c5a8f0f91 (diff)
Merge pull request #18584 from vespa-engine/musum/cleanup-ConfigCurator-1
Cleanup Curator and ConfigCurator usage [run-systemtest]
Diffstat (limited to 'zkfacade')
-rw-r--r--zkfacade/src/main/java/com/yahoo/vespa/curator/recipes/CuratorCounter.java10
-rw-r--r--zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorCounterTest.java9
2 files changed, 10 insertions, 9 deletions
diff --git a/zkfacade/src/main/java/com/yahoo/vespa/curator/recipes/CuratorCounter.java b/zkfacade/src/main/java/com/yahoo/vespa/curator/recipes/CuratorCounter.java
index dd49b2595a4..2167b45bc02 100644
--- a/zkfacade/src/main/java/com/yahoo/vespa/curator/recipes/CuratorCounter.java
+++ b/zkfacade/src/main/java/com/yahoo/vespa/curator/recipes/CuratorCounter.java
@@ -1,6 +1,7 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.curator.recipes;
+import com.yahoo.path.Path;
import com.yahoo.vespa.curator.Curator;
import org.apache.curator.framework.recipes.atomic.AtomicValue;
import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong;
@@ -9,15 +10,14 @@ import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong;
* A distributed atomic counter.
*
* @author Ulf Lilleengen
- * @since 5.1
*/
public class CuratorCounter {
private final DistributedAtomicLong counter;
- private final String counterPath;
+ private final Path counterPath;
- public CuratorCounter(Curator curator, String counterPath) {
- this.counter = curator.createAtomicCounter(counterPath);
+ public CuratorCounter(Curator curator, Path counterPath) {
+ this.counter = curator.createAtomicCounter(counterPath.getAbsolute());
this.counterPath = counterPath;
}
diff --git a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorCounterTest.java b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorCounterTest.java
index 6b85953a1ff..3d465c6b71f 100644
--- a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorCounterTest.java
+++ b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorCounterTest.java
@@ -1,9 +1,10 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.curator;
import com.yahoo.vespa.curator.mock.MockCurator;
import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong;
import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
/**
@@ -14,9 +15,9 @@ public class CuratorCounterTest {
@Test
public void testCounter() throws Exception {
DistributedAtomicLong counter = new MockCurator().createAtomicCounter("/mycounter");
- counter.initialize(4l);
- assertEquals(4l, counter.get().postValue().longValue());
- assertEquals(5l, counter.increment().postValue().longValue());
+ counter.initialize(4L);
+ assertEquals(4L, counter.get().postValue().longValue());
+ assertEquals(5L, counter.increment().postValue().longValue());
}
}