Skip to content

Commit

Permalink
add staticstring to replace xmlstring for reusing in capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenHollmann committed Sep 6, 2022
1 parent 80489bb commit 193bc14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 193bc14

Please sign in to comment.