コード例 #1
0
  @Test
  public void testServiceNodeIsDeletedWhenRegistryIsClosed() throws Exception {
    ZooKeeperPersistentEphemeralNode node = mock(ZooKeeperPersistentEphemeralNode.class);
    when(_nodeFactory.create(anyString(), any(byte[].class))).thenReturn(node);

    _registry.register(FOO);

    _registry.close();

    verify(node).close(anyLong(), any(TimeUnit.class));
  }
コード例 #2
0
 @Test(expected = IllegalStateException.class)
 public void testUnregisterAfterClose() throws Exception {
   _registry.close();
   _registry.unregister(FOO);
 }
コード例 #3
0
 @After
 public void teardown() throws Exception {
   _registry.close();
 }