Exemple #1
0
class Module02Test(unittest.TestCase):
	
	config_obj = ConfigUtil.ConfigUtil()
	emulator_obj = TempSensorEmulator()
	
	"""
	we load instance of the class modules we are n=gonna use 	"""

	def test_load(self):
		""" test the laod status of config file by checking absolute path and return of key values of data"""
							
		obj=self.config_obj
# 		
		self.assertTrue(obj.loadconfig() is True, "loaded property files")
		self.assertTrue(obj.hasconfig("smtp.cloud", "host") is not None, "config file return cloud parameter")
		
	
	
	def test_temperatur(self):
		""" we use this test case to validate temperature values recieved from the function"""
		
		"""if the values return are vague and out of range it will fail"""
		obj=self.emulator_obj
		#obj=TempSensorEmulatorTask.TempSensorEmulator()
		
		
		[count,avg,max,min,current]=obj.sensoremulator()
		self.assertTrue(0.0<count, "count validated")
		self.assertTrue(0.0<avg<100.0, "average temperature validated")
		self.assertTrue(0.0<max<100.0, "Maximum temperature validated")
		self.assertTrue(0.0<min<100.0, "Maximum temperature validated")
Exemple #2
0
 def __init__(self, name):
     Thread.__init__(self)
     self.enableAdaptor = True;
     self.sensorData = SensorData.SensorData(name, 0, 30);
     self.actuator = ActuatorData.ActuatorData()
     self.connector = SmtpClientConnector.SmtpClientConnector()
     self.tempConf = ConfigUtil.ConfigUtil('../../../config/ConnectedDevicesConfig.props'); 
     self.actuatorEmulator = TempActuatorEmulator.TempActuatorEmulator();
Exemple #3
0
    def __init__(self):

        self.mqttClient = mqttClient.Client("Python_Client")
        self.pemfile = 'industrial.pem'
        self.password = ''
        self.config = ConfigUtil.ConfigUtil()
        self.sensoData = SensorData.SensorData()
        self.datautil = DataUtil.DataUtil()
        self.broker_keep_alive = 65
        self.connected_flag = False
        self.authToken = 'BBFF-DDJefJiPLcbNPpQHcfbGDM8Z4vJWiU'
        self.port_number = 1883
        self.broker_address = 'mqtt.eclipse.org'
 def __init__(self, name):
     '''
 Constructor
 Creates object of SensorData, ConfiUtil and TempActuatorEmulator
 This class is used to send notification through mail 
 and initiate an action to control the temperature 
     '''
     Thread.__init__(self)
     self.enableEmulator = True
     # flag to enable emulator function
     self.sensor = SensorData.SensorData(name, 0, 30)
     # creating a sensor data object
     self.temp = ConfigUtil.ConfigUtil(
         '../../../config/ConnectedDevicesConfig.props')
     self.temp_emul = TempActuatorEmulator.TempActuatorEmulator()
     '''
Exemple #5
0
 def __init__(self):
     super(TempSensorAdaptor,self).__init__()
     self.config = ConfigUtil.ConfigUtil('../../../config/ConnectedDevicesConfig.props')
     self.config.loadConfig()
     logging.info('Configuration data...\n' + str(self.config))
Exemple #6
0
 def __init__(self):
     self.config = ConfigUtil.ConfigUtil(
         '../../../config/ConnectedDevicesConfig.props')
     self.config.loadConfig()