@Test
 public void testFindLookupAndLoadFeed() {
   assertNotNullOrEmpty(
       String.format(RESOURCE_MISSING_MESSAGE, "Test Query."), TestConstants.TEST_QUERY);
   FindFeedQuery findQuery = factory.newFindFeedQuery();
   FindFeedResult findResult = findQuery.withQuery(TestConstants.TEST_QUERY).singleResult();
   assertNotNull("Find result should not be null or empty.", findResult);
   assertNotNull("Find result should not be null or empty.", findResult.getEntries());
   LookupFeedQuery lookupQuery = factory.newLookupFeedQuery();
   LookupFeedResult lookupResult =
       lookupQuery.withQuery(findResult.getEntries().get(0).getLink()).singleResult();
   assertNotNull("Lookup result should not be null or empty.", lookupResult);
   LoadFeedQuery loadQuery = factory.newLoadFeedQuery();
   LoadFeedResult loadResult = loadQuery.withQuery(lookupResult.getUrl()).singleResult();
   assertNotNull("Load result should not be null or empty.", loadResult);
   assertNotNull("Load result should not be null or empty.", loadResult.getEntries());
 }
コード例 #2
0
 /**
  * Process command line.
  *
  * @param line the line
  * @param options the options
  */
 private static void processCommandLine(CommandLine line, Options options) {
   if (line.hasOption(HELP_OPTION)) {
     printHelp(options);
   } else if (line.hasOption(APPLICATION_KEY_OPTION) && line.hasOption(QUERY_OPTION)) {
     GoogleSearchQueryFactory factory =
         GoogleSearchQueryFactory.newInstance(line.getOptionValue(APPLICATION_KEY_OPTION));
     FindFeedQuery findFeedQuery = factory.newFindFeedQuery();
     FindFeedResult findResponse = findFeedQuery.withQuery("hadoop").singleResult();
     printResponse(findResponse);
     LoadFeedQuery loadFeedQuery = factory.newLoadFeedQuery();
     LoadFeedResult loadResponse =
         loadFeedQuery.withNumber(10).withQuery(line.getOptionValue(QUERY_OPTION)).singleResult();
     printResponse(loadResponse);
   } else {
     printHelp(options);
   }
 }