use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerResponse in project hub-alert by blackducksoftware.
the class IssueTrackerProcessor method processMessages.
public final IssueTrackerResponse<T> processMessages(ProviderMessageHolder messages, String jobName) throws AlertException {
List<IssueTrackerIssueResponseModel<T>> issueResponseModels = new LinkedList<>();
IssueTrackerModelHolder<T> simpleMessageHolder = modelExtractor.extractSimpleMessageIssueModels(messages.getSimpleMessages(), jobName);
List<IssueTrackerIssueResponseModel<T>> simpleMessageResponseModels = messageSender.sendMessages(simpleMessageHolder);
issueResponseModels.addAll(simpleMessageResponseModels);
for (ProjectMessage projectMessage : messages.getProjectMessages()) {
IssueTrackerModelHolder<T> projectMessageHolder = modelExtractor.extractProjectMessageIssueModels(projectMessage, jobName);
List<IssueTrackerIssueResponseModel<T>> projectMessageResponseModels = messageSender.sendMessages(projectMessageHolder);
issueResponseModels.addAll(projectMessageResponseModels);
}
return new IssueTrackerResponse<>("Success", issueResponseModels);
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerResponse in project hub-alert by blackducksoftware.
the class IssueTrackerChannelTest method distributeMessagesTest.
@Test
public void distributeMessagesTest() throws AlertException {
IssueTrackerModelExtractor<String> modelExtractor = new IssueTrackerModelExtractor<>(createFormatter(), null);
IssueTrackerMessageSender<String> messageSender = createMessageSender();
IssueTrackerProcessor<String> processor = new IssueTrackerProcessor<>(modelExtractor, messageSender);
IssueTrackerProcessorFactory<DistributionJobDetailsModel, String> processorFactory = x -> processor;
IssueTrackerResponsePostProcessor postProcessor = new IssueTrackerResponsePostProcessor() {
@Override
public <T extends Serializable> void postProcess(IssueTrackerResponse<T> response) {
}
};
IssueTrackerChannel<DistributionJobDetailsModel, String> issueTrackerChannel = new IssueTrackerChannel<>(processorFactory, postProcessor) {
};
MessageResult testResult = issueTrackerChannel.distributeMessages(null, ProviderMessageHolder.empty(), null);
IssueTrackerResponse<?> processorResponse = processor.processMessages(ProviderMessageHolder.empty(), "jobName");
assertEquals(processorResponse.getStatusMessage(), testResult.getStatusMessage());
}
Aggregations