@Test public void shouldGetSyncingStatusSyncing() throws Exception { GetSyncing handler = new GetSyncing(syncDataProvider, jsonProvider); when(syncService.getSyncStatus()).thenReturn(getSyncStatus(true, 1, 7, 10)); handler.handle(context); verifyCacheStatus(CACHE_NONE); SyncingResponse response = getResponseObject(SyncingResponse.class); assertThat(response.data.headSlot).isEqualTo(UInt64.valueOf(7)); assertThat(response.data.syncDistance).isEqualTo(UInt64.valueOf(3)); }
@OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(new SyncingResponse(syncProvider.getSyncing()))); }
GetSyncing implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(new SyncingResponse(syncProvider.getSyncing()))); } }
GetSyncing implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(new SyncingResponse(syncProvider.getSyncing()))); } GetSyncing(final DataProvider provider, final JsonProvider jsonProvider);   GetSyncing(final SyncDataProvider syncProvider, final JsonProvider jsonProvider); }
GetSyncing implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(new SyncingResponse(syncProvider.getSyncing()))); } GetSyncing(final DataProvider provider, final JsonProvider jsonProvider);   GetSyncing(final SyncDataProvider syncProvider, final JsonProvider jsonProvider); @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override void handle(@NotNull final Context ctx); }
GetSyncing implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(new SyncingResponse(syncProvider.getSyncing()))); } GetSyncing(final DataProvider provider, final JsonProvider jsonProvider);   GetSyncing(final SyncDataProvider syncProvider, final JsonProvider jsonProvider); @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node syncing status", description = "Requests the beacon node to describe if it's currently syncing or not, " + "and if it is, what block it is up to.", tags = {TAG_V1_NODE, TAG_VALIDATOR_REQUIRED}, responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingResponse.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override void handle(@NotNull final Context ctx); static final String ROUTE; }