ArchaiusEffectiveJobDisruptionBudgetResolver implements EffectiveJobDisruptionBudgetResolver { @Override public DisruptionBudget resolve(Job<?> job) { return DisruptionBudgetFunctions.isSelfManaged(job) ? disruptionBudgetRef.get() : job.getJobDescriptor().getDisruptionBudget(); } @Inject  ArchaiusEffectiveJobDisruptionBudgetResolver(PropertyRepository repository,
                                                        @Named(JOB_STRICT_SANITIZER) EntitySanitizer sanitizer); @PreDestroy void shutdown(); @Override DisruptionBudget resolve(Job<?> job); static final String PROPERTY_KEY; }
@Test public void testReturnsOriginalForNotSelfManagedJobs() throws Exception { property.set(toJson(FALLBACK_BUDGET_1)); ArchaiusEffectiveJobDisruptionBudgetResolver resolver = new ArchaiusEffectiveJobDisruptionBudgetResolver(repository, sanitizer); assertThat(resolver.resolve(JOB_NOT_SELF_MANAGED)).isEqualTo(JOB_NOT_SELF_MANAGED.getJobDescriptor().getDisruptionBudget()); }
@Test public void testReturnsFallbackForSelfManagedJobs() throws Exception { property.set(toJson(FALLBACK_BUDGET_1)); ArchaiusEffectiveJobDisruptionBudgetResolver resolver = new ArchaiusEffectiveJobDisruptionBudgetResolver(repository, sanitizer); assertThat(resolver.resolve(JOB_SELF_MANAGED)).isEqualTo(FALLBACK_BUDGET_1); }