Search in sources :

Example 1 with SlackJobDetailsAccessor

use of com.synopsys.integration.alert.common.persistence.accessor.SlackJobDetailsAccessor in project hub-alert by blackducksoftware.

the class SlackDistributionEventHandlerTest method init.

@BeforeEach
public void init() throws IOException {
    MarkupEncoderUtil markupEncoderUtil = new MarkupEncoderUtil();
    SlackChannelMessageFormatter slackChannelMessageFormatter = new SlackChannelMessageFormatter(markupEncoderUtil);
    SlackChannelMessageConverter slackChannelMessageConverter = new SlackChannelMessageConverter(slackChannelMessageFormatter);
    SlackChannelMessageSender slackChannelMessageSender = new SlackChannelMessageSender(ChannelKeys.SLACK, createConnectionFactory());
    SlackChannel slackChannel = new SlackChannel(slackChannelMessageConverter, slackChannelMessageSender);
    mockSlackServer.start();
    String url = mockSlackServer.url("/").toString();
    SlackJobDetailsModel slackJobDetailsModel = new SlackJobDetailsModel(null, url, "channelName", "userName");
    SlackJobDetailsAccessor slackJobDetailsAccessor = jobId -> Optional.of(slackJobDetailsModel);
    distributionEventHandler = new SlackDistributionEventHandler(slackChannel, slackJobDetailsAccessor, processingAuditAccessor);
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) ChannelRestConnectionFactory(com.synopsys.integration.alert.api.channel.rest.ChannelRestConnectionFactory) DistributionEvent(com.synopsys.integration.alert.processor.api.distribute.DistributionEvent) SlackJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.SlackJobDetailsModel) ProxyManager(com.synopsys.integration.alert.common.rest.proxy.ProxyManager) SlackChannelKey(com.synopsys.integration.alert.descriptor.api.SlackChannelKey) Gson(com.google.gson.Gson) MockWebServer(okhttp3.mockwebserver.MockWebServer) ProviderDetails(com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) ProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder) MockProcessingAuditAccessor(com.synopsys.integration.alert.channel.slack.distribution.mock.MockProcessingAuditAccessor) LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) Set(java.util.Set) IOException(java.io.IOException) UUID(java.util.UUID) SlackJobDetailsAccessor(com.synopsys.integration.alert.common.persistence.accessor.SlackJobDetailsAccessor) Test(org.junit.jupiter.api.Test) Mockito(org.mockito.Mockito) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) Optional(java.util.Optional) MarkupEncoderUtil(com.synopsys.integration.alert.common.util.MarkupEncoderUtil) ChannelKeys(com.synopsys.integration.alert.descriptor.api.model.ChannelKeys) MockResponse(okhttp3.mockwebserver.MockResponse) ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) MarkupEncoderUtil(com.synopsys.integration.alert.common.util.MarkupEncoderUtil) SlackJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.SlackJobDetailsModel) SlackJobDetailsAccessor(com.synopsys.integration.alert.common.persistence.accessor.SlackJobDetailsAccessor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Gson (com.google.gson.Gson)1 ChannelRestConnectionFactory (com.synopsys.integration.alert.api.channel.rest.ChannelRestConnectionFactory)1 MockProcessingAuditAccessor (com.synopsys.integration.alert.channel.slack.distribution.mock.MockProcessingAuditAccessor)1 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)1 SlackJobDetailsAccessor (com.synopsys.integration.alert.common.persistence.accessor.SlackJobDetailsAccessor)1 SlackJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.SlackJobDetailsModel)1 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)1 MarkupEncoderUtil (com.synopsys.integration.alert.common.util.MarkupEncoderUtil)1 SlackChannelKey (com.synopsys.integration.alert.descriptor.api.SlackChannelKey)1 ChannelKeys (com.synopsys.integration.alert.descriptor.api.model.ChannelKeys)1 DistributionEvent (com.synopsys.integration.alert.processor.api.distribute.DistributionEvent)1 ProviderDetails (com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails)1 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)1 SimpleMessage (com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage)1 MockAlertProperties (com.synopsys.integration.alert.test.common.MockAlertProperties)1 ProxyInfo (com.synopsys.integration.rest.proxy.ProxyInfo)1 IOException (java.io.IOException)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1