use of com.linkedin.thirdeye.datalayer.dto.OverrideConfigDTO in project pinot by linkedin.
the class AbstractManagerTestBase method getTestOverrideConfigForTimeSeries.
protected OverrideConfigDTO getTestOverrideConfigForTimeSeries(DateTime now) {
OverrideConfigDTO overrideConfigDTO = new OverrideConfigDTO();
overrideConfigDTO.setStartTime(now.minusHours(8).getMillis());
overrideConfigDTO.setEndTime(now.plusHours(8).getMillis());
overrideConfigDTO.setTargetEntity(OverrideConfigHelper.ENTITY_TIME_SERIES);
overrideConfigDTO.setActive(true);
Map<String, String> overrideProperties = new HashMap<>();
overrideProperties.put(ScalingFactor.SCALING_FACTOR, "1.2");
overrideConfigDTO.setOverrideProperties(overrideProperties);
Map<String, List<String>> overrideTarget = new HashMap<>();
overrideTarget.put(OverrideConfigHelper.TARGET_COLLECTION, Arrays.asList("collection1", "collection2"));
overrideTarget.put(OverrideConfigHelper.EXCLUDED_COLLECTION, Arrays.asList("collection3"));
overrideConfigDTO.setTargetLevel(overrideTarget);
return overrideConfigDTO;
}
use of com.linkedin.thirdeye.datalayer.dto.OverrideConfigDTO in project pinot by linkedin.
the class RunAdhocDatabaseQueriesTool method updateOverrideConfig.
private void updateOverrideConfig(long id, OverrideConfigDTO overrideConfigDTO) {
OverrideConfigDTO overrideConfigToUpdated = overrideConfigDAO.findById(id);
if (overrideConfigToUpdated == null) {
LOG.warn("Failed to update config {}", id);
} else {
overrideConfigToUpdated.setStartTime(overrideConfigDTO.getStartTime());
overrideConfigToUpdated.setEndTime(overrideConfigDTO.getEndTime());
overrideConfigToUpdated.setTargetLevel(overrideConfigDTO.getTargetLevel());
overrideConfigToUpdated.setTargetEntity(overrideConfigDTO.getTargetEntity());
overrideConfigToUpdated.setOverrideProperties(overrideConfigDTO.getOverrideProperties());
overrideConfigToUpdated.setActive(overrideConfigDTO.getActive());
overrideConfigDAO.update(overrideConfigToUpdated);
LOG.info("Updated config {}" + id);
}
}
use of com.linkedin.thirdeye.datalayer.dto.OverrideConfigDTO in project pinot by linkedin.
the class TestOverrideConfigManager method testUpdate.
@Test(dependsOnMethods = { "testFind" })
public void testUpdate() {
// Test update of override property
OverrideConfigDTO overrideConfigDTO = overrideConfigDAO.findById(overrideConfigId1);
Assert.assertNotNull(overrideConfigDTO);
Assert.assertNotNull(overrideConfigDTO.getOverrideProperties());
Assert.assertNotNull(overrideConfigDTO.getOverrideProperties().get(ScalingFactor.SCALING_FACTOR));
Assert.assertEquals(overrideConfigDTO.getOverrideProperties().get(ScalingFactor.SCALING_FACTOR), "1.2");
Map<String, String> newOverrideProperties = new HashMap<>();
newOverrideProperties.put(ScalingFactor.SCALING_FACTOR, "0.8");
overrideConfigDTO.setOverrideProperties(newOverrideProperties);
overrideConfigDAO.update(overrideConfigDTO);
overrideConfigDTO = overrideConfigDAO.findById(overrideConfigId1);
Assert.assertNotNull(overrideConfigDTO);
Assert.assertNotNull(overrideConfigDTO.getOverrideProperties());
Assert.assertNotNull(overrideConfigDTO.getOverrideProperties().get(ScalingFactor.SCALING_FACTOR));
Assert.assertEquals(overrideConfigDTO.getOverrideProperties().get(ScalingFactor.SCALING_FACTOR), "0.8");
// Test update of target level
overrideConfigDTO = overrideConfigDAO.findById(overrideConfigId1);
Assert.assertNotNull(overrideConfigDTO);
Assert.assertNotNull(overrideConfigDTO.getTargetLevel());
List<String> targetLevel = overrideConfigDTO.getTargetLevel().get(OverrideConfigHelper.TARGET_COLLECTION);
Assert.assertNotNull(targetLevel);
Assert.assertEquals(targetLevel, Arrays.asList("collection1", "collection2"));
List<String> newTargetLevel = Arrays.asList("collection1", "collection4");
overrideConfigDTO.getTargetLevel().put(OverrideConfigHelper.TARGET_COLLECTION, newTargetLevel);
overrideConfigDAO.update(overrideConfigDTO);
overrideConfigDTO = overrideConfigDAO.findById(overrideConfigId1);
Assert.assertNotNull(overrideConfigDTO);
Assert.assertNotNull(overrideConfigDTO.getTargetLevel());
targetLevel = overrideConfigDTO.getTargetLevel().get(OverrideConfigHelper.TARGET_COLLECTION);
Assert.assertNotNull(targetLevel);
Assert.assertEquals(targetLevel, Arrays.asList("collection1", "collection4"));
}
use of com.linkedin.thirdeye.datalayer.dto.OverrideConfigDTO in project pinot by linkedin.
the class TestOverrideConfigManager method testCreate.
@Test
public void testCreate() {
OverrideConfigDTO overrideConfigDTO1 = getTestOverrideConfigForTimeSeries(now);
overrideConfigId1 = overrideConfigDAO.save(overrideConfigDTO1);
Assert.assertNotNull(overrideConfigId1);
Assert.assertNotNull(overrideConfigDAO.findById(overrideConfigId1));
}
use of com.linkedin.thirdeye.datalayer.dto.OverrideConfigDTO in project pinot by linkedin.
the class TestOverrideConfigManager method testDelete.
@Test(dependsOnMethods = { "testUpdate" })
public void testDelete() {
overrideConfigDAO.deleteById(overrideConfigId1);
OverrideConfigDTO overrideConfigDTO = overrideConfigDAO.findById(overrideConfigId1);
Assert.assertNull(overrideConfigDTO);
}
Aggregations