Skip to content

Commit

Permalink
[Test Proxy] Maps Render migration (#35924)
Browse files Browse the repository at this point in the history
* Added exports statements to POM required for local testing.

* Changed test classes to use TestProxyTestBase and refactored tests to include the user of a user agent, retry logic and better HTTP logging.

* Updated test recordings.

* Got rid of unused throws statements.

* Updated CustomMatchers to use a more appropriate API to handle header matching.

* Migrated recordings to assets repo.

* Applied PR feedback.
  • Loading branch information
vcolin7 authored Jul 18, 2023
1 parent d4d4172 commit 8b191b0
Show file tree
Hide file tree
Showing 42 changed files with 122 additions and 1,019 deletions.
6 changes: 6 additions & 0 deletions sdk/maps/azure-maps-render/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/maps/azure-maps-render",
"Tag": "java/maps/azure-maps-render_4e569f19be"
}
5 changes: 5 additions & 0 deletions sdk/maps/azure-maps-render/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
<!-- Configures the Java 9+ run to perform the required module exports, opens, and reads that are necessary for testing but shouldn't be part of the module-info. -->
<javaModulesSurefireArgLine>
--add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED
--add-exports com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED
</javaModulesSurefireArgLine>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.min.linecoverage>0.0</jacoco.min.linecoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.azure.maps.render.models.TileIndex;
import com.azure.maps.render.models.TilesetId;

/** Initializes a new instance of the synchronous RenderClient type.
/** Initializes a new instance of the synchronous RenderClient type.
* {@link MapsRenderClient} instances are created via the {@link MapsRenderClientBuilder}, as shown below.
* Creating a sync client using a {@link com.azure.core.credential.AzureKeyCredential}:
* <!-- src_embed com.azure.maps.render.sync.builder.key.instantiation -->
Expand Down Expand Up @@ -61,15 +61,15 @@ public final class MapsRenderClient {
/**
* Initializes an instance of Render client.
*
* @param serviceClient the service client implementation.
* @param asyncClient the service client implementation.
*/
MapsRenderClient(MapsRenderAsyncClient asyncClient) {
this.asyncClient = asyncClient;
}

/**
* Get Map Tile
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_tile -->
* <pre>
* System.out.println&#40;&quot;Get Map Tile&quot;&#41;;
Expand All @@ -95,7 +95,7 @@ public BinaryData getMapTile(MapTileOptions options) {

/**
* Get Map Tile
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_tile -->
* <pre>
* System.out.println&#40;&quot;Get Map Tile&quot;&#41;;
Expand Down Expand Up @@ -127,7 +127,7 @@ public Response<BinaryData> getMapTileWithResponse(MapTileOptions options, Conte

/**
* Get Map Tileset
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_tileset -->
* <pre>
* System.out.println&#40;&quot;Get Map Tileset&quot;&#41;;
Expand All @@ -151,9 +151,9 @@ public MapTileset getMapTileset(TilesetId tilesetId) {

/**
* Get Map Tileset
*
*
* The Get Map Tileset API allows users to request metadata for a tileset.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_tileset -->
* <pre>
* System.out.println&#40;&quot;Get Map Tileset&quot;&#41;;
Expand All @@ -176,7 +176,7 @@ public Response<MapTileset> getMapTilesetWithResponse(TilesetId tilesetId, Conte

/**
* Get Map Attribution
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_attribution -->
* <pre>
* System.out.println&#40;&quot;Get Map Attribution&quot;&#41;;
Expand All @@ -201,10 +201,10 @@ public MapAttribution getMapAttribution(TilesetId tilesetId, int zoom, GeoBoundi

/**
* Get Map Attribution
*
*
* The Get Map Attribution With Response API allows users to request map copyright attribution information for a section of a
* tileset with response
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_attribution -->
* <pre>
* System.out.println&#40;&quot;Get Map Attribution&quot;&#41;;
Expand All @@ -213,7 +213,7 @@ public MapAttribution getMapAttribution(TilesetId tilesetId, int zoom, GeoBoundi
* client.getMapAttribution&#40;TilesetId.MICROSOFT_BASE, 6, bounds&#41;;
* </pre>
* <!-- end com.azure.maps.render.sync.get_map_attribution -->
*
*
* @param tilesetId the tileset id.
* @param zoom Zoom level for the desired map attribution.
* @param bounds the {@code GeoBoundingBox} surrounding the area for which attribution is needed.
Expand Down Expand Up @@ -279,7 +279,7 @@ public Response<Void> downloadMapStateTileWithResponse(OutputStream stream, Stri
*
* As an alternative to copyrights for map request, one can receive captions for displaying the map provider
* information on the map.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_caption -->
* <pre>
* System.out.println&#40;&quot;Get Copyright Caption&quot;&#41;;
Expand All @@ -305,7 +305,7 @@ public CopyrightCaption getCopyrightCaption() {
*
* As an alternative to copyrights for map request, one can receive captions for displaying the map provider
* information on the map.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_caption -->
* <pre>
* System.out.println&#40;&quot;Get Copyright Caption&quot;&#41;;
Expand Down Expand Up @@ -334,7 +334,7 @@ public Response<CopyrightCaption> getCopyrightCaptionWithResponse(Context contex
* like to interact with the rendered map. If the map contents will be relatively unchanging, a static map is a good
* choice. If you want to support a lot of zooming, panning and changing of the map content, the map tile service
* would be a better choice.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_static_image -->
* <pre>
* System.out.println&#40;&quot;Get Map Static Image&quot;&#41;;
Expand Down Expand Up @@ -369,7 +369,7 @@ public BinaryData getMapStaticImage(MapStaticImageOptions options) {
* like to interact with the rendered map. If the map contents will be relatively unchanging, a static map is a good
* choice. If you want to support a lot of zooming, panning and changing of the map content, the map tile service
* would be a better choice.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_map_static_image -->
* <pre>
* System.out.println&#40;&quot;Get Map Static Image&quot;&#41;;
Expand Down Expand Up @@ -402,12 +402,12 @@ public Response<BinaryData> getMapStaticImageWithResponse(MapStaticImageOptions

/**
* Get Copyright From Bounding Box
*
*
* **Applies to**: S0 and S1 pricing tiers.
*
* Returns copyright information for a given bounding box. Bounding-box requests should specify the minimum and
* maximum longitude and latitude (EPSG-3857) coordinates.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_from_bounding_box -->
* <pre>
* GeoBoundingBox boundingBox = new GeoBoundingBox&#40;52.41064, 4.84228, 52.41072, 4.84239&#41;;
Expand All @@ -430,17 +430,17 @@ public Copyright getCopyrightFromBoundingBox(GeoBoundingBox boundingBox, boolean

/**
* Get Copyright From Bounding Box
*
*
* Returns copyright information for a given bounding box with response. Bounding-box requests should specify the minimum and
* maximum longitude and latitude (EPSG-3857) coordinates.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_from_bounding_box -->
* <pre>
* GeoBoundingBox boundingBox = new GeoBoundingBox&#40;52.41064, 4.84228, 52.41072, 4.84239&#41;;
* client.getCopyrightFromBoundingBox&#40;boundingBox, true&#41;;
* </pre>
* <!-- end com.azure.maps.render.sync.get_copyright_from_bounding_box -->
*
*
* @param boundingBox the {@code GeoBoundingBox} for which copyright information is needed.
* @param includeText Yes/no value to exclude textual data from response. Only images and country names will be in
* response.
Expand All @@ -454,14 +454,14 @@ public Response<Copyright> getCopyrightFromBoundingBoxWithResponse(GeoBoundingBo

/**
* Get Copyright For Tile
*
*
* **Applies to**: S0 and S1 pricing tiers.
*
* Copyrights API is designed to serve copyright information for Render Tile service. In addition to basic
* copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the
* copyright information for a given tile. To obtain the copyright information for a particular tile, the request
* should specify the tile's zoom level and x and y coordinates (see: Zoom Levels and Tile Grid).
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_for_tile -->
* <pre>
* client.getCopyrightForTile&#40;new TileIndex&#40;&#41;.setX&#40;9&#41;.setY&#40;22&#41;.setZ&#40;6&#41;, true&#41;;
Expand All @@ -483,18 +483,18 @@ public Copyright getCopyrightForTile(TileIndex tileIndex, boolean includeText) {

/**
* Get Copyright For Tile
*
*
* Copyrights With Response API is designed to serve copyright information for Render Tile service with response. In addition to basic
* copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the
* copyright information for a given tile. To obtain the copyright information for a particular tile, the request
* should specify the tile's zoom level and x and y coordinates (see: Zoom Levels and Tile Grid)
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_for_tile -->
* <pre>
* client.getCopyrightForTile&#40;new TileIndex&#40;&#41;.setX&#40;9&#41;.setY&#40;22&#41;.setZ&#40;6&#41;, true&#41;;
* </pre>
* <!-- end com.azure.maps.render.sync.get_copyright_for_tile -->
*
*
* @param tileIndex Parameter group
* @param includeText Yes/no value to exclude textual data from response. Only images and country names will be in
* response.
Expand All @@ -508,14 +508,14 @@ public Response<Copyright> getCopyrightForTileWithResponse(TileIndex tileIndex,

/**
* Get Copyright For World
*
*
* **Applies to**: S0 and S1 pricing tiers.
*
* Copyrights API is designed to serve copyright information for Render Tile service. In addition to basic
* copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the
* copyright information for the world. To obtain the default copyright information for the whole world, do not
* specify a tile or bounding box.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_for_world -->
* <pre>
* client.getCopyrightForWorld&#40;true&#41;;
Expand All @@ -536,18 +536,18 @@ public Copyright getCopyrightForWorld(boolean includeText) {

/**
* Get Copyright For World
*
*
* Copyrights with response API is designed to serve copyright information with response for Render Tile service. In addition to basic
* copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the
* copyright information for the world. To obtain the default copyright information for the whole world, do not
* specify a tile or bounding box.
*
*
* <!-- src_embed com.azure.maps.render.sync.get_copyright_for_world -->
* <pre>
* client.getCopyrightForWorld&#40;true&#41;;
* </pre>
* <!-- end com.azure.maps.render.sync.get_copyright_for_world -->
*
*
* @param includeText Yes/no value to exclude textual data from response. Only images and country names will be in
* response.
* @param context the context associated with this operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ public final class MapsRenderClientBuilder implements AzureKeyCredentialTrait<Ma
private static final ClientLogger LOGGER = new ClientLogger(MapsRenderClientBuilder.class);
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private static final String RENDER_SUBSCRIPTION_KEY = "subscription-key";
private static final String X_MS_CLIENT_ID = "x-ms-client-id";
private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy();

// subscription key
static final String RENDER_SUBSCRIPTION_KEY = "subscription-key";

// instance fields
private final Map<String, String> properties = new HashMap<>();
private String endpoint;
Expand Down
Loading

0 comments on commit 8b191b0

Please sign in to comment.