Search in sources :

Example 1 with DependencyNameExtractor

use of com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor in project abort-mission by nagyesta.

the class MissionOutlineDefinition method defineOutline.

@Override
@SuppressWarnings("checkstyle:MagicNumber")
protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
    final DependencyNameExtractor extractor = new TagDependencyNameExtractor();
    final DataSource dataSource = H2DataSourceProvider.createDefaultDataSource(PORT_NUMBER);
    final Map<String, Consumer<AbortMissionCommandOps>> plan = new HashMap<>();
    plan.put(STATIC_FIRE, ops -> {
        final StageStatisticsCollectorFactory factory = getCollectorFactory(STATIC_FIRE, dataSource);
        final MissionHealthCheckMatcher sideBoosterMatcher = matcher().dependencyWith(SIDE_BOOSTER).extractor(extractor).build();
        final MissionHealthCheckMatcher centerCoreMatcher = matcher().dependencyWith(CENTER_CORE).extractor(extractor).build();
        ops.registerHealthCheck(percentageBasedEvaluator(sideBoosterMatcher, factory).abortThreshold(10).burnInTestCount(2).build());
        ops.registerHealthCheck(percentageBasedEvaluator(centerCoreMatcher, factory).build());
    });
    plan.put(PARALLEL, ops -> {
        final StageStatisticsCollectorFactory factory = getCollectorFactory(PARALLEL, dataSource);
        final MissionHealthCheckMatcher anyClassMatcher = matcher().anyClass().build();
        ops.registerHealthCheck(reportOnlyEvaluator(anyClassMatcher, factory).build());
    });
    return plan;
}
Also used : TagDependencyNameExtractor(com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor) DependencyNameExtractor(com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor) Consumer(java.util.function.Consumer) HashMap(java.util.HashMap) StageStatisticsCollectorFactory(com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory) H2BackedStageStatisticsCollectorFactory(com.github.nagyesta.abortmission.strongback.h2.stats.H2BackedStageStatisticsCollectorFactory) TagDependencyNameExtractor(com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor) MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) DataSource(javax.sql.DataSource)

Example 2 with DependencyNameExtractor

use of com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor in project abort-mission by nagyesta.

the class MissionOutlineDefinition method defineOutline.

@Override
@SuppressWarnings("checkstyle:MagicNumber")
protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
    final DependencyNameExtractor extractor = new TagDependencyNameExtractor();
    final Registry registry = RmiServiceProvider.lookupRegistry(RmiServerConstants.DEFAULT_RMI_PORT);
    final Map<String, Consumer<AbortMissionCommandOps>> plan = new HashMap<>();
    plan.put(STATIC_FIRE, ops -> {
        final StageStatisticsCollectorFactory factory = getCollectorFactory(STATIC_FIRE, registry);
        final MissionHealthCheckMatcher sideBoosterMatcher = matcher().dependencyWith(SIDE_BOOSTER).extractor(extractor).build();
        final MissionHealthCheckMatcher centerCoreMatcher = matcher().dependencyWith(CENTER_CORE).extractor(extractor).build();
        ops.registerHealthCheck(percentageBasedEvaluator(sideBoosterMatcher, factory).abortThreshold(10).burnInTestCount(2).build());
        ops.registerHealthCheck(percentageBasedEvaluator(centerCoreMatcher, factory).build());
    });
    plan.put(PARALLEL, ops -> {
        final StageStatisticsCollectorFactory factory = getCollectorFactory(PARALLEL, registry);
        final MissionHealthCheckMatcher anyClassMatcher = matcher().anyClass().build();
        ops.registerHealthCheck(reportOnlyEvaluator(anyClassMatcher, factory).build());
    });
    return plan;
}
Also used : TagDependencyNameExtractor(com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor) DependencyNameExtractor(com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor) Consumer(java.util.function.Consumer) HashMap(java.util.HashMap) StageStatisticsCollectorFactory(com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory) RmiBackedStageStatisticsCollectorFactory(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiBackedStageStatisticsCollectorFactory) Registry(java.rmi.registry.Registry) TagDependencyNameExtractor(com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor) MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher)

Aggregations

TagDependencyNameExtractor (com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor)2 DependencyNameExtractor (com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor)2 StageStatisticsCollectorFactory (com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory)2 MissionHealthCheckMatcher (com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher)2 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2 H2BackedStageStatisticsCollectorFactory (com.github.nagyesta.abortmission.strongback.h2.stats.H2BackedStageStatisticsCollectorFactory)1 RmiBackedStageStatisticsCollectorFactory (com.github.nagyesta.abortmission.strongback.rmi.stats.RmiBackedStageStatisticsCollectorFactory)1 Registry (java.rmi.registry.Registry)1 DataSource (javax.sql.DataSource)1