Skip to content

Commit

Permalink
Attempt to fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdos committed Jul 27, 2020
1 parent d18f55f commit ad5ae86
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions grails-app/services/au/org/ala/regions/MetadataService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import grails.util.Metadata
import groovyx.net.http.URIBuilder
import org.apache.commons.lang.StringEscapeUtils
import org.apache.commons.httpclient.util.URIUtil
import org.grails.web.json.JSONObject

import javax.annotation.PostConstruct

Expand Down Expand Up @@ -592,16 +593,20 @@ class MetadataService {
}

@Cacheable(value = "metadata", key = { '"getStateEmblems"' })
def getStateEmblems() {
JSONObject getStateEmblems() {
def file = new File(CONFIG_DIR + "/state-emblems.json")
JSONObject emblemObj = new JSONObject()

if (!file.exists()) {
log.debug "Emblems not found in ext config, looking in grails-app/conf."
file = new File(this.class.classLoader.getResource('default/state-emblems.json').toURI())
}

if (file.exists()) {
JSON.parse(file.text)
} else {
[] // NdR this should be a Map not List! TODO test and fix
emblemObj = JSON.parse(file.text)
}

emblemObj
}

/**
Expand Down Expand Up @@ -778,8 +783,7 @@ class MetadataService {
if (file.exists()) {
JSON.parse(file.text)
} else {
file =
null
file = null
}
}
}

0 comments on commit ad5ae86

Please sign in to comment.