diff options
Diffstat (limited to 'netconf/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java')
-rw-r--r-- | netconf/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/netconf/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java b/netconf/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java new file mode 100644 index 0000000..ff01937 --- /dev/null +++ b/netconf/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2014 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.sal.restconf.impl.test; + +import java.util.List; +import org.opendaylight.yangtools.yang.common.RpcError; +import org.opendaylight.yangtools.yang.common.RpcResult; + +public class DummyRpcResult<T> implements RpcResult<T> { + + private final boolean isSuccessful; + private final T result; + private final List<RpcError> errors; + + public DummyRpcResult() { + isSuccessful = false; + result = null; + errors = null; + } + + private DummyRpcResult(final Builder<T> builder) { + isSuccessful = builder.isSuccessful; + result = builder.result; + errors = builder.errors; + } + + @Override + public boolean isSuccessful() { + return isSuccessful; + } + + @Override + public T getResult() { + return result; + } + + @Override + public List<RpcError> getErrors() { + return errors; + } + + public static class Builder<T> { + private boolean isSuccessful; + private T result; + private List<RpcError> errors; + + public Builder<T> isSuccessful(final boolean successful) { + this.isSuccessful = successful; + return this; + } + + public Builder<T> result(final T newResult) { + this.result = newResult; + return this; + } + + public Builder<T> errors(final List<RpcError> newErrors) { + this.errors = newErrors; + return this; + } + + public RpcResult<T> build() { + return new DummyRpcResult<>(this); + } + } +} |