use of com.synopsys.integration.alert.channel.jira.server.environment.JiraServerEnvironmentVariableHandlerFactory in project hub-alert by blackducksoftware.
the class JiraServerEnvironmentHandlerFactoryTestIT method testCleanEnvironment.
@Test
void testCleanEnvironment() {
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());
assertTrue(result.hasValues());
assertEquals(TEST_DISABLE_PLUGIN_CHECK, result.getVariableValue(JiraServerEnvironmentVariableHandlerFactory.DISABLE_PLUGIN_KEY).orElse("Disable plugin check value missing"));
assertEquals(TEST_URL, result.getVariableValue(JiraServerEnvironmentVariableHandlerFactory.URL_KEY).orElse("Url value missing"));
assertEquals(AlertConstants.MASKED_VALUE, result.getVariableValue(JiraServerEnvironmentVariableHandlerFactory.PASSWORD_KEY).orElse("Password value missing"));
assertEquals(TEST_USER, result.getVariableValue(JiraServerEnvironmentVariableHandlerFactory.USERNAME_KEY).orElse("Username value missing"));
}
use of com.synopsys.integration.alert.channel.jira.server.environment.JiraServerEnvironmentVariableHandlerFactory 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());
}
Aggregations