@Test public void testDontRetryPersistentErrors() { InsertRetryPolicy policy = InsertRetryPolicy.retryTransientErrors(); assertTrue( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "unavailable")))); assertFalse(policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "invalid")))); assertFalse( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "invalidQuery")))); assertFalse( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "notImplemented")))); }
if (retryPolicy.shouldRetry(new InsertRetryPolicy.Context(error))) { allErrors.add(error); retryRows.add(rowsToPublish.get(errorIndex));
@Test public void testNeverRetry() { assertFalse( InsertRetryPolicy.neverRetry() .shouldRetry(new Context(new TableDataInsertAllResponse.InsertErrors()))); }
@Test public void testAlwaysRetry() { assertTrue( InsertRetryPolicy.alwaysRetry() .shouldRetry(new Context(new TableDataInsertAllResponse.InsertErrors()))); }
if (allErrors != null) { for (TableDataInsertAllResponse.InsertErrors errors : allErrors) { if (!retryPolicy.shouldRetry(new Context(errors))) { shouldInsert = false;