|
9 | 9 | import static org.mockito.ArgumentMatchers.anyInt;
|
10 | 10 | import static org.mockito.ArgumentMatchers.anyString;
|
11 | 11 | import static org.mockito.Mockito.doAnswer;
|
12 |
| -import static org.mockito.Mockito.doCallRealMethod; |
13 | 12 | import static org.mockito.Mockito.doNothing;
|
14 | 13 | import static org.mockito.Mockito.mock;
|
15 | 14 | import static org.mockito.Mockito.times;
|
|
38 | 37 | import com.linkedin.venice.utils.ComplementSet;
|
39 | 38 | import com.linkedin.venice.utils.VeniceProperties;
|
40 | 39 | import java.lang.reflect.Field;
|
| 40 | +import java.lang.reflect.InvocationTargetException; |
| 41 | +import java.lang.reflect.Method; |
41 | 42 | import java.util.ArrayList;
|
42 | 43 | import java.util.HashSet;
|
43 | 44 | import java.util.List;
|
@@ -168,7 +169,8 @@ public void testBootstrappingAwareCompletableFuture()
|
168 | 169 | }
|
169 | 170 |
|
170 | 171 | @Test
|
171 |
| - public void testBootstrappingSubscription() throws NoSuchFieldException, IllegalAccessException { |
| 172 | + public void testBootstrappingSubscription() |
| 173 | + throws IllegalAccessException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException { |
172 | 174 | DaVinciBackend backend = mock(DaVinciBackend.class);
|
173 | 175 | StorageService mockStorageService = mock(StorageService.class);
|
174 | 176 |
|
@@ -254,18 +256,20 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
|
254 | 256 | ingestionServiceField.set(backend, storeIngestionService);
|
255 | 257 | doNothing().when(ingestionBackend).addIngestionNotifier(any());
|
256 | 258 |
|
| 259 | + Method bootstrapMethod = DaVinciBackend.class.getDeclaredMethod("bootstrap"); |
| 260 | + bootstrapMethod.setAccessible(true); |
| 261 | + |
257 | 262 | // DA_VINCI_SUBSCRIBE_ON_DISK_PARTITIONS_AUTOMATICALLY == false
|
258 | 263 | when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(false);
|
259 |
| - doCallRealMethod().when(backend).bootstrap(); |
260 |
| - backend.bootstrap(); |
| 264 | + bootstrapMethod.invoke(backend); |
261 | 265 |
|
262 | 266 | ComplementSet<Integer> subscription = mockStoreBackend.getSubscription();
|
263 | 267 | assertTrue(subscription.contains(0));
|
264 | 268 | assertTrue(subscription.contains(1));
|
265 | 269 | assertFalse(subscription.contains(2));
|
266 | 270 |
|
267 | 271 | when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(true);
|
268 |
| - backend.bootstrap(); |
| 272 | + bootstrapMethod.invoke(backend); |
269 | 273 |
|
270 | 274 | // DA_VINCI_SUBSCRIBE_ON_DISK_PARTITIONS_AUTOMATICALLY == true
|
271 | 275 | subscription = mockStoreBackend.getSubscription();
|
|
0 commit comments