Skip to content

Commit

Permalink
fix: errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Nov 27, 2023
1 parent 856414d commit bce9a72
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@

import jeeves.server.ServiceConfig;
import jeeves.server.sources.http.JeevesServlet;
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;
import org.apache.log4j.bridge.AppenderWrapper;
import org.apache.logging.log4j.core.appender.FileAppender;
import org.apache.logging.log4j.core.appender.RollingFileAppender;
import org.fao.geonet.ApplicationContextHolder;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.utils.IO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,19 @@ protected static String escapeLikeLiteral(String text) {
protected static String convertLikePattern(PropertyIsLike filter) {
String result = filter.getLiteral();
if (!filter.getWildCard().equals("*")) {
final String wildcardRe = "(?<!" + Pattern.quote(filter.getEscape()) + ")" + Pattern.quote(filter.getWildCard());
final String wildcardRe =
StringUtils.isNotEmpty(filter.getEscape())
? Pattern.quote(filter.getEscape() + filter.getWildCard())
: filter.getWildCard();
result = result.replaceAll(wildcardRe, "*");
}
if (!filter.getSingleChar().equals("?")) {
final String singleCharRe = "(?<!" + Pattern.quote(filter.getEscape()) + ")" + Pattern.quote(filter.getSingleChar());
final String singleCharRe =
StringUtils.isNotEmpty(filter.getEscape())
? Pattern.quote(filter.getEscape() + filter.getSingleChar())
: filter.getSingleChar();
result = result.replaceAll(singleCharRe, "?");
}
if (!filter.getEscape().equals("\\")) {
final String escapeRe = Pattern.quote(filter.getEscape()) + "(.)";
result = result.replaceAll(escapeRe, "\\\\$1");
}
return result;
}

Expand Down Expand Up @@ -363,7 +365,7 @@ public Object visit(PropertyIsEqualTo filter, Object extraData) {
String dataPropertyValue = stack.pop();
String dataPropertyName = stack.pop();

final String filterEqualTo = String.format(templateMatch, dataPropertyName, dataPropertyValue.replaceAll("\\/", "\\\\\\\\/"));
final String filterEqualTo = String.format(templateMatch, dataPropertyName, dataPropertyValue);
stack.push(filterEqualTo);

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,25 @@ private void createCoverageForStore(String ws, String cs, String file,
+ "<type>text/xml</type>"
+ "<metadataType>ISO19115:2003</metadataType>"
+ "<content>"
+ this.nodeUrl + "api/records/" + metadataUuid + "/formatters/xml"
+ this.baseCatalogueUrl
+ "/csw?SERVICE=CSW&amp;VERSION=2.0.2&amp;REQUEST=GetRecordById"
+ "&amp;outputSchema=http://www.isotc211.org/2005/gmd"
+ "&amp;ID=" + metadataUuid
+ "</content>"
+ "</metadataLink>"
+ "<metadataLink>"
+ "<type>text/html</type>"
+ "<metadataType>ISO19115:2003</metadataType>"
+ "<metadataType>TC211</metadataType>"
+ "<content>"
+ this.baseCatalogueUrl
+ "/csw?SERVICE=CSW&amp;VERSION=2.0.2&amp;REQUEST=GetRecordById"
+ "&amp;outputSchema=http://www.isotc211.org/2005/gmd"
+ "&amp;ID=" + metadataUuid
+ "</content>"
+ "</metadataLink>"
+ "<metadataLink>"
+ "<type>text/html</type>"
+ "<metadataType>TC211</metadataType>"
+ "<content>"
+ this.nodeUrl + "api/records/" + metadataUuid
+ "</content>"
Expand Down Expand Up @@ -572,12 +585,25 @@ public boolean createFeatureType(String ws, String ds, String ft,
+ "<type>text/xml</type>"
+ "<metadataType>ISO19115:2003</metadataType>"
+ "<content>"
+ this.nodeUrl + "api/records/" + metadataUuid + "/formatters/xml"
+ this.baseCatalogueUrl
+ "/csw?SERVICE=CSW&amp;VERSION=2.0.2&amp;REQUEST=GetRecordById"
+ "&amp;outputSchema=http://www.isotc211.org/2005/gmd"
+ "&amp;ID=" + metadataUuid
+ "</content>"
+ "</metadataLink>"
+ "<metadataLink>"
+ "<type>text/xml</type>"
+ "<metadataType>TC211</metadataType>"
+ "<content>"
+ this.baseCatalogueUrl
+ "/csw?SERVICE=CSW&amp;VERSION=2.0.2&amp;REQUEST=GetRecordById"
+ "&amp;outputSchema=http://www.isotc211.org/2005/gmd"
+ "&amp;ID=" + metadataUuid
+ "</content>"
+ "</metadataLink>"
+ "<metadataLink>"
+ "<type>text/html</type>"
+ "<metadataType>ISO19115:2003</metadataType>"
+ "<metadataType>TC211</metadataType>"
+ "<content>"
+ this.nodeUrl + "api/records/" + metadataUuid
+ "</content>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public JSONObject getLayersFromSelectedMetadatas(

// case #1 : #id parameter is undefined
if (paramId == null) {
synchronized (sm.getSelection("s101")) {
for (Iterator<String> iter = sm.getSelection("s101").iterator(); iter.hasNext(); ) {
synchronized (sm.getSelection("metadata")) {
for (Iterator<String> iter = sm.getSelection("metadata").iterator(); iter.hasNext(); ) {
String uuid = iter.next();
String id = dm.getMetadataId(uuid);
lst.add(id);
Expand Down

0 comments on commit bce9a72

Please sign in to comment.