Skip to content

Commit

Permalink
Rename GtfsDao to OtpTransitDao.
Browse files Browse the repository at this point in the history
(Refactor OTP to have new OTP classes to replace the OBA GTFS classes #2494)
  • Loading branch information
Thomas Gran committed Oct 30, 2017
1 parent 0fb954e commit a693883
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 52 deletions.
Expand Up @@ -33,7 +33,7 @@
import org.onebusaway2.gtfs.model.StopTime; import org.onebusaway2.gtfs.model.StopTime;
import org.onebusaway2.gtfs.model.Transfer; import org.onebusaway2.gtfs.model.Transfer;
import org.onebusaway2.gtfs.model.Trip; import org.onebusaway2.gtfs.model.Trip;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
Expand All @@ -55,7 +55,7 @@
* *
* @author bdferris * @author bdferris
*/ */
public class GtfsDaoImpl implements GtfsDao { public class OtpTransitDaoImpl implements OtpTransitDao {


private Collection<Agency> agencies; private Collection<Agency> agencies;


Expand Down Expand Up @@ -98,7 +98,7 @@ public class GtfsDaoImpl implements GtfsDao {


private Map<AgencyAndId, List<ServiceCalendar>> calendarsByServiceId = null; private Map<AgencyAndId, List<ServiceCalendar>> calendarsByServiceId = null;


public GtfsDaoImpl(Collection<Agency> agencies, Collection<ServiceCalendarDate> calendarDates, public OtpTransitDaoImpl(Collection<Agency> agencies, Collection<ServiceCalendarDate> calendarDates,
Collection<ServiceCalendar> calendars, Collection<FareAttribute> fareAttributes, Collection<ServiceCalendar> calendars, Collection<FareAttribute> fareAttributes,
Collection<FareRule> fareRules, Collection<FeedInfo> feedInfos, Collection<FareRule> fareRules, Collection<FeedInfo> feedInfos,
Collection<Frequency> frequencies, Collection<Pathway> pathways, Collection<Frequency> frequencies, Collection<Pathway> pathways,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/onebusaway2/gtfs/services/MockGtfs.java
Expand Up @@ -39,11 +39,11 @@ public void putLines(String fileName, String... rows) {
gtfsDelegate.putLines(fileName, rows); gtfsDelegate.putLines(fileName, rows);
} }


public GtfsDao read() throws IOException { public OtpTransitDao read() throws IOException {
return ModelMapper.mapDao(gtfsDelegate.read()); return ModelMapper.mapDao(gtfsDelegate.read());
} }


public GtfsDao read(org.onebusaway.gtfs.serialization.GtfsReader reader) throws IOException { public OtpTransitDao read(org.onebusaway.gtfs.serialization.GtfsReader reader) throws IOException {
return ModelMapper.mapDao(gtfsDelegate.read(reader)); return ModelMapper.mapDao(gtfsDelegate.read(reader));
} }


Expand Down
Expand Up @@ -22,7 +22,7 @@
/** /**
* Methods for accessing imported entities. * Methods for accessing imported entities.
*/ */
public interface GtfsDao { public interface OtpTransitDao {


Collection<Agency> getAllAgencies(); Collection<Agency> getAllAgencies();


Expand Down
Expand Up @@ -24,7 +24,7 @@
import org.onebusaway2.gtfs.model.calendar.CalendarServiceData; import org.onebusaway2.gtfs.model.calendar.CalendarServiceData;
import org.onebusaway2.gtfs.model.calendar.LocalizedServiceId; import org.onebusaway2.gtfs.model.calendar.LocalizedServiceId;
import org.onebusaway2.gtfs.model.calendar.ServiceDate; import org.onebusaway2.gtfs.model.calendar.ServiceDate;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.onebusaway2.gtfs.services.calendar.CalendarService; import org.onebusaway2.gtfs.services.calendar.CalendarService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
Expand All @@ -51,17 +51,17 @@ public class CalendarServiceDataFactoryImpl {


private static final Logger LOG = LoggerFactory.getLogger(CalendarServiceDataFactoryImpl.class); private static final Logger LOG = LoggerFactory.getLogger(CalendarServiceDataFactoryImpl.class);


private final GtfsDao dao; private final OtpTransitDao dao;


public static CalendarService createCalendarService(GtfsDao dao) { public static CalendarService createCalendarService(OtpTransitDao dao) {
return new CalendarServiceImpl(createCalendarServiceData(dao)); return new CalendarServiceImpl(createCalendarServiceData(dao));
} }


public static CalendarServiceData createCalendarServiceData(GtfsDao dao) { public static CalendarServiceData createCalendarServiceData(OtpTransitDao dao) {
return new CalendarServiceDataFactoryImpl(dao).createData(); return new CalendarServiceDataFactoryImpl(dao).createData();
} }


public static CalendarServiceData createCalendarSrvDataWithoutDatesForLocalizedSrvId(GtfsDao dao) { public static CalendarServiceData createCalendarSrvDataWithoutDatesForLocalizedSrvId(OtpTransitDao dao) {
return (new CalendarServiceDataFactoryImpl(dao) { return (new CalendarServiceDataFactoryImpl(dao) {
@Override void addDatesForLocalizedServiceId( @Override void addDatesForLocalizedServiceId(
AgencyAndId serviceId, List<ServiceDate> serviceDates, CalendarServiceData data AgencyAndId serviceId, List<ServiceDate> serviceDates, CalendarServiceData data
Expand All @@ -71,7 +71,7 @@ public static CalendarServiceData createCalendarSrvDataWithoutDatesForLocalizedS
}).createData(); }).createData();
} }


private CalendarServiceDataFactoryImpl(GtfsDao dao) { private CalendarServiceDataFactoryImpl(OtpTransitDao dao) {
this.dao = dao; this.dao = dao;
} }


Expand Down
Expand Up @@ -17,7 +17,7 @@ the License, or (at your option) any later version.
import org.onebusaway2.gtfs.model.AgencyAndId; import org.onebusaway2.gtfs.model.AgencyAndId;
import org.onebusaway2.gtfs.model.calendar.CalendarServiceData; import org.onebusaway2.gtfs.model.calendar.CalendarServiceData;
import org.onebusaway2.gtfs.model.calendar.LocalizedServiceId; import org.onebusaway2.gtfs.model.calendar.LocalizedServiceId;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;


/** /**
* This is actually kind of a hack, and assumes that there is only one copy of CalendarServiceData * This is actually kind of a hack, and assumes that there is only one copy of CalendarServiceData
Expand All @@ -32,7 +32,7 @@ public MultiCalendarServiceImpl() {
super(new CalendarServiceData()); super(new CalendarServiceData());
} }


public void addData(CalendarServiceData data, GtfsDao dao) { public void addData(CalendarServiceData data, OtpTransitDao dao) {
CalendarServiceData _data = super.getData(); CalendarServiceData _data = super.getData();
for (Agency agency : dao.getAllAgencies()) { for (Agency agency : dao.getAllAgencies()) {
String agencyId = agency.getId(); String agencyId = agency.getId();
Expand Down
Expand Up @@ -40,6 +40,7 @@ the License, or (at your option) any later version.
import org.onebusaway.gtfs.serialization.GtfsReader; import org.onebusaway.gtfs.serialization.GtfsReader;
import org.onebusaway.gtfs.services.GenericMutableDao; import org.onebusaway.gtfs.services.GenericMutableDao;
import org.onebusaway.gtfs.services.GtfsMutableRelationalDao; import org.onebusaway.gtfs.services.GtfsMutableRelationalDao;
import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.calendar.impl.MultiCalendarServiceImpl; import org.opentripplanner.calendar.impl.MultiCalendarServiceImpl;
import org.opentripplanner.graph_builder.model.GtfsBundle; import org.opentripplanner.graph_builder.model.GtfsBundle;
import org.opentripplanner.graph_builder.services.GraphBuilderModule; import org.opentripplanner.graph_builder.services.GraphBuilderModule;
Expand All @@ -55,7 +56,6 @@ the License, or (at your option) any later version.


import com.google.common.collect.Sets; import com.google.common.collect.Sets;


import static org.opentripplanner.calendar.impl.CalendarServiceDataFactoryImpl.createCalendarServiceData;
import static org.opentripplanner.calendar.impl.CalendarServiceDataFactoryImpl.createCalendarSrvDataWithoutDatesForLocalizedSrvId; import static org.opentripplanner.calendar.impl.CalendarServiceDataFactoryImpl.createCalendarSrvDataWithoutDatesForLocalizedSrvId;
import static org.opentripplanner.gtfs.mapping.ModelMapper.mapDao; import static org.opentripplanner.gtfs.mapping.ModelMapper.mapDao;


Expand Down Expand Up @@ -115,7 +115,7 @@ public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
if (useCached != null && gtfsBundle.useCached == null) if (useCached != null && gtfsBundle.useCached == null)
gtfsBundle.useCached = useCached; gtfsBundle.useCached = useCached;


org.onebusaway2.gtfs.services.GtfsDao dao = mapDao(loadBundle(gtfsBundle)); OtpTransitDao dao = mapDao(loadBundle(gtfsBundle));


GtfsContext context = GtfsLibrary.createContext(gtfsBundle.getFeedId(), dao, service); GtfsContext context = GtfsLibrary.createContext(gtfsBundle.getFeedId(), dao, service);
GTFSPatternHopFactory hf = new GTFSPatternHopFactory(context); GTFSPatternHopFactory hf = new GTFSPatternHopFactory(context);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/opentripplanner/gtfs/GtfsContext.java
Expand Up @@ -13,12 +13,12 @@ the License, or (at your option) any later version.


package org.opentripplanner.gtfs; package org.opentripplanner.gtfs;


import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.onebusaway2.gtfs.services.calendar.CalendarService; import org.onebusaway2.gtfs.services.calendar.CalendarService;
import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.GtfsFeedId;


public interface GtfsContext { public interface GtfsContext {
GtfsFeedId getFeedId(); GtfsFeedId getFeedId();
GtfsDao getDao(); OtpTransitDao getDao();
CalendarService getCalendarService(); CalendarService getCalendarService();
} }
14 changes: 7 additions & 7 deletions src/main/java/org/opentripplanner/gtfs/GtfsLibrary.java
Expand Up @@ -19,7 +19,7 @@ the License, or (at your option) any later version.


import org.onebusaway2.gtfs.model.AgencyAndId; import org.onebusaway2.gtfs.model.AgencyAndId;
import org.onebusaway2.gtfs.model.Route; import org.onebusaway2.gtfs.model.Route;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.onebusaway2.gtfs.services.calendar.CalendarService; import org.onebusaway2.gtfs.services.calendar.CalendarService;
import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.GtfsFeedId;
import org.opentripplanner.gtfs.mapping.ModelMapper; import org.opentripplanner.gtfs.mapping.ModelMapper;
Expand All @@ -31,20 +31,20 @@ public class GtfsLibrary {


public static final char ID_SEPARATOR = ':'; // note this is different than what OBA GTFS uses to match our 1.0 API public static final char ID_SEPARATOR = ':'; // note this is different than what OBA GTFS uses to match our 1.0 API


public static GtfsContext createContext(GtfsFeedId feedId, GtfsDao dao) { public static GtfsContext createContext(GtfsFeedId feedId, OtpTransitDao dao) {
CalendarService calendarService = createCalendarService(dao); CalendarService calendarService = createCalendarService(dao);
return createContext(feedId, dao, calendarService); return createContext(feedId, dao, calendarService);
} }


public static GtfsContext createContext(GtfsFeedId feedId, GtfsDao dao, CalendarService calendarService) { public static GtfsContext createContext(GtfsFeedId feedId, OtpTransitDao dao, CalendarService calendarService) {
return new GtfsContextImpl(feedId, dao, calendarService); return new GtfsContextImpl(feedId, dao, calendarService);
} }


public static GtfsContext readGtfs(File path) throws IOException { public static GtfsContext readGtfs(File path) throws IOException {
GtfsImport gtfsImport = new GtfsImport(path); GtfsImport gtfsImport = new GtfsImport(path);


GtfsFeedId feedId = gtfsImport.getFeedId(); GtfsFeedId feedId = gtfsImport.getFeedId();
GtfsDao otpDao = ModelMapper.mapDao(gtfsImport.getDao()); OtpTransitDao otpDao = ModelMapper.mapDao(gtfsImport.getDao());
CalendarService calendarService = createCalendarService(otpDao); CalendarService calendarService = createCalendarService(otpDao);


return new GtfsContextImpl(feedId, otpDao, calendarService); return new GtfsContextImpl(feedId, otpDao, calendarService);
Expand Down Expand Up @@ -131,11 +131,11 @@ private static class GtfsContextImpl implements GtfsContext {


private GtfsFeedId _feedId; private GtfsFeedId _feedId;


private GtfsDao _dao; private OtpTransitDao _dao;


private CalendarService _calendar; private CalendarService _calendar;


public GtfsContextImpl(GtfsFeedId feedId, GtfsDao dao, CalendarService calendar) { public GtfsContextImpl(GtfsFeedId feedId, OtpTransitDao dao, CalendarService calendar) {
_feedId = feedId; _feedId = feedId;
_dao = dao; _dao = dao;
_calendar = calendar; _calendar = calendar;
Expand All @@ -147,7 +147,7 @@ public GtfsFeedId getFeedId() {
} }


@Override @Override
public GtfsDao getDao() { public OtpTransitDao getDao() {
return _dao; return _dao;
} }


Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/opentripplanner/gtfs/mapping/ModelMapper.java
Expand Up @@ -13,8 +13,8 @@ the License, or (at your option) any later version.


package org.opentripplanner.gtfs.mapping; package org.opentripplanner.gtfs.mapping;


import org.onebusaway2.gtfs.impl.GtfsDaoImpl; import org.onebusaway2.gtfs.impl.OtpTransitDaoImpl;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;


public class ModelMapper { public class ModelMapper {
private final AgencyMapper agencyMapper = new AgencyMapper(); private final AgencyMapper agencyMapper = new AgencyMapper();
Expand Down Expand Up @@ -49,12 +49,12 @@ public class ModelMapper {
routeMapper, fareAttributeMapper routeMapper, fareAttributeMapper
); );


public static GtfsDao mapDao(org.onebusaway.gtfs.services.GtfsRelationalDao data) { public static OtpTransitDao mapDao(org.onebusaway.gtfs.services.GtfsRelationalDao data) {
return new ModelMapper().map(data); return new ModelMapper().map(data);
} }


private GtfsDao map(org.onebusaway.gtfs.services.GtfsRelationalDao data) { private OtpTransitDao map(org.onebusaway.gtfs.services.GtfsRelationalDao data) {
return new GtfsDaoImpl(agencyMapper.map(data.getAllAgencies()), return new OtpTransitDaoImpl(agencyMapper.map(data.getAllAgencies()),
serviceCalendarDateMapper.map(data.getAllCalendarDates()), serviceCalendarDateMapper.map(data.getAllCalendarDates()),
serviceCalendarMapper.map(data.getAllCalendars()), serviceCalendarMapper.map(data.getAllCalendars()),
fareAttributeMapper.map(data.getAllFareAttributes()), fareAttributeMapper.map(data.getAllFareAttributes()),
Expand Down
Expand Up @@ -21,7 +21,7 @@ the License, or (at your option) any later version.
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.common.model.P2; import org.opentripplanner.common.model.P2;
import org.opentripplanner.routing.services.FareService; import org.opentripplanner.routing.services.FareService;
import org.opentripplanner.routing.services.FareServiceFactory; import org.opentripplanner.routing.services.FareServiceFactory;
Expand All @@ -47,7 +47,7 @@ public FareService makeFareService() {
} }


@Override @Override
public void processGtfs(GtfsDao dao) { public void processGtfs(OtpTransitDao dao) {
// Nothing to do // Nothing to do
} }


Expand Down
Expand Up @@ -40,7 +40,7 @@ the License, or (at your option) any later version.
import org.onebusaway2.gtfs.model.StopTime; import org.onebusaway2.gtfs.model.StopTime;
import org.onebusaway2.gtfs.model.Transfer; import org.onebusaway2.gtfs.model.Transfer;
import org.onebusaway2.gtfs.model.Trip; import org.onebusaway2.gtfs.model.Trip;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.onebusaway2.gtfs.services.calendar.CalendarService; import org.onebusaway2.gtfs.services.calendar.CalendarService;
import org.opentripplanner.common.geometry.GeometryUtils; import org.opentripplanner.common.geometry.GeometryUtils;
import org.opentripplanner.common.geometry.PackedCoordinateSequence; import org.opentripplanner.common.geometry.PackedCoordinateSequence;
Expand All @@ -58,7 +58,6 @@ the License, or (at your option) any later version.
import org.opentripplanner.graph_builder.annotation.RepeatedStops; import org.opentripplanner.graph_builder.annotation.RepeatedStops;
import org.opentripplanner.graph_builder.annotation.TripDegenerate; import org.opentripplanner.graph_builder.annotation.TripDegenerate;
import org.opentripplanner.graph_builder.annotation.TripUndefinedService; import org.opentripplanner.graph_builder.annotation.TripUndefinedService;
import org.opentripplanner.graph_builder.annotation.*;
import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.GtfsFeedId;
import org.opentripplanner.gtfs.GtfsContext; import org.opentripplanner.gtfs.GtfsContext;
import org.opentripplanner.gtfs.GtfsLibrary; import org.opentripplanner.gtfs.GtfsLibrary;
Expand Down Expand Up @@ -291,7 +290,7 @@ public class GTFSPatternHopFactory {


private GtfsFeedId _feedId; private GtfsFeedId _feedId;


private GtfsDao _dao; private OtpTransitDao _dao;


private CalendarService _calendarService; private CalendarService _calendarService;


Expand Down
Expand Up @@ -18,8 +18,7 @@ the License, or (at your option) any later version.
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.routing.bike_rental.TimeBasedBikeRentalFareServiceFactory;
import org.opentripplanner.routing.impl.DefaultFareServiceFactory; import org.opentripplanner.routing.impl.DefaultFareServiceFactory;
import org.opentripplanner.routing.services.FareService; import org.opentripplanner.routing.services.FareService;
import org.opentripplanner.routing.services.FareServiceFactory; import org.opentripplanner.routing.services.FareServiceFactory;
Expand All @@ -46,7 +45,7 @@ public FareService makeFareService() {
protected abstract FareService makeMultipleFareService(List<FareService> subServices); protected abstract FareService makeMultipleFareService(List<FareService> subServices);


@Override @Override
public void processGtfs(GtfsDao dao) { public void processGtfs(OtpTransitDao dao) {
for (FareServiceFactory subFactory : subFactories) for (FareServiceFactory subFactory : subFactories)
subFactory.processGtfs(dao); subFactory.processGtfs(dao);
} }
Expand Down
Expand Up @@ -18,7 +18,7 @@ the License, or (props, at your option) any later version.
import org.onebusaway2.gtfs.model.FareAttribute; import org.onebusaway2.gtfs.model.FareAttribute;
import org.onebusaway2.gtfs.model.FareRule; import org.onebusaway2.gtfs.model.FareRule;
import org.onebusaway2.gtfs.model.Route; import org.onebusaway2.gtfs.model.Route;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.routing.bike_rental.TimeBasedBikeRentalFareServiceFactory; import org.opentripplanner.routing.bike_rental.TimeBasedBikeRentalFareServiceFactory;
import org.opentripplanner.routing.core.Fare.FareType; import org.opentripplanner.routing.core.Fare.FareType;
import org.opentripplanner.routing.core.FareRuleSet; import org.opentripplanner.routing.core.FareRuleSet;
Expand Down Expand Up @@ -52,7 +52,7 @@ public FareService makeFareService() {
} }


@Override @Override
public void processGtfs(GtfsDao dao) { public void processGtfs(OtpTransitDao dao) {
fillFareRules(null, dao.getAllFareAttributes(), dao.getAllFareRules(), regularFareRules); fillFareRules(null, dao.getAllFareAttributes(), dao.getAllFareRules(), regularFareRules);
} }


Expand Down
Expand Up @@ -13,7 +13,7 @@ the License, or (props, at your option) any later version.


package org.opentripplanner.routing.impl; package org.opentripplanner.routing.impl;


import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.routing.services.FareService; import org.opentripplanner.routing.services.FareService;
import org.opentripplanner.routing.services.FareServiceFactory; import org.opentripplanner.routing.services.FareServiceFactory;


Expand All @@ -26,7 +26,7 @@ public FareService makeFareService() {
} }


@Override @Override
public void processGtfs(GtfsDao dao) { public void processGtfs(OtpTransitDao dao) {
} }


@Override @Override
Expand Down
Expand Up @@ -18,7 +18,7 @@ the License, or (at your option) any later version.


import org.onebusaway2.gtfs.model.AgencyAndId; import org.onebusaway2.gtfs.model.AgencyAndId;
import org.onebusaway2.gtfs.model.Trip; import org.onebusaway2.gtfs.model.Trip;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;
import org.opentripplanner.routing.core.Fare.FareType; import org.opentripplanner.routing.core.Fare.FareType;
import org.opentripplanner.routing.core.FareRuleSet; import org.opentripplanner.routing.core.FareRuleSet;
import org.opentripplanner.routing.services.FareService; import org.opentripplanner.routing.services.FareService;
Expand Down Expand Up @@ -49,7 +49,7 @@ public void configure(JsonNode config) {
} }


@Override @Override
public void processGtfs(GtfsDao dao) { public void processGtfs(OtpTransitDao dao) {
// Add custom extension: trips may have a fare ID specified in KCM GTFS. // Add custom extension: trips may have a fare ID specified in KCM GTFS.
// Need to ensure that we are scoped to feed when adding trips to FareRuleSet, // Need to ensure that we are scoped to feed when adding trips to FareRuleSet,
// since fare IDs may not be unique across feeds and trip agency IDsqq // since fare IDs may not be unique across feeds and trip agency IDsqq
Expand Down
Expand Up @@ -14,13 +14,13 @@ the License, or (props, at your option) any later version.
package org.opentripplanner.routing.services; package org.opentripplanner.routing.services;


import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import org.onebusaway2.gtfs.services.GtfsDao; import org.onebusaway2.gtfs.services.OtpTransitDao;


public interface FareServiceFactory { public interface FareServiceFactory {


FareService makeFareService(); FareService makeFareService();


void processGtfs(GtfsDao dao); void processGtfs(OtpTransitDao dao);


void configure(JsonNode config); void configure(JsonNode config);
} }
Expand Up @@ -45,7 +45,7 @@ the License, or (at your option) any later version.
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;


public class GtfsDaoImplTest { public class OtpTransitDaoImplTest {
private static final String FEED_ID = "Z"; private static final String FEED_ID = "Z";


private static final AgencyAndId SERVICE_ALLDAYS_ID = new AgencyAndId(FEED_ID, "alldays"); private static final AgencyAndId SERVICE_ALLDAYS_ID = new AgencyAndId(FEED_ID, "alldays");
Expand All @@ -55,7 +55,7 @@ public class GtfsDaoImplTest {
private static final AgencyAndId STATION_ID = new AgencyAndId(FEED_ID, "station"); private static final AgencyAndId STATION_ID = new AgencyAndId(FEED_ID, "station");


// The subject is used as read only; hence static is ok // The subject is used as read only; hence static is ok
private static GtfsDaoImpl subject; private static OtpTransitDaoImpl subject;


private static Agency agency; private static Agency agency;


Expand All @@ -70,7 +70,7 @@ public static void setup() throws IOException {
reader.setDefaultAgencyId(FEED_ID); reader.setDefaultAgencyId(FEED_ID);
reader.run(); reader.run();


subject = (GtfsDaoImpl) ModelMapper.mapDao(dao); subject = (OtpTransitDaoImpl) ModelMapper.mapDao(dao);
agency = first(subject.getAllAgencies()); agency = first(subject.getAllAgencies());


// Supplement test data with at least one entity in all collections // Supplement test data with at least one entity in all collections
Expand Down Expand Up @@ -224,7 +224,7 @@ public void testGetStopsForStation() {
public void testGetShapePointsForShapeId() { public void testGetShapePointsForShapeId() {
List<ShapePoint> shapePoints = subject.getShapePointsForShapeId(new AgencyAndId("Z", "5")); List<ShapePoint> shapePoints = subject.getShapePointsForShapeId(new AgencyAndId("Z", "5"));
assertEquals("[#1 (41,-72), #2 (41,-72), #3 (40,-72), #4 (41,-73), #5 (41,-74)]", assertEquals("[#1 (41,-72), #2 (41,-72), #3 (40,-72), #4 (41,-73), #5 (41,-74)]",
shapePoints.stream().map(GtfsDaoImplTest::toString).collect(toList()).toString()); shapePoints.stream().map(OtpTransitDaoImplTest::toString).collect(toList()).toString());
} }


@Test @Test
Expand Down

0 comments on commit a693883

Please sign in to comment.