use of com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails in project hub-alert by blackducksoftware.
the class ProviderMessageDistributorTest method createProcessedProviderMessageHolder.
private ProcessedProviderMessageHolder createProcessedProviderMessageHolder(int numberOfProjectMessages, int numberOfSimpleMessages) {
List<ProcessedProviderMessage<ProjectMessage>> processedProjectMessages = new ArrayList<>();
List<ProcessedProviderMessage<SimpleMessage>> processedSimpleMessages = new ArrayList<>();
LinkableItem commonProject = new LinkableItem("Project", "Common Project");
ProjectOperation commonOperation = ProjectOperation.CREATE;
for (long i = 1; i < numberOfProjectMessages + 1; i++) {
LinkableItem provider = new LinkableItem("Provider", "Provider " + i);
ProviderDetails providerDetails = new ProviderDetails(i, provider);
ProjectMessage projectMessage = ProjectMessage.projectStatusInfo(providerDetails, commonProject, commonOperation);
ProcessedProviderMessage<ProjectMessage> processedProviderMessage = ProcessedProviderMessage.singleSource(i, projectMessage);
processedProjectMessages.add(processedProviderMessage);
}
for (long i = 1; i < numberOfSimpleMessages + 1; i++) {
LinkableItem provider = new LinkableItem("Details", "Detail " + i);
ProviderDetails providerDetails = new ProviderDetails(i, provider);
SimpleMessage simpleMessage = SimpleMessage.original(providerDetails, "Summary " + i, "Description " + i, List.of(commonProject));
ProcessedProviderMessage<SimpleMessage> processedSimpleMessage = ProcessedProviderMessage.singleSource(i, simpleMessage);
processedSimpleMessages.add(processedSimpleMessage);
}
return new ProcessedProviderMessageHolder(processedProjectMessages, processedSimpleMessages);
}
use of com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails in project hub-alert by blackducksoftware.
the class ProjectMessageTest method hasBomComponentsTest.
@Test
public void hasBomComponentsTest() {
LinkableItem provider = new LinkableItem("Provider", "Provider Config Name");
ProviderDetails providerDetails = new ProviderDetails(1L, provider);
LinkableItem commonProject = new LinkableItem("Project", "Project 1");
LinkableItem commonProjectVersion = new LinkableItem("Project Version", "Project Version 1");
BomComponentDetails bomComponentDetails = new BomComponentDetails(new LinkableItem("Component", "The component"), commonProjectVersion, ComponentVulnerabilities.none(), List.of(), List.of(), new LinkableItem("License", "The software license name", "https://license-url"), "The usage of the component", ComponentUpgradeGuidance.none(), List.of(), "https://blackduck-issues-url");
ProjectMessage projectMessage = ProjectMessage.componentConcern(providerDetails, commonProject, commonProjectVersion, List.of(bomComponentDetails));
assertTrue(projectMessage.hasBomComponents());
assertEquals(1, projectMessage.getBomComponents().size());
assertEquals(bomComponentDetails, projectMessage.getBomComponents().get(0));
}
use of com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails in project hub-alert by blackducksoftware.
the class ProjectMessageTest 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);
assertNotCombined(projectMessage1, projectMessage2);
assertNotCombined(projectMessage1, projectMessage3);
assertNotCombined(projectMessage2, projectMessage3);
}
use of com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails in project hub-alert by blackducksoftware.
the class ProjectMessageTest method combineProjectOperationsDontMatchTest.
@Test
public void combineProjectOperationsDontMatchTest() {
LinkableItem provider = new LinkableItem("Provider", "Provider Config Name");
ProviderDetails providerDetails = new ProviderDetails(1L, provider);
LinkableItem commonProject = new LinkableItem("Project", "Project 1");
ProjectMessage projectMessage1 = ProjectMessage.projectStatusInfo(providerDetails, commonProject, ProjectOperation.CREATE);
ProjectMessage projectMessage2 = ProjectMessage.projectStatusInfo(providerDetails, commonProject, ProjectOperation.DELETE);
// Create then delete
List<ProjectMessage> combinedProjectMessages1 = projectMessage1.combine(projectMessage2);
assertEquals(0, combinedProjectMessages1.size());
// Delete then create
List<ProjectMessage> combinedProjectMessages2 = projectMessage2.combine(projectMessage1);
assertEquals(1, combinedProjectMessages2.size());
assertEquals(projectMessage1, combinedProjectMessages2.get(0));
}
use of com.synopsys.integration.alert.processor.api.extract.model.ProviderDetails in project hub-alert by blackducksoftware.
the class ProjectMessageTest method combineProjectOperationsMatchTest.
@Test
public void combineProjectOperationsMatchTest() {
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;
ProjectMessage projectMessage1 = ProjectMessage.projectStatusInfo(providerDetails, commonProject, commonOperation);
ProjectMessage projectMessage2 = ProjectMessage.projectStatusInfo(providerDetails, commonProject, commonOperation);
assertCombined(projectMessage1, projectMessage2);
}
Aggregations