Search in sources :

Example 6 with IngraphMetricConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.

the class AbstractManagerTestBase method getTestIngraphMetricConfig.

protected IngraphMetricConfigDTO getTestIngraphMetricConfig(String rrd, String metric, String dashboard) {
    IngraphMetricConfigDTO ingraphMetricConfigDTO = new IngraphMetricConfigDTO();
    ingraphMetricConfigDTO.setRrdName(rrd);
    ingraphMetricConfigDTO.setMetricName(metric);
    ingraphMetricConfigDTO.setDashboardName(dashboard);
    ingraphMetricConfigDTO.setContainer("test");
    ingraphMetricConfigDTO.setMetricDataType("test");
    ingraphMetricConfigDTO.setMetricSourceType("test");
    return ingraphMetricConfigDTO;
}
Also used : IngraphMetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO)

Example 7 with IngraphMetricConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.

the class TestIngraphMetricConfigManager method testUpdateIngraphMetric.

@Test(dependsOnMethods = { "testFindIngraphMetric" })
public void testUpdateIngraphMetric() {
    IngraphMetricConfigDTO ingraphMetricConfigDTO = ingraphMetricConfigDAO.findById(ingraphMetricConfigId1);
    Assert.assertNotNull(ingraphMetricConfigDTO);
    Assert.assertEquals(ingraphMetricConfigDTO.getDashboardName(), dashboard1);
    ingraphMetricConfigDTO.setDashboardName(dashboard2);
    ingraphMetricConfigDAO.update(ingraphMetricConfigDTO);
    ingraphMetricConfigDTO = ingraphMetricConfigDAO.findById(ingraphMetricConfigId1);
    Assert.assertNotNull(ingraphMetricConfigDTO);
    Assert.assertEquals(ingraphMetricConfigDTO.getDashboardName(), dashboard2);
    List<IngraphMetricConfigDTO> ingraphMetricConfigDTOs = ingraphMetricConfigDAO.findByDashboard(dashboard2);
    Assert.assertEquals(ingraphMetricConfigDTOs.size(), 2);
}
Also used : IngraphMetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO) Test(org.testng.annotations.Test)

Example 8 with IngraphMetricConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.

the class TestIngraphMetricConfigManager method testFindIngraphMetric.

@Test(dependsOnMethods = { "testCreateIngraphMetric" })
public void testFindIngraphMetric() {
    List<IngraphMetricConfigDTO> ingraphMetricConfigDTOs = ingraphMetricConfigDAO.findAll();
    Assert.assertEquals(ingraphMetricConfigDTOs.size(), 2);
    ingraphMetricConfigDTOs = ingraphMetricConfigDAO.findByDashboard(dashboard1);
    Assert.assertEquals(ingraphMetricConfigDTOs.size(), 1);
    IngraphMetricConfigDTO ingraphMetricConfigDTO = ingraphMetricConfigDAO.findByDashboardAndMetricName(dashboard1, metric1);
    Assert.assertEquals(ingraphMetricConfigDTO.getDashboardName(), dashboard1);
    Assert.assertEquals(ingraphMetricConfigDTO.getMetricName(), metric1);
    Assert.assertEquals(ingraphMetricConfigDTO.getRrdName(), rrd1);
    ingraphMetricConfigDTO = ingraphMetricConfigDAO.findByRrdName(rrd1);
    Assert.assertEquals(ingraphMetricConfigDTO.getDashboardName(), dashboard1);
    Assert.assertEquals(ingraphMetricConfigDTO.getMetricName(), metric1);
    Assert.assertEquals(ingraphMetricConfigDTO.getRrdName(), rrd1);
}
Also used : IngraphMetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO) Test(org.testng.annotations.Test)

Example 9 with IngraphMetricConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.

the class TestIngraphMetricConfigManager method testDeleteIngraphMetric.

@Test(dependsOnMethods = { "testUpdateIngraphMetric" })
public void testDeleteIngraphMetric() {
    ingraphMetricConfigDAO.deleteById(ingraphMetricConfigId1);
    IngraphMetricConfigDTO ingraphMetricConfigDTO = ingraphMetricConfigDAO.findById(ingraphMetricConfigId1);
    Assert.assertNull(ingraphMetricConfigDTO);
}
Also used : IngraphMetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO) Test(org.testng.annotations.Test)

Example 10 with IngraphMetricConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.

the class IngraphMetricConfigResource method createMetricConfig.

@GET
@Path("/create")
public String createMetricConfig(@QueryParam("rrdName") String rrdName, @QueryParam("metricName") String metricName, @QueryParam("dashboardName") String dashboardName, @QueryParam("metricDataType") String metricDataType, @QueryParam("metricSourceType") String metricSourceType, @QueryParam("container") String container) {
    try {
        IngraphMetricConfigDTO ingraphMetricConfigDTO = new IngraphMetricConfigDTO();
        ingraphMetricConfigDTO.setRrdName(rrdName);
        ingraphMetricConfigDTO.setMetricName(metricName);
        ingraphMetricConfigDTO.setDashboardName(dashboardName);
        ingraphMetricConfigDTO.setContainer(container);
        ingraphMetricConfigDTO.setMetricDataType(metricDataType);
        ingraphMetricConfigDTO.setMetricSourceType(metricSourceType);
        Long id = ingraphMetricConfigDao.save(ingraphMetricConfigDTO);
        ingraphMetricConfigDTO.setId(id);
        return JsonResponseUtil.buildResponseJSON(ingraphMetricConfigDTO).toString();
    } catch (Exception e) {
        return JsonResponseUtil.buildErrorResponseJSON("Failed to create rrd:" + rrdName).toString();
    }
}
Also used : IngraphMetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

IngraphMetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO)11 Test (org.testng.annotations.Test)4 IngraphMetricConfigBean (com.linkedin.thirdeye.datalayer.pojo.IngraphMetricConfigBean)3 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 ArrayList (java.util.ArrayList)1 Produces (javax.ws.rs.Produces)1 ObjectNode (org.codehaus.jackson.node.ObjectNode)1