@Test public void validateDomainOneDomainTest() throws ValidationException { Set<ArtifactCoordinates> domains = new HashSet<>(); ArtifactCoordinates muleDomainA = new ArtifactCoordinates(GROUP_ID, ARTIFACT_ID_PREFIX + "a", VERSION, TYPE, DOMAIN_CLASSIFIER); ArtifactCoordinates muleDomainB = new ArtifactCoordinates(GROUP_ID, ARTIFACT_ID_PREFIX + "b", VERSION, TYPE, DOMAIN_CLASSIFIER); domains.add(muleDomainA); domains.add(muleDomainB); expectedException.expect(ValidationException.class); expectedException .expectMessage("A mule domain bundle must contain exactly one mule domain. " + "However, the project has reference to the following domains: "); expectedException.expectMessage(muleDomainA.toString()); expectedException.expectMessage(muleDomainB.toString()); 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() != DOMAIN_BUNDLE_VALID_NUMBER_OF_DOMAINS) { String message = "A mule domain bundle must contain exactly one mule domain. "; if (domains.isEmpty()) { message += "However, the project has no reference to domains in its dependencies."; } else { message += "However, the project has reference to the following domains: " + domains.stream().collect(Collectors.toList()); } throw new ValidationException(message); } }
DomainBundleProjectValidator 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() != DOMAIN_BUNDLE_VALID_NUMBER_OF_DOMAINS) { String message = "A mule domain bundle must contain exactly one mule domain. "; if (domains.isEmpty()) { message += "However, the project has no reference to domains in its dependencies."; } else { message += "However, the project has reference to the following domains: " + domains.stream().collect(Collectors.toList()); } throw new ValidationException(message); } } }
DomainBundleProjectValidator 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() != DOMAIN_BUNDLE_VALID_NUMBER_OF_DOMAINS) { String message = "A mule domain bundle must contain exactly one mule domain. "; if (domains.isEmpty()) { message += "However, the project has no reference to domains in its dependencies."; } else { message += "However, the project has reference to the following domains: " + domains.stream().collect(Collectors.toList()); } throw new ValidationException(message); } } DomainBundleProjectValidator(ProjectInformation defaultProjectInformation,
                                      AetherMavenClient aetherMavenClient); }
DomainBundleProjectValidator 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() != DOMAIN_BUNDLE_VALID_NUMBER_OF_DOMAINS) { String message = "A mule domain bundle must contain exactly one mule domain. "; if (domains.isEmpty()) { message += "However, the project has no reference to domains in its dependencies."; } else { message += "However, the project has reference to the following domains: " + domains.stream().collect(Collectors.toList()); } throw new ValidationException(message); } } DomainBundleProjectValidator(ProjectInformation defaultProjectInformation,
                                      AetherMavenClient aetherMavenClient);  }
DomainBundleProjectValidator 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() != DOMAIN_BUNDLE_VALID_NUMBER_OF_DOMAINS) { String message = "A mule domain bundle must contain exactly one mule domain. "; if (domains.isEmpty()) { message += "However, the project has no reference to domains in its dependencies."; } else { message += "However, the project has reference to the following domains: " + domains.stream().collect(Collectors.toList()); } throw new ValidationException(message); } } DomainBundleProjectValidator(ProjectInformation defaultProjectInformation,
                                      AetherMavenClient aetherMavenClient);   }