@Test public void assertResourceOffers() { SchedulerDriver schedulerDriver = mock(SchedulerDriver.class); List<Protos.Offer> offers = Arrays.asList(OfferBuilder.createOffer("offer_0"), OfferBuilder.createOffer("offer_1")); schedulerEngine.resourceOffers(schedulerDriver, offers); assertThat(LeasesQueue.getInstance().drainTo().size(), is(2)); }
@Override public void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers) { for (Protos.Offer offer: offers) { log.trace("Adding offer {} from host {}", offer.getId(), offer.getHostname()); LeasesQueue.getInstance().offer(offer); } }
SchedulerEngine implements Scheduler { @Override public void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers) { for (Protos.Offer offer: offers) { log.trace("Adding offer {} from host {}", offer.getId(), offer.getHostname()); LeasesQueue.getInstance().offer(offer); } } }
SchedulerEngine implements Scheduler { @Override public void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers) { for (Protos.Offer offer: offers) { log.trace("Adding offer {} from host {}", offer.getId(), offer.getHostname()); LeasesQueue.getInstance().offer(offer); } }  }
SchedulerEngine implements Scheduler { @Override public void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers) { for (Protos.Offer offer: offers) { log.trace("Adding offer {} from host {}", offer.getId(), offer.getHostname()); LeasesQueue.getInstance().offer(offer); } }  @Override void registered(final SchedulerDriver schedulerDriver, final Protos.FrameworkID frameworkID, final Protos.MasterInfo masterInfo); @Override void reregistered(final SchedulerDriver schedulerDriver, final Protos.MasterInfo masterInfo); @Override void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers); @Override void offerRescinded(final SchedulerDriver schedulerDriver, final Protos.OfferID offerID); @Override void statusUpdate(final SchedulerDriver schedulerDriver, final Protos.TaskStatus taskStatus); @Override void frameworkMessage(final SchedulerDriver schedulerDriver, final Protos.ExecutorID executorID, final Protos.SlaveID slaveID, final byte[] bytes); @Override void disconnected(final SchedulerDriver schedulerDriver); @Override void slaveLost(final SchedulerDriver schedulerDriver, final Protos.SlaveID slaveID); @Override void executorLost(final SchedulerDriver schedulerDriver, final Protos.ExecutorID executorID, final Protos.SlaveID slaveID, final int i); @Override void error(final SchedulerDriver schedulerDriver, final String message); }
SchedulerEngine implements Scheduler { @Override public void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers) { for (Protos.Offer offer: offers) { log.trace("Adding offer {} from host {}", offer.getId(), offer.getHostname()); LeasesQueue.getInstance().offer(offer); } }  @Override void registered(final SchedulerDriver schedulerDriver, final Protos.FrameworkID frameworkID, final Protos.MasterInfo masterInfo); @Override void reregistered(final SchedulerDriver schedulerDriver, final Protos.MasterInfo masterInfo); @Override void resourceOffers(final SchedulerDriver schedulerDriver, final List<Protos.Offer> offers); @Override void offerRescinded(final SchedulerDriver schedulerDriver, final Protos.OfferID offerID); @Override void statusUpdate(final SchedulerDriver schedulerDriver, final Protos.TaskStatus taskStatus); @Override void frameworkMessage(final SchedulerDriver schedulerDriver, final Protos.ExecutorID executorID, final Protos.SlaveID slaveID, final byte[] bytes); @Override void disconnected(final SchedulerDriver schedulerDriver); @Override void slaveLost(final SchedulerDriver schedulerDriver, final Protos.SlaveID slaveID); @Override void executorLost(final SchedulerDriver schedulerDriver, final Protos.ExecutorID executorID, final Protos.SlaveID slaveID, final int i); @Override void error(final SchedulerDriver schedulerDriver, final String message);  }