### Question:
XSiteResource implements ResourceHandler { private CompletionStage<RestResponse> cancelPushState(RestRequest restRequest) { return executeXSiteCacheOp(restRequest, CANCEL_PUSH_STATE); } XSiteResource(InvocationHelper invocationHelper); @Override Invocations getInvocations(); static final String AFTER_FAILURES_FIELD; static final String MIN_WAIT_FIELD; }### Answer:
@Test public void testCancelPushState() throws Exception { RestCacheClient cache = getCacheClient(LON); RestCacheClient backupCache = getCacheClient(NYC); takeBackupOffline(LON, NYC); assertEquals(OFFLINE, getBackupStatus(LON, NYC)); int entries = 50; IntStream.range(0, entries).forEach(i -> assertNoContent(cache.put(String.valueOf(i), "value"))); assertEquals(entries, getCacheSize(cache)); assertEquals(0, getCacheSize(backupCache)); ControlledTransport controllerTransport = ControlledTransport.replace(cache(LON, 0)); controllerTransport.blockBefore(XSiteStatePushCommand.class); assertSuccessful(cache.pushSiteState(NYC)); controllerTransport.waitForCommandToBlock(); assertSuccessful(cache.cancelPushState(NYC)); controllerTransport.stopBlocking(); Json status = jsonResponseBody(cache.pushStateStatus()); assertEquals("CANCELED", status.at(NYC).asString()); assertSuccessful(cache.clearPushStateStatus()); status = jsonResponseBody(cache.pushStateStatus()); assertTrue(status.asMap().isEmpty()); assertSuccessful(cache.cancelReceiveState(NYC)); }