diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 69765ea1..d2fcbee3 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -16,12 +16,12 @@ jobs: call-workflow: strategy: matrix: - josm-revision: ["", "r18877"] - uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v2 + josm-revision: ["", "r19067"] + uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v3 with: java-version: 17 josm-revision: ${{ matrix.josm-revision }} plugin-jar-name: 'mapwithai' - perform-revision-tagging: ${{ matrix.josm-revision == 'r18877' && github.repository == 'JOSM/MapWithAI' && github.ref_type == 'branch' && github.ref_name == 'master' && github.event_name != 'schedule' && github.event_name != 'pull_request' }} + perform-revision-tagging: ${{ matrix.josm-revision == 'r19067' && github.repository == 'JOSM/MapWithAI' && github.ref_type == 'branch' && github.ref_name == 'master' && github.event_name != 'schedule' && github.event_name != 'pull_request' }} secrets: inherit diff --git a/.github/workflows/reports.yaml b/.github/workflows/reports.yaml index 43794f4f..007304f0 100644 --- a/.github/workflows/reports.yaml +++ b/.github/workflows/reports.yaml @@ -10,4 +10,4 @@ permissions: jobs: call-workflow: - uses: JOSM/JOSMPluginAction/.github/workflows/reports.yaml@v2 + uses: JOSM/JOSMPluginAction/.github/workflows/reports.yaml@v3 diff --git a/gradle.properties b/gradle.properties index 28d74150..5c5f4494 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ # The minimum JOSM version this plugin is compatible with (can be any numeric version -plugin.main.version = 18877 +plugin.main.version = 19067 # The JOSM version this plugin is currently compiled against # Please make sure this version is available at https://josm.openstreetmap.de/download # The special values "latest" and "tested" are also possible here, but not recommended. -plugin.compile.version = 18877 +plugin.compile.version = 19067 plugin.canloadatruntime = true plugin.author = Taylor Smock plugin.class = org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..a836507a --- /dev/null +++ b/pom.xml @@ -0,0 +1,193 @@ + + 4.0.0 + org.openstreetmap.josm.plugins + MapWithAI + SNAPSHOT + + 1.49.a + 7.5.0 + 0.8.12 + 10.18.1 + 4.8.6 + + + + JOSM-releases + https://josm.openstreetmap.de/nexus/content/repositories/releases/ + + + JOSM-snapshots + https://josm.openstreetmap.de/nexus/content/repositories/snapshots/ + + + + + + org.junit + junit-bom + 5.11.1 + pom + import + + + + + + org.openstreetmap.josm + josm + SNAPSHOT + provided + + + org.openstreetmap.josm.plugins + pmtiles + SNAPSHOT + provided + + + org.openstreetmap.josm.plugins + utilsplugin2 + SNAPSHOT + provided + + + org.openstreetmap.josm + josm-unittest + SNAPSHOT + test + + + org.wiremock + wiremock + 3.9.1 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + junit + junit + 4.13.2 + test + + + org.awaitility + awaitility + 4.2.2 + test + + + nl.jqno.equalsverifier + equalsverifier + 3.17 + test + + + org.jmockit + jmockit + 1.49.a + test + + + jakarta.json + jakarta.json-api + 2.1.3 + provided + + + + src/test/unit + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 17 + + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + 4.21 + ${project.basedir}/../00_core_tools/eclipse/formatter.xml + + + + // License: GPL. For details, see LICENSE file. + + + src/main/java/**/*.java + src/test/unit/**/*.java + src/test/integration/**/*.java + + + + + + + check + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-maven + + enforce + + + + + + + 3.6.3 + + + + + + + maven-surefire-plugin + 3.2.5 + + 1 + -javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar + + + file.encoding = UTF-8 + java.locale.providers = SPI,CLDR + junit.jupiter.extensions.autodetection.enabled = true + junit.jupiter.execution.parallel.enabled = true + + + + src/test/build/config/josm.home + src/test/resources + true + Monocle + Headless + sw + + + + + + diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java index b5d9bd7c..85a54344 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java @@ -359,8 +359,6 @@ private void updateEsriLayers(@Nonnull final Collection layers) { Logging.error(e); } } - } else { - esriInfo.add(layer); } } layers.addAll(esriInfo); diff --git a/src/test/data b/src/test/data new file mode 120000 index 00000000..fc478085 --- /dev/null +++ b/src/test/data @@ -0,0 +1 @@ +resources \ No newline at end of file diff --git a/src/test/resources/wiremock/__files/MapWithAIStyle.zip b/src/test/resources/__files/MapWithAIStyle.zip similarity index 100% rename from src/test/resources/wiremock/__files/MapWithAIStyle.zip rename to src/test/resources/__files/MapWithAIStyle.zip diff --git a/src/test/resources/wiremock/__files/josmfile?page=Styles/MapWithAI&zip=1 b/src/test/resources/__files/josmfile?page=Styles/MapWithAI&zip=1 similarity index 100% rename from src/test/resources/wiremock/__files/josmfile?page=Styles/MapWithAI&zip=1 rename to src/test/resources/__files/josmfile?page=Styles/MapWithAI&zip=1 diff --git a/src/test/resources/wiremock/mappings/06_nodes-5f086efd-b8fa-4340-b368-cd4fa7626e0b.json b/src/test/resources/mappings/06_nodes-5f086efd-b8fa-4340-b368-cd4fa7626e0b.json similarity index 100% rename from src/test/resources/wiremock/mappings/06_nodes-5f086efd-b8fa-4340-b368-cd4fa7626e0b.json rename to src/test/resources/mappings/06_nodes-5f086efd-b8fa-4340-b368-cd4fa7626e0b.json diff --git a/src/test/resources/wiremock/mappings/06_nodes-7938c30e-bd58-4c8c-a716-49e434123ccb.json b/src/test/resources/mappings/06_nodes-7938c30e-bd58-4c8c-a716-49e434123ccb.json similarity index 100% rename from src/test/resources/wiremock/mappings/06_nodes-7938c30e-bd58-4c8c-a716-49e434123ccb.json rename to src/test/resources/mappings/06_nodes-7938c30e-bd58-4c8c-a716-49e434123ccb.json diff --git a/src/test/resources/wiremock/mappings/06_nodes-98af8a28-e882-4d58-a828-f149ef8b3913.json b/src/test/resources/mappings/06_nodes-98af8a28-e882-4d58-a828-f149ef8b3913.json similarity index 100% rename from src/test/resources/wiremock/mappings/06_nodes-98af8a28-e882-4d58-a828-f149ef8b3913.json rename to src/test/resources/mappings/06_nodes-98af8a28-e882-4d58-a828-f149ef8b3913.json diff --git a/src/test/resources/wiremock/mappings/06_nodes-aa8912c8-d2fc-4c2d-bf5e-f0192dad2bb4.json b/src/test/resources/mappings/06_nodes-aa8912c8-d2fc-4c2d-bf5e-f0192dad2bb4.json similarity index 100% rename from src/test/resources/wiremock/mappings/06_nodes-aa8912c8-d2fc-4c2d-bf5e-f0192dad2bb4.json rename to src/test/resources/mappings/06_nodes-aa8912c8-d2fc-4c2d-bf5e-f0192dad2bb4.json diff --git a/src/test/resources/wiremock/mappings/capabilities-cf884424-9817-4f92-a3af-6b5aa2bc4b0e.json b/src/test/resources/mappings/capabilities-cf884424-9817-4f92-a3af-6b5aa2bc4b0e.json similarity index 100% rename from src/test/resources/wiremock/mappings/capabilities-cf884424-9817-4f92-a3af-6b5aa2bc4b0e.json rename to src/test/resources/mappings/capabilities-cf884424-9817-4f92-a3af-6b5aa2bc4b0e.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_abilene_tx_buildings_featureserver-cf2fc003-e869-4bff-9c52-16e73cf89b9d.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_abilene_tx_buildings_featureserver-cf2fc003-e869-4bff-9c52-16e73cf89b9d.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_abilene_tx_buildings_featureserver-cf2fc003-e869-4bff-9c52-16e73cf89b9d.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_abilene_tx_buildings_featureserver-cf2fc003-e869-4bff-9c52-16e73cf89b9d.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver-ffce8d3a-c21a-410b-9303-2b59875b76aa.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver-ffce8d3a-c21a-410b-9303-2b59875b76aa.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver-ffce8d3a-c21a-410b-9303-2b59875b76aa.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver-ffce8d3a-c21a-410b-9303-2b59875b76aa.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver_0-ee34e070-0bf4-4a36-bfe5-4833a8f25ae5.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver_0-ee34e070-0bf4-4a36-bfe5-4833a8f25ae5.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver_0-ee34e070-0bf4-4a36-bfe5-4833a8f25ae5.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_alexandria_va_addresses_featureserver_0-ee34e070-0bf4-4a36-bfe5-4833a8f25ae5.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_baton_rouge_la_buildings_featureserver-dd6fd63f-5bf7-44e1-96cb-3accb0d9e652.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_baton_rouge_la_buildings_featureserver-dd6fd63f-5bf7-44e1-96cb-3accb0d9e652.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_baton_rouge_la_buildings_featureserver-dd6fd63f-5bf7-44e1-96cb-3accb0d9e652.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_baton_rouge_la_buildings_featureserver-dd6fd63f-5bf7-44e1-96cb-3accb0d9e652.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_boston_ma_addresses_featureserver-1878a845-e581-4519-9568-57e3c4ca5681.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_boston_ma_addresses_featureserver-1878a845-e581-4519-9568-57e3c4ca5681.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_boston_ma_addresses_featureserver-1878a845-e581-4519-9568-57e3c4ca5681.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_boston_ma_addresses_featureserver-1878a845-e581-4519-9568-57e3c4ca5681.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver-f5b30af0-0177-459b-ac7a-b4fc0be7d99a.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver-f5b30af0-0177-459b-ac7a-b4fc0be7d99a.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver-f5b30af0-0177-459b-ac7a-b4fc0be7d99a.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver-f5b30af0-0177-459b-ac7a-b4fc0be7d99a.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver_0-d0e9831e-6eff-4f7e-83ee-f09bad38c40d.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver_0-d0e9831e-6eff-4f7e-83ee-f09bad38c40d.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver_0-d0e9831e-6eff-4f7e-83ee-f09bad38c40d.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_flagstaff_az_addresses_featureserver_0-d0e9831e-6eff-4f7e-83ee-f09bad38c40d.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_fort_collins_co_buildings_featureserver-5b042812-8b74-43cc-8f3c-5455209e6174.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_fort_collins_co_buildings_featureserver-5b042812-8b74-43cc-8f3c-5455209e6174.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_fort_collins_co_buildings_featureserver-5b042812-8b74-43cc-8f3c-5455209e6174.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_fort_collins_co_buildings_featureserver-5b042812-8b74-43cc-8f3c-5455209e6174.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklin_county_oh_buildings_featureserver-9f5608b0-7f9b-4744-9bfa-aca77b68a338.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklin_county_oh_buildings_featureserver-9f5608b0-7f9b-4744-9bfa-aca77b68a338.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklin_county_oh_buildings_featureserver-9f5608b0-7f9b-4744-9bfa-aca77b68a338.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklin_county_oh_buildings_featureserver-9f5608b0-7f9b-4744-9bfa-aca77b68a338.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver-4a594e6d-4b81-42ad-b547-39005f2a5f62.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver-4a594e6d-4b81-42ad-b547-39005f2a5f62.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver-4a594e6d-4b81-42ad-b547-39005f2a5f62.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver-4a594e6d-4b81-42ad-b547-39005f2a5f62.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver_0-8cd10b04-891d-4d27-9282-82e7349f5bd3.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver_0-8cd10b04-891d-4d27-9282-82e7349f5bd3.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver_0-8cd10b04-891d-4d27-9282-82e7349f5bd3.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_franklincounty_buildings_featureserver_0-8cd10b04-891d-4d27-9282-82e7349f5bd3.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_indianapolis_in_buildings_featureserver-0839729e-481d-474b-b6c4-186632418ff8.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_indianapolis_in_buildings_featureserver-0839729e-481d-474b-b6c4-186632418ff8.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_indianapolis_in_buildings_featureserver-0839729e-481d-474b-b6c4-186632418ff8.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_indianapolis_in_buildings_featureserver-0839729e-481d-474b-b6c4-186632418ff8.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_addresses_featureserver-1af1902a-7f3e-406c-baae-c87beb5f51b2.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_addresses_featureserver-1af1902a-7f3e-406c-baae-c87beb5f51b2.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_addresses_featureserver-1af1902a-7f3e-406c-baae-c87beb5f51b2.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_addresses_featureserver-1af1902a-7f3e-406c-baae-c87beb5f51b2.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_buildings_featureserver-1f76a677-dad5-47c2-86f9-a6215bd47f09.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_buildings_featureserver-1f76a677-dad5-47c2-86f9-a6215bd47f09.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_buildings_featureserver-1f76a677-dad5-47c2-86f9-a6215bd47f09.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_johns_creek_ga_buildings_featureserver-1f76a677-dad5-47c2-86f9-a6215bd47f09.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_madison_county_ky_addresses_featureserver-66ef9aca-060f-4595-ba9d-426efca7992a.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_madison_county_ky_addresses_featureserver-66ef9aca-060f-4595-ba9d-426efca7992a.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_madison_county_ky_addresses_featureserver-66ef9aca-060f-4595-ba9d-426efca7992a.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_madison_county_ky_addresses_featureserver-66ef9aca-060f-4595-ba9d-426efca7992a.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver-757edf0f-0dc4-4b42-869e-1bc2cf3ecf31.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver-757edf0f-0dc4-4b42-869e-1bc2cf3ecf31.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver-757edf0f-0dc4-4b42-869e-1bc2cf3ecf31.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver-757edf0f-0dc4-4b42-869e-1bc2cf3ecf31.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver_0-e759c7d0-92ff-4db5-9bd8-25c500797126.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver_0-e759c7d0-92ff-4db5-9bd8-25c500797126.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver_0-e759c7d0-92ff-4db5-9bd8-25c500797126.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_featureserver_0-e759c7d0-92ff-4db5-9bd8-25c500797126.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_v2_featureserver-e0115f5a-2f2f-4c3c-bd23-97d8b183e7f7.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_v2_featureserver-e0115f5a-2f2f-4c3c-bd23-97d8b183e7f7.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_v2_featureserver-e0115f5a-2f2f-4c3c-bd23-97d8b183e7f7.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_orange_county_ca_buildings_v2_featureserver-e0115f5a-2f2f-4c3c-bd23-97d8b183e7f7.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_pottawattamie_county_ia_buildings_featureserver-146e68bf-e36f-4d1a-9670-5cdbe2c3f636.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_pottawattamie_county_ia_buildings_featureserver-146e68bf-e36f-4d1a-9670-5cdbe2c3f636.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_pottawattamie_county_ia_buildings_featureserver-146e68bf-e36f-4d1a-9670-5cdbe2c3f636.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_pottawattamie_county_ia_buildings_featureserver-146e68bf-e36f-4d1a-9670-5cdbe2c3f636.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_richland_county_nd_addresses_featureserver-6b8d2ee4-b32f-4e81-80d1-bdf6bf8bba3f.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_richland_county_nd_addresses_featureserver-6b8d2ee4-b32f-4e81-80d1-bdf6bf8bba3f.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_richland_county_nd_addresses_featureserver-6b8d2ee4-b32f-4e81-80d1-bdf6bf8bba3f.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_richland_county_nd_addresses_featureserver-6b8d2ee4-b32f-4e81-80d1-bdf6bf8bba3f.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver-1b8f292c-d3b0-4281-ad07-680b02579e6b.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver-1b8f292c-d3b0-4281-ad07-680b02579e6b.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver-1b8f292c-d3b0-4281-ad07-680b02579e6b.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver-1b8f292c-d3b0-4281-ad07-680b02579e6b.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver_0-9bba8228-60ea-4b25-b140-ea7b4aeb79ab.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver_0-9bba8228-60ea-4b25-b140-ea7b4aeb79ab.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver_0-9bba8228-60ea-4b25-b140-ea7b4aeb79ab.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_featureserver_0-9bba8228-60ea-4b25-b140-ea7b4aeb79ab.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_v2_featureserver-646c0289-b022-4f04-a4e2-b402a256f18d.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_v2_featureserver-646c0289-b022-4f04-a4e2-b402a256f18d.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_v2_featureserver-646c0289-b022-4f04-a4e2-b402a256f18d.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_riverside_ca_buildings_v2_featureserver-646c0289-b022-4f04-a4e2-b402a256f18d.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sandiego_county_ca_addresses_featureserver-35444ef3-ef5b-4ba3-b2e6-8eaa2b18bb4c.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sandiego_county_ca_addresses_featureserver-35444ef3-ef5b-4ba3-b2e6-8eaa2b18bb4c.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sandiego_county_ca_addresses_featureserver-35444ef3-ef5b-4ba3-b2e6-8eaa2b18bb4c.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sandiego_county_ca_addresses_featureserver-35444ef3-ef5b-4ba3-b2e6-8eaa2b18bb4c.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sangis_buildings_featureserver-7100a55a-11f9-4a63-ab7e-27e463171e03.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sangis_buildings_featureserver-7100a55a-11f9-4a63-ab7e-27e463171e03.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sangis_buildings_featureserver-7100a55a-11f9-4a63-ab7e-27e463171e03.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sangis_buildings_featureserver-7100a55a-11f9-4a63-ab7e-27e463171e03.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver-7950efe2-fcb1-4457-9b3a-fd281eb49684.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver-7950efe2-fcb1-4457-9b3a-fd281eb49684.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver-7950efe2-fcb1-4457-9b3a-fd281eb49684.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver-7950efe2-fcb1-4457-9b3a-fd281eb49684.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver_1-89bb3fed-c485-401c-a9b9-9c5b367f81a0.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver_1-89bb3fed-c485-401c-a9b9-9c5b367f81a0.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver_1-89bb3fed-c485-401c-a9b9-9c5b367f81a0.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_addresses_featureserver_1-89bb3fed-c485-401c-a9b9-9c5b367f81a0.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver-1ab90e03-6781-4f0b-97c0-9e66b728c81c.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver-1ab90e03-6781-4f0b-97c0-9e66b728c81c.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver-1ab90e03-6781-4f0b-97c0-9e66b728c81c.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver-1ab90e03-6781-4f0b-97c0-9e66b728c81c.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver_1-1edea050-3368-40f5-80ae-099dba138e0d.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver_1-1edea050-3368-40f5-80ae-099dba138e0d.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver_1-1edea050-3368-40f5-80ae-099dba138e0d.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sarpy_county_ne_buildings_featureserver_1-1edea050-3368-40f5-80ae-099dba138e0d.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_addresses_featureserver-c933f432-3e62-4fec-be6e-4f95894bd3b9.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_addresses_featureserver-c933f432-3e62-4fec-be6e-4f95894bd3b9.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_addresses_featureserver-c933f432-3e62-4fec-be6e-4f95894bd3b9.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_addresses_featureserver-c933f432-3e62-4fec-be6e-4f95894bd3b9.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_buildings_featureserver-3f1883b1-14dc-402f-bbbe-8d5f346ffcd6.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_buildings_featureserver-3f1883b1-14dc-402f-bbbe-8d5f346ffcd6.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_buildings_featureserver-3f1883b1-14dc-402f-bbbe-8d5f346ffcd6.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_sioux_falls_sd_buildings_featureserver-3f1883b1-14dc-402f-bbbe-8d5f346ffcd6.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_tacoma_wa_buildings_featureserver-d08e2666-3342-4c02-8f80-279e5910a37d.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_tacoma_wa_buildings_featureserver-d08e2666-3342-4c02-8f80-279e5910a37d.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_tacoma_wa_buildings_featureserver-d08e2666-3342-4c02-8f80-279e5910a37d.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_tacoma_wa_buildings_featureserver-d08e2666-3342-4c02-8f80-279e5910a37d.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_tampa_fl_buildings_featureserver-204ccfc2-0167-4cd7-a8df-3f281d10d5d0.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_tampa_fl_buildings_featureserver-204ccfc2-0167-4cd7-a8df-3f281d10d5d0.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_tampa_fl_buildings_featureserver-204ccfc2-0167-4cd7-a8df-3f281d10d5d0.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_tampa_fl_buildings_featureserver-204ccfc2-0167-4cd7-a8df-3f281d10d5d0.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver-66d2a4b2-09ce-46d3-b9c9-a0c7489fefab.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver-66d2a4b2-09ce-46d3-b9c9-a0c7489fefab.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver-66d2a4b2-09ce-46d3-b9c9-a0c7489fefab.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver-66d2a4b2-09ce-46d3-b9c9-a0c7489fefab.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver_0-d64a22d3-e6e0-4dc6-ae5c-f9a2ba8f8485.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver_0-d64a22d3-e6e0-4dc6-ae5c-f9a2ba8f8485.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver_0-d64a22d3-e6e0-4dc6-ae5c-f9a2ba8f8485.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_wb_zanzibar_buildings_featureserver_0-d64a22d3-e6e0-4dc6-ae5c-f9a2ba8f8485.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_williamson_county_tx_buildings_featureserver-6db57544-0cfa-4b2f-8cd3-5845cac15108.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_williamson_county_tx_buildings_featureserver-6db57544-0cfa-4b2f-8cd3-5845cac15108.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_williamson_county_tx_buildings_featureserver-6db57544-0cfa-4b2f-8cd3-5845cac15108.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_williamson_county_tx_buildings_featureserver-6db57544-0cfa-4b2f-8cd3-5845cac15108.json diff --git a/src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_yavapai_county_az_buildings_featureserver-037b364c-e9e2-4478-8bd9-8bd9a3b3c9aa.json b/src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_yavapai_county_az_buildings_featureserver-037b364c-e9e2-4478-8bd9-8bd9a3b3c9aa.json similarity index 100% rename from src/test/resources/wiremock/mappings/do88dok2xjtucxd1_arcgis_rest_services_yavapai_county_az_buildings_featureserver-037b364c-e9e2-4478-8bd9-8bd9a3b3c9aa.json rename to src/test/resources/mappings/do88dok2xjtucxd1_arcgis_rest_services_yavapai_county_az_buildings_featureserver-037b364c-e9e2-4478-8bd9-8bd9a3b3c9aa.json diff --git a/src/test/resources/wiremock/mappings/faviconico-0a890cfc-c50c-44be-973b-acf92836e513.json b/src/test/resources/mappings/faviconico-0a890cfc-c50c-44be-973b-acf92836e513.json similarity index 100% rename from src/test/resources/wiremock/mappings/faviconico-0a890cfc-c50c-44be-973b-acf92836e513.json rename to src/test/resources/mappings/faviconico-0a890cfc-c50c-44be-973b-acf92836e513.json diff --git a/src/test/resources/wiremock/mappings/faviconico-b9f04630-0820-4f01-a541-b9d4226b8f84.json b/src/test/resources/mappings/faviconico-b9f04630-0820-4f01-a541-b9d4226b8f84.json similarity index 100% rename from src/test/resources/wiremock/mappings/faviconico-b9f04630-0820-4f01-a541-b9d4226b8f84.json rename to src/test/resources/mappings/faviconico-b9f04630-0820-4f01-a541-b9d4226b8f84.json diff --git a/src/test/resources/wiremock/mappings/faviconico-ca7c6f18-2915-4be6-b28a-1729a6217b54.json b/src/test/resources/mappings/faviconico-ca7c6f18-2915-4be6-b28a-1729a6217b54.json similarity index 100% rename from src/test/resources/wiremock/mappings/faviconico-ca7c6f18-2915-4be6-b28a-1729a6217b54.json rename to src/test/resources/mappings/faviconico-ca7c6f18-2915-4be6-b28a-1729a6217b54.json diff --git a/src/test/resources/wiremock/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json b/src/test/resources/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json similarity index 55% rename from src/test/resources/wiremock/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json rename to src/test/resources/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json index 45928773..e92643a8 100644 --- a/src/test/resources/wiremock/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json +++ b/src/test/resources/mappings/josm_mapwithai_json_conflation_serversjson-fb2197f1-81fd-445d-bb90-b6219d187af6.json @@ -7,7 +7,20 @@ }, "response" : { "status" : 200, - "body" : "{\n \"Taylor's Address Conflation Server\" : {\n \"categories\" : [\n \"addresses\"\n ],\n \"description\" : \"Originally developed for use with local datasets, it now accepts external datasets for conflation purposes. In the event of a failure, the plugin will use the original dataset.\",\n \"license\" : \"AGPL\",\n \"source\" : \"https://gitlab.com/smocktaylor/serve_osm_files/\",\n \"url\" : \"https://importdata.riverviewtechnologies.com/conflate\"\n }\n}\n", + "jsonBody": { + "Taylor's Address Conflation Server": { + "categories": [ + "addresses" + ], + "description": "Originally developed for use with local datasets, it now accepts external datasets for conflation purposes. In the event of a failure, the plugin will use the original dataset.", + "license": "AGPL", + "source": "{{ request.baseUrl }}/smocktaylor/serve_osm_files/", + "url": "{{ request.baseUrl }}/conflate" + } + }, + "transformers": [ + "response-template" + ], "headers" : { "Accept-Ranges" : "bytes", "Cache-Control" : "max-age=600", diff --git a/src/test/resources/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json b/src/test/resources/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json new file mode 100644 index 00000000..87915c09 --- /dev/null +++ b/src/test/resources/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json @@ -0,0 +1,641 @@ +{ + "id" : "23497750-675c-440a-986a-34dd14b047f8", + "name" : "josm_mapwithai_json_sourcesjson", + "request" : { + "urlPattern" : "\/MapWithAI\/?json\/sources.json", + "method" : "GET" + }, + "response" : { + "status" : 200, + "jsonBody": { + "Statewide Aggregate Addresses in Colorado 2019 (Public)": { + "countries": { + "US-CO": [ + "addr:housenumber" + ] + }, + "license": "Public Domain", + "osm_compatible": "yes", + "parameters": [], + "permission_url": "{{ request.baseUrl }}/wiki/Import/Colorado_Addresses", + "url": "{{ request.baseUrl }}/coloradoAddresses/map?bbox={bbox}" + }, + "MapWithAI": { + "countries": { + "AE": [ + "highway" + ], + "AF": [ + "highway" + ], + "AG": [ + "highway" + ], + "AI": [ + "highway" + ], + "AL": [ + "highway" + ], + "AM": [ + "highway" + ], + "AO": [ + "highway" + ], + "AR": [ + "highway" + ], + "AT": [ + "highway" + ], + "AU": [ + "highway" + ], + "AZ": [ + "highway" + ], + "BA": [ + "highway" + ], + "BB": [ + "highway" + ], + "BD": [ + "highway" + ], + "BE": [ + "highway" + ], + "BF": [ + "highway" + ], + "BG": [ + "highway" + ], + "BI": [ + "highway" + ], + "BJ": [ + "highway" + ], + "BL": [ + "highway" + ], + "BN": [ + "highway" + ], + "BO": [ + "highway" + ], + "BR": [ + "highway" + ], + "BS": [ + "highway" + ], + "BT": [ + "highway" + ], + "BW": [ + "highway" + ], + "BY": [ + "highway" + ], + "BZ": [ + "highway" + ], + "CA": [ + "building", + "highway" + ], + "CD": [ + "highway" + ], + "CF": [ + "highway" + ], + "CG": [ + "highway" + ], + "CH": [ + "highway" + ], + "CI": [ + "highway" + ], + "CL": [ + "highway" + ], + "CM": [ + "highway" + ], + "CN": [ + "highway" + ], + "CO": [ + "highway" + ], + "CR": [ + "highway" + ], + "CU": [ + "highway" + ], + "CY": [ + "highway" + ], + "CZ": [ + "highway" + ], + "DE": [ + "highway" + ], + "DJ": [ + "highway" + ], + "DK": [ + "highway" + ], + "DM": [ + "highway" + ], + "DO": [ + "highway" + ], + "DZ": [ + "highway" + ], + "EC": [ + "highway" + ], + "EE": [ + "highway" + ], + "EG": [ + "highway" + ], + "EH": [ + "highway" + ], + "ER": [ + "highway" + ], + "ES": [ + "highway" + ], + "ET": [ + "highway" + ], + "FK": [ + "highway" + ], + "FI": [ + "highway" + ], + "FJ": [ + "highway" + ], + "FR": [ + "highway" + ], + "GA": [ + "highway" + ], + "GB": [ + "highway" + ], + "GD": [ + "highway" + ], + "GE": [ + "highway" + ], + "GF": [ + "highway" + ], + "GH": [ + "highway" + ], + "GM": [ + "highway" + ], + "GN": [ + "highway" + ], + "GP": [ + "highway" + ], + "GQ": [ + "highway" + ], + "GR": [ + "highway" + ], + "GT": [ + "highway" + ], + "GW": [ + "highway" + ], + "GY": [ + "highway" + ], + "HN": [ + "highway" + ], + "HR": [ + "highway" + ], + "HT": [ + "highway" + ], + "HU": [ + "highway" + ], + "ID": [ + "highway" + ], + "IE": [ + "highway" + ], + "IL": [ + "highway" + ], + "IN": [ + "highway" + ], + "IQ": [ + "highway" + ], + "IS": [ + "highway" + ], + "IT": [ + "highway" + ], + "JM": [ + "highway" + ], + "JO": [ + "highway" + ], + "JP": [ + "highway" + ], + "KE": [ + "highway" + ], + "KG": [ + "highway" + ], + "KH": [ + "highway" + ], + "KN": [ + "highway" + ], + "KY": [ + "highway" + ], + "KR": [ + "highway" + ], + "KW": [ + "highway" + ], + "KZ": [ + "highway" + ], + "LA": [ + "highway" + ], + "LB": [ + "highway" + ], + "LC": [ + "highway" + ], + "LK": [ + "highway" + ], + "LR": [ + "highway" + ], + "LS": [ + "highway" + ], + "LT": [ + "highway" + ], + "LU": [ + "highway" + ], + "LV": [ + "highway" + ], + "LY": [ + "highway" + ], + "MA": [ + "highway" + ], + "MD": [ + "highway" + ], + "ME": [ + "highway" + ], + "MF": [ + "highway" + ], + "MG": [ + "highway" + ], + "MK": [ + "highway" + ], + "ML": [ + "highway" + ], + "MM": [ + "highway" + ], + "MN": [ + "highway" + ], + "MQ": [ + "highway" + ], + "MR": [ + "highway" + ], + "MS": [ + "highway" + ], + "MW": [ + "highway" + ], + "MX": [ + "highway" + ], + "MY": [ + "highway" + ], + "MZ": [ + "highway" + ], + "NA": [ + "highway" + ], + "NE": [ + "highway" + ], + "NG": [ + "highway" + ], + "NI": [ + "highway" + ], + "NL": [ + "highway" + ], + "NL-BQ2": [ + "highway" + ], + "NL-BQ3": [ + "highway" + ], + "NO": [ + "highway" + ], + "NP": [ + "highway" + ], + "NZ": [ + "highway" + ], + "OM": [ + "highway" + ], + "PA": [ + "highway" + ], + "PE": [ + "highway" + ], + "PF": [ + "highway" + ], + "PG": [ + "highway" + ], + "PH": [ + "highway" + ], + "PK": [ + "highway" + ], + "PL": [ + "highway" + ], + "PR": [ + "highway" + ], + "PS": [ + "highway" + ], + "PT": [ + "highway" + ], + "PY": [ + "highway" + ], + "QA": [ + "highway" + ], + "RO": [ + "highway" + ], + "RS": [ + "highway" + ], + "RS-KM": [ + "highway" + ], + "RU": [ + "highway" + ], + "RW": [ + "highway" + ], + "SA": [ + "highway" + ], + "SB": [ + "highway" + ], + "SD": [ + "highway" + ], + "SE": [ + "highway" + ], + "SG": [ + "highway" + ], + "SI": [ + "highway" + ], + "SK": [ + "highway" + ], + "SL": [ + "highway" + ], + "SN": [ + "highway" + ], + "SO": [ + "highway" + ], + "SR": [ + "highway" + ], + "SS": [ + "highway" + ], + "ST": [ + "highway" + ], + "SV": [ + "highway" + ], + "SX": [ + "highway" + ], + "SZ": [ + "highway" + ], + "TC": [ + "highway" + ], + "TD": [ + "highway" + ], + "TG": [ + "highway" + ], + "TH": [ + "highway" + ], + "TJ": [ + "highway" + ], + "TL": [ + "highway" + ], + "TM": [ + "highway" + ], + "TN": [ + "highway" + ], + "TR": [ + "highway" + ], + "TT": [ + "highway" + ], + "TW": [ + "highway" + ], + "TZ": [ + "building", + "highway" + ], + "UA": [ + "highway" + ], + "UG": [ + "building", + "highway" + ], + "US": [ + "building", + "highway" + ], + "US-AK": [ + "building" + ], + "US-HI": [ + "building" + ], + "UY": [ + "highway" + ], + "UZ": [ + "highway" + ], + "VC": [ + "highway" + ], + "VE": [ + "highway" + ], + "VG": [ + "highway" + ], + "VN": [ + "highway" + ], + "VU": [ + "highway" + ], + "YE": [ + "highway" + ], + "ZA": [ + "highway" + ], + "ZM": [ + "highway" + ], + "ZW": [ + "highway" + ] + }, + "default": true, + "license": "ODBL", + "osm_compatible": "yes", + "parameters": [ + { + "description": "buildings", + "enabled": true, + "parameter": "result_type=road_building_vector_xml" + } + ], + "permission_url": "{{ request.baseUrl }}/facebookmicrosites/Open-Mapping-At-Facebook/wiki/FAQ", + "terms_of_use_url": "{{ request.baseUrl }}/doc/license/MapWithAILicense.pdf", + "privacy_policy_url": "{{ request.baseUrl }}/doc/license/MapWithAIPrivacyPolicy.pdf#page=3", + "url": "{{ request.baseUrl }}/maps/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&bbox={bbox}" + } + }, + "transformers": [ + "response-template" + ], + "headers" : { + "Accept-Ranges" : "bytes", + "Cache-Control" : "max-age=600", + "Content-Type" : "application/json", + "Expires" : "Tue, 21 Apr 2020 19:51:40 UTC", + "Last-Modified" : "Tue, 21 Apr 2020 17:34:08 GMT", + "Vary" : "Origin", + "Date" : "Tue, 21 Apr 2020 19:41:40 GMT" + } + }, + "uuid" : "23497750-675c-440a-986a-34dd14b047f8", + "persistent" : true, + "insertionIndex" : 1 +} diff --git a/src/test/resources/wiremock/mappings/josmfile-Styles-MapWithAI.json b/src/test/resources/mappings/josmfile-Styles-MapWithAI.json similarity index 100% rename from src/test/resources/wiremock/mappings/josmfile-Styles-MapWithAI.json rename to src/test/resources/mappings/josmfile-Styles-MapWithAI.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-04b70b03-d148-4e3d-a1fc-98334cd10e64.json b/src/test/resources/mappings/maps_ml_roads-04b70b03-d148-4e3d-a1fc-98334cd10e64.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-04b70b03-d148-4e3d-a1fc-98334cd10e64.json rename to src/test/resources/mappings/maps_ml_roads-04b70b03-d148-4e3d-a1fc-98334cd10e64.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-0bc0c6c3-8e38-4da4-8f85-c07bde3ef54d.json b/src/test/resources/mappings/maps_ml_roads-0bc0c6c3-8e38-4da4-8f85-c07bde3ef54d.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-0bc0c6c3-8e38-4da4-8f85-c07bde3ef54d.json rename to src/test/resources/mappings/maps_ml_roads-0bc0c6c3-8e38-4da4-8f85-c07bde3ef54d.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-146193dd-3082-495b-b350-8164e2858f8d.json b/src/test/resources/mappings/maps_ml_roads-146193dd-3082-495b-b350-8164e2858f8d.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-146193dd-3082-495b-b350-8164e2858f8d.json rename to src/test/resources/mappings/maps_ml_roads-146193dd-3082-495b-b350-8164e2858f8d.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-3098faf3-c028-43c6-9263-42f1cab7c161.json b/src/test/resources/mappings/maps_ml_roads-3098faf3-c028-43c6-9263-42f1cab7c161.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-3098faf3-c028-43c6-9263-42f1cab7c161.json rename to src/test/resources/mappings/maps_ml_roads-3098faf3-c028-43c6-9263-42f1cab7c161.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-4df1e72e-a62e-48b6-806d-99fd74956742.json b/src/test/resources/mappings/maps_ml_roads-4df1e72e-a62e-48b6-806d-99fd74956742.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-4df1e72e-a62e-48b6-806d-99fd74956742.json rename to src/test/resources/mappings/maps_ml_roads-4df1e72e-a62e-48b6-806d-99fd74956742.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-53133862-d606-4976-b016-a35be71df3fb.json b/src/test/resources/mappings/maps_ml_roads-53133862-d606-4976-b016-a35be71df3fb.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-53133862-d606-4976-b016-a35be71df3fb.json rename to src/test/resources/mappings/maps_ml_roads-53133862-d606-4976-b016-a35be71df3fb.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-580f7b5b-cb9a-4092-8a39-bf8b714e6efe.json b/src/test/resources/mappings/maps_ml_roads-580f7b5b-cb9a-4092-8a39-bf8b714e6efe.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-580f7b5b-cb9a-4092-8a39-bf8b714e6efe.json rename to src/test/resources/mappings/maps_ml_roads-580f7b5b-cb9a-4092-8a39-bf8b714e6efe.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-715854d4-ba75-4289-89fe-9352c3d3ed6b.json b/src/test/resources/mappings/maps_ml_roads-715854d4-ba75-4289-89fe-9352c3d3ed6b.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-715854d4-ba75-4289-89fe-9352c3d3ed6b.json rename to src/test/resources/mappings/maps_ml_roads-715854d4-ba75-4289-89fe-9352c3d3ed6b.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-9b87a83b-8600-4f49-9362-9bb066b02133.json b/src/test/resources/mappings/maps_ml_roads-9b87a83b-8600-4f49-9362-9bb066b02133.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-9b87a83b-8600-4f49-9362-9bb066b02133.json rename to src/test/resources/mappings/maps_ml_roads-9b87a83b-8600-4f49-9362-9bb066b02133.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-ce324a60-116f-48ae-8999-fa4321b68f18.json b/src/test/resources/mappings/maps_ml_roads-ce324a60-116f-48ae-8999-fa4321b68f18.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-ce324a60-116f-48ae-8999-fa4321b68f18.json rename to src/test/resources/mappings/maps_ml_roads-ce324a60-116f-48ae-8999-fa4321b68f18.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-e3da5e5b-126f-44e1-8411-93eff12bd08a.json b/src/test/resources/mappings/maps_ml_roads-e3da5e5b-126f-44e1-8411-93eff12bd08a.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-e3da5e5b-126f-44e1-8411-93eff12bd08a.json rename to src/test/resources/mappings/maps_ml_roads-e3da5e5b-126f-44e1-8411-93eff12bd08a.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-e543fb8b-a680-4a1d-9f90-a793b7a7a6a6.json b/src/test/resources/mappings/maps_ml_roads-e543fb8b-a680-4a1d-9f90-a793b7a7a6a6.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-e543fb8b-a680-4a1d-9f90-a793b7a7a6a6.json rename to src/test/resources/mappings/maps_ml_roads-e543fb8b-a680-4a1d-9f90-a793b7a7a6a6.json diff --git a/src/test/resources/wiremock/mappings/maps_ml_roads-f72200ba-e99d-481a-90e9-c4e7ddd3398b.json b/src/test/resources/mappings/maps_ml_roads-f72200ba-e99d-481a-90e9-c4e7ddd3398b.json similarity index 100% rename from src/test/resources/wiremock/mappings/maps_ml_roads-f72200ba-e99d-481a-90e9-c4e7ddd3398b.json rename to src/test/resources/mappings/maps_ml_roads-f72200ba-e99d-481a-90e9-c4e7ddd3398b.json diff --git a/src/test/resources/wiremock/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-2b3ba100-8f68-4bd8-977f-86cf5c5212b2.json b/src/test/resources/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-2b3ba100-8f68-4bd8-977f-86cf5c5212b2.json similarity index 100% rename from src/test/resources/wiremock/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-2b3ba100-8f68-4bd8-977f-86cf5c5212b2.json rename to src/test/resources/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-2b3ba100-8f68-4bd8-977f-86cf5c5212b2.json diff --git a/src/test/resources/wiremock/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-b603ddec-a465-4f56-8406-bfef84c6e30f.json b/src/test/resources/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-b603ddec-a465-4f56-8406-bfef84c6e30f.json similarity index 100% rename from src/test/resources/wiremock/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-b603ddec-a465-4f56-8406-bfef84c6e30f.json rename to src/test/resources/mappings/sharing_rest_content_groups_bdf6c800b3ae453b9db239e03d7c1727_search-b603ddec-a465-4f56-8406-bfef84c6e30f.json diff --git a/src/test/resources/wiremock/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json b/src/test/resources/wiremock/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json deleted file mode 100644 index c0a6a1af..00000000 --- a/src/test/resources/wiremock/mappings/josm_mapwithai_json_sourcesjson-23497750-675c-440a-986a-34dd14b047f8.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id" : "23497750-675c-440a-986a-34dd14b047f8", - "name" : "josm_mapwithai_json_sourcesjson", - "request" : { - "urlPattern" : "\/MapWithAI\/?json\/sources.json", - "method" : "GET" - }, - "response" : { - "status" : 200, - "body" : "{\n \"Statewide Aggregate Addresses in Colorado 2019 (Public)\": {\n \"countries\": {\n \"US-CO\": [\"addr:housenumber\"]\n },\n \"license\": \"Public Domain\",\n \"osm_compatible\": \"yes\",\n \"parameters\": [],\n \"permission_url\": \"https://wiki.openstreetmap.org/wiki/Import/Colorado_Addresses\",\n \"url\": \"https://importdata.riverviewtechnologies.com/coloradoAddresses/map?bbox={bbox}\"\n },\n \"MapWithAI\": {\n \"countries\": {\n \"AE\": [\"highway\"],\n \"AF\": [\"highway\"],\n \"AG\": [\"highway\"],\n \"AI\": [\"highway\"],\n \"AL\": [\"highway\"],\n \"AM\": [\"highway\"],\n \"AO\": [\"highway\"],\n \"AR\": [\"highway\"],\n \"AT\": [\"highway\"],\n \"AU\": [\"highway\"],\n \"AZ\": [\"highway\"],\n \"BA\": [\"highway\"],\n \"BB\": [\"highway\"],\n \"BD\": [\"highway\"],\n \"BE\": [\"highway\"],\n \"BF\": [\"highway\"],\n \"BG\": [\"highway\"],\n \"BI\": [\"highway\"],\n \"BJ\": [\"highway\"],\n \"BL\": [\"highway\"],\n \"BN\": [\"highway\"],\n \"BO\": [\"highway\"],\n \"BR\": [\"highway\"],\n \"BS\": [\"highway\"],\n \"BT\": [\"highway\"],\n \"BW\": [\"highway\"],\n \"BY\": [\"highway\"],\n \"BZ\": [\"highway\"],\n \"CA\": [\"building\", \"highway\"],\n \"CD\": [\"highway\"],\n \"CF\": [\"highway\"],\n \"CG\": [\"highway\"],\n \"CH\": [\"highway\"],\n \"CI\": [\"highway\"],\n \"CL\": [\"highway\"],\n \"CM\": [\"highway\"],\n \"CN\": [\"highway\"],\n \"CO\": [\"highway\"],\n \"CR\": [\"highway\"],\n \"CU\": [\"highway\"],\n \"CY\": [\"highway\"],\n \"CZ\": [\"highway\"],\n \"DE\": [\"highway\"],\n \"DJ\": [\"highway\"],\n \"DK\": [\"highway\"],\n \"DM\": [\"highway\"],\n \"DO\": [\"highway\"],\n \"DZ\": [\"highway\"],\n \"EC\": [\"highway\"],\n \"EE\": [\"highway\"],\n \"EG\": [\"highway\"],\n \"EH\": [\"highway\"],\n \"ER\": [\"highway\"],\n \"ES\": [\"highway\"],\n \"ET\": [\"highway\"],\n \"FK\": [\"highway\"],\n \"FI\": [\"highway\"],\n \"FJ\": [\"highway\"],\n \"FR\": [\"highway\"],\n \"GA\": [\"highway\"],\n \"GB\": [\"highway\"],\n \"GD\": [\"highway\"],\n \"GE\": [\"highway\"],\n \"GF\": [\"highway\"],\n \"GH\": [\"highway\"],\n \"GM\": [\"highway\"],\n \"GN\": [\"highway\"],\n \"GP\": [\"highway\"],\n \"GQ\": [\"highway\"],\n \"GR\": [\"highway\"],\n \"GT\": [\"highway\"],\n \"GW\": [\"highway\"],\n \"GY\": [\"highway\"],\n \"HN\": [\"highway\"],\n \"HR\": [\"highway\"],\n \"HT\": [\"highway\"],\n \"HU\": [\"highway\"],\n \"ID\": [\"highway\"],\n \"IE\": [\"highway\"],\n \"IL\": [\"highway\"],\n \"IN\": [\"highway\"],\n \"IQ\": [\"highway\"],\n \"IS\": [\"highway\"],\n \"IT\": [\"highway\"],\n \"JM\": [\"highway\"],\n \"JO\": [\"highway\"],\n \"JP\": [\"highway\"],\n \"KE\": [\"highway\"],\n \"KG\": [\"highway\"],\n \"KH\": [\"highway\"],\n \"KN\": [\"highway\"],\n \"KY\": [\"highway\"],\n \"KR\": [\"highway\"],\n \"KW\": [\"highway\"],\n \"KZ\": [\"highway\"],\n \"LA\": [\"highway\"],\n \"LB\": [\"highway\"],\n \"LC\": [\"highway\"],\n \"LK\": [\"highway\"],\n \"LR\": [\"highway\"],\n \"LS\": [\"highway\"],\n \"LT\": [\"highway\"],\n \"LU\": [\"highway\"],\n \"LV\": [\"highway\"],\n \"LY\": [\"highway\"],\n \"MA\": [\"highway\"],\n \"MD\": [\"highway\"],\n \"ME\": [\"highway\"],\n \"MF\": [\"highway\"],\n \"MG\": [\"highway\"],\n \"MK\": [\"highway\"],\n \"ML\": [\"highway\"],\n \"MM\": [\"highway\"],\n \"MN\": [\"highway\"],\n \"MQ\": [\"highway\"],\n \"MR\": [\"highway\"],\n \"MS\": [\"highway\"],\n \"MW\": [\"highway\"],\n \"MX\": [\"highway\"],\n \"MY\": [\"highway\"],\n \"MZ\": [\"highway\"],\n \"NA\": [\"highway\"],\n \"NE\": [\"highway\"],\n \"NG\": [\"highway\"],\n \"NI\": [\"highway\"],\n \"NL\": [\"highway\"],\n \"NL-BQ2\": [\"highway\"],\n \"NL-BQ3\": [\"highway\"],\n \"NO\": [\"highway\"],\n \"NP\": [\"highway\"],\n \"NZ\": [\"highway\"],\n \"OM\": [\"highway\"],\n \"PA\": [\"highway\"],\n \"PE\": [\"highway\"],\n \"PF\": [\"highway\"],\n \"PG\": [\"highway\"],\n \"PH\": [\"highway\"],\n \"PK\": [\"highway\"],\n \"PL\": [\"highway\"],\n \"PR\": [\"highway\"],\n \"PS\": [\"highway\"],\n \"PT\": [\"highway\"],\n \"PY\": [\"highway\"],\n \"QA\": [\"highway\"],\n \"RO\": [\"highway\"],\n \"RS\": [\"highway\"],\n \"RS-KM\": [\"highway\"],\n \"RU\": [\"highway\"],\n \"RW\": [\"highway\"],\n \"SA\": [\"highway\"],\n \"SB\": [\"highway\"],\n \"SD\": [\"highway\"],\n \"SE\": [\"highway\"],\n \"SG\": [\"highway\"],\n \"SI\": [\"highway\"],\n \"SK\": [\"highway\"],\n \"SL\": [\"highway\"],\n \"SN\": [\"highway\"],\n \"SO\": [\"highway\"],\n \"SR\": [\"highway\"],\n \"SS\": [\"highway\"],\n \"ST\": [\"highway\"],\n \"SV\": [\"highway\"],\n \"SX\": [\"highway\"],\n \"SZ\": [\"highway\"],\n \"TC\": [\"highway\"],\n \"TD\": [\"highway\"],\n \"TG\": [\"highway\"],\n \"TH\": [\"highway\"],\n \"TJ\": [\"highway\"],\n \"TL\": [\"highway\"],\n \"TM\": [\"highway\"],\n \"TN\": [\"highway\"],\n \"TR\": [\"highway\"],\n \"TT\": [\"highway\"],\n \"TW\": [\"highway\"],\n \"TZ\": [\"building\", \"highway\"],\n \"UA\": [\"highway\"],\n \"UG\": [\"building\", \"highway\"],\n \"US\": [\"building\", \"highway\"],\n \"US-AK\": [\"building\"],\n \"US-HI\": [\"building\"],\n \"UY\": [\"highway\"],\n \"UZ\": [\"highway\"],\n \"VC\": [\"highway\"],\n \"VE\": [\"highway\"],\n \"VG\": [\"highway\"],\n \"VN\": [\"highway\"],\n \"VU\": [\"highway\"],\n \"YE\": [\"highway\"],\n \"ZA\": [\"highway\"],\n \"ZM\": [\"highway\"],\n \"ZW\": [\"highway\"]\n },\n \"default\": true,\n \"license\": \"ODBL\",\n \"osm_compatible\": \"yes\",\n \"parameters\": [{\n \"description\": \"buildings\",\n \"enabled\": true,\n \"parameter\": \"result_type=road_building_vector_xml\"\n }],\n \"permission_url\": \"https://github.com/facebookmicrosites/Open-Mapping-At-Facebook/wiki/FAQ\",\n \"terms_of_use_url\": \"https://mapwith.ai/doc/license/MapWithAILicense.pdf\",\n \"privacy_policy_url\": \"https://mapwith.ai/doc/license/MapWithAIPrivacyPolicy.pdf#page=3\",\n \"url\": \"https://www.mapwith.ai/maps/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&bbox={bbox}\"\n }\n}\n", - "headers" : { - "Accept-Ranges" : "bytes", - "Cache-Control" : "max-age=600", - "Content-Type" : "application/json", - "Expires" : "Tue, 21 Apr 2020 19:51:40 UTC", - "Last-Modified" : "Tue, 21 Apr 2020 17:34:08 GMT", - "Vary" : "Origin", - "Date" : "Tue, 21 Apr 2020 19:41:40 GMT" - } - }, - "uuid" : "23497750-675c-440a-986a-34dd14b047f8", - "persistent" : true, - "insertionIndex" : 1 -} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/actions/AddMapWithAILayerActionTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/actions/AddMapWithAILayerActionTest.java index ac816cdb..897f03a7 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/actions/AddMapWithAILayerActionTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/actions/AddMapWithAILayerActionTest.java @@ -24,6 +24,7 @@ import javax.swing.Action; import javax.swing.ImageIcon; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -74,14 +75,11 @@ public ThreadSyncMWAI() { @RegisterExtension static ThreadSyncMWAI threadSync = new ThreadSyncMWAI(); - @BasicWiremock - WireMockServer wireMockServer; - private static MapWithAIInfo info; private static MapWithAIInfo backupInfo; @BeforeEach - void setup() { + void setup(WireMockRuntimeInfo wireMockRuntimeInfo) { final Map parameterMap = new HashMap<>(); final AnythingPattern anythingPattern = new AnythingPattern(); parameterMap.put("geometryType", anythingPattern); @@ -91,7 +89,7 @@ void setup() { parameterMap.put("outfields", new EqualToPattern("*")); parameterMap.put("result_type", new EqualToPattern("road_building_vector_xml")); parameterMap.put("resultOffset", anythingPattern); - wireMockServer.stubFor( + wireMockRuntimeInfo.getWireMock().register( WireMock.get(new UrlPathPattern(new EqualToPattern("/query"), false)).withQueryParams(parameterMap) .willReturn(WireMock.aResponse() .withBody(Json.createObjectBuilder().add("type", "FeatureCollection") @@ -142,7 +140,7 @@ void testAddMapWithAILayerActionTest() { } @Test - void testRemoteIcon() throws IOException { + void testRemoteIcon(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException { final ImageIcon blankImage = ImageProvider.createBlankIcon(ImageProvider.ImageSizes.LARGEICON); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); // BufferedImage is what the current implementation uses. Otherwise, we will @@ -150,10 +148,9 @@ void testRemoteIcon() throws IOException { final BufferedImage bi = assertInstanceOf(BufferedImage.class, blankImage.getImage()); ImageIO.write(bi, "png", byteArrayOutputStream); byte[] originalImage = byteArrayOutputStream.toByteArray(); - wireMockServer.addStubMapping( - wireMockServer.stubFor(WireMock.get("/icon").willReturn(WireMock.aResponse().withBody(originalImage)))); + wireMockRuntimeInfo.getWireMock().register(WireMock.get("/icon").willReturn(WireMock.aResponse().withBody(originalImage))); final MapWithAIInfo remoteInfo = new MapWithAIInfo(info); - remoteInfo.setIcon(wireMockServer.baseUrl() + "/icon"); + remoteInfo.setIcon(wireMockRuntimeInfo.getHttpBaseUrl() + "/icon"); final AddMapWithAILayerAction action = new AddMapWithAILayerAction(remoteInfo); threadSync.threadSync(); final Object image = action.getValue(Action.LARGE_ICON_KEY); @@ -166,7 +163,7 @@ void testRemoteIcon() throws IOException { } @Test - void testNonRegression22683() { + void testNonRegression22683(WireMockRuntimeInfo wireMockRuntimeInfo) { final OsmDataLayer layer = new OsmDataLayer(new DataSet(), "testNonRegression22683", null); layer.getDataSet().addDataSource(new DataSource(new Bounds(0, 0, 0.001, 0.001), "Area 1")); layer.getDataSet().addDataSource(new DataSource(new Bounds(-0.001, -0.001, 0, 0), "Area 2")); @@ -190,7 +187,7 @@ public void close() { }; Logging.getLogger().addHandler(testHandler); try { - info.setUrl(wireMockServer.baseUrl()); + info.setUrl(wireMockRuntimeInfo.getHttpBaseUrl()); info.setSourceType(MapWithAIType.ESRI_FEATURE_SERVER); final AddMapWithAILayerAction action = new AddMapWithAILayerAction(info); Logging.clearLastErrorAndWarnings(); diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloaderTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloaderTest.java index ec2f33fb..d7b1321c 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloaderTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloaderTest.java @@ -5,8 +5,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import java.util.List; import java.util.stream.Collectors; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.stubbing.ServeEvent; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.osm.DataSet; @@ -17,12 +20,9 @@ import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAIConfig; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; -import org.openstreetmap.josm.testutils.annotations.BasicWiremock; import org.openstreetmap.josm.testutils.annotations.HTTP; import org.openstreetmap.josm.testutils.annotations.OsmApi; -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.admin.model.GetServeEventsResult; import com.github.tomakehurst.wiremock.admin.model.ServeEventQuery; import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.http.Request; @@ -46,35 +46,32 @@ class BoundingBoxMapWithAIDownloaderTest { private static final String TEST_DATA = ""; - @BasicWiremock - public WireMockServer wireMockServer; - @Test - void testThirdPartyConflation() { + void testThirdPartyConflation(WireMockRuntimeInfo wireMockRuntimeInfo) { MapWithAIInfo.THIRD_PARTY_CONFLATE.put(true); final MapWithAIInfo info = new MapWithAIInfo("testThirdPartyConflation", - this.wireMockServer.baseUrl() + "/testThirdPartyConflation"); + wireMockRuntimeInfo.getHttpBaseUrl() + "/testThirdPartyConflation"); // ADDRESS has a default /conflate endpoint from a mocked copy of conflation // servers. info.setCategory(MapWithAICategory.ADDRESS); final Bounds downloadBounds = new Bounds(-10, -10, 10, 10); final BoundingBoxMapWithAIDownloader boundingBoxMapWithAIDownloader = new BoundingBoxMapWithAIDownloader( downloadBounds, info, false); - this.wireMockServer.stubFor( + wireMockRuntimeInfo.getWireMock().register( WireMock.get("/testThirdPartyConflation").willReturn(WireMock.aResponse().withBody(TEST_DATA))); - final StubMapping conflationStub = this.wireMockServer - .stubFor(WireMock.post("/conflate").willReturn(WireMock.aResponse() + final StubMapping conflationStub = wireMockRuntimeInfo.getWireMock() + .register(WireMock.post("/conflate").willReturn(WireMock.aResponse() .withBody(""))); final DataSet ds = assertDoesNotThrow( () -> boundingBoxMapWithAIDownloader.parseOsm(NullProgressMonitor.INSTANCE)); assertEquals(1, ds.allPrimitives().size()); assertEquals(1L, ds.allPrimitives().iterator().next().getPrimitiveId().getUniqueId()); - final GetServeEventsResult serveEvents = this.wireMockServer + final List serveEvents = wireMockRuntimeInfo.getWireMock() .getServeEvents(ServeEventQuery.forStubMapping(conflationStub)); - assertEquals(1, serveEvents.getRequests().size()); - final LoggedRequest request = serveEvents.getRequests().get(0).getRequest(); + assertEquals(1, serveEvents.size()); + final LoggedRequest request = serveEvents.get(0).getRequest(); assertEquals(1, request.getParts().size(), request.getParts().stream().map(Request.Part::getName).collect(Collectors.joining(","))); assertNotNull(request.getPart("external")); @@ -85,29 +82,29 @@ void testThirdPartyConflation() { * MapWithAI servers */ @Test - void testNonRegression22624() { + void testNonRegression22624(WireMockRuntimeInfo wireMockRuntimeInfo) { MapWithAIInfo.THIRD_PARTY_CONFLATE.put(true); MapWithAIInfo info = new MapWithAIInfo("testNonRegression22624", - this.wireMockServer.baseUrl() + "/no-conflation?bbox={bbox}", + wireMockRuntimeInfo.getHttpBaseUrl() + "/no-conflation?bbox={bbox}", MapWithAIType.ESRI_FEATURE_SERVER.getTypeString(), null, "testNonRegression22624"); - info.setConflationUrl(this.wireMockServer.baseUrl() + "/conflation?bbox={bbox}"); + info.setConflationUrl(wireMockRuntimeInfo.getHttpBaseUrl() + "/conflation?bbox={bbox}"); info.setConflation(true); final Bounds downloadBounds = new Bounds(-10, -10, 10, 10); final BoundingBoxMapWithAIDownloader boundingBoxMapWithAIDownloader = new BoundingBoxMapWithAIDownloader( downloadBounds, info, false); - StubMapping noConflation = this.wireMockServer - .stubFor(WireMock.get("/no-conflation").willReturn(WireMock.badRequest())); - StubMapping resultOffset = this.wireMockServer.stubFor( + StubMapping noConflation = wireMockRuntimeInfo.getWireMock() + .register(WireMock.get("/no-conflation").willReturn(WireMock.badRequest())); + StubMapping resultOffset = wireMockRuntimeInfo.getWireMock().register( WireMock.get(WireMock.urlPathEqualTo("/conflation")).withQueryParam("bbox", new AnythingPattern()) .withQueryParam("resultOffset", new EqualToPattern("0")).willReturn(WireMock.badRequest())); - StubMapping noResultOffset = this.wireMockServer.stubFor(WireMock.get(WireMock.urlPathEqualTo("/conflation")) + StubMapping noResultOffset = wireMockRuntimeInfo.getWireMock().register(WireMock.get(WireMock.urlPathEqualTo("/conflation")) .withQueryParam("bbox", new AnythingPattern()).withQueryParam("resultOffset", AbsentPattern.ABSENT) .willReturn(WireMock.aResponse().withBody(TEST_DATA))); assertDoesNotThrow(() -> boundingBoxMapWithAIDownloader.parseOsm(NullProgressMonitor.INSTANCE)); - this.wireMockServer.verify(0, RequestPatternBuilder.forCustomMatcher(noConflation.getRequest())); - this.wireMockServer.verify(0, RequestPatternBuilder.forCustomMatcher(resultOffset.getRequest())); - this.wireMockServer.verify(1, RequestPatternBuilder.forCustomMatcher(noResultOffset.getRequest())); + wireMockRuntimeInfo.getWireMock().verifyThat(0, RequestPatternBuilder.forCustomMatcher(noConflation.getRequest())); + wireMockRuntimeInfo.getWireMock().verifyThat(0, RequestPatternBuilder.forCustomMatcher(resultOffset.getRequest())); + wireMockRuntimeInfo.getWireMock().verifyThat(1, RequestPatternBuilder.forCustomMatcher(noResultOffset.getRequest())); } } diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DataConflationSenderTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DataConflationSenderTest.java index f0fdc93b..84f3261f 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DataConflationSenderTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DataConflationSenderTest.java @@ -9,6 +9,8 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Stream; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.ThrowingSupplier; @@ -46,9 +48,6 @@ @Wiremock @MapWithAISources class DataConflationSenderTest { - @BasicWiremock - WireMockServer wireMockServer; - static class MapWithAIConflationCategoryMock extends MockUp { static String url; @@ -81,10 +80,10 @@ void testEmptyUrl() { } @Test - void testWorkingUrl() { - MapWithAIConflationCategoryMock.url = wireMockServer.baseUrl() + "/conflate"; - final StubMapping stubMapping = wireMockServer - .stubFor(WireMock.post("/conflate").willReturn(WireMock.aResponse().withBody( + void testWorkingUrl(WireMockRuntimeInfo wireMockRuntimeInfo) { + MapWithAIConflationCategoryMock.url = wireMockRuntimeInfo.getHttpBaseUrl() + "/conflate"; + final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock() + .register(WireMock.post("/conflate").willReturn(WireMock.aResponse().withBody( ""))); new MapWithAIConflationCategoryMock(); @@ -99,14 +98,13 @@ void testWorkingUrl() { assertEquals(1, conflated.getNodes().size()); final Node conflatedNode = conflated.getNodes().iterator().next(); assertEquals(new LatLon(89, 0.1), conflatedNode.getCoor()); - assertEquals(1, wireMockServer.getAllServeEvents().stream() - .filter(serveEvent -> stubMapping.equals(serveEvent.getStubMapping())).count()); + wireMockRuntimeInfo.getWireMock().verifyThat(1, RequestPatternBuilder.like(stubMapping.getRequest())); } @Test - void testWorkingUrlTimeout() { - MapWithAIConflationCategoryMock.url = wireMockServer.baseUrl() + "/conflate"; - final StubMapping stubMapping = wireMockServer.stubFor(WireMock.post("/conflate") + void testWorkingUrlTimeout(WireMockRuntimeInfo wireMockRuntimeInfo) { + MapWithAIConflationCategoryMock.url = wireMockRuntimeInfo.getHttpBaseUrl() + "/conflate"; + final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock().register(WireMock.post("/conflate") .willReturn(WireMock.aResponse().withBody( "") .withFixedDelay(500))); @@ -123,8 +121,7 @@ void testWorkingUrlTimeout() { assertEquals(1, conflated.getNodes().size()); final Node conflatedNode = conflated.getNodes().iterator().next(); assertEquals(new LatLon(89, 0.1), conflatedNode.getCoor()); - assertEquals(1, wireMockServer.getAllServeEvents().stream() - .filter(serveEvent -> stubMapping.equals(serveEvent.getStubMapping())).count()); + wireMockRuntimeInfo.getWireMock().verifyThat(1, RequestPatternBuilder.like(stubMapping.getRequest())); } static Stream testNonWorkingUrl() { @@ -135,9 +132,9 @@ static Stream testNonWorkingUrl() { @ParameterizedTest @MethodSource - void testNonWorkingUrl(final ResponseDefinitionBuilder response) { - MapWithAIConflationCategoryMock.url = wireMockServer.baseUrl() + "/conflate"; - final StubMapping stubMapping = wireMockServer.stubFor(WireMock.post("/conflate").willReturn(response)); + void testNonWorkingUrl(final ResponseDefinitionBuilder response, final WireMockRuntimeInfo wireMockRuntimeInfo) { + MapWithAIConflationCategoryMock.url = wireMockRuntimeInfo.getHttpBaseUrl() + "/conflate"; + final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock().register(WireMock.post("/conflate").willReturn(response)); new MapWithAIConflationCategoryMock(); final DataSet external = new DataSet(new Node(LatLon.NORTH_POLE)); @@ -147,7 +144,6 @@ void testNonWorkingUrl(final ResponseDefinitionBuilder response) { dataConflationSender.run(); final DataSet conflated = assertDoesNotThrow((ThrowingSupplier) dataConflationSender::get); assertNull(conflated); - assertEquals(1, wireMockServer.getAllServeEvents().stream() - .filter(serveEvent -> stubMapping.equals(serveEvent.getStubMapping())).count()); + wireMockRuntimeInfo.getWireMock().verifyThat(1, RequestPatternBuilder.like(stubMapping.getRequest())); } } diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReaderTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReaderTest.java index 5d073546..6aae0aae 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReaderTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReaderTest.java @@ -12,6 +12,7 @@ import java.util.concurrent.Future; import java.util.stream.Collectors; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import org.awaitility.Awaitility; import org.awaitility.Durations; import org.junit.jupiter.api.AfterEach; @@ -31,9 +32,6 @@ @Wiremock class ESRISourceReaderTest { - @BasicWiremock - public WireMockServer wireMockServer; - @BeforeEach void setUp() { ESRISourceReader.SOURCE_CACHE.clear(); @@ -51,11 +49,11 @@ void tearDown() { * file/wiremocked file */ @Test - void testAddEsriLayer() throws IOException { + void testAddEsriLayer(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException { // TODO wiremock MapWithAIInfo info = new MapWithAIInfo("TEST", "test_url", "bdf6c800b3ae453b9db239e03d7c1727"); info.setSourceType(MapWithAIType.ESRI); - String tUrl = wireMockServer.url("/sharing/rest"); + String tUrl = wireMockRuntimeInfo.getHttpBaseUrl() + "/sharing/rest"; for (String url : Arrays.asList(tUrl, tUrl + "/")) { info.setUrl(url); final ESRISourceReader reader = new ESRISourceReader(info); @@ -65,7 +63,7 @@ void testAddEsriLayer() throws IOException { } catch (ExecutionException | InterruptedException e) { throw new JosmRuntimeException(e); } - }).collect(Collectors.toList()); + }).toList(); Future workerQueue = MainApplication.worker.submit(() -> { /* Sync threads */}); Awaitility.await().atMost(Durations.FIVE_SECONDS).until(workerQueue::isDone); diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAIConfig.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAIConfig.java index bf38e4c9..e1234903 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAIConfig.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAIConfig.java @@ -8,14 +8,13 @@ import java.lang.annotation.Target; import java.util.stream.Stream; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.openstreetmap.josm.plugins.mapwithai.spi.preferences.IMapWithAIUrls; -import com.github.tomakehurst.wiremock.WireMockServer; - /** * Set the MapWithAI config for the test * @@ -29,7 +28,7 @@ public @interface MapWithAIConfig { class MapWithAIConfigExtension extends Wiremock.WiremockExtension implements BeforeEachCallback, AfterEachCallback { @Override - public void beforeEach(ExtensionContext context) throws Exception { + public void beforeEach(ExtensionContext context) { org.openstreetmap.josm.plugins.mapwithai.spi.preferences.MapWithAIConfig .setUrlsProvider(new WireMockMapWithAIUrls(getWiremock(context))); } @@ -42,25 +41,25 @@ public void afterEach(ExtensionContext context) { } private static final class WireMockMapWithAIUrls implements IMapWithAIUrls { - private final WireMockServer wireMockServer; + private final WireMockRuntimeInfo wireMockServer; - public WireMockMapWithAIUrls(final WireMockServer wireMockServer) { + public WireMockMapWithAIUrls(final WireMockRuntimeInfo wireMockServer) { this.wireMockServer = wireMockServer; } @Override public String getConflationServerJson() { - return this.wireMockServer.baseUrl() + "/MapWithAI/json/conflation_servers.json"; + return this.wireMockServer.getHttpBaseUrl() + "/MapWithAI/json/conflation_servers.json"; } @Override public String getMapWithAISourcesJson() { - return this.wireMockServer.baseUrl() + "/MapWithAI/json/sources.json"; + return this.wireMockServer.getHttpBaseUrl() + "/MapWithAI/json/sources.json"; } @Override public String getMapWithAIPaintStyle() { - return this.wireMockServer.baseUrl() + "/josmfile?page=Styles/MapWithAI&zip=1"; + return this.wireMockServer.getHttpBaseUrl() + "/josmfile?page=Styles/MapWithAI&zip=1"; } } diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java index 88459e16..1a61ef06 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java @@ -1,17 +1,29 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapwithai.testutils.annotations; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.lang.reflect.Field; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import org.awaitility.Awaitility; import org.awaitility.Durations; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.platform.commons.support.AnnotationSupport; import org.openstreetmap.josm.plugins.mapwithai.backend.DataAvailability; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory; @@ -29,11 +41,8 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.Response; +import org.openstreetmap.josm.tools.Logging; +import org.openstreetmap.josm.tools.ReflectionUtils; /** * Test annotation to ensure that wiremock is used @@ -44,8 +53,8 @@ @Target({ ElementType.PARAMETER, ElementType.TYPE, ElementType.METHOD }) @BasicPreferences @HTTP +@BasicWiremock(value = "src/test/resources/wiremock") @ExtendWith(Wiremock.TestMapWithAIUrls.class) -@BasicWiremock(value = "src/test/resources/wiremock", responseTransformers = Wiremock.WireMockUrlTransformer.class) public @interface Wiremock { /** * Set to {@code false} to turn off wiremock (use only in integration tests) @@ -54,72 +63,35 @@ */ boolean value() default true; - /** - * Replace URL's with the wiremock URL - * - * @author Taylor Smock - */ - class WireMockUrlTransformer extends ResponseTransformer { - private final ExtensionContext context; - - public WireMockUrlTransformer(ExtensionContext context) { - this.context = context; - } - - @Override - public String getName() { - return "Convert urls in responses to wiremock url"; - } - - @Override - public Response transform(Request request, Response response, FileSource files, Parameters parameters) { - if (!request.getUrl().endsWith("/capabilities") - && response.getHeaders().getContentTypeHeader().mimeTypePart() != null - && !response.getHeaders().getContentTypeHeader().mimeTypePart().contains("application/zip")) { - String origBody = response.getBodyAsString(); - String newBody = origBody.replaceAll("https?://.*?/", - WiremockExtension.getWiremock(context).baseUrl() + "/"); - return Response.Builder.like(response).but().body(newBody).build(); - } - return response; - } - } - /** * This is the base wiremock extension class */ - class WiremockExtension extends BasicWiremock.WireMockExtension { + class WiremockExtension { /** * Get the default wiremock server * * @param context The context to search * @return The wiremock server */ - public static WireMockServer getWiremock(ExtensionContext context) { - ExtensionContext.Namespace namespace = ExtensionContext.Namespace.create(BasicWiremock.class); - return context.getStore(namespace).get(WireMockServer.class, WireMockServer.class); + public static WireMockRuntimeInfo getWiremock(ExtensionContext context) { + return context.getStore(ExtensionContext.Namespace.create(BasicWiremock.WireMockExtension.class)) + .get(BasicWiremock.WireMockExtension.class, BasicWiremock.WireMockExtension.class) + .getRuntimeInfo(); } } /** * Extension for {@link MapWithAILayerInfo} */ - class MapWithAILayerInfoExtension extends WiremockExtension { - private static int hashCode; + class MapWithAILayerInfoExtension extends WiremockExtension implements BeforeAllCallback, AfterAllCallback { @Override - public void afterAll(ExtensionContext context) throws Exception { - try { - super.afterAll(context); - } finally { - resetMapWithAILayerInfo(context); - } + public void afterAll(ExtensionContext context) { + resetMapWithAILayerInfo(context); } @Override - public void beforeAll(ExtensionContext context) throws Exception { - super.beforeAll(context); - + public void beforeAll(ExtensionContext context) { MapWithAILayerInfo.setImageryLayersSites(null); AtomicBoolean finished = new AtomicBoolean(); MapWithAILayerInfo.getInstance().clear(); @@ -141,29 +113,45 @@ private static void resetMapWithAILayerInfo(ExtensionContext context) { } - class TestMapWithAIUrls extends WiremockExtension implements IMapWithAIUrls { + class TestMapWithAIUrls extends WiremockExtension implements IMapWithAIUrls, BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback { ExtensionContext context; private static boolean conflationServerInitialized; + /** + * Replace URL servers with wiremock + * + * @param baseUrl The wiremock to point to + * @param url The URL to fix + * @return A url that points at the wiremock server + */ + public static String replaceUrl(String baseUrl, String url) { + try { + URL temp = new URL(url); + return baseUrl + temp.getFile(); + } catch (MalformedURLException error) { + Logging.error(error); + } + return null; + } + @Override public String getConflationServerJson() { conflationServerInitialized = true; - return replaceUrl(getWiremock(this.context), MapWithAIUrls.getInstance().getConflationServerJson()); + return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getConflationServerJson()); } @Override public String getMapWithAISourcesJson() { - return replaceUrl(getWiremock(this.context), MapWithAIUrls.getInstance().getMapWithAISourcesJson()); + return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getMapWithAISourcesJson()); } @Override public String getMapWithAIPaintStyle() { - return replaceUrl(getWiremock(this.context), MapWithAIUrls.getInstance().getMapWithAIPaintStyle()); + return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getMapWithAIPaintStyle()); } @Override - public void beforeAll(ExtensionContext context) throws Exception { - super.beforeAll(context); + public void beforeAll(ExtensionContext context) { final Optional annotation = AnnotationUtils.findFirstParentAnnotation(context, Wiremock.class); this.context = context; if (Boolean.FALSE.equals(annotation.map(Wiremock::value).orElse(Boolean.TRUE))) { @@ -174,44 +162,48 @@ public void beforeAll(ExtensionContext context) throws Exception { if (conflationServerInitialized) { MapWithAIConflationCategory.initialize(); } - AnnotationUtils.resetStaticClass(DataAvailability.class); + assertDoesNotThrow(() -> AnnotationUtils.resetStaticClass(DataAvailability.class)); } @Override - public void beforeEach(ExtensionContext context) throws Exception { + public void beforeEach(ExtensionContext context) { final Optional annotation = AnnotationUtils.findFirstParentAnnotation(context, Wiremock.class); this.context = context; if (annotation.isPresent()) { this.beforeAll(context); } - final WireMockServer wireMockServer = getWiremock(context); - - super.beforeEach(context); + final WireMock wireMockServer = getWiremock(context).getWireMock(); - if (wireMockServer.getStubMappings().stream().filter(mapping -> mapping.getRequest().getUrl() != null) + if (wireMockServer.allStubMappings().getMappings().stream().filter(mapping -> mapping.getRequest().getUrl() != null) .noneMatch(mapping -> mapping.getRequest().getUrl() .equals("/MapWithAI/json/conflation_servers.json"))) { - wireMockServer.stubFor(WireMock.get("/MapWithAI/json/conflation_servers.json") + wireMockServer.register(WireMock.get("/MapWithAI/json/conflation_servers.json") .willReturn(WireMock.aResponse().withBody("{}")).atPriority(-5)); } } @Override - public void afterAll(ExtensionContext context) throws Exception { + public void afterEach(ExtensionContext extensionContext) { + this.context = extensionContext; + } + + @Override + public void afterAll(ExtensionContext context) { + this.context = context; // @Wiremock stops the WireMockServer prior to this method being called - getWiremock(context).start(); - MapPaintUtils.removeMapWithAIPaintStyles(); + final WireMockServer wireMockServer = assertDoesNotThrow(() -> { + final Field serverField = WireMockRuntimeInfo.class.getDeclaredField("wireMockServer"); + ReflectionUtils.setObjectsAccessible(serverField); + return (WireMockServer) serverField.get(getWiremock(context)); + }); try { - // This stops the WireMockServer again. - super.afterAll(context); + wireMockServer.start(); + MapPaintUtils.removeMapWithAIPaintStyles(); + wireMockServer.stop(); } finally { MapWithAIConfig.setUrlsProvider(new InvalidMapWithAIUrls()); } } - - public WireMockServer getWireMockServer() { - return getWiremock(context); - } } class InvalidMapWithAIUrls implements IMapWithAIUrls {