Search in sources :

Example 1 with DefaultFieldMapping

use of org.onebusaway.csv_entities.schema.DefaultFieldMapping in project onebusaway-gtfs-modules by OneBusAway.

the class EntitySchemaCacheTest method test.

@Test
public void test() {
    EntitySchemaCache cache = new EntitySchemaCache();
    EntitySchema schema = new EntitySchema(Route.class, "routes.txt", true);
    FieldMapping fieldMapping = new DefaultFieldMapping(Route.class, "route_short_name", "shortName", String.class, false);
    schema.addField(fieldMapping);
    cache.addEntitySchema(schema);
    assertSame(cache.getSchemaForFileName("routes.txt"), schema);
    assertSame(cache.getSchemaForEntityType(Route.class), schema);
    assertSame(cache.getFieldMappingForCsvFieldName(Route.class, "route_short_name"), fieldMapping);
    assertSame(cache.getFieldMappingForObjectFieldName(Route.class, "shortName"), fieldMapping);
}
Also used : DefaultFieldMapping(org.onebusaway.csv_entities.schema.DefaultFieldMapping) FieldMapping(org.onebusaway.csv_entities.schema.FieldMapping) EntitySchema(org.onebusaway.csv_entities.schema.EntitySchema) DefaultFieldMapping(org.onebusaway.csv_entities.schema.DefaultFieldMapping) Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DefaultFieldMapping (org.onebusaway.csv_entities.schema.DefaultFieldMapping)1 EntitySchema (org.onebusaway.csv_entities.schema.EntitySchema)1 FieldMapping (org.onebusaway.csv_entities.schema.FieldMapping)1 Route (org.onebusaway.gtfs.model.Route)1