X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FBrokerFacadeTest.java;h=ff3fca11b462d4fd285e89a6043fa82032a80f7b;hp=6542396612f6a2c4d57bc0226567e4ac507681c3;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hpb=9fb1df14f2dc885fee1dce821b753cc99af6e54f diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java index 6542396612..ff3fca11b4 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) ${year} Brocade Communications Systems, Inc. and others. All rights reserved. + * Copyright (c) 2014, 2015 Brocade Communications 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, @@ -197,32 +197,29 @@ public class BrokerFacadeTest { @SuppressWarnings("unchecked") final CheckedFuture expFuture = mock(CheckedFuture.class); - final NormalizedNode dummyNode2 = createDummyNode("dummy:namespace2", "2014-07-01", "dummy local name2"); - - when(rwTransaction.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn( - wrapDummyNode(dummyNode2)); - when(rwTransaction.exists(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn( - wrapExistence(true)); + wrapExistence(false)); when(rwTransaction.submit()).thenReturn(expFuture); final CheckedFuture actualFuture = brokerFacade.commitConfigurationDataPost( - (SchemaContext)null, YangInstanceIdentifier.builder().build(), dummyNode); + (SchemaContext)null, instanceID, dummyNode); assertSame("commitConfigurationDataPost", expFuture, actualFuture); final InOrder inOrder = inOrder(domDataBroker, rwTransaction); inOrder.verify(domDataBroker).newReadWriteTransaction(); - inOrder.verify(rwTransaction).merge(LogicalDatastoreType.CONFIGURATION, instanceID, dummyNode); + inOrder.verify(rwTransaction).exists(LogicalDatastoreType.CONFIGURATION, instanceID); + inOrder.verify(rwTransaction).put(LogicalDatastoreType.CONFIGURATION, instanceID, dummyNode); inOrder.verify(rwTransaction).submit(); } @Test(expected = RestconfDocumentedException.class) public void testCommitConfigurationDataPostAlreadyExists() { - when(rwTransaction.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn( - dummyNodeInFuture); + final CheckedFuture successFuture = Futures.immediateCheckedFuture(Boolean.TRUE); + when(rwTransaction.exists(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn( + successFuture); try { // Schema context is only necessary for ensuring parent structure brokerFacade.commitConfigurationDataPost((SchemaContext)null, instanceID, dummyNode);