forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:rjurney/druid into test-harness
- Loading branch information
Showing
2 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...rc/test/java/com/metamx/druid/query/timeboundary/TimeBoundaryQueryQueryToolChestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Druid - a distributed column store. | ||
* Copyright (C) 2012 Metamarkets Group Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
package com.metamx.druid.query.timeboundary; | ||
|
||
import com.metamx.druid.LogicalSegment; | ||
import junit.framework.Assert; | ||
import org.joda.time.Interval; | ||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
*/ | ||
public class TimeBoundaryQueryQueryToolChestTest | ||
{ | ||
@Test | ||
public void testFilterSegments() throws Exception | ||
{ | ||
List<LogicalSegment> segments = new TimeBoundaryQueryQueryToolChest().filterSegments( | ||
null, | ||
Arrays.asList( | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01/P1D"); | ||
} | ||
}, | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01T01/PT1H"); | ||
} | ||
}, | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01T02/PT1H"); | ||
} | ||
} | ||
) | ||
); | ||
|
||
Assert.assertEquals(segments.size(), 3); | ||
|
||
List<LogicalSegment> expected = Arrays.asList( | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01/P1D"); | ||
} | ||
}, | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01T01/PT1H"); | ||
} | ||
}, | ||
new LogicalSegment() | ||
{ | ||
@Override | ||
public Interval getInterval() | ||
{ | ||
return new Interval("2013-01-01T02/PT1H"); | ||
} | ||
} | ||
); | ||
|
||
for (int i = 0; i < segments.size(); i++) { | ||
Assert.assertEquals(segments.get(i).getInterval(), expected.get(i).getInterval()); | ||
} | ||
} | ||
} |