2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.mdsal.binding.javav2.dom.adapter.impl.data.tree;
11 import static org.mockito.Matchers.any;
12 import static org.mockito.Mockito.verify;
13 import static org.mockito.MockitoAnnotations.initMocks;
15 import com.google.common.collect.ImmutableMap;
16 import com.google.common.collect.ImmutableSet;
17 import com.google.common.util.concurrent.MoreExecutors;
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.mockito.Mock;
21 import org.opendaylight.mdsal.binding.javav2.api.DataTreeListener;
22 import org.opendaylight.mdsal.binding.javav2.dom.adapter.test.BindingBrokerTestFactory;
23 import org.opendaylight.mdsal.binding.javav2.dom.adapter.test.BindingTestContext;
24 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
25 import org.opendaylight.mdsal.dom.api.DOMDataTreeListeningException;
27 public class BindingDOMDataTreeListenerAdapterTest {
29 private BindingDOMDataTreeListenerAdapter bindingDOMDataTreeListenerAdapter;
32 private DataTreeListener delegate;
35 public void setUp() throws Exception {
37 final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
38 testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
39 final BindingTestContext testContext = testFactory.getTestContext();
42 bindingDOMDataTreeListenerAdapter =
43 new BindingDOMDataTreeListenerAdapter(delegate, testContext.getCodec(), LogicalDatastoreType.OPERATIONAL);
47 public void onDataTreeChanged() throws Exception {
48 bindingDOMDataTreeListenerAdapter.onDataTreeChanged(ImmutableSet.of(), ImmutableMap.of());
49 verify(delegate).onDataTreeChanged(any(), any());
53 public void onDataTreeFailedTest() throws Exception {
54 bindingDOMDataTreeListenerAdapter.onDataTreeFailed(ImmutableSet.of(new DOMDataTreeListeningException("test")));
55 verify(delegate).onDataTreeFailed(any());