GenClientLibAction extends EndpointsToolAction { public Object genClientLib(String language, String outputDirPath, String discoveryDoc, String buildSystem) throws IOException { if (!isRestDiscoveryDoc(discoveryDoc)) { throw new IllegalArgumentException("discovery doc must be in rest format"); } File outputFile = new File(outputDirPath + "/" + getApiNameVersion(discoveryDoc) + "-" + language.toLowerCase() + ".zip"); ClientLibGenerator generator = CloudClientLibGenerator.using("https: generator.generateClientLib(discoveryDoc, language, null, buildSystem, outputFile); System.out.println("API client library written to " + outputFile.getPath()); return null; } GenClientLibAction(); @Override boolean execute(); Object genClientLibFromFile(String language, String outputDirPath, String discoveryDocPath,
      String buildSystem); Object genClientLib(String language, String outputDirPath, String discoveryDoc,
      String buildSystem); @Override String getUsageString(); static final String NAME; }
@Test public void testGenClientLib() throws Exception { tool.execute( new String[]{GenClientLibAction.NAME, option(EndpointsToolAction.OPTION_LANGUAGE_SHORT), "java", option(EndpointsToolAction.OPTION_OUTPUT_DIR_SHORT), "outputDir", option(EndpointsToolAction.OPTION_BUILD_SYSTEM_SHORT), "maven", "discoveryDocPath"}); assertFalse(usagePrinted); assertEquals("java", language); assertEquals("outputDir", outputDirPath); assertEquals("discoveryDocPath", discoveryDocPath); assertEquals("maven", buildSystem); }