@@ -586,9 +586,7 @@ public void testGetDrsPlanWithMultipleIterations() throws ConfigurationException
586586 Mockito .when (balancedAlgorithm .needsDrs (Mockito .any (), Mockito .anyList (), Mockito .anyList ())).thenReturn (
587587 true , true , false );
588588 Mockito .when (serviceOfferingDao .findByIdIncludingRemoved (Mockito .anyLong (), Mockito .anyLong ())).thenReturn (serviceOffering );
589- Mockito .when (hostJoinDao .searchByIds (Mockito .any ())).thenReturn (List .of (hostJoin1 , hostJoin2 ));
590-
591- HostVO compatibleHost = Mockito .mock (HostVO .class );
589+ Mockito .when (hostJoinDao .searchByIds (1L , 2L )).thenReturn (List .of (hostJoin1 , hostJoin2 ));
592590
593591 // Return migrations for first two iterations, then null
594592 Mockito .doReturn (new Pair <>(vm1 , host2 ), new Pair <>(vm2 , host2 ), new Pair <>(null , null ))
@@ -628,35 +626,12 @@ public void testGetDrsPlanWithMigrationToOriginalHost() throws ConfigurationExce
628626 List <VMInstanceVO > vmList = new ArrayList <>();
629627 vmList .add (vm1 );
630628
631- HostJoinVO hostJoin1 = Mockito .mock (HostJoinVO .class );
632- Mockito .when (hostJoin1 .getId ()).thenReturn (1L );
633- Mockito .when (hostJoin1 .getCpuUsedCapacity ()).thenReturn (1000L );
634- Mockito .when (hostJoin1 .getCpuReservedCapacity ()).thenReturn (0L );
635- Mockito .when (hostJoin1 .getCpus ()).thenReturn (4 );
636- Mockito .when (hostJoin1 .getSpeed ()).thenReturn (1000L );
637- Mockito .when (hostJoin1 .getMemUsedCapacity ()).thenReturn (1024L );
638- Mockito .when (hostJoin1 .getMemReservedCapacity ()).thenReturn (0L );
639- Mockito .when (hostJoin1 .getTotalMemory ()).thenReturn (8192L );
640-
641- HostJoinVO hostJoin2 = Mockito .mock (HostJoinVO .class );
642- Mockito .when (hostJoin2 .getId ()).thenReturn (2L );
643- Mockito .when (hostJoin2 .getCpuUsedCapacity ()).thenReturn (1000L );
644- Mockito .when (hostJoin2 .getCpuReservedCapacity ()).thenReturn (0L );
645- Mockito .when (hostJoin2 .getCpus ()).thenReturn (4 );
646- Mockito .when (hostJoin2 .getSpeed ()).thenReturn (1000L );
647- Mockito .when (hostJoin2 .getMemUsedCapacity ()).thenReturn (1024L );
648- Mockito .when (hostJoin2 .getMemReservedCapacity ()).thenReturn (0L );
649- Mockito .when (hostJoin2 .getTotalMemory ()).thenReturn (8192L );
650-
651629 ServiceOfferingVO serviceOffering = Mockito .mock (ServiceOfferingVO .class );
652630
653631 Mockito .when (hostDao .findByClusterId (1L )).thenReturn (hostList );
654632 Mockito .when (vmInstanceDao .listByClusterId (1L )).thenReturn (vmList );
655633 Mockito .when (balancedAlgorithm .needsDrs (Mockito .any (), Mockito .anyList (), Mockito .anyList ())).thenReturn (true );
656634 Mockito .when (serviceOfferingDao .findByIdIncludingRemoved (Mockito .anyLong (), Mockito .anyLong ())).thenReturn (serviceOffering );
657- Mockito .when (hostJoinDao .searchByIds (Mockito .any ())).thenReturn (List .of (hostJoin1 , hostJoin2 ));
658-
659- HostVO compatibleHost = Mockito .mock (HostVO .class );
660635
661636 // Return migration to original host (host1) - should break the loop
662637 Mockito .doReturn (new Pair <>(vm1 , host1 )).when (clusterDrsService ).getBestMigration (
0 commit comments