use of com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint in project waltz by khartec.
the class AuthoritativeSourceResolverTest method existingEntriesThenReturnsMostSpecificRating.
@Test
public void existingEntriesThenReturnsMostSpecificRating() {
List<AuthoritativeRatingVantagePoint> vantagePoints = new ArrayList<>();
vantagePoints.add(ImmutableAuthoritativeRatingVantagePoint.builder().vantagePoint(vantagePoint).rank(1).dataTypeCode("REF_DATA").applicationId(205L).rating(AuthoritativenessRating.PRIMARY).build());
vantagePoints.add(ImmutableAuthoritativeRatingVantagePoint.builder().vantagePoint(vantagePoint).rank(2).dataTypeCode("REF_DATA").applicationId(200L).rating(AuthoritativenessRating.SECONDARY).build());
AuthoritativeSourceResolver authoritativeSourceResolver = new AuthoritativeSourceResolver(vantagePoints);
AuthoritativenessRating rating = authoritativeSourceResolver.resolve(vantagePoint, sourceApp, "REF_DATA");
Assert.assertEquals(AuthoritativenessRating.SECONDARY, rating);
}
use of com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint in project waltz by khartec.
the class AuthoritativeSourceResolverTest method whenResolveWithMissingVantagePointThenReturnsNoOpinion.
@Test
public void whenResolveWithMissingVantagePointThenReturnsNoOpinion() {
List<AuthoritativeRatingVantagePoint> vantagePoints = new ArrayList<>();
AuthoritativeSourceResolver authoritativeSourceResolver = new AuthoritativeSourceResolver(vantagePoints);
AuthoritativenessRating rating = authoritativeSourceResolver.resolve(vantagePoint, sourceApp, "REF_DATA");
Assert.assertEquals(AuthoritativenessRating.NO_OPINION, rating);
}
use of com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint in project waltz by khartec.
the class AuthoritativeSourceResolverTest method whenResolveWithExistingVantageButMissingDataTypeThenReturnsNoOpinion.
@Test
public void whenResolveWithExistingVantageButMissingDataTypeThenReturnsNoOpinion() {
List<AuthoritativeRatingVantagePoint> vantagePoints = new ArrayList<>();
vantagePoints.add(ImmutableAuthoritativeRatingVantagePoint.builder().vantagePoint(vantagePoint).rank(1).dataTypeCode("TRADE_DATA").applicationId(200L).rating(AuthoritativenessRating.SECONDARY).build());
AuthoritativeSourceResolver authoritativeSourceResolver = new AuthoritativeSourceResolver(vantagePoints);
AuthoritativenessRating rating = authoritativeSourceResolver.resolve(vantagePoint, sourceApp, "REF_DATA");
Assert.assertEquals(AuthoritativenessRating.NO_OPINION, rating);
}
use of com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint in project waltz by khartec.
the class AuthoritativeSourceResolverTest method getBestRankedIsCorrect.
@Test
public void getBestRankedIsCorrect() {
ImmutableAuthoritativeRatingVantagePoint rank1 = ImmutableAuthoritativeRatingVantagePoint.builder().vantagePoint(vantagePoint).rank(1).dataTypeCode("REF_DATA").applicationId(205L).rating(AuthoritativenessRating.PRIMARY).build();
ImmutableAuthoritativeRatingVantagePoint rank2 = rank1.withRank(2);
Optional<AuthoritativeRatingVantagePoint> bestRanked = AuthoritativeSourceResolver.getBestRanked(ListUtilities.newArrayList(rank1, rank2));
Assert.assertTrue(bestRanked.isPresent());
Assert.assertEquals(rank2, bestRanked.get());
}
use of com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint in project waltz by khartec.
the class LogicalFlowDecoratorRatingsCalculator method createResolver.
private AuthoritativeSourceResolver createResolver(Collection<Application> targetApps) {
Set<Long> orgIds = map(targetApps, app -> app.organisationalUnitId());
List<AuthoritativeRatingVantagePoint> authoritativeRatingVantagePoints = authoritativeSourceDao.findAuthoritativeRatingVantagePoints(orgIds);
AuthoritativeSourceResolver resolver = new AuthoritativeSourceResolver(authoritativeRatingVantagePoints);
return resolver;
}
Aggregations