15 #include <scheduler.h>
52 FO_ASSERT_PTR_NULL(scheduler->
db_conn);
54 FO_ASSERT_PTR_NOT_NULL_FATAL(scheduler->
db_conn);
60 job = g_tree_lookup(scheduler->
job_list, &jq_pk);
61 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
63 FO_ASSERT_EQUAL(job->
id, jq_pk);
67 params->second = jq_pk;
69 FO_ASSERT_EQUAL(job->
status, JB_PAUSED);
73 params->second = jq_pk;
75 FO_ASSERT_EQUAL(job->
status, JB_RESTART);
81 FO_ASSERT_EQUAL(job->
status, JB_RESTART);
84 FO_ASSERT_EQUAL(job->
status, JB_FAILED);
111 FO_ASSERT_PTR_NULL(scheduler->
db_conn);
113 FO_ASSERT_PTR_NOT_NULL(scheduler->
db_conn);
119 job = g_tree_lookup(scheduler->
job_list, &jq_pk);
120 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
123 FO_ASSERT_STRING_EQUAL(res,
"6");
125 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
126 FO_ASSERT_EQUAL(job->
id, 1);
128 FO_ASSERT_PTR_NOT_NULL_FATAL(job);
129 FO_ASSERT_EQUAL(job->
id, 1);
131 FO_ASSERT_EQUAL(result, 0);
140 CU_TestInfo tests_job[] =
void job_fail_event(scheduler_t *scheduler, job_t *job)
Events that causes a job to be marked a failed.
void job_restart_event(scheduler_t *scheduler, arg_int *params)
job_t * next_job(GSequence *job_queue)
Gets the next job from the job queue.
char * job_next(job_t *job)
job_t * peek_job(GSequence *job_queue)
Gets the job that is at the top of the queue if there is one.
void job_verbose_event(scheduler_t *scheduler, job_t *job)
void job_pause_event(scheduler_t *scheduler, arg_int *params)
Event to pause a job.
void job_priority_event(scheduler_t *scheduler, arg_int *params)
uint32_t active_jobs(GTree *job_list)
Gets the number of jobs that are not paused.
void database_init(scheduler_t *scheduler)
void database_update_event(scheduler_t *scheduler, void *unused)
Checks the job queue for any new entries.
void scheduler_update(scheduler_t *scheduler)
Update function called after every event.
scheduler_t * scheduler_init(gchar *sysconfigdir, log_t *log)
Create a new scheduler object.
void scheduler_destroy(scheduler_t *scheduler)
Free any memory associated with a scheduler_t.
int Prepare_Testing_Data(scheduler_t *scheduler)
int32_t id
The identifier for this job.
job_status status
The current status for the job.
GTree * job_list
List of jobs that have been created.
PGconn * db_conn
The database connection.
GSequence * job_queue
heap of jobs that still need to be started
void test_job_fun()
Test for job functions.
void test_job_event()
Test for job events.
int Prepare_Testing_Data_Job(scheduler_t *scheduler)