Skip to content

Commit

Permalink
Added test for getSimpleProjectArea method, fixed config retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-brinkman committed Sep 25, 2024
1 parent e726a1b commit 02ebb01
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grails-app/services/au/org/ala/ecodata/SiteService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ class SiteService {
}

def getSimpleProjectArea(projectSiteId) {
def threshold = grailsApplication.config.getProperty('biocollect.projectArea.simplificationThreshold', 10000)
def tolerance = grailsApplication.config.getProperty('biocollect.projectArea.simplificationTolerance', 0.0001)
def threshold = grailsApplication.config.getProperty('biocollect.projectArea.simplificationThreshold', Integer, 10000)
def tolerance = grailsApplication.config.getProperty('biocollect.projectArea.simplificationTolerance', Double, 0.0001)
log.info("Threshhold ${threshold} Tolerance ${tolerance}")

def site = get(projectSiteId, [SiteService.FLAT, SiteService.INDEXING])
Expand Down
16 changes: 16 additions & 0 deletions src/test/groovy/au/org/ala/ecodata/SiteServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,22 @@ class SiteServiceSpec extends MongoSpec implements ServiceUnitTest<SiteService>
}
def "Site service returns simplified geometry for siteId"() {
when:
def coordinates = [[148.260498046875, -37.26530995561874], [148.260498046875, -37.26531995561874], [148.310693359375, -37.26531995561874], [148.310693359375, -37.26531995561874], [148.260498046875, -37.26530995561874]]
def extent = [
geometry: [
type : "Polygon",
coordinates: coordinates
]
]
def newSite = service.create([name:'Site 1', extent: extent])
then:
def site = service.getSimpleProjectArea(newSite.siteId)
site.geoIndex != null
}
private Map buildExtent(source, type, coordinates, pid = '') {
return [source:source, geometry:[type:type, coordinates: coordinates, pid:pid]]
}
Expand Down

0 comments on commit 02ebb01

Please sign in to comment.