@Test public void getQuotesOneQuote() throws Exception { List<Quote> quotes = service.getQuotes(TestConfiguration.QUOTE_SYMBOL); assertNotNull("should have 1 quotes", quotes); assertEquals("should have 1 quotes", quotes.size(), 1); }
public List<Quote> getQuotes(String symbols) { log.debug("retrieving multiple quotes for: " + symbols); IexBatchQuote batchQuotes = restTemplate.getForObject(quotes_url, IexBatchQuote.class, symbols); log.debug("Got response: " + batchQuotes); final List<Quote> quotes = new ArrayList<>(); Arrays.asList(symbols.split(",")).forEach(symbol -> { if(batchQuotes.containsKey(symbol)) { quotes.add(QuoteMapper.INSTANCE.mapFromIexQuote(batchQuotes.get(symbol).get("quote"))); } else { log.warn("Quote could not be found for the following symbol: " + symbol); Quote quote = new Quote(); quote.setSymbol(symbol); quote.setStatus("FAILED"); quotes.add(quote); } }); return quotes; }
QuoteService { public List<Quote> getQuotes(String symbols) { log.debug("retrieving multiple quotes for: " + symbols); IexBatchQuote batchQuotes = restTemplate.getForObject(quotes_url, IexBatchQuote.class, symbols); log.debug("Got response: " + batchQuotes); final List<Quote> quotes = new ArrayList<>(); Arrays.asList(symbols.split(",")).forEach(symbol -> { if(batchQuotes.containsKey(symbol)) { quotes.add(QuoteMapper.INSTANCE.mapFromIexQuote(batchQuotes.get(symbol).get("quote"))); } else { log.warn("Quote could not be found for the following symbol: " + symbol); Quote quote = new Quote(); quote.setSymbol(symbol); quote.setStatus("FAILED"); quotes.add(quote); } }); return quotes; } }
QuoteService { public List<Quote> getQuotes(String symbols) { log.debug("retrieving multiple quotes for: " + symbols); IexBatchQuote batchQuotes = restTemplate.getForObject(quotes_url, IexBatchQuote.class, symbols); log.debug("Got response: " + batchQuotes); final List<Quote> quotes = new ArrayList<>(); Arrays.asList(symbols.split(",")).forEach(symbol -> { if(batchQuotes.containsKey(symbol)) { quotes.add(QuoteMapper.INSTANCE.mapFromIexQuote(batchQuotes.get(symbol).get("quote"))); } else { log.warn("Quote could not be found for the following symbol: " + symbol); Quote quote = new Quote(); quote.setSymbol(symbol); quote.setStatus("FAILED"); quotes.add(quote); } }); return quotes; }  }
QuoteService { public List<Quote> getQuotes(String symbols) { log.debug("retrieving multiple quotes for: " + symbols); IexBatchQuote batchQuotes = restTemplate.getForObject(quotes_url, IexBatchQuote.class, symbols); log.debug("Got response: " + batchQuotes); final List<Quote> quotes = new ArrayList<>(); Arrays.asList(symbols.split(",")).forEach(symbol -> { if(batchQuotes.containsKey(symbol)) { quotes.add(QuoteMapper.INSTANCE.mapFromIexQuote(batchQuotes.get(symbol).get("quote"))); } else { log.warn("Quote could not be found for the following symbol: " + symbol); Quote quote = new Quote(); quote.setSymbol(symbol); quote.setStatus("FAILED"); quotes.add(quote); } }); return quotes; }  @HystrixCommand(fallbackMethod = "getQuoteFallback") Quote getQuote(String symbol); @HystrixCommand(fallbackMethod = "getCompanyInfoFallback", commandProperties = { @HystrixProperty(name="execution.timeout.enabled", value="false") }) List<CompanyInfo> getCompanyInfo(String name); List<Quote> getQuotes(String symbols); }
QuoteService { public List<Quote> getQuotes(String symbols) { log.debug("retrieving multiple quotes for: " + symbols); IexBatchQuote batchQuotes = restTemplate.getForObject(quotes_url, IexBatchQuote.class, symbols); log.debug("Got response: " + batchQuotes); final List<Quote> quotes = new ArrayList<>(); Arrays.asList(symbols.split(",")).forEach(symbol -> { if(batchQuotes.containsKey(symbol)) { quotes.add(QuoteMapper.INSTANCE.mapFromIexQuote(batchQuotes.get(symbol).get("quote"))); } else { log.warn("Quote could not be found for the following symbol: " + symbol); Quote quote = new Quote(); quote.setSymbol(symbol); quote.setStatus("FAILED"); quotes.add(quote); } }); return quotes; }  @HystrixCommand(fallbackMethod = "getQuoteFallback") Quote getQuote(String symbol); @HystrixCommand(fallbackMethod = "getCompanyInfoFallback", commandProperties = { @HystrixProperty(name="execution.timeout.enabled", value="false") }) List<CompanyInfo> getCompanyInfo(String name); List<Quote> getQuotes(String symbols); static final String FMT; }