1 package org.opendaylight.controller.sal.restconf.impl.test;
3 import java.util.concurrent.*;
5 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
6 import org.opendaylight.yangtools.yang.common.RpcResult;
8 public class DummyFuture implements Future<RpcResult<TransactionStatus>> {
10 private final boolean cancel;
11 private final boolean isCancelled;
12 private final boolean isDone;
13 private final RpcResult<TransactionStatus> result;
15 public DummyFuture() {
22 private DummyFuture(Builder builder) {
23 cancel = builder.cancel;
24 isCancelled = builder.isCancelled;
25 isDone = builder.isDone;
26 result = builder.result;
29 public static Builder builder() {
30 return new DummyFuture.Builder();
34 public boolean cancel(boolean mayInterruptIfRunning) {
39 public boolean isCancelled() {
44 public boolean isDone() {
49 public RpcResult<TransactionStatus> get() throws InterruptedException, ExecutionException {
54 public RpcResult<TransactionStatus> get(long timeout, TimeUnit unit) throws InterruptedException,
55 ExecutionException, TimeoutException {
59 public static class Builder {
61 private boolean cancel;
62 private boolean isCancelled;
63 private boolean isDone;
64 private RpcResult<TransactionStatus> result;
66 public Builder cancel(boolean cancel) {
71 public Builder isCancelled(boolean isCancelled) {
72 this.isCancelled = isCancelled;
76 public Builder isDone(boolean isDone) {
81 public Builder rpcResult(RpcResult<TransactionStatus> result) {
86 public Future<RpcResult<TransactionStatus>> build() {
87 return new DummyFuture(this);