Search in sources :

Example 1 with ProjectOperation

use of com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation in project hub-alert by blackducksoftware.

the class ProjectMessageSummarizerTest method summarizeProjectStatusTest.

@Test
public void summarizeProjectStatusTest() {
    ProjectOperation commonOperation = ProjectOperation.CREATE;
    ProjectMessage projectMessage = ProjectMessage.projectStatusInfo(providerDetails, commonProject, commonOperation);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage = new ProcessedProviderMessage<>(Set.of(1L), projectMessage);
    ProcessedProviderMessage<SimpleMessage> summarizedSimpleMessage = projectMessageSummarizer.summarize(processedProviderMessage);
    SimpleMessage simpleMessage = summarizedSimpleMessage.getProviderMessage();
    printSimpleMessage(simpleMessage);
    testProjectStatus(simpleMessage);
    assertEquals(1, simpleMessage.getDetails().size());
    assertTrue(simpleMessage.getDetails().contains(commonProject));
    assertTrue(simpleMessage.getSummary().contains(ProjectMessageSummarizer.OP_PARTICIPLE_CREATED));
}
Also used : ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) ProcessedProviderMessage(com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessage) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) ProjectOperation(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation) Test(org.junit.jupiter.api.Test)

Example 2 with ProjectOperation

use of com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation in project hub-alert by blackducksoftware.

the class ProjectMessageSummarizerTest method summarizeProjectVersionStatusTest.

@Test
public void summarizeProjectVersionStatusTest() {
    ProjectOperation commonOperation = ProjectOperation.CREATE;
    ProjectMessage projectMessage = ProjectMessage.projectVersionStatusInfo(providerDetails, commonProject, commonProjectVersion, commonOperation);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage = new ProcessedProviderMessage<>(Set.of(1L), projectMessage);
    ProcessedProviderMessage<SimpleMessage> summarizedSimpleMessage = projectMessageSummarizer.summarize(processedProviderMessage);
    SimpleMessage simpleMessage = summarizedSimpleMessage.getProviderMessage();
    printSimpleMessage(simpleMessage);
    testProjectStatus(simpleMessage);
    assertEquals(2, simpleMessage.getDetails().size(), "Expected 2 LinkableItems. One for project the other for project-version.");
    assertTrue(simpleMessage.getDetails().contains(commonProject));
    assertTrue(simpleMessage.getDetails().contains(commonProjectVersion));
    assertTrue(simpleMessage.getSummary().contains(commonProjectVersion.getValue()));
    assertTrue(simpleMessage.getSummary().contains(ProjectMessageSummarizer.OP_PARTICIPLE_CREATED));
    assertTrue(simpleMessage.getDescription().contains(commonProjectVersion.getValue()));
}
Also used : ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) ProcessedProviderMessage(com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessage) SimpleMessage(com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage) ProjectOperation(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation) Test(org.junit.jupiter.api.Test)

Example 3 with ProjectOperation

use of com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation in project hub-alert by blackducksoftware.

the class ProcessedProviderMessageTest method combineProjectsDontMatchTest.

@Test
public void combineProjectsDontMatchTest() {
    LinkableItem provider = new LinkableItem("Provider", "Provider Config Name");
    ProviderDetails providerDetails = new ProviderDetails(1L, provider);
    LinkableItem project1 = new LinkableItem("Project", "Project 1");
    LinkableItem project2 = new LinkableItem("Project", "Project 2");
    ProjectOperation commonOperation = ProjectOperation.CREATE;
    ProjectMessage projectMessage1 = ProjectMessage.projectStatusInfo(providerDetails, project1, commonOperation);
    ProjectMessage projectMessage2 = ProjectMessage.projectStatusInfo(providerDetails, project2, commonOperation);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage1 = ProcessedProviderMessage.singleSource(10L, projectMessage1);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage2 = ProcessedProviderMessage.singleSource(20L, projectMessage2);
    assertNotCombined(processedProviderMessage1, processedProviderMessage2);
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) ProjectOperation(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation) Test(org.junit.jupiter.api.Test)

Example 4 with ProjectOperation

use of com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation in project hub-alert by blackducksoftware.

the class ProcessedProviderMessageTest method combineProjectVersionsDontMatchTest.

@Test
public void combineProjectVersionsDontMatchTest() {
    LinkableItem provider = new LinkableItem("Provider", "Provider Config Name");
    ProviderDetails providerDetails = new ProviderDetails(1L, provider);
    LinkableItem commonProject = new LinkableItem("Project", "Project 1");
    ProjectOperation commonOperation = ProjectOperation.CREATE;
    LinkableItem projectVersion1 = new LinkableItem("Project Version", "Project Version 1");
    LinkableItem projectVersion2 = new LinkableItem("Project Version", "Project Version 2");
    ProjectMessage projectMessage1 = ProjectMessage.projectVersionStatusInfo(providerDetails, commonProject, null, commonOperation);
    ProjectMessage projectMessage2 = ProjectMessage.projectVersionStatusInfo(providerDetails, commonProject, projectVersion1, commonOperation);
    ProjectMessage projectMessage3 = ProjectMessage.projectVersionStatusInfo(providerDetails, commonProject, projectVersion2, commonOperation);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage1 = ProcessedProviderMessage.singleSource(10L, projectMessage1);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage2 = ProcessedProviderMessage.singleSource(20L, projectMessage2);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage3 = ProcessedProviderMessage.singleSource(30L, projectMessage3);
    assertNotCombined(processedProviderMessage1, processedProviderMessage2);
    assertNotCombined(processedProviderMessage1, processedProviderMessage3);
    assertNotCombined(processedProviderMessage2, processedProviderMessage3);
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) ProjectOperation(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation) Test(org.junit.jupiter.api.Test)

Example 5 with ProjectOperation

use of com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation in project hub-alert by blackducksoftware.

the class ProcessedProviderMessageTest method combineMessageReasonsDontMatchTest.

@Test
public void combineMessageReasonsDontMatchTest() {
    LinkableItem provider = new LinkableItem("Provider", "Provider Config Name");
    ProviderDetails providerDetails = new ProviderDetails(1L, provider);
    LinkableItem commonProject = new LinkableItem("Project", "Common Project");
    ProjectOperation commonOperation = ProjectOperation.CREATE;
    ProjectMessage projectMessage1 = ProjectMessage.projectStatusInfo(providerDetails, commonProject, commonOperation);
    LinkableItem projectVersion = new LinkableItem("Project Version", "1.2.3");
    ProjectMessage projectMessage2 = ProjectMessage.projectVersionStatusInfo(providerDetails, commonProject, projectVersion, commonOperation);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage1 = ProcessedProviderMessage.singleSource(10L, projectMessage1);
    ProcessedProviderMessage<ProjectMessage> processedProviderMessage2 = ProcessedProviderMessage.singleSource(20L, projectMessage2);
    assertNotCombined(processedProviderMessage1, processedProviderMessage2);
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) ProjectMessage(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage) ProjectOperation(com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation) Test(org.junit.jupiter.api.Test)

Aggregations

ProjectMessage (com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage)12 ProjectOperation (com.synopsys.integration.alert.processor.api.extract.model.project.ProjectOperation)12 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)9 Test (org.junit.jupiter.api.Test)9 ProcessedProviderMessage (com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessage)4 SimpleMessage (com.synopsys.integration.alert.processor.api.extract.model.SimpleMessage)4 ProviderDetails (com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails)3 AlertConfigurationException (com.synopsys.integration.alert.api.common.model.exception.AlertConfigurationException)2 AlertNotificationModel (com.synopsys.integration.alert.common.rest.model.AlertNotificationModel)2 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)2 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)2 ProcessedProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessageHolder)1 ArrayList (java.util.ArrayList)1