Skip to main content

unit testing BatchRuntime using GF 4 embedded API

No replies
ritzpar
Offline
Joined: 2012-08-22
Points: 0

Hi.
I wanted to test the new Batch functionality in GF 4 using Embedded API but the status of the job never changes from "STARTING". How do i get it to run ?

JobOperator operator = BatchRuntime.getJobOperator();

Set jobs = operator.getJobNames();

for (String string : jobs) {
System.out.println("found job " + string);
}

Properties props = new Properties();
long execID = operator.start("catalogUpdateJob", props);

int count = 1;

do {
Thread.currentThread().sleep(3000);

JobExecution jobExec = operator.getJobExecution(execID);
String status = jobExec.getBatchStatus().toString();
System.out.println("job status is " + status);
count++;

if (count > 15) {
operator.stop(execID);
}

} while (count < 20);