Search in sources :

Example 1 with DatabaseInformationService

use of com.khartec.waltz.service.database_information.DatabaseInformationService in project waltz by khartec.

the class DatabaseHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DatabaseInformationService databaseInfoService = ctx.getBean(DatabaseInformationService.class);
    DatabaseInformationDao databaseDao = ctx.getBean(DatabaseInformationDao.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    /*
        List<DatabaseInformation> dbs = databaseDao.findByApplicationId(801L);
        System.out.println(dbs.size());


        List<Tally<String>> eolCounts = calculateStringTallies(
                dsl,
                DATABASE_INFORMATION,
                DSL.when(DATABASE_INFORMATION.END_OF_LIFE_DATE.lt(DSL.currentDate()), DSL.inline(EndOfLifeStatus.END_OF_LIFE.name()))
                        .otherwise(DSL.inline(EndOfLifeStatus.NOT_END_OF_LIFE.name())),
                DSL.trueCondition());

        System.out.println(eolCounts);
        */
    IdSelectionOptions options = ImmutableIdSelectionOptions.builder().entityReference(ImmutableEntityReference.builder().kind(EntityKind.ORG_UNIT).id(10).build()).scope(HierarchyQueryScope.CHILDREN).build();
    for (int i = 0; i < 5; i++) {
        HarnessUtilities.time("stats", () -> databaseInfoService.findStatsForAppIdSelector(options));
    }
}
Also used : DatabaseInformationDao(com.khartec.waltz.data.database_information.DatabaseInformationDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DSLContext(org.jooq.DSLContext) DatabaseInformationService(com.khartec.waltz.service.database_information.DatabaseInformationService)

Aggregations

DatabaseInformationDao (com.khartec.waltz.data.database_information.DatabaseInformationDao)1 DatabaseInformationService (com.khartec.waltz.service.database_information.DatabaseInformationService)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1