@Test(description = "Test Ballerina client generation") public void generateClient() { final String pkgName = "client"; String definitionPath = RES_DIR + File.separator + "petstore.yaml"; CodeGenerator generator = new CodeGenerator(); generator.setSrcPackage(pkgName); try { OpenAPIBallerinaProject ballerinaProject = OpenAPICommandTest.createBalProject(projectPath.toString() ); Path outFile = ballerinaProject.getImplPath().resolve("client") .resolve(Paths.get("openapi_petstore.bal")); generator.generateClient(projectPath.toString(), definitionPath, "openapi_petstore", projectPath.toString(), filter); if (Files.exists(outFile)) { String result = new String(Files.readAllBytes(outFile)); Assert.assertTrue(result.contains("public remote function listPets()")); } else { Assert.fail("Client was not generated"); } } catch (IOException | BallerinaOpenApiException e) { Assert.fail("Error while generating the service. " + e.getMessage()); } }
public void generateClient(String executionPath, String definitionPath, String serviceName, String outPath, Filter filter) throws IOException, BallerinaOpenApiException { generate(GenType.GEN_CLIENT, executionPath, definitionPath, null, serviceName, outPath, filter); }
CodeGenerator { public void generateClient(String executionPath, String definitionPath, String serviceName, String outPath, Filter filter) throws IOException, BallerinaOpenApiException { generate(GenType.GEN_CLIENT, executionPath, definitionPath, null, serviceName, outPath, filter); } }
CodeGenerator { public void generateClient(String executionPath, String definitionPath, String serviceName, String outPath, Filter filter) throws IOException, BallerinaOpenApiException { generate(GenType.GEN_CLIENT, executionPath, definitionPath, null, serviceName, outPath, filter); }  }
CodeGenerator { public void generateClient(String executionPath, String definitionPath, String serviceName, String outPath, Filter filter) throws IOException, BallerinaOpenApiException { generate(GenType.GEN_CLIENT, executionPath, definitionPath, null, serviceName, outPath, filter); }  void generateBothFiles(GenType type, String definitionPath,
                          String reldefinitionPath , String serviceName, String outPath , Filter filter); static Predicate<T> distinctByKey(
            Function<? super T, ?> keyExtractor); void generateClient(String executionPath, String definitionPath, String serviceName, String outPath,
                               Filter filter); void generateService(String executionPath, String definitionPath,
                                String reldefinitionPath, String serviceName, String outPath, Filter filter); List<GenSrcFile> generateBalSource(GenType type, String definitionPath,
                                              String reldefinitionPath, String serviceName, Filter filter); @Deprecated void writeBallerina(Object object, String templateDir, String templateName, String outPath); String getSrcPackage(); void setSrcPackage(String srcPackage); String getModelPackage(); void setModelPackage(String modelPackage); }
CodeGenerator { public void generateClient(String executionPath, String definitionPath, String serviceName, String outPath, Filter filter) throws IOException, BallerinaOpenApiException { generate(GenType.GEN_CLIENT, executionPath, definitionPath, null, serviceName, outPath, filter); }  void generateBothFiles(GenType type, String definitionPath,
                          String reldefinitionPath , String serviceName, String outPath , Filter filter); static Predicate<T> distinctByKey(
            Function<? super T, ?> keyExtractor); void generateClient(String executionPath, String definitionPath, String serviceName, String outPath,
                               Filter filter); void generateService(String executionPath, String definitionPath,
                                String reldefinitionPath, String serviceName, String outPath, Filter filter); List<GenSrcFile> generateBalSource(GenType type, String definitionPath,
                                              String reldefinitionPath, String serviceName, Filter filter); @Deprecated void writeBallerina(Object object, String templateDir, String templateName, String outPath); String getSrcPackage(); void setSrcPackage(String srcPackage); String getModelPackage(); void setModelPackage(String modelPackage);  }