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.md.sal.dom.broker.impl;
10 import com.google.common.util.concurrent.SettableFuture;
11 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
12 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
13 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
16 * Simple implementation of {@link TransactionChainListener} for testing.
19 * This transaction chain listener does not contain any logic, only update
20 * futures ({@link #getFailFuture()} and {@link #getSuccessFuture()} when
21 * transaction chain event is retrieved.
23 class BlockingTransactionChainListener implements TransactionChainListener {
25 private final SettableFuture<Throwable> failFuture = SettableFuture.create();
26 private final SettableFuture<Void> successFuture = SettableFuture.create();
29 public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction,
30 final Throwable cause) {
31 failFuture.set(cause);
35 public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
36 successFuture.set(null);
39 public SettableFuture<Throwable> getFailFuture() {
43 public SettableFuture<Void> getSuccessFuture() {