X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=netconf%2Fsal-netconf-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Fconnect%2Fnetconf%2Fsal%2Ftx%2FReadOnlyTxTest.java;h=8d67fbc78a234d57282fab1c1dea6e87b9d9edcd;hb=7af02aeff63b4891b87643df8ff6ae8f2debcb9a;hp=1e9c0fcd86f26a632d0d1ebcb76d10139821c6fd;hpb=0e180ee7955d6770dc7d46d94164cf15fc17d3f7;p=netconf.git diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java index 1e9c0fcd86..8d67fbc78a 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java @@ -14,9 +14,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import com.google.common.util.concurrent.Futures; - import java.net.InetSocketAddress; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -62,4 +61,24 @@ public class ReadOnlyTxTest { readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, path); verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.toPath(NetconfMessageTransformUtil.NETCONF_GET_QNAME)), any(NormalizedNode.class)); } + + @Test + public void testExists() throws Exception { + final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mock(SchemaContext.class)); + + final ReadOnlyTx readOnlyTx = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196))); + + readOnlyTx.exists(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.create()); + verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.toPath(NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME)), any(NormalizedNode.class)); + readOnlyTx.exists(LogicalDatastoreType.OPERATIONAL, path); + verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.toPath(NetconfMessageTransformUtil.NETCONF_GET_QNAME)), any(NormalizedNode.class)); + } + + @Test + public void testIdentifier() throws Exception { + final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mock(SchemaContext.class)); + final ReadOnlyTx tx1 = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196))); + final ReadOnlyTx tx2 = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196))); + Assert.assertNotEquals(tx1.getIdentifier(), tx2.getIdentifier()); + } } \ No newline at end of file