use of com.icthh.xm.ms.entity.domain.Comment in project xm-ms-entity by xm-online.
the class CommentResource method getAllComments.
/**
* GET /comments : get all the comments.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and the list of comments in body
*/
@GetMapping("/comments")
@Timed
public ResponseEntity<List<Comment>> getAllComments(@ApiParam Pageable pageable) {
Page<Comment> page = commentService.findAll(pageable, null);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/comments");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
use of com.icthh.xm.ms.entity.domain.Comment in project xm-ms-entity by xm-online.
the class CommentResource method searchComments.
/**
* SEARCH /_search/comments?query=:query : search for the comment corresponding
* to the query.
*
* @param query the query of the comment search
* @param pageable the pagination information
* @return the result of the search
*/
@GetMapping("/_search/comments")
@Timed
public ResponseEntity<List<Comment>> searchComments(@RequestParam String query, @ApiParam Pageable pageable) {
Page<Comment> page = commentService.search(query, pageable, null);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/comments");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
use of com.icthh.xm.ms.entity.domain.Comment in project xm-ms-entity by xm-online.
the class CommentResourceIntTest method updateComment.
@Test
@Transactional
public void updateComment() throws Exception {
// Initialize the database
commentService.save(comment);
int databaseSizeBeforeUpdate = commentRepository.findAll().size();
// Update the comment
Comment updatedComment = commentRepository.findOne(comment.getId());
updatedComment.userKey(UPDATED_USER_KEY).message(UPDATED_MESSAGE).entryDate(UPDATED_ENTRY_DATE);
restCommentMockMvc.perform(put("/api/comments").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedComment))).andExpect(status().isOk());
// Validate the Comment in the database
List<Comment> commentList = commentRepository.findAll();
assertThat(commentList).hasSize(databaseSizeBeforeUpdate);
Comment testComment = commentList.get(commentList.size() - 1);
assertThat(testComment.getUserKey()).isEqualTo(DEFAULT_USER_KEY);
assertThat(testComment.getMessage()).isEqualTo(UPDATED_MESSAGE);
assertThat(testComment.getEntryDate()).isEqualTo(UPDATED_ENTRY_DATE);
// Validate the Comment in Elasticsearch
Comment commentEs = commentSearchRepository.findOne(testComment.getId());
assertThat(commentEs).isEqualToComparingFieldByField(testComment);
}
use of com.icthh.xm.ms.entity.domain.Comment in project xm-ms-entity by xm-online.
the class CommentResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Comment.class);
Comment comment1 = new Comment();
comment1.setId(1L);
Comment comment2 = new Comment();
comment2.setId(comment1.getId());
assertThat(comment1).isEqualTo(comment2);
comment2.setId(2L);
assertThat(comment1).isNotEqualTo(comment2);
comment1.setId(null);
assertThat(comment1).isNotEqualTo(comment2);
}
use of com.icthh.xm.ms.entity.domain.Comment in project xm-ms-entity by xm-online.
the class CommentResourceIntTest method createEntity.
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Comment createEntity(EntityManager em) {
Comment comment = new Comment().userKey(DEFAULT_USER_KEY).message(DEFAULT_MESSAGE).entryDate(DEFAULT_ENTRY_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
comment.setXmEntity(xmEntity);
return comment;
}
Aggregations