protected static String accessToken() { final SphereAccessTokenSupplier sphereAccessTokenSupplier = SphereAccessTokenSupplier.ofOneTimeFetchingToken(getSphereClientConfig(), newHttpClient(), true); final String accessToken = sphereAccessTokenSupplier.get().toCompletableFuture().join(); sphereAccessTokenSupplier.close(); return accessToken; }
protected static String accessToken() { final SphereAccessTokenSupplier sphereAccessTokenSupplier = SphereAccessTokenSupplier.ofOneTimeFetchingToken(getSphereClientConfig(), newHttpClient(), true); final String accessToken = sphereAccessTokenSupplier.get().toCompletableFuture().join(); sphereAccessTokenSupplier.close(); return accessToken; }
public static void setupClient() { if (client == null) { final SphereClientConfig config = getSphereClientConfig(); final HttpClient httpClient = newHttpClient(); final SphereAccessTokenSupplier tokenSupplier = SphereAccessTokenSupplier.ofAutoRefresh(config, httpClient, false); final SphereClient underlying = SphereClient.of(config, httpClient, tokenSupplier); final SphereClient underlying1 = withMaybeDeprecationWarnTool(underlying); client = BlockingSphereClient.of(underlying1, 30, TimeUnit.SECONDS); assertProjectSettingsAreFine(client); } } //
public static void setupClient() { if (client == null) { final SphereClientConfig config = getSphereClientConfig(); final HttpClient httpClient = newHttpClient(); final SphereAccessTokenSupplier tokenSupplier = SphereAccessTokenSupplier.ofAutoRefresh(config, httpClient, false); final SphereClient underlying = SphereClient.of(config, httpClient, tokenSupplier); final SphereClient underlying1 = withMaybeDeprecationWarnTool(underlying); client = BlockingSphereClient.of(underlying1, 20, TimeUnit.SECONDS); assertProjectSettingsAreFine(client); } }
@Test public void integrationTest() { final HttpClient httpClient = AsyncHttpClientAdapter.of(new AsyncHttpClient()); final SphereClientConfig sphereClientConfig = IntegrationTest.getSphereClientConfig(); final SphereClientFactory factory = SphereClientFactory.of(() -> httpClient); try (final BlockingSphereClient sphereClient = BlockingSphereClient.of(factory.createClient(sphereClientConfig), 10, TimeUnit.SECONDS)) { final Project project = sphereClient.executeBlocking(ProjectGet.of()); assertThat(project.getKey()).isEqualTo(sphereClientConfig.getProjectKey()); } } }