Skip to content

Commit

Permalink
Merge pull request #105 from nicolas-f/addtest
Browse files Browse the repository at this point in the history
add tutorial as unit test
  • Loading branch information
nicolas-f authored Jan 24, 2020
2 parents e5da34e + 7b0fb11 commit d4fce5a
Show file tree
Hide file tree
Showing 10 changed files with 586 additions and 454 deletions.
3 changes: 3 additions & 0 deletions wps_scripts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ dependencies {
exclude group: 'no.ecc.vectortile'
exclude group: 'javax.media'
exclude group: 'commons-beanutils'
exclude group: 'org.locationtech.jts'
}
compile 'org.postgresql:postgresql:9.4-1201-jdbc41'
compile 'org.codehaus.groovy:groovy-all:2.5.5'
compile group: 'org.ejml', name: 'all', version: '0.29'
compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.10.1'
compile group: 'org.orbisgis', name: 'h2gis', version: '1.5.0'
compile group: 'org.locationtech.jts', name: 'jts-core', version: '1.15.1'
compile group: 'org.locationtech.jts', name: 'jts-io', version: '1.15.1'
compile group: 'org.orbisgis', name: 'noisemodelling-emission', version: '3.0.1-SNAPSHOT'
compile group: 'org.orbisgis', name: 'noisemodelling-propagation', version: '3.0.1-SNAPSHOT'
//compile group: 'org.orbisgis', name: 'osm', version: '1.0.0-SNAPSHOT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def exec(Connection connection, input) {
columnIndex++
}
}
sb.append("</br>")
}
sb.append("</br>")
}

// print to Console windows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,52 +46,59 @@ def run(input) {

// Get name of the database
String dbName = ""
if (input['databaseName']){dbName = input['databaseName'] as String}
if (input['databaseName']) {
dbName = input['databaseName'] as String
}

// Open connection
openGeoserverDataStoreConnection(dbName).withCloseable { Connection connection ->
exec(connection, input)
}
}

def exec(connection, input) {

String exportPath = input["exportPath"] as String
String tableToExport = input["tableToExport"] as String
tableToExport = tableToExport.toUpperCase()

String ext = exportPath.substring(exportPath.lastIndexOf('.') + 1, exportPath.length())
String success = "Table " + tableToExport + " successfully exported !"

switch (ext) {
case "csv":
CSVDriverFunction csvDriver = new CSVDriverFunction()
csvDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "dbf":
DBFDriverFunction dbfDriver = new DBFDriverFunction()
dbfDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "geojson":
GeoJsonDriverFunction geoJsonDriver = new GeoJsonDriverFunction()
geoJsonDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "json":
JsonDriverFunction jsonDriver = new JsonDriverFunction()
jsonDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "kml":
KMLDriverFunction kmlDriver = new KMLDriverFunction()
kmlDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "shp":
SHPDriverFunction shpDriver = new SHPDriverFunction()
shpDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "tsv":
TSVDriverFunction tsvDriver = new TSVDriverFunction()
tsvDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
default:
success = "Error ! table not exported"
break
}

return [result: success]
String exportPath = input["exportPath"] as String
String tableToExport = input["tableToExport"] as String
tableToExport = tableToExport.toUpperCase()

String ext = exportPath.substring(exportPath.lastIndexOf('.') + 1, exportPath.length())
String success = "Table " + tableToExport + " successfully exported !"

switch (ext) {
case "csv":
CSVDriverFunction csvDriver = new CSVDriverFunction()
csvDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "dbf":
DBFDriverFunction dbfDriver = new DBFDriverFunction()
dbfDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "geojson":
GeoJsonDriverFunction geoJsonDriver = new GeoJsonDriverFunction()
geoJsonDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "json":
JsonDriverFunction jsonDriver = new JsonDriverFunction()
jsonDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "kml":
KMLDriverFunction kmlDriver = new KMLDriverFunction()
kmlDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "shp":
SHPDriverFunction shpDriver = new SHPDriverFunction()
shpDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
case "tsv":
TSVDriverFunction tsvDriver = new TSVDriverFunction()
tsvDriver.exportTable(connection, tableToExport, new File(exportPath), new EmptyProgressVisitor())
break
default:
success = "Error ! table not exported"
break
}

return [result: success]

}
Loading

0 comments on commit d4fce5a

Please sign in to comment.