Search in sources :

Example 1 with AuthoritativeRatingVantagePoint

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);
}
Also used : ImmutableAuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint) AuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint) ArrayList(java.util.ArrayList) AuthoritativenessRating(com.khartec.waltz.model.rating.AuthoritativenessRating) Test(org.junit.Test)

Example 2 with AuthoritativeRatingVantagePoint

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);
}
Also used : ImmutableAuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint) AuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint) ArrayList(java.util.ArrayList) AuthoritativenessRating(com.khartec.waltz.model.rating.AuthoritativenessRating) Test(org.junit.Test)

Example 3 with AuthoritativeRatingVantagePoint

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);
}
Also used : ImmutableAuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint) AuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint) ArrayList(java.util.ArrayList) AuthoritativenessRating(com.khartec.waltz.model.rating.AuthoritativenessRating) Test(org.junit.Test)

Example 4 with AuthoritativeRatingVantagePoint

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());
}
Also used : ImmutableAuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint) ImmutableAuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint) AuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint) Test(org.junit.Test)

Example 5 with AuthoritativeRatingVantagePoint

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;
}
Also used : AuthoritativeRatingVantagePoint(com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint) AuthoritativeSourceResolver(com.khartec.waltz.service.authoritative_source.AuthoritativeSourceResolver)

Aggregations

AuthoritativeRatingVantagePoint (com.khartec.waltz.model.authoritativesource.AuthoritativeRatingVantagePoint)6 ImmutableAuthoritativeRatingVantagePoint (com.khartec.waltz.model.authoritativesource.ImmutableAuthoritativeRatingVantagePoint)5 Test (org.junit.Test)5 AuthoritativenessRating (com.khartec.waltz.model.rating.AuthoritativenessRating)4 ArrayList (java.util.ArrayList)4 AuthoritativeSourceResolver (com.khartec.waltz.service.authoritative_source.AuthoritativeSourceResolver)1