當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。