win32-service 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,188 +1,188 @@
1
- ########################################################################
2
- # test_win32_service_info.rb
3
- #
4
- # Test case for the Struct::ServiceInfo structure.
5
- ########################################################################
6
- require 'test-unit'
7
- require 'win32/service'
8
-
9
- class TC_Win32_ServiceInfo_Struct < Test::Unit::TestCase
10
- def self.startup
11
- @@services = Win32::Service.services
12
- end
13
-
14
- def setup
15
- @service_name = "Dhcp"
16
- @service_info = @@services.find{ |s| s.service_name == @service_name }
17
-
18
- @error_controls = [
19
- 'critical',
20
- 'ignore',
21
- 'normal',
22
- 'severe',
23
- nil
24
- ]
25
-
26
- @start_types = [
27
- 'auto start',
28
- 'boot start',
29
- 'demand start',
30
- 'disabled',
31
- 'system start',
32
- nil
33
- ]
34
-
35
- @types = [
36
- 'file system driver',
37
- 'kernel driver',
38
- 'own process',
39
- 'share process',
40
- 'recognizer token',
41
- 'driver',
42
- 'win32',
43
- 'all',
44
- 'own process, interactive',
45
- 'share process, interactive',
46
- nil
47
- ]
48
-
49
- @states = [
50
- 'continue pending',
51
- 'pause pending',
52
- 'paused',
53
- 'running',
54
- 'start pending',
55
- 'stop pending',
56
- 'stopped',
57
- nil
58
- ]
59
-
60
- @controls = [
61
- 'netbind change',
62
- 'param change',
63
- 'pause continue',
64
- 'pre-shutdown',
65
- 'shutdown',
66
- 'stop',
67
- 'hardware profile change',
68
- 'power event',
69
- 'session change',
70
- 'interrogate'
71
- ]
72
- end
73
-
74
- def test_service_info_info_service_name
75
- assert_respond_to(@service_info, :service_name)
76
- assert_kind_of(String, @service_info.service_name)
77
- end
78
-
79
- def test_service_info_info_display_name
80
- assert_respond_to(@service_info, :display_name)
81
- assert_kind_of(String, @service_info.display_name)
82
- end
83
-
84
- def test_service_info_info_service_type
85
- assert_respond_to(@service_info, :service_type)
86
- assert(@types.include?(@service_info.service_type))
87
- end
88
-
89
- def test_service_info_current_state
90
- assert_respond_to(@service_info, :current_state)
91
- assert(@states.include?(@service_info.current_state))
92
- end
93
-
94
- def test_service_info_controls_accepted
95
- assert_respond_to(@service_info, :controls_accepted)
96
- assert_kind_of(Array, @service_info.controls_accepted)
97
- assert_false(@service_info.controls_accepted.empty?)
98
- @service_info.controls_accepted.each{ |control|
99
- assert_true(@controls.include?(control))
100
- }
101
- end
102
-
103
- def test_service_info_win32_exit_code
104
- assert_respond_to(@service_info, :win32_exit_code)
105
- assert_kind_of(Fixnum, @service_info.win32_exit_code)
106
- end
107
-
108
- def test_service_info_service_specific_exit_code
109
- assert_respond_to(@service_info, :service_specific_exit_code)
110
- assert_kind_of(Fixnum, @service_info.service_specific_exit_code)
111
- end
112
-
113
- def test_service_info_check_point
114
- assert_respond_to(@service_info, :check_point)
115
- assert_kind_of(Fixnum, @service_info.check_point)
116
- end
117
-
118
- def test_service_info_wait_hint
119
- assert_respond_to(@service_info, :wait_hint)
120
- assert_kind_of(Fixnum, @service_info.wait_hint)
121
- end
122
-
123
- def test_service_info_binary_path_name
124
- assert_respond_to(@service_info, :binary_path_name)
125
- assert_kind_of(String, @service_info.binary_path_name)
126
- end
127
-
128
- def test_service_info_start_type
129
- assert_respond_to(@service_info, :start_type)
130
- assert(@start_types.include?(@service_info.start_type))
131
- end
132
-
133
- def test_service_info_error_control
134
- assert_respond_to(@service_info, :error_control)
135
- assert(@error_controls.include?(@service_info.error_control))
136
- end
137
-
138
- def test_service_info_load_order_group
139
- assert_respond_to(@service_info, :load_order_group)
140
- assert_kind_of(String, @service_info.load_order_group)
141
- end
142
-
143
- def test_service_info_tag_id
144
- assert_respond_to(@service_info, :tag_id)
145
- assert_kind_of(Fixnum, @service_info.tag_id)
146
- end
147
-
148
- def test_service_info_start_name
149
- assert_respond_to(@service_info, :start_name)
150
- assert_kind_of(String, @service_info.start_name)
151
- end
152
-
153
- def test_service_info_dependencies
154
- assert_respond_to(@service_info, :dependencies)
155
- assert_kind_of(Array, @service_info.dependencies)
156
- end
157
-
158
- def test_service_info_description
159
- assert_respond_to(@service_info, :description)
160
- assert_kind_of(String, @service_info.description)
161
- end
162
-
163
- def test_service_info_interactive
164
- assert_respond_to(@service_info, :interactive)
165
- assert_boolean(@service_info.interactive)
166
- end
167
-
168
- def test_service_info_service_flags
169
- assert_respond_to(@service_info, :service_flags)
170
- assert([0,1].include?(@service_info.service_flags))
171
- end
172
-
173
- def test_service_info_delayed_start
174
- assert_respond_to(@service_info, :delayed_start)
175
- assert_boolean(@service_info.delayed_start)
176
- end
177
-
178
- def teardown
179
- @types = nil
180
- @states = nil
181
- @controls = nil
182
- @service_name = nil
183
- end
184
-
185
- def self.shutdown
186
- @@services = nil
187
- end
188
- end
1
+ ########################################################################
2
+ # test_win32_service_info.rb
3
+ #
4
+ # Test case for the Struct::ServiceInfo structure.
5
+ ########################################################################
6
+ require 'test-unit'
7
+ require 'win32/service'
8
+
9
+ class TC_Win32_ServiceInfo_Struct < Test::Unit::TestCase
10
+ def self.startup
11
+ @@services = Win32::Service.services
12
+ end
13
+
14
+ def setup
15
+ @service_name = "Dhcp"
16
+ @service_info = @@services.find{ |s| s.service_name == @service_name }
17
+
18
+ @error_controls = [
19
+ 'critical',
20
+ 'ignore',
21
+ 'normal',
22
+ 'severe',
23
+ nil
24
+ ]
25
+
26
+ @start_types = [
27
+ 'auto start',
28
+ 'boot start',
29
+ 'demand start',
30
+ 'disabled',
31
+ 'system start',
32
+ nil
33
+ ]
34
+
35
+ @types = [
36
+ 'file system driver',
37
+ 'kernel driver',
38
+ 'own process',
39
+ 'share process',
40
+ 'recognizer token',
41
+ 'driver',
42
+ 'win32',
43
+ 'all',
44
+ 'own process, interactive',
45
+ 'share process, interactive',
46
+ nil
47
+ ]
48
+
49
+ @states = [
50
+ 'continue pending',
51
+ 'pause pending',
52
+ 'paused',
53
+ 'running',
54
+ 'start pending',
55
+ 'stop pending',
56
+ 'stopped',
57
+ nil
58
+ ]
59
+
60
+ @controls = [
61
+ 'netbind change',
62
+ 'param change',
63
+ 'pause continue',
64
+ 'pre-shutdown',
65
+ 'shutdown',
66
+ 'stop',
67
+ 'hardware profile change',
68
+ 'power event',
69
+ 'session change',
70
+ 'interrogate'
71
+ ]
72
+ end
73
+
74
+ def test_service_info_info_service_name
75
+ assert_respond_to(@service_info, :service_name)
76
+ assert_kind_of(String, @service_info.service_name)
77
+ end
78
+
79
+ def test_service_info_info_display_name
80
+ assert_respond_to(@service_info, :display_name)
81
+ assert_kind_of(String, @service_info.display_name)
82
+ end
83
+
84
+ def test_service_info_info_service_type
85
+ assert_respond_to(@service_info, :service_type)
86
+ assert(@types.include?(@service_info.service_type))
87
+ end
88
+
89
+ def test_service_info_current_state
90
+ assert_respond_to(@service_info, :current_state)
91
+ assert(@states.include?(@service_info.current_state))
92
+ end
93
+
94
+ def test_service_info_controls_accepted
95
+ assert_respond_to(@service_info, :controls_accepted)
96
+ assert_kind_of(Array, @service_info.controls_accepted)
97
+ assert_false(@service_info.controls_accepted.empty?)
98
+ @service_info.controls_accepted.each{ |control|
99
+ assert_true(@controls.include?(control))
100
+ }
101
+ end
102
+
103
+ def test_service_info_win32_exit_code
104
+ assert_respond_to(@service_info, :win32_exit_code)
105
+ assert_kind_of(Fixnum, @service_info.win32_exit_code)
106
+ end
107
+
108
+ def test_service_info_service_specific_exit_code
109
+ assert_respond_to(@service_info, :service_specific_exit_code)
110
+ assert_kind_of(Fixnum, @service_info.service_specific_exit_code)
111
+ end
112
+
113
+ def test_service_info_check_point
114
+ assert_respond_to(@service_info, :check_point)
115
+ assert_kind_of(Fixnum, @service_info.check_point)
116
+ end
117
+
118
+ def test_service_info_wait_hint
119
+ assert_respond_to(@service_info, :wait_hint)
120
+ assert_kind_of(Fixnum, @service_info.wait_hint)
121
+ end
122
+
123
+ def test_service_info_binary_path_name
124
+ assert_respond_to(@service_info, :binary_path_name)
125
+ assert_kind_of(String, @service_info.binary_path_name)
126
+ end
127
+
128
+ def test_service_info_start_type
129
+ assert_respond_to(@service_info, :start_type)
130
+ assert(@start_types.include?(@service_info.start_type))
131
+ end
132
+
133
+ def test_service_info_error_control
134
+ assert_respond_to(@service_info, :error_control)
135
+ assert(@error_controls.include?(@service_info.error_control))
136
+ end
137
+
138
+ def test_service_info_load_order_group
139
+ assert_respond_to(@service_info, :load_order_group)
140
+ assert_kind_of(String, @service_info.load_order_group)
141
+ end
142
+
143
+ def test_service_info_tag_id
144
+ assert_respond_to(@service_info, :tag_id)
145
+ assert_kind_of(Fixnum, @service_info.tag_id)
146
+ end
147
+
148
+ def test_service_info_start_name
149
+ assert_respond_to(@service_info, :start_name)
150
+ assert_kind_of(String, @service_info.start_name)
151
+ end
152
+
153
+ def test_service_info_dependencies
154
+ assert_respond_to(@service_info, :dependencies)
155
+ assert_kind_of(Array, @service_info.dependencies)
156
+ end
157
+
158
+ def test_service_info_description
159
+ assert_respond_to(@service_info, :description)
160
+ assert_kind_of(String, @service_info.description)
161
+ end
162
+
163
+ def test_service_info_interactive
164
+ assert_respond_to(@service_info, :interactive)
165
+ assert_boolean(@service_info.interactive)
166
+ end
167
+
168
+ def test_service_info_service_flags
169
+ assert_respond_to(@service_info, :service_flags)
170
+ assert([0,1].include?(@service_info.service_flags))
171
+ end
172
+
173
+ def test_service_info_delayed_start
174
+ assert_respond_to(@service_info, :delayed_start)
175
+ assert([0,1].include?(@service_info.delayed_start))
176
+ end
177
+
178
+ def teardown
179
+ @types = nil
180
+ @states = nil
181
+ @controls = nil
182
+ @service_name = nil
183
+ end
184
+
185
+ def self.shutdown
186
+ @@services = nil
187
+ end
188
+ end
@@ -1,110 +1,110 @@
1
- ########################################################################
2
- # test_win32_service_status.rb
3
- #
4
- # Test case for the Struct::ServiceStatus struct.
5
- ########################################################################
6
- require 'test-unit'
7
- require 'win32/service'
8
-
9
- class TC_Win32_ServiceStatus_Struct < Test::Unit::TestCase
10
- def setup
11
- @service_name = 'Schedule'
12
- @service_stat = Win32::Service.status(@service_name)
13
-
14
- @types = [
15
- 'file system driver',
16
- 'kernel driver',
17
- 'own process',
18
- 'share process',
19
- 'recognizer token',
20
- 'driver',
21
- 'win32',
22
- 'all',
23
- 'own process, interactive',
24
- 'share process, interactive',
25
- nil
26
- ]
27
-
28
- @states = [
29
- 'continue pending',
30
- 'pause pending',
31
- 'paused',
32
- 'running',
33
- 'start pending',
34
- 'stop pending',
35
- 'stopped',
36
- nil
37
- ]
38
-
39
- @controls = [
40
- 'netbind change',
41
- 'param change',
42
- 'pause continue',
43
- 'shutdown',
44
- 'stop',
45
- 'hardware profile change',
46
- 'power event',
47
- 'session change'
48
- ]
49
- end
50
-
51
- def test_service_status_service_type
52
- assert_respond_to(@service_stat, :service_type)
53
- assert(@types.include?(@service_stat.service_type))
54
- end
55
-
56
- def test_service_status_current_state
57
- assert_respond_to(@service_stat, :current_state)
58
- assert(@states.include?(@service_stat.current_state))
59
- end
60
-
61
- def test_service_status_controls_accepted
62
- assert_respond_to(@service_stat, :controls_accepted)
63
- assert_kind_of(Array, @service_stat.controls_accepted)
64
- @service_stat.controls_accepted.each{ |control|
65
- assert_true(@controls.include?(control))
66
- }
67
- end
68
-
69
- def test_service_status_win32_exit_code
70
- assert_respond_to(@service_stat, :win32_exit_code)
71
- assert_kind_of(Fixnum, @service_stat.win32_exit_code)
72
- end
73
-
74
- def test_service_status_service_specific_exit_code
75
- assert_respond_to(@service_stat, :service_specific_exit_code)
76
- assert_kind_of(Fixnum, @service_stat.service_specific_exit_code)
77
- end
78
-
79
- def test_service_status_check_point
80
- assert_respond_to(@service_stat, :check_point)
81
- assert_kind_of(Fixnum, @service_stat.check_point)
82
- end
83
-
84
- def test_service_status_wait_hint
85
- assert_respond_to(@service_stat, :wait_hint)
86
- assert_kind_of(Fixnum, @service_stat.wait_hint)
87
- end
88
-
89
- def test_service_status_interactive
90
- assert_respond_to(@service_stat, :interactive)
91
- assert([true, false].include?(@service_stat.interactive))
92
- end
93
-
94
- def test_service_status_pid
95
- assert_respond_to(@service_stat, :pid)
96
- assert_kind_of(Fixnum, @service_stat.pid)
97
- end
98
-
99
- def test_service_status_service_flags
100
- assert_respond_to(@service_stat, :service_flags)
101
- assert_kind_of(Fixnum, @service_stat.service_flags)
102
- end
103
-
104
- def teardown
105
- @service_stat = nil
106
- @types = nil
107
- @states = nil
108
- @controls = nil
109
- end
110
- end
1
+ ########################################################################
2
+ # test_win32_service_status.rb
3
+ #
4
+ # Test case for the Struct::ServiceStatus struct.
5
+ ########################################################################
6
+ require 'test-unit'
7
+ require 'win32/service'
8
+
9
+ class TC_Win32_ServiceStatus_Struct < Test::Unit::TestCase
10
+ def setup
11
+ @service_name = 'Schedule'
12
+ @service_stat = Win32::Service.status(@service_name)
13
+
14
+ @types = [
15
+ 'file system driver',
16
+ 'kernel driver',
17
+ 'own process',
18
+ 'share process',
19
+ 'recognizer token',
20
+ 'driver',
21
+ 'win32',
22
+ 'all',
23
+ 'own process, interactive',
24
+ 'share process, interactive',
25
+ nil
26
+ ]
27
+
28
+ @states = [
29
+ 'continue pending',
30
+ 'pause pending',
31
+ 'paused',
32
+ 'running',
33
+ 'start pending',
34
+ 'stop pending',
35
+ 'stopped',
36
+ nil
37
+ ]
38
+
39
+ @controls = [
40
+ 'netbind change',
41
+ 'param change',
42
+ 'pause continue',
43
+ 'shutdown',
44
+ 'stop',
45
+ 'hardware profile change',
46
+ 'power event',
47
+ 'session change'
48
+ ]
49
+ end
50
+
51
+ def test_service_status_service_type
52
+ assert_respond_to(@service_stat, :service_type)
53
+ assert(@types.include?(@service_stat.service_type))
54
+ end
55
+
56
+ def test_service_status_current_state
57
+ assert_respond_to(@service_stat, :current_state)
58
+ assert(@states.include?(@service_stat.current_state))
59
+ end
60
+
61
+ def test_service_status_controls_accepted
62
+ assert_respond_to(@service_stat, :controls_accepted)
63
+ assert_kind_of(Array, @service_stat.controls_accepted)
64
+ @service_stat.controls_accepted.each{ |control|
65
+ assert_true(@controls.include?(control))
66
+ }
67
+ end
68
+
69
+ def test_service_status_win32_exit_code
70
+ assert_respond_to(@service_stat, :win32_exit_code)
71
+ assert_kind_of(Fixnum, @service_stat.win32_exit_code)
72
+ end
73
+
74
+ def test_service_status_service_specific_exit_code
75
+ assert_respond_to(@service_stat, :service_specific_exit_code)
76
+ assert_kind_of(Fixnum, @service_stat.service_specific_exit_code)
77
+ end
78
+
79
+ def test_service_status_check_point
80
+ assert_respond_to(@service_stat, :check_point)
81
+ assert_kind_of(Fixnum, @service_stat.check_point)
82
+ end
83
+
84
+ def test_service_status_wait_hint
85
+ assert_respond_to(@service_stat, :wait_hint)
86
+ assert_kind_of(Fixnum, @service_stat.wait_hint)
87
+ end
88
+
89
+ def test_service_status_interactive
90
+ assert_respond_to(@service_stat, :interactive)
91
+ assert([true, false].include?(@service_stat.interactive))
92
+ end
93
+
94
+ def test_service_status_pid
95
+ assert_respond_to(@service_stat, :pid)
96
+ assert_kind_of(Fixnum, @service_stat.pid)
97
+ end
98
+
99
+ def test_service_status_service_flags
100
+ assert_respond_to(@service_stat, :service_flags)
101
+ assert_kind_of(Fixnum, @service_stat.service_flags)
102
+ end
103
+
104
+ def teardown
105
+ @service_stat = nil
106
+ @types = nil
107
+ @states = nil
108
+ @controls = nil
109
+ end
110
+ end