win32-service 0.8.10 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,189 +1,189 @@
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
- test "service_name basic functionality" do
75
- assert_respond_to(@service_info, :service_name)
76
- assert_kind_of(String, @service_info.service_name)
77
- end
78
-
79
- test "display_name basic functionality" do
80
- assert_respond_to(@service_info, :display_name)
81
- assert_kind_of(String, @service_info.display_name)
82
- end
83
-
84
- test "service_type basic functionality" do
85
- assert_respond_to(@service_info, :service_type)
86
- assert(@types.include?(@service_info.service_type))
87
- end
88
-
89
- test "current_state basic functionality" do
90
- assert_respond_to(@service_info, :current_state)
91
- assert(@states.include?(@service_info.current_state))
92
- end
93
-
94
- test "controls_accepted basic functionality" do
95
- assert_respond_to(@service_info, :controls_accepted)
96
- assert_kind_of(Array, @service_info.controls_accepted)
97
- end
98
-
99
- test "controls_accepted returns expected values" do
100
- assert_false(@service_info.controls_accepted.empty?)
101
- @service_info.controls_accepted.each{ |c| assert_true(@controls.include?(c)) }
102
- end
103
-
104
- test "win32_exit_code basic functionality" do
105
- assert_respond_to(@service_info, :win32_exit_code)
106
- assert_kind_of(Fixnum, @service_info.win32_exit_code)
107
- end
108
-
109
- test "service_specific_exit_code basic functionality" do
110
- assert_respond_to(@service_info, :service_specific_exit_code)
111
- assert_kind_of(Fixnum, @service_info.service_specific_exit_code)
112
- end
113
-
114
- test "check_point basic functionality" do
115
- assert_respond_to(@service_info, :check_point)
116
- assert_kind_of(Fixnum, @service_info.check_point)
117
- end
118
-
119
- test "wait_hint basic functionality" do
120
- assert_respond_to(@service_info, :wait_hint)
121
- assert_kind_of(Fixnum, @service_info.wait_hint)
122
- end
123
-
124
- test "binary_path_name basic functionality" do
125
- assert_respond_to(@service_info, :binary_path_name)
126
- assert_kind_of(String, @service_info.binary_path_name)
127
- end
128
-
129
- test "start_type basic functionality" do
130
- assert_respond_to(@service_info, :start_type)
131
- assert(@start_types.include?(@service_info.start_type))
132
- end
133
-
134
- test "error_control basic functionality" do
135
- assert_respond_to(@service_info, :error_control)
136
- assert(@error_controls.include?(@service_info.error_control))
137
- end
138
-
139
- test "load_order_group basic functionality" do
140
- assert_respond_to(@service_info, :load_order_group)
141
- assert_kind_of(String, @service_info.load_order_group)
142
- end
143
-
144
- test "tag_id basic functionality" do
145
- assert_respond_to(@service_info, :tag_id)
146
- assert_kind_of(Fixnum, @service_info.tag_id)
147
- end
148
-
149
- test "start_name basic functionality" do
150
- assert_respond_to(@service_info, :start_name)
151
- assert_kind_of(String, @service_info.start_name)
152
- end
153
-
154
- test "dependencies basic functionality" do
155
- assert_respond_to(@service_info, :dependencies)
156
- assert_kind_of(Array, @service_info.dependencies)
157
- end
158
-
159
- test "description basic functionality" do
160
- assert_respond_to(@service_info, :description)
161
- assert_kind_of(String, @service_info.description)
162
- end
163
-
164
- test "interactive basic functionality" do
165
- assert_respond_to(@service_info, :interactive)
166
- assert_boolean(@service_info.interactive)
167
- end
168
-
169
- test "service_flags basic functionality" do
170
- assert_respond_to(@service_info, :service_flags)
171
- assert([0,1].include?(@service_info.service_flags))
172
- end
173
-
174
- test "delayed_start basic functionality" do
175
- assert_respond_to(@service_info, :delayed_start)
176
- assert([0,1].include?(@service_info.delayed_start))
177
- end
178
-
179
- def teardown
180
- @types = nil
181
- @states = nil
182
- @controls = nil
183
- @service_name = nil
184
- end
185
-
186
- def self.shutdown
187
- @@services = nil
188
- end
189
- 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
+ test "service_name basic functionality" do
75
+ assert_respond_to(@service_info, :service_name)
76
+ assert_kind_of(String, @service_info.service_name)
77
+ end
78
+
79
+ test "display_name basic functionality" do
80
+ assert_respond_to(@service_info, :display_name)
81
+ assert_kind_of(String, @service_info.display_name)
82
+ end
83
+
84
+ test "service_type basic functionality" do
85
+ assert_respond_to(@service_info, :service_type)
86
+ assert(@types.include?(@service_info.service_type))
87
+ end
88
+
89
+ test "current_state basic functionality" do
90
+ assert_respond_to(@service_info, :current_state)
91
+ assert(@states.include?(@service_info.current_state))
92
+ end
93
+
94
+ test "controls_accepted basic functionality" do
95
+ assert_respond_to(@service_info, :controls_accepted)
96
+ assert_kind_of(Array, @service_info.controls_accepted)
97
+ end
98
+
99
+ test "controls_accepted returns expected values" do
100
+ assert_false(@service_info.controls_accepted.empty?)
101
+ @service_info.controls_accepted.each{ |c| assert_true(@controls.include?(c)) }
102
+ end
103
+
104
+ test "win32_exit_code basic functionality" do
105
+ assert_respond_to(@service_info, :win32_exit_code)
106
+ assert_kind_of(Fixnum, @service_info.win32_exit_code)
107
+ end
108
+
109
+ test "service_specific_exit_code basic functionality" do
110
+ assert_respond_to(@service_info, :service_specific_exit_code)
111
+ assert_kind_of(Fixnum, @service_info.service_specific_exit_code)
112
+ end
113
+
114
+ test "check_point basic functionality" do
115
+ assert_respond_to(@service_info, :check_point)
116
+ assert_kind_of(Fixnum, @service_info.check_point)
117
+ end
118
+
119
+ test "wait_hint basic functionality" do
120
+ assert_respond_to(@service_info, :wait_hint)
121
+ assert_kind_of(Fixnum, @service_info.wait_hint)
122
+ end
123
+
124
+ test "binary_path_name basic functionality" do
125
+ assert_respond_to(@service_info, :binary_path_name)
126
+ assert_kind_of(String, @service_info.binary_path_name)
127
+ end
128
+
129
+ test "start_type basic functionality" do
130
+ assert_respond_to(@service_info, :start_type)
131
+ assert(@start_types.include?(@service_info.start_type))
132
+ end
133
+
134
+ test "error_control basic functionality" do
135
+ assert_respond_to(@service_info, :error_control)
136
+ assert(@error_controls.include?(@service_info.error_control))
137
+ end
138
+
139
+ test "load_order_group basic functionality" do
140
+ assert_respond_to(@service_info, :load_order_group)
141
+ assert_kind_of(String, @service_info.load_order_group)
142
+ end
143
+
144
+ test "tag_id basic functionality" do
145
+ assert_respond_to(@service_info, :tag_id)
146
+ assert_kind_of(Fixnum, @service_info.tag_id)
147
+ end
148
+
149
+ test "start_name basic functionality" do
150
+ assert_respond_to(@service_info, :start_name)
151
+ assert_kind_of(String, @service_info.start_name)
152
+ end
153
+
154
+ test "dependencies basic functionality" do
155
+ assert_respond_to(@service_info, :dependencies)
156
+ assert_kind_of(Array, @service_info.dependencies)
157
+ end
158
+
159
+ test "description basic functionality" do
160
+ assert_respond_to(@service_info, :description)
161
+ assert_kind_of(String, @service_info.description)
162
+ end
163
+
164
+ test "interactive basic functionality" do
165
+ assert_respond_to(@service_info, :interactive)
166
+ assert_boolean(@service_info.interactive)
167
+ end
168
+
169
+ test "service_flags basic functionality" do
170
+ assert_respond_to(@service_info, :service_flags)
171
+ assert([0,1].include?(@service_info.service_flags))
172
+ end
173
+
174
+ test "delayed_start basic functionality" do
175
+ assert_respond_to(@service_info, :delayed_start)
176
+ assert([0,1].include?(@service_info.delayed_start))
177
+ end
178
+
179
+ def teardown
180
+ @types = nil
181
+ @states = nil
182
+ @controls = nil
183
+ @service_name = nil
184
+ end
185
+
186
+ def self.shutdown
187
+ @@services = nil
188
+ end
189
+ 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