win32-eventlog 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/misc/rubymsg.mc CHANGED
@@ -1,35 +1,35 @@
1
- MessageId=0x1
2
- SymbolicName=CATEGORY_ERROR
3
- Language=English
4
- Error
5
- .
6
-
7
- MessageId=0x2
8
- SymbolicName=CATEGORY_WARNING
9
- Language=English
10
- Warning
11
- .
12
-
13
- MessageId=0x3
14
- SymbolicName=CATEGORY_OUTPUT
15
- Language=English
16
- Output
17
- .
18
-
19
- MessageId=0x4
20
- SymbolicName=RUBY_ERROR
21
- Language=English
22
- Ruby error: %1
23
- .
24
-
25
- MessageId=0x5
26
- SymbolicName=RUBY_WARNING
27
- Language=English
28
- Ruby warning: %1
29
- .
30
-
31
- MessageId=0x6
32
- SymbolicName=RUBY_OUTPUT
33
- Language=English
34
- Ruby output: %1
35
- .
1
+ MessageId=0x1
2
+ SymbolicName=CATEGORY_ERROR
3
+ Language=English
4
+ Error
5
+ .
6
+
7
+ MessageId=0x2
8
+ SymbolicName=CATEGORY_WARNING
9
+ Language=English
10
+ Warning
11
+ .
12
+
13
+ MessageId=0x3
14
+ SymbolicName=CATEGORY_OUTPUT
15
+ Language=English
16
+ Output
17
+ .
18
+
19
+ MessageId=0x4
20
+ SymbolicName=RUBY_ERROR
21
+ Language=English
22
+ Ruby error: %1
23
+ .
24
+
25
+ MessageId=0x5
26
+ SymbolicName=RUBY_WARNING
27
+ Language=English
28
+ Ruby warning: %1
29
+ .
30
+
31
+ MessageId=0x6
32
+ SymbolicName=RUBY_OUTPUT
33
+ Language=English
34
+ Ruby output: %1
35
+ .
data/test/foo.mc CHANGED
@@ -1,24 +1,24 @@
1
- MessageId=0x1
2
- SymbolicName=CATEGORY_HELLO
3
- Language=English
4
- Foohello
5
- .
6
-
7
- MessageId=0x2
8
- SymbolicName=CATEGORY_WORLD
9
- Language=English
10
- Fooworld
11
- .
12
-
13
- MessageId=0x3
14
- SymbolicName=FOO_ERROR
15
- Language=English
16
- Foo error: %1
17
- .
18
-
19
- MessageId=0x4
20
- SymbolicName=FOO_WARN
21
- Language=English
22
- Foo warning: %1
23
- .
24
-
1
+ MessageId=0x1
2
+ SymbolicName=CATEGORY_HELLO
3
+ Language=English
4
+ Foohello
5
+ .
6
+
7
+ MessageId=0x2
8
+ SymbolicName=CATEGORY_WORLD
9
+ Language=English
10
+ Fooworld
11
+ .
12
+
13
+ MessageId=0x3
14
+ SymbolicName=FOO_ERROR
15
+ Language=English
16
+ Foo error: %1
17
+ .
18
+
19
+ MessageId=0x4
20
+ SymbolicName=FOO_WARN
21
+ Language=English
22
+ Foo warning: %1
23
+ .
24
+
@@ -1,319 +1,310 @@
1
- ##############################################################################
2
- # test_eventlog.rb
3
- #
4
- # Test case for the win32-eventlog package. You should run this test case
5
- # via the 'rake test' Rakefile task. This test will take a minute or two
6
- # to complete.
7
- #############################################################################
8
- require 'rubygems'
9
- gem 'test-unit'
10
-
11
- require 'test/unit'
12
- require 'win32/eventlog'
13
- require 'socket'
14
- require 'tmpdir'
15
- include Win32
16
-
17
- class TC_Win32_EventLog < Test::Unit::TestCase
18
- def self.startup
19
- @@hostname = Socket.gethostname
20
- end
21
-
22
- def setup
23
- @log = EventLog.new('Application')
24
- @logfile = 'temp.evt'
25
- @bakfile = File.join(Dir.tmpdir, 'test_event_log.bak')
26
- @records = []
27
- @last = nil
28
- end
29
-
30
- def test_version
31
- assert_equal('0.5.3', EventLog::VERSION)
32
- end
33
-
34
- test "constructor basic functionality" do
35
- assert_respond_to(EventLog, :new)
36
- assert_nothing_raised{ EventLog.new }
37
- end
38
-
39
- test "constructor accepts a block" do
40
- assert_nothing_raised{ EventLog.new{ |log| } }
41
- end
42
-
43
- test "constructor accepts a log type" do
44
- assert_nothing_raised{ EventLog.new('System') }
45
- end
46
-
47
- test "constructor accepts a host name" do
48
- assert_nothing_raised{ EventLog.new('System', @@hostname) }
49
- end
50
-
51
- test "open is a singleton alias for new" do
52
- assert_alias_method(EventLog, :new, :open)
53
- end
54
-
55
- test "constructor accepts a maximum of two arguments" do
56
- assert_raises(EventLog::Error){ EventLog.new('System', @@hostname, 'foo') }
57
- end
58
-
59
- test "arguments to constructor must be strings" do
60
- assert_raises(TypeError){ EventLog.open(1) }
61
- assert_raises(TypeError){ EventLog.open('System', 1) }
62
- end
63
-
64
- test "source accessor method basic functionality" do
65
- @log = EventLog.new('Application', @@hostname)
66
- assert_respond_to(@log, :source)
67
- assert_equal('Application', @log.source)
68
- end
69
-
70
- test "server accessor method basic functionality" do
71
- @log = EventLog.new('Application', @@hostname)
72
- assert_respond_to(@log, :server)
73
- assert_equal(@@hostname, @log.server)
74
- end
75
-
76
- test "backup basic functionality" do
77
- assert_respond_to(@log, :backup)
78
- assert_nothing_raised{ @log.backup(@bakfile) }
79
- end
80
-
81
- test "backup works as expected" do
82
- assert_nothing_raised{ @log.backup(@bakfile) }
83
- assert(File.exists?(@bakfile))
84
- end
85
-
86
- test "backup method fails if backup file already exists" do
87
- assert_nothing_raised{ @log.backup(@bakfile) }
88
- assert_raise(EventLog::Error){ @log.backup(@bakfile) }
89
- end
90
-
91
- test "open_backup basic functionality" do
92
- assert_respond_to(EventLog, :open_backup)
93
- end
94
-
95
- test "open_backup works as expected" do
96
- EventLog.new('Application', @@hostname) do |log|
97
- log.backup(@bakfile)
98
- end
99
-
100
- assert_nothing_raised{ @log = EventLog.open_backup(@bakfile) }
101
- assert_kind_of(EventLog, @log)
102
- end
103
-
104
- test "it is possible to read and close the backup log file" do
105
- EventLog.new('Application', @@hostname) do |log|
106
- log.backup(@bakfile)
107
- end
108
-
109
- @log = EventLog.open_backup(@bakfile)
110
- assert_nothing_raised{ @log.read{ break } }
111
- assert_nothing_raised{ @log.close }
112
- end
113
-
114
- # Ensure that an Array is returned in non-block form and that none of the
115
- # descriptions are nil.
116
- #
117
- # The test for descriptions was added as a result of ruby-talk:116528.
118
- # Thanks go to Joey Gibson for the spot. The test for unique record
119
- # numbers was added to ensure no dups.
120
- #
121
- test "singleton read method works as expected" do
122
- assert_nothing_raised{ @array = EventLog.read }
123
- assert_kind_of(Array, @array)
124
-
125
- record_numbers = []
126
- @array.each{ |log|
127
- assert_not_nil(log.description)
128
- assert_equal(false, record_numbers.include?(log.record_number))
129
- record_numbers << log.record_number
130
- }
131
- end
132
-
133
- # I've added explicit breaks because an event log could be rather large.
134
- #
135
- test "singleton read method does not require any arguments" do
136
- assert_nothing_raised{ EventLog.read{ break } }
137
- end
138
-
139
- test "singleton read method accepts a log type" do
140
- assert_nothing_raised{ EventLog.read("Application"){ break } }
141
- end
142
-
143
- test "singleton read method accepts a server argument" do
144
- assert_nothing_raised{ EventLog.read("Application", nil){ break } }
145
- end
146
-
147
- test "singleton read method accepts a flags argument" do
148
- assert_nothing_raised{ EventLog.read("Application", nil, nil){ break } }
149
- end
150
-
151
- test "singleton read method accepts an offset argument" do
152
- assert_nothing_raised{ EventLog.read("Application", nil, nil, 10){ break } }
153
- end
154
-
155
- test "singleton read method accepts a maximum of four arguments" do
156
- assert_raises(ArgumentError){
157
- EventLog.read("Application", nil, nil, nil, nil){}
158
- }
159
- end
160
-
161
- test "instance method read basic functionality" do
162
- assert_respond_to(@log, :read)
163
- assert_nothing_raised{ @log.read{ break } }
164
- end
165
-
166
- test "instance method read accepts flags" do
167
- flags = EventLog::FORWARDS_READ | EventLog::SEQUENTIAL_READ
168
- assert_nothing_raised{ @log.read(flags){ break } }
169
- end
170
-
171
- test "instance method read accepts an offset" do
172
- assert_nothing_raised{ @log.read(nil, 500){ break } }
173
- end
174
-
175
- test "instance method read accepts a maximum of two arguments" do
176
- assert_raises(ArgumentError){ @log.read(nil, 500, 'foo') }
177
- end
178
-
179
- test "seek_read flag plus forwards_read flag works as expected" do
180
- flags = EventLog::SEEK_READ | EventLog::FORWARDS_READ
181
- assert_nothing_raised{ @last = @log.read[-10].record_number }
182
- assert_nothing_raised{
183
- @records = EventLog.read(nil, nil, flags, @last)
184
- }
185
- assert_equal(10, @records.length)
186
- end
187
-
188
- # This test could fail, since a record number + 10 may not actually exist.
189
- test "seek_read flag plus backwards_read flag works as expected" do
190
- flags = EventLog::SEEK_READ | EventLog::BACKWARDS_READ
191
- assert_nothing_raised{ @last = @log.oldest_record_number + 10 }
192
- assert_nothing_raised{ @records = EventLog.read(nil, nil, flags, @last) }
193
- assert_equal(11, @records.length)
194
- end
195
-
196
- test "the eventlog struct returned by read is frozen" do
197
- EventLog.read{ |log| @entry = log; break }
198
- assert_true(@entry.frozen?)
199
- end
200
-
201
- test "server method basic functionality" do
202
- assert_respond_to(@log, :server)
203
- assert_nothing_raised{ @log.server }
204
- assert_nil(@log.server)
205
- end
206
-
207
- test "server method is readonly" do
208
- assert_raises(NoMethodError){ @log.server = 'foo' }
209
- end
210
-
211
- test "source method basic functionality" do
212
- assert_respond_to(@log, :source)
213
- assert_nothing_raised{ @log.source }
214
- assert_kind_of(String, @log.source)
215
- end
216
-
217
- test "source method is readonly" do
218
- assert_raises(NoMethodError){ @log.source = 'foo' }
219
- end
220
-
221
- test "file method basic functionality" do
222
- assert_respond_to(@log, :file)
223
- assert_nothing_raised{ @log.file }
224
- assert_nil(@log.file)
225
- end
226
-
227
- test "file method is readonly" do
228
- assert_raises(NoMethodError){ @log.file = 'foo' }
229
- end
230
-
231
- # Since I don't want to actually clear anyone's event log, I can't really
232
- # verify that it works.
233
- test "clear method basic functionality" do
234
- assert_respond_to(@log, :clear)
235
- end
236
-
237
- test "full method basic functionality" do
238
- assert_respond_to(@log, :full?)
239
- assert_nothing_raised{ @log.full? }
240
- end
241
-
242
- test "full method returns a boolean" do
243
- assert_boolean(@log.full?)
244
- end
245
-
246
- test "close method basic functionality" do
247
- assert_respond_to(@log, :close)
248
- assert_nothing_raised{ @log.close }
249
- end
250
-
251
- test "oldest_record_number basic functionality" do
252
- assert_respond_to(@log, :oldest_record_number)
253
- assert_nothing_raised{ @log.oldest_record_number }
254
- assert_kind_of(Fixnum, @log.oldest_record_number)
255
- end
256
-
257
- test "total_records basic functionality" do
258
- assert_respond_to(@log, :total_records)
259
- assert_nothing_raised{ @log.total_records }
260
- assert_kind_of(Fixnum, @log.total_records)
261
- end
262
-
263
- # We can't test that this method actually executes properly since it goes
264
- # into an endless loop.
265
- #
266
- test "tail basic functionality" do
267
- assert_respond_to(@log, :tail)
268
- assert_raises(EventLog::Error){ @log.tail }
269
- end
270
-
271
- # We can't test that this method actually executes properly since it goes
272
- # into an endless loop.
273
- #
274
- test "notify_change basic functionality" do
275
- assert_respond_to(@log, :notify_change)
276
- assert_raises(EventLog::Error){ @log.notify_change }
277
- end
278
-
279
- # I can't really do more in depth testing for this method since there
280
- # isn't an event source I can reliably and safely write to.
281
- #
282
- test "report_event basic functionality" do
283
- assert_respond_to(@log, :report_event)
284
- assert_raises(ArgumentError){ @log.report_event }
285
- end
286
-
287
- test "write is an alias for report_event" do
288
- assert_respond_to(@log, :write)
289
- assert_alias_method(@log, :write, :report_event)
290
- end
291
-
292
- test "read event constants" do
293
- assert_not_nil(EventLog::FORWARDS_READ)
294
- assert_not_nil(EventLog::BACKWARDS_READ)
295
- assert_not_nil(EventLog::SEEK_READ)
296
- assert_not_nil(EventLog::SEQUENTIAL_READ)
297
- end
298
-
299
- test "event type constants" do
300
- assert_not_nil(EventLog::SUCCESS)
301
- assert_not_nil(EventLog::ERROR)
302
- assert_not_nil(EventLog::WARN)
303
- assert_not_nil(EventLog::INFO)
304
- assert_not_nil(EventLog::AUDIT_SUCCESS)
305
- assert_not_nil(EventLog::AUDIT_FAILURE)
306
- end
307
-
308
- def teardown
309
- @log.close rescue nil
310
- File.delete(@bakfile) if File.exists?(@bakfile)
311
- @logfile = nil
312
- @records = nil
313
- @last = nil
314
- end
315
-
316
- def self.shutdown
317
- @@hostname = nil
318
- end
319
- end
1
+ ##############################################################################
2
+ # test_eventlog.rb
3
+ #
4
+ # Test case for the win32-eventlog package. You should run this test case
5
+ # via the 'rake test' Rakefile task. This test will take a minute or two
6
+ # to complete.
7
+ #############################################################################
8
+ require 'test-unit'
9
+ require 'win32/eventlog'
10
+ require 'socket'
11
+ require 'tmpdir'
12
+ include Win32
13
+
14
+ class TC_Win32_EventLog < Test::Unit::TestCase
15
+ def self.startup
16
+ @@hostname = Socket.gethostname
17
+ end
18
+
19
+ def setup
20
+ @log = EventLog.new('Application')
21
+ @logfile = 'temp.evt'
22
+ @bakfile = File.join(Dir.tmpdir, 'test_event_log.bak')
23
+ @records = []
24
+ @last = nil
25
+ end
26
+
27
+ test "version constant is set to expected value" do
28
+ assert_equal('0.6.0', EventLog::VERSION)
29
+ end
30
+
31
+ test "constructor basic functionality" do
32
+ assert_respond_to(EventLog, :new)
33
+ assert_nothing_raised{ EventLog.new }
34
+ end
35
+
36
+ test "constructor accepts a block" do
37
+ assert_nothing_raised{ EventLog.new{ |log| } }
38
+ end
39
+
40
+ test "constructor accepts a log type" do
41
+ assert_nothing_raised{ EventLog.new('System') }
42
+ end
43
+
44
+ test "constructor accepts a host name" do
45
+ assert_nothing_raised{ EventLog.new('System', @@hostname) }
46
+ end
47
+
48
+ #test "open is a singleton alias for new" do
49
+ # assert_alias_method(EventLog, :new, :open)
50
+ #end
51
+
52
+ test "constructor accepts a maximum of three arguments" do
53
+ assert_raises(ArgumentError){ EventLog.new('System', @@hostname, 'foo', 'bar') }
54
+ end
55
+
56
+ test "arguments to constructor must be strings" do
57
+ assert_raises(TypeError){ EventLog.open(1) }
58
+ assert_raises(TypeError){ EventLog.open('System', 1) }
59
+ end
60
+
61
+ test "source accessor method basic functionality" do
62
+ @log = EventLog.new('Application', @@hostname)
63
+ assert_respond_to(@log, :source)
64
+ assert_equal('Application', @log.source)
65
+ end
66
+
67
+ test "server accessor method basic functionality" do
68
+ @log = EventLog.new('Application', @@hostname)
69
+ assert_respond_to(@log, :server)
70
+ assert_equal(@@hostname, @log.server)
71
+ end
72
+
73
+ test "backup basic functionality" do
74
+ assert_respond_to(@log, :backup)
75
+ assert_nothing_raised{ @log.backup(@bakfile) }
76
+ end
77
+
78
+ test "backup works as expected" do
79
+ assert_nothing_raised{ @log.backup(@bakfile) }
80
+ assert(File.exists?(@bakfile))
81
+ end
82
+
83
+ test "backup method fails if backup file already exists" do
84
+ assert_nothing_raised{ @log.backup(@bakfile) }
85
+ assert_raise(SystemCallError){ @log.backup(@bakfile) }
86
+ end
87
+
88
+ test "open_backup basic functionality" do
89
+ assert_respond_to(EventLog, :open_backup)
90
+ end
91
+
92
+ test "open_backup works as expected" do
93
+ EventLog.new('Application', @@hostname){ |log| log.backup(@bakfile) }
94
+ assert_nothing_raised{ @log = EventLog.open_backup(@bakfile) }
95
+ assert_kind_of(EventLog, @log)
96
+ end
97
+
98
+ test "it is possible to read and close the backup log file" do
99
+ EventLog.new('Application', @@hostname){ |log| log.backup(@bakfile) }
100
+ @log = EventLog.open_backup(@bakfile)
101
+ assert_nothing_raised{ @log.read{ break } }
102
+ assert_nothing_raised{ @log.close }
103
+ end
104
+
105
+ # Ensure that an Array is returned in non-block form and that none of the
106
+ # descriptions are nil.
107
+ #
108
+ # The test for descriptions was added as a result of ruby-talk:116528.
109
+ # Thanks go to Joey Gibson for the spot. The test for unique record
110
+ # numbers was added to ensure no dups.
111
+ #
112
+ test "singleton read method works as expected" do
113
+ assert_nothing_raised{ @array = EventLog.read }
114
+ assert_kind_of(Array, @array)
115
+
116
+ record_numbers = []
117
+ @array.each{ |log|
118
+ assert_not_nil(log.description)
119
+ assert_equal(false, record_numbers.include?(log.record_number))
120
+ record_numbers << log.record_number
121
+ }
122
+ end
123
+
124
+ # I've added explicit breaks because an event log could be rather large.
125
+ #
126
+ test "singleton read method does not require any arguments" do
127
+ assert_nothing_raised{ EventLog.read{ break } }
128
+ end
129
+
130
+ test "singleton read method accepts a log type" do
131
+ assert_nothing_raised{ EventLog.read("Application"){ break } }
132
+ end
133
+
134
+ test "singleton read method accepts a server argument" do
135
+ assert_nothing_raised{ EventLog.read("Application", nil){ break } }
136
+ end
137
+
138
+ test "singleton read method accepts a flags argument" do
139
+ assert_nothing_raised{ EventLog.read("Application", nil, nil){ break } }
140
+ end
141
+
142
+ test "singleton read method accepts an offset argument" do
143
+ assert_nothing_raised{ EventLog.read("Application", nil, nil, 10){ break } }
144
+ end
145
+
146
+ test "singleton read method accepts a maximum of four arguments" do
147
+ assert_raises(ArgumentError){
148
+ EventLog.read("Application", nil, nil, nil, nil){}
149
+ }
150
+ end
151
+
152
+ test "instance method read basic functionality" do
153
+ assert_respond_to(@log, :read)
154
+ assert_nothing_raised{ @log.read{ break } }
155
+ end
156
+
157
+ test "instance method read accepts flags" do
158
+ flags = EventLog::FORWARDS_READ | EventLog::SEQUENTIAL_READ
159
+ assert_nothing_raised{ @log.read(flags){ break } }
160
+ end
161
+
162
+ test "instance method read accepts an offset" do
163
+ assert_nothing_raised{ @log.read(nil, 500){ break } }
164
+ end
165
+
166
+ test "instance method read accepts a maximum of two arguments" do
167
+ assert_raises(ArgumentError){ @log.read(nil, 500, 'foo') }
168
+ end
169
+
170
+ test "seek_read flag plus forwards_read flag works as expected" do
171
+ flags = EventLog::SEEK_READ | EventLog::FORWARDS_READ
172
+ assert_nothing_raised{ @last = @log.read[-10].record_number }
173
+ assert_nothing_raised{
174
+ @records = EventLog.read(nil, nil, flags, @last)
175
+ }
176
+ assert_equal(10, @records.length)
177
+ end
178
+
179
+ # This test could fail, since a record number + 10 may not actually exist.
180
+ test "seek_read flag plus backwards_read flag works as expected" do
181
+ flags = EventLog::SEEK_READ | EventLog::BACKWARDS_READ
182
+ assert_nothing_raised{ @last = @log.oldest_record_number + 10 }
183
+ assert_nothing_raised{ @records = EventLog.read(nil, nil, flags, @last) }
184
+ assert_equal(11, @records.length)
185
+ end
186
+
187
+ test "the eventlog struct returned by read is frozen" do
188
+ EventLog.read{ |log| @entry = log; break }
189
+ assert_true(@entry.frozen?)
190
+ end
191
+
192
+ test "server method basic functionality" do
193
+ assert_respond_to(@log, :server)
194
+ assert_nothing_raised{ @log.server }
195
+ assert_nil(@log.server)
196
+ end
197
+
198
+ test "server method is readonly" do
199
+ assert_raises(NoMethodError){ @log.server = 'foo' }
200
+ end
201
+
202
+ test "source method basic functionality" do
203
+ assert_respond_to(@log, :source)
204
+ assert_nothing_raised{ @log.source }
205
+ assert_kind_of(String, @log.source)
206
+ end
207
+
208
+ test "source method is readonly" do
209
+ assert_raises(NoMethodError){ @log.source = 'foo' }
210
+ end
211
+
212
+ test "file method basic functionality" do
213
+ assert_respond_to(@log, :file)
214
+ assert_nothing_raised{ @log.file }
215
+ assert_nil(@log.file)
216
+ end
217
+
218
+ test "file method is readonly" do
219
+ assert_raises(NoMethodError){ @log.file = 'foo' }
220
+ end
221
+
222
+ # Since I don't want to actually clear anyone's event log, I can't really
223
+ # verify that it works.
224
+ test "clear method basic functionality" do
225
+ assert_respond_to(@log, :clear)
226
+ end
227
+
228
+ test "full method basic functionality" do
229
+ assert_respond_to(@log, :full?)
230
+ assert_nothing_raised{ @log.full? }
231
+ end
232
+
233
+ test "full method returns a boolean" do
234
+ assert_boolean(@log.full?)
235
+ end
236
+
237
+ test "close method basic functionality" do
238
+ assert_respond_to(@log, :close)
239
+ assert_nothing_raised{ @log.close }
240
+ end
241
+
242
+ test "oldest_record_number basic functionality" do
243
+ assert_respond_to(@log, :oldest_record_number)
244
+ assert_nothing_raised{ @log.oldest_record_number }
245
+ assert_kind_of(Fixnum, @log.oldest_record_number)
246
+ end
247
+
248
+ test "total_records basic functionality" do
249
+ assert_respond_to(@log, :total_records)
250
+ assert_nothing_raised{ @log.total_records }
251
+ assert_kind_of(Fixnum, @log.total_records)
252
+ end
253
+
254
+ # We can't test that this method actually executes properly since it goes
255
+ # into an endless loop.
256
+ #
257
+ test "tail basic functionality" do
258
+ assert_respond_to(@log, :tail)
259
+ assert_raises(ArgumentError){ @log.tail }
260
+ end
261
+
262
+ # We can't test that this method actually executes properly since it goes
263
+ # into an endless loop.
264
+ #
265
+ test "notify_change basic functionality" do
266
+ assert_respond_to(@log, :notify_change)
267
+ assert_raises(ArgumentError){ @log.notify_change }
268
+ end
269
+
270
+ # I can't really do more in depth testing for this method since there
271
+ # isn't an event source I can reliably and safely write to.
272
+ #
273
+ test "report_event basic functionality" do
274
+ assert_respond_to(@log, :report_event)
275
+ assert_raises(ArgumentError){ @log.report_event }
276
+ end
277
+
278
+ test "write is an alias for report_event" do
279
+ assert_respond_to(@log, :write)
280
+ assert_alias_method(@log, :write, :report_event)
281
+ end
282
+
283
+ test "read event constants" do
284
+ assert_not_nil(EventLog::FORWARDS_READ)
285
+ assert_not_nil(EventLog::BACKWARDS_READ)
286
+ assert_not_nil(EventLog::SEEK_READ)
287
+ assert_not_nil(EventLog::SEQUENTIAL_READ)
288
+ end
289
+
290
+ test "event type constants" do
291
+ assert_not_nil(EventLog::SUCCESS)
292
+ assert_not_nil(EventLog::ERROR_TYPE)
293
+ assert_not_nil(EventLog::WARN_TYPE)
294
+ assert_not_nil(EventLog::INFO_TYPE)
295
+ assert_not_nil(EventLog::AUDIT_SUCCESS)
296
+ assert_not_nil(EventLog::AUDIT_FAILURE)
297
+ end
298
+
299
+ def teardown
300
+ @log.close rescue nil
301
+ File.delete(@bakfile) if File.exists?(@bakfile)
302
+ @logfile = nil
303
+ @records = nil
304
+ @last = nil
305
+ end
306
+
307
+ def self.shutdown
308
+ @@hostname = nil
309
+ end
310
+ end