Search in sources :

Example 6 with MockChannelMessageFormatter

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");
}
Also used : MockChannelMessageFormatter(com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter)

Example 7 with MockChannelMessageFormatter

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());
    }
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) MockChannelMessageFormatter(com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter) ProviderDetails(com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails) ProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder) Test(org.junit.jupiter.api.Test)

Example 8 with MockChannelMessageFormatter

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");
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) MockChannelMessageFormatter(com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter) ProviderDetails(com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails)

Aggregations

MockChannelMessageFormatter (com.synopsys.integration.alert.api.channel.convert.mock.MockChannelMessageFormatter)8 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)2 ProviderDetails (com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails)2 SimpleMessage (com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage)2 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)1 ComponentConcern (com.synopsys.integration.alert.processor.api.extract.model.project.ComponentConcern)1 ProjectMessage (com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage)1 Test (org.junit.jupiter.api.Test)1