Exemple #1
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     seed = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                           _SEED_DECODE_OFFSET)
     id = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                         _ID_DECODE_OFFSET)
     name = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return RaftGroupId(name, seed, id)
 def setUp(self):
     self.session_manager = MagicMock()
     self.context = MagicMock(proxy_session_manager=self.session_manager)
     self.semaphore = SessionlessSemaphore(
         self.context,
         RaftGroupId("name", 0, 42),
         SEMAPHORE_SERVICE,
         "semaphore@mygroup",
         "semaphore",
     ).blocking()
 def setUp(self):
     self.acquire_session = MagicMock()
     self.release_session = MagicMock()
     self.invalidate_session = MagicMock()
     self.session_manager = MagicMock(acquire_session=self.acquire_session, release_session=self.release_session,
                                      invalidate_session=self.invalidate_session)
     context = MagicMock(proxy_session_manager=self.session_manager)
     self.group_id = RaftGroupId("test", 0, 42)
     self.semaphore = SessionAwareSemaphore(context, self.group_id, SEMAPHORE_SERVICE, "semaphore@mygroup",
                                            "semaphore").blocking()
 def setUp(self):
     self.acquire_session = MagicMock()
     self.release_session = MagicMock()
     self.invalidate_session = MagicMock()
     self.session_manager = MagicMock(
         acquire_session=self.acquire_session,
         release_session=self.release_session,
         invalidate_session=self.invalidate_session)
     context = MagicMock(proxy_session_manager=self.session_manager)
     group_id = RaftGroupId("test", 0, 42)
     self.proxy = FencedLock(context, group_id, LOCK_SERVICE,
                             "mylock@mygroup", "mylock").blocking()
Exemple #5
0
 def setUpClass(cls):
     cls.group_id = 42
     cls.session_id = 24
     cls.raft_group_id = RaftGroupId("test", 0, cls.group_id)
 def setUpClass(cls):
     cls.group_id = RaftGroupId("test", 0, 42)