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