@Test public void testGetCorporateDependencies(){ final Module module = DataModelFactory.createModule("module1", "1.0.0-SNAPSHOT"); final Artifact artifact1 = DataModelFactory.createArtifact("com.my.company.test", "dependency1", "1.0.0-SNAPSHOT", null, "jar", "jar"); final Dependency dependency1 = DataModelFactory.createDependency(artifact1, Scope.COMPILE); final Artifact artifact2 = DataModelFactory.createArtifact("org.all", "dependency1", "1.0.0-SNAPSHOT", null, "jar", "jar"); final Dependency dependency2 = DataModelFactory.createDependency(artifact2, Scope.COMPILE); module.addDependency(dependency1); module.addDependency(dependency2); final List<String> corporateFilters = new ArrayList<String>(); corporateFilters.add("com.my.company"); final List<Dependency> dependencies = ModuleUtils.getCorporateDependencies(module, corporateFilters); assertNotNull(dependencies); assertEquals(1, dependencies.size()); assertEquals(dependency1, dependencies.get(0)); }
public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) { final List<Dependency> corporateDependencies = new ArrayList<Dependency>(); final Pattern corporatePattern = generateCorporatePattern(corporateFilters); for(final Dependency dependency: getAllDependencies(module)){ if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){ corporateDependencies.add(dependency); } } return corporateDependencies; }
ModuleUtils { public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) { final List<Dependency> corporateDependencies = new ArrayList<Dependency>(); final Pattern corporatePattern = generateCorporatePattern(corporateFilters); for(final Dependency dependency: getAllDependencies(module)){ if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){ corporateDependencies.add(dependency); } } return corporateDependencies; } }
ModuleUtils { public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) { final List<Dependency> corporateDependencies = new ArrayList<Dependency>(); final Pattern corporatePattern = generateCorporatePattern(corporateFilters); for(final Dependency dependency: getAllDependencies(module)){ if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){ corporateDependencies.add(dependency); } } return corporateDependencies; } private  ModuleUtils(); }
ModuleUtils { public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) { final List<Dependency> corporateDependencies = new ArrayList<Dependency>(); final Pattern corporatePattern = generateCorporatePattern(corporateFilters); for(final Dependency dependency: getAllDependencies(module)){ if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){ corporateDependencies.add(dependency); } } return corporateDependencies; } private  ModuleUtils(); static List<Artifact> getAllArtifacts(final Module module); static List<Dependency> getAllDependencies(final Module module); static Set<Dependency> getAllDependencies(final Module module, final List<String> producedArtifacts); static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters); static List<Dependency> getThirdPartyLibraries(final Module module, final List<String> corporateFilters); }
ModuleUtils { public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) { final List<Dependency> corporateDependencies = new ArrayList<Dependency>(); final Pattern corporatePattern = generateCorporatePattern(corporateFilters); for(final Dependency dependency: getAllDependencies(module)){ if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){ corporateDependencies.add(dependency); } } return corporateDependencies; } private  ModuleUtils(); static List<Artifact> getAllArtifacts(final Module module); static List<Dependency> getAllDependencies(final Module module); static Set<Dependency> getAllDependencies(final Module module, final List<String> producedArtifacts); static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters); static List<Dependency> getThirdPartyLibraries(final Module module, final List<String> corporateFilters);  }