Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,10 @@ class FeatureTokenDecoderGmlSpec extends Specification {
.putProperties2("rol", new ImmutableFeatureSchema.Builder()
.sourcePath("qag__dpl_prs_pro_resp_rol_cdv")
.type(SchemaBase.Type.STRING)
.alias("role")))
.alias("role")
.constraints(new ImmutableSchemaConstraints.Builder()
.codelist("CI_RoleCode")
.build())))
.putProperties2("src", new ImmutableFeatureSchema.Builder()
.type(SchemaBase.Type.OBJECT)
.objectType("LI_Source")
Expand Down Expand Up @@ -1952,6 +1955,7 @@ class FeatureTokenDecoderGmlSpec extends Specification {
// - dateTime wraps <gco:DateTime> — gmd/gco auto-detected
// - organisationName wraps <gco:CharacterString> — auto-detected
// - role wraps <gmd:CI_RoleCode codeListValue=…> — auto-detected; text content used
// (rol has a codelist constraint, but the gmd text path wins; see the focused test below)
// - source/description wraps <adv:AX_Datenerhebung_Punktort> — explicit valueWrap
// The sibling <adv:genauigkeitsstufe> at AX_DQPunktort level exercises a scalar that
// sits next to the deep dpl subtree.
Expand Down Expand Up @@ -2012,6 +2016,48 @@ class FeatureTokenDecoderGmlSpec extends Specification {
valueAtPath(tokens, ["qag", "gst"]) == "2100"
}

def 'a codelist-constrained role still decodes from the gmd:CI_RoleCode text, not as an xlink:href'() {
given:
// Regression guard for the ISO 19139 codelist encoding (GmlConfiguration#codeListUriTemplateIso19139).
// The `rol` property carries a `codelist` constraint, which makes the decoder treat it as a
// codelist property eligible for xlink:href routing. The ISO 19139 wire, however, carries the
// value in the gmd:CI_RoleCode text content (and the codeListValue attribute), with no
// xlink:href on the property element — so the codelist routing finds no href and the gmd
// value-wrapper text is used. The codeList URI must not leak into the decoded value.
def decoder = newPunktortAuDecoder(nasNamespaceProfile())
def xml = """<adv:AX_PunktortAU xmlns:adv="${ADV_NS}"
xmlns:gmd="${GMD_NS}"
xmlns:gml="http://www.opengis.net/gml/3.2"
gml:id="DENW31AL10000ABC">
<adv:qualitaetsangaben>
<adv:AX_DQPunktort>
<adv:herkunft>
<gmd:LI_Lineage>
<gmd:processStep>
<gmd:LI_ProcessStep>
<gmd:processor>
<gmd:CI_ResponsibleParty>
<gmd:role>
<gmd:CI_RoleCode codeList="https://schemas.isotc211.org/19139/resources/codelists/gmxCodelists.xml/gmxCodelists.xml#CI_RoleCode" codeListValue="processor">processor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:processor>
</gmd:LI_ProcessStep>
</gmd:processStep>
</gmd:LI_Lineage>
</adv:herkunft>
</adv:AX_DQPunktort>
</adv:qualitaetsangaben>
</adv:AX_PunktortAU>"""

when:
def tokens = runDecoder(decoder, xml)

then:
valueAtPath(tokens, ["qag", "dpl", "prs", "pro", "rol"]) == "processor"
!tokens.contains("https://schemas.isotc211.org/19139/resources/codelists/gmxCodelists.xml/gmxCodelists.xml#CI_RoleCode")
}

def 'LI_ProcessStep children written in the wrong namespace are skipped'() {
given:
// Sanity check: with objectTypeNamespaces[LI_ProcessStep] = gmd, an LI_ProcessStep
Expand Down
Loading