Search in sources :

Example 1 with TimeRangeFacetConfig

use of com.google.refine.browsing.facets.TimeRangeFacet.TimeRangeFacetConfig in project OpenRefine by OpenRefine.

the class TimeRangeFacetTests method serializeTimeRangeFacetConfig.

@Test
public void serializeTimeRangeFacetConfig() throws JsonParseException, JsonMappingException, IOException {
    TimeRangeFacetConfig config = ParsingUtilities.mapper.readValue(configJson, TimeRangeFacetConfig.class);
    TestUtils.isSerializedTo(config, configJson);
}
Also used : TimeRangeFacetConfig(com.google.refine.browsing.facets.TimeRangeFacet.TimeRangeFacetConfig) RefineTest(com.google.refine.RefineTest) Test(org.testng.annotations.Test)

Example 2 with TimeRangeFacetConfig

use of com.google.refine.browsing.facets.TimeRangeFacet.TimeRangeFacetConfig in project OpenRefine by OpenRefine.

the class TimeRangeFacetTests method serializeTimeRangeFacet.

@Test
public void serializeTimeRangeFacet() throws JsonParseException, JsonMappingException, IOException {
    Project project = createCSVProject("my column\n" + "placeholder\n" + "nontime\n" + "placeholder\n" + "placeholder\n");
    project.rows.get(0).cells.set(0, new Cell(OffsetDateTime.parse("2018-01-03T08:09:10Z"), null));
    project.rows.get(2).cells.set(0, new Cell(OffsetDateTime.parse("2008-01-03T03:04:05Z"), null));
    project.rows.get(3).cells.set(0, new Cell(OffsetDateTime.parse("2012-04-05T02:00:01Z"), null));
    Engine engine = new Engine(project);
    TimeRangeFacetConfig config = ParsingUtilities.mapper.readValue(configJson, TimeRangeFacetConfig.class);
    TimeRangeFacet facet = config.apply(project);
    facet.computeChoices(project, engine.getAllFilteredRows());
    TestUtils.isSerializedTo(facet, facetJson);
}
Also used : Project(com.google.refine.model.Project) Cell(com.google.refine.model.Cell) TimeRangeFacet(com.google.refine.browsing.facets.TimeRangeFacet) Engine(com.google.refine.browsing.Engine) TimeRangeFacetConfig(com.google.refine.browsing.facets.TimeRangeFacet.TimeRangeFacetConfig) RefineTest(com.google.refine.RefineTest) Test(org.testng.annotations.Test)

Aggregations

RefineTest (com.google.refine.RefineTest)2 TimeRangeFacetConfig (com.google.refine.browsing.facets.TimeRangeFacet.TimeRangeFacetConfig)2 Test (org.testng.annotations.Test)2 Engine (com.google.refine.browsing.Engine)1 TimeRangeFacet (com.google.refine.browsing.facets.TimeRangeFacet)1 Cell (com.google.refine.model.Cell)1 Project (com.google.refine.model.Project)1