@Test public void testSelectIndexYearChange2Days() throws Exception { final String indexPattern = indexSelector.getIndexPatternOlderThanDays("metrics-", 2); assertEquals("metrics-*,-metrics-1970.01.*,-metrics-1969.12.31,-metrics-1969.12.30", indexPattern); }
public String getIndexPatternOlderThanDays(String prefix, int days) { final StringBuilder indexPattern = new StringBuilder(prefix).append('*'); final GregorianCalendar now = getNowUTC(); final GregorianCalendar lastDayToExclude = getLastDayToExclude(days); final GregorianCalendar alreadyExcluded = getNowUTC(); excludeMonths(prefix, now, indexPattern, lastDayToExclude, alreadyExcluded); excludeDays(prefix, indexPattern, lastDayToExclude, alreadyExcluded); return indexPattern.toString(); }
IndexSelector { public String getIndexPatternOlderThanDays(String prefix, int days) { final StringBuilder indexPattern = new StringBuilder(prefix).append('*'); final GregorianCalendar now = getNowUTC(); final GregorianCalendar lastDayToExclude = getLastDayToExclude(days); final GregorianCalendar alreadyExcluded = getNowUTC(); excludeMonths(prefix, now, indexPattern, lastDayToExclude, alreadyExcluded); excludeDays(prefix, indexPattern, lastDayToExclude, alreadyExcluded); return indexPattern.toString(); } }
IndexSelector { public String getIndexPatternOlderThanDays(String prefix, int days) { final StringBuilder indexPattern = new StringBuilder(prefix).append('*'); final GregorianCalendar now = getNowUTC(); final GregorianCalendar lastDayToExclude = getLastDayToExclude(days); final GregorianCalendar alreadyExcluded = getNowUTC(); excludeMonths(prefix, now, indexPattern, lastDayToExclude, alreadyExcluded); excludeDays(prefix, indexPattern, lastDayToExclude, alreadyExcluded); return indexPattern.toString(); } IndexSelector(Clock clock); }
IndexSelector { public String getIndexPatternOlderThanDays(String prefix, int days) { final StringBuilder indexPattern = new StringBuilder(prefix).append('*'); final GregorianCalendar now = getNowUTC(); final GregorianCalendar lastDayToExclude = getLastDayToExclude(days); final GregorianCalendar alreadyExcluded = getNowUTC(); excludeMonths(prefix, now, indexPattern, lastDayToExclude, alreadyExcluded); excludeDays(prefix, indexPattern, lastDayToExclude, alreadyExcluded); return indexPattern.toString(); } IndexSelector(Clock clock); String getIndexPatternOlderThanDays(String prefix, int days); }
IndexSelector { public String getIndexPatternOlderThanDays(String prefix, int days) { final StringBuilder indexPattern = new StringBuilder(prefix).append('*'); final GregorianCalendar now = getNowUTC(); final GregorianCalendar lastDayToExclude = getLastDayToExclude(days); final GregorianCalendar alreadyExcluded = getNowUTC(); excludeMonths(prefix, now, indexPattern, lastDayToExclude, alreadyExcluded); excludeDays(prefix, indexPattern, lastDayToExclude, alreadyExcluded); return indexPattern.toString(); } IndexSelector(Clock clock); String getIndexPatternOlderThanDays(String prefix, int days);  }