blob: 6b85953a1ff54964041e566f982c76fbf339bafc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright 2017 Yahoo Holdings. 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;
/**
* @author Ulf Lilleengen
*/
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());
}
}
|