Results 1 to 4 of 4

Thread: Junit with Quartz SchedulerFactoryBean

  1. #1
    Join Date
    Dec 2009
    Posts
    15

    Default Junit with Quartz SchedulerFactoryBean

    Hi,

    I have created a simple Job using SchedulerFactoryBean for my application. Can anyone please let me know how do I test this Job using Junit and make sure that is working fine for the interval given.

    I created this Job using the below link: http://www.mkyong.com/spring/spring-...duler-example/

    Thanks in Advance.
    Rauf Khan

  2. #2

    Default

    Hi rauf,
    What are you trying to achieve using JUnit, since SimpleTrigger and Cron trigger are already configured, just bootstrap the spring context would kick-in the quartz scheduling.

    Thanks,
    Karthik

  3. #3
    Join Date
    Dec 2009
    Posts
    15

    Default

    Hi Karthik,
    I have configured the quartz scheduling and its working fine.

    What I want to try using Junit is: The Job call's a method after a required interval, I want to test the value of the method and other functionalities associated with this method.

    Code:
    Public class First {
       private HashMap myData = null;
    
       public void reload(){
             myData = calling some method;
       }
    
    }
    I have created an instance of First in Junit then used sleep for some interval. In between the sleep interval the reload has be called by the Job and that has filled the myData as per log file. Now when I try to test the value of myData using Junit its giving as NULL. The instance of First is having myData as NULL value.

    Does anyone has idea how to test the value of this instance.

    Thanks in Advance
    Khan
    Last edited by Rauf Khan; Mar 17th, 2011 at 01:32 AM. Reason: Added extra info

  4. #4
    Join Date
    Dec 2009
    Posts
    15

    Default

    Does anyone has any idea how to test the value of the member variable, whose value is assigned by the Job Scheduler.

    After creating an instance of the class and should wait for job to execute the method. Once the method is executed it should assign the values to the member variables of the instance. Right now the the member variable are having values when I check the log file but the member variable through the instance is showing NULL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •