当前位置: 首页>>代码示例>>Python>>正文


Python Util.ACSCorba类代码示例

本文整理汇总了Python中Acspy.Util.ACSCorba的典型用法代码示例。如果您正苦于以下问题:Python ACSCorba类的具体用法?Python ACSCorba怎么用?Python ACSCorba使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ACSCorba类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: shutdown

    def shutdown(self, action):
        '''
        Shutdown the Container.

        Normally invoked via CORBA but can also "self terminate" so to speak.

        Parameters:
        - action is an encrypted value that tells the container what action to take

        oneway void shutdown (in unsigned long action)
        '''
        action = (action >> 8) & 0xFF

        if (action == ACTIVATOR_EXIT) or (action == ACTIVATOR_REBOOT) or (action == ACTIVATOR_RELOAD):

            self.logger.logTrace("Shutting down container: " + self.name)

            #Logout from manager
            ACSCorba.getManager().logout(self.token.h)

            if (action == ACTIVATOR_REBOOT) or (action == ACTIVATOR_RELOAD):
                print "Container.shutdown(): Action may not work correctly...-", str(action)
                self.__init__(self.name)
            else:
                #tell the main thread of execution to stop
                self.running = 0
                Log.stopPeriodicFlush()
        else:
            self.logger.logWarning("Unable to process 'shutdown' request at this time: " + str(action))
        
        # Close the alarm interface factory
        Acsalarmpy.AlarmSystemInterfaceFactory.done()
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: test_ok

 def test_ok(self, getorbmock, nilmock, corbalocmock):
     nilmock.return_value = False
     objmock = mock.Mock(spec=ACSCorba.CORBA.Object)
     orbmock = mock.Mock(spec=ACSCorba.CORBA.ORB)
     orbmock.string_to_object.return_value = objmock
     getorbmock.return_value = orbmock
     self.assertEqual(False, ACSCorba.getManager() is None)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: test_orb_fault

    def test_orb_fault(self, getorbmock, corbalocmock):
        def raiser(*args):
            raise Exception("Boom!")

        orbmock = mock.Mock(spec=ACSCorba.CORBA.ORB)
        orbmock.string_to_object.side_effect = raiser
        getorbmock.return_value = orbmock
        self.assertEqual(True, ACSCorba.getManager() is None)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: test_init_fault

    def test_init_fault(self, getorbmock):
        def raiser(*args):
            raise Exception("Boom!")

        orbmock = mock.Mock(spec=ACSCorba.CORBA.ORB)
        orbmock.resolve_initial_references.side_effect = raiser
        getorbmock.return_value = orbmock
        self.assertEqual(True, ACSCorba.getPOARoot() is None)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: test_client_init_pydoc

    def test_client_init_pydoc(self, corbaRef, poaManager, manager):
        manager.return_value = None

        sys.argv.insert(0, 'pydoc')
        mockManager.side_effect = manager_side_effect
        client = ACSCorba._Client()
        sys.argv.pop()
        self.assertEqual(True , client.token is None)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6: test_obj_fault

    def test_obj_fault(self, getorbmock, nilmock, corbalocmock):
        def raiser(*args):
            raise Exception("Boom!")

        nilmock.return_value = False
        objmock = mock.Mock(spec=ACSCorba.CORBA.Object)
        objmock._non_existent.side_effect = raiser
        orbmock = mock.Mock(spec=ACSCorba.CORBA.ORB)
        orbmock.string_to_object.return_value = objmock
        getorbmock.return_value = orbmock
        self.assertEqual(True, ACSCorba.getManager() is None)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例7: getManagerHost

    def getManagerHost(self): # pragma: NO COVER
        '''
        Helper function returns a string consisting of managers host.

        Return: hostname where manager is running.

        Raises: ???
        '''
        temp = ACSCorba.getManagerCorbaloc()
        # words end up as ['corbaloc', '', 'condor', 'xxxx/Manager']
        words = temp.split(':')
        return words[2]
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: createPOAForComponent

    def createPOAForComponent(self, comp_name): # pragma: NO COVER
        '''
        Creates a new POA that is responsible for exactly one component and
        the new POA is created as a child of the ComponentPOA.

        Parameters: comp_name is the components stringified name.

        Return: a new POA.

        Raises: ???
        '''
        return self.componentPOA.create_POA("ComponentPOA" + comp_name, ACSCorba.getPOAManager(), self.compPolicies)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例9: configCORBA

    def configCORBA(self): # pragma: NO COVER
        '''
        configCORBA is a helper method responsible for initializing the ORB,
        POAs, etc.

        Parameters: None

        Return: None

        Raises: ???
        '''

        #Create the Container's POA
        try:
            cont_policies = []  #CORBA.PolicyList
            cont_policies.append(ACSCorba.getPOARoot().create_id_assignment_policy(PortableServer.USER_ID))
            cont_policies.append(ACSCorba.getPOARoot().create_lifespan_policy(PortableServer.PERSISTENT))
            cont_policies.append(ACSCorba.getPOARoot().create_request_processing_policy(PortableServer.USE_ACTIVE_OBJECT_MAP_ONLY))
            cont_policies.append(ACSCorba.getPOARoot().create_servant_retention_policy(PortableServer.RETAIN))
            self.containerPOA = ACSCorba.getPOARoot().create_POA("ContainerPOA", ACSCorba.getPOAManager(), cont_policies)
            for policy in cont_policies:
                policy.destroy()
        except Exception, e:
            self.logger.logWarning("Unable to create the container's POA - " + str(e))
            print_exc()
            raise CouldntCreateObjectExImpl()
开发者ID:,项目名称:,代码行数:26,代码来源:

示例10: test_no_args_or_env

 def test_no_args_or_env(self, managerportmock, ipmock):
     ipmock.return_value = '127.0.0.1'
     managerportmock.return_value = '3000'
     self.assertEqual('corbaloc::127.0.0.1:3000/Manager',
                      ACSCorba.getManagerCorbaloc())
开发者ID:,项目名称:,代码行数:5,代码来源:

示例11: test_new_corbaloc

 def test_new_corbaloc(self):
     self.assertEqual('foo', ACSCorba.getManagerCorbaloc('foo'))
开发者ID:,项目名称:,代码行数:2,代码来源:

示例12: test_manager_exists

 def test_manager_exists(self):
     ACSCorba.MGR_CORBALOC = 'foo'
     self.assertEqual('foo', ACSCorba.getManagerCorbaloc())
开发者ID:,项目名称:,代码行数:3,代码来源:

示例13: setUp

 def setUp(self, corbaRef, poaManager, manager):
     manager.return_value = mock.Mock(spec=ACSCorba.maci._objref_Manager)
     corbaRef.return_value = mock.Mock(spec=ACSCorba.maci__POA.omniORB.PortableServer.POA)
     self.client = ACSCorba._Client()
开发者ID:,项目名称:,代码行数:4,代码来源:

示例14: test_create_fault

    def test_create_fault(self, clientmock):
        def raiser(*args):
            raise Exception("Boom!")

        clientmock.side_effect = raiser
        self.assertEqual(True, ACSCorba.getClient() is None)
开发者ID:,项目名称:,代码行数:6,代码来源:

示例15: test_orb_exists

 def test_orb_exists(self):
     ACSCorba.ORB = 'foo'
     self.assertEqual('foo', ACSCorba.getORB())
开发者ID:,项目名称:,代码行数:3,代码来源:


注:本文中的Acspy.Util.ACSCorba类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。