def test_cast(self, mock_client): client = mock.Mock() mock_client.return_value = client method = 'fake_method' kwargs = {'key': 'value'} rpcapi = rpc_client.ManagerClient() msg = rpcapi.make_msg(method, **kwargs) # with no version res = rpcapi.cast(self.context, msg) self.assertEqual(client, rpcapi._client) client.cast.assert_called_once_with(self.context, 'fake_method', key='value') self.assertEqual(res, client.cast.return_value) # with version res = rpcapi.cast(self.context, msg, version='123') client.prepare.assert_called_once_with(version='123') new_client = client.prepare.return_value new_client.cast.assert_called_once_with(self.context, 'fake_method', key='value') self.assertEqual(res, new_client.cast.return_value)
def setUp(self): messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) self.context = utils.dummy_context() # self.stubs = stubout.StubOutForTesting() self.rpcapi = rpc_client.ManagerClient() super(ManagerRpcAPITestCase, self).setUp()
def __init__(self, app, conf): super(PatchAPIController, self).__init__(app) self.ctxt = context.get_admin_context() self._default_dispatcher = APIDispatcher(app) self.rpc_client = dcmanager_rpc_client.ManagerClient() self.response_hander_map = { proxy_consts.PATCH_ACTION_UPLOAD: self.patch_upload_req, proxy_consts.PATCH_ACTION_UPLOAD_DIR: self.patch_upload_dir_req, proxy_consts.PATCH_ACTION_DELETE: self.patch_delete_req, proxy_consts.PATCH_ACTION_APPLY: self.notify, proxy_consts.PATCH_ACTION_COMMIT: self.notify, proxy_consts.PATCH_ACTION_REMOVE: self.notify, }
def __init__(self, subcloud_engine): super(SyncThread, self).__init__() self.endpoint_type = None # endpoint type in keystone self.subcloud_engine = subcloud_engine # engine that owns this obj self.thread = None # thread running sync() self.audit_thread = None self.status = STATUS_NEW # protected by condition lock self.audit_status = None # todo: needed? self.condition = threading.Condition() # used to wake up the thread self.ctxt = context.get_admin_context() self.sync_handler_map = {} self.master_region_name = consts.CLOUD_0 self.audit_resources = [] self.log_extra = { "instance": self.subcloud_engine.subcloud.region_name + ": " } self.dcmanager_rpc_client = dcmanager_rpc_client.ManagerClient() self.sync_status = dcmanager_consts.SYNC_STATUS_UNKNOWN self.subcloud_managed = False self.sc_admin_session = None self.admin_session = None self.ks_client = None
def __init__(self): super(SubcloudsController, self).__init__() self.rpc_client = rpc_client.ManagerClient()
def __init__(self): super(SwUpdateOptionsController, self).__init__() self.rpc_client = rpc_client.ManagerClient()