@Test
public void testAggregatedIntervalConfig() throws Exception {
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
assertNotNull(defaultAggregatedIntervalConfig);
assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
assertEquals(0, defaultAggregatedIntervalConfig.getIncluded().size());
AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
assertNull(loginAggregatedIntervalConfig);
loginAggregatedIntervalConfig = eventAggregationManagementDao.createAggregatedIntervalConfig(LoginPortalEventAggregator.class);
assertNotNull(loginAggregatedIntervalConfig);
assertEquals(0, loginAggregatedIntervalConfig.getExcluded().size());
assertEquals(0, loginAggregatedIntervalConfig.getIncluded().size());
defaultAggregatedIntervalConfig.getIncluded().add(AggregationInterval.MINUTE);
loginAggregatedIntervalConfig.getExcluded().add(AggregationInterval.MINUTE);
eventAggregationManagementDao.updateAggregatedIntervalConfig(defaultAggregatedIntervalConfig);
eventAggregationManagementDao.updateAggregatedIntervalConfig(loginAggregatedIntervalConfig);
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
assertNotNull(defaultAggregatedIntervalConfig);
assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
assertEquals(1, defaultAggregatedIntervalConfig.getIncluded().size());
AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
assertNotNull(loginAggregatedIntervalConfig);
assertEquals(1, loginAggregatedIntervalConfig.getExcluded().size());
assertEquals(0, loginAggregatedIntervalConfig.getIncluded().size());
eventAggregationManagementDao.deleteAggregatedIntervalConfig(defaultAggregatedIntervalConfig);
eventAggregationManagementDao.deleteAggregatedIntervalConfig(loginAggregatedIntervalConfig);
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
assertNotNull(defaultAggregatedIntervalConfig);
assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
assertEquals(0, defaultAggregatedIntervalConfig.getIncluded().size());
AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
assertNull(loginAggregatedIntervalConfig);
}
});
}