CopybaraGenerator { public String generateCopybaraConfigFile() { StringJoiner copybaraConfig = new StringJoiner("\n"); copybaraConfig.add("urlOrigin = \"https: copybaraConfig.add("urlDestination = \"file: copybaraConfig.add("core.workflow("); copybaraConfig.add(" name = \"default\","); copybaraConfig.add(" origin = git.origin("); copybaraConfig.add(" url = urlOrigin,"); copybaraConfig.add(" ref = \"master\","); copybaraConfig.add(" ),"); copybaraConfig.add(" destination = git.destination("); copybaraConfig.add(" url = urlDestination,"); copybaraConfig.add(" fetch = \"master\","); copybaraConfig.add(" push = \"master\","); copybaraConfig.add(" ),"); copybaraConfig.add(" authoring = authoring.pass_thru(\"OpenTOSCA Bot <opentosca@iaas.uni-stuttgart.de>\"),"); copybaraConfig.add(" " + generateOriginFilesConfig()); copybaraConfig.add(" destination_files = glob([\"**\"], exclude = [\"README_INTERNAL.md\"]),"); copybaraConfig.add(")"); return copybaraConfig.toString(); } CopybaraGenerator();  CopybaraGenerator(IRepository repository); String generateOriginFilesConfig(); String generateCopybaraConfigFile(); void generateCopybaraConfigFile(Path targetFile);  }
@Test public void generatedConfigHasCorrectStrings() throws Exception { this.setRevisionTo("4b218e6"); CopybaraGenerator copybaraGenerator = new CopybaraGenerator(); String config = copybaraGenerator.generateCopybaraConfigFile(); assertEquals("urlOrigin = \"https: "urlDestination = \"file: "core.workflow(\n" + " name = \"default\",\n" + " origin = git.origin(\n" + " url = urlOrigin,\n" + " ref = \"master\",\n" + " ),\n" + " destination = git.destination(\n" + " url = urlDestination,\n" + " fetch = \"master\",\n" + " push = \"master\",\n" + " ),\n" + " authoring = authoring.pass_thru(\"OpenTOSCA Bot <opentosca@iaas.uni-stuttgart.de>\"),\n" + " origin_files = glob([\"README.md\", \"LICENSE\", \"artifacttemplates/http%3A%2F%2Fplain.winery.opentosca.org%2Fartifacttemplates/ArtifactTemplateWithFilesAndSources-ArtifactTypeWithoutProperties/**\",\n" + " \"artifacttemplates/http%3A%2F%2Fplain.winery.opentosca.org%2Fartifacttemplates/ArtifactTemplateWithoutAnyFiles-ArtifactTypeWithoutProperties/**\"]),\n" + " destination_files = glob([\"**\"], exclude = [\"README_INTERNAL.md\"]),\n" + ")", config); }