OfferLifecycleManager { public void addOffers(Protos.Offer... offers) { for (Protos.Offer offer : offers) { String hostname = offer.getHostname(); Optional<Node> optNode = getOfferNode(hostname); if (optNode.isPresent()) { OfferFeed feed = getOfferFeed(hostname); feed.add(offer); optNode.get().setSlaveId(offer.getSlaveId()); LOGGER.debug("addResourceOffers: caching offer for host {}, offer id {}", hostname, offer.getId().getValue()); } else { myriadDriver.getDriver().declineOffer(offer.getId()); LOGGER.debug("Declined offer for unregistered host {}", hostname); } } } @Inject  OfferLifecycleManager(NodeStore nodeStore, MyriadDriver myriadDriver); void declineOffer(Protos.Offer offer); void addOffers(Protos.Offer... offers); void markAsConsumed(Protos.Offer offer); ConsumedOffer drainConsumedOffer(String hostname); void declineOutstandingOffers(String hostname);  }
@Test public void testAddOffers() throws Exception { manager.addOffers(TestObjectFactory.getOffer("localhost", "slave-1", "mock-framework", "offer-1", 0.0, 0.0)); assertNotNull(manager.getOfferFeed("localhost").poll()); }