Beispiel #1
0
    def __init__(self, ctx: ActorRuntimeContext):
        self._runtime_ctx = ctx
        self._message_serializer = self._runtime_ctx.message_serializer

        self._active_actors: Dict[str, Actor] = {}
        self._active_actors_lock = asyncio.Lock()

        self._dispatcher = ActorMethodDispatcher(ctx.actor_type_info)
        self._timer_method_context = ActorMethodContext.create_for_timer(TIMER_METHOD_NAME)
        self._reminder_method_context = ActorMethodContext.create_for_reminder(REMINDER_METHOD_NAME)
 def test_dispatch(self):
     dispatcher = ActorMethodDispatcher(self._testActorTypeInfo)
     actorInstance = FakeSimpleActor(self._fake_runtime_ctx, None)
     result = _run(dispatcher.dispatch(actorInstance, "ActorMethod", 10))
     self.assertEqual({'name': 'actor_method'}, result)
 def test_get_return_type(self):
     dispatcher = ActorMethodDispatcher(self._testActorTypeInfo)
     arg_names = dispatcher.get_return_type("ActorMethod")
     self.assertEqual(dict, arg_names)
 def test_get_arg_types(self):
     dispatcher = ActorMethodDispatcher(self._testActorTypeInfo)
     arg_names = dispatcher.get_arg_types("ActorMethod")
     self.assertEqual([int], arg_names)