ModuleAnalyzer { public List<ArtifactSpec> getDependencies() { if (this.module == null) { return Collections.emptyList(); } List<ArtifactType<ResourcesType<ModuleDescriptor>>> artifacts = this.module.getOrCreateResources().getAllArtifact(); List<ArtifactSpec> dependencies = new ArrayList<>(); for (ArtifactType<ResourcesType<ModuleDescriptor>> artifact : artifacts) { ArtifactSpec dep = ArtifactSpec.fromMscGav(artifact.getName()); dep.shouldGather = true; dependencies.add(dep); } return dependencies; } ModuleAnalyzer(File f);  ModuleAnalyzer(Path p);  ModuleAnalyzer(InputStream in); String getName(); String getSlot(); List<ArtifactSpec> getDependencies();  }
@Test public void testAnalysis() throws Exception { InputStream moduleXml = getClass().getClassLoader().getResourceAsStream("module.xml"); ModuleAnalyzer analyzer = new ModuleAnalyzer(moduleXml); assertThat(analyzer.getDependencies()).hasSize(2); List<String> gavs = analyzer.getDependencies().stream().map(e -> e.mscGav()).collect(Collectors.toList()); assertThat(gavs).contains("org.wildfly:wildfly-webservices-server-integration:10.0.0.CR4"); assertThat(gavs).contains("org.jboss.ws.cxf:jbossws-cxf-resources:5.1.0.Final:wildfly1000"); assertThat(analyzer.getDependencies().stream().allMatch(e -> e.shouldGather)); }
@Test public void testAvoidAliases() throws IOException { InputStream moduleXml = getClass().getClassLoader().getResourceAsStream("alias-module.xml"); ModuleAnalyzer analyzer = new ModuleAnalyzer(moduleXml); assertThat(analyzer.getDependencies()).hasSize(0); }