restconf was returning 200 Ok but according to RCF8040, for put,
"If an existing resource is modified, a "204 No Content"
status-line is returned."" and for delete, "If the DELETE request
succeeds, a "204 No Content" status-line is returned.".
Change-Id: I7133cdd747c1869d6b640c873bbcdccd437e8900
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
final CheckedFuture<Void, TransactionCommitFailedException> future = submitData(
transactionNode.getTransactionChain(), transactionNode.getTransactionChain().newReadWriteTransaction(),
transactionNode.getInstanceIdentifier().getInstanceIdentifier());
final CheckedFuture<Void, TransactionCommitFailedException> future = submitData(
transactionNode.getTransactionChain(), transactionNode.getTransactionChain().newReadWriteTransaction(),
transactionNode.getInstanceIdentifier().getInstanceIdentifier());
- final ResponseFactory response = new ResponseFactory(Status.OK);
+ final ResponseFactory response = new ResponseFactory(Status.NO_CONTENT);
FutureCallbackTx.addCallback(future, RestconfDataServiceConstant.DeleteData.DELETE_TX_TYPE, response);
return response.build();
}
FutureCallbackTx.addCallback(future, RestconfDataServiceConstant.DeleteData.DELETE_TX_TYPE, response);
return response.build();
}
final FutureDataFactory<Boolean> existsResponse = new FutureDataFactory<>();
FutureCallbackTx.addCallback(existsFuture, RestconfDataServiceConstant.PutData.PUT_TX_TYPE, existsResponse);
final FutureDataFactory<Boolean> existsResponse = new FutureDataFactory<>();
FutureCallbackTx.addCallback(existsFuture, RestconfDataServiceConstant.PutData.PUT_TX_TYPE, existsResponse);
- final ResponseFactory responseFactory = new ResponseFactory(existsResponse.result ? Status.OK : Status.CREATED);
+ final ResponseFactory responseFactory =
+ new ResponseFactory(existsResponse.result ? Status.NO_CONTENT : Status.CREATED);
final CheckedFuture<Void, TransactionCommitFailedException> submitData = submitData(path, schemaContext,
transactionNode.getTransactionChain(), readWriteTransaction, payload.getData(), insert, point);
FutureCallbackTx.addCallback(submitData, RestconfDataServiceConstant.PutData.PUT_TX_TYPE, responseFactory);
final CheckedFuture<Void, TransactionCommitFailedException> submitData = submitData(path, schemaContext,
transactionNode.getTransactionChain(), readWriteTransaction, payload.getData(), insert, point);
FutureCallbackTx.addCallback(submitData, RestconfDataServiceConstant.PutData.PUT_TX_TYPE, responseFactory);
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
- assertEquals(200, response.getStatus());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
doReturn(Futures.immediateCheckedFuture(null)).when(this.readWrite).submit();
final Response response = this.dataService.putData(null, payload, this.uriInfo);
assertNotNull(response);
- assertEquals(200, response.getStatus());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
.when(this.readWrite).exists(LogicalDatastoreType.CONFIGURATION, this.iidBase);
final Response response = this.dataService.deleteData("example-jukebox:jukebox");
assertNotNull(response);
.when(this.readWrite).exists(LogicalDatastoreType.CONFIGURATION, this.iidBase);
final Response response = this.dataService.deleteData("example-jukebox:jukebox");
assertNotNull(response);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
final Response response =
this.dataService.deleteData("example-jukebox:jukebox/yang-ext:mount/example-jukebox:jukebox");
assertNotNull(response);
final Response response =
this.dataService.deleteData("example-jukebox:jukebox/yang-ext:mount/example-jukebox:jukebox");
assertNotNull(response);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
new TransactionVarsWrapper(this.context, null, this.transactionChain));
// assert success
new TransactionVarsWrapper(this.context, null, this.transactionChain));
// assert success
- assertEquals("Not expected response received", Status.OK.getStatusCode(), response.getStatus());
+ assertEquals("Not expected response received", Status.NO_CONTENT.getStatusCode(), response.getStatus());
assertEquals(404, e.getErrors().get(0).getErrorTag().getStatusCode());
}
}
assertEquals(404, e.getErrors().get(0).getErrorTag().getStatusCode());
}
}
-}
\ No newline at end of file