Skip to content

Commit

Permalink
Fix in OsrmConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
solita-sabinaf committed Dec 11, 2024
1 parent 5494a67 commit ba79595
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public static <E> String getEntityName(E entity) {
}
} else if (entity instanceof VersionedChildStructure) {
if (localPart.endsWith("VersionedChildStructure")) {
localPart = localPart.substring(0, localPart.lastIndexOf("_VersionedChildStructure"));
localPart =
localPart.substring(0, localPart.lastIndexOf("_VersionedChildStructure"));
}
}
return localPart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,6 @@ Quay getQuay(String quayRef) {
.get(0);
}

String extractQuayRefFrom(Ref serviceLinkRef, NetexExportContext context) {
String suffix = NetexIdProducer.getObjectIdSuffix(serviceLinkRef.id).split("_")[0];
return getQuayRef(context, suffix);
}

String extractQuayRefTo(Ref serviceLinkRef, NetexExportContext context) {
String suffix = NetexIdProducer.getObjectIdSuffix(serviceLinkRef.id).split("_")[1];
return getQuayRef(context, suffix);
}

String getQuayRef(NetexExportContext context, String suffix) {
return context.quayRefs
.stream()
.filter(quay -> NetexIdProducer.getObjectIdSuffix(quay).equals(suffix))
.findFirst()
.get();
}

String getLineStringId(Ref serviceLinkRef) {
String serviceLinkSuffix = NetexIdProducer.getObjectIdSuffix(serviceLinkRef.id);
return "LS_" + serviceLinkSuffix;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.entur.uttu.routing.osrm;

import no.entur.uttu.routing.RoutingService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -10,7 +11,7 @@
public class OsrmConfiguration {

@Bean
OsrmService osrmService(@Value("${uttu.routing.osrm-api}") String osrmApi) {
RoutingService routingService(@Value("${uttu.routing.osrm-api}") String osrmApi) {
return new OsrmService(osrmApi);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@

public class NetexObjectFactoryTest {

@Test
void populateIdReturnsValidIdForVersionedChildStructureElements() {
NetexObjectFactory factory = new NetexObjectFactory(
new DateUtils(),
new ExportTimeZone()
);
@Test
void populateIdReturnsValidIdForVersionedChildStructureElements() {
NetexObjectFactory factory = new NetexObjectFactory(
new DateUtils(),
new ExportTimeZone()
);

Assertions.assertEquals(
"ENT:ServiceLinkInJourneyPattern:1",
factory.populateId(
new ServiceLinkInJourneyPattern_VersionedChildStructure(),
new Ref("ENT:ServiceLink:1", "1")
).getId()
);
}
Assertions.assertEquals(
"ENT:ServiceLinkInJourneyPattern:1",
factory
.populateId(
new ServiceLinkInJourneyPattern_VersionedChildStructure(),
new Ref("ENT:ServiceLink:1", "1")
)
.getId()
);
}
}

0 comments on commit ba79595

Please sign in to comment.