예제 #1
0
 def sendMessage(self,
                 messageContent,
                 source='unspecified',
                 phase='unspecified',
                 status='info'):
     """ Sends the message after
     creating the correct format:
     including content, timestamp, status, source, phase and the uuid
     of the pilot.
 Returns:
   bool: False in case of any errors, True otherwise
 """
     if not self._isCorrectStatus(status):
         logging.error('status: ' + str(status) + ' is not correct')
         return False
     myUUID = getPilotUUIDFromFile(self.params['FileWithID'])
     message = generateDict(myUUID, generateTimeStamp(), source, phase,
                            status, messageContent)
     if not isMessageFormatCorrect(message):
         logging.warning("Message format is not correct.")
         return False
     encodedMsg = encodeMessage(message)
     self.messageSender.sendMessage(encodedMsg, flag=status)
     return False
예제 #2
0
 def test_cosistency( self ):
   result = decodeMessage( encodeMessage( self.msg ) )
   self.assertEqual( result, self.msg )
예제 #3
0
 def test_cosistency( self ):
   result = decodeMessage( encodeMessage( self.msg ) )
   self.assertEqual( result, self.msg )
예제 #4
0
  def test_success( self ):
    result = encodeMessage( self.msg )
    standJSON = json.dumps( self.msg )

    self.assertEqual( result, standJSON )
예제 #5
0
  def test_success( self ):
    result = encodeMessage( self.msg )
    standJSON = json.dumps( self.msg )

    self.assertEqual( result, standJSON )