X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FTestTicker.java;fp=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FTestTicker.java;h=3387eca0e635dc6fe2e870cb419f117e2c67b04e;hb=3dffbf36946550b6bf11ac03a80cd4e5c58dbbdf;hp=0000000000000000000000000000000000000000;hpb=a7740542c8ce1985c0a35767966c781805dfad84;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/TestTicker.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/TestTicker.java new file mode 100644 index 0000000000..3387eca0e6 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/TestTicker.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.common.actor; + +import com.google.common.base.Ticker; + +/** + * Utility {@link Ticker} where passage of time is explicitly controlled via {@link #increment(long)}. + * + * @author Robert Varga + */ +public final class TestTicker extends Ticker { + private long counter = 0; + + @Override + public long read() { + return counter; + } + + public long increment(final long ticks) { + counter += ticks; + return counter; + } +}