コード例 #1
0
 def setUp(self):
     self._path_manager = PathManager()
     self._path_manager.dataPath = "."
     self._persistenceLayer = PersistenceLayer(
         pathManager=self._path_manager)
     self.deviceManager = DeviceManager(self._persistenceLayer)
     #yield self._persistenceLayer.setup()
     yield self.deviceManagers.setup()
コード例 #2
0
ファイル: environment.py プロジェクト: kaosat-dev/Pollapli
 def __init__(self,parent = None, persistenceLayer= None, name="home",description="Add Description here",status="active",*args,**kwargs):
     BaseComponent.__init__(self, parent)
     self._persistenceLayer = persistenceLayer
     self.name=name
     self.description=description
     self.status=status
     self._devices=DeviceManager(self)
     self._tasks=TaskManager(self)
コード例 #3
0
class Test_device_manager(unittest.TestCase):
    @defer.inlineCallbacks
    def setUp(self):
        self._path_manager = PathManager()
        self._path_manager.dataPath = "."
        self._persistenceLayer = PersistenceLayer(
            pathManager=self._path_manager)
        self.deviceManager = DeviceManager(self._persistenceLayer)
        #yield self._persistenceLayer.setup()
        yield self.deviceManagers.setup()

    def tearDown(self):
        self.deviceManager.teardown()
        self._persistenceLayer.tearDown()
        if os.path.exists("pollapli.db"):
            os.remove("pollapli.db")
コード例 #4
0
 def setUp(self):
     self._path_manager = PathManager()
     self._path_manager.dataPath = "."
     self._persistenceLayer = PersistenceLayer(pathManager = self._path_manager)
     self.deviceManager=DeviceManager(self._persistenceLayer)
     #yield self._persistenceLayer.setup()
     yield self.deviceManagers.setup()
コード例 #5
0
class Test_device_manager(unittest.TestCase):
    
    @defer.inlineCallbacks
    def setUp(self):
        self._path_manager = PathManager()
        self._path_manager.dataPath = "."
        self._persistenceLayer = PersistenceLayer(pathManager = self._path_manager)
        self.deviceManager=DeviceManager(self._persistenceLayer)
        #yield self._persistenceLayer.setup()
        yield self.deviceManagers.setup()
        
    def tearDown(self):
        self.deviceManager.teardown()
        self._persistenceLayer.tearDown()
        if os.path.exists("pollapli.db"):
            os.remove("pollapli.db")
コード例 #6
0
ファイル: environment.py プロジェクト: kaosat-dev/Pollapli
 def __init__(
     self,
     parent=None,
     persistenceLayer=None,
     name="home",
     description="Add Description here",
     status="active",
     *args,
     **kwargs
 ):
     BaseComponent.__init__(self, parent)
     self._persistenceLayer = persistenceLayer
     self.name = name
     self.description = description
     self.status = status
     self._devices = DeviceManager(self)
     self._tasks = TaskManager(self)
コード例 #7
0
ファイル: environment.py プロジェクト: kaosat-dev/Pollapli
class Environment(BaseComponent):
    def __init__(self,parent = None, persistenceLayer= None, name="home",description="Add Description here",status="active",*args,**kwargs):
        BaseComponent.__init__(self, parent)
        self._persistenceLayer = persistenceLayer
        self.name=name
        self.description=description
        self.status=status
        self._devices=DeviceManager(self)
        self._tasks=TaskManager(self)
        
    def __eq__(self, other):
        return self.cid == other.cid and self.name == other.name and self.description == other.description and self.status == other.status
    
    def __ne__(self, other):
        return not self.__eq__(other)
    
    def __str__(self):
        return "%s %s %s" %(self.name,self.description,self.status)
    
    def __getattr__(self, attr_name):
        if hasattr(self._devices, attr_name):
            return getattr(self._devices, attr_name)
        elif hasattr(self._tasks, attr_name):
            return getattr(self._tasks, attr_name)
        else:
            raise AttributeError(attr_name)
    """
    ####################################################################################
    Configuration and shutdown methods
    """
    @defer.inlineCallbacks
    def setup(self):
        """
        Method configuring additional elements of the current environment
        """
        yield self._devices.setup()
        yield self._tasks.setup()
        log.msg("Environment ",self.name ,"with id", self.cid," setup correctly", logLevel=logging.CRITICAL, system="environment")

    def teardown(self):
        """
コード例 #8
0
ファイル: environment.py プロジェクト: kaosat-dev/Pollapli
class Environment(BaseComponent):
    def __init__(
        self,
        parent=None,
        persistenceLayer=None,
        name="home",
        description="Add Description here",
        status="active",
        *args,
        **kwargs
    ):
        BaseComponent.__init__(self, parent)
        self._persistenceLayer = persistenceLayer
        self.name = name
        self.description = description
        self.status = status
        self._devices = DeviceManager(self)
        self._tasks = TaskManager(self)

    def __eq__(self, other):
        return (
            self.cid == other.cid
            and self.name == other.name
            and self.description == other.description
            and self.status == other.status
        )

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        return "%s %s %s" % (self.name, self.description, self.status)

    def __getattr__(self, attr_name):
        if hasattr(self._devices, attr_name):
            return getattr(self._devices, attr_name)
        elif hasattr(self._tasks, attr_name):
            return getattr(self._tasks, attr_name)
        else:
            raise AttributeError(attr_name)

    """
    ####################################################################################
    Configuration and shutdown methods
    """

    @defer.inlineCallbacks
    def setup(self):
        """
        Method configuring additional elements of the current environment
        """
        yield self._devices.setup()
        yield self._tasks.setup()
        log.msg(
            "Environment ",
            self.name,
            "with id",
            self.cid,
            " setup correctly",
            logLevel=logging.CRITICAL,
            system="environment",
        )

    def teardown(self):
        """