Search in sources :

Example 1 with ChangedStopPlaceSearchDto

use of org.rutebanken.tiamat.dtoassembling.dto.ChangedStopPlaceSearchDto in project tiamat by entur.

the class ExportResourceTest method exportStopPlacesWithEffectiveChangedInPeriod.

@Test
public void exportStopPlacesWithEffectiveChangedInPeriod() throws Exception {
    LocalDateTime validFrom = LocalDateTime.now().minusDays(3);
    StopPlace stopPlace1 = new StopPlace().withId("XYZ:Stopplace:1").withVersion("1").withName(new MultilingualString().withValue("Changed stop1")).withValidBetween(new ValidBetween().withFromDate(validFrom)).withCentroid(new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLatitude(new BigDecimal("59.914353")).withLongitude(new BigDecimal("10.806387"))));
    StopPlace stopPlace2 = new StopPlace().withId("XYZ:Stopplace:2").withVersion("1").withName(new MultilingualString().withValue("Changed stop2")).withValidBetween(new ValidBetween().withFromDate(validFrom.plusDays(1))).withCentroid(new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLatitude(new BigDecimal("22.914353")).withLongitude(new BigDecimal("11.806387"))));
    PublicationDeliveryStructure publicationDelivery = publicationDeliveryTestHelper.createPublicationDeliveryWithStopPlace(stopPlace1, stopPlace2);
    publicationDeliveryTestHelper.postAndReturnPublicationDelivery(publicationDelivery);
    UriInfo uriInfoMock = Mockito.mock(UriInfo.class);
    Mockito.when(uriInfoMock.getAbsolutePathBuilder()).thenReturn(JerseyUriBuilder.fromPath("http://test"));
    ChangedStopPlaceSearchDto search = new ChangedStopPlaceSearchDto(null, null, 0, 1);
    Response response = exportResource.exportStopPlacesWithEffectiveChangedInPeriod(search, newExportParamsBuilder().build(), uriInfoMock);
    List<StopPlace> changedStopPlaces = publicationDeliveryTestHelper.extractStopPlaces(response);
    Assert.assertEquals(1, changedStopPlaces.size());
    Assert.assertEquals(stopPlace1.getName().getValue(), changedStopPlaces.get(0).getName().getValue());
    Link link = response.getLink("next");
    Assert.assertNotNull(link);
}
Also used : LocalDateTime(java.time.LocalDateTime) StopPlace(org.rutebanken.netex.model.StopPlace) PublicationDeliveryStructure(org.rutebanken.netex.model.PublicationDeliveryStructure) SimplePoint_VersionStructure(org.rutebanken.netex.model.SimplePoint_VersionStructure) ValidBetween(org.rutebanken.netex.model.ValidBetween) LocationStructure(org.rutebanken.netex.model.LocationStructure) BigDecimal(java.math.BigDecimal) Response(javax.ws.rs.core.Response) MultilingualString(org.rutebanken.netex.model.MultilingualString) EmbeddableMultilingualString(org.rutebanken.tiamat.model.EmbeddableMultilingualString) ChangedStopPlaceSearchDto(org.rutebanken.tiamat.dtoassembling.dto.ChangedStopPlaceSearchDto) UriInfo(javax.ws.rs.core.UriInfo) Link(javax.ws.rs.core.Link) Test(org.junit.Test) TiamatIntegrationTest(org.rutebanken.tiamat.TiamatIntegrationTest)

Example 2 with ChangedStopPlaceSearchDto

use of org.rutebanken.tiamat.dtoassembling.dto.ChangedStopPlaceSearchDto in project tiamat by entur.

the class ExportResourceTest method exportStopPlacesWithEffectiveChangedInPeriodNoContent.

@Test
public void exportStopPlacesWithEffectiveChangedInPeriodNoContent() throws Exception {
    String historicTime = "2012-04-23T18:25:43.511+0100";
    UriInfo uriInfoMock = Mockito.mock(UriInfo.class);
    ChangedStopPlaceSearchDto search = new ChangedStopPlaceSearchDto(historicTime, historicTime, 0, 1);
    Response response = exportResource.exportStopPlacesWithEffectiveChangedInPeriod(search, newExportParamsBuilder().build(), uriInfoMock);
    Assert.assertEquals(response.getStatus(), HttpStatus.NO_CONTENT.value());
}
Also used : Response(javax.ws.rs.core.Response) MultilingualString(org.rutebanken.netex.model.MultilingualString) EmbeddableMultilingualString(org.rutebanken.tiamat.model.EmbeddableMultilingualString) ChangedStopPlaceSearchDto(org.rutebanken.tiamat.dtoassembling.dto.ChangedStopPlaceSearchDto) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test) TiamatIntegrationTest(org.rutebanken.tiamat.TiamatIntegrationTest)

Aggregations

Response (javax.ws.rs.core.Response)2 UriInfo (javax.ws.rs.core.UriInfo)2 Test (org.junit.Test)2 MultilingualString (org.rutebanken.netex.model.MultilingualString)2 TiamatIntegrationTest (org.rutebanken.tiamat.TiamatIntegrationTest)2 ChangedStopPlaceSearchDto (org.rutebanken.tiamat.dtoassembling.dto.ChangedStopPlaceSearchDto)2 EmbeddableMultilingualString (org.rutebanken.tiamat.model.EmbeddableMultilingualString)2 BigDecimal (java.math.BigDecimal)1 LocalDateTime (java.time.LocalDateTime)1 Link (javax.ws.rs.core.Link)1 LocationStructure (org.rutebanken.netex.model.LocationStructure)1 PublicationDeliveryStructure (org.rutebanken.netex.model.PublicationDeliveryStructure)1 SimplePoint_VersionStructure (org.rutebanken.netex.model.SimplePoint_VersionStructure)1 StopPlace (org.rutebanken.netex.model.StopPlace)1 ValidBetween (org.rutebanken.netex.model.ValidBetween)1