Skip to content

Commit

Permalink
fix unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Sep 13, 2009
1 parent 1d1c0c7 commit 2252a27
Showing 1 changed file with 14 additions and 4 deletions.
Expand Up @@ -383,16 +383,18 @@ public void syncUpdateWithEmptyKey() {
@Test(timeout = 30000)
public void testPurge() throws Exception {
logTestRunning();
IParameterService parameterService = AppUtils.find(Constants.PARAMETER_SERVICE, getClientEngine());
int purgeRetentionMinues = parameterService.getInt(ParameterConstants.PURGE_RETENTION_MINUTES);
// set purge in the future just in case the database time is different than the current time
parameterService.saveParameter(ParameterConstants.PURGE_RETENTION_MINUTES, -60*24);

// do an extra push & pull to make sure we have events cleared out
getClientEngine().pull();
getClientEngine().push();

Thread.sleep(2000);

IParameterService parameterService = AppUtils.find(Constants.PARAMETER_SERVICE, getRootEngine());
int purgeRetentionMinues = parameterService.getInt(ParameterConstants.PURGE_RETENTION_MINUTES);
// set purge in the future just in case the database time is different than the current time
parameterService.saveParameter(ParameterConstants.PURGE_RETENTION_MINUTES, -60*24);

int beforePurge = rootJdbcTemplate.queryForInt("select count(*) from sym_data");
getRootEngine().purge();
int afterPurge = rootJdbcTemplate.queryForInt("select count(*) from sym_data");
Expand All @@ -404,7 +406,14 @@ public void testPurge() throws Exception {
+ " row before anf " + afterPurge + " rows after. The max create_time in sym_data was " + maxCreateTime
+ " and the min create_time in sym_data was " + minCreateTime
+ " and the current time of the server is " + new Date(), (beforePurge - afterPurge) > 0);

parameterService.saveParameter(ParameterConstants.PURGE_RETENTION_MINUTES, purgeRetentionMinues);

parameterService = AppUtils.find(Constants.PARAMETER_SERVICE, getClientEngine());
purgeRetentionMinues = parameterService.getInt(ParameterConstants.PURGE_RETENTION_MINUTES);
// set purge in the future just in case the database time is different than the current time
parameterService.saveParameter(ParameterConstants.PURGE_RETENTION_MINUTES, -60*24);

beforePurge = clientJdbcTemplate.queryForInt("select count(*) from sym_data");
getClientEngine().purge();
afterPurge = clientJdbcTemplate.queryForInt("select count(*) from sym_data");
Expand All @@ -416,6 +425,7 @@ public void testPurge() throws Exception {
+ " row before anf " + afterPurge + " rows after. . The max create_time in sym_data was "
+ maxCreateTime + " and the min create_time in sym_data was " + minCreateTime
+ " and the current time of the server is " + new Date(), (beforePurge - afterPurge) > 0);

parameterService.saveParameter(ParameterConstants.PURGE_RETENTION_MINUTES, purgeRetentionMinues);
}

Expand Down

0 comments on commit 2252a27

Please sign in to comment.