Package org.openbp.server.scheduler

Examples of org.openbp.server.scheduler.ProcessJobDescriptor


    scheduler.suspend();

    String [] groupNames = scheduler.getJobGroupNames();
    assertEquals(0, groupNames.length);

    ProcessJobDescriptor job1 = new ProcessJobDescriptor();
    job1.setJobName("job1");
    job1.setJobGroup("SchedulerMgmtTest");
    job1.setPositionRef(STARTREF);
    job1.setExecutionMode(ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS);
    Trigger t1 = new CronTrigger("CronTestTrigger1", "SchedulerMgmtTest", "0/5 * * * * ?");
    scheduler.scheduleProcess(job1, t1);

    ProcessJobDescriptor job2 = new ProcessJobDescriptor();
    job2.setJobName("job2");
    job2.setJobGroup("SchedulerMgmtTest");
    job2.setPositionRef(STARTREF);
    job2.setExecutionMode(ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS);
    Trigger t2 = new CronTrigger("CronTestTrigger2", "SchedulerMgmtTest", "0/5 * * * * ?");
    scheduler.scheduleProcess(job2, t2);

    String [] groupNames2 = scheduler.getJobGroupNames();
    assertEquals(1, groupNames2.length);

    String [] jobNames = scheduler.getJobNames("SchedulerMgmtTest");
    assertEquals(2, jobNames.length);

    ProcessJobDescriptor job1Copy = scheduler.getProcessJobDescriptor("job1", "SchedulerMgmtTest");
    assertNotNull(job1Copy);

    scheduler.deleteJob("job1", "SchedulerMgmtTest");
    String [] groupNames3 = scheduler.getJobGroupNames();
    assertEquals(1, groupNames3.length);
View Full Code Here


    getProcessServer().getProcessFacade().begin();
    TokenContext tc = createToken();
    getProcessServer().getProcessFacade().prepareTokenForScheduler(tc);
    getProcessServer().getProcessFacade().commit();

    ProcessJobDescriptor job1 = new ProcessJobDescriptor();
    job1.setJobName("job1");
    job1.setJobGroup("SchedulerTest");
    job1.setTokenContext(tc);
    job1.setPositionRef(STARTREF);

    // For this test case, we will execute the job directly within the job handler.
    // In an application, you should rather use the asynchronous execution mode using the execution thread pool.
    job1.setExecutionMode(ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS);

    HashMap inputValues = new HashMap();
    inputValues.put("StringParam", TEST_PARAM_VALUE);
    job1.setInputValues(inputValues);

    // Start in 5 sec.
    Trigger t1 = new SimpleTrigger("trigger1", "SchedulerTest");
    long currentTime = System.currentTimeMillis();
    Date d1 = new Date(currentTime + 5000L);
    t1.setStartTime(d1);

    scheduler.scheduleProcess(job1, t1);

    // Wait 10 sec
    Object v1 = wait(SIGNAL1, 10);
    assertEquals(TEST_PARAM_VALUE, v1);

    // The process has been executed as desired. The execution of the process stopped
    // at the wait state node.

    // The next job will resume the workflow from its current position.
    ProcessJobDescriptor job2 = new ProcessJobDescriptor();
    job2.setJobName("job2");
    job2.setJobGroup("SchedulerTest");
    job2.setTokenContext(tc);
    job2.setPositionRef("Continue");
    job2.setStartMode(ProcessJobDescriptor.START_MODE_RESUME);

    // For this test case, we will execute the job directly within the job handler.
    // In an application, you should rather use the asynchronous execution mode using the execution thread pool.
    job2.setExecutionMode(ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS);

    // Again, 5 sec. delay
    Trigger t2 = new SimpleTrigger("trigger2", "SchedulerTest");
    currentTime = System.currentTimeMillis();
    Date d2 = new Date(currentTime + 5000L);
View Full Code Here

  public void test5SecTrigger()
    throws Exception
  {
    scheduler = (QuartzProcessScheduler) getProcessServer().getProcessScheduler();

    ProcessJobDescriptor job1 = new ProcessJobDescriptor();
    job1.setJobName("job1");
    job1.setJobGroup("SchedulerTest");
    job1.setPositionRef(STARTREF);

    // For this test case, we will execute the job directly within the job handler.
    // In an application, you should rather use the asynchronous execution mode using the execution thread pool.
    job1.setExecutionMode(ProcessJobDescriptor.EXECUTION_MODE_SYNCHRONOUS);

    TestCaseSyncMgr.getInstance().setSignal("Counter", new Integer(0));

    // Fire trigger each 5 seconds
    Trigger t = new CronTrigger("CronTestTrigger", "SchedulerTest", "0/5 * * * * ?");
 
View Full Code Here

TOP

Related Classes of org.openbp.server.scheduler.ProcessJobDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.