Search in sources :

Example 1 with AgencyNarrative

use of org.onebusaway.transit_data_federation.model.narrative.AgencyNarrative in project onebusaway-application-modules by camsys.

the class AgencyBeanServiceImpl method getAgencyForId.

@Cacheable
public AgencyBean getAgencyForId(String id) {
    AgencyNarrative agency = _narrativeService.getAgencyForId(id);
    if (agency == null)
        return null;
    AgencyBean bean = new AgencyBean();
    bean.setId(id);
    bean.setLang(agency.getLang());
    bean.setName(agency.getName());
    bean.setPhone(agency.getPhone());
    bean.setEmail(agency.getEmail());
    bean.setTimezone(agency.getTimezone());
    bean.setUrl(agency.getUrl());
    bean.setDisclaimer(agency.getDisclaimer());
    bean.setPrivateService(agency.isPrivateService());
    bean.setFareUrl(agency.getFareUrl());
    bean.setEmail(agency.getEmail());
    return bean;
}
Also used : AgencyNarrative(org.onebusaway.transit_data_federation.model.narrative.AgencyNarrative) AgencyBean(org.onebusaway.transit_data.model.AgencyBean) Cacheable(org.onebusaway.container.cache.Cacheable)

Example 2 with AgencyNarrative

use of org.onebusaway.transit_data_federation.model.narrative.AgencyNarrative in project onebusaway-application-modules by camsys.

the class GenerateNarrativesTaskTest method testGenerateAgencyNarratives.

@Test
public void testGenerateAgencyNarratives() {
    Agency agency = new Agency();
    agency.setId("1");
    agency.setLang("en");
    agency.setName("Agency");
    agency.setPhone("555-1234");
    agency.setTimezone("America/New_York");
    agency.setUrl("http://agency.gov/");
    Mockito.when(_gtfsDao.getAllAgencies()).thenReturn(Arrays.asList(agency));
    Modification mod = new Modification();
    mod.setType(AgencyNarrative.class);
    mod.setId("1");
    mod.setProperty("disclaimer");
    mod.setValue("Use at your own risk.");
    _modifications.setModifications(Arrays.asList(mod));
    _task.generateAgencyNarratives(_provider);
    AgencyNarrative narrative = _provider.getNarrativeForAgencyId("1");
    assertEquals(mod.getValue(), narrative.getDisclaimer());
    assertEquals(agency.getLang(), narrative.getLang());
    assertEquals(agency.getName(), narrative.getName());
    assertEquals(agency.getPhone(), narrative.getPhone());
    assertEquals(agency.getTimezone(), narrative.getTimezone());
    assertEquals(agency.getUrl(), narrative.getUrl());
}
Also used : Modification(org.onebusaway.transit_data_federation.model.modifications.Modification) Agency(org.onebusaway.gtfs.model.Agency) AgencyNarrative(org.onebusaway.transit_data_federation.model.narrative.AgencyNarrative) Test(org.junit.Test)

Aggregations

AgencyNarrative (org.onebusaway.transit_data_federation.model.narrative.AgencyNarrative)2 Test (org.junit.Test)1 Cacheable (org.onebusaway.container.cache.Cacheable)1 Agency (org.onebusaway.gtfs.model.Agency)1 AgencyBean (org.onebusaway.transit_data.model.AgencyBean)1 Modification (org.onebusaway.transit_data_federation.model.modifications.Modification)1