Move MessageTrackerTest
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / common / actor / TestTicker.java
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 (file)
index 0000000..3387eca
--- /dev/null
@@ -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;
+    }
+}