use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class ChannelRestConnectionFactory method createIntHttpClient.
public IntHttpClient createIntHttpClient(String baseUrl, IntLogger intLogger, int timeout) {
Optional<Boolean> alertTrustCertificate = alertProperties.getAlertTrustCertificate();
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(baseUrl);
return new IntHttpClient(intLogger, gson, timeout, alertTrustCertificate.orElse(Boolean.FALSE), proxyInfo);
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class JiraCloudPropertiesFactory method createJiraProperties.
public JiraCloudProperties createJiraProperties(FieldModel fieldModel) {
String url = fieldModel.getFieldValue(JiraCloudDescriptor.KEY_JIRA_URL).orElse("");
String username = fieldModel.getFieldValue(JiraCloudDescriptor.KEY_JIRA_ADMIN_EMAIL_ADDRESS).orElse("");
String accessToken = fieldModel.getFieldValueModel(JiraCloudDescriptor.KEY_JIRA_ADMIN_API_TOKEN).map(this::getAppropriateAccessToken).orElse("");
boolean pluginCheckDisabled = fieldModel.getFieldValue(JiraCloudDescriptor.KEY_JIRA_DISABLE_PLUGIN_CHECK).map(Boolean::parseBoolean).orElse(false);
ProxyInfo proxy = proxyManager.createProxyInfoForHost(url);
return new JiraCloudProperties(url, accessToken, username, pluginCheckDisabled, proxy);
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class NotificationExtractorBlackDuckServicesFactoryCacheTest method retrieveBlackDuckServicesFactoryTest.
@Test
public void retrieveBlackDuckServicesFactoryTest() throws AlertConfigurationException {
ConfigurationModel configurationModel = createConfigurationModel();
Mockito.when(configurationModelConfigurationAccessor.getConfigurationById(Mockito.eq(blackDuckConfigId))).thenReturn(Optional.of(configurationModel));
ProxyInfo proxyInfo = ProxyInfo.NO_PROXY_INFO;
Mockito.when(proxyManager.createProxyInfoForHost(Mockito.any())).thenReturn(proxyInfo);
// Create a BlackDuckServiceFactory and verify the same object is cached and returned.
BlackDuckServicesFactory blackDuckServicesFactory = cache.retrieveBlackDuckServicesFactory(blackDuckConfigId);
BlackDuckServicesFactory blackDuckServicesFactoryCached = cache.retrieveBlackDuckServicesFactory(blackDuckConfigId);
assertSame(blackDuckServicesFactory, blackDuckServicesFactoryCached, "Object reference of cached BlackDuckServiceFactory does not match. Verify the first factory is getting cached correctly.");
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class NotificationExtractorBlackDuckServicesFactoryCacheTest method cacheClearedTest.
@Test
public void cacheClearedTest() throws AlertConfigurationException {
ConfigurationModel configurationModel = createConfigurationModel();
Mockito.when(configurationModelConfigurationAccessor.getConfigurationById(Mockito.eq(blackDuckConfigId))).thenReturn(Optional.of(configurationModel));
ProxyInfo proxyInfo = ProxyInfo.NO_PROXY_INFO;
Mockito.when(proxyManager.createProxyInfoForHost(Mockito.any())).thenReturn(proxyInfo);
BlackDuckServicesFactory blackDuckServicesFactory = cache.retrieveBlackDuckServicesFactory(blackDuckConfigId);
cache.clear();
BlackDuckServicesFactory blackDuckServicesFactoryCached = cache.retrieveBlackDuckServicesFactory(blackDuckConfigId);
assertNotSame(blackDuckServicesFactory, blackDuckServicesFactoryCached, "Object reference of cached BlackDuckServiceFactory matches. Verify that the first factory is getting cleared correctly.");
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class UpdateChecker method createHttpClient.
private IntHttpClient createHttpClient() {
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(DockerTagRetriever.ALERT_DOCKER_REGISTRY_URL);
Boolean alwaysTrustServerCert = alertProperties.getAlertTrustCertificate().orElse(Boolean.FALSE);
return new IntHttpClient(logger, gson, 120, alwaysTrustServerCert, proxyInfo);
}
Aggregations