use of com.blackducksoftware.integration.hub.api.generated.component.ProjectVersionRequest in project hub-alert by blackducksoftware.
the class AccumulatorProcessorTestIT method testProcess.
@Test
public void testProcess() throws Exception {
final Long timestamp = (new Date()).getTime();
final String testProjectName = "hub-Alert-NotificationAccumulatorTest-" + timestamp;
final String testProjectVersionName = "1.0.0";
final ProjectRequest projectRequest = new ProjectRequest();
projectRequest.name = testProjectName;
final String projectUrl = projectService.createHubProject(projectRequest);
final ProjectView projectItem = hubService.getResponse(projectUrl, ProjectView.class);
System.out.println("projectUrl: " + projectUrl);
final ProjectVersionRequest projectVersionRequest = new ProjectVersionRequest();
projectVersionRequest.distribution = ProjectVersionDistributionType.INTERNAL;
projectVersionRequest.phase = ProjectVersionPhaseType.DEVELOPMENT;
projectVersionRequest.versionName = testProjectVersionName;
projectService.createHubVersion(projectItem, projectVersionRequest);
uploadBdio("bdio/component-bdio.jsonld");
TimeUnit.SECONDS.sleep(60);
final NotificationResults notificationData = notificationDataService.getAllNotificationResults(new Date(System.currentTimeMillis() - 100000), new Date());
final AccumulatorProcessor accumulatorProcessor = new AccumulatorProcessor(globalProperties);
final DBStoreEvent storeEvent = accumulatorProcessor.process(notificationData);
assertNotNull(storeEvent);
final List<NotificationEvent> notificationEvents = storeEvent.getNotificationList();
assertFalse(notificationEvents.isEmpty());
assertEquals(storeEvent.getEventId().length(), 36);
NotificationEvent apacheEvent = null;
for (final NotificationEvent event : notificationEvents) {
System.out.println(event);
if ("Apache Commons FileUpload".equals(event.getDataSet().get("COMPONENT"))) {
apacheEvent = event;
}
}
assertNotNull(apacheEvent);
final AccumulatorProcessor accumulatorProcessorNull = new AccumulatorProcessor(null);
final DBStoreEvent storeEventNull = accumulatorProcessorNull.process(notificationData);
assertNull(storeEventNull);
}
Aggregations