use of com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter in project hub-alert by blackducksoftware.
the class ProjectMessageConverterTest method callConvertToFormattedMessageChunks.
private List<String> callConvertToFormattedMessageChunks(ProjectMessage projectMessage) {
MockChannelMessageFormatter formatter = new MockChannelMessageFormatter(Integer.MAX_VALUE);
ProjectMessageConverter projectMessageConverter = new ProjectMessageConverter(formatter);
return projectMessageConverter.convertToFormattedMessageChunks(projectMessage, "jobName");
}
use of com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter in project hub-alert by blackducksoftware.
the class AbstractChannelMessageConverterTest method convertToChannelMessagesTest.
@Test
public void convertToChannelMessagesTest() {
MockChannelMessageFormatter mockChannelMessageFormatter = new MockChannelMessageFormatter(Integer.MAX_VALUE);
MockChannelMessageConverter mockChannelMessageConverter = new MockChannelMessageConverter(mockChannelMessageFormatter);
MockDistributionJobDetailsModel jobDetails = new MockDistributionJobDetailsModel(UUID.randomUUID());
ProviderDetails providerDetails = new ProviderDetails(0L, new LinkableItem("Provider", "Black Duck"));
ProjectMessage projectCreateMessage = ProjectMessage.projectStatusInfo(providerDetails, new LinkableItem("Project", "A project"), ProjectOperation.CREATE);
SimpleMessage simpleMessage = SimpleMessage.original(providerDetails, "Summary", "Description", List.of());
ProviderMessageHolder providerMessageHolder = new ProviderMessageHolder(List.of(projectCreateMessage), List.of(simpleMessage));
List<MockOutputModel> mockOutputModels = mockChannelMessageConverter.convertToChannelMessages(jobDetails, providerMessageHolder, "jobName");
assertEquals(2, mockOutputModels.size());
for (MockOutputModel mockOutputModel : mockOutputModels) {
assertEquals(1, mockOutputModel.getMessagePieces().size());
}
}
use of com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter in project hub-alert by blackducksoftware.
the class SimpleMessageConverterTest method callConvertToFormattedMessageChunks.
private List<String> callConvertToFormattedMessageChunks() {
ProviderDetails providerDetails = new ProviderDetails(0L, new LinkableItem("Provider", "The provider name"));
LinkableItem detail1 = new LinkableItem("Detail", "The first detail (unlinked)");
LinkableItem detail2 = new LinkableItem("Detail Prime", "The second detail (linked)", "https://a-hub-url");
SimpleMessage simpleMessage = SimpleMessage.original(providerDetails, "The Summary", "The Description", List.of(detail1, detail2));
MockChannelMessageFormatter formatter = new MockChannelMessageFormatter(Integer.MAX_VALUE);
SimpleMessageConverter simpleMessageConverter = new SimpleMessageConverter(formatter);
return simpleMessageConverter.convertToFormattedMessageChunks(simpleMessage, "jobName");
}
Aggregations