@Test public void getModuleDependenciesReturnsAlsoSubModuleDependenciesWhatEverTheScope(){ final DbModule module = new DbModule(); module.setName("module"); module.setVersion("1.0.0"); final DbModule subModule = new DbModule(); subModule.setName("subModule"); subModule.setVersion("1.0.0"); module.addSubmodule(subModule); final DbArtifact dependency1 = new DbArtifact(); dependency1.setGroupId("org.axway.grapes.test"); dependency1.setArtifactId("dependency1"); dependency1.setVersion("123"); subModule.addDependency(dependency1.getGavc(), Scope.COMPILE); final DbArtifact dependency2 = new DbArtifact(); dependency2.setGroupId("org.axway.grapes.test"); dependency2.setArtifactId("dependency2"); dependency2.setVersion("456"); subModule.addDependency(dependency2.getGavc(), Scope.TEST); final DbArtifact dependency3 = new DbArtifact(); dependency3.setGroupId("org.axway.grapes.test"); dependency3.setArtifactId("dependency3"); dependency3.setVersion("789"); subModule.addDependency(dependency3.getGavc(), Scope.RUNTIME); final DbArtifact dependency4 = new DbArtifact(); dependency4.setGroupId("org.axway.grapes.test"); dependency4.setArtifactId("dependency4"); dependency4.setVersion("101"); subModule.addDependency(dependency4.getGavc(), Scope.PROVIDED); final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class); when(repositoryHandler.getModule(module.getId())).thenReturn(module); when(repositoryHandler.getArtifact(dependency1.getGavc())).thenReturn(dependency1); when(repositoryHandler.getArtifact(dependency2.getGavc())).thenReturn(dependency2); when(repositoryHandler.getArtifact(dependency3.getGavc())).thenReturn(dependency3); when(repositoryHandler.getArtifact(dependency4.getGavc())).thenReturn(dependency4); final FiltersHolder filters = new FiltersHolder(); filters.getScopeHandler().setScopeComp(true); filters.getScopeHandler().setScopePro(true); filters.getScopeHandler().setScopeRun(true); filters.getScopeHandler().setScopeTest(true); filters.getDecorator().setShowThirdparty(true); final DependencyHandler dependencyHandler = new DependencyHandler(repositoryHandler); final List<Dependency> dependencies = dependencyHandler.getModuleDependencies(module.getId(), filters); assertNotNull(dependencies); assertEquals(4, dependencies.size()); }
public List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters){ final DbModule module = moduleHandler.getModule(moduleId); final DbOrganization organization = moduleHandler.getOrganization(module); filters.setCorporateFilter(new CorporateFilter(organization)); return getModuleDependencies(module, filters, 1, new ArrayList<String>()); }
DependencyHandler { public List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters){ final DbModule module = moduleHandler.getModule(moduleId); final DbOrganization organization = moduleHandler.getOrganization(module); filters.setCorporateFilter(new CorporateFilter(organization)); return getModuleDependencies(module, filters, 1, new ArrayList<String>()); } }
DependencyHandler { public List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters){ final DbModule module = moduleHandler.getModule(moduleId); final DbOrganization organization = moduleHandler.getOrganization(module); filters.setCorporateFilter(new CorporateFilter(organization)); return getModuleDependencies(module, filters, 1, new ArrayList<String>()); } DependencyHandler(final RepositoryHandler repositoryHandler); }
DependencyHandler { public List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters){ final DbModule module = moduleHandler.getModule(moduleId); final DbOrganization organization = moduleHandler.getOrganization(module); filters.setCorporateFilter(new CorporateFilter(organization)); return getModuleDependencies(module, filters, 1, new ArrayList<String>()); } DependencyHandler(final RepositoryHandler repositoryHandler); List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters); DependencyReport getDependencyReport(final String moduleId, final FiltersHolder filters); }
DependencyHandler { public List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters){ final DbModule module = moduleHandler.getModule(moduleId); final DbOrganization organization = moduleHandler.getOrganization(module); filters.setCorporateFilter(new CorporateFilter(organization)); return getModuleDependencies(module, filters, 1, new ArrayList<String>()); } DependencyHandler(final RepositoryHandler repositoryHandler); List<Dependency> getModuleDependencies(final String moduleId, final FiltersHolder filters); DependencyReport getDependencyReport(final String moduleId, final FiltersHolder filters);  }