@Test public void testGetTTL() throws Exception { assertTrue(combinedProvider.getTTL("foo", Granularity.FULL, RollupType.BF_BASIC).isPresent()); assertTrue(combinedProvider.getTTL("foo", Granularity.MIN_5, RollupType.BF_BASIC).isPresent()); assertFalse(configProvider.getTTL("foo", Granularity.MIN_5, RollupType.BF_BASIC).isPresent()); assertEquals(combinedProvider.getTTL("foo", Granularity.MIN_5, RollupType.BF_BASIC).get(), SafetyTtlProvider.getInstance().getTTL("foo", Granularity.MIN_5, RollupType.BF_BASIC).get()); }
@Override public Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType) { Optional<TimeValue> primaryValue = primary.getTTL(tenantId, gran, rollupType); Optional<TimeValue> safetyValue = safety.getTTL(tenantId, gran, rollupType); return getTimeValue(primaryValue, safetyValue); }
CombinedTtlProvider implements TenantTtlProvider { @Override public Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType) { Optional<TimeValue> primaryValue = primary.getTTL(tenantId, gran, rollupType); Optional<TimeValue> safetyValue = safety.getTTL(tenantId, gran, rollupType); return getTimeValue(primaryValue, safetyValue); } }
CombinedTtlProvider implements TenantTtlProvider { @Override public Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType) { Optional<TimeValue> primaryValue = primary.getTTL(tenantId, gran, rollupType); Optional<TimeValue> safetyValue = safety.getTTL(tenantId, gran, rollupType); return getTimeValue(primaryValue, safetyValue); } @VisibleForTesting  CombinedTtlProvider(ConfigTtlProvider primary, SafetyTtlProvider safety); }
CombinedTtlProvider implements TenantTtlProvider { @Override public Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType) { Optional<TimeValue> primaryValue = primary.getTTL(tenantId, gran, rollupType); Optional<TimeValue> safetyValue = safety.getTTL(tenantId, gran, rollupType); return getTimeValue(primaryValue, safetyValue); } @VisibleForTesting  CombinedTtlProvider(ConfigTtlProvider primary, SafetyTtlProvider safety); static CombinedTtlProvider getInstance(); @Override Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType); long getFinalTTL(String tenantid, Granularity gran); }
CombinedTtlProvider implements TenantTtlProvider { @Override public Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType) { Optional<TimeValue> primaryValue = primary.getTTL(tenantId, gran, rollupType); Optional<TimeValue> safetyValue = safety.getTTL(tenantId, gran, rollupType); return getTimeValue(primaryValue, safetyValue); } @VisibleForTesting  CombinedTtlProvider(ConfigTtlProvider primary, SafetyTtlProvider safety); static CombinedTtlProvider getInstance(); @Override Optional<TimeValue> getTTL(String tenantId, Granularity gran, RollupType rollupType); long getFinalTTL(String tenantid, Granularity gran);  }