cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/test/java/org/cloudsimplus/integrationtests/CheckHostAvailableMipsTest.java
private void onUpdateVmsProcessing(HostUpdatesVmsProcessingEventInfo evt) {
        double time = (int)evt.getTime();
        final double hostCapacity = HOST_MIPS * HOST_PES;
        final double usedHostMips = (NUMBER_OF_CLOUDLETS * CLOUDLET_PES * VM_MIPS
                * utilizationModel.getUtilization(time));
        double expectedAvailableHostMips = hostCapacity - usedHostMips;

        /*After 10 seconds all VMs finish and
        all host capacity will be free*/
        if(time > 10) {
            expectedAvailableHostMips = hostCapacity;
        }
        /*After 6 seconds, one VM finishes and
        its used capacity will be free*/
        else if(time > 6){
            expectedAvailableHostMips += VM_MIPS*VM_PES;
        }

        Log.printConcatLine(
            "- VMs processing at time ", time, " host ", evt.getHost().getId(),
            " available mips: ", evt.getHost().getAvailableMips(),
            " expected availability: ", expectedAvailableHostMips);

        assertEquals(
                String.format("Host available mips at time %.0f", time),
                expectedAvailableHostMips, evt.getHost().getAvailableMips(), 0);
    }
/**
     * A lambda function used by the {@link Host#addOnUpdateProcessingListener(EventListener)}
     * that will be called every time a host updates the processing of its VMs.
     * It checks if the amount of available Host CPU is as expected,
     * every time a host updates the processing of all its VMs.
     *
     * @param evt
     */
A lambda function used by the  Host#addOnUpdateProcessingListener(EventListener)
that will be called every time a host updates the processing of its VMs.
It checks if the amount of available Host CPU is as expected,
every time a host updates the processing of all its VMs.

@param evt
A lambda function used by the Host#addOnUpdateProcessingListener ( EventListener ) that will be called every time a host updates the processing of its VMs . It checks if the amount of available Host CPU is as expected every time a host updates the processing of all its VMs . @param evt
private void onUpdateVmsProcessing(HostUpdatesVmsProcessingEventInfo evt) {
        double time = (int)evt.getTime();
        final double hostCapacity = HOST_MIPS * HOST_PES;
        final double usedHostMips = (NUMBER_OF_CLOUDLETS * CLOUDLET_PES * VM_MIPS
                * utilizationModel.getUtilization(time));
        double expectedAvailableHostMips = hostCapacity - usedHostMips;
        /*After 10 seconds all VMs finish and
        all host capacity will be free*/
        if(time > 10) {
            expectedAvailableHostMips = hostCapacity;
        }
        /*After 6 seconds, one VM finishes and
        its used capacity will be free*/
        else if(time > 6){
            expectedAvailableHostMips += VM_MIPS*VM_PES;
        }
        Log.printConcatLine(
            "- VMs processing at time ", time, " host ", evt.getHost().getId(),
            " available mips: ", evt.getHost().getAvailableMips(),
            " expected availability: ", expectedAvailableHostMips);
        assertEquals(
                String.format("Host available mips at time %.0f", time),
                expectedAvailableHostMips, evt.getHost().getAvailableMips(), 0);
    }
private void onUpdateVmsProcessing ( HostUpdatesVmsProcessingEventInfo evt ) { double time = ( int ) evt . getTime ( ) ; final double hostCapacity = HOST_MIPS * HOST_PES ; final double usedHostMips = ( NUMBER_OF_CLOUDLETS * CLOUDLET_PES * VM_MIPS * utilizationModel . getUtilization ( time ) ) ; double expectedAvailableHostMips = hostCapacity - usedHostMips ; /*After 10 seconds all VMs finish and
        all host capacity will be free*/ if ( time > 10 ) { expectedAvailableHostMips = hostCapacity ; } /*After 6 seconds, one VM finishes and
        its used capacity will be free*/ else if ( time > 6 ) { expectedAvailableHostMips += VM_MIPS * VM_PES ; } Log . printConcatLine ( "- VMs processing at time " , time , " host " , evt . getHost ( ) . getId ( ) , " available mips: " , evt . getHost ( ) . getAvailableMips ( ) , " expected availability: " , expectedAvailableHostMips ) ; assertEquals ( String . format ( "Host available mips at time %.0f" , time ) , expectedAvailableHostMips , evt . getHost ( ) . getAvailableMips ( ) , 0 ) ; }
A lambda function used by the {@link Host#addOnUpdateProcessingListener(EventListener)}
 that will be called every time a host updates the processing of its VMs.
A lambda function used by the { @link Host#addOnUpdateProcessingListener ( EventListener ) } that will be called every time a host updates the processing of its VMs .