return pluginService.generateEasyAntReport(module, moduleAnt, null);
}
@Test
public void testGenerateReport() throws Exception {
EasyAntReport eaReport = generateReport();
Assert.assertNotNull(eaReport);
// the report should contain the run-java plugin
boolean containsBuildType = false;
boolean containsPlugin = true;
for (ImportedModuleReport importedModule : eaReport.getImportedModuleReports()) {
if (importedModule.getModuleMrid().equals("org.apache.easyant.buildtypes#build-std-java;0.9")) {
containsBuildType = true;
}
if (importedModule.getModuleMrid().equals("org.apache.easyant.plugins#run-java;0.9")) {
containsPlugin = true;
}
}
Assert.assertTrue(containsBuildType);
Assert.assertTrue(containsPlugin);
// be sure that the property exist
PropertyDescriptor property = eaReport.getPropertyDescriptors().get("run.main.classname");
Assert.assertNotNull(property);
// check the value of the property
Assert.assertEquals("org.apache.easyant.example.Example", property.getValue());
// be sure that the property exist
PropertyDescriptor srcMainJava = eaReport.getAvailableProperties().get("src.main.java");
Assert.assertNotNull(srcMainJava);
// check the value of the property
Assert.assertEquals("${basedir}/src/main/java", srcMainJava.getValue());
// the property should also be contained in getAvailableProperties which
// list all properties (those for the current module and those in
// imported modules)
property = eaReport.getAvailableProperties().get("run.main.classname");
Assert.assertNotNull(property);
// check the value of the property
Assert.assertEquals("org.apache.easyant.example.Example", property.getValue());
// check that package ExtensionPoint exists and that jar:jar target is bound to
// this extension-point
ExtensionPointReport packageEP = null;
for (ExtensionPointReport extensionPoint : eaReport.getExtensionPointReports()) {
if ("package".equals(extensionPoint.getName())) {
packageEP = extensionPoint;
break;
}
}
Assert.assertNotNull(packageEP);
Assert.assertEquals("compile,abstract-package:package,hello-world", packageEP.getDepends());
List<TargetReport> targets = packageEP.getTargetReports();
Set<String> expectedTargets = new HashSet<String>(Arrays.asList("hello-world"));
Assert.assertEquals(expectedTargets.size(), targets.size());
for (TargetReport target : packageEP.getTargetReports()) {
Assert.assertTrue("expected to find " + target.getName(), expectedTargets.remove(target.getName()));
}
TargetReport helloWorld = eaReport.getTargetReport("hello-world");
Assert.assertNotNull(helloWorld);
Assert.assertTrue("package".equals(helloWorld.getExtensionPoint()));
}