use of com.synopsys.integration.alert.environment.EnvironmentVariableHandler 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.environment.EnvironmentVariableHandler in project hub-alert by blackducksoftware.
the class ProxySettingsEnvironmentHandlerFactoryTest method testProxyMissingFromEnvironment.
@Test
void testProxyMissingFromEnvironment() {
Environment environment = Mockito.mock(Environment.class);
SettingsProxyConfigAccessor configAccessor = Mockito.mock(SettingsProxyConfigAccessor.class);
Mockito.when(configAccessor.getConfiguration()).thenReturn(Optional.empty());
EnvironmentVariableUtility environmentVariableUtility = new EnvironmentVariableUtility(environment);
EnvironmentVariableHandlerFactory factory = new ProxySettingsEnvironmentHandlerFactory(configAccessor, environmentVariableUtility, validator);
EnvironmentVariableHandler handler = factory.build();
EnvironmentProcessingResult result = handler.updateFromEnvironment();
assertEquals(ProxySettingsEnvironmentHandlerFactory.HANDLER_NAME, handler.getName());
assertFalse(result.hasValues());
}
Aggregations