gpt4 book ai didi

com.github.robozonky.app.tenant.ZonkyApiTokenSupplier.close()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:32:15 28 4
gpt4 key购买 nike

本文整理了Java中com.github.robozonky.app.tenant.ZonkyApiTokenSupplier.close()方法的一些代码示例,展示了ZonkyApiTokenSupplier.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonkyApiTokenSupplier.close()方法的具体详情如下:
包路径:com.github.robozonky.app.tenant.ZonkyApiTokenSupplier
类名称:ZonkyApiTokenSupplier
方法名:close

ZonkyApiTokenSupplier.close介绍

暂无

代码示例

代码示例来源:origin: com.github.robozonky/robozonky-app

@Override
public void close() { // cancel existing tokens
  tokens.forEach((k, v) -> v.close());
}

代码示例来源:origin: RoboZonky/robozonky

@Override
public void close() {
  tokens.forEach((k, v) -> v.close()); // cancel existing tokens
  loanCache.get().close(); // clean up the cache
}

代码示例来源:origin: RoboZonky/robozonky

@Test
void closingNeverLoaded() {
  final Zonky zonky = mock(Zonky.class);
  final OAuth oAuth = mock(OAuth.class);
  final ZonkyApiToken token = getTokenExpiringIn(Duration.ofSeconds(5));
  when(oAuth.login(eq(OAuthScope.SCOPE_APP_WEB), eq(SECRETS.getUsername()), eq(SECRETS.getPassword())))
      .thenAnswer(invocation -> token);
  when(oAuth.refresh(any())).thenReturn(token);
  final ApiProvider api = mockApi(oAuth, zonky);
  final ZonkyApiTokenSupplier t = new ZonkyApiTokenSupplier(api, SECRETS);
  t.close();
  verify(oAuth, never()).login(any(), any(), any());
  verify(zonky, never()).logout();
  assertThatThrownBy(t::get).isInstanceOf(IllegalStateException.class);
}

代码示例来源:origin: RoboZonky/robozonky

@Test
  void notClosingWhenExpired() {
    final Zonky zonky = mock(Zonky.class);
    final OAuth oAuth = mock(OAuth.class);
    final ZonkyApiToken token = getTokenExpiringIn(Duration.ZERO);
    when(oAuth.login(eq(OAuthScope.SCOPE_APP_WEB), eq(SECRETS.getUsername()), eq(SECRETS.getPassword())))
        .thenAnswer(invocation -> token);
    final ApiProvider api = mockApi(oAuth, zonky);
    final ZonkyApiTokenSupplier t = new ZonkyApiTokenSupplier(api, SECRETS);
    t.close();
    verify(zonky, never()).logout();
  }
}

代码示例来源:origin: RoboZonky/robozonky

@Test
void closingLoaded() {
  final Zonky zonky = mock(Zonky.class);
  final OAuth oAuth = mock(OAuth.class);
  final ZonkyApiToken token = getTokenExpiringIn(Duration.ofSeconds(5));
  when(oAuth.login(eq(OAuthScope.SCOPE_APP_WEB), eq(SECRETS.getUsername()), eq(SECRETS.getPassword())))
      .thenAnswer(invocation -> token);
  when(oAuth.refresh(any())).thenReturn(token);
  final ApiProvider api = mockApi(oAuth, zonky);
  final ZonkyApiTokenSupplier t = new ZonkyApiTokenSupplier(api, SECRETS);
  t.get();
  verify(oAuth).login(any(), any(), any());
  assertThat(t.isClosed()).isFalse();
  t.close();
  verify(zonky, only()).logout();
  assertThat(t.isClosed()).isTrue();
  assertThatThrownBy(t::get).isInstanceOf(IllegalStateException.class);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com