use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.
the class FlowClassificationRuleResolverTest method existingEntriesThenReturnsMostSpecificRating.
@Test
public void existingEntriesThenReturnsMostSpecificRating() {
List<FlowClassificationRuleVantagePoint> vantagePoints = new ArrayList<>();
vantagePoints.add(ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(1).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(2).applicationId(205L).classificationCode(AuthoritativenessRatingValue.of("PRIMARY").value()).ruleId(1L).build());
vantagePoints.add(ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(2).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(3).applicationId(200L).classificationCode(AuthoritativenessRatingValue.of("SECONDARY").value()).ruleId(1L).build());
FlowClassificationRuleResolver flowClassificationRuleResolver = new FlowClassificationRuleResolver(vantagePoints);
AuthoritativenessRatingValue rating = flowClassificationRuleResolver.resolve(vantagePoint, sourceApp, 20L);
assertEquals(AuthoritativenessRatingValue.of("SECONDARY"), rating);
}
use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.
the class FlowClassificationRuleResolverTest method getBestRankedIsCorrect.
@Test
public void getBestRankedIsCorrect() {
ImmutableFlowClassificationRuleVantagePoint rank12 = ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(1).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(2).applicationId(205L).classificationCode(AuthoritativenessRatingValue.of("PRIMARY").value()).ruleId(1L).build();
ImmutableFlowClassificationRuleVantagePoint rank22 = rank12.withVantagePointRank(2);
ImmutableFlowClassificationRuleVantagePoint rank11 = rank12.withDataTypeRank(1);
Optional<FlowClassificationRuleVantagePoint> bestRankedOrgUnit = getMostSpecificRanked(newArrayList(rank12, rank22));
Optional<FlowClassificationRuleVantagePoint> bestRankedDataType = getMostSpecificRanked(newArrayList(rank12, rank11));
assertTrue(bestRankedOrgUnit.isPresent());
assertEquals(rank22, bestRankedOrgUnit.get());
assertTrue(bestRankedDataType.isPresent());
assertEquals(rank12, bestRankedDataType.get());
}
use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.
the class LogicalFlowDecoratorRatingsCalculator method createResolver.
private FlowClassificationRuleResolver createResolver(Collection<Application> targetApps) {
Set<Long> orgIds = map(targetApps, app -> app.organisationalUnitId());
List<FlowClassificationRuleVantagePoint> flowClassificationRuleVantagePoints = flowClassificationRuleDao.findExpandedFlowClassificationRuleVantagePoints(orgIds);
FlowClassificationRuleResolver resolver = new FlowClassificationRuleResolver(flowClassificationRuleVantagePoints);
return resolver;
}
Aggregations