From 193bc1477dc4be080312318a99235d5d4d66373d Mon Sep 17 00:00:00 2001 From: CarstenHollmann Date: Tue, 6 Sep 2022 10:48:01 +0200 Subject: [PATCH] add staticstring to replace xmlstring for reusing in capabilities --- .../ogc/ows/service/GetCapabilitiesResponse.java | 16 ++++++++++++---- .../encode/GetCapabilitiesResponseEncoder.java | 2 +- .../GetCapabilitiesResponseEncoderTest.java | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/shetland/core/src/main/java/org/n52/shetland/ogc/ows/service/GetCapabilitiesResponse.java b/shetland/core/src/main/java/org/n52/shetland/ogc/ows/service/GetCapabilitiesResponse.java index 6b16a8e6d..f42d4690c 100644 --- a/shetland/core/src/main/java/org/n52/shetland/ogc/ows/service/GetCapabilitiesResponse.java +++ b/shetland/core/src/main/java/org/n52/shetland/ogc/ows/service/GetCapabilitiesResponse.java @@ -28,7 +28,7 @@ */ public class GetCapabilitiesResponse extends OwsServiceResponse { private OwsCapabilities capabilities; - private String xmlString; + private String staticString; public GetCapabilitiesResponse() { super(null, null, OWSConstants.Operations.GetCapabilities.name()); @@ -65,15 +65,23 @@ public GetCapabilitiesResponse setCapabilities(OwsCapabilities capabilities) { } public String getXmlString() { - return xmlString; + return getStaticString(); } public GetCapabilitiesResponse setXmlString(String xmlString) { - this.xmlString = xmlString; + return setStaticString(xmlString); + } + + public String getStaticString() { + return staticString; + } + + public GetCapabilitiesResponse setStaticString(String staticString) { + this.staticString = staticString; return this; } public boolean isStatic() { - return getXmlString() != null && !getXmlString().isEmpty(); + return getStaticString() != null && !getStaticString().isEmpty(); } } diff --git a/svalbard/xmlbeans/src/main/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoder.java b/svalbard/xmlbeans/src/main/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoder.java index 8e54730b2..42933eed4 100644 --- a/svalbard/xmlbeans/src/main/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoder.java +++ b/svalbard/xmlbeans/src/main/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoder.java @@ -82,7 +82,7 @@ protected XmlObject create(GetCapabilitiesResponse response) throws EncodingExce createExtension(xbCaps, response.getExtensions()); } if (response.isStatic()) { - String xml = response.getXmlString(); + String xml = response.getStaticString(); LOGGER.trace("Response is static. XML-String:\n{}\n", xml); try { doc.set(XmlObject.Factory.parse(xml)); diff --git a/svalbard/xmlbeans/src/test/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoderTest.java b/svalbard/xmlbeans/src/test/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoderTest.java index b8fdda877..b10d577c3 100644 --- a/svalbard/xmlbeans/src/test/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoderTest.java +++ b/svalbard/xmlbeans/src/test/java/org/n52/svalbard/encode/GetCapabilitiesResponseEncoderTest.java @@ -54,7 +54,7 @@ public void setUp() { public void should_create_static_capabilities() throws Exception { XmlObject encodedResponse = encoder.encode(minimalCapabilities()); - Diff d = new Diff(encodedResponse.xmlText(), minimalCapabilities().getXmlString()); + Diff d = new Diff(encodedResponse.xmlText(), minimalCapabilities().getStaticString()); assertThat(d.identical(), is(true)); assertThat(d.similar(), is(true));