use of org.finos.waltz.model.allocation_scheme.AllocationScheme in project waltz by khartec.
the class AllocationHarness method mkScheme.
private static AllocationScheme mkScheme(AllocationSchemeService schemeService, MeasurableCategory category) {
AllocationScheme scheme = ImmutableAllocationScheme.builder().description(PROVENANCE).name("TEST_SCHEME").measurableCategoryId(category.id().get()).build();
long id = schemeService.create(scheme);
return schemeService.getById(id);
}
use of org.finos.waltz.model.allocation_scheme.AllocationScheme in project waltz by khartec.
the class AllocationHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
AllocationSchemeService schemesService = ctx.getBean(AllocationSchemeService.class);
MeasurableService measurableService = ctx.getBean(MeasurableService.class);
MeasurableCategoryDao categoryDao = ctx.getBean(MeasurableCategoryDao.class);
MeasurableRatingService ratingService = ctx.getBean(MeasurableRatingService.class);
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
Tuple4<Application, MeasurableCategory, List<Measurable>, AllocationScheme> stuff = setup(dsl, schemesService, measurableService, categoryDao, applicationService);
addRating(ratingService, stuff, 0);
addRating(ratingService, stuff, 1);
// addRating(ratingService, stuff, 2);
// addAllocation(dsl, stuff, 0, 50);
addAllocation(dsl, stuff, 1, 20);
Long measurableCategory = stuff.v2.id().get();
dumpRatings(dsl, stuff.v4);
dumpAllocs(dsl, stuff.v4);
doDiff(dsl, measurableCategory);
System.out.println(ratingService.findByCategory(measurableCategory));
}
use of org.finos.waltz.model.allocation_scheme.AllocationScheme in project waltz by khartec.
the class AllocationHarness method setup.
private static Tuple4<Application, MeasurableCategory, List<Measurable>, AllocationScheme> setup(DSLContext dsl, AllocationSchemeService schemesService, MeasurableService measurableService, MeasurableCategoryDao categoryDao, ApplicationService applicationService) {
deleteAll(dsl);
Application app = mkApp(dsl, applicationService);
MeasurableCategory category = mkCategory(dsl, categoryDao);
List<Measurable> measurables = mkMeasurables(measurableService, category);
AllocationScheme scheme = mkScheme(schemesService, category);
return Tuple.tuple(app, category, measurables, scheme);
}
Aggregations