use of org.wso2.carbon.humantask.core.engine.commands.UpdateComment in project carbon-apimgt by wso2.
the class APIStoreImplTestCase method testUpdateComment.
@Test(description = "Update comment")
public void testUpdateComment() throws APIManagementException {
ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
APIStore apiStore = getApiStoreImpl(apiDAO);
API api = SampleTestObjectCreator.createDefaultAPI().build();
Mockito.when(apiDAO.isAPIExists(api.getId())).thenReturn(true);
Comment comment = SampleTestObjectCreator.createDefaultComment(api.getId());
Mockito.when(apiDAO.getCommentByUUID(UUID, api.getId())).thenReturn(comment);
apiStore.updateComment(comment, UUID, api.getId(), "admin");
Mockito.verify(apiDAO, Mockito.times(1)).isAPIExists(api.getId());
Mockito.verify(apiDAO, Mockito.times(1)).updateComment(comment, UUID, api.getId());
}
use of org.wso2.carbon.humantask.core.engine.commands.UpdateComment in project carbon-business-process by wso2.
the class TaskOperationsImpl method updateComment.
/**
* Updates the identified comment with the supplied new text.
* @param taskIdURI : task identifier
* @param commentId : comment identifier
* @param s : new comment in plain text.
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void updateComment(final URI taskIdURI, final URI commentId, final String s) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
final Long taskId = validateTaskId(taskIdURI);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
UpdateComment updateCommentCommand = new UpdateComment(getCaller(), taskId, new Long(commentId.toString()), s);
updateCommentCommand.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
Aggregations