Search in sources :

Example 1 with MultilingualString

use of org.rutebanken.netex.model.MultilingualString in project OpenTripPlanner by opentripplanner.

the class OperatorToAgencyMapperTest method mapOperatorWithMinimumDataSet.

@Test
public void mapOperatorWithMinimumDataSet() {
    // Given
    Operator operator = new Operator().withId(ID).withName(new MultilingualString().withValue(NAME));
    // When mapped
    org.opentripplanner.model.Operator o;
    o = new OperatorToAgencyMapper(MappingSupport.ID_FACTORY).mapOperator(operator);
    // Then expect
    assertEquals(ID, o.getId().getId());
    assertEquals(NAME, o.getName());
    assertNull(o.getUrl());
    assertNull(o.getPhone());
}
Also used : Operator(org.rutebanken.netex.model.Operator) MultilingualString(org.rutebanken.netex.model.MultilingualString) Test(org.junit.Test)

Example 2 with MultilingualString

use of org.rutebanken.netex.model.MultilingualString in project OpenTripPlanner by opentripplanner.

the class RouteMapperTest method createExampleLine.

private Line createExampleLine() {
    Line line = new Line();
    line.setId(RUT_LINE_ID);
    line.setTransportMode(AllVehicleModesOfTransportEnumeration.METRO);
    line.setName(new MultilingualString().withValue("Line 1"));
    line.setPublicCode("L1");
    line.setRepresentedByGroupRef(new GroupOfLinesRefStructure().withRef(NETWORK_ID));
    return line;
}
Also used : Line(org.rutebanken.netex.model.Line) MultilingualString(org.rutebanken.netex.model.MultilingualString) GroupOfLinesRefStructure(org.rutebanken.netex.model.GroupOfLinesRefStructure)

Example 3 with MultilingualString

use of org.rutebanken.netex.model.MultilingualString in project OpenTripPlanner by opentripplanner.

the class NoticeMapperTest method mapNotice.

@Test
public void mapNotice() {
    org.opentripplanner.model.Notice otpNotice;
    // Given
    NoticeMapper mapper = new NoticeMapper(MappingSupport.ID_FACTORY);
    // And
    Notice netexNotice = new Notice();
    netexNotice.setId(NOTICE_ID);
    netexNotice.setText(new MultilingualString().withValue(NOTICE_TEXT));
    netexNotice.setPublicCode(PUBLIC_CODE);
    // When
    otpNotice = mapper.map(netexNotice);
    // Then
    assertEquals(NOTICE_ID, otpNotice.getId().getId());
    assertEquals(NOTICE_TEXT, otpNotice.getText());
    assertEquals(PUBLIC_CODE, otpNotice.getPublicCode());
    // And when other instance with same id is mapped, the first one is returned
    // from cache - ignoring all properties except the id
    otpNotice = mapper.map(new Notice().withId(NOTICE_ID).withPublicCode("Albatross").withText(new MultilingualString().withValue("Different text")));
    // Then
    assertEquals(NOTICE_ID, otpNotice.getId().getId());
    assertEquals("Not Albatross", NOTICE_TEXT, otpNotice.getText());
}
Also used : Notice(org.rutebanken.netex.model.Notice) MultilingualString(org.rutebanken.netex.model.MultilingualString) Test(org.junit.Test)

Example 4 with MultilingualString

use of org.rutebanken.netex.model.MultilingualString in project OpenTripPlanner by opentripplanner.

the class OperatorToAgencyMapperTest method mapOperatorWithEverything.

@Test
public void mapOperatorWithEverything() {
    // Given
    Operator operator = new Operator().withId(ID).withName(new MultilingualString().withValue(NAME)).withContactDetails(new ContactStructure().withUrl(URL).withPhone(PHONE));
    // When mapped
    org.opentripplanner.model.Operator o;
    o = new OperatorToAgencyMapper(MappingSupport.ID_FACTORY).mapOperator(operator);
    // Then expect
    assertEquals(ID, o.getId().getId());
    assertEquals(NAME, o.getName());
    assertEquals(URL, o.getUrl());
    assertEquals(PHONE, o.getPhone());
}
Also used : Operator(org.rutebanken.netex.model.Operator) ContactStructure(org.rutebanken.netex.model.ContactStructure) MultilingualString(org.rutebanken.netex.model.MultilingualString) Test(org.junit.Test)

Aggregations

MultilingualString (org.rutebanken.netex.model.MultilingualString)4 Test (org.junit.Test)3 Operator (org.rutebanken.netex.model.Operator)2 ContactStructure (org.rutebanken.netex.model.ContactStructure)1 GroupOfLinesRefStructure (org.rutebanken.netex.model.GroupOfLinesRefStructure)1 Line (org.rutebanken.netex.model.Line)1 Notice (org.rutebanken.netex.model.Notice)1