Skip to Content.
Sympa Menu

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

Subject: Grouper Developers Forum

List archive

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


Chronological Thread 
  • From: Shilen Patel <>
  • To: Tom Zeller <>, Chris Hyzer <>
  • Cc: Grouper Dev <>
  • Subject: Re: [grouper-dev] help with writing changeLog tests ?
  • Date: Fri, 30 Sep 2011 18:52:10 +0000
  • Accept-language: en-US

The time it takes to run that depends on how many changes you have in your
temp change log among other things. Is there a particular junit test that
is having this slow response time when using postgres? If so, I can try
to reproduce it and take a look.

Thanks!

-- Shilen

On 9/30/11 2:22 PM, "Tom Zeller"
<>
wrote:

>Thanks.
>
>I found that in GrouperLoaderType, in the CHANGE_LOG enum, the following
>
> 826 ChangeLogTempToEntity.convertRecords(hib3GrouploaderLog);
>
>seems slow (10s per test) using postgres, it is faster with hsql.
>
>I guess it is the PIT saveOrUpdate() stuff.
>
>This may be of concern, perhaps the postgres ddl needs tweaking, I
>have no idea how :-)
>
>On Fri, Sep 30, 2011 at 11:06 AM, Chris Hyzer
><>
>wrote:
>> I think you can make it think it is actually running to be a more
>>realistic test... i.e. configure it for tests in the grouper-loader
>>testConfig in a startUp() [and remove in tearDown()]:
>>
>>
>>GrouperLoaderConfig.testConfig.put("changeLog.consumer.ldappcng.class",
>>LdappcngConsumer.class.getName());
>>
>>GrouperLoaderConfig.testConfig.put("changeLog.consumer.ldappcng.quartzCro
>>n", "0 0 8 * * ?");
>>
>> Then run it to register the consumer and clear out the change log:
>>
>> GrouperLoader.runOnceByJobName(grouperSession,
>>GrouperLoaderType.GROUPER_CHANGE_LOG_TEMP_TO_CHANGE_LOG);
>> GrouperLoader.runOnceByJobName(grouperSession,
>>GrouperLoaderType.GROUPER_CHANGE_LOG_CONSUMER_PREFIX + "ldappcng");
>>
>> Do stuff:
>>
>> Call those again and it will process whatever you did
>>
>> GrouperLoader.runOnceByJobName(grouperSession,
>>GrouperLoaderType.GROUPER_CHANGE_LOG_TEMP_TO_CHANGE_LOG);
>> GrouperLoader.runOnceByJobName(grouperSession,
>>GrouperLoaderType.GROUPER_CHANGE_LOG_CONSUMER_PREFIX + "ldappcng");
>>
>> Ok?
>>
>> Thanks,
>> Chris
>>
>> -----Original Message-----
>> From:
>>
>>
>> [mailto:]
>> On Behalf Of Tom
>>Zeller
>> Sent: Friday, September 30, 2011 10:31 AM
>> To: Grouper Dev
>> Subject: [grouper-dev] help with writing changeLog tests ?
>>
>> 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