-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.49..v0.2.50 changeset ImportCommandTest.java
Garret Voltz edited this page Nov 6, 2019
·
1 revision
diff --git a/hoot-services/src/test/java/hoot/services/controllers/ingest/ImportCommandTest.java b/hoot-services/src/test/java/hoot/services/controllers/ingest/ImportCommandTest.java
index 2fc0ab7..2d8bc0a 100644
--- a/hoot-services/src/test/java/hoot/services/controllers/ingest/ImportCommandTest.java
+++ b/hoot-services/src/test/java/hoot/services/controllers/ingest/ImportCommandTest.java
@@ -30,9 +30,13 @@ package hoot.services.controllers.ingest;
import static hoot.services.HootProperties.HOME_FOLDER;
import static hoot.services.HootProperties.HOOTAPI_DB_URL;
import static hoot.services.HootProperties.TEMP_OUTPUT_PATH;
-import static hoot.services.controllers.ingest.UploadClassification.*;
+import static hoot.services.controllers.ingest.UploadClassification.FGDB;
+import static hoot.services.controllers.ingest.UploadClassification.OSM;
+import static hoot.services.controllers.ingest.UploadClassification.SHP;
+import static hoot.services.controllers.ingest.UploadClassification.ZIP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -56,17 +60,20 @@ public class ImportCommandTest {
List<File> zips = null;
String translation = "translations/TDSv40.js";
+ String advUploadOpts = "Ogr2osmSimplifyComplexBuildings";
+ String multiAdvOpts = "Ogr2osmSimplifyComplexBuildings,Ogr2osmMergeNearbyNodes";
String etlName = "ogrImport";
Boolean isNoneTranslation = false;
List<String> options = new LinkedList<>();
//options.add("osm2ogr.ops=hoot::DecomposeBuildingRelationsVisitor");
options.add("hootapi.db.writer.overwrite.map=true");
+ options.add("ogr2osm.simplify.complex.buildings=true");
options.add("hootapi.db.writer.create.user=true");
options.add("[email protected]");
options.add("schema.translation.script=" + translation);
- ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, SHP, caller, null);
String hootConvertCommand = "hoot convert --${DEBUG_LEVEL} ${HOOT_OPTIONS} ${INPUTS} ${INPUT_NAME}";
@@ -76,6 +83,7 @@ public class ImportCommandTest {
assertNotNull(importCommand.getSubstitutionMap());
assertNotNull(importCommand.getWorkDir());
assertNotNull(importCommand.getCommand());
+ assertNotSame(advUploadOpts, multiAdvOpts);
assertEquals(hootConvertCommand, importCommand.getCommand());
assertEquals(1, ((List)importCommand.getSubstitutionMap().get("INPUTS")).size());
@@ -83,11 +91,12 @@ public class ImportCommandTest {
assertEquals(HOOTAPI_DB_URL + "/" + etlName, importCommand.getSubstitutionMap().get("INPUT_NAME"));
isNoneTranslation = true;
- importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, SHP, caller, null);
assertEquals(jobId, importCommand.getJobId());
assertEquals(true, importCommand.getTrackable());
+
assertNotNull(importCommand.getSubstitutionMap());
assertNotNull(importCommand.getWorkDir());
assertNotNull(importCommand.getCommand());
@@ -108,17 +117,18 @@ public class ImportCommandTest {
List<File> zips = null;
String translation = "translations/TDSv40.js";
+ String advUploadOpts = "Ogr2osmSimplifyComplexBuildings";
String etlName = "ogrImport";
Boolean isNoneTranslation = false;
List<String> options = new LinkedList<>();
- options.add("osm2ogr.ops=hoot::DecomposeBuildingRelationsVisitor");
+ //options.add("osm2ogr.ops=hoot::DecomposeBuildingRelationsVisitor");
options.add("hootapi.db.writer.overwrite.map=true");
options.add("hootapi.db.writer.create.user=true");
options.add("[email protected]");
options.add("schema.translation.script=" + translation);
- ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, FGDB, caller, null);
String hootConvertCommand = "hoot convert --${DEBUG_LEVEL} ${HOOT_OPTIONS} ${INPUTS} ${INPUT_NAME}";
@@ -135,7 +145,7 @@ public class ImportCommandTest {
assertEquals(HOOTAPI_DB_URL + "/" + etlName, importCommand.getSubstitutionMap().get("INPUT_NAME"));
isNoneTranslation = true;
- importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, SHP, caller, null);
assertEquals(jobId, importCommand.getJobId());
@@ -161,16 +171,18 @@ public class ImportCommandTest {
zips.add(new File("file.zip"));
String translation = "translations/TDSv40.js";
+ String advUploadOpts = "SimplifyComplexBuildings";
String etlName = "ogrImport";
Boolean isNoneTranslation = false;
List<String> options = new LinkedList<>();
- options.add("osm2ogr.ops=hoot::DecomposeBuildingRelationsVisitor");
- options.add("hootapi.db.writer.overwrite.map=true");
+ //options.add("osm2ogr.ops=hoot::DecomposeBuildingRelationsVisitor");
+ options.add("hootapi.db.writer.overwrite.map=true");options.add("ogr2osm.simplify.complex.buildings=true");
+
options.add("hootapi.db.writer.create.user=true");
options.add("[email protected]");
- ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, ZIP, caller, null);
String hootConvertCommand = "hoot convert --${DEBUG_LEVEL} ${HOOT_OPTIONS} ${INPUTS} ${INPUT_NAME}";
@@ -191,7 +203,7 @@ public class ImportCommandTest {
assertTrue(importCommand.getSubstitutionMap().get("TRANSLATION_PATH").toString().endsWith(translation));
isNoneTranslation = true;
- importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, ZIP, caller, null);
assertEquals(jobId, importCommand.getJobId());
@@ -219,6 +231,7 @@ public class ImportCommandTest {
List<File> zips = null;
String translation = "translations/TDSv40.js";
+ String advUploadOpts = "SimplifyComplexBuildings";
String etlName = "ogrImport";
Boolean isNoneTranslation = false;
@@ -232,7 +245,7 @@ public class ImportCommandTest {
String hootConvertCommand = "hoot convert --${DEBUG_LEVEL} ${HOOT_OPTIONS} ${INPUTS} ${INPUT_NAME}";
- ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, OSM, caller, null);
assertEquals(hootConvertCommand, importCommand.getCommand());
@@ -264,6 +277,7 @@ public class ImportCommandTest {
List<File> zips = null;
String translation = "translations/TDSv40.js";
+ String advUploadOpts = "SimplifyComplexBuildings";
String etlName = "ogrImport";
Boolean isNoneTranslation = false;
@@ -277,7 +291,7 @@ public class ImportCommandTest {
String hootConvertCommand = "hoot convert --${DEBUG_LEVEL} ${HOOT_OPTIONS} ${INPUTS} ${INPUT_NAME}";
- ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation,
+ ImportCommand importCommand = new ImportCommand(jobId, workDir, filesToImport, zips, translation, advUploadOpts,
etlName, isNoneTranslation, debugLevel, OSM, caller, null);
assertEquals(hootConvertCommand, importCommand.getCommand());