Merge "Don't shade org.eclipse.jgit.transport package" into stable-3.6
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
index dd06875..991ef07 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
@@ -91,7 +91,12 @@
try {
state.markAllFetchTasksScheduled();
Future<?> future = source.get().schedule(name, refName, state, fetchType, apiRequestMetrics);
- future.get(source.get().getTimeout(), TimeUnit.SECONDS);
+ int timeout = source.get().getTimeout();
+ if (timeout == 0) {
+ future.get();
+ } else {
+ future.get(timeout, TimeUnit.SECONDS);
+ }
} catch (ExecutionException
| IllegalStateException
| TimeoutException
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
index c093719..de8036e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
@@ -125,7 +125,7 @@
@Test
public void shouldUpdateStateWhenInterruptedException()
throws InterruptedException, ExecutionException, TimeoutException {
- when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(new InterruptedException());
+ when(future.get()).thenThrow(new InterruptedException());
when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
.thenReturn(future);
@@ -140,8 +140,7 @@
@Test
public void shouldUpdateStateWhenExecutionException()
throws InterruptedException, ExecutionException, TimeoutException {
- when(future.get(anyLong(), eq(TimeUnit.SECONDS)))
- .thenThrow(new ExecutionException(new Exception()));
+ when(future.get()).thenThrow(new ExecutionException(new Exception()));
when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
.thenReturn(future);
@@ -159,6 +158,7 @@
when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(new TimeoutException());
when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
.thenReturn(future);
+ when(source.getTimeout()).thenReturn(1);
TimeoutException e =
assertThrows(