win32-service 0.6.1-x86-mswin32-60
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/CHANGES +217 -0
- data/MANIFEST +18 -0
- data/README +44 -0
- data/doc/daemon.txt +155 -0
- data/doc/service.txt +365 -0
- data/lib/win32/daemon.so +0 -0
- data/lib/win32/service.rb +1579 -0
- data/test/tc_daemon.rb +55 -0
- data/test/tc_service.rb +260 -0
- data/test/tc_service_create.rb +83 -0
- data/test/tc_service_info.rb +170 -0
- data/test/tc_service_status.rb +108 -0
- metadata +80 -0
data/test/tc_daemon.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#########################################################################
|
2
|
+
# tc_daemon.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Win32::Daemon class. You should run this test via
|
5
|
+
# the 'rake test' or 'rake test_daemon' tasks.
|
6
|
+
#
|
7
|
+
# These tests are rather limited, since the acid test is to install
|
8
|
+
# your daemon as a service and see how it behaves.
|
9
|
+
#########################################################################
|
10
|
+
require 'win32/daemon'
|
11
|
+
require 'test/unit'
|
12
|
+
include Win32
|
13
|
+
|
14
|
+
class TC_Daemon < Test::Unit::TestCase
|
15
|
+
def setup
|
16
|
+
@daemon = Daemon.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_version
|
20
|
+
assert_equal('0.6.1', Daemon::VERSION)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_constructor
|
24
|
+
assert_respond_to(Daemon, :new)
|
25
|
+
assert_nothing_raised{ Daemon.new }
|
26
|
+
assert_raises(ArgumentError){ Daemon.new(1) } # No arguments by default
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_mainloop
|
30
|
+
assert_respond_to(@daemon, :mainloop)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_state
|
34
|
+
assert_respond_to(@daemon, :state)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_running
|
38
|
+
assert_respond_to(@daemon, :running?)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_constants
|
42
|
+
assert_not_nil(Daemon::CONTINUE_PENDING)
|
43
|
+
assert_not_nil(Daemon::PAUSE_PENDING)
|
44
|
+
assert_not_nil(Daemon::PAUSED)
|
45
|
+
assert_not_nil(Daemon::RUNNING)
|
46
|
+
assert_not_nil(Daemon::START_PENDING)
|
47
|
+
assert_not_nil(Daemon::STOP_PENDING)
|
48
|
+
assert_not_nil(Daemon::STOPPED)
|
49
|
+
assert_not_nil(Daemon::IDLE)
|
50
|
+
end
|
51
|
+
|
52
|
+
def teardown
|
53
|
+
@daemon = nil
|
54
|
+
end
|
55
|
+
end
|
data/test/tc_service.rb
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
##########################################################################
|
2
|
+
# tc_service.rb
|
3
|
+
#
|
4
|
+
# Test case for the Win32::Service class.
|
5
|
+
##########################################################################
|
6
|
+
require 'win32/service'
|
7
|
+
require 'socket'
|
8
|
+
require 'test/unit'
|
9
|
+
|
10
|
+
class TC_Win32_Service < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@display_name = "Task Scheduler"
|
13
|
+
@service_name = "Schedule"
|
14
|
+
@service_stat = nil
|
15
|
+
@services = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def wait_for_status(status)
|
19
|
+
sleep 0.1 while Win32::Service.status(@service_name).current_state != status
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_version
|
23
|
+
assert_equal('0.6.1', Win32::Service::VERSION)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_service_configure
|
27
|
+
assert_respond_to(Win32::Service, :configure)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_service_configure_expected_errors
|
31
|
+
assert_raise(ArgumentError){ Win32::Service.configure }
|
32
|
+
assert_raise(ArgumentError){ Win32::Service.configure('bogus') }
|
33
|
+
assert_raise(ArgumentError){ Win32::Service.configure('bogus', 'bogus') }
|
34
|
+
assert_raise(Win32::Service::Error){ Win32::Service.configure('x', nil, :description => 'Test') }
|
35
|
+
assert_raise(Win32::Service::Error){ Win32::Service.configure('x', 'y', :description => 'Test') }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_services_basic
|
39
|
+
assert_respond_to(Win32::Service, :services)
|
40
|
+
assert_nothing_raised{ Win32::Service.services }
|
41
|
+
assert_nothing_raised{ Win32::Service.services(nil) }
|
42
|
+
assert_nothing_raised{ Win32::Service.services(nil, 'network') }
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_services_non_block_form
|
46
|
+
assert_nothing_raised{ @services = Win32::Service.services }
|
47
|
+
assert_kind_of(Array, @services)
|
48
|
+
assert_kind_of(Struct::ServiceInfo, @services[0])
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_services_block_form
|
52
|
+
assert_nothing_raised{ Win32::Service.services{ |s| @services << s } }
|
53
|
+
assert_kind_of(Array, @services)
|
54
|
+
assert_kind_of(Struct::ServiceInfo, @services[0])
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_services_expected_errors
|
58
|
+
assert_raise(TypeError){ Win32::Service.services(1) }
|
59
|
+
assert_raise(TypeError){ Win32::Service.services(nil, 1) }
|
60
|
+
assert_raise(ArgumentError){ Win32::Service.services(nil, 'network', 1) }
|
61
|
+
assert_raise(Win32::Service::Error){ Win32::Service.services('bogus') }
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_delete
|
65
|
+
assert_respond_to(Win32::Service, :delete)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_delete_expected_errors
|
69
|
+
assert_raise(ArgumentError){ Win32::Service.delete }
|
70
|
+
assert_raise(Win32::Service::Error){ Win32::Service.delete('bogus') }
|
71
|
+
assert_raise(Win32::Service::Error){ Win32::Service.delete('bogus', 'bogus') }
|
72
|
+
assert_raise(ArgumentError){ Win32::Service.delete('x', 'y', 'z') }
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_service_pause_and_resume
|
76
|
+
assert_respond_to(Win32::Service, :pause)
|
77
|
+
assert_respond_to(Win32::Service, :resume)
|
78
|
+
assert_nothing_raised{ Win32::Service.pause(@service_name) }
|
79
|
+
assert_nothing_raised{ wait_for_status('paused') }
|
80
|
+
assert_nothing_raised{ Win32::Service.pause(@service_name) }
|
81
|
+
assert_nothing_raised{ Win32::Service.resume(@service_name) }
|
82
|
+
assert_nothing_raised{ wait_for_status('running') }
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_pause_expected_errors
|
86
|
+
assert_raise(ArgumentError){ Win32::Service.pause }
|
87
|
+
assert_raise(Win32::Service::Error){ Win32::Service.pause('bogus') }
|
88
|
+
assert_raise(Win32::Service::Error){ Win32::Service.pause('bogus', 'bogus') }
|
89
|
+
assert_raise(ArgumentError){ Win32::Service.pause('x', 'y', 'z') }
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_resume_expected_errors
|
93
|
+
assert_raise(ArgumentError){ Win32::Service.resume }
|
94
|
+
assert_raise(Win32::Service::Error){ Win32::Service.resume('bogus') }
|
95
|
+
assert_raise(Win32::Service::Error){ Win32::Service.resume('bogus', 'bogus') }
|
96
|
+
assert_raise(ArgumentError){ Win32::Service.resume('bogus', 'bogus', 'a') }
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_service_stop_and_start
|
100
|
+
assert_respond_to(Win32::Service, :stop)
|
101
|
+
assert_respond_to(Win32::Service, :start)
|
102
|
+
assert_nothing_raised{ Win32::Service.stop(@service_name) }
|
103
|
+
assert_nothing_raised{ wait_for_status('stopped') }
|
104
|
+
assert_raise(Win32::Service::Error){ Win32::Service.stop(@service_name) }
|
105
|
+
assert_nothing_raised{ Win32::Service.start(@service_name) }
|
106
|
+
assert_nothing_raised{ wait_for_status('running') }
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_stop_expected_errors
|
110
|
+
assert_raise(ArgumentError){ Win32::Service.stop }
|
111
|
+
assert_raise(Win32::Service::Error){ Win32::Service.stop('bogus') }
|
112
|
+
assert_raise(Win32::Service::Error){ Win32::Service.stop('bogus', 'bogus') }
|
113
|
+
assert_raise(ArgumentError){ Win32::Service.stop('x', 'y', 'z') }
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_start_expected_errors
|
117
|
+
assert_raise(ArgumentError){ Win32::Service.start }
|
118
|
+
assert_raise(Win32::Service::Error){ Win32::Service.start(@service_name) } # Started
|
119
|
+
assert_raise(Win32::Service::Error){ Win32::Service.start('bogus') }
|
120
|
+
assert_raise(Win32::Service::Error){ Win32::Service.start('bogus', 'bogus') }
|
121
|
+
assert_raise(Win32::Service::Error){ Win32::Service.start('bogus', 'bogus', 'a') }
|
122
|
+
assert_raise(Win32::Service::Error){ Win32::Service.start('a', 'b', 'c', 'd') }
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_service_stop_expected_errors
|
126
|
+
assert_raise(ArgumentError){ Win32::Service.stop }
|
127
|
+
assert_raise(Win32::Service::Error){ Win32::Service.stop('bogus') }
|
128
|
+
assert_raise(Win32::Service::Error){ Win32::Service.stop('bogus', 'bogus') }
|
129
|
+
assert_raise(ArgumentError){ Win32::Service.stop('a', 'b', 'c') }
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_service_status_basic
|
133
|
+
assert_respond_to(Win32::Service, :status)
|
134
|
+
assert_nothing_raised{ Win32::Service.status(@service_name) }
|
135
|
+
assert_kind_of(Struct::ServiceStatus, Win32::Service.status(@service_name))
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_service_get_service_name_basic
|
139
|
+
assert_respond_to(Win32::Service, :get_service_name)
|
140
|
+
assert_nothing_raised{ Win32::Service.get_service_name(@display_name) }
|
141
|
+
assert_kind_of(String, Win32::Service.get_service_name(@display_name))
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_service_getservicename_alias_basic
|
145
|
+
assert_respond_to(Win32::Service, :getservicename)
|
146
|
+
assert_nothing_raised{ Win32::Service.getservicename(@display_name) }
|
147
|
+
assert_kind_of(String, Win32::Service.getservicename(@display_name))
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_service_get_service_name
|
151
|
+
assert_equal(@service_name, Win32::Service.get_service_name(@display_name))
|
152
|
+
assert_equal(@service_name, Win32::Service.getservicename(@display_name))
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_service_get_service_name_expected_errors
|
156
|
+
assert_raise(ArgumentError){ Win32::Service.get_service_name }
|
157
|
+
assert_raise(Win32::Service::Error){ Win32::Service.get_service_name('bogus') }
|
158
|
+
assert_raise(Win32::Service::Error){ Win32::Service.get_service_name('foo','bogus') }
|
159
|
+
assert_raise(ArgumentError){ Win32::Service.get_service_name('x', 'y', 'z') }
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_service_get_display_name_basic
|
163
|
+
assert_respond_to(Win32::Service, :get_display_name)
|
164
|
+
assert_nothing_raised{ Win32::Service.get_display_name(@service_name) }
|
165
|
+
assert_kind_of(String, Win32::Service.get_display_name(@service_name))
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_service_getdisplayname_alias_basic
|
169
|
+
assert_respond_to(Win32::Service, :getdisplayname)
|
170
|
+
assert_nothing_raised{ Win32::Service.getdisplayname(@service_name) }
|
171
|
+
assert_kind_of(String, Win32::Service.getdisplayname(@service_name))
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_service_get_display_name
|
175
|
+
assert_equal(@display_name, Win32::Service.get_display_name(@service_name))
|
176
|
+
assert_equal(@display_name, Win32::Service.getdisplayname(@service_name))
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_service_get_display_name_expected_errors
|
180
|
+
assert_raise(ArgumentError){ Win32::Service.get_display_name }
|
181
|
+
assert_raise(Win32::Service::Error){ Win32::Service.get_display_name('bogus') }
|
182
|
+
assert_raise(Win32::Service::Error){ Win32::Service.get_display_name('foo','bogus') }
|
183
|
+
assert_raise(ArgumentError){ Win32::Service.get_display_name('x', 'y', 'z') }
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_service_exists
|
187
|
+
assert_respond_to(Win32::Service, :exists?)
|
188
|
+
assert_nothing_raised{ Win32::Service.exists?('W32Time') }
|
189
|
+
assert_equal(true, Win32::Service.exists?('W32Time'))
|
190
|
+
assert_equal(false, Win32::Service.exists?('foobar'))
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_service_exists_expected_errors
|
194
|
+
assert_raises(ArgumentError){ Win32::Service.exists? }
|
195
|
+
assert_raises(Win32::Service::Error){Win32::Service.exists?('foo', 'bogushost') }
|
196
|
+
assert_raises(ArgumentError){ Win32::Service.exists?('foo', 'bar', 'baz') }
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_scm_security_constants
|
200
|
+
assert_not_nil(Win32::Service::MANAGER_ALL_ACCESS)
|
201
|
+
assert_not_nil(Win32::Service::MANAGER_CREATE_SERVICE)
|
202
|
+
assert_not_nil(Win32::Service::MANAGER_CONNECT)
|
203
|
+
assert_not_nil(Win32::Service::MANAGER_ENUMERATE_SERVICE)
|
204
|
+
assert_not_nil(Win32::Service::MANAGER_LOCK)
|
205
|
+
assert_not_nil(Win32::Service::MANAGER_QUERY_LOCK_STATUS)
|
206
|
+
end
|
207
|
+
|
208
|
+
def test_service_specific_constants
|
209
|
+
assert_not_nil(Win32::Service::ALL_ACCESS)
|
210
|
+
assert_not_nil(Win32::Service::CHANGE_CONFIG)
|
211
|
+
assert_not_nil(Win32::Service::ENUMERATE_DEPENDENTS)
|
212
|
+
assert_not_nil(Win32::Service::INTERROGATE)
|
213
|
+
assert_not_nil(Win32::Service::PAUSE_CONTINUE)
|
214
|
+
assert_not_nil(Win32::Service::QUERY_CONFIG)
|
215
|
+
assert_not_nil(Win32::Service::QUERY_STATUS)
|
216
|
+
assert_not_nil(Win32::Service::STOP)
|
217
|
+
assert_not_nil(Win32::Service::START)
|
218
|
+
assert_not_nil(Win32::Service::USER_DEFINED_CONTROL)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_service_type_constants
|
222
|
+
assert_not_nil(Win32::Service::FILE_SYSTEM_DRIVER)
|
223
|
+
assert_not_nil(Win32::Service::KERNEL_DRIVER)
|
224
|
+
assert_not_nil(Win32::Service::WIN32_OWN_PROCESS)
|
225
|
+
assert_not_nil(Win32::Service::WIN32_SHARE_PROCESS)
|
226
|
+
assert_not_nil(Win32::Service::INTERACTIVE_PROCESS)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_service_start_option_constants
|
230
|
+
assert_not_nil(Win32::Service::AUTO_START)
|
231
|
+
assert_not_nil(Win32::Service::BOOT_START)
|
232
|
+
assert_not_nil(Win32::Service::DEMAND_START)
|
233
|
+
assert_not_nil(Win32::Service::DISABLED)
|
234
|
+
assert_not_nil(Win32::Service::SYSTEM_START)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_service_error_control_constants
|
238
|
+
assert_not_nil(Win32::Service::ERROR_IGNORE)
|
239
|
+
assert_not_nil(Win32::Service::ERROR_NORMAL)
|
240
|
+
assert_not_nil(Win32::Service::ERROR_SEVERE)
|
241
|
+
assert_not_nil(Win32::Service::ERROR_CRITICAL)
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_service_state_constants
|
245
|
+
assert_not_nil(Win32::Service::CONTINUE_PENDING)
|
246
|
+
assert_not_nil(Win32::Service::PAUSE_PENDING)
|
247
|
+
assert_not_nil(Win32::Service::PAUSED)
|
248
|
+
assert_not_nil(Win32::Service::RUNNING)
|
249
|
+
assert_not_nil(Win32::Service::START_PENDING)
|
250
|
+
assert_not_nil(Win32::Service::STOP_PENDING)
|
251
|
+
assert_not_nil(Win32::Service::STOPPED)
|
252
|
+
end
|
253
|
+
|
254
|
+
def teardown
|
255
|
+
@display_name = nil
|
256
|
+
@service_name = nil
|
257
|
+
@service_stat = nil
|
258
|
+
@services = nil
|
259
|
+
end
|
260
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
########################################################################
|
2
|
+
# tc_service_create.rb
|
3
|
+
#
|
4
|
+
# Test case for the Service.create method. This test case will create
|
5
|
+
# a dummy (notepad) service. It won't actually run of course.
|
6
|
+
########################################################################
|
7
|
+
require 'win32/service'
|
8
|
+
require 'test/unit'
|
9
|
+
|
10
|
+
class TC_Service_Create < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@notepad = "C:\\windows\\system32\\notepad.exe"
|
13
|
+
@service = 'notepad'
|
14
|
+
@info = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_create_basic
|
18
|
+
assert_respond_to(Win32::Service, :new)
|
19
|
+
assert_respond_to(Win32::Service, :create)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_create_with_minimal_options
|
23
|
+
assert_nothing_raised{
|
24
|
+
Win32::Service.new(@service, nil, :binary_path_name => @notepad)
|
25
|
+
}
|
26
|
+
|
27
|
+
assert_equal(true, Win32::Service.exists?(@service))
|
28
|
+
assert_nothing_raised{ @info = Win32::Service.config_info(@service) }
|
29
|
+
|
30
|
+
assert_equal('own process, interactive', @info.service_type)
|
31
|
+
assert_equal('demand start', @info.start_type)
|
32
|
+
assert_equal('normal', @info.error_control)
|
33
|
+
assert_equal(@notepad, @info.binary_path_name)
|
34
|
+
assert_equal('', @info.load_order_group)
|
35
|
+
assert_equal(0, @info.tag_id)
|
36
|
+
assert_equal([], @info.dependencies)
|
37
|
+
assert_equal('LocalSystem', @info.service_start_name)
|
38
|
+
assert_equal('notepad', @info.display_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_create_with_most_options
|
42
|
+
assert_nothing_raised{
|
43
|
+
Win32::Service.new(@service, nil,
|
44
|
+
:display_name => 'Notepad Test',
|
45
|
+
:desired_access => Win32::Service::ALL_ACCESS,
|
46
|
+
:service_type => Win32::Service::WIN32_OWN_PROCESS,
|
47
|
+
:start_type => Win32::Service::DISABLED,
|
48
|
+
:error_control => Win32::Service::ERROR_IGNORE,
|
49
|
+
:binary_path_name => @notepad,
|
50
|
+
:load_order_group => 'Network',
|
51
|
+
:dependencies => 'W32Time',
|
52
|
+
:description => 'Test service. Please delete me'
|
53
|
+
)
|
54
|
+
}
|
55
|
+
assert_equal(true, Win32::Service.exists?(@service))
|
56
|
+
assert_nothing_raised{ @info = Win32::Service.config_info(@service) }
|
57
|
+
|
58
|
+
assert_equal('own process', @info.service_type)
|
59
|
+
assert_equal('disabled', @info.start_type)
|
60
|
+
assert_equal('ignore', @info.error_control)
|
61
|
+
assert_equal(@notepad, @info.binary_path_name)
|
62
|
+
assert_equal('Network', @info.load_order_group)
|
63
|
+
assert_equal(0, @info.tag_id)
|
64
|
+
assert_equal(['W32Time'], @info.dependencies)
|
65
|
+
assert_equal('LocalSystem', @info.service_start_name)
|
66
|
+
assert_equal('Notepad Test', @info.display_name)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_create_expected_errors
|
70
|
+
assert_raise(ArgumentError){ Win32::Service.new }
|
71
|
+
assert_raise(ArgumentError){ Win32::Service.new(@service) }
|
72
|
+
assert_raise(ArgumentError){ Win32::Service.new(@service, 'bogus') }
|
73
|
+
end
|
74
|
+
|
75
|
+
def teardown
|
76
|
+
Win32::Service.delete(@service) if Win32::Service.exists?(@service)
|
77
|
+
sleep 1 while Win32::Service.exists?(@service)
|
78
|
+
|
79
|
+
@notepad = nil
|
80
|
+
@service = nil
|
81
|
+
@status = nil
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
########################################################################
|
2
|
+
# tc_service_info.rb
|
3
|
+
#
|
4
|
+
# Test case for the Struct::ServiceInfo structure.
|
5
|
+
########################################################################
|
6
|
+
require 'win32/service'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TC_Struct_ServiceInfo < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@services = Win32::Service.services
|
12
|
+
@service_info = @services[0]
|
13
|
+
|
14
|
+
@error_controls = [
|
15
|
+
'critical',
|
16
|
+
'ignore',
|
17
|
+
'normal',
|
18
|
+
'severe',
|
19
|
+
nil
|
20
|
+
]
|
21
|
+
|
22
|
+
@start_types = [
|
23
|
+
'auto start',
|
24
|
+
'boot start',
|
25
|
+
'demand start',
|
26
|
+
'disabled',
|
27
|
+
'system start',
|
28
|
+
nil
|
29
|
+
]
|
30
|
+
|
31
|
+
@types = [
|
32
|
+
'file system driver',
|
33
|
+
'kernel driver',
|
34
|
+
'own process',
|
35
|
+
'share process',
|
36
|
+
'recognizer token',
|
37
|
+
'driver',
|
38
|
+
'win32',
|
39
|
+
'all',
|
40
|
+
'own process, interactive',
|
41
|
+
'share process, interactive',
|
42
|
+
nil
|
43
|
+
]
|
44
|
+
|
45
|
+
@states = [
|
46
|
+
'continue pending',
|
47
|
+
'pause pending',
|
48
|
+
'paused',
|
49
|
+
'running',
|
50
|
+
'start pending',
|
51
|
+
'stop pending',
|
52
|
+
'stopped',
|
53
|
+
nil
|
54
|
+
]
|
55
|
+
|
56
|
+
@controls = [
|
57
|
+
'netbind change',
|
58
|
+
'param change',
|
59
|
+
'pause continue',
|
60
|
+
'shutdown',
|
61
|
+
'stop',
|
62
|
+
'hardware profile change',
|
63
|
+
'power event',
|
64
|
+
'session change',
|
65
|
+
nil
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_service_info_info_service_name
|
70
|
+
assert_respond_to(@service_info, :service_name)
|
71
|
+
assert_kind_of(String, @service_info.service_name)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_service_info_info_display_name
|
75
|
+
assert_respond_to(@service_info, :display_name)
|
76
|
+
assert_kind_of(String, @service_info.display_name)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_service_info_info_service_type
|
80
|
+
assert_respond_to(@service_info, :service_type)
|
81
|
+
assert(@types.include?(@service_info.service_type))
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_service_info_current_state
|
85
|
+
assert_respond_to(@service_info, :current_state)
|
86
|
+
assert(@states.include?(@service_info.current_state))
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_service_info_controls_accepted
|
90
|
+
assert_respond_to(@service_info, :controls_accepted)
|
91
|
+
assert(@controls.include?(@service_info.controls_accepted))
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_service_info_win32_exit_code
|
95
|
+
assert_respond_to(@service_info, :win32_exit_code)
|
96
|
+
assert_kind_of(Fixnum, @service_info.win32_exit_code)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_service_info_service_specific_exit_code
|
100
|
+
assert_respond_to(@service_info, :service_specific_exit_code)
|
101
|
+
assert_kind_of(Fixnum, @service_info.service_specific_exit_code)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_service_info_check_point
|
105
|
+
assert_respond_to(@service_info, :check_point)
|
106
|
+
assert_kind_of(Fixnum, @service_info.check_point)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_service_info_wait_hint
|
110
|
+
assert_respond_to(@service_info, :wait_hint)
|
111
|
+
assert_kind_of(Fixnum, @service_info.wait_hint)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_service_info_binary_path_name
|
115
|
+
assert_respond_to(@service_info, :binary_path_name)
|
116
|
+
assert_kind_of(String, @service_info.binary_path_name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_service_info_start_type
|
120
|
+
assert_respond_to(@service_info, :start_type)
|
121
|
+
assert(@start_types.include?(@service_info.start_type))
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_service_info_error_control
|
125
|
+
assert_respond_to(@service_info, :error_control)
|
126
|
+
assert(@error_controls.include?(@service_info.error_control))
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_service_info_load_order_group
|
130
|
+
assert_respond_to(@service_info, :load_order_group)
|
131
|
+
assert_kind_of(String, @service_info.load_order_group)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_service_info_tag_id
|
135
|
+
assert_respond_to(@service_info, :tag_id)
|
136
|
+
assert_kind_of(Fixnum, @service_info.tag_id)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_service_info_start_name
|
140
|
+
assert_respond_to(@service_info, :start_name)
|
141
|
+
assert_kind_of(String, @service_info.start_name)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_service_info_dependencies
|
145
|
+
assert_respond_to(@service_info, :dependencies)
|
146
|
+
assert_kind_of(Array, @service_info.dependencies)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_service_info_description
|
150
|
+
assert_respond_to(@service_info, :description)
|
151
|
+
assert_kind_of(String, @service_info.description)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_service_info_interactive
|
155
|
+
assert_respond_to(@service_info, :interactive)
|
156
|
+
assert([true, false].include?(@service_info.interactive))
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_service_info_service_flags
|
160
|
+
assert_respond_to(@service_info, :service_flags)
|
161
|
+
assert([0,1].include?(@service_info.service_flags))
|
162
|
+
end
|
163
|
+
|
164
|
+
def teardown
|
165
|
+
@services = nil
|
166
|
+
@types = nil
|
167
|
+
@states = nil
|
168
|
+
@controls = nil
|
169
|
+
end
|
170
|
+
end
|