3636import static org .mockito .Mockito .atLeastOnce ;
3737import static org .mockito .Mockito .mock ;
3838import static org .mockito .Mockito .never ;
39- import static org .mockito .Mockito .timeout ;
39+ import static org .mockito .Mockito .times ;
4040import static org .mockito .Mockito .verify ;
4141
4242import com .google .common .collect .ImmutableMap ;
@@ -196,7 +196,7 @@ public void verify_basic_config() {
196196 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
197197 serverName , serverName , nameResolverArgs , scheduler );
198198
199- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
199+ verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
200200 testWatcher .verifyStats (1 , 0 );
201201 }
202202
@@ -206,13 +206,13 @@ public void verify_config_update() {
206206 serverName , serverName , nameResolverArgs , scheduler );
207207
208208 InOrder inOrder = Mockito .inOrder (xdsConfigWatcher );
209- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
209+ inOrder .verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
210210 testWatcher .verifyStats (1 , 0 );
211211 assertThat (testWatcher .lastConfig ).isEqualTo (defaultXdsConfig );
212212
213213 XdsTestUtils .setAdsConfig (controlPlaneService , serverName , "RDS2" , "CDS2" , "EDS2" ,
214214 ENDPOINT_HOSTNAME + "2" , ENDPOINT_PORT + 2 );
215- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (ArgumentMatchers .notNull ());
215+ inOrder .verify (xdsConfigWatcher ).onUpdate (ArgumentMatchers .notNull ());
216216 testWatcher .verifyStats (2 , 0 );
217217 assertThat (testWatcher .lastConfig ).isNotEqualTo (defaultXdsConfig );
218218 }
@@ -222,7 +222,7 @@ public void verify_simple_aggregate() {
222222 InOrder inOrder = Mockito .inOrder (xdsConfigWatcher );
223223 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
224224 serverName , serverName , nameResolverArgs , scheduler );
225- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
225+ inOrder .verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
226226
227227 List <String > childNames = Arrays .asList ("clusterC" , "clusterB" , "clusterA" );
228228 String rootName = "root_c" ;
@@ -233,7 +233,7 @@ public void verify_simple_aggregate() {
233233 ADS_TYPE_URL_RDS , ImmutableMap .of (XdsTestUtils .RDS_NAME , routeConfig ));
234234
235235 XdsTestUtils .setAggregateCdsConfig (controlPlaneService , serverName , rootName , childNames );
236- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
236+ inOrder .verify (xdsConfigWatcher ).onUpdate (any ());
237237
238238 Map <String , StatusOr <XdsClusterConfig >> lastConfigClusters =
239239 testWatcher .lastConfig .getClusters ();
@@ -281,13 +281,13 @@ public void testComplexRegisteredAggregate() throws IOException {
281281
282282 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
283283 serverName , serverName , nameResolverArgs , scheduler );
284- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
284+ inOrder .verify (xdsConfigWatcher ).onUpdate (any ());
285285
286286 Closeable subscription1 = xdsDependencyManager .subscribeToCluster (rootName1 );
287- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
287+ inOrder .verify (xdsConfigWatcher ).onUpdate (any ());
288288
289289 Closeable subscription2 = xdsDependencyManager .subscribeToCluster (rootName2 );
290- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
290+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
291291 testWatcher .verifyStats (3 , 0 );
292292 ImmutableSet .Builder <String > builder = ImmutableSet .builder ();
293293 Set <String > expectedClusters = builder .add (rootName1 ).add (rootName2 ).add (CLUSTER_NAME )
@@ -297,23 +297,23 @@ public void testComplexRegisteredAggregate() throws IOException {
297297
298298 // Close 1 subscription shouldn't affect the other or RDS subscriptions
299299 subscription1 .close ();
300- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
300+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
301301 builder = ImmutableSet .builder ();
302302 Set <String > expectedClusters2 =
303303 builder .add (rootName2 ).add (CLUSTER_NAME ).addAll (childNames2 ).build ();
304304 assertThat (xdsUpdateCaptor .getValue ().getValue ().getClusters ().keySet ())
305305 .isEqualTo (expectedClusters2 );
306306
307307 subscription2 .close ();
308- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
308+ inOrder .verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
309309 }
310310
311311 @ Test
312312 public void testDelayedSubscription () {
313313 InOrder inOrder = Mockito .inOrder (xdsConfigWatcher );
314314 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
315315 serverName , serverName , nameResolverArgs , scheduler );
316- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
316+ inOrder .verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
317317
318318 String rootName1 = "root_c" ;
319319
@@ -362,7 +362,7 @@ public void testMissingCdsAndEds() {
362362 serverName , serverName , nameResolverArgs , scheduler );
363363
364364 fakeClock .forwardTime (16 , TimeUnit .SECONDS );
365- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
365+ verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
366366
367367 List <StatusOr <XdsClusterConfig >> returnedClusters = new ArrayList <>();
368368 for (String childName : childNames ) {
@@ -395,7 +395,7 @@ public void testMissingLds() {
395395 serverName , ldsName , nameResolverArgs , scheduler );
396396
397397 fakeClock .forwardTime (16 , TimeUnit .SECONDS );
398- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (
398+ verify (xdsConfigWatcher ).onUpdate (
399399 argThat (StatusOrMatcher .hasStatus (statusHasCode (Status .Code .UNAVAILABLE )
400400 .andDescriptionContains (ldsName ))));
401401
@@ -411,7 +411,7 @@ public void testTcpListenerErrors() {
411411 serverName , serverName , nameResolverArgs , scheduler );
412412
413413 fakeClock .forwardTime (16 , TimeUnit .SECONDS );
414- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (
414+ verify (xdsConfigWatcher ).onUpdate (
415415 argThat (StatusOrMatcher .hasStatus (
416416 statusHasCode (Status .Code .UNAVAILABLE ).andDescriptionContains ("Not an API listener" ))));
417417
@@ -429,7 +429,7 @@ public void testMissingRds() {
429429 serverName , serverName , nameResolverArgs , scheduler );
430430
431431 fakeClock .forwardTime (16 , TimeUnit .SECONDS );
432- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (
432+ verify (xdsConfigWatcher ).onUpdate (
433433 argThat (StatusOrMatcher .hasStatus (statusHasCode (Status .Code .UNAVAILABLE )
434434 .andDescriptionContains (rdsName ))));
435435
@@ -446,7 +446,7 @@ public void testUpdateToMissingVirtualHost() {
446446 serverName , serverName , nameResolverArgs , scheduler );
447447
448448 // Update with a config that has a virtual host that doesn't match the server name
449- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
449+ verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
450450 assertThat (xdsUpdateCaptor .getValue ().getStatus ().getDescription ())
451451 .contains ("Failed to find virtual host matching hostname: " + serverName );
452452
@@ -461,7 +461,7 @@ public void testCorruptLds() {
461461 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
462462 serverName , ldsResourceName , nameResolverArgs , scheduler );
463463
464- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (
464+ verify (xdsConfigWatcher ).onUpdate (
465465 argThat (StatusOrMatcher .hasStatus (
466466 statusHasCode (Status .Code .UNAVAILABLE ).andDescriptionContains (ldsResourceName ))));
467467
@@ -474,14 +474,14 @@ public void testChangeRdsName_fromLds() {
474474 InOrder inOrder = Mockito .inOrder (xdsConfigWatcher );
475475 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
476476 serverName , serverName , nameResolverArgs , scheduler );
477- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
477+ inOrder .verify (xdsConfigWatcher ).onUpdate (StatusOr .fromValue (defaultXdsConfig ));
478478
479479 String newRdsName = "newRdsName1" ;
480480
481481 Listener clientListener = buildInlineClientListener (newRdsName , CLUSTER_NAME );
482482 controlPlaneService .setXdsConfig (ADS_TYPE_URL_LDS ,
483483 ImmutableMap .of (serverName , clientListener ));
484- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
484+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
485485 assertThat (xdsUpdateCaptor .getValue ().getValue ()).isNotEqualTo (defaultXdsConfig );
486486 assertThat (xdsUpdateCaptor .getValue ().getValue ().getVirtualHost ().name ()).isEqualTo (newRdsName );
487487 }
@@ -530,7 +530,7 @@ public void testMultipleParentsInCdsTree() throws IOException {
530530 InOrder inOrder = Mockito .inOrder (xdsConfigWatcher );
531531 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
532532 serverName , serverName , nameResolverArgs , scheduler );
533- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
533+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
534534 XdsConfig initialConfig = xdsUpdateCaptor .getValue ().getValue ();
535535
536536 // Make sure that adding subscriptions that rds points at doesn't change the config
@@ -551,12 +551,12 @@ public void testMultipleParentsInCdsTree() throws IOException {
551551 XdsTestUtils .buildRouteConfiguration (serverName , XdsTestUtils .RDS_NAME , "clusterA11" );
552552 controlPlaneService .setXdsConfig (
553553 ADS_TYPE_URL_RDS , ImmutableMap .of (XdsTestUtils .RDS_NAME , newRouteConfig ));
554- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
554+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
555555 assertThat (xdsUpdateCaptor .getValue ().getValue ().getClusters ().keySet ().size ()).isEqualTo (4 );
556556
557557 // Now that it is released, we should only have A11
558558 rootSub .close ();
559- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
559+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
560560 assertThat (xdsUpdateCaptor .getValue ().getValue ().getClusters ().keySet ())
561561 .containsExactly ("clusterA11" );
562562 }
@@ -591,7 +591,7 @@ public void testMultipleCdsReferToSameEds() {
591591 // Start the actual test
592592 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
593593 serverName , serverName , nameResolverArgs , scheduler );
594- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
594+ verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
595595 XdsConfig initialConfig = xdsUpdateCaptor .getValue ().getValue ();
596596 assertThat (initialConfig .getClusters ().keySet ())
597597 .containsExactly ("root" , "clusterA" , "clusterB" );
@@ -643,7 +643,7 @@ public void testChangeRdsName_FromLds_complexTree() {
643643 Listener clientListener = buildInlineClientListener (newRdsName , "root" );
644644 controlPlaneService .setXdsConfig (ADS_TYPE_URL_LDS ,
645645 ImmutableMap .of (serverName , clientListener ));
646- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
646+ inOrder .verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
647647 XdsConfig config = xdsUpdateCaptor .getValue ().getValue ();
648648 assertThat (config .getVirtualHost ().name ()).isEqualTo (newRdsName );
649649 assertThat (config .getClusters ().size ()).isEqualTo (4 );
@@ -655,7 +655,7 @@ public void testChangeAggCluster() {
655655
656656 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
657657 serverName , serverName , nameResolverArgs , scheduler );
658- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
658+ inOrder .verify (xdsConfigWatcher ).onUpdate (any ());
659659
660660 // Setup initial config A -> A1 -> (A11, A12)
661661 Cluster rootCluster =
@@ -699,7 +699,7 @@ public void testChangeAggCluster() {
699699 // Verify that the config is updated as expected
700700 ClusterNameMatcher nameMatcher
701701 = new ClusterNameMatcher (Arrays .asList ("root" , "clusterA21" , "clusterA22" ));
702- inOrder .verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (argThat (nameMatcher ));
702+ inOrder .verify (xdsConfigWatcher ).onUpdate (argThat (nameMatcher ));
703703 }
704704
705705 @ Test
@@ -710,7 +710,7 @@ public void testCdsError() throws IOException {
710710 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
711711 serverName , serverName , nameResolverArgs , scheduler );
712712
713- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (xdsUpdateCaptor .capture ());
713+ verify (xdsConfigWatcher ).onUpdate (xdsUpdateCaptor .capture ());
714714 Status status = xdsUpdateCaptor .getValue ().getValue ()
715715 .getClusters ().get (CLUSTER_NAME ).getStatus ();
716716 assertThat (status .getDescription ()).contains (XdsTestUtils .CLUSTER_NAME );
@@ -724,7 +724,7 @@ public void ldsUpdateAfterShutdown() {
724724 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
725725 serverName , serverName , nameResolverArgs , scheduler );
726726
727- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
727+ verify (xdsConfigWatcher ).onUpdate (any ());
728728
729729 @ SuppressWarnings ("unchecked" )
730730 XdsClient .ResourceWatcher <XdsListenerResource .LdsUpdate > resourceWatcher =
@@ -734,7 +734,7 @@ public void ldsUpdateAfterShutdown() {
734734 serverName ,
735735 resourceWatcher ,
736736 MoreExecutors .directExecutor ());
737- verify (resourceWatcher , timeout ( 5000 ) ).onChanged (any ());
737+ verify (resourceWatcher ).onChanged (any ());
738738
739739 syncContext .execute (() -> {
740740 // Shutdown before any updates. This will unsubscribe from XdsClient, but only after this
@@ -743,7 +743,7 @@ public void ldsUpdateAfterShutdown() {
743743
744744 XdsTestUtils .setAdsConfig (controlPlaneService , serverName , "RDS2" , "CDS" , "EDS" ,
745745 ENDPOINT_HOSTNAME , ENDPOINT_PORT );
746- verify (resourceWatcher , timeout ( 5000 ). times (2 )).onChanged (any ());
746+ verify (resourceWatcher , times (2 )).onChanged (any ());
747747 xdsClient .cancelXdsResourceWatch (
748748 XdsListenerResource .getInstance (), serverName , resourceWatcher );
749749 });
@@ -757,7 +757,7 @@ public void rdsUpdateAfterShutdown() {
757757 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
758758 serverName , serverName , nameResolverArgs , scheduler );
759759
760- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
760+ verify (xdsConfigWatcher ).onUpdate (any ());
761761
762762 @ SuppressWarnings ("unchecked" )
763763 XdsClient .ResourceWatcher <XdsRouteConfigureResource .RdsUpdate > resourceWatcher =
@@ -767,7 +767,7 @@ public void rdsUpdateAfterShutdown() {
767767 "RDS" ,
768768 resourceWatcher ,
769769 MoreExecutors .directExecutor ());
770- verify (resourceWatcher , timeout ( 5000 ) ).onChanged (any ());
770+ verify (resourceWatcher ).onChanged (any ());
771771
772772 syncContext .execute (() -> {
773773 // Shutdown before any updates. This will unsubscribe from XdsClient, but only after this
@@ -776,7 +776,7 @@ public void rdsUpdateAfterShutdown() {
776776
777777 XdsTestUtils .setAdsConfig (controlPlaneService , serverName , "RDS" , "CDS2" , "EDS" ,
778778 ENDPOINT_HOSTNAME , ENDPOINT_PORT );
779- verify (resourceWatcher , timeout ( 5000 ). times (2 )).onChanged (any ());
779+ verify (resourceWatcher , times (2 )).onChanged (any ());
780780 xdsClient .cancelXdsResourceWatch (
781781 XdsRouteConfigureResource .getInstance (), serverName , resourceWatcher );
782782 });
@@ -790,7 +790,7 @@ public void cdsUpdateAfterShutdown() {
790790 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
791791 serverName , serverName , nameResolverArgs , scheduler );
792792
793- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
793+ verify (xdsConfigWatcher ).onUpdate (any ());
794794
795795 @ SuppressWarnings ("unchecked" )
796796 XdsClient .ResourceWatcher <XdsClusterResource .CdsUpdate > resourceWatcher =
@@ -800,7 +800,7 @@ public void cdsUpdateAfterShutdown() {
800800 "CDS" ,
801801 resourceWatcher ,
802802 MoreExecutors .directExecutor ());
803- verify (resourceWatcher , timeout ( 5000 ) ).onChanged (any ());
803+ verify (resourceWatcher ).onChanged (any ());
804804
805805 syncContext .execute (() -> {
806806 // Shutdown before any updates. This will unsubscribe from XdsClient, but only after this
@@ -809,7 +809,7 @@ public void cdsUpdateAfterShutdown() {
809809
810810 XdsTestUtils .setAdsConfig (controlPlaneService , serverName , "RDS" , "CDS" , "EDS2" ,
811811 ENDPOINT_HOSTNAME , ENDPOINT_PORT );
812- verify (resourceWatcher , timeout ( 5000 ). times (2 )).onChanged (any ());
812+ verify (resourceWatcher , times (2 )).onChanged (any ());
813813 xdsClient .cancelXdsResourceWatch (
814814 XdsClusterResource .getInstance (), serverName , resourceWatcher );
815815 });
@@ -823,7 +823,7 @@ public void edsUpdateAfterShutdown() {
823823 xdsDependencyManager = new XdsDependencyManager (xdsClient , xdsConfigWatcher , syncContext ,
824824 serverName , serverName , nameResolverArgs , scheduler );
825825
826- verify (xdsConfigWatcher , timeout ( 1000 ) ).onUpdate (any ());
826+ verify (xdsConfigWatcher ).onUpdate (any ());
827827
828828 @ SuppressWarnings ("unchecked" )
829829 XdsClient .ResourceWatcher <XdsEndpointResource .EdsUpdate > resourceWatcher =
@@ -833,7 +833,7 @@ public void edsUpdateAfterShutdown() {
833833 "EDS" ,
834834 resourceWatcher ,
835835 MoreExecutors .directExecutor ());
836- verify (resourceWatcher , timeout ( 5000 ) ).onChanged (any ());
836+ verify (resourceWatcher ).onChanged (any ());
837837
838838 syncContext .execute (() -> {
839839 // Shutdown before any updates. This will unsubscribe from XdsClient, but only after this
@@ -842,7 +842,7 @@ public void edsUpdateAfterShutdown() {
842842
843843 XdsTestUtils .setAdsConfig (controlPlaneService , serverName , "RDS" , "CDS" , "EDS" ,
844844 ENDPOINT_HOSTNAME + "2" , ENDPOINT_PORT );
845- verify (resourceWatcher , timeout ( 5000 ). times (2 )).onChanged (any ());
845+ verify (resourceWatcher , times (2 )).onChanged (any ());
846846 xdsClient .cancelXdsResourceWatch (
847847 XdsEndpointResource .getInstance (), serverName , resourceWatcher );
848848 });
0 commit comments