@Test public void shouldApplyFlowMetrics () { shouldInitRegionAdaptationContexts(); adaptationManager.adapt( regionExecPlans, metrics ); verify( metrics ).getRegionMetrics( region1.getRegionId(), pipelineMetricsHistorySummarizer ); verify( metrics ).getRegionMetrics( region2.getRegionId(), pipelineMetricsHistorySummarizer ); verify( metrics ).getRegionMetrics( region3.getRegionId(), pipelineMetricsHistorySummarizer ); verify( metrics ).getRegionMetrics( region4.getRegionId(), pipelineMetricsHistorySummarizer ); verify( region1Context ).updateRegionMetrics( singletonList( region1PipelineMetrics ), loadChangePredicate ); verify( region2Context ).updateRegionMetrics( singletonList( region2PipelineMetrics ), loadChangePredicate ); verify( region3Context ).updateRegionMetrics( singletonList( region3PipelineMetrics ), loadChangePredicate ); verify( region4Context ).updateRegionMetrics( singletonList( region4PipelineMetrics ), loadChangePredicate ); verify( region1Context ).resolveIfBottleneck( eq( bottleneckPredicate ), anyListOf( BottleneckResolver.class ) ); verify( region2Context ).resolveIfBottleneck( eq( bottleneckPredicate ), anyListOf( BottleneckResolver.class ) ); verify( region3Context ).resolveIfBottleneck( eq( bottleneckPredicate ), anyListOf( BottleneckResolver.class ) ); verify( region4Context ).resolveIfBottleneck( eq( bottleneckPredicate ), anyListOf( BottleneckResolver.class ) ); }
@Override public List<AdaptationAction> adapt ( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ) { return adaptingRegions.isEmpty() ? resolveBottlenecksIfPresent( metrics ) : evaluateAdaptations( metrics ); }
OrganicAdaptationManager implements AdaptationManager { @Override public List<AdaptationAction> adapt ( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ) { return adaptingRegions.isEmpty() ? resolveBottlenecksIfPresent( metrics ) : evaluateAdaptations( metrics ); } }
OrganicAdaptationManager implements AdaptationManager { @Override public List<AdaptationAction> adapt ( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ) { return adaptingRegions.isEmpty() ? resolveBottlenecksIfPresent( metrics ) : evaluateAdaptations( metrics ); } @Inject  OrganicAdaptationManager( final JokerConfig config );   OrganicAdaptationManager( final JokerConfig config,
                               final Function<RegionExecPlan, RegionAdaptationContext> regionAdaptationContextFactory ); }
OrganicAdaptationManager implements AdaptationManager { @Override public List<AdaptationAction> adapt ( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ) { return adaptingRegions.isEmpty() ? resolveBottlenecksIfPresent( metrics ) : evaluateAdaptations( metrics ); } @Inject  OrganicAdaptationManager( final JokerConfig config );   OrganicAdaptationManager( final JokerConfig config,
                               final Function<RegionExecPlan, RegionAdaptationContext> regionAdaptationContextFactory ); @Override void initialize( final FlowDef flowDef, final List<RegionExecPlan> execPlans ); @Override void disableAdaptation(); @Override List<AdaptationAction> adapt( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ); }
OrganicAdaptationManager implements AdaptationManager { @Override public List<AdaptationAction> adapt ( final List<RegionExecPlan> execPlans, final FlowMetrics metrics ) { return adaptingRegions.isEmpty() ? resolveBottlenecksIfPresent( metrics ) : evaluateAdaptations( metrics ); } @Inject  OrganicAdaptationManager( final JokerConfig config );   OrganicAdaptationManager( final JokerConfig config,
                               final Function<RegionExecPlan, RegionAdaptationContext> regionAdaptationContextFactory ); @Override void initialize( final FlowDef flowDef, final List<RegionExecPlan> execPlans ); @Override void disableAdaptation(); @Override List<AdaptationAction> adapt( final List<RegionExecPlan> execPlans, final FlowMetrics metrics );  }