Search in sources :

Example 1 with SegmentIdentifierParts

use of io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts in project druid by druid-io.

the class DataSegmentUtilsTest method testBasic.

@Test
public void testBasic() {
    String datasource = "datasource";
    SegmentIdentifierParts desc = new SegmentIdentifierParts(datasource, new Interval("2015-01-02/2015-01-03"), "ver", "0_0");
    Assert.assertEquals("datasource_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = new SegmentIdentifierParts(datasource, new Interval("2015-01-02/2015-01-03"), "ver", null);
    Assert.assertEquals("datasource_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
}
Also used : SegmentIdentifierParts(io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 2 with SegmentIdentifierParts

use of io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts in project druid by druid-io.

the class DataSegmentUtilsTest method testDataSourceWithUnderscore2.

@Test
public void testDataSourceWithUnderscore2() {
    String dataSource = "datasource_2015-01-01T00:00:00.000Z";
    SegmentIdentifierParts desc = new SegmentIdentifierParts(dataSource, new Interval("2015-01-02/2015-01-03"), "ver", "0_0");
    Assert.assertEquals("datasource_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(dataSource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_2015-01-01T00:00:00.000Z_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(dataSource, desc.toString()));
    desc = new SegmentIdentifierParts(dataSource, new Interval("2015-01-02/2015-01-03"), "ver", null);
    Assert.assertEquals("datasource_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(dataSource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_2015-01-01T00:00:00.000Z_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(dataSource, desc.toString()));
}
Also used : SegmentIdentifierParts(io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 3 with SegmentIdentifierParts

use of io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts in project druid by druid-io.

the class DataSegmentUtilsTest method testDataSourceWithUnderscore1.

@Test
public void testDataSourceWithUnderscore1() {
    String datasource = "datasource_1";
    SegmentIdentifierParts desc = new SegmentIdentifierParts(datasource, new Interval("2015-01-02/2015-01-03"), "ver", "0_0");
    Assert.assertEquals("datasource_1_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_1_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver_0_0", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = new SegmentIdentifierParts(datasource, new Interval("2015-01-02/2015-01-03"), "ver", null);
    Assert.assertEquals("datasource_1_2015-01-02T00:00:00.000Z_2015-01-03T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
    desc = desc.withInterval(new Interval("2014-10-20T00:00:00Z/P1D"));
    Assert.assertEquals("datasource_1_2014-10-20T00:00:00.000Z_2014-10-21T00:00:00.000Z_ver", desc.toString());
    Assert.assertEquals(desc, DataSegmentUtils.valueOf(datasource, desc.toString()));
}
Also used : SegmentIdentifierParts(io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

SegmentIdentifierParts (io.druid.timeline.DataSegmentUtils.SegmentIdentifierParts)3 Interval (org.joda.time.Interval)3 Test (org.junit.Test)3