Module: MobyController::QT::WidgetCommand

Includes:
Abstraction
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb

Instance Method Summary collapse

Instance Method Details

#executeObject

Execute the command). Sends the message to the device using the @sut_adapter (see base class)

params

returns

raises

NotImplementedError: raised if unsupported command type



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb', line 75

def execute

  message = make_message

  if @sut_adapter.group?

    @sut_adapter.append_command( message.doc.root.children )

  else

    @sut_adapter.send_service_request( Comms::MessageGenerator.generate( message.to_xml ) )

  end

end

#make_messageObject

generate service request



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb', line 29

def make_message

  # reduce AST calls
  _application_id = @_application_id
  _transitions = @_transitions
  _service = @_service

  _object_id = @_object_id
  _object_type = @_object_type
  _command_value = @_command_value

  # Object#not_nil return self if value not nil
  _command_params = { :eventType => @_event_type.not_nil('Assert: event_type must be set!'), :name => @_command_name }.merge!( @_command_params || {} )

  builder = Nokogiri::XML::Builder.new{

    TasCommands( :id => _application_id, :transitions => _transitions, :service => _service || 'uiCommand' ) {

      Target( :TasId => _object_id, :type => _object_type ) {

      if _command_value.kind_of?( Array )

        _command_value.each do | command_part | Command( command_part[ :value ], command_part[ :params ] ); end

      elsif _command_value

          Command( _command_value, _command_params )

      else

          Command( _command_params )

      end

      }
    }
  }              

end