Skip to content

Commit

Permalink
fix(bosa): namespace ending with slash
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandaal committed Nov 4, 2024
1 parent b9be08d commit 2918ea8
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/Basisregisters.IntegrationDb.Bosa/AddressService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void CreateXml(Stream outputStream)
EndLifeSpanVersion = endLifeSpanVersion,
Code = new XmlCode
{
Namespace = address.Namespace,
Namespace = FormatNamespace(address.Namespace),
ObjectIdentifier = address.AddressPersistentLocalId.ToString(),
VersionIdentifier = GetVersionAsString(address.VersionTimestamp)
},
Expand Down Expand Up @@ -106,19 +106,19 @@ public void CreateXml(Stream outputStream)
},
HasStreetName = new XmlCode
{
Namespace = streetName.Namespace,
Namespace = FormatNamespace(streetName.Namespace),
ObjectIdentifier = streetName.StreetNamePersistentLocalId.ToString(),
VersionIdentifier = GetVersionAsString(streetName.VersionTimestamp)
},
HasMunicipality = new XmlCode
{
Namespace = municipality.Namespace,
Namespace = FormatNamespace(municipality.Namespace),
ObjectIdentifier = municipality.NisCode,
VersionIdentifier = GetVersionAsString(municipality.VersionTimestamp)
},
HasPostalInfo = new XmlCode
{
Namespace = postalInfo.Namespace,
Namespace = FormatNamespace(postalInfo.Namespace),
ObjectIdentifier = postalInfo.PostalCode,
VersionIdentifier = GetVersionAsString(postalInfo.VersionTimestamp)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ namespace Basisregisters.IntegrationDb.Bosa
public class BaseRegistryService
{
protected static string GetVersionAsString(DateTimeOffset value) => value.ToBelgianString();
protected static string FormatNamespace(string @namespace) => @namespace.EndsWith('/') ? @namespace : $"{@namespace}/";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void CreateXml(Stream outputStream)
{
Code = new XmlCode
{
Namespace = x.Namespace,
Namespace = FormatNamespace(x.Namespace),
ObjectIdentifier = x.NisCode,
VersionIdentifier = GetVersionAsString(x.VersionTimestamp)
},
Expand Down
2 changes: 1 addition & 1 deletion src/Basisregisters.IntegrationDb.Bosa/PostalInfoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void CreateXml(Stream outputStream)
{
Code = new XmlCode
{
Namespace = postalInfo.Namespace,
Namespace = FormatNamespace(postalInfo.Namespace),
ObjectIdentifier = postalInfo.PostalCode,
VersionIdentifier = GetVersionAsString(postalInfo.VersionTimestamp),
},
Expand Down
4 changes: 2 additions & 2 deletions src/Basisregisters.IntegrationDb.Bosa/StreetNameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void CreateXml(Stream outputStream)
EndLifeSpanVersion = endLifeSpanVersion,
Code = new XmlCode
{
Namespace = streetName.Namespace,
Namespace = FormatNamespace(streetName.Namespace),
ObjectIdentifier = streetName.StreetNamePersistentLocalId.ToString(),
VersionIdentifier = GetVersionAsString(streetName.VersionTimestamp)
},
Expand All @@ -53,7 +53,7 @@ public void CreateXml(Stream outputStream)
Type = "streetname",
IsAssignedByMunicipality = new XmlCode
{
Namespace = streetName.MunicipalityNamespace,
Namespace = FormatNamespace(streetName.MunicipalityNamespace),
ObjectIdentifier = streetName.NisCode,
VersionIdentifier = GetVersionAsString(streetName.MunicipalityVersionTimestamp)
}
Expand Down
24 changes: 12 additions & 12 deletions test/Basisregisters.IntegrationDb.Bosa.Tests/XmlAddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public async Task GivenAddress_ThenSerializesCorrectly()
<tns:timestamp>1970-01-01T01:00:00+01:00</tns:timestamp>
<tns:address beginLifeSpanVersion="2023-11-09T00:00:00+01:00" endLifeSpanVersion="2023-11-09T00:00:00+01:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/adres</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/adres/</com:namespace>
<com:objectIdentifier>200001</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:code>
Expand All @@ -179,24 +179,24 @@ public async Task GivenAddress_ThenSerializesCorrectly()
<com:houseNumber>59</com:houseNumber>
<com:officiallyAssigned>true</com:officiallyAssigned>
<com:hasStreetName>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>14602</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasStreetName>
<com:hasMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>13013</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasMunicipality>
<com:hasPostalInfo>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>2230</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasPostalInfo>
</tns:address>
<tns:address beginLifeSpanVersion="2014-04-04T18:44:32+02:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/adres</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/adres/</com:namespace>
<com:objectIdentifier>30328681</com:objectIdentifier>
<com:versionIdentifier>2024-04-04T18:44:37+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -216,24 +216,24 @@ public async Task GivenAddress_ThenSerializesCorrectly()
<com:houseNumber>1</com:houseNumber>
<com:officiallyAssigned>true</com:officiallyAssigned>
<com:hasStreetName>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>6345</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasStreetName>
<com:hasMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>11035</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasMunicipality>
<com:hasPostalInfo>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>2520</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasPostalInfo>
</tns:address>
<tns:address beginLifeSpanVersion="2014-04-04T18:44:32+02:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/adres</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/adres/</com:namespace>
<com:objectIdentifier>30328682</com:objectIdentifier>
<com:versionIdentifier>2024-04-04T18:44:37+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -253,17 +253,17 @@ public async Task GivenAddress_ThenSerializesCorrectly()
<com:houseNumber>2</com:houseNumber>
<com:officiallyAssigned>true</com:officiallyAssigned>
<com:hasStreetName>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>6345</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasStreetName>
<com:hasMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>11035</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasMunicipality>
<com:hasPostalInfo>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>2520</com:objectIdentifier>
<com:versionIdentifier>2023-11-09T00:00:00+01:00</com:versionIdentifier>
</com:hasPostalInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task GivenMunicipality_ThenSerializesCorrectly()
<tns:timestamp>1970-01-01T01:00:00+01:00</tns:timestamp>
<tns:municipality>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>23027</com:objectIdentifier>
<com:versionIdentifier>1940-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -69,7 +69,7 @@ public async Task GivenMunicipality_ThenSerializesCorrectly()
</tns:municipality>
<tns:municipality>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>93027</com:objectIdentifier>
<com:versionIdentifier>2002-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -84,7 +84,7 @@ public async Task GivenMunicipality_ThenSerializesCorrectly()
</tns:municipality>
<tns:municipality>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>23028</com:objectIdentifier>
<com:versionIdentifier>2024-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task GivenPostalInfo_ThenSerializesCorrectly()
<tns:timestamp>1970-01-01T01:00:00+01:00</tns:timestamp>
<tns:postalInfo>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>1500</com:objectIdentifier>
<com:versionIdentifier>1940-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -67,7 +67,7 @@ public async Task GivenPostalInfo_ThenSerializesCorrectly()
</tns:postalInfo>
<tns:postalInfo>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>1600</com:objectIdentifier>
<com:versionIdentifier>2002-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -78,7 +78,7 @@ public async Task GivenPostalInfo_ThenSerializesCorrectly()
</tns:postalInfo>
<tns:postalInfo>
<com:code>
<com:namespace>https://data.vlaanderen.be/id/postinfo</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/postinfo/</com:namespace>
<com:objectIdentifier>3890</com:objectIdentifier>
<com:versionIdentifier>2024-08-13T14:37:33+02:00</com:versionIdentifier>
</com:code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public async Task GivenStreetName_ThenSerializesCorrectly()
<tns:timestamp>1970-01-01T01:00:00+01:00</tns:timestamp>
<tns:streetName beginLifeSpanVersion="2002-08-31T17:19:02+02:00" endLifeSpanVersion="2015-08-31T17:19:02+02:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>27114</com:objectIdentifier>
<com:versionIdentifier>2015-08-31T17:19:02+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -119,14 +119,14 @@ public async Task GivenStreetName_ThenSerializesCorrectly()
</com:streetNameStatus>
<com:type>streetname</com:type>
<com:isAssignedByMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>23044</com:objectIdentifier>
<com:versionIdentifier>2024-08-13T17:32:32+02:00</com:versionIdentifier>
</com:isAssignedByMunicipality>
</tns:streetName>
<tns:streetName beginLifeSpanVersion="2016-10-03T08:46:40+02:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>30376</com:objectIdentifier>
<com:versionIdentifier>2016-10-03T08:44:22+02:00</com:versionIdentifier>
</com:code>
Expand All @@ -144,14 +144,14 @@ public async Task GivenStreetName_ThenSerializesCorrectly()
</com:streetNameStatus>
<com:type>streetname</com:type>
<com:isAssignedByMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>23098</com:objectIdentifier>
<com:versionIdentifier>2002-08-13T17:32:32+02:00</com:versionIdentifier>
</com:isAssignedByMunicipality>
</tns:streetName>
<tns:streetName beginLifeSpanVersion="2024-01-31T14:16:03+01:00">
<com:code>
<com:namespace>https://data.vlaanderen.be/id/straatnaam</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/straatnaam/</com:namespace>
<com:objectIdentifier>228584</com:objectIdentifier>
<com:versionIdentifier>2024-01-31T14:16:08+01:00</com:versionIdentifier>
</com:code>
Expand All @@ -165,7 +165,7 @@ public async Task GivenStreetName_ThenSerializesCorrectly()
</com:streetNameStatus>
<com:type>streetname</com:type>
<com:isAssignedByMunicipality>
<com:namespace>https://data.vlaanderen.be/id/gemeente</com:namespace>
<com:namespace>https://data.vlaanderen.be/id/gemeente/</com:namespace>
<com:objectIdentifier>24059</com:objectIdentifier>
<com:versionIdentifier>2010-08-13T17:32:32+02:00</com:versionIdentifier>
</com:isAssignedByMunicipality>
Expand Down

0 comments on commit 2918ea8

Please sign in to comment.