GetClientLibAction extends EndpointsToolAction { public Object getClientLib(URL[] classPath, String language, String outputDirPath, List<String> serviceClassNames, String buildSystem, String hostname, String basePath, boolean debug) throws ClassNotFoundException, IOException, ApiConfigException { Map<String, String> discoveryDocs = new GetDiscoveryDocAction().getDiscoveryDoc( classPath, outputDirPath, serviceClassNames, hostname, basePath, debug ); for (Map.Entry<String, String> entry : discoveryDocs.entrySet()) { new GenClientLibAction().genClientLib(language, outputDirPath, entry.getValue(), buildSystem); } return null; } GetClientLibAction(); @Override boolean execute(); Object getClientLib(URL[] classPath, String language, String outputDirPath,
      List<String> serviceClassNames, String buildSystem, String hostname, String basePath,
      boolean debug); @Override String getUsageString(); static final String NAME; }
@Test public void testGetClientLib() throws Exception { tool.execute(new String[]{GetClientLibAction.NAME, option(EndpointsToolAction.OPTION_CLASS_PATH_SHORT), "classPath", option(EndpointsToolAction.OPTION_LANGUAGE_SHORT), "java", option(EndpointsToolAction.OPTION_OUTPUT_DIR_SHORT), "outputDir", option(EndpointsToolAction.OPTION_HOSTNAME_SHORT), "foo.com", "MyService", "MyService2"}); assertFalse(usagePrinted); assertThat(Lists.newArrayList(classPath)) .containsExactly(new File("classPath").toURI().toURL(), new File(new File(EndpointsToolAction.DEFAULT_WAR_PATH).getAbsoluteFile(), "/WEB-INF/classes") .toURI() .toURL()); assertEquals("java", language); assertEquals("outputDir", outputDirPath); assertStringsEqual(Arrays.asList("MyService", "MyService2"), serviceClassNames); assertEquals(null, buildSystem); assertFalse(debugOutput); assertThat(basePath).isEqualTo("/_ah/api"); }