@Test public void appropriateFiltersAreUsedOnModuleDepRetrieval() { final Delivery delivery = DataModelFactory.createDelivery( SAMPLE_NAME, SAMPLE_VERSION, LocalDate.now().toString(), Arrays.asList("one")); final DbModule m1 = makeModule("one"); final RepositoryHandler repoHandler = makeRepoHandler(m1); final DependencyHandler depHandler = mock(DependencyHandler.class); withDeps(depHandler, "one", "one_a"); final DataFetchingUtils sut = new DataFetchingUtils(); final Set<String> deliveryDependencies = sut.getDeliveryDependencies(repoHandler, depHandler, delivery); ArgumentCaptor<FiltersHolder> filterCollector = ArgumentCaptor.forClass(FiltersHolder.class); verify(depHandler, times(1)).getModuleDependencies(eq("one"), filterCollector.capture()); Decorator d = filterCollector.getValue().getDecorator(); assertFalse(d.getShowCorporate()); assertTrue(d.getShowThirdparty()); }
public Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler, final DependencyHandler depHandler, final Delivery delivery) { final FiltersHolder filters = new FiltersHolder(); filters.getDecorator().setShowCorporate(Boolean.FALSE); filters.getDecorator().setShowThirdparty(Boolean.TRUE); Set<String> deps = new HashSet<>(); delivery.getDependencies().forEach(d -> { final DbModule module = repoHandler.getModule(d); if (module != null) { final List<Dependency> allDependencies = depHandler.getModuleDependencies(module.getId(), filters); allDependencies.forEach(dep -> deps.add(dep.getTarget().getGavc())); } else { if(isFullGAVC(d)) { deps.add(strip(d, 2)); } else { deps.add(d); } } }); return deps; }
DataFetchingUtils { public Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler, final DependencyHandler depHandler, final Delivery delivery) { final FiltersHolder filters = new FiltersHolder(); filters.getDecorator().setShowCorporate(Boolean.FALSE); filters.getDecorator().setShowThirdparty(Boolean.TRUE); Set<String> deps = new HashSet<>(); delivery.getDependencies().forEach(d -> { final DbModule module = repoHandler.getModule(d); if (module != null) { final List<Dependency> allDependencies = depHandler.getModuleDependencies(module.getId(), filters); allDependencies.forEach(dep -> deps.add(dep.getTarget().getGavc())); } else { if(isFullGAVC(d)) { deps.add(strip(d, 2)); } else { deps.add(d); } } }); return deps; } }
DataFetchingUtils { public Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler, final DependencyHandler depHandler, final Delivery delivery) { final FiltersHolder filters = new FiltersHolder(); filters.getDecorator().setShowCorporate(Boolean.FALSE); filters.getDecorator().setShowThirdparty(Boolean.TRUE); Set<String> deps = new HashSet<>(); delivery.getDependencies().forEach(d -> { final DbModule module = repoHandler.getModule(d); if (module != null) { final List<Dependency> allDependencies = depHandler.getModuleDependencies(module.getId(), filters); allDependencies.forEach(dep -> deps.add(dep.getTarget().getGavc())); } else { if(isFullGAVC(d)) { deps.add(strip(d, 2)); } else { deps.add(d); } } }); return deps; }  }
DataFetchingUtils { public Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler, final DependencyHandler depHandler, final Delivery delivery) { final FiltersHolder filters = new FiltersHolder(); filters.getDecorator().setShowCorporate(Boolean.FALSE); filters.getDecorator().setShowThirdparty(Boolean.TRUE); Set<String> deps = new HashSet<>(); delivery.getDependencies().forEach(d -> { final DbModule module = repoHandler.getModule(d); if (module != null) { final List<Dependency> allDependencies = depHandler.getModuleDependencies(module.getId(), filters); allDependencies.forEach(dep -> deps.add(dep.getTarget().getGavc())); } else { if(isFullGAVC(d)) { deps.add(strip(d, 2)); } else { deps.add(d); } } }); return deps; }  List<DbProduct> getProductWithCommercialDeliveries(final RepositoryHandler repoHandler); Optional<Delivery> getCommercialDelivery(final RepositoryHandler repoHandler,
                                                    final String name,
                                                    final String version); Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler,
                                               final DependencyHandler depHandler,
                                               final Delivery delivery); void initCorporateIDs(final RepositoryHandler repoHandler,
                                 final String orgName); boolean isThirdParty(final DbArtifact artifact); }
DataFetchingUtils { public Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler, final DependencyHandler depHandler, final Delivery delivery) { final FiltersHolder filters = new FiltersHolder(); filters.getDecorator().setShowCorporate(Boolean.FALSE); filters.getDecorator().setShowThirdparty(Boolean.TRUE); Set<String> deps = new HashSet<>(); delivery.getDependencies().forEach(d -> { final DbModule module = repoHandler.getModule(d); if (module != null) { final List<Dependency> allDependencies = depHandler.getModuleDependencies(module.getId(), filters); allDependencies.forEach(dep -> deps.add(dep.getTarget().getGavc())); } else { if(isFullGAVC(d)) { deps.add(strip(d, 2)); } else { deps.add(d); } } }); return deps; }  List<DbProduct> getProductWithCommercialDeliveries(final RepositoryHandler repoHandler); Optional<Delivery> getCommercialDelivery(final RepositoryHandler repoHandler,
                                                    final String name,
                                                    final String version); Set<String> getDeliveryDependencies(final RepositoryHandler repoHandler,
                                               final DependencyHandler depHandler,
                                               final Delivery delivery); void initCorporateIDs(final RepositoryHandler repoHandler,
                                 final String orgName); boolean isThirdParty(final DbArtifact artifact);  }