Search in sources :

Example 6 with EventDTO

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);
}
Also used : HashMap(java.util.HashMap) EventDTO(com.linkedin.thirdeye.datalayer.dto.EventDTO) List(java.util.List) Test(org.testng.annotations.Test)

Example 7 with EventDTO

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);
}
Also used : EventDTO(com.linkedin.thirdeye.datalayer.dto.EventDTO) Test(org.testng.annotations.Test)

Example 8 with EventDTO

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;
}
Also used : EventBean(com.linkedin.thirdeye.datalayer.pojo.EventBean) ArrayList(java.util.ArrayList) EventDTO(com.linkedin.thirdeye.datalayer.dto.EventDTO) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 9 with EventDTO

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);
}
Also used : EventDTO(com.linkedin.thirdeye.datalayer.dto.EventDTO) Test(org.testng.annotations.Test)

Example 10 with EventDTO

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;
}
Also used : ArrayList(java.util.ArrayList) EventDTO(com.linkedin.thirdeye.datalayer.dto.EventDTO) DateTime(org.joda.time.DateTime)

Aggregations

EventDTO (com.linkedin.thirdeye.datalayer.dto.EventDTO)11 ArrayList (java.util.ArrayList)8 List (java.util.List)4 EventBean (com.linkedin.thirdeye.datalayer.pojo.EventBean)3 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)3 HashMap (java.util.HashMap)3 Test (org.testng.annotations.Test)3 MergedAnomalyResultDTO (com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO)1 Map (java.util.Map)1 DateTime (org.joda.time.DateTime)1