use of org.walkmod.commands.AddTransformationCommand in project walkmod-core by walkmod.
the class XMLConfigurationProviderTest method testAddIncludesExcludeInDefault.
@Test
public void testAddIncludesExcludeInDefault() throws Exception {
AddTransformationCommand command = new AddTransformationCommand("imports-cleaner", null, false, null, null, null, null, false);
File aux = new File("src/test/resources/xmlincludes2");
aux.mkdirs();
File xml = new File(aux, "walkmod.xml");
XMLConfigurationProvider prov = new XMLConfigurationProvider(xml.getPath(), false);
try {
prov.createConfig();
TransformationConfig transfCfg = command.buildTransformationCfg();
prov.addTransformationConfig(null, null, transfCfg, false, null, null);
prov.addIncludesToChain(null, Arrays.asList("foo"), false, true, false);
String output = FileUtils.readFileToString(xml);
System.out.println(output);
Assert.assertTrue(output.contains("wildcard") && output.contains("foo"));
} finally {
FileUtils.deleteDirectory(aux);
}
}
use of org.walkmod.commands.AddTransformationCommand in project walkmod-core by walkmod.
the class XMLConfigurationProviderTest method testRemoveChains.
@Test
public void testRemoveChains() throws Exception {
AddTransformationCommand command = new AddTransformationCommand("imports-cleaner", "mychain", false, null, null, null, null, false);
File aux = new File("src/test/resources/xml");
aux.mkdirs();
File xml = new File(aux, "walkmod.xml");
XMLConfigurationProvider prov = new XMLConfigurationProvider(xml.getPath(), false);
try {
prov.createConfig();
TransformationConfig transfCfg = command.buildTransformationCfg();
prov.addTransformationConfig("mychain", null, transfCfg, false, null, null);
String output = FileUtils.readFileToString(xml);
Assert.assertTrue(output.contains("mychain"));
List<String> chains = new LinkedList<String>();
chains.add("mychain");
prov.removeChains(chains, false);
output = FileUtils.readFileToString(xml);
System.out.println(output);
Assert.assertTrue(!output.contains("mychain"));
} finally {
if (xml.exists()) {
xml.delete();
}
}
}
use of org.walkmod.commands.AddTransformationCommand in project walkmod-core by walkmod.
the class XMLConfigurationProviderTest method testSetReader.
@Test
public void testSetReader() throws Exception {
File aux = new File("src/test/resources/xml");
aux.mkdirs();
File xml = new File(aux, "walkmod.xml");
XMLConfigurationProvider prov = new XMLConfigurationProvider(xml.getPath(), false);
try {
Configuration conf = new ConfigurationImpl();
prov.init(conf);
prov.createConfig();
AddTransformationCommand command = new AddTransformationCommand("imports-cleaner", null, false, null, null, null, null, false);
prov.addTransformationConfig(null, null, command.buildTransformationCfg(), false, null, null);
prov.setReader(null, "walkmod:commons:file-reader", null, false, null);
String output = FileUtils.readFileToString(xml);
System.out.println(output);
Assert.assertTrue(output.contains("walkmod:commons:file-reader"));
} finally {
if (xml.exists()) {
xml.delete();
}
}
}
use of org.walkmod.commands.AddTransformationCommand in project walkmod-core by walkmod.
the class XMLConfigurationProviderTest method testAddExcludes.
@Test
public void testAddExcludes() throws Exception {
AddTransformationCommand command = new AddTransformationCommand("imports-cleaner", "mychain", false, null, null, null, null, false);
File aux = new File("src/test/resources/xmlincludes");
aux.mkdirs();
File xml = new File(aux, "walkmod.xml");
XMLConfigurationProvider prov = new XMLConfigurationProvider(xml.getPath(), false);
try {
prov.createConfig();
TransformationConfig transfCfg = command.buildTransformationCfg();
prov.addTransformationConfig("mychain", null, transfCfg, false, null, null);
prov.setWriter("mychain", "eclipse-writer", null, false, null);
prov.addExcludesToChain("mychain", Arrays.asList("foo"), false, true, false);
String output = FileUtils.readFileToString(xml);
System.out.println(output);
Assert.assertTrue(output.contains("wildcard") && output.contains("foo"));
} finally {
FileUtils.deleteDirectory(aux);
}
}
use of org.walkmod.commands.AddTransformationCommand in project walkmod-core by walkmod.
the class XMLConfigurationProviderTest method testAddIncludesToReaderAndWriter.
@Test
public void testAddIncludesToReaderAndWriter() throws Exception {
AddTransformationCommand command = new AddTransformationCommand("imports-cleaner", "mychain", false, null, null, null, null, false);
File aux = new File("src/test/resources/xmlincludes");
aux.mkdirs();
File xml = new File(aux, "walkmod.xml");
XMLConfigurationProvider prov = new XMLConfigurationProvider(xml.getPath(), false);
try {
prov.createConfig();
TransformationConfig transfCfg = command.buildTransformationCfg();
prov.addTransformationConfig("mychain", null, transfCfg, false, null, null);
prov.setWriter("mychain", "eclipse-writer", null, false, null);
prov.addIncludesToChain("mychain", Arrays.asList("foo"), false, true, true);
String output = FileUtils.readFileToString(xml);
System.out.println(output);
Assert.assertTrue(output.contains("wildcard") && output.contains("foo"));
} finally {
FileUtils.deleteDirectory(aux);
}
}
Aggregations