2 * Copyright (c) 2016 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.mdsal.binding.dom.adapter;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.verify;
12 import static org.mockito.MockitoAnnotations.initMocks;
14 import com.google.common.collect.ImmutableMap;
15 import com.google.common.collect.ImmutableSet;
16 import com.google.common.util.concurrent.MoreExecutors;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.mockito.Mock;
20 import org.opendaylight.mdsal.binding.api.DataTreeListener;
21 import org.opendaylight.mdsal.binding.dom.adapter.test.util.BindingBrokerTestFactory;
22 import org.opendaylight.mdsal.binding.dom.adapter.test.util.BindingTestContext;
23 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
24 import org.opendaylight.mdsal.dom.api.DOMDataTreeListeningException;
26 public class BindingDOMDataTreeListenerAdapterTest {
28 private BindingDOMDataTreeListenerAdapter bindingDOMDataTreeListenerAdapter;
31 private DataTreeListener delegate;
34 public void setUp() throws Exception {
36 final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
37 testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
38 final BindingTestContext testContext = testFactory.getTestContext();
41 bindingDOMDataTreeListenerAdapter =
42 new BindingDOMDataTreeListenerAdapter(delegate, testContext.getCodec(), LogicalDatastoreType.OPERATIONAL);
46 public void onDataTreeChanged() throws Exception {
47 bindingDOMDataTreeListenerAdapter.onDataTreeChanged(ImmutableSet.of(), ImmutableMap.of());
48 verify(delegate).onDataTreeChanged(any(), any());
52 public void onDataTreeFailedTest() throws Exception {
53 bindingDOMDataTreeListenerAdapter.onDataTreeFailed(ImmutableSet.of(new DOMDataTreeListeningException("test")));
54 verify(delegate).onDataTreeFailed(any());