Module: MobyBehaviour::QT::Settings

Includes:
Behaviour
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb

Overview

description

behaviour

QtSettings

requires

testability-driver-qt-sut-plugin

input_type

*

sut_type

QT

sut_version

*

objects

*

Instance Method Summary collapse

Methods included from Behaviour

#command_params

Instance Method Details

#read_all_settings(identifiers) ⇒ Object

returns

Hash

description: Hash table with key value pairs for the settings read.
example: {:setting => 'value'}

exceptions

ArgumentError

description:  In case the given parameters are not valid.


255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb', line 255

def read_all_settings(identifiers)
		hash = nil
		begin

 params = generate_fixture_params(identifiers, nil)
 result_string =fixture('setting', 'readAll', params)
 hash = JSON.parse(result_string)		  
 
		rescue Exception => e

 $logger.behaviour "FAIL;Failed read all settings \"#{identifiers.to_s}\".;read_all_settings;"
 raise e

		end

		$logger.behaviour "PASS;Operation read all settings executed successfully \"#{identifiers.to_s}\".;read_all_settings;"

		hash

end

#read_settings(identifiers, setting_keys) ⇒ Object

returns

Hash

description: Hash table with key value pairs for the settings read.
example: {:setting => 'value'}

exceptions

ArgumentError

description:  In case the given parameters are not valid.


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb', line 204

def read_settings(identifiers, setting_keys)
		hash = nil
		begin
 raise ArgumentError.new("No settings to read") unless setting_keys

 params = generate_fixture_params(identifiers, nil)
 setting_keys.each{|value| params[value.to_sym] = ''}
 
 result_string =fixture('setting', 'read', params)
 hash = JSON.parse(result_string)		  
 
		rescue Exception => e

 $logger.behaviour "FAIL;Failed read settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"
 raise e

		end

		$logger.behaviour "PASS;Operation read settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"

		hash

end

#remove_settings(identifiers, setting_keys) ⇒ Object

returns

NilClass

description: -
example: -

exceptions

ArgumentError

description:  In case the given parameters are not valid.


151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb', line 151

def remove_settings(identifiers, setting_keys)
		begin
 raise ArgumentError.new("No settings to remove") unless setting_keys
 
 params = generate_fixture_params(identifiers, nil)
 setting_keys.each{|value| params[value.to_sym] = ''}
 
 fixture('setting', 'remove', params)		  

		rescue Exception => e

 $logger.behaviour "FAIL;Failed remove settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"
 raise e

		end

		$logger.behaviour "PASS;Operation remove settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"

		nil
	  
end

#set_settings(identifiers, values) ⇒ Object

returns

NilClass

description: -
example: -

exceptions

ArgumentError

description:  In case the given parameters are not valid.


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb', line 98

def set_settings(identifiers, values)

		begin
 raise ArgumentError.new("No values to set") unless values

 params = generate_fixture_params(identifiers, values)
 
 fixture('setting', 'set', params)		  

		rescue Exception => e

 $logger.behaviour "FAIL;Failed set settings \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"
 raise e

		end

		$logger.behaviour "PASS;Operation set settings executed successfully \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"

		nil
end