use of com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender in project hub-alert by blackducksoftware.
the class AzureBoardsProcessorFactory method createProcessor.
@Override
public IssueTrackerProcessor<Integer> createProcessor(AzureBoardsJobDetailsModel distributionDetails) throws AlertException {
AzureBoardsProperties azureBoardsProperties = azureBoardsPropertiesFactory.createAzureBoardsProperties();
String organizationName = azureBoardsProperties.getOrganizationName();
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);
// Common Azure Boards Services
AzureApiVersionAppender apiVersionAppender = new AzureApiVersionAppender();
AzureProjectService projectService = new AzureProjectService(azureHttpService, apiVersionAppender);
AzureWorkItemService workItemService = new AzureWorkItemService(azureHttpService, azureHttpRequestCreator);
AzureWorkItemQueryService workItemQueryService = new AzureWorkItemQueryService(azureHttpService, apiVersionAppender);
String projectNameOrId = distributionDetails.getProjectNameOrId();
String teamProjectName = retrieveProjectNameIfNecessary(projectService, organizationName, projectNameOrId);
installCustomFieldsIfNecessary(organizationName, teamProjectName, distributionDetails.getWorkItemType(), projectService, new AzureProcessService(azureHttpService, apiVersionAppender));
// Searcher Requirements
AzureBoardsIssueStatusResolver azureBoardsIssueStatusResolver = new AzureBoardsIssueStatusResolver(distributionDetails.getWorkItemCompletedState(), distributionDetails.getWorkItemReopenState());
AzureBoardsIssueTrackerQueryManager queryManager = new AzureBoardsIssueTrackerQueryManager(organizationName, distributionDetails, workItemService, workItemQueryService);
// Extractor Requirements
AzureBoardsExistingIssueDetailsCreator issueDetailsCreator = new AzureBoardsExistingIssueDetailsCreator(organizationName, issueCategoryRetriever, azureBoardsIssueStatusResolver);
AzureBoardsWorkItemFinder workItemFinder = new AzureBoardsWorkItemFinder(queryManager, teamProjectName);
AzureBoardsProjectAndVersionIssueFinder projectAndVersionIssueFinder = new AzureBoardsProjectAndVersionIssueFinder(gson, issueDetailsCreator, workItemFinder);
AzureBoardsComponentIssueFinder componentIssueFinder = new AzureBoardsComponentIssueFinder(gson, workItemFinder, issueDetailsCreator);
IssueTrackerSearcher<Integer> azureBoardsSearcher = new IssueTrackerSearcher<>(projectAndVersionIssueFinder, projectAndVersionIssueFinder, componentIssueFinder, componentIssueFinder, modelTransformer);
IssueTrackerModelExtractor<Integer> extractor = new IssueTrackerModelExtractor<>(formatter, azureBoardsSearcher);
// Message Sender Requirements
AzureWorkItemTypeStateService workItemTypeStateService = new AzureWorkItemTypeStateService(azureHttpService, apiVersionAppender);
AzureWorkItemCommentService workItemCommentService = new AzureWorkItemCommentService(azureHttpService, apiVersionAppender);
IssueTrackerMessageSender<Integer> messageSender = azureBoardsMessageSenderFactory.createMessageSender(workItemService, workItemTypeStateService, workItemCommentService, organizationName, distributionDetails);
return new IssueTrackerProcessor<>(extractor, messageSender);
}
use of com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender in project hub-alert by blackducksoftware.
the class AzureBoardsGlobalFieldModelTestAction method testConfig.
@Override
public MessageResult testConfig(String configId, FieldModel fieldModel, FieldUtility registeredFieldValues) throws IntegrationException {
try {
Optional<ConfigurationFieldModel> configurationFieldModel = registeredFieldValues.getField(AzureBoardsDescriptor.KEY_ORGANIZATION_NAME);
String organizationName = configurationFieldModel.flatMap(ConfigurationFieldModel::getFieldValue).orElse(null);
AzureBoardsProperties azureBoardsProperties = AzureBoardsProperties.fromFieldAccessor(azureBoardsCredentialDataStoreFactory, azureRedirectUrlCreator.createOAuthRedirectUri(), registeredFieldValues);
AzureHttpService azureHttpService = createAzureHttpService(azureBoardsProperties);
AzureProjectService azureProjectService = new AzureProjectService(azureHttpService, new AzureApiVersionAppender());
azureProjectService.getProjects(organizationName);
return new MessageResult("Successfully connected to Azure instance.");
} catch (HttpServiceException ex) {
logger.error("Global Test Action failed testing Azure Boards connection.", ex);
throw (ex);
}
}
use of com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender 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.azure.boards.common.http.AzureApiVersionAppender in project hub-alert by blackducksoftware.
the class AzureOAuthCallbackController method testGetProjects.
private void testGetProjects(AzureHttpService azureHttpService, String organizationName, String oAuthRequestKey) {
try {
AzureProjectService azureProjectService = new AzureProjectService(azureHttpService, new AzureApiVersionAppender());
AzureArrayResponseModel<TeamProjectReferenceResponseModel> projects = azureProjectService.getProjects(organizationName);
Integer projectCount = projects.getCount();
logger.info("OAuth request with id {}: Azure Boards project count: {}", oAuthRequestKey, projectCount);
} catch (HttpServiceException ex) {
logger.error("OAuth request with id {}: Error in azure oauth get projects validation test ", oAuthRequestKey, ex);
}
}
Aggregations