}
public void testPutWithFailures() {
populateKeys(cache("LON", 0));
BackupSenderImpl bs = (BackupSenderImpl) cache("LON", 0).getAdvancedCache().getComponentRegistry().getComponent(BackupSender.class);
OfflineStatus nycStatus = bs.getOfflineStatus("NYC");
for (int i = 0; i < FAILURES / nrRpcPerPut; i++) {
try {
assertEquals(BackupSender.BringSiteOnlineResponse.ALREADY_ONLINE, bs.bringSiteOnline("NYC"));
cache("LON", 0).put(KEYS[i], "v" + i);
fail("This should have failed");
} catch (Exception e) {
Assert.assertEquals(i + 1, nycStatus.getFailureCount());
}
}
assert nycStatus.isOffline();
for (int i = 0; i < FAILURES; i++) {
cache("LON", 0).put(KEYS[i], "v" + i);
}