use of org.walkmod.conf.entities.ChainConfig in project walkmod-core by walkmod.
the class YAMLConfigurationProviderTest method testCompleteYaml.
@Test
public void testCompleteYaml() {
YAMLConfigurationProvider provider = new YAMLConfigurationProvider("src/test/resources/yaml/walkmod.yml");
Configuration conf = new ConfigurationImpl();
provider.init(conf);
provider.load();
Assert.assertEquals(2, conf.getPlugins().size());
Iterator<PluginConfig> itPluginCfg = conf.getPlugins().iterator();
PluginConfig firstPlugin = itPluginCfg.next();
Assert.assertEquals("org.walkmod", firstPlugin.getGroupId());
Assert.assertEquals("walkmod-maven-plugin", firstPlugin.getArtifactId());
Assert.assertEquals("[1.0, 2.0)", firstPlugin.getVersion());
Assert.assertEquals(1, conf.getProviderConfigurations().size());
Iterator<ProviderConfig> itProvCfg = conf.getProviderConfigurations().iterator();
Assert.assertEquals("walkmod:commons:maven", itProvCfg.next().getType());
Assert.assertEquals(1, conf.getChainConfigs().size());
ChainConfig cc = conf.getChainConfigs().iterator().next();
Assert.assertEquals("main-chain", cc.getName());
Assert.assertNotNull(cc.getReaderConfig());
Assert.assertNull(cc.getReaderConfig().getPath());
Assert.assertEquals(2, cc.getWalkerConfig().getTransformations().size());
Assert.assertNotNull(cc.getWriterConfig());
Assert.assertNull(cc.getWriterConfig().getPath());
Iterator<TransformationConfig> it = cc.getWalkerConfig().getTransformations().iterator();
TransformationConfig transCfg = it.next();
Assert.assertEquals("walkmod:commons:method-refactor", transCfg.getType());
Assert.assertNotNull(transCfg.getParameters());
Assert.assertEquals("src/conf/refactoring-methods.json", transCfg.getParameters().get("refactoringConfigFile"));
}
use of org.walkmod.conf.entities.ChainConfig in project walkmod-core by walkmod.
the class YAMLConfigurationProviderTest method testEmptyChain.
@Test
public void testEmptyChain() throws Exception {
File file = new File("src/test/resources/yaml/addEmptychain.yml");
if (file.exists()) {
file.delete();
}
file.createNewFile();
FileUtils.write(file, "");
YAMLConfigurationProvider provider = new YAMLConfigurationProvider(file.getPath());
Configuration conf = new ConfigurationImpl();
provider.init(conf);
ChainConfig chainCfg = new ChainConfigImpl();
try {
provider.addChainConfig(chainCfg, false, null);
String output = FileUtils.readFileToString(file);
Assert.assertEquals("", output);
} finally {
if (file.exists()) {
file.delete();
}
}
}
Aggregations