public async Task Setup() { RemoveTestData(); await PrepareTestDataAsync(); var tileSources = new[] { new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "world-mercator-hd", Abstract = "World map", Location = MbtilesFilePath1, }, new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "small-area", Abstract = "Small area map", Location = MbtilesFilePath2, }, new SourceConfiguration { Type = SourceConfiguration.TypeLocalFiles, Title = "World Geodetic EPSG:4326", Id = "world-geodetic", Location = LocalFilesPath + "\\{z}\\{x}\\{y}.jpg", Srs = Utils.SrsCodes.EPSG4326, Format = ImageFormats.Jpeg, MinZoom = 0, MaxZoom = 3, }, }; this.client = new HttpClient { BaseAddress = new Uri(TestConfiguration.BaseUrl), }; var json = JsonSerializer.Serialize(new { Sources = tileSources }); this.serviceHost = await TestsUtility.CreateAndRunServiceHostAsync(json, TestConfiguration.portNumber); var tileSources2 = new[] { // TODO: add TMS proxy test (init source after service started) new SourceConfiguration { Type = SourceConfiguration.TypeTms, Id = "tms-proxy", Title = "Proxy to world-mercator-hd", Format = "png", Location = TestConfiguration.BaseUrl + "/tms/1.0.0/world-mercator-hd", }, }; var json2 = JsonSerializer.Serialize(new { Sources = tileSources2 }); this.serviceHost2 = await TestsUtility.CreateAndRunServiceHostAsync(json2, TestConfiguration.portNumber + 1); }
public async Task Setup() { RemoveTestData(); await PrepareTestDataAsync(); var tileSources = new[] { new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "world-mercator-hd", Title = "world-mercator-hd (png)", Location = MbtilesFilePath1, }, new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "small-area", Title = "small-area (jpeg)", Location = MbtilesFilePath2, }, new SourceConfiguration { Type = SourceConfiguration.TypeLocalFiles, Title = "World Geodetic EPSG:4326", Id = "world-geodetic", Location = LocalFilesPath + "\\{z}\\{x}\\{y}.jpg", Srs = Utils.SrsCodes.EPSG4326, Format = ImageFormats.Jpeg, MinZoom = 0, MaxZoom = 3, }, }; this.client = new HttpClient { BaseAddress = new Uri(TestConfiguration.BaseUrl), }; var json = JsonSerializer.Serialize( new { Sources = tileSources, Service = new { keywords = "service,tile" } }); this.serviceHost = await TestsUtility.CreateAndRunServiceHostAsync(json, TestConfiguration.portNumber); // TODO: proxy source }
public async Task GetWmtsCapabilitiesAsync() { var r = await client.GetAsync("/wmts?service=WMTS&request=GetCapabilities"); Assert.AreEqual(HttpStatusCode.OK, r.StatusCode); var expectedXml = Encoding.UTF8.GetString(TestsUtility.ReadResource("Expected.wmts_GetCapabilities.xml")); var actualXml = await r.Content.ReadAsStringAsync(); expectedXml = TestsUtility.UpdateXmlContents(expectedXml, TestConfiguration.portNumber); TestsUtility.CompareXml(expectedXml, actualXml); }
public async Task GetTmsTileMap3Async() { var r = await client.GetAsync("/tms/1.0.0/source3"); Assert.AreEqual(HttpStatusCode.OK, r.StatusCode); var expectedXml = Encoding.UTF8.GetString(TestsUtility.ReadResource("Expected.tms_capabilities_TileMap3.xml")); var actualXml = await r.Content.ReadAsStringAsync(); expectedXml = TestsUtility.UpdateXmlContents(expectedXml, TestConfiguration.portNumber); TestsUtility.CompareXml(expectedXml, actualXml); }
public async Task Setup() { var tileSources = new[] { new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "world-countries", Location = Mbtiles1FilePath, MinZoom = 0, MaxZoom = 18, }, new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "world-satellite-imagery", Title = null, // will be used from mbtiles metadata Location = Mbtiles2FilePath, }, new SourceConfiguration { Type = SourceConfiguration.TypeMBTiles, Id = "caspian-sea", Title = null, // will be used from mbtiles metadata Location = Mbtiles3FilePath, }, new SourceConfiguration { Type = SourceConfiguration.TypeLocalFiles, Id = "source3", Title = "Tile Source 3", Location = LocalFilesPath + "\\{z}\\{x}\\{y}.png", MinZoom = 0, MaxZoom = 2, Format = ImageFormats.Png, Tms = false, }, new SourceConfiguration { Type = SourceConfiguration.TypeXyz, Id = "httpproxy", Title = "HTTP proxy to world-countries", Location = TestConfiguration.BaseUrl + "/xyz/world-countries/{z}/{x}/{y}.png", Format = ImageFormats.Png, MinZoom = 0, MaxZoom = 2, }, // TODO: EPSG:4326 source }; RemoveTestData(); PrepareTestData(); CreateLocalTiles(tileSources[3]); this.client = new HttpClient { BaseAddress = new Uri(TestConfiguration.BaseUrl), }; var json = JsonSerializer.Serialize(new { Sources = tileSources, Service = new ServiceProperties { Title = "WMTS Service", Abstract = String.Empty }, }); this.serviceHost = await TestsUtility.CreateAndRunServiceHostAsync(json, TestConfiguration.portNumber); }