win32-taskscheduler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,103 @@
1
+ #define WIN32_TASKSCHEDULER_VERSION "0.1.0"
2
+
3
+ // Prototype
4
+ static VALUE ts_new_work_item(VALUE self, VALUE job, VALUE trigger);
5
+
6
+ #ifdef __cplusplus
7
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
8
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
9
+ #else
10
+ # define VALUEFUNC(f) (f)
11
+ # define VOIDFUNC(f) (f)
12
+ #endif
13
+
14
+ #define TASKS_TO_RETRIEVE 5
15
+ #define TOTAL_RUN_TIME_TO_FETCH 10
16
+ #define ERROR_BUFFER 1024
17
+
18
+ #ifndef NAME_MAX
19
+ #define NAME_MAX 256
20
+ #endif
21
+
22
+ // I dug these out of WinBase.h
23
+ #ifndef BELOW_NORMAL_PRIORITY_CLASS
24
+ #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
25
+ #endif
26
+
27
+ #ifndef ABOVE_NORMAL_PRIORITY_CLASS
28
+ #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
29
+ #endif
30
+
31
+ #ifndef TASK_FLAG_RUN_ONLY_IF_LOGGED_ON
32
+ #define TASK_FLAG_RUN_ONLY_IF_LOGGED_ON 0x2000
33
+ #endif
34
+
35
+ static VALUE cTSError;
36
+
37
+ struct tsstruct {
38
+ ITaskScheduler *pITS;
39
+ ITask *pITask;
40
+ };
41
+
42
+ typedef struct tsstruct TSStruct;
43
+
44
+ static void ts_free(TSStruct *p){
45
+ if(p->pITask != NULL)
46
+ p->pITask->Release();
47
+
48
+ if(p->pITS != NULL)
49
+ p->pITS->Release();
50
+
51
+ CoUninitialize();
52
+ free(p);
53
+ }
54
+
55
+ static VALUE obj_free(VALUE obj){
56
+ rb_gc();
57
+ return Qnil;
58
+ }
59
+
60
+ DWORD bitFieldToHumanDays(DWORD day){
61
+ return (DWORD)((log((double)day)/log((double)2))+1);
62
+ }
63
+
64
+ DWORD humanDaysToBitField(DWORD day){
65
+ return (DWORD)pow((double)2, (int)(day-1));
66
+ }
67
+
68
+ // Return an error code as a string
69
+ LPTSTR ErrorString(DWORD p_dwError)
70
+ {
71
+ HLOCAL hLocal = NULL;
72
+ static char ErrStr[1024];
73
+ int len;
74
+
75
+ if (!(len=FormatMessage(
76
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
77
+ FORMAT_MESSAGE_FROM_SYSTEM |
78
+ FORMAT_MESSAGE_IGNORE_INSERTS,
79
+ NULL,
80
+ p_dwError,
81
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
82
+ (LPTSTR)&hLocal,
83
+ 0,
84
+ NULL)))
85
+ {
86
+ rb_raise(rb_eStandardError,"Unable to format error message");
87
+ }
88
+ memset(ErrStr, 0, ERROR_BUFFER);
89
+ strncpy(ErrStr, (LPTSTR)hLocal, len-2); // remove \r\n
90
+ LocalFree(hLocal);
91
+ return ErrStr;
92
+ }
93
+
94
+ /* Private internal function that validates that the TS and ITask struct
95
+ * members are not null.
96
+ */
97
+ void check_ts_ptr(TSStruct* ptr, const char* func_name){
98
+ if(ptr->pITS == NULL)
99
+ rb_raise(cTSError, "Fatal error: null pointer (%s)", func_name);
100
+
101
+ if(ptr->pITask == NULL)
102
+ rb_raise(cTSError, "No currently active task");
103
+ }
@@ -0,0 +1,494 @@
1
+ ##########################################################################
2
+ # tc_taskscheduler.rb
3
+ #
4
+ # Test suite for the win32-taskscheduler package. You should run this
5
+ # via the 'rake test' task.
6
+ ##########################################################################
7
+ require 'test/unit'
8
+ require 'win32/taskscheduler'
9
+ require 'socket'
10
+ include Win32
11
+
12
+ class TC_TaskScheduler < Test::Unit::TestCase
13
+ def setup
14
+ @host = Socket.gethostname
15
+ @task = 'foo'
16
+ @job_file = "C:\\WINDOWS\\Tasks\\test.job"
17
+ @trigger = {
18
+ 'start_year' => 2009,
19
+ 'start_month' => 4,
20
+ 'start_day' => 11,
21
+ 'start_hour' => 7,
22
+ 'start_minute' => 14,
23
+ 'trigger_type' => TaskScheduler::DAILY,
24
+ 'type' => { 'days_interval' => 1 }
25
+ }
26
+ @ts = TaskScheduler.new(@task, @trigger)
27
+ @ts.save
28
+ @ts.activate(@task)
29
+ end
30
+
31
+ def test_version
32
+ assert_equal('0.1.0', TaskScheduler::VERSION)
33
+ end
34
+
35
+ def test_get_account_information
36
+ assert_respond_to(@ts, :account_information)
37
+ assert_equal(nil, @ts.account_information)
38
+ end
39
+
40
+ def test_get_account_information_expected_errors
41
+ assert_raise(ArgumentError){ @ts.account_information('foo') }
42
+ end
43
+
44
+ def test_set_account_information
45
+ assert_nothing_raised{ @ts.set_account_information('test', 'XXXX') }
46
+ assert_equal('test', @ts.account_information)
47
+ end
48
+
49
+ def test_set_account_information_expected_errors
50
+ assert_raise(ArgumentError){ @ts.set_account_information }
51
+ assert_raise(ArgumentError){ @ts.set_account_information('x') }
52
+ assert_raise(ArgumentError){ @ts.set_account_information('x', 'y', 'z') }
53
+ assert_raise(TypeError){ @ts.set_account_information(1, 'XXX') }
54
+ assert_raise(TypeError){ @ts.set_account_information('x', 1) }
55
+ end
56
+
57
+ def test_activate
58
+ assert_nothing_raised{ @ts.activate('foo') }
59
+ assert_nothing_raised{ @ts.activate('foo') } # Intentional duplicate
60
+ end
61
+
62
+ def test_activate_expected_errors
63
+ assert_raise(ArgumentError){ @ts.activate }
64
+ assert_raise(ArgumentError){ @ts.activate('foo', 'bar') }
65
+ assert_raise(TypeError){ @ts.activate(1) }
66
+ assert_raise(TaskScheduler::Error){ @ts.activate('bogus') }
67
+ end
68
+
69
+ def test_get_application_name
70
+ assert_respond_to(@ts, :application_name)
71
+ assert_nothing_raised{ @ts.application_name }
72
+ assert_kind_of(String, @ts.application_name)
73
+ end
74
+
75
+ def test_get_application_name_expected_errors
76
+ assert_raises(ArgumentError){ @ts.application_name('bogus') }
77
+ end
78
+
79
+ def test_set_application_name
80
+ assert_respond_to(@ts, :application_name=)
81
+ assert_nothing_raised{ @ts.application_name = "notepad.exe" }
82
+ end
83
+
84
+ def test_set_application_name_expected_errors
85
+ assert_raise(ArgumentError){ @ts.send(:application_name=) }
86
+ assert_raise(TypeError){ @ts.application_name = 1 }
87
+ end
88
+
89
+ def test_get_comment
90
+ assert_respond_to(@ts, :comment)
91
+ assert_nothing_raised{ @ts.comment }
92
+ assert_kind_of(String, @ts.comment)
93
+ end
94
+
95
+ def test_get_comment_expected_errors
96
+ assert_raise(ArgumentError){ @ts.comment('test') }
97
+ end
98
+
99
+ def test_set_comment
100
+ assert_respond_to(@ts, :comment=)
101
+ assert_nothing_raised{ @ts.comment = "test" }
102
+ end
103
+
104
+ def test_set_comment_expected_errors
105
+ assert_raise(ArgumentError){ @ts.send(:comment=) }
106
+ assert_raise(TypeError){ @ts.comment = 1 }
107
+ end
108
+
109
+ def test_get_creator
110
+ assert_respond_to(@ts, :creator)
111
+ assert_nothing_raised{ @ts.creator }
112
+ assert_kind_of(String, @ts.creator)
113
+ end
114
+
115
+ def test_get_creator_expected_errors
116
+ assert_raise(ArgumentError){ @ts.creator('foo') }
117
+ end
118
+
119
+ def test_set_creator
120
+ assert_respond_to(@ts, :creator=)
121
+ assert_nothing_raised{ @ts.creator = "Test Creator" }
122
+ end
123
+
124
+ def test_set_creator_expected_errors
125
+ assert_raise(ArgumentError){ @ts.send(:creator=) }
126
+ assert_raise(TypeError){ @ts.creator = 1 }
127
+ end
128
+
129
+ def test_delete
130
+ assert_respond_to(@ts, :delete)
131
+ assert_nothing_raised{ @ts.delete(@task) }
132
+ end
133
+
134
+ def test_delete_expected_errors
135
+ assert_raise(ArgumentError){ @ts.delete }
136
+ assert_raise(TaskScheduler::Error){ @ts.delete("foofoo") }
137
+ end
138
+
139
+ def test_delete_trigger
140
+ assert_respond_to(@ts, :delete_trigger)
141
+ assert_equal(0, @ts.delete_trigger(0))
142
+ end
143
+
144
+ # TODO: Figure out why the last two fail
145
+ def test_delete_trigger_expected_errors
146
+ assert_raise(ArgumentError){ @ts.delete }
147
+ #assert_raise(TypeError){ @ts.delete('test') }
148
+ #assert_raise(TaskScheduler::Error){ @ts.delete(-1) }
149
+ end
150
+
151
+ def test_enum
152
+ assert_respond_to(@ts, :enum)
153
+ assert_kind_of(Array, @ts.enum)
154
+ assert_nothing_raised{ @ts.enum }
155
+ end
156
+
157
+ def test_enum_expected_errors
158
+ assert_raise(ArgumentError){ @ts.enum(1) }
159
+ assert_raise(NoMethodError){ @ts.enum = true }
160
+ end
161
+
162
+ def test_exit_code
163
+ assert_respond_to(@ts, :exit_code)
164
+ assert_nothing_raised{ @ts.exit_code }
165
+ assert_kind_of(Fixnum, @ts.exit_code)
166
+ end
167
+
168
+ def test_exit_code_expected_errors
169
+ assert_raise(ArgumentError){ @ts.exit_code(true) }
170
+ assert_raise(NoMethodError){ @ts.exit_code = 1 }
171
+ end
172
+
173
+ def test_get_flags
174
+ assert_respond_to(@ts, :flags)
175
+ assert_nothing_raised{ @ts.flags }
176
+ assert_kind_of(Fixnum, @ts.flags)
177
+ end
178
+
179
+ def test_get_flags_expected_errors
180
+ assert_raise(ArgumentError){ @ts.flags(1) }
181
+ end
182
+
183
+ def test_set_flags
184
+ assert_respond_to(@ts, :flags=)
185
+ assert_nothing_raised{ @ts.flags = TaskScheduler::DELETE_WHEN_DONE }
186
+ end
187
+
188
+ def test_set_flags_expected_errors
189
+ assert_raise(ArgumentError){ @ts.send(:flags=) }
190
+ assert_raise(TypeError){ @ts.flags = 'test' }
191
+ end
192
+
193
+ # TODO: Why does setting the host fail?
194
+ def test_set_machine
195
+ assert_respond_to(@ts, :host=)
196
+ assert_respond_to(@ts, :machine=)
197
+ #assert_nothing_raised{ @ts.machine = @host }
198
+ end
199
+
200
+ def test_get_max_run_time
201
+ assert_respond_to(@ts, :max_run_time)
202
+ assert_nothing_raised{ @ts.max_run_time }
203
+ assert_kind_of(Fixnum, @ts.max_run_time)
204
+ end
205
+
206
+ def test_get_max_run_time_expected_errors
207
+ assert_raise(ArgumentError){ @ts.max_run_time(true) }
208
+ end
209
+
210
+ def test_set_max_run_time
211
+ assert_respond_to(@ts, :max_run_time=)
212
+ assert_nothing_raised{ @ts.max_run_time = 20000 }
213
+ end
214
+
215
+ def test_set_max_run_time_expected_errors
216
+ assert_raise(ArgumentError){ @ts.send(:max_run_time=) }
217
+ assert_raise(TypeError){ @ts.max_run_time = true }
218
+ end
219
+
220
+ def test_most_recent_run_time
221
+ assert_respond_to(@ts, :most_recent_run_time)
222
+ assert_nothing_raised{ @ts.most_recent_run_time }
223
+ assert_nil(@ts.most_recent_run_time)
224
+ end
225
+
226
+ def test_most_recent_run_time_expected_errors
227
+ assert_raise(ArgumentError){ @ts.most_recent_run_time(true) }
228
+ assert_raise(NoMethodError){ @ts.most_recent_run_time = Time.now }
229
+ end
230
+
231
+ def test_new_work_item
232
+ assert_respond_to(@ts, :new_work_item)
233
+ assert_nothing_raised{ @ts.new_work_item('bar', @trigger) }
234
+ end
235
+
236
+ def test_new_task_alias
237
+ assert_respond_to(@ts, :new_task)
238
+ assert_equal(true, @ts.method(:new_task) == @ts.method(:new_work_item))
239
+ end
240
+
241
+ def test_new_work_item_expected_errors
242
+ assert_raise(ArgumentError){ @ts.new_work_item }
243
+ assert_raise(ArgumentError){ @ts.new_work_item('bar') }
244
+ assert_raise(TypeError){ @ts.new_work_item(1, 'bar') }
245
+ assert_raise(TypeError){ @ts.new_work_item('bar', 1) }
246
+ end
247
+
248
+ def test_next_run_time
249
+ assert_respond_to(@ts, :next_run_time)
250
+ assert_nothing_raised{ @ts.next_run_time }
251
+ assert_kind_of(Time, @ts.next_run_time)
252
+ end
253
+
254
+ def test_next_run_time_expected_errors
255
+ assert_raise(ArgumentError){ @ts.next_run_time(true) }
256
+ assert_raise(NoMethodError){ @ts.next_run_time = Time.now }
257
+ end
258
+
259
+ def test_get_parameters
260
+ assert_respond_to(@ts, :parameters)
261
+ assert_nothing_raised{ @ts.parameters }
262
+ end
263
+
264
+ def test_get_parameters_expected_errors
265
+ assert_raise(ArgumentError){ @ts.parameters('test') }
266
+ end
267
+
268
+ def set_parameters
269
+ assert_respond_to(@ts, :parameters=)
270
+ assert_nothing_raised{ @ts.parameters = "somefile.txt" }
271
+ end
272
+
273
+ def set_parameters_expected_errors
274
+ assert_raise(ArgumentError){ @ts.send(:parameters=) }
275
+ assert_raise(TypeError){ @ts.parameters = 1 }
276
+ end
277
+
278
+ def test_get_priority
279
+ assert_respond_to(@ts, :priority)
280
+ assert_nothing_raised{ @ts.priority }
281
+ assert_kind_of(String, @ts.priority)
282
+ end
283
+
284
+ def test_get_priority_expected_errors
285
+ assert_raise(ArgumentError){ @ts.priority(true) }
286
+ end
287
+
288
+ def test_set_priority
289
+ assert_respond_to(@ts, :priority=)
290
+ assert_nothing_raised{ @ts.priority = TaskScheduler::NORMAL }
291
+ end
292
+
293
+ def test_set_priority_expected_errors
294
+ assert_raise(ArgumentError){ @ts.send(:priority=) }
295
+ assert_raise(TypeError){ @ts.priority = 'alpha' }
296
+ end
297
+
298
+ # TODO: Find a harmless way to test this.
299
+ def test_run
300
+ assert_respond_to(@ts, :run)
301
+ end
302
+
303
+ def test_run_expected_errors
304
+ assert_raise(ArgumentError){ @ts.run(true) }
305
+ assert_raise(NoMethodError){ @ts.run = true }
306
+ end
307
+
308
+ def test_save
309
+ assert_respond_to(@ts, :save)
310
+ assert_nothing_raised{ @ts.save }
311
+ end
312
+
313
+ def test_save_custom_file
314
+ assert_nothing_raised{ @ts.save(@job_file) }
315
+ assert_equal(true, File.exists?(@job_file))
316
+ end
317
+
318
+ def test_save_expected_errors
319
+ assert_raise(TypeError){ @ts.save(true) }
320
+ assert_raise(ArgumentError){ @ts.save(@job_file, true) }
321
+ assert_raise(NoMethodError){ @ts.save = true }
322
+ assert_raise(TaskScheduler::Error){ @ts.save; @ts.save }
323
+ end
324
+
325
+ def test_status
326
+ assert_respond_to(@ts, :status)
327
+ assert_nothing_raised{ @ts.status }
328
+ assert_equal('not scheduled', @ts.status)
329
+ end
330
+
331
+ def test_status_expected_errors
332
+ assert_raise(ArgumentError){ @ts.status(true) }
333
+ assert_raise(NoMethodError){ @ts.status = true }
334
+ end
335
+
336
+ def test_terminate
337
+ assert_respond_to(@ts, :terminate)
338
+ end
339
+
340
+ def test_terminate_expected_errors
341
+ assert_raise(ArgumentError){ @ts.terminate(true) }
342
+ assert_raise(NoMethodError){ @ts.terminate = true }
343
+ assert_raise(TaskScheduler::Error){ @ts.terminate } # It's not running
344
+ end
345
+
346
+ def test_get_trigger
347
+ assert_respond_to(@ts, :trigger)
348
+ assert_nothing_raised{ @ts.trigger(0) }
349
+ assert_kind_of(Hash, @ts.trigger(0))
350
+ end
351
+
352
+ def test_get_trigger_expected_errors
353
+ assert_raises(ArgumentError){ @ts.trigger }
354
+ assert_raises(TaskScheduler::Error){ @ts.trigger(9999) }
355
+ end
356
+
357
+ def test_set_trigger
358
+ assert_respond_to(@ts, :trigger=)
359
+ assert_nothing_raised{ @ts.trigger = @trigger }
360
+ end
361
+
362
+ def test_set_trigger_expected_errors
363
+ assert_raises(TypeError){ @ts.trigger = 'blah' }
364
+ end
365
+
366
+ def test_add_trigger
367
+ assert_respond_to(@ts, :add_trigger)
368
+ assert_nothing_raised{ @ts.add_trigger(0, @trigger) }
369
+ end
370
+
371
+ def test_add_trigger_expected_errors
372
+ assert_raises(ArgumentError){ @ts.add_trigger }
373
+ assert_raises(ArgumentError){ @ts.add_trigger(0) }
374
+ assert_raises(TypeError){ @ts.add_trigger(0, 'foo') }
375
+ end
376
+
377
+ def test_trigger_count
378
+ assert_respond_to(@ts, :trigger_count)
379
+ assert_nothing_raised{ @ts.trigger_count }
380
+ assert_kind_of(Fixnum, @ts.trigger_count)
381
+ end
382
+
383
+ def test_trigger_count_expected_errors
384
+ assert_raise(ArgumentError){ @ts.trigger_count(true) }
385
+ assert_raise(NoMethodError){ @ts.trigger_count = 1 }
386
+ end
387
+
388
+ def test_trigger_delete
389
+ assert_respond_to(@ts, :delete_trigger)
390
+ assert_nothing_raised{ @ts.delete_trigger(0) }
391
+ end
392
+
393
+ def test_trigger_delete_expected_errors
394
+ assert_raise(ArgumentError){ @ts.delete_trigger }
395
+ assert_raise(TaskScheduler::Error){ @ts.delete_trigger(9999) }
396
+ end
397
+
398
+ def test_trigger_string
399
+ assert_respond_to(@ts, :trigger_string)
400
+ assert_nothing_raised{ @ts.trigger_string(0) }
401
+ assert_equal('At 7:14 AM every day, starting 4/11/2009', @ts.trigger_string(0))
402
+ end
403
+
404
+ def test_trigger_string_expected_errors
405
+ assert_raise(ArgumentError){ @ts.trigger_string }
406
+ assert_raise(ArgumentError){ @ts.trigger_string(0, 0) }
407
+ assert_raise(TypeError){ @ts.trigger_string('alpha') }
408
+ assert_raise(TaskScheduler::Error){ @ts.trigger_string(9999) }
409
+ end
410
+
411
+ def test_get_working_directory
412
+ assert_respond_to(@ts, :working_directory)
413
+ assert_nothing_raised{ @ts.working_directory }
414
+ assert_kind_of(String, @ts.working_directory)
415
+ end
416
+
417
+ def test_get_working_directory_expected_errors
418
+ assert_raise(ArgumentError){ @ts.working_directory(true) }
419
+ end
420
+
421
+ def test_set_working_directory
422
+ assert_respond_to(@ts, :working_directory=)
423
+ assert_nothing_raised{ @ts.working_directory = "C:\\" }
424
+ end
425
+
426
+ def test_set_working_directory_expected_errors
427
+ assert_raise(ArgumentError){ @ts.send(:working_directory=) }
428
+ assert_raise(TypeError){ @ts.working_directory = 1 }
429
+ end
430
+
431
+ def test_constants
432
+ assert_not_nil(TaskScheduler::MONDAY)
433
+ assert_not_nil(TaskScheduler::TUESDAY)
434
+ assert_not_nil(TaskScheduler::WEDNESDAY)
435
+ assert_not_nil(TaskScheduler::THURSDAY)
436
+ assert_not_nil(TaskScheduler::FRIDAY)
437
+ assert_not_nil(TaskScheduler::SATURDAY)
438
+ assert_not_nil(TaskScheduler::SUNDAY)
439
+
440
+ assert_not_nil(TaskScheduler::JANUARY)
441
+ assert_not_nil(TaskScheduler::FEBRUARY)
442
+ assert_not_nil(TaskScheduler::MARCH)
443
+ assert_not_nil(TaskScheduler::APRIL)
444
+ assert_not_nil(TaskScheduler::MAY)
445
+ assert_not_nil(TaskScheduler::JUNE)
446
+ assert_not_nil(TaskScheduler::JULY)
447
+ assert_not_nil(TaskScheduler::AUGUST)
448
+ assert_not_nil(TaskScheduler::SEPTEMBER)
449
+ assert_not_nil(TaskScheduler::OCTOBER)
450
+ assert_not_nil(TaskScheduler::NOVEMBER)
451
+ assert_not_nil(TaskScheduler::DECEMBER)
452
+
453
+ assert_not_nil(TaskScheduler::ONCE)
454
+ assert_not_nil(TaskScheduler::DAILY)
455
+ assert_not_nil(TaskScheduler::WEEKLY)
456
+ assert_not_nil(TaskScheduler::MONTHLYDATE)
457
+ assert_not_nil(TaskScheduler::MONTHLYDOW)
458
+
459
+ assert_not_nil(TaskScheduler::ON_IDLE)
460
+ assert_not_nil(TaskScheduler::AT_SYSTEMSTART)
461
+ assert_not_nil(TaskScheduler::AT_LOGON)
462
+
463
+ assert_not_nil(TaskScheduler::INTERACTIVE)
464
+ assert_not_nil(TaskScheduler::DELETE_WHEN_DONE)
465
+ assert_not_nil(TaskScheduler::DISABLED)
466
+ assert_not_nil(TaskScheduler::START_ONLY_IF_IDLE)
467
+ assert_not_nil(TaskScheduler::KILL_ON_IDLE_END)
468
+ assert_not_nil(TaskScheduler::DONT_START_IF_ON_BATTERIES)
469
+ assert_not_nil(TaskScheduler::KILL_IF_GOING_ON_BATTERIES)
470
+ assert_not_nil(TaskScheduler::HIDDEN)
471
+ assert_not_nil(TaskScheduler::RESTART_ON_IDLE_RESUME)
472
+ assert_not_nil(TaskScheduler::SYSTEM_REQUIRED)
473
+ assert_not_nil(TaskScheduler::FLAG_HAS_END_DATE)
474
+ assert_not_nil(TaskScheduler::FLAG_KILL_AT_DURATION_END)
475
+ assert_not_nil(TaskScheduler::FLAG_DISABLED)
476
+ assert_not_nil(TaskScheduler::MAX_RUN_TIMES)
477
+
478
+ assert_not_nil(TaskScheduler::IDLE)
479
+ assert_not_nil(TaskScheduler::NORMAL)
480
+ assert_not_nil(TaskScheduler::HIGH)
481
+ assert_not_nil(TaskScheduler::REALTIME)
482
+ assert_not_nil(TaskScheduler::ABOVE_NORMAL)
483
+ assert_not_nil(TaskScheduler::BELOW_NORMAL)
484
+ end
485
+
486
+ def teardown
487
+ File.delete(@job_file) if File.exists?(@job_file)
488
+ @ts.delete('foo') rescue nil
489
+ @ts = nil
490
+ @trigger = nil
491
+ @host = nil
492
+ @job_file = nil
493
+ end
494
+ end