use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class ProxyManagerTest method testCreateProxyInfoForHost.
@Test
public void testCreateProxyInfoForHost() {
Mockito.when(settingsUtility.getConfiguration()).thenReturn(Optional.of(createSettingsProxyModelWithNonProxyHosts()));
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(HOST);
performAssertions(proxyInfo);
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class ProxyManagerTest method testCreateProxyInfoForHostNoProxy.
@Test
public void testCreateProxyInfoForHostNoProxy() {
Mockito.when(settingsUtility.getConfiguration()).thenReturn(Optional.empty());
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(HOST);
assertTrue(proxyInfo.getHost().isEmpty());
assertEquals(0, proxyInfo.getPort());
assertTrue(proxyInfo.getUsername().isEmpty());
assertTrue(proxyInfo.getPassword().isEmpty());
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class AzureBoardsMessageSenderFactory method createMessageSender.
@Override
public IssueTrackerMessageSender<Integer> createMessageSender(AzureBoardsJobDetailsModel distributionDetails) throws AlertException {
AzureBoardsProperties azureBoardsProperties = azureBoardsPropertiesFactory.createAzureBoardsProperties();
azureBoardsProperties.validateProperties();
// Initialize Http Service
ProxyInfo proxy = proxyManager.createProxyInfoForHost(AzureHttpRequestCreatorFactory.DEFAULT_BASE_URL);
AzureHttpRequestCreator azureHttpRequestCreator = azureBoardsProperties.createAzureHttpRequestCreator(proxy, gson);
AzureHttpService azureHttpService = new AzureHttpService(gson, azureHttpRequestCreator);
// Azure Boards Services
AzureApiVersionAppender apiVersionAppender = new AzureApiVersionAppender();
AzureWorkItemService workItemService = new AzureWorkItemService(azureHttpService, azureHttpRequestCreator);
AzureWorkItemTypeStateService workItemTypeStateService = new AzureWorkItemTypeStateService(azureHttpService, apiVersionAppender);
AzureWorkItemCommentService workItemCommentService = new AzureWorkItemCommentService(azureHttpService, apiVersionAppender);
return createMessageSender(workItemService, workItemTypeStateService, workItemCommentService, azureBoardsProperties.getOrganizationName(), distributionDetails);
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class AzureBoardsCustomFunctionAction method isAuthenticated.
private boolean isAuthenticated(FieldUtility fieldUtility) {
AzureBoardsProperties properties = AzureBoardsProperties.fromFieldAccessor(azureBoardsCredentialDataStoreFactory, azureRedirectUrlCreator.createOAuthRedirectUri(), fieldUtility);
ProxyInfo proxy = proxyManager.createProxyInfoForHost(AzureHttpRequestCreatorFactory.DEFAULT_BASE_URL);
return properties.hasOAuthCredentials(proxy);
}
use of com.synopsys.integration.rest.proxy.ProxyInfo in project hub-alert by blackducksoftware.
the class AzureOAuthCallbackController method testOAuthConnection.
private void testOAuthConnection(AzureBoardsProperties azureBoardsProperties, String authorizationCode, String oAuthRequestId) {
try {
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(AzureHttpRequestCreatorFactory.DEFAULT_BASE_URL);
String organizationName = azureBoardsProperties.getOrganizationName();
// save initiate token requests with the authorization code.
logger.info("OAuth request with id {}: Testing with authorization code to save tokens.", oAuthRequestId);
testGetProjects(azureBoardsProperties.createAzureHttpService(proxyInfo, gson, authorizationCode), organizationName, oAuthRequestId);
// load the oauth credentials from the store.
logger.info("OAuth request with id {}: Testing with store to read tokens.", oAuthRequestId);
testGetProjects(azureBoardsProperties.createAzureHttpService(proxyInfo, gson), organizationName, oAuthRequestId);
} catch (AlertException ex) {
logger.error("OAuth request with id {}: Error in azure oauth validation test ", oAuthRequestId, ex);
logger.error("Caused by: ", ex);
}
}
Aggregations