001package org.xbib.elasticsearch.river.jdbc.support; 002 003import org.elasticsearch.common.joda.time.DateTime; 004import org.elasticsearch.common.joda.time.format.DateTimeFormat; 005import org.testng.annotations.Test; 006import org.xbib.elasticsearch.plugin.jdbc.util.PlainIndexableObject; 007import org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverMouth; 008 009import java.io.IOException; 010 011import static org.testng.Assert.assertEquals; 012 013public class TimeWindowedTests { 014 015 @Test 016 public void testTimeWindow() throws IOException { 017 SimpleRiverMouth mouth = new SimpleRiverMouth(); 018 // daily index format 019 String index = "'test-'YYYY.MM.dd"; 020 mouth.setIndex(index); 021 mouth.index(new PlainIndexableObject(), false); 022 String dayIndex = DateTimeFormat.forPattern(index).print(new DateTime()); 023 assertEquals(mouth.getIndex(), dayIndex); 024 } 025}