Skip to content

Commit 839a2ee

Browse files
committed
fixes
1 parent 73e406e commit 839a2ee

File tree

19 files changed

+50
-58
lines changed

19 files changed

+50
-58
lines changed

internal/controller/capabilitiesgenerator/mapper.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func MapWFSToCapabilitiesGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoper
4949

5050
ServiceProvider: mapServiceProvider(&ownerInfo.Spec.WFS.ServiceProvider),
5151
ServiceIdentification: wfs200.ServiceIdentification{
52-
Title: mapperutils.EscapeQuotes(wfs.Spec.Service.Title),
53-
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
52+
Title: wfs.Spec.Service.Title,
53+
Abstract: wfs.Spec.Service.Abstract,
5454
AccessConstraints: wfs.Spec.Service.AccessConstraints.String(),
5555
Keywords: &wsc110.Keywords{
5656
Keyword: wfs.Spec.Service.KeywordsIncludingInspireKeyword(),
@@ -163,8 +163,8 @@ func getFeatureTypeList(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv1.OwnerInfo
163163

164164
featureType := wfs200.FeatureType{
165165
Name: wfs.Spec.Service.Prefix + ":" + fType.Name,
166-
Title: mapperutils.EscapeQuotes(fType.Title),
167-
Abstract: mapperutils.EscapeQuotes(fType.Abstract),
166+
Title: fType.Title,
167+
Abstract: fType.Abstract,
168168
Keywords: &[]wsc110.Keywords{
169169
{
170170
Keyword: fType.Keywords,
@@ -272,8 +272,6 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
272272
return nil, err
273273
}
274274

275-
abstract := mapperutils.EscapeQuotes(wms.Spec.Service.Abstract)
276-
277275
config := capabilitiesgenerator.Config{
278276
Global: capabilitiesgenerator.Global{
279277
// Prefix is unused for the WMS, but doesn't hurt to pass it
@@ -288,10 +286,10 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
288286
Wms130: wms130.GetCapabilitiesResponse{
289287
WMSService: wms130.WMSService{
290288
Name: "WMS",
291-
Title: mapperutils.EscapeQuotes(wms.Spec.Service.Title),
292-
Abstract: &abstract,
289+
Title: wms.Spec.Service.Title,
290+
Abstract: &wms.Spec.Service.Abstract,
293291
KeywordList: &wms130.Keywords{Keyword: wms.Spec.Service.KeywordsIncludingInspireKeyword()},
294-
OnlineResource: wms130.OnlineResource{Href: smoothoperatorutils.Pointer(wms.URL().Scheme + "://" + wms.URL().Host)},
292+
OnlineResource: wms130.OnlineResource{Href: smoothoperatorutils.Pointer(wms.URL().Scheme + "://" + wms.URL().Host + "/")},
295293
ContactInformation: getContactInformation(ownerInfo),
296294
Fees: wms.Spec.Service.Fees,
297295
AccessConstraints: ptr.To(wms.Spec.Service.AccessConstraints.String()),
@@ -316,7 +314,7 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
316314
DCPType: getDcpType(canonicalServiceURL.String(), true),
317315
},
318316
},
319-
Exception: wms130.ExceptionType{Format: []string{"XML", "BLANK"}},
317+
Exception: wms130.ExceptionType{Format: []string{"XML", "INIMAGE", "BLANK"}},
320318
ExtendedCapabilities: nil,
321319
Layer: layer,
322320
},
@@ -400,13 +398,19 @@ func getDcpType(url string, fillPost bool) *wms130.DCPType {
400398
OnlineResource: wms130.OnlineResource{
401399
Xlink: smoothoperatorutils.Pointer(XLinkURL),
402400
Type: nil,
403-
Href: smoothoperatorutils.Pointer(url),
401+
Href: smoothoperatorutils.Pointer(url + "?"),
404402
},
405403
}
406404

407405
var post *wms130.Method
408406
if fillPost {
409-
post = &get
407+
post = &wms130.Method{
408+
OnlineResource: wms130.OnlineResource{
409+
Xlink: smoothoperatorutils.Pointer(XLinkURL),
410+
Type: nil,
411+
Href: smoothoperatorutils.Pointer(url),
412+
},
413+
}
410414
}
411415

412416
result := wms130.DCPType{
@@ -434,7 +438,7 @@ func mapLayer(layer pdoknlv3.Layer, canonicalURL string, authorityURL *wms130.Au
434438
authorityURL = &wms130.AuthorityURL{
435439
Name: layer.Authority.Name,
436440
OnlineResource: wms130.OnlineResource{
437-
Xlink: smoothoperatorutils.Pointer(XLinkURL),
441+
Xlink: nil,
438442
Type: nil,
439443
Href: &layer.Authority.URL,
440444
},
@@ -454,8 +458,8 @@ func mapLayer(layer pdoknlv3.Layer, canonicalURL string, authorityURL *wms130.Au
454458
Queryable: smoothoperatorutils.Pointer(1),
455459
Opaque: nil,
456460
Name: layer.Name,
457-
Title: mapperutils.EscapeQuotes(smoothoperatorutils.PointerVal(layer.Title, "")),
458-
Abstract: smoothoperatorutils.Pointer(mapperutils.EscapeQuotes(smoothoperatorutils.PointerVal(layer.Abstract, ""))),
461+
Title: smoothoperatorutils.PointerVal(layer.Title, ""),
462+
Abstract: smoothoperatorutils.Pointer(smoothoperatorutils.PointerVal(layer.Abstract, "")),
459463
KeywordList: &wms130.Keywords{Keyword: layer.Keywords},
460464
CRS: crsses,
461465
EXGeographicBoundingBox: exBbox,

internal/controller/capabilitiesgenerator/test_data/wfs_input.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
definition:
1111
serviceIdentification:
1212
title: some Service title
13-
abstract: some \"Service\" abstract
13+
abstract: 'some "Service" abstract'
1414
keywords:
1515
keyword:
1616
- service-keyword-1
@@ -37,7 +37,7 @@ services:
3737
featureType:
3838
- name: prefix:featuretype-1-name
3939
title: featuretype-1-title
40-
abstract: feature \"1\" abstract
40+
abstract: 'feature "1" abstract'
4141
keywords:
4242
- keyword:
4343
- featuretype-1-keyword-1
@@ -59,7 +59,7 @@ services:
5959
href: https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=datadata-data-data-data-datadatadata
6060
- name: prefix:featuretype-2-name
6161
title: featuretype-2-title
62-
abstract: feature \"2\" abstract
62+
abstract: 'feature "2" abstract'
6363
keywords:
6464
- keyword:
6565
- featuretype-2-keyword-1

internal/controller/capabilitiesgenerator/test_data/wms_input.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
onlineResource:
3232
xlink: null
3333
type: null
34-
href: http://localhost
34+
href: http://localhost/
3535
contactInformation:
3636
contactPersonPrimary:
3737
contactPerson: KlantContactCenter PDOK
@@ -63,7 +63,7 @@ services:
6363
onlineResource:
6464
xlink: http://www.w3.org/1999/xlink
6565
type: null
66-
href: http://localhost/rws/nwbwegen/wms/v1_0
66+
href: http://localhost/rws/nwbwegen/wms/v1_0?
6767
post: null
6868
getMap:
6969
format:
@@ -78,7 +78,7 @@ services:
7878
onlineResource:
7979
xlink: http://www.w3.org/1999/xlink
8080
type: null
81-
href: http://localhost/rws/nwbwegen/wms/v1_0
81+
href: http://localhost/rws/nwbwegen/wms/v1_0?
8282
post:
8383
onlineResource:
8484
xlink: http://www.w3.org/1999/xlink
@@ -99,7 +99,7 @@ services:
9999
onlineResource:
100100
xlink: http://www.w3.org/1999/xlink
101101
type: null
102-
href: http://localhost/rws/nwbwegen/wms/v1_0
102+
href: http://localhost/rws/nwbwegen/wms/v1_0?
103103
post:
104104
onlineResource:
105105
xlink: http://www.w3.org/1999/xlink
@@ -108,6 +108,7 @@ services:
108108
exception:
109109
format:
110110
- XML
111+
- INIMAGE
111112
- BLANK
112113
extendedCapabilities:
113114
metadataUrl:
@@ -277,7 +278,7 @@ services:
277278
onlineResource:
278279
href: https://www.rijkswaterstaat.nl
279280
type: null
280-
xlink: http://www.w3.org/1999/xlink
281+
xlink: null
281282
identifier:
282283
authority: rws
283284
value: 8f0497f0-dbd7-4bee-b85a-5fdec484a7ff
@@ -380,7 +381,7 @@ services:
380381
onlineResource:
381382
href: https://www.rijkswaterstaat.nl
382383
type: null
383-
xlink: http://www.w3.org/1999/xlink
384+
xlink: null
384385
identifier:
385386
authority: rws
386387
value: 8f0497f0-dbd7-4bee-b85a-5fdec484a7ff

internal/controller/mapfilegenerator/mapper.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func MapWFSToMapfileGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv
4343

4444
input := WFSInput{
4545
BaseServiceInput: BaseServiceInput{
46-
Title: mapperutils.EscapeQuotes(wfs.Spec.Service.Title),
47-
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
46+
Title: wfs.Spec.Service.Title,
47+
Abstract: wfs.Spec.Service.Abstract,
4848
Keywords: strings.Join(wfs.Spec.Service.KeywordsIncludingInspireKeyword(), ","),
4949
OnlineResource: wfs.URL().Scheme + "://" + wfs.URL().Host,
5050
Path: wfs.URL().Path,
@@ -70,8 +70,8 @@ func getWFSLayers(service pdoknlv3.WFSService) (layers []WFSLayer) {
7070
layer := WFSLayer{
7171
BaseLayer: BaseLayer{
7272
Name: featureType.Name,
73-
Title: mapperutils.EscapeQuotes(featureType.Title),
74-
Abstract: mapperutils.EscapeQuotes(featureType.Abstract),
73+
Title: featureType.Title,
74+
Abstract: featureType.Abstract,
7575
Keywords: strings.Join(featureType.Keywords, ","),
7676
Extent: getWFSExtent(featureType, service),
7777
MetadataID: featureType.DatasetMetadataURL.CSW.MetadataIdentifier,

internal/controller/mapfilegenerator/test_data/expected/wfs.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"service_title": "some Service title",
3-
"service_abstract": "some \\\"Service\\\" abstract",
3+
"service_abstract": "some \"Service\" abstract",
44
"service_keywords": "service-keyword-1,service-keyword-2,infoFeatureAccessService",
55
"service_extent": "0.0 2.0 1.0 3.0",
66
"service_wfs_maxfeatures": "1000",
@@ -27,7 +27,7 @@
2727
{
2828
"name": "featuretype-1-name",
2929
"title": "featuretype-1-title",
30-
"abstract": "feature \\\"1\\\" abstract",
30+
"abstract": "feature \"1\" abstract",
3131
"keywords": "featuretype-1-keyword-1,featuretype-1-keyword-2",
3232
"layer_extent": "0.0 2.0 1.0 3.0",
3333
"dataset_metadata_id": "datadata-data-data-data-datadatadata",
@@ -49,7 +49,7 @@
4949
{
5050
"name": "featuretype-2-name",
5151
"title": "featuretype-2-title",
52-
"abstract": "feature \\\"2\\\" abstract",
52+
"abstract": "feature \"2\" abstract",
5353
"keywords": "featuretype-2-keyword-1,featuretype-2-keyword-2",
5454
"layer_extent": "0.0 2.0 1.0 3.0",
5555
"dataset_metadata_id": "datadata-data-data-data-datadatadata",

internal/controller/mapperutils/utils.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,6 @@ func GetNamespaceURI(prefix string, ownerInfo *smoothoperatorv1.OwnerInfo) strin
6262
return strings.ReplaceAll(*ownerInfo.Spec.NamespaceTemplate, "{{prefix}}", prefix)
6363
}
6464

65-
func EscapeQuotes(s string) string {
66-
return strings.ReplaceAll(s, "\"", "\\\"")
67-
}
68-
69-
func GetLabelValueByKey(labels map[string]string, key string) *string {
70-
for k, v := range labels {
71-
if k == key {
72-
return &v
73-
}
74-
}
75-
return nil
76-
}
77-
7865
func AnyMatch[S ~[]E, E any](slice S, eql func(E) bool) bool {
7966
for _, elem := range slice {
8067
if eql(elem) {

internal/controller/test_data/wfs/complete/expected/configmap-capabilities-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ metadata:
107107
service-type: wfs
108108
service-version: v1_0
109109
theme: theme
110-
name: complete-wfs-capabilities-generator-g7fh2dbt4m
110+
name: complete-wfs-capabilities-generator-mfbh8cgh5c
111111
namespace: default
112112
ownerReferences:
113113
- apiVersion: pdok.nl/v3

internal/controller/test_data/wfs/complete/expected/configmap-mapfile-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ metadata:
111111
service-type: wfs
112112
service-version: v1_0
113113
theme: theme
114-
name: complete-wfs-mapfile-generator-c4f5ctgfmb
114+
name: complete-wfs-mapfile-generator-dkmmf7b5hf
115115
namespace: default
116116
ownerReferences:
117117
- apiVersion: pdok.nl/v3

internal/controller/test_data/wfs/complete/expected/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ spec:
261261
name: complete-wfs-init-scripts-fft29bbtdd
262262
name: init-scripts
263263
- configMap:
264-
name: complete-wfs-capabilities-generator-g7fh2dbt4m
264+
name: complete-wfs-capabilities-generator-mfbh8cgh5c
265265
defaultMode: 420
266266
name: capabilities-generator-config
267267
- configMap:
268-
name: complete-wfs-mapfile-generator-c4f5ctgfmb
268+
name: complete-wfs-mapfile-generator-dkmmf7b5hf
269269
defaultMode: 420
270270
name: mapfile-generator-config

internal/controller/test_data/wms/complete/expected/configmap-capabilities-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ metadata:
233233
service-type: wms
234234
service-version: v1_0
235235
theme: '2016'
236-
name: complete-wms-capabilities-generator-ccc59c7dhm
236+
name: complete-wms-capabilities-generator-gk8t45g7g2
237237
namespace: default
238238
ownerReferences:
239239
- apiVersion: pdok.nl/v3

0 commit comments

Comments
 (0)