8787import com .cloud .domain .DomainVO ;
8888import com .cloud .domain .dao .DomainDao ;
8989import com .cloud .event .UsageEventUtils ;
90- import com .cloud .event .UsageEventVO ;
9190import com .cloud .exception .InsufficientAddressCapacityException ;
9291import com .cloud .exception .InsufficientCapacityException ;
9392import com .cloud .exception .InsufficientServerCapacityException ;
@@ -3134,15 +3133,12 @@ private ServiceOfferingVO getMockedServiceOffering(boolean custom, boolean custo
31343133 if (custom ) {
31353134 when (serviceOffering .getCpu ()).thenReturn (null );
31363135 when (serviceOffering .getRamSize ()).thenReturn (null );
3137- } else {
3138- when (serviceOffering .getCpu ()).thenReturn (2 );
3139- when (serviceOffering .getRamSize ()).thenReturn (2048 );
31403136 }
31413137 if (customSpeed ) {
31423138 when (serviceOffering .getSpeed ()).thenReturn (null );
31433139 } else {
31443140 when (serviceOffering .isCustomCpuSpeedSupported ()).thenReturn (false );
3145- when (serviceOffering .getSpeed ()).thenReturn (2500 );
3141+ when (serviceOffering .getSpeed ()).thenReturn (1000 );
31463142 }
31473143 System .out .println ("Service Offering customized: " + serviceOffering .isCustomized () + ", speed: " + serviceOffering .getSpeed ());
31483144 return serviceOffering ;
@@ -3161,7 +3157,8 @@ public void cpuSpeedCustomizationNotAllowedThrowsException() {
31613157 ServiceOfferingVO serviceOffering = getMockedServiceOffering (true , false );
31623158
31633159 Map <String , String > customParameters = new HashMap <>();
3164- customParameters .put (UsageEventVO .DynamicParameters .cpuSpeed .name (), "2500" );
3160+ customParameters .put (VmDetailConstants .CPU_NUMBER , "1" );
3161+ customParameters .put (VmDetailConstants .CPU_SPEED , "2500" );
31653162
31663163 InvalidParameterValueException ex = Assert .assertThrows (InvalidParameterValueException .class , () ->
31673164 userVmManagerImpl .validateCustomParameters (serviceOffering , customParameters ));
@@ -3173,7 +3170,9 @@ public void cpuSpeedCustomizationAllowedDoesNotThrowException() {
31733170 ServiceOfferingVO serviceOffering = getMockedServiceOffering (true , true );
31743171
31753172 Map <String , String > customParameters = new HashMap <>();
3176- customParameters .put (UsageEventVO .DynamicParameters .cpuSpeed .name (), "2500" );
3173+ customParameters .put (VmDetailConstants .CPU_NUMBER , "1" );
3174+ customParameters .put (VmDetailConstants .CPU_SPEED , "2500" );
3175+ customParameters .put (VmDetailConstants .MEMORY , "256" );
31773176
31783177 userVmManagerImpl .validateCustomParameters (serviceOffering , customParameters );
31793178 }
0 commit comments