use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalCrudActionsTestIT method updateNotFoundTest.
@Test
void updateNotFoundTest() {
JiraServerGlobalCrudActions crudActions = new JiraServerGlobalCrudActions(authorizationManager, configAccessor, validator);
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = createBasicJiraModel();
ActionResponse<JiraServerGlobalConfigModel> actionResponse = crudActions.update(UUID.randomUUID(), jiraServerGlobalConfigModel);
assertTrue(actionResponse.isError());
assertFalse(actionResponse.hasContent());
assertEquals(HttpStatus.NOT_FOUND, actionResponse.getHttpStatus());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalCrudActionsTestIT method createDuplicateNameTest.
@Test
void createDuplicateNameTest() {
JiraServerGlobalCrudActions crudActions = new JiraServerGlobalCrudActions(authorizationManager, configAccessor, validator);
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = createBasicJiraModel();
ActionResponse<JiraServerGlobalConfigModel> actionResponse = crudActions.create(jiraServerGlobalConfigModel);
assertTrue(actionResponse.isSuccessful());
assertTrue(actionResponse.hasContent());
assertEquals(HttpStatus.OK, actionResponse.getHttpStatus());
ActionResponse<JiraServerGlobalConfigModel> actionResponseDuplicate = crudActions.create(jiraServerGlobalConfigModel);
assertTrue(actionResponseDuplicate.isError());
assertFalse(actionResponseDuplicate.hasContent());
assertEquals(HttpStatus.BAD_REQUEST, actionResponseDuplicate.getHttpStatus());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalCrudActionsTestIT method deleteTest.
@Test
void deleteTest() {
JiraServerGlobalCrudActions crudActions = new JiraServerGlobalCrudActions(authorizationManager, configAccessor, validator);
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = createBasicJiraModel();
ActionResponse<JiraServerGlobalConfigModel> createActionResponse = crudActions.create(jiraServerGlobalConfigModel);
assertTrue(createActionResponse.isSuccessful());
assertTrue(createActionResponse.getContent().isPresent());
UUID uuid = UUID.fromString(createActionResponse.getContent().get().getId());
ActionResponse<JiraServerGlobalConfigModel> actionResponse = crudActions.delete(uuid);
assertTrue(actionResponse.isSuccessful());
assertFalse(actionResponse.hasContent());
assertEquals(HttpStatus.NO_CONTENT, actionResponse.getHttpStatus());
ActionResponse<JiraServerGlobalConfigModel> getActionResponse = crudActions.getOne(uuid);
assertTrue(getActionResponse.isError());
assertEquals(HttpStatus.NOT_FOUND, getActionResponse.getHttpStatus());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalConfigControllerTestIT method verifyValidateEndpointTest.
@Test
@WithMockUser(roles = AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)
public void verifyValidateEndpointTest() throws Exception {
String urlPath = REQUEST_URL + "/validate";
MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(urlPath).with(SecurityMockMvcRequestPostProcessors.user("admin").roles(AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)).with(SecurityMockMvcRequestPostProcessors.csrf());
UUID uuid = UUID.randomUUID();
JiraServerGlobalConfigModel configModel = createConfigModel(uuid);
request.content(gson.toJson(configModel));
request.contentType(MEDIA_TYPE);
mockMvc.perform(request).andExpect(MockMvcResultMatchers.status().isOk());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalConfigControllerTestIT method verifyDeleteEndpointTest.
@Test
@WithMockUser(roles = AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)
public void verifyDeleteEndpointTest() throws Exception {
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = saveConfigModel(createConfigModel(UUID.randomUUID()));
String urlPath = REQUEST_URL + "/" + jiraServerGlobalConfigModel.getId();
MockHttpServletRequestBuilder request = MockMvcRequestBuilders.delete(urlPath).with(SecurityMockMvcRequestPostProcessors.user("admin").roles(AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)).with(SecurityMockMvcRequestPostProcessors.csrf());
mockMvc.perform(request).andExpect(MockMvcResultMatchers.status().isNoContent());
}
Aggregations