.build();
this.contextRef = new SchemaContextRef(
- YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles(PATH_FOR_NEW_SCHEMA_CONTEXT)));
+ YangParserTestUtils.parseYangFiles(TestRestconfUtils.loadFiles(PATH_FOR_NEW_SCHEMA_CONTEXT)));
this.schemaNode = DataSchemaContextTree.from(this.contextRef.get()).getChild(this.iidBase).getDataSchemaNode();
final TransactionChainHandler txHandler = Mockito.mock(TransactionChainHandler.class);
new InstanceIdentifierContext<>(this.iidBase, this.schemaNode, null, this.contextRef.get());
final NormalizedNodeContext payload = new NormalizedNodeContext(iidContext, this.buildBaseCont);
- doReturn(Futures.immediateCheckedFuture(Optional.of(this.buildBaseCont))).when(this.read)
- .read(LogicalDatastoreType.CONFIGURATION, this.iidBase);
- doNothing().when(this.write).put(LogicalDatastoreType.CONFIGURATION, this.iidBase, payload.getData());
+ doReturn(Futures.immediateCheckedFuture(Boolean.TRUE)).when(this.readWrite)
+ .exists(LogicalDatastoreType.CONFIGURATION, this.iidBase);
+ doNothing().when(this.readWrite).put(LogicalDatastoreType.CONFIGURATION, this.iidBase, payload.getData());
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
@Test
public void testPutDataWithMountPoint() {
final DOMDataBroker dataBroker = Mockito.mock(DOMDataBroker.class);
- final DOMMountPoint mountPoint = Mockito.mock(DOMMountPoint.class);
doReturn(Optional.of(dataBroker)).when(mountPoint).getService(DOMDataBroker.class);
doReturn(this.transactionChainHandler.get()).when(dataBroker)
.createTransactionChain(RestConnectorProvider.TRANSACTION_CHAIN_LISTENER);
new InstanceIdentifierContext<>(this.iidBase, this.schemaNode, mountPoint, this.contextRef.get());
final NormalizedNodeContext payload = new NormalizedNodeContext(iidContext, this.buildBaseCont);
- doReturn(Futures.immediateCheckedFuture(Optional.of(this.buildBaseCont))).when(this.read)
- .read(LogicalDatastoreType.CONFIGURATION, this.iidBase);
- doNothing().when(this.write).put(LogicalDatastoreType.CONFIGURATION, this.iidBase, payload.getData());
+ doReturn(Futures.immediateCheckedFuture(Boolean.TRUE)).when(this.readWrite)
+ .exists(LogicalDatastoreType.CONFIGURATION, this.iidBase);
+ doNothing().when(this.readWrite).put(LogicalDatastoreType.CONFIGURATION, this.iidBase, payload.getData());
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
final String errorMessage = status.getEditCollection().get(2).getEditErrors().get(0).getErrorMessage();
assertEquals("Data does not exist", errorMessage);
}
-}
\ No newline at end of file
+}