Search in sources :

Example 16 with ProxyInfo

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);
}
Also used : ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) IntHttpClient(com.synopsys.integration.rest.client.IntHttpClient)

Example 17 with 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);
}
Also used : ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo)

Example 18 with ProxyInfo

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.");
}
Also used : ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) BlackDuckServicesFactory(com.synopsys.integration.blackduck.service.BlackDuckServicesFactory) Test(org.junit.jupiter.api.Test)

Example 19 with ProxyInfo

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.");
}
Also used : ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) BlackDuckServicesFactory(com.synopsys.integration.blackduck.service.BlackDuckServicesFactory) Test(org.junit.jupiter.api.Test)

Example 20 with ProxyInfo

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);
}
Also used : ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) IntHttpClient(com.synopsys.integration.rest.client.IntHttpClient)

Aggregations

ProxyInfo (com.synopsys.integration.rest.proxy.ProxyInfo)22 Test (org.junit.jupiter.api.Test)9 IntHttpClient (com.synopsys.integration.rest.client.IntHttpClient)5 AzureBoardsProperties (com.synopsys.integration.alert.channel.azure.boards.AzureBoardsProperties)3 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)3 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)2 AzureApiVersionAppender (com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender)2 AzureHttpRequestCreator (com.synopsys.integration.azure.boards.common.http.AzureHttpRequestCreator)2 AzureHttpService (com.synopsys.integration.azure.boards.common.http.AzureHttpService)2 AzureWorkItemCommentService (com.synopsys.integration.azure.boards.common.service.comment.AzureWorkItemCommentService)2 AzureWorkItemTypeStateService (com.synopsys.integration.azure.boards.common.service.state.AzureWorkItemTypeStateService)2 AzureWorkItemService (com.synopsys.integration.azure.boards.common.service.workitem.AzureWorkItemService)2 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)2 IntLogger (com.synopsys.integration.log.IntLogger)2 Credentials (com.synopsys.integration.rest.credentials.Credentials)2 CredentialsBuilder (com.synopsys.integration.rest.credentials.CredentialsBuilder)2 ProxyInfoBuilder (com.synopsys.integration.rest.proxy.ProxyInfoBuilder)2 IssueTrackerModelExtractor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor)1 IssueTrackerProcessor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor)1 IssueTrackerSearcher (com.synopsys.integration.alert.api.channel.issue.search.IssueTrackerSearcher)1