2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.restconf.impl.test;
10 import java.util.concurrent.*;
12 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
13 import org.opendaylight.yangtools.yang.common.RpcResult;
15 public class DummyFuture implements Future<RpcResult<TransactionStatus>> {
17 private final boolean cancel;
18 private final boolean isCancelled;
19 private final boolean isDone;
20 private final RpcResult<TransactionStatus> result;
22 public DummyFuture() {
29 private DummyFuture(Builder builder) {
30 cancel = builder.cancel;
31 isCancelled = builder.isCancelled;
32 isDone = builder.isDone;
33 result = builder.result;
36 public static Builder builder() {
37 return new DummyFuture.Builder();
41 public boolean cancel(boolean mayInterruptIfRunning) {
46 public boolean isCancelled() {
51 public boolean isDone() {
56 public RpcResult<TransactionStatus> get() throws InterruptedException, ExecutionException {
61 public RpcResult<TransactionStatus> get(long timeout, TimeUnit unit) throws InterruptedException,
62 ExecutionException, TimeoutException {
66 public static class Builder {
68 private boolean cancel;
69 private boolean isCancelled;
70 private boolean isDone;
71 private RpcResult<TransactionStatus> result;
73 public Builder cancel(boolean cancel) {
78 public Builder isCancelled(boolean isCancelled) {
79 this.isCancelled = isCancelled;
83 public Builder isDone(boolean isDone) {
88 public Builder rpcResult(RpcResult<TransactionStatus> result) {
93 public Future<RpcResult<TransactionStatus>> build() {
94 return new DummyFuture(this);