Bug 6714 - Use singleton service in clustered netconf topology
[netconf.git] / netconf / netconf-topology / src / test / java / org / opendaylight / netconf / topology / pipeline / NetconfDeviceSlaveDataBrokerTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.netconf.topology.pipeline;
10
11 import static org.junit.Assert.assertTrue;
12 import static org.mockito.Mockito.mock;
13
14 import akka.actor.ActorSystem;
15 import java.net.InetSocketAddress;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.mockito.Mock;
19 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
20 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
21 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
22 import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
23 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
24 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
25
26 public class NetconfDeviceSlaveDataBrokerTest {
27
28     private static final RemoteDeviceId REMOTE_DEVICE_ID = new RemoteDeviceId("testing-device", new InetSocketAddress(9999));
29
30     @Mock
31     private ProxyNetconfDeviceDataBroker mockedDataBroker;
32
33     @Mock
34     private ActorSystem mockedActorSystem;
35
36     private NetconfDeviceSlaveDataBroker slaveDataBroker;
37
38     @Before
39     public void setUp() {
40         slaveDataBroker = new NetconfDeviceSlaveDataBroker(mockedActorSystem, REMOTE_DEVICE_ID, mockedDataBroker);
41     }
42
43     @Test(expected = UnsupportedOperationException.class)
44     public void testRegisterDataChangeListener() {
45         slaveDataBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY,
46                 mock(DOMDataChangeListener.class), AsyncDataBroker.DataChangeScope.SUBTREE);
47     }
48
49     @Test(expected = UnsupportedOperationException.class)
50     public void testCreateTransactionChain() {
51         slaveDataBroker.createTransactionChain(mock(TransactionChainListener.class));
52     }
53
54     @Test
55     public void testGetSupportedExtensions() {
56         assertTrue(slaveDataBroker.getSupportedExtensions().isEmpty());
57     }
58 }