CloudletSchedulerSpaceShared extends CloudletSchedulerAbstract { @Override public double cloudletResume(Cloudlet cloudlet) { return findCloudletInList(cloudlet, getCloudletPausedList()) .map(this::movePausedCloudletToExecListOrWaitingList) .orElse(0.0); }  @Override double cloudletResume(Cloudlet cloudlet);  }
@Test public void testCloudletResumeWhenCloudletLengthNotChangedAfterResumeAndMovingToWaitList(){ final double mips = 1000; final long cloudletLen = 10000; final CloudSim cloudsim = CloudSimMocker.createMock(mocker -> { mocker.clock(0).anyTimes(); mocker.getMinTimeBetweenEvents(0).anyTimes(); }); final Vm vm = new VmSimple(0, mips, 1); vm.setBroker(DatacenterBroker.NULL); final CloudletSchedulerSpaceShared instance = CloudletSchedulerSpaceSharedTestUtil.createScheduler(vm); final List<Double> mipsList = Collections.singletonList(mips); instance.setCurrentMipsShare(mipsList); final Cloudlet cloudlet = CloudletTestUtil.createCloudlet(0, cloudletLen, 1); instance.cloudletSubmit(cloudlet); instance.updateProcessing(2, mipsList); assertEquals(cloudletLen, cloudlet.getLength()); instance.cloudletPause(cloudlet); instance.cloudletResume(cloudlet); assertEquals(cloudletLen, cloudlet.getLength()); }
@Test public void testCloudletResumeWhenNotInPausedList() { final int cloudletId = 0; final CloudletSchedulerSpaceShared instance = CloudletSchedulerSpaceSharedTestUtil.createScheduler(); final double expResult = 0.0; final double result = instance.cloudletResume(new CloudletSimple(cloudletId, 1, 1)); assertEquals(expResult, result); }
@Test public void testCloudletResumeWhenNotEnoughPesToResume() { final int cloudletId = 0; final int cloudletPes = 1; final int numberOfCloudlets = 2; final CloudletSchedulerSpaceShared instance = CloudletSchedulerSpaceSharedTestUtil.createScheduler(numberOfCloudlets); for(int i = 0; i <= numberOfCloudlets; i++){ instance.addCloudletToExecList( new CloudletExecution( CloudletTestUtil.createCloudletWithOnePe(i))); } instance.getCloudletPausedList().add( new CloudletExecution( CloudletTestUtil.createCloudlet(numberOfCloudlets, cloudletPes))); final double expResult = 0.0; final double result = instance.cloudletResume(new CloudletSimple(cloudletId, 1, 1)); assertEquals(expResult, result); }