26 #include <scheduler.h> 63 FO_ASSERT_PTR_NULL(scheduler->
db_conn);
65 FO_ASSERT_PTR_NOT_NULL_FATAL(scheduler->
db_conn);
71 job = g_tree_lookup(scheduler->
job_list, &jq_pk);
72 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
74 FO_ASSERT_EQUAL(job->
id, jq_pk);
78 params->second = jq_pk;
80 FO_ASSERT_EQUAL(job->
status, JB_PAUSED);
84 params->second = jq_pk;
86 FO_ASSERT_EQUAL(job->
status, JB_RESTART);
92 FO_ASSERT_EQUAL(job->
status, JB_RESTART);
95 FO_ASSERT_EQUAL(job->
status, JB_FAILED);
122 FO_ASSERT_PTR_NULL(scheduler->
db_conn);
124 FO_ASSERT_PTR_NOT_NULL(scheduler->
db_conn);
130 job = g_tree_lookup(scheduler->
job_list, &jq_pk);
131 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
134 FO_ASSERT_STRING_EQUAL(res,
"6");
136 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
137 FO_ASSERT_EQUAL(job->
id, 1);
139 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
140 FO_ASSERT_EQUAL(job->
id, 1);
142 FO_ASSERT_EQUAL(result, 0);
151 CU_TestInfo tests_job[] =
PGconn * db_conn
The database connection.
void job_verbose_event(scheduler_t *scheduler, job_t *job)
int Prepare_Testing_Data(scheduler_t *scheduler)
void test_job_event()
Test for job events.
void job_pause_event(scheduler_t *scheduler, arg_int *params)
Event to pause a job.
void scheduler_destroy(scheduler_t *scheduler)
Free any memory associated with a scheduler_t.
void database_init(scheduler_t *scheduler)
void database_update_event(scheduler_t *scheduler, void *unused)
Checks the job queue for any new entries.
GSequence * job_queue
heap of jobs that still need to be started
int Prepare_Testing_Data_Job(scheduler_t *scheduler)
char * job_next(job_t *job)
void scheduler_update(scheduler_t *scheduler)
Update function called after every event.
GTree * job_list
List of jobs that have been created.
uint32_t active_jobs(GTree *job_list)
Gets the number of jobs that are not paused.
job_t * peek_job(GSequence *job_queue)
Gets the job that is at the top of the queue if there is one.
void job_restart_event(scheduler_t *scheduler, arg_int *params)
scheduler_t * scheduler_init(gchar *sysconfigdir, log_t *log)
Create a new scheduler object.
job_t * next_job(GSequence *job_queue)
Gets the next job from the job queue.
void test_job_fun()
Test for job functions.
void job_priority_event(scheduler_t *scheduler, arg_int *params)
job_status status
The current status for the job.
void job_fail_event(scheduler_t *scheduler, job_t *job)
Events that causes a job to be marked a failed.
int32_t id
The identifier for this job.