Class: MobyController::QT::Comms::QTResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb

Overview

deprecated: see send_service_request#adapter.rb Wrapper for protocol message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_flag, msg_body, crc, message_id) ⇒ QTResponse

deprecated: see send_service_request#adapter.rb Initialize QT Response.

params

command_flag Indicator flad for message type (error or ok) message_code 0 or an error code msg_body Body of the message. For command a simple “OK” message for ui state the xml document as string

returns



58
59
60
61
62
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb', line 58

def initialize( command_flag, msg_body, crc, message_id )

  @flag, @msg_body, @crc, @message_id = command_flag, msg_body, crc, message_id

end

Instance Attribute Details

#crcObject

Returns the value of attribute crc.



49
50
51
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb', line 49

def crc
  @crc
end

#flagObject

Returns the value of attribute flag.



49
50
51
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb', line 49

def flag
  @flag
end

#message_idObject

Returns the value of attribute message_id.



49
50
51
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb', line 49

def message_id
  @message_id
end

#msg_bodyObject

Returns the value of attribute msg_body.



49
50
51
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb', line 49

def msg_body
  @msg_body
end

Instance Method Details

#validate_message(msg_id) ⇒ Object

deprecated: see send_service_request#adapter.rb



65
66
67
68
69
70
71
72
73
74
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/sut/communication.rb', line 65

def validate_message( msg_id )

  #check that response matches the request
  if @message_id != msg_id 

    msg = "Response to request did not match: #{ @message_id.to_s.inspect }!=#{ msg_id.to_s.inspect }"

    $logger.fatal msg

    $logger.fatal @msg_body 

    raise RuntimeError, msg

  end

  #raise error if error flag
  if @flag == Comms::ERROR_MSG

    raise MobyBase::ApplicationNotAvailableError, @msg_body if @msg_body =~ /The application with Id \d+ is no longer available/

    raise RuntimeError, @msg_body

  end

end