@Test public void validateDomainOneValidDomain() throws ValidationException { Set<ArtifactCoordinates> domains = new HashSet<>(); ArtifactCoordinates muleDomain = new ArtifactCoordinates(GROUP_ID, ARTIFACT_ID_PREFIX + "a", VERSION, TYPE, MULE_DOMAIN.toString()); muleDomain.setScope("provided"); domains.add(muleDomain); validator.validateDomain(domains); }
protected void validateDomain(Set<ArtifactCoordinates> domains) throws ValidationException { checkArgument(domains != null, "Set of domains should not be null"); if (!domains.stream() .allMatch(artifactCoordinates -> StringUtils.equals(artifactCoordinates.getClassifier(), MULE_DOMAIN.toString()))) { String message = "Not all dependencies are mule domains"; throw new ValidationException(message); } if (domains.size() > MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS) { String message = "A mule project of type " + projectInformation.getPackaging() + " should reference at most " + MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS + ". However, the project has references to the following domains: " + domains.stream().collect(Collectors.toList()); throw new ValidationException(message); } for (ArtifactCoordinates domain : domains) { if (!StringUtils.equals("provided", domain.getScope())) { throw new ValidationException("A mule-domain dependency should have the <provided> scope"); } } }
MuleProjectValidator extends AbstractProjectValidator { protected void validateDomain(Set<ArtifactCoordinates> domains) throws ValidationException { checkArgument(domains != null, "Set of domains should not be null"); if (!domains.stream() .allMatch(artifactCoordinates -> StringUtils.equals(artifactCoordinates.getClassifier(), MULE_DOMAIN.toString()))) { String message = "Not all dependencies are mule domains"; throw new ValidationException(message); } if (domains.size() > MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS) { String message = "A mule project of type " + projectInformation.getPackaging() + " should reference at most " + MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS + ". However, the project has references to the following domains: " + domains.stream().collect(Collectors.toList()); throw new ValidationException(message); } for (ArtifactCoordinates domain : domains) { if (!StringUtils.equals("provided", domain.getScope())) { throw new ValidationException("A mule-domain dependency should have the <provided> scope"); } } } }
MuleProjectValidator extends AbstractProjectValidator { protected void validateDomain(Set<ArtifactCoordinates> domains) throws ValidationException { checkArgument(domains != null, "Set of domains should not be null"); if (!domains.stream() .allMatch(artifactCoordinates -> StringUtils.equals(artifactCoordinates.getClassifier(), MULE_DOMAIN.toString()))) { String message = "Not all dependencies are mule domains"; throw new ValidationException(message); } if (domains.size() > MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS) { String message = "A mule project of type " + projectInformation.getPackaging() + " should reference at most " + MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS + ". However, the project has references to the following domains: " + domains.stream().collect(Collectors.toList()); throw new ValidationException(message); } for (ArtifactCoordinates domain : domains) { if (!StringUtils.equals("provided", domain.getScope())) { throw new ValidationException("A mule-domain dependency should have the <provided> scope"); } } } MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              boolean strictCheck);  MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              ProjectRequirement requirement); }
MuleProjectValidator extends AbstractProjectValidator { protected void validateDomain(Set<ArtifactCoordinates> domains) throws ValidationException { checkArgument(domains != null, "Set of domains should not be null"); if (!domains.stream() .allMatch(artifactCoordinates -> StringUtils.equals(artifactCoordinates.getClassifier(), MULE_DOMAIN.toString()))) { String message = "Not all dependencies are mule domains"; throw new ValidationException(message); } if (domains.size() > MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS) { String message = "A mule project of type " + projectInformation.getPackaging() + " should reference at most " + MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS + ". However, the project has references to the following domains: " + domains.stream().collect(Collectors.toList()); throw new ValidationException(message); } for (ArtifactCoordinates domain : domains) { if (!StringUtils.equals("provided", domain.getScope())) { throw new ValidationException("A mule-domain dependency should have the <provided> scope"); } } } MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              boolean strictCheck);  MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              ProjectRequirement requirement); static void isProjectStructureValid(String packagingType, Path projectBaseDir); void validateSharedLibraries(List<SharedLibraryDependency> sharedLibraries,
                                      List<ArtifactCoordinates> projectDependencies); }
MuleProjectValidator extends AbstractProjectValidator { protected void validateDomain(Set<ArtifactCoordinates> domains) throws ValidationException { checkArgument(domains != null, "Set of domains should not be null"); if (!domains.stream() .allMatch(artifactCoordinates -> StringUtils.equals(artifactCoordinates.getClassifier(), MULE_DOMAIN.toString()))) { String message = "Not all dependencies are mule domains"; throw new ValidationException(message); } if (domains.size() > MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS) { String message = "A mule project of type " + projectInformation.getPackaging() + " should reference at most " + MULE_PROJECT_MAXIMUM_NUMBER_OF_DOMAINS + ". However, the project has references to the following domains: " + domains.stream().collect(Collectors.toList()); throw new ValidationException(message); } for (ArtifactCoordinates domain : domains) { if (!StringUtils.equals("provided", domain.getScope())) { throw new ValidationException("A mule-domain dependency should have the <provided> scope"); } } } MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              boolean strictCheck);  MuleProjectValidator(ProjectInformation projectInformation, List<SharedLibraryDependency> sharedLibraries,
                              ProjectRequirement requirement); static void isProjectStructureValid(String packagingType, Path projectBaseDir); void validateSharedLibraries(List<SharedLibraryDependency> sharedLibraries,
                                      List<ArtifactCoordinates> projectDependencies);  }