Add TileProvision configuration and gRPC service for tile delivery
ci/woodpecker/push/01-test Pipeline failed
ci/woodpecker/push/02-build-push unknown status

- Introduced new TileProvision settings in appsettings.json, including MaxTilesPerBatch and ProgressEmitIntervalSeconds.
- Configured TileProvisionConfig in Program.cs to bind the new settings.
- Added gRPC service for RouteTileDelivery in Program.cs to handle tile delivery requests.
- Updated SatelliteProvider.Api.csproj to include Grpc.AspNetCore package and added protobuf file for tile provision.
- Enhanced AuthenticationServiceCollectionExtensions to handle JWT token extraction from the Authorization header.
- Registered additional services in RouteManagementServiceCollectionExtensions for tile processing.

These changes enhance the API's capability to manage tile provisioning and delivery efficiently.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-06-23 13:18:59 +03:00
parent 62d6b8310a
commit 275ee1b554
22 changed files with 1469 additions and 3 deletions
@@ -0,0 +1,68 @@
using FluentAssertions;
using Microsoft.Extensions.Options;
using SatelliteProvider.Common.Configs;
using SatelliteProvider.Services.RouteManagement;
using SatelliteProvider.Services.RouteManagement.TileProvision;
namespace SatelliteProvider.Tests;
public class RouteTileExpanderTests
{
private readonly RouteTileExpander _expander = new(
new RoutePointGraphBuilder(Options.Create(new ProcessingConfig { MaxRoutePointSpacingMeters = 200 })),
new GeofenceGridCalculator());
[Fact]
public void Expand_ShortRoute_ProducesTilesForEachWaypointCorridor()
{
var waypoints = new List<(double Lat, double Lon)>
{
(47.0, 37.0),
(47.001, 37.001),
};
var tiles = _expander.Expand(waypoints, regionSizeMeters: 400, zoom: 18, [], includeGeofenceTiles: false);
tiles.Should().NotBeEmpty();
tiles.Select(t => (t.Z, t.X, t.Y)).Should().OnlyHaveUniqueItems();
tiles.Should().OnlyContain(t => t.Z == 18);
}
[Fact]
public void Expand_LongSegment_AddsIntermediateCorridors()
{
var waypoints = new List<(double Lat, double Lon)>
{
(47.0, 37.0),
(47.01, 37.0),
};
var tiles = _expander.Expand(waypoints, regionSizeMeters: 400, zoom: 18, [], includeGeofenceTiles: false);
tiles.Should().NotBeEmpty();
tiles.Select(t => t.RoutePriority).Max().Should().BeGreaterThan(1u);
}
[Fact]
public void Expand_WithGeofence_IncludesGeofenceTilesWhenRequested()
{
var waypoints = new List<(double Lat, double Lon)>
{
(47.0, 37.0),
(47.001, 37.001),
};
var geofence = new List<(double Lat, double Lon)>
{
(47.002, 37.002),
(47.003, 37.002),
(47.003, 37.003),
(47.002, 37.003),
};
var without = _expander.Expand(waypoints, 400, 18, [], false);
var with = _expander.Expand(waypoints, 400, 18, [geofence], true);
with.Count.Should().BeGreaterThan(without.Count);
}
}