X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fsal-netconf-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnect%2Fnetconf%2Fsal%2FNetconfDeviceTopologyAdapterTest.java;fp=opendaylight%2Fnetconf%2Fsal-netconf-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnect%2Fnetconf%2Fsal%2FNetconfDeviceTopologyAdapterTest.java;h=0000000000000000000000000000000000000000;hp=158c4c43f098d0843cf24ec97b3f9fabc6a69831;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hpb=b2e81149739c87f0ecc2ce7f06448d7a5d3162b8 diff --git a/opendaylight/netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java b/opendaylight/netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java deleted file mode 100644 index 158c4c43f0..0000000000 --- a/opendaylight/netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.sal.connect.netconf.sal; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import com.google.common.util.concurrent.Futures; -import java.net.InetSocketAddress; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.controller.sal.connect.netconf.listener.NetconfDeviceCapabilities; -import org.opendaylight.controller.sal.connect.util.RemoteDeviceId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class NetconfDeviceTopologyAdapterTest { - - private RemoteDeviceId id = new RemoteDeviceId("test", new InetSocketAddress("localhost", 22)); - - @Mock - private DataBroker broker; - @Mock - private WriteTransaction writeTx; - @Mock - private BindingTransactionChain txChain; - @Mock - private Node data; - - private String txIdent = "test transaction"; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - doReturn(txChain).when(broker).createTransactionChain(any(TransactionChainListener.class)); - doReturn(writeTx).when(txChain).newWriteOnlyTransaction(); - doNothing().when(writeTx).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); - doNothing().when(writeTx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); - - doReturn(txIdent).when(writeTx).getIdentifier(); - } - - @Test - public void testFailedDevice() throws Exception { - doReturn(Futures.immediateCheckedFuture(null)).when(writeTx).submit(); - - NetconfDeviceTopologyAdapter adapter = new NetconfDeviceTopologyAdapter(id, broker); - adapter.setDeviceAsFailed(null); - - verify(txChain, times(2)).newWriteOnlyTransaction(); - verify(writeTx, times(3)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); - } - - @Test - public void testDeviceUpdate() throws Exception { - doReturn(Futures.immediateCheckedFuture(null)).when(writeTx).submit(); - - NetconfDeviceTopologyAdapter adapter = new NetconfDeviceTopologyAdapter(id, broker); - adapter.updateDeviceData(true, new NetconfDeviceCapabilities()); - - verify(txChain, times(2)).newWriteOnlyTransaction(); - verify(writeTx, times(3)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); - } - -} \ No newline at end of file