use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalCrudActionsTestIT method createBadRequestTest.
@Test
void createBadRequestTest() {
JiraServerGlobalCrudActions crudActions = new JiraServerGlobalCrudActions(authorizationManager, configAccessor, validator);
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = new JiraServerGlobalConfigModel();
ActionResponse<JiraServerGlobalConfigModel> actionResponse = crudActions.create(jiraServerGlobalConfigModel);
assertTrue(actionResponse.isError());
assertFalse(actionResponse.hasContent());
assertEquals(HttpStatus.BAD_REQUEST, actionResponse.getHttpStatus());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerEnvironmentHandlerFactoryTestIT method testExistingConfig.
@Test
void testExistingConfig() throws AlertConfigurationException {
String createdAt = DateUtils.formatDate(DateUtils.createCurrentDateTimestamp(), DateUtils.UTC_DATE_FORMAT_TO_MINUTE);
JiraServerGlobalConfigModel emailGlobalConfigModel = new JiraServerGlobalConfigModel(null, AlertRestConstants.DEFAULT_CONFIGURATION_NAME, createdAt, createdAt, TEST_URL, TEST_USER, TEST_PASSWORD, false, true);
jiraGlobalConfigAccessor.createConfiguration(emailGlobalConfigModel);
Environment environment = setupMockedEnvironment();
EnvironmentVariableUtility environmentVariableUtility = new EnvironmentVariableUtility(environment);
EnvironmentVariableHandlerFactory factory = new JiraServerEnvironmentVariableHandlerFactory(jiraGlobalConfigAccessor, environmentVariableUtility);
EnvironmentVariableHandler handler = factory.build();
EnvironmentProcessingResult result = handler.updateFromEnvironment();
assertEquals(ChannelKeys.JIRA_SERVER.getDisplayName(), handler.getName());
assertFalse(result.hasValues());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalConfigControllerTestIT method verifyCreateEndpointTest.
@Test
@WithMockUser(roles = AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)
public void verifyCreateEndpointTest() throws Exception {
String urlPath = REQUEST_URL;
MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(urlPath).with(SecurityMockMvcRequestPostProcessors.user("admin").roles(AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)).with(SecurityMockMvcRequestPostProcessors.csrf());
JiraServerGlobalConfigModel configModel = createConfigModel(null);
request.content(gson.toJson(configModel));
request.contentType(MEDIA_TYPE);
ResultActions resultActions = mockMvc.perform(request);
resultActions.andExpect(MockMvcResultMatchers.status().isCreated());
}
use of com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel in project hub-alert by blackducksoftware.
the class JiraServerGlobalConfigControllerTestIT method verifyGetOneEndpointTest.
@Test
@WithMockUser(roles = AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)
public void verifyGetOneEndpointTest() throws Exception {
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = saveConfigModel(createConfigModel(UUID.randomUUID()));
String urlPath = REQUEST_URL + "/" + jiraServerGlobalConfigModel.getId();
MockHttpServletRequestBuilder request = MockMvcRequestBuilders.get(urlPath).with(SecurityMockMvcRequestPostProcessors.user("admin").roles(AlertIntegrationTestConstants.ROLE_ALERT_ADMIN)).with(SecurityMockMvcRequestPostProcessors.csrf());
mockMvc.perform(request).andExpect(MockMvcResultMatchers.status().isOk());
}
Aggregations