@Test public void testPushAllCaches() { RestClient restClientLon = clientPerSite.get(LON); RestClient restClientSfo = clientPerSite.get(SFO); RestCacheClient cache1Lon = restClientLon.cache(CACHE_1); RestCacheClient cache2Lon = restClientLon.cache(CACHE_2); RestCacheClient cache1Sfo = restClientSfo.cache(CACHE_1); RestCacheClient cache2Sfo = restClientSfo.cache(CACHE_2); assertSuccessful(restClientLon.cacheManager(CACHE_MANAGER).takeOffline(SFO)); Json backupStatuses = jsonResponseBody(restClientLon.cacheManager(CACHE_MANAGER).backupStatuses()); assertEquals("offline", backupStatuses.at(SFO).at("status").asString()); int entries = 10; IntStream.range(0, entries).forEach(i -> { String key = String.valueOf(i); String value = "value"; assertNoContent(cache1Lon.put(key, value)); assertNoContent(cache2Lon.put(key, value)); }); assertEquals(0, getCacheSize(cache1Sfo)); assertEquals(0, getCacheSize(cache2Sfo)); assertSuccessful(restClientLon.cacheManager(CACHE_MANAGER).pushSiteState(SFO)); assertEquals(ONLINE, getBackupStatus(LON, SFO)); eventuallyEquals("OK", () -> pushStateStatus(cache1Lon, SFO)); eventuallyEquals("OK", () -> pushStateStatus(cache2Lon, SFO)); assertEquals(entries, getCacheSize(cache1Sfo)); assertEquals(entries, getCacheSize(cache2Sfo)); }
private CompletionStage<RestResponse> pushStateStatus(RestRequest request) { return statusOperation(request, PUSH_STATE_STATUS); }
XSiteResource implements ResourceHandler { private CompletionStage<RestResponse> pushStateStatus(RestRequest request) { return statusOperation(request, PUSH_STATE_STATUS); } }
XSiteResource implements ResourceHandler { private CompletionStage<RestResponse> pushStateStatus(RestRequest request) { return statusOperation(request, PUSH_STATE_STATUS); } XSiteResource(InvocationHelper invocationHelper); }
XSiteResource implements ResourceHandler { private CompletionStage<RestResponse> pushStateStatus(RestRequest request) { return statusOperation(request, PUSH_STATE_STATUS); } XSiteResource(InvocationHelper invocationHelper); @Override Invocations getInvocations(); }
XSiteResource implements ResourceHandler { private CompletionStage<RestResponse> pushStateStatus(RestRequest request) { return statusOperation(request, PUSH_STATE_STATUS); } XSiteResource(InvocationHelper invocationHelper); @Override Invocations getInvocations(); static final String AFTER_FAILURES_FIELD; static final String MIN_WAIT_FIELD; }