Search in sources :

Example 16 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class DeferredValueSupportTest method testResolveAgencyAndId_ExistingAgencyId.

@Test
public void testResolveAgencyAndId_ExistingAgencyId() {
    Stop stop = new Stop();
    stop.setId(new AgencyAndId("a1", "2"));
    BeanWrapper bean = BeanWrapperFactory.wrap(stop);
    AgencyAndId id = _support.resolveAgencyAndId(bean, "id", "1");
    assertEquals(new AgencyAndId("a1", "1"), id);
}
Also used : BeanWrapper(org.onebusaway.csv_entities.schema.BeanWrapper) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) Stop(org.onebusaway.gtfs.model.Stop) Test(org.junit.Test)

Example 17 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class ReplaceValueSetterTest method test.

@Test
public void test() {
    ReplaceValueSetter setter = new ReplaceValueSetter("cats", "dogs");
    Stop stop = new Stop();
    stop.setName("I like cats.");
    setter.setValue(BeanWrapperFactory.wrap(stop), "name");
    assertEquals("I like dogs.", stop.getName());
}
Also used : Stop(org.onebusaway.gtfs.model.Stop) Test(org.junit.Test)

Example 18 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV_differentLocale.

@Test
public void testTranslateFromObjectToCSV_differentLocale() {
    Locale.setDefault(Locale.FRANCE);
    _fieldMapping = buildFieldMapping();
    Stop stop = new Stop();
    stop.setLat(47.5678);
    Map<String, Object> csvValues = new HashMap<String, Object>();
    _fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
    assertEquals("47.567800", csvValues.get("stop_lat"));
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) Stop(org.onebusaway.gtfs.model.Stop) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 19 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromCSVToObject.

@Test
public void testTranslateFromCSVToObject() {
    Map<String, Object> csvValues = new HashMap<String, Object>();
    csvValues.put("stop_lat", "47.1234");
    Stop stop = new Stop();
    _fieldMapping.translateFromCSVToObject(new CsvEntityContextImpl(), csvValues, BeanWrapperFactory.wrap(stop));
    assertEquals(47.1234, stop.getLat(), 0.00001);
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) HashMap(java.util.HashMap) Stop(org.onebusaway.gtfs.model.Stop) Test(org.junit.Test)

Example 20 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV.

@Test
public void testTranslateFromObjectToCSV() {
    Stop stop = new Stop();
    stop.setLat(47.5678);
    Map<String, Object> csvValues = new HashMap<String, Object>();
    _fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
    assertEquals("47.567800", csvValues.get("stop_lat"));
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) Stop(org.onebusaway.gtfs.model.Stop) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

Stop (org.onebusaway.gtfs.model.Stop)40 Test (org.junit.Test)29 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)24 StopTime (org.onebusaway.gtfs.model.StopTime)11 Trip (org.onebusaway.gtfs.model.Trip)11 Agency (org.onebusaway.gtfs.model.Agency)8 ShapePoint (org.onebusaway.gtfs.model.ShapePoint)7 Route (org.onebusaway.gtfs.model.Route)6 ServiceCalendar (org.onebusaway.gtfs.model.ServiceCalendar)6 FareAttribute (org.onebusaway.gtfs.model.FareAttribute)5 ServiceCalendarDate (org.onebusaway.gtfs.model.ServiceCalendarDate)5 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)5 GtfsRelationalDao (org.onebusaway.gtfs.services.GtfsRelationalDao)5 FareRule (org.onebusaway.gtfs.model.FareRule)4 GtfsMutableRelationalDao (org.onebusaway.gtfs.services.GtfsMutableRelationalDao)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 CsvEntityContextImpl (org.onebusaway.csv_entities.CsvEntityContextImpl)3 Frequency (org.onebusaway.gtfs.model.Frequency)3 Transfer (org.onebusaway.gtfs.model.Transfer)3