use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class TestEventManager method testCreate.
@Test
public void testCreate() {
EventDTO eventDTO = new EventDTO();
eventDTO.setName("test");
eventDTO.setMetric("test");
eventDTO.setEventType(EventType.DEPLOYMENT.name());
eventDTO.setService("testService");
eventDTO.setStartTime(System.currentTimeMillis() - 10);
eventDTO.setEndTime(System.currentTimeMillis());
Map<String, List<String>> targetDimensionsMap = new HashMap<>();
eventDTO.setTargetDimensionMap(targetDimensionsMap);
testEventId = eventManager.save(eventDTO);
Assert.assertTrue(testEventId > 0);
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class TestEventManager method testDelete.
@Test(dependsOnMethods = { "testGetById" })
public void testDelete() {
eventManager.deleteById(testEventId);
EventDTO testEventDTO = eventManager.findById(testEventId);
Assert.assertNull(testEventDTO);
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class EventManagerImpl method findByEventType.
public List<EventDTO> findByEventType(String eventType) {
Predicate predicate = Predicate.EQ("eventType", eventType);
List<EventBean> list = genericPojoDao.get(predicate, EventBean.class);
List<EventDTO> results = new ArrayList<>();
for (EventBean event : list) {
EventDTO eventDTO = MODEL_MAPPER.map(event, EventDTO.class);
results.add(eventDTO);
}
return results;
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class TestEventManager method testGetById.
@Test(dependsOnMethods = { "testCreate" })
public void testGetById() {
EventDTO testEventDTO = eventManager.findById(testEventId);
Assert.assertEquals(testEventDTO.getId().longValue(), testEventId);
System.out.println(testEventDTO.getStartTime());
System.out.println(testEventDTO.getEndTime());
System.out.println(testEventDTO.getEventType());
List<EventDTO> results0 = eventManager.findByEventType(EventType.DEPLOYMENT.name());
Assert.assertEquals(results0.size(), 1);
List<EventDTO> results1 = eventManager.findEventsBetweenTimeRange(EventType.DEPLOYMENT.name(), 0, System.currentTimeMillis());
Assert.assertEquals(results1.size(), 1);
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class DefaultDeploymentEventProvider method getEvents.
@Override
public List<EventDTO> getEvents(EventFilter eventFilter) {
List<EventDTO> qualifiedDeploymentEvents = new ArrayList<>();
ExternalApiQueryUtil.InFormedPosts inFormedPosts = informedQueryUtil.retrieveInformedEvents(SITEOPS, new DateTime(eventFilter.getStartTime()), new DateTime(eventFilter.getEndTime()));
if (inFormedPosts != null && inFormedPosts.getData() != null && inFormedPosts.getData().size() > 0) {
for (ExternalApiQueryUtil.InFormedPost inFormedPost : inFormedPosts.getData()) {
// TODO: have a better string matching once service name is extracted from content - informed API.
if (!Strings.isNullOrEmpty(eventFilter.getServiceName()) && !inFormedPost.getContent().contains(eventFilter.getServiceName())) {
continue;
}
EventDTO eventDTO = getEventFromInformed(inFormedPost);
qualifiedDeploymentEvents.add(eventDTO);
}
}
return qualifiedDeploymentEvents;
}
Aggregations