Search in sources :

Example 1 with AbstractChannelMessageConverter

use of com.synopsys.integration.alert.api.channel.convert.AbstractChannelMessageConverter in project hub-alert by blackducksoftware.

the class MessageBoardChannelTest method distributeMessagesTest.

@Test
public void distributeMessagesTest() throws AlertException {
    MessageResult expectedResult = new MessageResult("Test result");
    DistributionJobDetailsModel testDetails = new DistributionJobDetailsModel(null, null) {
    };
    AbstractChannelMessageConverter<DistributionJobDetailsModel, Object> converter = createConverter();
    ChannelMessageSender<DistributionJobDetailsModel, Object, MessageResult> sender = (x, y) -> expectedResult;
    MessageBoardChannel<DistributionJobDetailsModel, Object> messageBoardChannel = new MessageBoardChannel<>(converter, sender) {
    };
    MessageResult testResult = messageBoardChannel.distributeMessages(testDetails, ProviderMessageHolder.empty(), "jobName");
    assertEquals(expectedResult, testResult);
}
Also used : DistributionJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel) Test(org.junit.jupiter.api.Test) List(java.util.List) MessageResult(com.synopsys.integration.alert.common.message.model.MessageResult) ChannelMessageFormatter(com.synopsys.integration.alert.api.channel.convert.ChannelMessageFormatter) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DistributionJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) AbstractChannelMessageConverter(com.synopsys.integration.alert.api.channel.convert.AbstractChannelMessageConverter) AlertException(com.synopsys.integration.alert.api.common.model.exception.AlertException) ProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder) MessageResult(com.synopsys.integration.alert.common.message.model.MessageResult) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractChannelMessageConverter (com.synopsys.integration.alert.api.channel.convert.AbstractChannelMessageConverter)1 ChannelMessageFormatter (com.synopsys.integration.alert.api.channel.convert.ChannelMessageFormatter)1 AlertException (com.synopsys.integration.alert.api.common.model.exception.AlertException)1 MessageResult (com.synopsys.integration.alert.common.message.model.MessageResult)1 DistributionJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel)1 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)1 SimpleMessage (com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage)1 ProjectMessage (com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage)1 List (java.util.List)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Test (org.junit.jupiter.api.Test)1