Search in sources :

Example 1 with ConfigurableTestSchedule

use of pipelite.tester.pipeline.ConfigurableTestSchedule in project pipelite by enasequence.

the class TestTypeScheduleRunner method runSchedules.

public <T extends SingleStageTestProcessConfiguration> void runSchedules(StageService stageServiceSpy, int schedulerSeconds, int processCnt, Function<TestType, T> testProcessConfigurationFactory) {
    // Register test pipelines.
    List<ConfigurableTestSchedule<T>> testSchedules = new ArrayList<>();
    for (TestType testType : TestType.tests) {
        ConfigurableTestSchedule<T> schedule = new ConfigurableTestSchedule<>("0/" + schedulerSeconds + " * * * * ?", testProcessConfigurationFactory.apply(testType));
        testSchedules.add(schedule);
        registeredPipelineService.registerPipeline(schedule);
    }
    registeredScheduleService.saveSchedules();
    // Spy stage service.
    TestType.spyStageService(stageServiceSpy);
    try {
        processRunnerPoolManager.createPools();
        ScheduleRunner scheduleRunner = runnerService.getScheduleRunner();
        for (ConfigurableTestSchedule<T> f : testSchedules) {
            scheduleRunner.setMaximumExecutions(f.pipelineName(), processCnt);
        }
        processRunnerPoolManager.startPools();
        processRunnerPoolManager.waitPoolsToStop();
        for (ConfigurableTestSchedule<T> f : testSchedules) {
            assertSchedule(stageServiceSpy, f, processCnt);
        }
    } finally {
        for (ConfigurableTestSchedule<T> f : testSchedules) {
            deleteSchedule(f);
        }
    }
}
Also used : ScheduleRunner(pipelite.runner.schedule.ScheduleRunner) ArrayList(java.util.ArrayList) ConfigurableTestSchedule(pipelite.tester.pipeline.ConfigurableTestSchedule)

Aggregations

ArrayList (java.util.ArrayList)1 ScheduleRunner (pipelite.runner.schedule.ScheduleRunner)1 ConfigurableTestSchedule (pipelite.tester.pipeline.ConfigurableTestSchedule)1