@@ -1522,12 +1522,12 @@ TEST_F(DataserviceReadVersionedLayerClientTest,
1522
1522
TEST_F (DataserviceReadVersionedLayerClientTest, PrefetchAggregatedTile) {
1523
1523
constexpr auto kLayerId = " hype-test-prefetch" ;
1524
1524
1525
- auto client = std::make_shared<read::VersionedLayerClient>(
1526
- kCatalog , kLayerId , boost::none, settings_);
1525
+ const auto requested_tile = geo::TileKey::FromHereTile (" 23618365" );
1526
+
1527
+ read::VersionedLayerClient client (kCatalog , kLayerId , boost::none, settings_);
1527
1528
1528
1529
{
1529
1530
SCOPED_TRACE (" Prefetch aggregated tile" );
1530
- const auto requested_tile = geo::TileKey::FromHereTile (" 23618365" );
1531
1531
1532
1532
EXPECT_CALL (*network_mock_,
1533
1533
Send (IsGetRequest (URL_QUADKEYS_92259), _, _, _, _))
@@ -1540,7 +1540,7 @@ TEST_F(DataserviceReadVersionedLayerClientTest, PrefetchAggregatedTile) {
1540
1540
1541
1541
auto promise = std::make_shared<std::promise<PrefetchTilesResponse>>();
1542
1542
auto future = promise->get_future ();
1543
- auto token = client-> PrefetchTiles (
1543
+ auto token = client. PrefetchTiles (
1544
1544
request, [promise](PrefetchTilesResponse response) {
1545
1545
promise->set_value (std::move (response));
1546
1546
});
@@ -1557,6 +1557,18 @@ TEST_F(DataserviceReadVersionedLayerClientTest, PrefetchAggregatedTile) {
1557
1557
ASSERT_TRUE (tile_response->IsSuccessful ());
1558
1558
ASSERT_TRUE (tile_response->tile_key_ .IsParentOf (requested_tile));
1559
1559
}
1560
+ {
1561
+ SCOPED_TRACE (" Check that the tile is available as aggregated" );
1562
+ EXPECT_TRUE (client.IsCached (requested_tile, true ));
1563
+ EXPECT_FALSE (client.IsCached (requested_tile));
1564
+ }
1565
+ {
1566
+ SCOPED_TRACE (" Check that the tile can be accesed with GetAggregatedData" );
1567
+ auto future = client.GetAggregatedData (
1568
+ read::TileRequest ().WithTileKey (requested_tile));
1569
+ auto result = future.GetFuture ().get ();
1570
+ EXPECT_TRUE (result.IsSuccessful ());
1571
+ }
1560
1572
}
1561
1573
1562
1574
TEST_F (DataserviceReadVersionedLayerClientTest, PrefetchTilesWrongLevels) {
@@ -2983,40 +2995,48 @@ TEST_F(DataserviceReadVersionedLayerClientTest, RemoveFromCacheTileKey) {
2983
2995
}
2984
2996
2985
2997
TEST_F (DataserviceReadVersionedLayerClientTest, CheckIfPartitionCached) {
2986
- EXPECT_CALL (*network_mock_, Send (_, _, _, _, _))
2987
- .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
2988
- HTTP_RESPONSE_LOOKUP))
2989
- .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
2990
- kHttpResponsePartition_269 ))
2991
- .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
2992
- kHttpResponseBlobData_269 ));
2993
-
2994
- auto client = std::make_shared<read::VersionedLayerClient>(
2995
- kCatalog , kTestLayer , kTestVersion , settings_);
2996
-
2997
- // load and cache some data
2998
- auto promise = std::make_shared<std::promise<DataResponse>>();
2999
- auto future = promise->get_future ();
2998
+ settings_.cache = client::OlpClientSettingsFactory::CreateDefaultCache ({});
2999
+ {
3000
+ SCOPED_TRACE (" Download and check" );
3000
3001
3001
- auto data_request = read::DataRequest ().WithPartitionId (kTestPartition );
3002
- auto token = client->GetData (data_request, [promise](DataResponse response) {
3003
- promise->set_value (response);
3004
- });
3002
+ EXPECT_CALL (*network_mock_, Send (_, _, _, _, _))
3003
+ .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
3004
+ HTTP_RESPONSE_LOOKUP))
3005
+ .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
3006
+ kHttpResponsePartition_269 ))
3007
+ .WillOnce (ReturnHttpResponse (GetResponse (http::HttpStatusCode::OK),
3008
+ kHttpResponseBlobData_269 ));
3005
3009
3006
- ASSERT_NE (future. wait_for ( kWaitTimeout ), std::future_status::timeout);
3007
- DataResponse response = future. get ( );
3010
+ read::VersionedLayerClient client ( kCatalog , kTestLayer , kTestVersion ,
3011
+ settings_ );
3008
3012
3009
- ASSERT_TRUE (response.IsSuccessful ()) << response.GetError ().GetMessage ();
3010
- ASSERT_NE (response.GetResult (), nullptr );
3011
- ASSERT_NE (response.GetResult ()->size (), 0u );
3013
+ auto data_request = read::DataRequest ().WithPartitionId (kTestPartition );
3014
+ auto future = client.GetData (data_request).GetFuture ();
3012
3015
3013
- // check the data is available in cache
3014
- ASSERT_TRUE (client-> IsCached ( kTestPartition ) );
3016
+ ASSERT_NE (future. wait_for ( kWaitTimeout ), std::future_status::timeout);
3017
+ DataResponse response = future. get ( );
3015
3018
3016
- // remove the data from cache
3017
- ASSERT_TRUE (client->RemoveFromCache (kTestPartition ));
3019
+ ASSERT_TRUE (response.IsSuccessful ()) << response.GetError ().GetMessage ();
3020
+ ASSERT_NE (response.GetResult (), nullptr );
3021
+ ASSERT_NE (response.GetResult ()->size (), 0u );
3018
3022
3019
- ASSERT_FALSE (client->IsCached (kTestPartition ));
3023
+ // check the data is available in cache
3024
+ ASSERT_TRUE (client.IsCached (kTestPartition ));
3025
+ }
3026
+ {
3027
+ SCOPED_TRACE (" Client without version can't check" );
3028
+ read::VersionedLayerClient client (kCatalog , kTestLayer , boost::none,
3029
+ settings_);
3030
+ EXPECT_FALSE (client.IsCached (kTestPartition ));
3031
+ }
3032
+ {
3033
+ SCOPED_TRACE (" IsCached after removal" );
3034
+ read::VersionedLayerClient client (kCatalog , kTestLayer , kTestVersion ,
3035
+ settings_);
3036
+ ASSERT_TRUE (client.IsCached (kTestPartition ));
3037
+ ASSERT_TRUE (client.RemoveFromCache (kTestPartition ));
3038
+ ASSERT_FALSE (client.IsCached (kTestPartition ));
3039
+ }
3020
3040
}
3021
3041
3022
3042
TEST_F (DataserviceReadVersionedLayerClientTest, CheckIfTileKeyCached) {
0 commit comments