DataUtils { public static List<String> getAllArtifacts(final DbModule module) { final List<String> gavcs = module.getArtifacts(); for(final DbModule submodule: module.getSubmodules()){ gavcs.addAll(getAllArtifacts(submodule)); } return gavcs; } private  DataUtils(); static List<String> getAllArtifacts(final DbModule module); static Set<Artifact> getAllArtifacts(final Module module); static Set<Dependency> getAllDependencies(final Module module); static List<DbDependency> getAllDbDependencies(final DbModule module); static String getModuleName(final String moduleId); static String getModuleVersion(final String moduleId); static String getGroupId(final String gavc); static DbArtifact createDbArtifact(final String gavc); static Artifact createArtifact(final String gavc); static List<DbModule> getAllSubmodules(final DbModule module); static boolean isFullGAVC(final String entry); static String strip(final String gavc, final int stripCount); static void sort(final List<Artifact> targets);  }
@Test public void getAllDbArtifacts(){ final DbModule module = new DbModule(); module.addArtifact(new DbArtifact()); final DbModule submodule1 = new DbModule(); submodule1.addArtifact(new DbArtifact()); final DbModule submodule2 = new DbModule(); submodule2.addArtifact(new DbArtifact()); submodule1.addSubmodule(submodule2); module.addSubmodule(submodule1); final List<String> gavcs = DataUtils.getAllArtifacts(module); assertEquals(3, gavcs.size()); }
@Test public void getAllArtifacts(){ final Module module = DataModelFactory.createModule("root", "1"); module.addArtifact(DataModelFactory.createArtifact("gr1","art1","123","","","")); final Module submodule1 = DataModelFactory.createModule("sub1", "1"); submodule1.addArtifact(DataModelFactory.createArtifact("gr2","art2","321","","","")); final Module submodule2 = DataModelFactory.createModule("sub2", "1"); submodule2.addArtifact(DataModelFactory.createArtifact("gr3","art3","456","","","")); submodule1.addSubmodule(submodule2); module.addSubmodule(submodule1); final Set<Artifact> artifacts = DataUtils.getAllArtifacts(module); assertEquals(3, artifacts.size()); }