@Test public void testAddOffering() { Fongo fongo = new Fongo("Mongo DB"); Discoverer d = new Discoverer(fongo.getMongo()); String ofId = "EC2"; d.addOffering(new Offering(ofId)); Offering of = d.fetchOffer(ofId); Assert.assertNotNull(of); Assert.assertEquals(of.getName(), ofId); }
public String addOffering(Offering newOffering) { if (newOffering == null) return null; String offeringName = newOffering.getName(); if (offeringManager.getOffering(offeringName) != null) { offeringManager.removeOffering(offeringName); } offeringManager.addOffering(newOffering); this.offeringNodeTemplates.add(newOffering.getNodeTemplate()); totalCrawledOfferings++; return offeringName; }
Discoverer { public String addOffering(Offering newOffering) { if (newOffering == null) return null; String offeringName = newOffering.getName(); if (offeringManager.getOffering(offeringName) != null) { offeringManager.removeOffering(offeringName); } offeringManager.addOffering(newOffering); this.offeringNodeTemplates.add(newOffering.getNodeTemplate()); totalCrawledOfferings++; return offeringName; } }
Discoverer { public String addOffering(Offering newOffering) { if (newOffering == null) return null; String offeringName = newOffering.getName(); if (offeringManager.getOffering(offeringName) != null) { offeringManager.removeOffering(offeringName); } offeringManager.addOffering(newOffering); this.offeringNodeTemplates.add(newOffering.getNodeTemplate()); totalCrawledOfferings++; return offeringName; } Discoverer(MongoClient mongoClient, ArrayList<String> activeCrawlers);  Discoverer(MongoClient mongoClient); }
Discoverer { public String addOffering(Offering newOffering) { if (newOffering == null) return null; String offeringName = newOffering.getName(); if (offeringManager.getOffering(offeringName) != null) { offeringManager.removeOffering(offeringName); } offeringManager.addOffering(newOffering); this.offeringNodeTemplates.add(newOffering.getNodeTemplate()); totalCrawledOfferings++; return offeringName; } Discoverer(MongoClient mongoClient, ArrayList<String> activeCrawlers);  Discoverer(MongoClient mongoClient); synchronized void setRefreshing(boolean refreshing); synchronized boolean getRefreshing(); Offering fetchOffer(String cloudOfferingId); String addOffering(Offering newOffering); boolean removeOffering(String cloudOfferingId); Collection<String> getAllOfferingIds(); void generateSingleOffering(); void refreshRepository(); }
Discoverer { public String addOffering(Offering newOffering) { if (newOffering == null) return null; String offeringName = newOffering.getName(); if (offeringManager.getOffering(offeringName) != null) { offeringManager.removeOffering(offeringName); } offeringManager.addOffering(newOffering); this.offeringNodeTemplates.add(newOffering.getNodeTemplate()); totalCrawledOfferings++; return offeringName; } Discoverer(MongoClient mongoClient, ArrayList<String> activeCrawlers);  Discoverer(MongoClient mongoClient); synchronized void setRefreshing(boolean refreshing); synchronized boolean getRefreshing(); Offering fetchOffer(String cloudOfferingId); String addOffering(Offering newOffering); boolean removeOffering(String cloudOfferingId); Collection<String> getAllOfferingIds(); void generateSingleOffering(); void refreshRepository(); public int totalCrawledOfferings; public int crawledTimes; public Date lastCrawl; public OfferingManager offeringManager; }