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 org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
11 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
12 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
14 import com.google.common.util.concurrent.SettableFuture;
17 * 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.
24 class BlockingTransactionChainListener implements TransactionChainListener {
26 private final SettableFuture<Throwable> failFuture = SettableFuture.create();
27 private final SettableFuture<Void> successFuture = SettableFuture.create();
30 public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction,
31 final Throwable cause) {
32 failFuture.set(cause);
36 public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
37 successFuture.set(null);
40 public SettableFuture<Throwable> getFailFuture() {
44 public SettableFuture<Void> getSuccessFuture() {