Prevent ConfigPusher from killing its thread
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / DummyRpcResult.java
1 package org.opendaylight.controller.sal.restconf.impl.test;
2
3 import java.util.Collection;
4
5 import org.opendaylight.yangtools.yang.common.*;
6
7 public class DummyRpcResult<T> implements RpcResult<T> {
8
9     private final boolean isSuccessful;
10     private final T result;
11     private final Collection<RpcError> errors;
12
13     public DummyRpcResult() {
14         isSuccessful = false;
15         result = null;
16         errors = null;
17     }
18
19     private DummyRpcResult(Builder<T> builder) {
20         isSuccessful = builder.isSuccessful;
21         result = builder.result;
22         errors = builder.errors;
23     }
24
25     @Override
26     public boolean isSuccessful() {
27         return isSuccessful;
28     }
29
30     @Override
31     public T getResult() {
32         return result;
33     }
34
35     @Override
36     public Collection<RpcError> getErrors() {
37         return errors;
38     }
39
40     public static class Builder<T> {
41         private boolean isSuccessful;
42         private T result;
43         private Collection<RpcError> errors;
44
45         public Builder<T> isSuccessful(boolean isSuccessful) {
46             this.isSuccessful = isSuccessful;
47             return this;
48         }
49
50         public Builder<T> result(T result) {
51             this.result = result;
52             return this;
53         }
54
55         public Builder<T> errors(Collection<RpcError> errors) {
56             this.errors = errors;
57             return this;
58         }
59
60         public RpcResult<T> build() {
61             return new DummyRpcResult<T>(this);
62         }
63
64     }
65
66 }