@Test public void validateCoordinatesTestMvn() { artifact.addCoordinate(new Coordinate(Coordinate.Types.MAVEN, "test", "test", "test")); assertThat(validator.evaluate(artifacts).getEvaluationResults().size()).isEqualTo(0); }
@Override public IPolicyEvaluation evaluate(Collection<Artifact> artifacts) { DefaultPolicyEvaluation policyEvaluation = new DefaultPolicyEvaluation(); artifacts.stream() .filter(artifact -> ! artifact.getFlag(Artifact.IS_PROPRIETARY_FLAG_KEY)) .filter(artifact -> artifact.askForAll(ArtifactCoordinates.class).size() == 0) .forEach(artifact -> policyEvaluation.addEvaluationResult("CoordinatesValidator::rule1", "Artifact has no Coordinates", missingCoordinatesSeverity, artifact)); return policyEvaluation; }
CoordinatesValidator extends AbstractComplianceChecker { @Override public IPolicyEvaluation evaluate(Collection<Artifact> artifacts) { DefaultPolicyEvaluation policyEvaluation = new DefaultPolicyEvaluation(); artifacts.stream() .filter(artifact -> ! artifact.getFlag(Artifact.IS_PROPRIETARY_FLAG_KEY)) .filter(artifact -> artifact.askForAll(ArtifactCoordinates.class).size() == 0) .forEach(artifact -> policyEvaluation.addEvaluationResult("CoordinatesValidator::rule1", "Artifact has no Coordinates", missingCoordinatesSeverity, artifact)); return policyEvaluation; } }
CoordinatesValidator extends AbstractComplianceChecker { @Override public IPolicyEvaluation evaluate(Collection<Artifact> artifacts) { DefaultPolicyEvaluation policyEvaluation = new DefaultPolicyEvaluation(); artifacts.stream() .filter(artifact -> ! artifact.getFlag(Artifact.IS_PROPRIETARY_FLAG_KEY)) .filter(artifact -> artifact.askForAll(ArtifactCoordinates.class).size() == 0) .forEach(artifact -> policyEvaluation.addEvaluationResult("CoordinatesValidator::rule1", "Artifact has no Coordinates", missingCoordinatesSeverity, artifact)); return policyEvaluation; } CoordinatesValidator(); }
CoordinatesValidator extends AbstractComplianceChecker { @Override public IPolicyEvaluation evaluate(Collection<Artifact> artifacts) { DefaultPolicyEvaluation policyEvaluation = new DefaultPolicyEvaluation(); artifacts.stream() .filter(artifact -> ! artifact.getFlag(Artifact.IS_PROPRIETARY_FLAG_KEY)) .filter(artifact -> artifact.askForAll(ArtifactCoordinates.class).size() == 0) .forEach(artifact -> policyEvaluation.addEvaluationResult("CoordinatesValidator::rule1", "Artifact has no Coordinates", missingCoordinatesSeverity, artifact)); return policyEvaluation; } CoordinatesValidator(); @Override IPolicyEvaluation evaluate(Collection<Artifact> artifacts); @Override String getRulesetDescription(); @Override void configure(Map<String, String> configMap); }
CoordinatesValidator extends AbstractComplianceChecker { @Override public IPolicyEvaluation evaluate(Collection<Artifact> artifacts) { DefaultPolicyEvaluation policyEvaluation = new DefaultPolicyEvaluation(); artifacts.stream() .filter(artifact -> ! artifact.getFlag(Artifact.IS_PROPRIETARY_FLAG_KEY)) .filter(artifact -> artifact.askForAll(ArtifactCoordinates.class).size() == 0) .forEach(artifact -> policyEvaluation.addEvaluationResult("CoordinatesValidator::rule1", "Artifact has no Coordinates", missingCoordinatesSeverity, artifact)); return policyEvaluation; } CoordinatesValidator(); @Override IPolicyEvaluation evaluate(Collection<Artifact> artifacts); @Override String getRulesetDescription(); @Override void configure(Map<String, String> configMap);  }