Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] help with writing changeLog tests ?

Subject: Grouper Developers Forum

List archive

[grouper-dev] help with writing changeLog tests ?


Chronological Thread 
  • From: Tom Zeller <>
  • To: Grouper Dev <>
  • Subject: [grouper-dev] help with writing changeLog tests ?
  • Date: Fri, 30 Sep 2011 09:30:47 -0500

I am starting to write tests for the ldappcng changelog consumer. Is
this the correct way to write changelog tests ?

public void testSomething() {

ldappcngConsumer.runChangeLog();

ChangeLogTempToEntity.convertRecords();

// clear changelog
HibernateSession.byHqlStatic().createQuery("delete from
ChangeLogEntryTemp").executeUpdate();
HibernateSession.byHqlStatic().createQuery("delete from
ChangeLogEntryEntity").executeUpdate();

// do something e.g. group.addMember();

ChangeLogTempToEntity.convertRecords();

ldappcngConsumer.runChangeLog();

// verify test
}

And here is the runChangeLog() method :

public void runChangeLog() {
LOG.info("runChangeLog");
Hib3GrouperLoaderLog hib3GrouploaderLog = new Hib3GrouperLoaderLog();
hib3GrouploaderLog.setHost(GrouperUtil.hostname());
hib3GrouploaderLog.setJobName(CHANGELOG_JOB_NAME);
hib3GrouploaderLog.setStatus(GrouperLoaderStatus.RUNNING.name());
hib3GrouploaderLog.store();

try {
ChangeLogHelper.processRecords(CHANGELOG_JOB_NAME,
hib3GrouploaderLog, this);
hib3GrouploaderLog.setStatus(GrouperLoaderStatus.SUCCESS.name());
} catch (Exception e) {
LOG.error("Error processing records", e);
hib3GrouploaderLog.setStatus(GrouperLoaderStatus.ERROR.name());
}
hib3GrouploaderLog.store();
}



Archive powered by MHonArc 2.6.16.

Top of Page