From 19a386f54e0e106bf2deb36829a027ea366b0b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Erik=20St=C3=B8wer?= Date: Wed, 5 Feb 2025 13:45:35 +0100 Subject: [PATCH 1/4] Added endpoints for ScheduledStopPoint --- .../entur/mummu/resources/RestResource.java | 40 +++++++++++++++++++ .../mummu/services/NetexEntitiesService.java | 26 ++++++++++++ .../mummu/services/NetexObjectFactory.java | 9 +++++ 3 files changed, 75 insertions(+) diff --git a/src/main/java/no/entur/mummu/resources/RestResource.java b/src/main/java/no/entur/mummu/resources/RestResource.java index 7fc2840..211df28 100644 --- a/src/main/java/no/entur/mummu/resources/RestResource.java +++ b/src/main/java/no/entur/mummu/resources/RestResource.java @@ -13,6 +13,8 @@ import org.rutebanken.netex.model.Parking; import org.rutebanken.netex.model.ParkingsInFrame_RelStructure; import org.rutebanken.netex.model.Quay; +import org.rutebanken.netex.model.ScheduledStopPoint; +import org.rutebanken.netex.model.ScheduledStopPointsInFrame_RelStructure; import org.rutebanken.netex.model.StopPlace; import org.rutebanken.netex.model.StopPlacesInFrame_RelStructure; import org.rutebanken.netex.model.StopTypeEnumeration; @@ -107,6 +109,17 @@ public JAXBElement getJAXBElementStopPlaceById(@PathVariable String i return netexObjectFactory.createStopPlace(stopPlace); } + @GetMapping(value = "/stop-places/{id}/scheduled-stop-points", produces = "application/json") + public Collection getScheduledStopPointsForStopPlace(@PathVariable String id) { + return netexEntitiesService.getScheduledStopPointsForStopPlaceWithId(id); + } + + @GetMapping(value = "/stop-places/{id}/scheduled-stop-points", produces = "application/xml") + public JAXBElement getJAXBElementScheduledStopPointsForStopPlace(@PathVariable String id) { + var scheduledStopPoints = netexEntitiesService.getScheduledStopPointsForStopPlaceWithId(id); + return netexObjectFactory.createScheduledStopPoints(scheduledStopPoints); + } + @GetMapping(value = "/stop-places/{id}/versions", produces = "application/json") public Collection getStopPlaceVersions(@PathVariable String id) { return netexEntitiesService.getStopPlaceVersions(id); @@ -433,4 +446,31 @@ public JAXBElement getJAXBElementFareZoneVersion(@PathVariable String var fareZone = netexEntitiesService.getFareZoneVersion(id, version); return netexObjectFactory.createFareZone(fareZone); } + + @GetMapping(value = "/scheduled-stop-points", produces = "application/json") + public List getScheduledStopPoints( + @RequestParam(defaultValue = "10") Integer count, + @RequestParam(defaultValue = "0") Integer skip + ) { + return netexEntitiesService.getScheduledStopPoints(count, skip); + } + + @GetMapping(value = "/scheduled-stop-points", produces = "application/xml") + public JAXBElement getJAXBElementScheduledStopPoints( + @RequestParam(defaultValue = "10") Integer count, + @RequestParam(defaultValue = "0") Integer skip + ) { + var scheduledStopPoints = netexEntitiesService.getScheduledStopPoints(count, skip); + return netexObjectFactory.createScheduledStopPoints(scheduledStopPoints); + } + + @GetMapping(value = "/scheduled-stop-points/{id}", produces = "application/json") + public ScheduledStopPoint getScheduledStopPointById(@PathVariable String id) { + return netexEntitiesService.getScheduledStopPoint(id); + } + + @GetMapping(value = "/scheduled-stop-points/{id}", produces = "application/xml") + public JAXBElement getJAXBElementScheduledStopPointById(@PathVariable String id) { + return netexObjectFactory.createScheduledStopPoint(netexEntitiesService.getScheduledStopPoint(id)); + } } diff --git a/src/main/java/no/entur/mummu/services/NetexEntitiesService.java b/src/main/java/no/entur/mummu/services/NetexEntitiesService.java index 1776542..c4a8527 100644 --- a/src/main/java/no/entur/mummu/services/NetexEntitiesService.java +++ b/src/main/java/no/entur/mummu/services/NetexEntitiesService.java @@ -18,6 +18,7 @@ import org.rutebanken.netex.model.GroupOfTariffZones; import org.rutebanken.netex.model.Parking; import org.rutebanken.netex.model.Quay; +import org.rutebanken.netex.model.ScheduledStopPoint; import org.rutebanken.netex.model.StopPlace; import org.rutebanken.netex.model.StopTypeEnumeration; import org.rutebanken.netex.model.TariffZone; @@ -316,4 +317,29 @@ public FareZone getFareZoneVersion(String id, String version) { netexEntitiesIndex.getFareZoneIndex().getVersion(id, version) ).orElseThrow(NotFoundException::new); } + + public List getScheduledStopPoints( + Integer count, + Integer skip + ) { + return netexEntitiesIndex.getScheduledStopPointIndex().getLatestVersions().stream() + .sorted(new NetexIdComparator()) + .skip(skip) + .limit(count) + .collect(Collectors.toList()); + } + + public Collection getScheduledStopPointsForStopPlaceWithId(String id) { + return netexEntitiesIndex.getPassengerStopAssignmentsByStopPointRefIndex().entries().stream().filter(entry -> { + var passengerStopAssignment = entry.getValue(); + return passengerStopAssignment.getStopPlaceRef() != null && passengerStopAssignment.getStopPlaceRef().getRef().equals(id); + }).map(entry -> { + var stopPointRef = entry.getKey(); + return netexEntitiesIndex.getScheduledStopPointIndex().getLatestVersion(stopPointRef); + }).collect(Collectors.toSet()); + } + + public ScheduledStopPoint getScheduledStopPoint(String id) { + return netexEntitiesIndex.getScheduledStopPointIndex().getLatestVersion(id); + } } diff --git a/src/main/java/no/entur/mummu/services/NetexObjectFactory.java b/src/main/java/no/entur/mummu/services/NetexObjectFactory.java index 26e5d9c..bb8c1d9 100644 --- a/src/main/java/no/entur/mummu/services/NetexObjectFactory.java +++ b/src/main/java/no/entur/mummu/services/NetexObjectFactory.java @@ -1,6 +1,7 @@ package no.entur.mummu.services; import jakarta.xml.bind.JAXBElement; +import org.checkerframework.checker.units.qual.N; import org.rutebanken.netex.model.FareZone; import org.rutebanken.netex.model.FareZonesInFrame_RelStructure; import org.rutebanken.netex.model.GroupOfStopPlaces; @@ -10,6 +11,8 @@ import org.rutebanken.netex.model.ObjectFactory; import org.rutebanken.netex.model.Parking; import org.rutebanken.netex.model.ParkingsInFrame_RelStructure; +import org.rutebanken.netex.model.ScheduledStopPoint; +import org.rutebanken.netex.model.ScheduledStopPointsInFrame_RelStructure; import org.rutebanken.netex.model.StopPlace; import org.rutebanken.netex.model.StopPlacesInFrame_RelStructure; import org.rutebanken.netex.model.TariffZone; @@ -33,6 +36,7 @@ public class NetexObjectFactory extends ObjectFactory { private static final QName _groupsOfTariffZones_QNAME = new QName(NAMESPACE_URI, "groupsOfTariffZones"); private static final QName _parkings_QNAME = new QName(NAMESPACE_URI, "parkings"); private static final QName _topographicPlaces_QNAME = new QName(NAMESPACE_URI, "topographicPlaces"); + private static final QName _scheduledStopPoints_QNAME = new QName(NAMESPACE_URI, "scheduledStopPoints"); public JAXBElement createGroupsOfStopPlaces(List groupsOfStopPlaces) { var groupsOfStopPlacesInFrame = createGroupsOfStopPlacesInFrame_RelStructure().withGroupOfStopPlaces(groupsOfStopPlaces); @@ -72,4 +76,9 @@ public JAXBElement createTopographicPlace var topographicPlacesInFrame = createTopographicPlacesInFrame_RelStructure().withTopographicPlace(topographicPlaces); return new JAXBElement<>(_topographicPlaces_QNAME, TopographicPlacesInFrame_RelStructure.class, topographicPlacesInFrame); } + + public JAXBElement createScheduledStopPoints(Collection scheduledStopPoints) { + var scheduledStopPointsInFrame = createScheduledStopPointsInFrame_RelStructure().withScheduledStopPoint(scheduledStopPoints); + return new JAXBElement<>(_scheduledStopPoints_QNAME, ScheduledStopPointsInFrame_RelStructure.class, scheduledStopPointsInFrame); + } } From 5cd41d9aae8c26763a57df2bf05ddd3c4a140583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Erik=20St=C3=B8wer?= Date: Thu, 6 Feb 2025 10:41:50 +0100 Subject: [PATCH 2/4] Added tests for new endpoints --- .../mummu/RestResourceIntegrationTest.java | 28 +++++++++++ src/test/resources/IntegrationTestFixture.xml | 46 +++++++++++++++++- .../resources/IntegrationTestFixture.xml.zip | Bin 5725 -> 6007 bytes 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java b/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java index 0e7d294..5416ba8 100644 --- a/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java +++ b/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java @@ -283,4 +283,32 @@ void testXMLOutputCanBeMarshalled() throws Exception { JAXBElement stopPlace = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(contentAsString.getBytes())); Assertions.assertEquals("NSR:StopPlace:4004", stopPlace.getValue().getId()); } + + @Test + void testGetScheduledStopPointForStopPlace() throws Exception { + mvc.perform(get("/stop-places/NSR:StopPlace:4004/scheduled-stop-points")) + .andExpect(status().isOk()) + .andExpect(content() + .contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$[0].name.value").value("Jernbanetorget")); + } + + @Test + void testGetScheduledStopPoints() throws Exception { + mvc.perform(get("/scheduled-stop-points")) + .andExpect(status().isOk()) + .andExpect(content() + .contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$[0].name.value").value("Jernbanetorget")); + } + + @Test + void testGetScheduledStopPointById() throws Exception { + mvc.perform(get("/scheduled-stop-points/NSR:ScheduledStopPoint:S4004")) + .andExpect(status().isOk()) + .andExpect(content() + .contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.name.value").value("Jernbanetorget")); + } + } diff --git a/src/test/resources/IntegrationTestFixture.xml b/src/test/resources/IntegrationTestFixture.xml index 7a58ef3..a0c16c0 100644 --- a/src/test/resources/IntegrationTestFixture.xml +++ b/src/test/resources/IntegrationTestFixture.xml @@ -9,6 +9,50 @@ Europe/Oslo + + + + 2017-06-19T19:12:29.887 + 2021-10-05T12:11:14.999 + + Jernbanetorget + + + + Jernbanetorget + + + + 2017-06-19T19:33:17.697 + + Norefjell skiheis + + + + + + 2017-06-19T19:12:29.887 + 2021-10-05T12:11:14.999 + + + + + + + 2017-06-19T19:12:30.689 + 2018-01-18T12:00:54.999 + + + + + + + 2017-06-19T19:33:17.697 + + + + + Site frame ExportParams{topographicPlaceExportMode=RELEVANT, municipalityReferences=[], countyReferences=[], countryReferences=[], stopPlaceSearch=StopPlaceSearch{stopPlaceType=[], netexIdList=[], allVersions=false, versionValidity=CURRENT, withoutLocationOnly=false, withoutQuaysOnly=false, withDuplicatedQuayImportedIds=false, withTags=[], tags=[], page=0, size=20}, tariffZoneExportMode=RELEVANT, serviceFrameExportMode=ALL} @@ -1041,4 +1085,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/IntegrationTestFixture.xml.zip b/src/test/resources/IntegrationTestFixture.xml.zip index 5bbfb7f1ab44e86622f47eb92defe0f03c184730..84a2cab295b63bccc963e054e738ff3ebe81e6ae 100644 GIT binary patch delta 5928 zcmV+@7uV?BEcY%LP)h>@6aWYS2mlsUMp^&>00000008szkr*Wmor9!jor9!jor9!j zkx3kXOTt2cAWPPilQ@~oIJU>u$+=72O3@Z^4A&A|-BG zEK3PbrRrGCMq?q^3%&->`SXwApz%%mf$NP${_elcV2y@0;SN5rodD z?+m<=JUM!n!O@?)f9hOKZU^q26GE|fa^Ql0gy#l`8U-guk6}2r+wJe)zqdv*ls{UY z|InH|we^pqh|3-YB*p2C<>7#nmPV z;r4%gI={JlltZWKj#PK<ZGhRsOJ;GK3R^Hh%Ghwhy_c1Gc~yzgGzTmyTW7BTjn(7C+*D(}J|qG;-k z^uM`x^1bg2Wn&2M=-!>RbR@qgJ9N}=`zJ>r-%ggX@zGqGmZ-_^-M>nIbnCzu2cL<53_ER2 z%y?hRBemkFv%*pTJ4VbhNR@GK??rb?CK2Y$GGAsEQEFqe#jVm=RDBX$c)q;&9H&}n*I_=UAv=hLC(;#pkMnjqX`Cd6e0JcE-H!0SJ=l7+r2S4jY;yO_Ifj6HaZpO!rv#(b4sKl*b6dtFb535`KtQhVAS&(-*eQr zEq%~wVVk{8Fb#Q%AM8rPM@_oBZn&baJ1em4=)RM|o$rp7fUaU|+-t#qXFtZCAA$?+ z41<3{1HA{|89%yrdH|w_pS-?2xjs8T`+R!QJ8ldoBkipZ+)#Z1(uZhC1}FdhKgW$b zZ!*dz`is4^+lX#Y2NI<0 z7{Wa;V*1}!^xua~41yJ${nN)0pxGxOY+Scd!&O5gST zlKv^yb9V&F=Gq;9Jrpy?1;$>Wd%&!gWg>!=Jut{+sHfWM(QX#9E%!RCUr@rsF~D_ER}M9G&3G%%Xu5yvB*_W&Fi%1 z)GS@OD1I}I2M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WsKkcRMPwmn$>NDvgtX=MmLxfeM zG`TrCEf)s0EOkVME7fO5*@D-chMk6y9Me?ey4Jw+v3`z$(o#zsLnb4g200tn1+~h8 z4+}(YjxUQ?GKW=1VoQfvW$>ICSU9F%$&#>=a5HSoLUYJ*R9d#J``0U%PzwF*g0#i; zwrOu+`Bom_Pyu8gh)~@KTM<%vi(9c~7izKKr)X`E1TCqEf4a_KW1bRAoyda2gBl6Y zT?W*yP4!x~eRja3hEi8n1$&X>4a8pXb_Y6QUYSeQW6q7^lP+_oXHuXV(wVeH{RP?| zE(1@Gk?bkfAU=!_YXT_HWAEMO##mMe(rDJB?;7U8985ke~gMp6&t~99j*r4&>vx|8)xsgn8;0AMcU{k_GM^WhpxEMrG_5# zgC8x+D6a%kl&ch^Uo59;99iWbRwT3<16q~$_U}Q@f@`v69OWz(*Lq8lTqao~AafJ& zcW7m9oPqF5u@Ol-wd_nc`(Fyu<6H1R`80Q$lbM{`e7ZKRMCr@F%o@ssM0OXKlz!A$ zSakbXSQ^UMI8?a*7wP_=_L-7aNbvt>x<39SSlD>y*jQNqBH;fx@d^Hu|6>1Zhkv~K J?;;k~e*t9w3%LLQ From 9c5cc6b9b74a56376b99f45c2b5d6a19e143d83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Erik=20St=C3=B8wer?= Date: Thu, 6 Feb 2025 10:48:50 +0100 Subject: [PATCH 3/4] Remove unused import --- src/main/java/no/entur/mummu/services/NetexObjectFactory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/no/entur/mummu/services/NetexObjectFactory.java b/src/main/java/no/entur/mummu/services/NetexObjectFactory.java index bb8c1d9..ae21d96 100644 --- a/src/main/java/no/entur/mummu/services/NetexObjectFactory.java +++ b/src/main/java/no/entur/mummu/services/NetexObjectFactory.java @@ -1,7 +1,6 @@ package no.entur.mummu.services; import jakarta.xml.bind.JAXBElement; -import org.checkerframework.checker.units.qual.N; import org.rutebanken.netex.model.FareZone; import org.rutebanken.netex.model.FareZonesInFrame_RelStructure; import org.rutebanken.netex.model.GroupOfStopPlaces; From 4570076fd45e3c219d5326c87f196b797008aa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Erik=20St=C3=B8wer?= Date: Thu, 6 Feb 2025 10:56:15 +0100 Subject: [PATCH 4/4] Add xml test --- .../entur/mummu/RestResourceIntegrationTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java b/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java index 5416ba8..0497d37 100644 --- a/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java +++ b/src/test/java/no/entur/mummu/RestResourceIntegrationTest.java @@ -3,6 +3,7 @@ import jakarta.xml.bind.JAXBElement; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.rutebanken.netex.model.ScheduledStopPoint; import org.rutebanken.netex.model.StopPlace; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -311,4 +312,17 @@ void testGetScheduledStopPointById() throws Exception { .andExpect(jsonPath("$.name.value").value("Jernbanetorget")); } + @Test + void testGetScheduledStopPointByIdAsXML() throws Exception { + ResultActions resultActions = mvc.perform(get("/scheduled-stop-points/NSR:ScheduledStopPoint:S4004") + .accept(MediaType.APPLICATION_XML)) + .andExpect(status().isOk()); + MvcResult mvcResult = resultActions.andReturn(); + String contentAsString = mvcResult.getResponse().getContentAsString(); + Unmarshaller unmarshaller = JAXBContext + .newInstance(ScheduledStopPoint.class) + .createUnmarshaller(); + JAXBElement scheduledStopPoint = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(contentAsString.getBytes())); + Assertions.assertEquals("NSR:ScheduledStopPoint:S4004", scheduledStopPoint.getValue().getId()); + } }