use of com.synopsys.integration.alert.common.message.model.LinkableItem 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.common.message.model.LinkableItem 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);
}
use of com.synopsys.integration.alert.common.message.model.LinkableItem in project hub-alert by blackducksoftware.
the class ProjectMessageTest 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);
assertNotCombined(projectMessage1, projectMessage2);
}
use of com.synopsys.integration.alert.common.message.model.LinkableItem in project hub-alert by blackducksoftware.
the class NotificationRemovalTest method createABatchOfNotifications.
private void createABatchOfNotifications(ConfigurationModel providerConfig, OffsetDateTime notificationCreationTime, boolean batchOfProcessedNotifications) {
int count = BATCH_SIZE;
List<AlertNotificationModel> notifications = new ArrayList<>(BATCH_SIZE);
ProviderDetails providerDetails = new ProviderDetails(providerConfig.getConfigurationId(), new LinkableItem("Black Duck", "bd-server", BLACKDUCK_PROVIDER_URL));
for (int index = 0; index < count; index++) {
RuleViolationNotificationView ruleViolationNotificationView = createRuleViolationNotificationView(PROJECT_NAME);
String notificationContentString = GSON.toJson(ruleViolationNotificationView);
notifications.add(createNotification(providerDetails, NotificationType.RULE_VIOLATION.name(), notificationContentString, notificationCreationTime, batchOfProcessedNotifications));
}
notifications = notificationAccessor.saveAllNotifications(notifications);
createAuditEntries(notifications);
}
Aggregations