Search in sources :

Example 11 with CommentAddRemoveRequest

use of org.apache.metron.indexing.dao.update.CommentAddRemoveRequest in project metron by apache.

the class UpdateControllerIntegrationTest method shouldAddComment.

@Test
public void shouldAddComment() throws Exception {
    CommentAddRemoveRequest commentAddRemoveRequest = new CommentAddRemoveRequest();
    commentAddRemoveRequest.setGuid("bro_1");
    commentAddRemoveRequest.setSensorType("bro");
    commentAddRemoveRequest.setComment("test_comment");
    commentAddRemoveRequest.setUsername("test_username");
    commentAddRemoveRequest.setTimestamp(0L);
    updateService.addComment(commentAddRemoveRequest);
    ResultActions result = this.mockMvc.perform(post(updateUrl + "/add/comment").with(httpBasic(user, password)).with(csrf()).contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(addComment));
    result.andExpect(status().isOk());
}
Also used : CommentAddRemoveRequest(org.apache.metron.indexing.dao.update.CommentAddRemoveRequest) ResultActions(org.springframework.test.web.servlet.ResultActions) SearchIntegrationTest(org.apache.metron.indexing.dao.SearchIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with CommentAddRemoveRequest

use of org.apache.metron.indexing.dao.update.CommentAddRemoveRequest in project metron by apache.

the class UpdateControllerIntegrationTest method shouldRemoveComment.

@Test
public void shouldRemoveComment() throws Exception {
    CommentAddRemoveRequest commentAddRemoveRequest = new CommentAddRemoveRequest();
    commentAddRemoveRequest.setGuid("bro_1");
    commentAddRemoveRequest.setSensorType("bro");
    commentAddRemoveRequest.setComment("test_comment");
    commentAddRemoveRequest.setUsername("test_username");
    commentAddRemoveRequest.setTimestamp(0L);
    updateService.removeComment(commentAddRemoveRequest);
    ResultActions result = this.mockMvc.perform(post(updateUrl + "/remove/comment").with(httpBasic(user, password)).with(csrf()).contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(removeComment));
    result.andExpect(status().isOk());
}
Also used : CommentAddRemoveRequest(org.apache.metron.indexing.dao.update.CommentAddRemoveRequest) ResultActions(org.springframework.test.web.servlet.ResultActions) SearchIntegrationTest(org.apache.metron.indexing.dao.SearchIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

CommentAddRemoveRequest (org.apache.metron.indexing.dao.update.CommentAddRemoveRequest)12 Test (org.junit.jupiter.api.Test)11 Document (org.apache.metron.indexing.dao.update.Document)7 IOException (java.io.IOException)3 SearchIntegrationTest (org.apache.metron.indexing.dao.SearchIntegrationTest)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 ResultActions (org.springframework.test.web.servlet.ResultActions)2 AccessConfig (org.apache.metron.indexing.dao.AccessConfig)1 IndexDao (org.apache.metron.indexing.dao.IndexDao)1 MultiIndexDao (org.apache.metron.indexing.dao.MultiIndexDao)1