def testStartAndStopManagerWithMqtt(self):
        """
		NOTE: Be sure to enable CoAP by setting the following flag to True
		within PiotConfig.props
		enableMqttClient = True
		enableCoapClient = False
		
		"""
        ddMgr = DeviceDataManager()
        ddMgr.startManager()

        mqttClient = MqttClientConnector()
        mqttClient.connectClient()

        ad = ActuatorData()
        ad.setCommand(1)

        adJson = DataUtil().actuatorDataToJson(ad)

        mqttClient.publishMessage(ResourceNameEnum.CDA_ACTUATOR_CMD_RESOURCE,
                                  msg=adJson,
                                  qos=1)

        sleep(10)

        mqttClient.disconnectClient()
        ddMgr.stopManager()
Exemple #2
0
    def testStartAndStopManagerWithMqttAndCoap(self):
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=True)
        ddMgr.startManager()

        sleep(600000)

        ddMgr.stopManager()
Exemple #3
0
    def testStartAndStopManagerNoComms(self):
        ddMgr = DeviceDataManager(enableMqtt=False, enableCoap=False)
        ddMgr.startManager()

        sleep(30)

        ddMgr.stopManager()
 def __init__(self):
     """
     Initialization of class.
     
     @param path The name of the resource to apply to the URI.
     """
     logging.info("Initializing CDA...")
     self.devDataManager = DeviceDataManager()
    def testDeviceDataManagerIntegration(self):
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=False)
        ddMgr.startManager()

        # 5 min's should be long enough to run the tests and manually adjust the emulator values
        sleep(300)

        ddMgr.stopManager()
    def __init__(self):
        """
		Initialization of class.
		
		Create DeviceDataManager instance.
		"""
        logging.info("Initializing CDA...")
        self.devDataManager = DeviceDataManager()
Exemple #7
0
    def testDeviceDataManagerIntegration(self):
        # TODO: set either MQTT or CoAP to True - you'll only need one.
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=False)
        ddMgr.startManager()

        # 5 min's should be long enough to run the tests and manually adjust the emulator values
        sleep(300)

        ddMgr.stopManager()
Exemple #8
0
    def __init__(self):
        """
		Initialization of class.
		Create an instance of SystemPerformanceManager
		
		@param path The name of the resource to apply to the URI.
		"""
        logging.info("Initializing CDA...")
        self.devDataMgr = DeviceDataManager()
    def testActuatorDataCallback(self):
        ddMgr = DeviceDataManager()

        actuatorData = ActuatorData(typeID=ConfigConst.HVAC_ACTUATOR_TYPE)
        actuatorData.setCommand(ConfigConst.COMMAND_ON)
        actuatorData.setStateData("This is a test.")

        ddMgr.handleActuatorCommandMessage(actuatorData)

        sleep(10)
    def testStartAndStopManagerWithMqttAndCoap(self):
        ddMgr = DeviceDataManager(enableMqtt=False, enableCoap=False)

        actuatorData = ActuatorData(
            actuatorType=ActuatorData.HVAC_ACTUATOR_TYPE)
        actuatorData.setCommand(ActuatorData.COMMAND_ON)
        actuatorData.setStateData("This is a test.")

        ddMgr.handleActuatorCommandMessage(actuatorData)

        sleep(10)
    def testStartAndStopManagerWithCoap(self):
        """
		NOTE: Be sure to enable CoAP by setting the following flag to True
		within PiotConfig.props
		enableMqttClient = False
		enableCoapClient = True
		
		"""

        ddMgr = DeviceDataManager()
        ddMgr.startManager()

        sleep(60)

        ddMgr.stopManager()
Exemple #12
0
	def testStartAndStopManagerNoComms(self):
		"""
		NOTE: Be sure to disable MQTT and CoAP by setting the following flags to False
		within PiotConfig.props
		enableMqttClient = False
		enableCoapClient = False
		
		"""
		
		ddMgr = DeviceDataManager()
		ddMgr.startManager()
		
		sleep(120) # 2 minutes
		
		ddMgr.stopManager()