@Test public void readFull() throws ConfigurationException, UnsupportedEncodingException, IOException { try (Reader in = new InputStreamReader(getClass().getResourceAsStream("/srcdeps-full.yaml"), "utf-8")) { Configuration actual = new YamlConfigurationReader().read(in).build(); Configuration expected = Configuration.builder() .configModelVersion("3.0") .encoding(Charset.forName("UTF-16")) .forwardAsMasterConfig(true) .forwardProperty("myProp1") .forwardProperty("myProp2") .logToFile(false) .logToConsole(true) .skip(true) .sourcesDirectory(Paths.get("/home/me/.m2/srcdeps")) .verbosity(Verbosity.debug) .buildTimeout(new Duration(35, TimeUnit.MINUTES)) .buildVersionPattern(Pattern.compile(".*-SNAPSHOT")) .buildRef(SrcVersion.parseRef("branch-3.x")) .maven( Maven.builder() .versionsMavenPluginVersion("1.2") .useVersionsMavenPlugin(true) .failWith( MavenAssertions.failWithBuilder() .addDefaults(false) .goal("goal1") .goal("goal2") .profile("profile1") .profile("profile2") .property("property1") .property("property2") ) .failWithout( MavenAssertions.failWithoutBuilder() .goal("goalA") .goal("goalB") .profile("profileA") .profile("profileB") .property("propertyA") .property("propertyB") ) ) .repository( ScmRepository.builder() .id("org.repo1") .encoding(Charset.forName("UTF-8")) .verbosity(Verbosity.trace) .logToFile(true) .logToConsole(false) .include("group1") .include("group2:artifact2:*") .exclude("group3") .exclude("group4:artifact4") .url("url1") .url("url2") .buildArgument("-arg1") .buildArgument("-arg2") .addDefaultBuildArguments(false) .skipTests(false) .buildTimeout(new Duration(64, TimeUnit.SECONDS)) .buildVersionPattern(Pattern.compile("3\\.2\\..*")) .buildRef(SrcVersion.parseRef("revision-deadbeef")) .maven( ScmRepositoryMaven.builder() .versionsMavenPluginVersion("2.2") .useVersionsMavenPlugin(true) .excludeNonRequired(true) .includeRequired(true) .include("org.srcdeps.example:artifact1") .include("org.srcdeps.other:artifact2") ) .gradle( ScmRepositoryGradle.builder() .modelTransformer(CharStreamSource.of("file:my/file")) ) ) .repository( ScmRepository.builder() .id("org.repo2") .encoding(Charset.forName("UTF-8")) .logToFile(true) .logToConsole(false) .include("group3:artifact3") .include("group4:artifact4:1.2.3") .url("url3") .url("url4") .buildArgument("arg3") .addDefaultBuildArguments(false) .skipTests(false) .maven( ScmRepositoryMaven.builder() .useVersionsMavenPlugin(true) .excludeNonRequired(true) .includeRequired(true) ) ) .build(); Assert.assertEquals(expected, actual); final ScmRepository repo1 = actual.getRepositories().iterator().next(); Assert.assertTrue(repo1.getBuildVersionPattern().matcher("3.2.1").matches()); Assert.assertFalse(repo1.getBuildVersionPattern().matcher("3.3.1").matches()); } }
@Override public Configuration.Builder read(Reader in) throws ConfigurationException { Yaml yaml = new Yaml(new SrcdepsConstructor()); Configuration.Builder builder = yaml.loadAs(in, Configuration.Builder.class); return builder; }
YamlConfigurationReader implements ConfigurationReader { @Override public Configuration.Builder read(Reader in) throws ConfigurationException { Yaml yaml = new Yaml(new SrcdepsConstructor()); Configuration.Builder builder = yaml.loadAs(in, Configuration.Builder.class); return builder; } }
YamlConfigurationReader implements ConfigurationReader { @Override public Configuration.Builder read(Reader in) throws ConfigurationException { Yaml yaml = new Yaml(new SrcdepsConstructor()); Configuration.Builder builder = yaml.loadAs(in, Configuration.Builder.class); return builder; }  }
YamlConfigurationReader implements ConfigurationReader { @Override public Configuration.Builder read(Reader in) throws ConfigurationException { Yaml yaml = new Yaml(new SrcdepsConstructor()); Configuration.Builder builder = yaml.loadAs(in, Configuration.Builder.class); return builder; }  @Override Configuration.Builder read(Reader in); }
YamlConfigurationReader implements ConfigurationReader { @Override public Configuration.Builder read(Reader in) throws ConfigurationException { Yaml yaml = new Yaml(new SrcdepsConstructor()); Configuration.Builder builder = yaml.loadAs(in, Configuration.Builder.class); return builder; }  @Override Configuration.Builder read(Reader in);  }