Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/external_resources.txt3
-rw-r--r--defines.hpp3
-rw-r--r--editor/osm_editor.cpp2
-rw-r--r--generator/generator_tool/generator_tool.cpp8
-rw-r--r--map/framework.cpp96
-rw-r--r--map/framework.hpp7
-rw-r--r--map/map_tests/check_mwms.cpp5
-rw-r--r--platform/local_country_file_utils.cpp34
-rw-r--r--platform/local_country_file_utils.hpp6
-rw-r--r--platform/mwm_version.hpp8
-rw-r--r--platform/platform_android.cpp1
-rw-r--r--platform/platform_tests/country_file_tests.cpp17
-rw-r--r--platform/platform_tests/local_country_file_tests.cpp60
-rw-r--r--platform/platform_tests/platform_test.cpp8
-rw-r--r--qt/search_panel.cpp34
-rw-r--r--qt/search_panel.hpp1
-rw-r--r--routing/routing_integration_tests/routing_test_tools.cpp1
-rw-r--r--search/search_quality/helpers.cpp3
-rw-r--r--storage/country_info_getter.cpp22
-rw-r--r--storage/country_info_getter.hpp17
-rw-r--r--storage/country_info_reader_light.cpp1
-rw-r--r--storage/country_tree.cpp199
-rw-r--r--storage/country_tree.hpp8
-rw-r--r--storage/storage.cpp85
-rw-r--r--storage/storage.hpp19
-rw-r--r--storage/storage_integration_tests/CMakeLists.txt1
-rw-r--r--storage/storage_integration_tests/download_calc_size_test.cpp2
-rw-r--r--storage/storage_integration_tests/migrate_tests.cpp123
-rw-r--r--storage/storage_integration_tests/storage_3levels_tests.cpp1
-rw-r--r--storage/storage_integration_tests/storage_downloading_tests.cpp11
-rw-r--r--storage/storage_integration_tests/storage_group_download_tests.cpp4
-rw-r--r--storage/storage_integration_tests/storage_http_tests.cpp17
-rw-r--r--storage/storage_integration_tests/storage_update_tests.cpp2
-rw-r--r--storage/storage_tests/country_info_getter_tests.cpp79
-rw-r--r--storage/storage_tests/helpers.cpp5
-rw-r--r--storage/storage_tests/helpers.hpp1
-rw-r--r--storage/storage_tests/storage_tests.cpp347
37 files changed, 112 insertions, 1129 deletions
diff --git a/data/external_resources.txt b/data/external_resources.txt
index 0c55404429..20a2e8f48d 100644
--- a/data/external_resources.txt
+++ b/data/external_resources.txt
@@ -6,5 +6,4 @@
06_code2000.ttf 3155104
07_roboto_medium.ttf 162588
World.mwm 33464521
-WorldCoasts.mwm 4677305
-WorldCoasts_obsolete.mwm 4513802
+WorldCoasts.mwm 4677305 \ No newline at end of file
diff --git a/defines.hpp b/defines.hpp
index 84e5be7507..a9bbe43c3e 100644
--- a/defines.hpp
+++ b/defines.hpp
@@ -76,11 +76,9 @@
#define COUNTRIES_FILE "countries.txt"
#define COUNTRIES_META_FILE "countries_meta.txt"
-#define COUNTRIES_OBSOLETE_FILE "countries_obsolete.txt"
#define WORLD_FILE_NAME "World"
#define WORLD_COASTS_FILE_NAME "WorldCoasts"
-#define WORLD_COASTS_OBSOLETE_FILE_NAME "WorldCoasts_obsolete"
#define SETTINGS_FILE_NAME "settings.ini"
#define MARKETING_SETTINGS_FILE_NAME "marketing_settings.ini"
@@ -91,7 +89,6 @@
#define PACKED_POLYGONS_INFO_TAG "info"
#define PACKED_POLYGONS_FILE "packed_polygons.bin"
-#define PACKED_POLYGONS_OBSOLETE_FILE "packed_polygons_obsolete.bin"
#define EXTERNAL_RESOURCES_FILE "external_resources.txt"
diff --git a/editor/osm_editor.cpp b/editor/osm_editor.cpp
index 733da6bc0d..a8b0ad6179 100644
--- a/editor/osm_editor.cpp
+++ b/editor/osm_editor.cpp
@@ -545,8 +545,6 @@ EditableProperties Editor::GetEditableProperties(FeatureType & feature) const
auto const & fid = feature.GetID();
auto const featureStatus = GetFeatureStatusImpl(*features, fid.m_mwmId, fid.m_index);
- ASSERT(version::IsSingleMwm(feature.GetID().m_mwmId.GetInfo()->m_version.GetVersion()),
- ("Edit mode should be available only on new data"));
ASSERT(featureStatus != FeatureStatus::Obsolete,
("Edit mode should not be available on obsolete features"));
diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp
index d0cd24be9c..e8d07d45ad 100644
--- a/generator/generator_tool/generator_tool.cpp
+++ b/generator/generator_tool/generator_tool.cpp
@@ -435,8 +435,8 @@ MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
{
// All the mwms should use proper VehicleModels.
LOG(LCRITICAL,
- ("Countries file is needed. Please set countries file name (countries.txt or "
- "countries_obsolete.txt). File must be located in data directory."));
+ ("Countries file is needed. Please set countries file name (countries.txt). "
+ "File must be located in data directory."));
return EXIT_FAILURE;
}
@@ -473,8 +473,8 @@ MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
{
// All the mwms should use proper VehicleModels.
LOG(LCRITICAL,
- ("Countries file is needed. Please set countries file name (countries.txt or "
- "countries_obsolete.txt). File must be located in data directory."));
+ ("Countries file is needed. Please set countries file name (countries.txt). "
+ "File must be located in data directory."));
return EXIT_FAILURE;
}
diff --git a/map/framework.cpp b/map/framework.cpp
index cc203951fb..79887143ab 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -343,81 +343,11 @@ void Framework::OnViewportChanged(ScreenBase const & screen)
m_viewportChangedFn(screen);
}
-bool Framework::IsEnoughSpaceForMigrate() const
-{
- return GetPlatform().GetWritableStorageStatus(GetStorage().GetMaxMwmSizeBytes()) ==
- Platform::TStorageStatus::STORAGE_OK;
-}
-
-CountryId Framework::PreMigrate(ms::LatLon const & position,
- Storage::ChangeCountryFunction const & change,
- Storage::ProgressFunction const & progress)
-{
- GetStorage().PrefetchMigrateData();
-
- auto const infoGetter =
- CountryInfoReader::CreateCountryInfoReader(GetPlatform());
-
- CountryId currentCountryId = infoGetter->GetRegionCountryId(MercatorBounds::FromLatLon(position));
-
- if (currentCountryId == kInvalidCountryId)
- return kInvalidCountryId;
-
- GetStorage().GetPrefetchStorage()->Subscribe(change, progress);
- GetStorage().GetPrefetchStorage()->DownloadNode(currentCountryId);
- return currentCountryId;
-}
-
-void Framework::Migrate(bool keepDownloaded)
-{
- // Drape must be suspended while migration is performed since it access different parts of
- // framework (i.e. m_infoGetter) which are reinitialized during migration process.
- // If we do not suspend drape, it tries to access framework fields (i.e. m_infoGetter) which are null
- // while migration is performed.
- if (m_drapeEngine && m_isRenderingEnabled)
- {
- m_drapeEngine->SetRenderingDisabled(true);
- OnDestroySurface();
- }
- m_bmManager->ResetRegionAddressGetter();
- m_discoveryManager.reset();
- m_searchAPI.reset();
- m_infoGetter.reset();
- m_taxiEngine.reset();
- m_cityFinder.reset();
- CountriesVec existedCountries;
- GetStorage().DeleteAllLocalMaps(&existedCountries);
- DeregisterAllMaps();
- m_featuresFetcher.Clear();
- GetStorage().Migrate(keepDownloaded ? existedCountries : CountriesVec());
- InitCountryInfoGetter();
- InitSearchAPI();
- InitCityFinder();
- InitDiscoveryManager();
- InitTaxiEngine();
- RegisterAllMaps();
- m_notificationManager.SetDelegate(
- std::make_unique<NotificationManagerDelegate>(m_featuresFetcher.GetDataSource(), *m_cityFinder,
- m_addressGetter, *m_ugcApi));
-
- m_trafficManager.SetCurrentDataVersion(GetStorage().GetCurrentDataVersion());
- m_bmManager->InitRegionAddressGetter(m_featuresFetcher.GetDataSource(), *m_infoGetter);
- if (m_drapeEngine && m_isRenderingEnabled)
- {
- m_drapeEngine->SetRenderingEnabled();
- OnRecoverSurface(m_currentModelView.PixelRectIn3d().SizeX(),
- m_currentModelView.PixelRectIn3d().SizeY(),
- true /* recreateContextDependentResources */);
- }
- InvalidateRect(MercatorBounds::FullRect());
-}
-
Framework::Framework(FrameworkParams const & params)
: m_localAdsManager(bind(&Framework::GetMwmsByRect, this, _1, true /* rough */),
bind(&Framework::GetMwmIdByName, this, _1),
bind(&Framework::ReadFeatures, this, _1, _2),
bind(&Framework::GetMapObjectByID, this, _1))
- , m_storage(platform::migrate::NeedMigrate() ? COUNTRIES_OBSOLETE_FILE : COUNTRIES_FILE)
, m_enabledDiffs(params.m_enableDiffs)
, m_isRenderingEnabled(true)
, m_transitManager(m_featuresFetcher.GetDataSource(),
@@ -521,8 +451,6 @@ Framework::Framework(FrameworkParams const & params)
InitDiscoveryManager();
InitTaxiEngine();
- // All members which re-initialize in Migrate() method should be initialized before RegisterAllMaps().
- // Migrate() can be called from RegisterAllMaps().
RegisterAllMaps();
LOG(LDEBUG, ("Maps initialized"));
@@ -759,20 +687,6 @@ void Framework::RegisterAllMaps()
m_storage.RegisterAllLocalMaps(m_enabledDiffs);
- // Fast migrate in case there are no downloaded MWM.
- if (platform::migrate::NeedMigrate())
- {
- bool disableFastMigrate;
- if (!settings::Get("DisableFastMigrate", disableFastMigrate))
- disableFastMigrate = false;
- if (!disableFastMigrate && !m_storage.HaveDownloadedCountries())
- {
- GetStorage().PrefetchMigrateData();
- Migrate();
- return;
- }
- }
-
int minFormat = numeric_limits<int>::max();
char const * kLastDownloadedMapsCheck = "LastDownloadedMapsCheck";
@@ -1541,10 +1455,7 @@ void Framework::InitCountryInfoGetter()
ASSERT(!m_infoGetter.get(), ("InitCountryInfoGetter() must be called only once."));
auto const & platform = GetPlatform();
- if (platform::migrate::NeedMigrate())
- m_infoGetter = CountryInfoReader::CreateCountryInfoReaderObsolete(platform);
- else
- m_infoGetter = CountryInfoReader::CreateCountryInfoReader(platform);
+ m_infoGetter = CountryInfoReader::CreateCountryInfoReader(platform);
m_infoGetter->SetAffiliations(&m_storage.GetAffiliations());
}
@@ -1635,9 +1546,6 @@ string Framework::GetCountryName(m2::PointD const & pt) const
Framework::DoAfterUpdate Framework::ToDoAfterUpdate() const
{
- if (platform::migrate::NeedMigrate())
- return DoAfterUpdate::Migrate;
-
auto const connectionStatus = Platform::ConnectionStatus();
if (connectionStatus == Platform::EConnectionType::CONNECTION_NONE)
return DoAfterUpdate::Nothing;
@@ -3340,7 +3248,7 @@ void SetHostingBuildingAddress(FeatureID const & hostingBuildingFid, DataSource
bool Framework::CanEditMap() const
{
- return version::IsSingleMwm(GetCurrentDataVersion()) && !GetStorage().IsDownloadInProgress();
+ return !GetStorage().IsDownloadInProgress();
}
bool Framework::CreateMapObject(m2::PointD const & mercator, uint32_t const featureType,
diff --git a/map/framework.hpp b/map/framework.hpp
index 20ffd08805..0d51ff6510 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -288,13 +288,6 @@ public:
User & GetUser() { return m_user; }
User const & GetUser() const { return m_user; }
- /// Migrate to new version of very different data.
- bool IsEnoughSpaceForMigrate() const;
- storage::CountryId PreMigrate(ms::LatLon const & position,
- storage::Storage::ChangeCountryFunction const & change,
- storage::Storage::ProgressFunction const & progress);
- void Migrate(bool keepDownloaded = true);
-
/// \returns true if there're unsaved changes in map with |countryId| and false otherwise.
/// \note It works for group and leaf node.
bool HasUnsavedEdits(storage::CountryId const & countryId);
diff --git a/map/map_tests/check_mwms.cpp b/map/map_tests/check_mwms.cpp
index 993b82d498..6890dcabfd 100644
--- a/map/map_tests/check_mwms.cpp
+++ b/map/map_tests/check_mwms.cpp
@@ -37,11 +37,6 @@ UNIT_TEST(CheckMWM_LoadAll)
{
auto p = m.RegisterMap(localFile);
- // Normally we do not load maps older than March 2016, but we keep WorldCoasts_obsolete.mwm
- // for migration tests.
- if (localFile.GetCountryName() == WORLD_COASTS_OBSOLETE_FILE_NAME)
- continue;
-
TEST(p.first.IsAlive(), ());
TEST_EQUAL(MwmSet::RegResult::Success, p.second, ());
}
diff --git a/platform/local_country_file_utils.cpp b/platform/local_country_file_utils.cpp
index 63465de6ba..b705461f04 100644
--- a/platform/local_country_file_utils.cpp
+++ b/platform/local_country_file_utils.cpp
@@ -27,27 +27,6 @@ using namespace std;
namespace platform
{
-namespace migrate
-{
-// Set of functions to support migration between different versions of MWM
-// with totaly incompatible formats.
-// 160302 - Migrate to small single file MWM
-uint32_t constexpr kMinRequiredVersion = 160302;
-bool NeedMigrate()
-{
- uint32_t version;
- if (!settings::Get("LastMigration", version))
- return true;
-
- if (version >= kMinRequiredVersion)
- return false;
-
- return true;
-}
-
-void SetMigrationFlag() { settings::Set("LastMigration", kMinRequiredVersion); }
-} // namespace migrate
-
namespace
{
char const kBitsExt[] = ".bftsegbits";
@@ -204,16 +183,6 @@ void FindAllLocalMapsInDirectoryAndCleanup(string const & directory, int64_t ver
names.insert(name);
LocalCountryFile localFile(directory, CountryFile(name), version);
- // Delete Brazil.mwm and Japan.mwm maps, because they were
- // replaced with smaller regions after osrm routing
- // implementation.
- if (name == "Japan" || name == "Brazil")
- {
- localFile.SyncWithDisk();
- localFile.DeleteFromDisk(MapFileType::Map);
- continue;
- }
-
localFiles.push_back(localFile);
}
@@ -278,8 +247,7 @@ void FindAllLocalMapsAndCleanup(int64_t latestVersion, string const & dataDir,
// World and WorldCoasts can be stored in app bundle or in resources
// directory, thus it's better to get them via Platform.
string const world(WORLD_FILE_NAME);
- string const worldCoasts(migrate::NeedMigrate() ? WORLD_COASTS_OBSOLETE_FILE_NAME
- : WORLD_COASTS_FILE_NAME);
+ string const worldCoasts(WORLD_COASTS_FILE_NAME);
for (string const & file : {world, worldCoasts})
{
auto i = localFiles.begin();
diff --git a/platform/local_country_file_utils.hpp b/platform/local_country_file_utils.hpp
index 43090d1e34..9a8a7f6dd8 100644
--- a/platform/local_country_file_utils.hpp
+++ b/platform/local_country_file_utils.hpp
@@ -11,12 +11,6 @@ class ModelReader;
namespace platform
{
-namespace migrate
-{
-bool NeedMigrate();
-void SetMigrationFlag();
-}
-
// Removes all files downloader creates during downloading of a country.
// Note. The the maps are deleted from writable dir/|dataDir|/|version| directory.
// If |dataDir| is empty (or is not set) the function deletes maps from writable dir.
diff --git a/platform/mwm_version.hpp b/platform/mwm_version.hpp
index 2b87f7c779..8e418fc03c 100644
--- a/platform/mwm_version.hpp
+++ b/platform/mwm_version.hpp
@@ -79,10 +79,8 @@ MwmType GetMwmType(MwmVersion const & version);
/// which should be processed as either single or two components (mwm and routing) mwms.
enum ForTesting
{
- FOR_TESTING_TWO_COMPONENT_MWM1 = 10,
- FOR_TESTING_TWO_COMPONENT_MWM2,
- FOR_TESTING_SINGLE_MWM1 = 991215,
- FOR_TESTING_SINGLE_MWM2,
- FOR_TESTING_SINGLE_MWM_LATEST,
+ FOR_TESTING_MWM1 = 991215,
+ FOR_TESTING_MWM2,
+ FOR_TESTING_MWM_LATEST,
};
} // namespace version
diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp
index 296d36ec99..475a665834 100644
--- a/platform/platform_android.cpp
+++ b/platform/platform_android.cpp
@@ -42,7 +42,6 @@ bool IsResource(string const & file, string const & ext)
if (ext == DATA_FILE_EXTENSION)
{
return (strings::StartsWith(file, WORLD_COASTS_FILE_NAME) ||
- strings::StartsWith(file, WORLD_COASTS_OBSOLETE_FILE_NAME) ||
strings::StartsWith(file, WORLD_FILE_NAME));
}
else if (ext == BOOKMARKS_FILE_EXTENSION ||
diff --git a/platform/platform_tests/country_file_tests.cpp b/platform/platform_tests/country_file_tests.cpp
index 3375efcea3..0e0a009120 100644
--- a/platform/platform_tests/country_file_tests.cpp
+++ b/platform/platform_tests/country_file_tests.cpp
@@ -11,22 +11,7 @@ using namespace std;
namespace platform
{
-UNIT_TEST(CountryFile_SmokeTwoComponentMwm)
-{
- CountryFile countryFile("TestCountry");
- TEST_EQUAL("TestCountry", countryFile.GetName(), ());
- string const mapFileName =
- GetFileName(countryFile.GetName(), MapFileType::Map);
- TEST_EQUAL("TestCountry" DATA_FILE_EXTENSION, mapFileName, ());
-
- TEST_EQUAL(0, countryFile.GetRemoteSize(), ());
-
- countryFile.SetRemoteSize(1 /* mapSize */);
-
- TEST_EQUAL(1, countryFile.GetRemoteSize(), ());
-}
-
-UNIT_TEST(CountryFile_SmokeOneComponentMwm)
+UNIT_TEST(CountryFile_Smoke)
{
CountryFile countryFile("TestCountryOneComponent");
TEST_EQUAL("TestCountryOneComponent", countryFile.GetName(), ());
diff --git a/platform/platform_tests/local_country_file_tests.cpp b/platform/platform_tests/local_country_file_tests.cpp
index b1e65ccf30..3ca8ace791 100644
--- a/platform/platform_tests/local_country_file_tests.cpp
+++ b/platform/platform_tests/local_country_file_tests.cpp
@@ -88,8 +88,7 @@ UNIT_TEST(LocalCountryFile_Smoke)
TEST_EQUAL(150309, localFile.GetVersion(), ());
}
-// Creates test country map file and routing file and checks
-// sync-with-disk functionality.
+// Creates test country map file and checks sync-with-disk functionality.
UNIT_TEST(LocalCountryFile_DiskFiles)
{
Platform & platform = GetPlatform();
@@ -122,61 +121,6 @@ UNIT_TEST(LocalCountryFile_DiskFiles)
}
}
-UNIT_TEST(LocalCountryFile_CleanupMapFiles)
-{
- Platform & platform = GetPlatform();
- string const mapsDir = platform.WritableDir();
-
- // Two fake directories for test country files and indexes.
- ScopedDir dir3("3");
- ScopedDir dir4("4");
-
- ScopedDir absentCountryIndexesDir(dir4, "Absent");
- ScopedDir irelandIndexesDir(dir4, "Ireland");
-
- CountryFile japanFile("Japan");
- CountryFile brazilFile("Brazil");
- CountryFile irelandFile("Ireland");
-
- LocalCountryFile japanLocalFile(mapsDir, japanFile, 0 /* version */);
- ScopedFile japanMapFile("Japan.mwm", ScopedFile::Mode::Create);
-
- LocalCountryFile brazilLocalFile(mapsDir, brazilFile, 0 /* version */);
- ScopedFile brazilMapFile("Brazil.mwm", ScopedFile::Mode::Create);
-
- LocalCountryFile irelandLocalFile(dir4.GetFullPath(), irelandFile, 4 /* version */);
- ScopedFile irelandMapFile(dir4, irelandFile, MapFileType::Map);
-
- // Check FindAllLocalMaps()
- vector<LocalCountryFile> localFiles;
- FindAllLocalMapsAndCleanup(4 /* latestVersion */, localFiles);
- TEST(!Contains(localFiles, japanLocalFile), (japanLocalFile, localFiles));
- TEST(!Contains(localFiles, brazilLocalFile), (brazilLocalFile, localFiles));
- TEST(Contains(localFiles, irelandLocalFile), (irelandLocalFile, localFiles));
-
- TEST(!japanMapFile.Exists(), (japanMapFile));
- japanMapFile.Reset();
-
- TEST(!brazilMapFile.Exists(), (brazilMapFile));
- brazilMapFile.Reset();
-
- irelandLocalFile.SyncWithDisk();
- TEST(irelandLocalFile.OnDisk(MapFileType::Map), ());
- irelandLocalFile.DeleteFromDisk(MapFileType::Map);
- TEST(!irelandMapFile.Exists(), (irelandMapFile));
- irelandMapFile.Reset();
-
- TEST(!dir3.Exists(), ("Empty directory", dir3, "wasn't removed."));
- dir3.Reset();
-
- TEST(dir4.Exists(), ());
-
- TEST(!absentCountryIndexesDir.Exists(), ("Indexes for absent country weren't deleted."));
- absentCountryIndexesDir.Reset();
-
- TEST(irelandIndexesDir.Exists(), ());
-}
-
UNIT_TEST(LocalCountryFile_CleanupPartiallyDownloadedFiles)
{
ScopedDir oldDir("101009");
@@ -274,7 +218,7 @@ UNIT_TEST(LocalCountryFile_AllLocalFilesLookup)
worldFound = true;
TEST_NOT_EQUAL(0, file.GetVersion(), (file));
}
- if (file.GetCountryName() == WORLD_COASTS_OBSOLETE_FILE_NAME)
+ if (file.GetCountryName() == WORLD_COASTS_FILE_NAME)
{
worldCoastsFound = true;
TEST_NOT_EQUAL(0, file.GetVersion(), (file));
diff --git a/platform/platform_tests/platform_test.cpp b/platform/platform_tests/platform_test.cpp
index 341eca27d5..b2516e2480 100644
--- a/platform/platform_tests/platform_test.cpp
+++ b/platform/platform_tests/platform_test.cpp
@@ -250,14 +250,6 @@ UNIT_TEST(RmDirRecursively)
TEST(!Platform::IsFileExistsByFullPath(testDir2), ());
}
-UNIT_TEST(IsSingleMwm)
-{
- TEST(version::IsSingleMwm(version::FOR_TESTING_SINGLE_MWM1), ());
- TEST(version::IsSingleMwm(version::FOR_TESTING_SINGLE_MWM_LATEST), ());
- TEST(!version::IsSingleMwm(version::FOR_TESTING_TWO_COMPONENT_MWM1), ());
- TEST(!version::IsSingleMwm(version::FOR_TESTING_TWO_COMPONENT_MWM2), ());
-}
-
UNIT_TEST(MkDirRecursively)
{
using namespace platform::tests_support;
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp
index 32cb7d6e34..dfa9e9126d 100644
--- a/qt/search_panel.cpp
+++ b/qt/search_panel.cpp
@@ -169,38 +169,6 @@ bool SearchPanel::Try3dModeCmd(QString const & str)
return true;
}
-bool SearchPanel::TryMigrate(QString const & str)
-{
- bool const isMigrate = (str == "?migrate");
-
- if (!isMigrate)
- return false;
-
- m_pEditor->setText("");
- parentWidget()->hide();
-
- auto const stateChanged = [&](storage::CountryId const & id) {
- storage::Status const nextStatus = m_pDrawWidget->GetFramework().GetStorage().GetPrefetchStorage()->CountryStatusEx(id);
- LOG_SHORT(LINFO, (id, "status :", nextStatus));
- if (nextStatus == storage::Status::EOnDisk)
- {
- LOG_SHORT(LINFO, ("Prefetch done. Ready to migrate."));
- m_pDrawWidget->GetFramework().Migrate();
- }
- };
-
- auto const progressChanged = [](storage::CountryId const & id,
- storage::MapFilesDownloader::Progress const & sz) {
- LOG(LINFO, (id, "downloading progress:", sz));
- };
-
- ms::LatLon curPos(55.7, 37.7);
-
- m_pDrawWidget->GetFramework().PreMigrate(curPos, stateChanged, progressChanged);
- return true;
-
-}
-
bool SearchPanel::TryDisplacementModeCmd(QString const & str)
{
bool const isDefaultDisplacementMode = (str == "?dm:default");
@@ -247,8 +215,6 @@ void SearchPanel::OnSearchTextChanged(QString const & str)
return;
if (Try3dModeCmd(normalized))
return;
- if (TryMigrate(normalized))
- return;
if (TryDisplacementModeCmd(normalized))
return;
if (TryTrafficSimplifiedColorsCmd(normalized))
diff --git a/qt/search_panel.hpp b/qt/search_panel.hpp
index aac32cd802..6f4bb93a01 100644
--- a/qt/search_panel.hpp
+++ b/qt/search_panel.hpp
@@ -58,7 +58,6 @@ private slots:
bool TryChangeRouterCmd(QString const & str);
bool Try3dModeCmd(QString const & str);
- bool TryMigrate(QString const & str);
bool TryDisplacementModeCmd(QString const & str);
bool TryTrafficSimplifiedColorsCmd(QString const & str);
};
diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp
index fbaf3ec91a..b4a1586a55 100644
--- a/routing/routing_integration_tests/routing_test_tools.cpp
+++ b/routing/routing_integration_tests/routing_test_tools.cpp
@@ -132,7 +132,6 @@ void GetAllLocalFiles(vector<LocalCountryFile> & localFiles)
if (options.m_resourcePath)
pl.SetResourceDir(options.m_resourcePath);
- platform::migrate::SetMigrationFlag();
platform::FindAllLocalMapsAndCleanup(numeric_limits<int64_t>::max() /* latestVersion */,
localFiles);
for (auto & file : localFiles)
diff --git a/search/search_quality/helpers.cpp b/search/search_quality/helpers.cpp
index 6051aa1f1a..b0ffbfe8c4 100644
--- a/search/search_quality/helpers.cpp
+++ b/search/search_quality/helpers.cpp
@@ -38,8 +38,7 @@ namespace
{
uint64_t ReadVersionFromHeader(platform::LocalCountryFile const & mwm)
{
- vector<string> const kSpecialFiles = {WORLD_FILE_NAME, WORLD_COASTS_FILE_NAME,
- WORLD_COASTS_OBSOLETE_FILE_NAME};
+ vector<string> const kSpecialFiles = {WORLD_FILE_NAME, WORLD_COASTS_FILE_NAME};
for (auto const & name : kSpecialFiles)
{
if (mwm.GetCountryName() == name)
diff --git a/storage/country_info_getter.cpp b/storage/country_info_getter.cpp
index 2dda854e9d..faba3c0b84 100644
--- a/storage/country_info_getter.cpp
+++ b/storage/country_info_getter.cpp
@@ -203,23 +203,6 @@ std::unique_ptr<CountryInfoGetter> CountryInfoReader::CreateCountryInfoReader(
return std::unique_ptr<CountryInfoReader>();
}
-// static
-std::unique_ptr<CountryInfoGetter> CountryInfoReader::CreateCountryInfoReaderObsolete(
- Platform const & platform)
-{
- try
- {
- CountryInfoReader * result = new CountryInfoReader(platform.GetReader(PACKED_POLYGONS_OBSOLETE_FILE),
- platform.GetReader(COUNTRIES_OBSOLETE_FILE));
- return std::unique_ptr<CountryInfoReader>(result);
- }
- catch (RootException const & e)
- {
- LOG(LCRITICAL, ("Can't load needed resources for storage::CountryInfoGetter:", e.Msg()));
- }
- return std::unique_ptr<CountryInfoReader>();
-}
-
void CountryInfoReader::LoadRegionsFromDisk(size_t id, std::vector<m2::RegionD> & regions) const
{
regions.clear();
@@ -235,7 +218,7 @@ void CountryInfoReader::LoadRegionsFromDisk(size_t id, std::vector<m2::RegionD>
}
CountryInfoReader::CountryInfoReader(ModelReaderPtr polyR, ModelReaderPtr countryR)
- : CountryInfoGetter(true), m_reader(polyR), m_cache(3 /* logCacheSize */)
+ : m_reader(polyR), m_cache(3 /* logCacheSize */)
{
ReaderSource<ModelReaderPtr> src(m_reader.GetReader(PACKED_POLYGONS_INFO_TAG));
@@ -247,7 +230,7 @@ CountryInfoReader::CountryInfoReader(ModelReaderPtr polyR, ModelReaderPtr countr
std::string buffer;
countryR.ReadAsString(buffer);
- LoadCountryFile2CountryInfo(buffer, m_idToInfo, m_isSingleMwm);
+ LoadCountryFile2CountryInfo(buffer, m_idToInfo);
}
void CountryInfoReader::ClearCachesImpl() const
@@ -333,7 +316,6 @@ bool CountryInfoReader::IsCloseEnough(size_t id, m2::PointD const & pt, double d
// CountryInfoGetterForTesting ---------------------------------------------------------------------
CountryInfoGetterForTesting::CountryInfoGetterForTesting(std::vector<CountryDef> const & countries)
- : CountryInfoGetter(true)
{
for (auto const & country : countries)
AddCountry(country);
diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp
index d3befaec49..d9cf318c95 100644
--- a/storage/country_info_getter.hpp
+++ b/storage/country_info_getter.hpp
@@ -33,7 +33,6 @@ public:
using RegionId = size_t;
using RegionIdVec = std::vector<RegionId>;
- explicit CountryInfoGetterBase(bool isSingleMwm) : m_isSingleMwm(isSingleMwm) {}
virtual ~CountryInfoGetterBase() = default;
// Returns country file name without an extension for a country |pt|
@@ -59,19 +58,12 @@ protected:
// List of all known countries.
std::vector<CountryDef> m_countries;
-
- // m_isSingleMwm == true if the system is currently working with single (small) mwms
- // and false otherwise.
- // @TODO(bykoianko) Init m_isSingleMwm correctly.
- bool m_isSingleMwm;
};
// *NOTE* This class is thread-safe.
class CountryInfoGetter : public CountryInfoGetterBase
{
public:
- explicit CountryInfoGetter(bool isSingleMwm) : CountryInfoGetterBase(isSingleMwm) {}
-
// Returns vector of countries file names without extension for
// countries belonging to |rect|. When |rough| is equal to true, the
// method is much faster but the result is less precise.
@@ -112,7 +104,7 @@ public:
void SetAffiliations(Affiliations const * affiliations);
protected:
- CountryInfoGetter() : CountryInfoGetterBase(true /* isSingleMwm */ ) {};
+ CountryInfoGetter() = default;
// Invokes |toDo| on each country whose name starts with |prefix|.
template <typename ToDo>
@@ -145,13 +137,6 @@ public:
/// \returns CountryInfoGetter based on countries.txt and packed_polygons.bin.
static std::unique_ptr<CountryInfoGetter> CreateCountryInfoReader(Platform const & platform);
- /// \returns CountryInfoGetter based on countries_obsolete.txt and packed_polygons_obsolete.bin.
- /// \brief The polygons in CountryInfoGetter() returned by the method was used at the time when
- /// routing and map data were in different files.
- /// \note This method should be used before migration to single-component and for tests.
- static std::unique_ptr<CountryInfoGetter> CreateCountryInfoReaderObsolete(
- Platform const & platform);
-
// Loads all regions for country number |id| from |m_reader|.
void LoadRegionsFromDisk(size_t id, std::vector<m2::RegionD> & regions) const;
diff --git a/storage/country_info_reader_light.cpp b/storage/country_info_reader_light.cpp
index 97038bbd3b..6564a2a021 100644
--- a/storage/country_info_reader_light.cpp
+++ b/storage/country_info_reader_light.cpp
@@ -24,7 +24,6 @@
namespace lightweight
{
CountryInfoReader::CountryInfoReader()
- : CountryInfoGetterBase(true)
{
try
{
diff --git a/storage/country_tree.cpp b/storage/country_tree.cpp
index d9c3c0816b..16e54802ec 100644
--- a/storage/country_tree.cpp
+++ b/storage/country_tree.cpp
@@ -27,10 +27,10 @@ using MwmSubtreeAttrs = pair<MwmCounter, MwmSize>;
namespace
{
-class StoreSingleMwmInterface
+class StoreInterface
{
public:
- virtual ~StoreSingleMwmInterface() = default;
+ virtual ~StoreInterface() = default;
virtual Country * InsertToCountryTree(CountryId const & id, MwmSize mapSize,
string const & mapSha1, size_t depth,
CountryId const & parent) = 0;
@@ -41,7 +41,7 @@ public:
virtual OldMwmMapping GetMapping() const = 0;
};
-class StoreCountriesSingleMwms : public StoreSingleMwmInterface
+class StoreCountries : public StoreInterface
{
CountryTree & m_countries;
Affiliations & m_affiliations;
@@ -50,7 +50,7 @@ class StoreCountriesSingleMwms : public StoreSingleMwmInterface
OldMwmMapping m_idsMapping;
public:
- StoreCountriesSingleMwms(CountryTree & countries, Affiliations & affiliations,
+ StoreCountries(CountryTree & countries, Affiliations & affiliations,
CountryNameSynonyms & countryNameSynonyms,
MwmTopCityGeoIds & mwmTopCityGeoIds)
: m_countries(countries)
@@ -59,13 +59,13 @@ public:
, m_mwmTopCityGeoIds(mwmTopCityGeoIds)
{
}
- ~StoreCountriesSingleMwms()
+ ~StoreCountries()
{
for (auto & entry : m_affiliations)
base::SortUnique(entry.second);
}
- // StoreSingleMwmInterface overrides:
+ // StoreInterface overrides:
Country * InsertToCountryTree(CountryId const & id, MwmSize mapSize, string const & mapSha1,
size_t depth, CountryId const & parent) override
{
@@ -115,16 +115,16 @@ public:
OldMwmMapping GetMapping() const override { return m_idsMapping; }
};
-class StoreFile2InfoSingleMwms : public StoreSingleMwmInterface
+class StoreFile2Info : public StoreInterface
{
OldMwmMapping m_idsMapping;
map<string, CountryInfo> & m_file2info;
public:
- explicit StoreFile2InfoSingleMwms(map<string, CountryInfo> & file2info) : m_file2info(file2info)
+ explicit StoreFile2Info(map<string, CountryInfo> & file2info) : m_file2info(file2info)
{
}
- // StoreSingleMwmInterface overrides:
+ // StoreInterface overrides:
Country * InsertToCountryTree(CountryId const & id, MwmSize /* mapSize */,
string const & /* mapSha1 */, size_t /* depth */,
CountryId const & /* parent */) override
@@ -325,8 +325,8 @@ CountryTree::Node const * const CountryTree::FindFirstLeaf(CountryId const & key
return nullptr;
}
-MwmSubtreeAttrs LoadGroupSingleMwmsImpl(size_t depth, json_t * node, CountryId const & parent,
- StoreSingleMwmInterface & store)
+MwmSubtreeAttrs LoadGroupImpl(size_t depth, json_t * node, CountryId const & parent,
+ StoreInterface & store)
{
CountryId id;
FromJSONObject(node, "id", id);
@@ -336,12 +336,6 @@ MwmSubtreeAttrs LoadGroupSingleMwmsImpl(size_t depth, json_t * node, CountryId c
for (auto const & synonym : countryNameSynonyms)
store.InsertCountryNameSynonym(id, synonym);
- // Mapping two component (big) mwms to one componenst (small) ones.
- vector<string> oldIds;
- FromJSONObjectOptionalField(node, "old", oldIds);
- for (auto const & oldId : oldIds)
- store.InsertOldMwmMapping(id, oldId);
-
// Mapping affiliations to one component (small) mwms.
vector<string> affiliations;
FromJSONObjectOptionalField(node, "affiliations", affiliations);
@@ -376,7 +370,7 @@ MwmSubtreeAttrs LoadGroupSingleMwmsImpl(size_t depth, json_t * node, CountryId c
{
for (json_t * child : children)
{
- MwmSubtreeAttrs const childAttr = LoadGroupSingleMwmsImpl(depth + 1, child, id, store);
+ MwmSubtreeAttrs const childAttr = LoadGroupImpl(depth + 1, child, id, store);
mwmCounter += childAttr.first;
mwmSize += childAttr.second;
}
@@ -388,134 +382,12 @@ MwmSubtreeAttrs LoadGroupSingleMwmsImpl(size_t depth, json_t * node, CountryId c
return make_pair(mwmCounter, mwmSize);
}
-bool LoadCountriesSingleMwmsImpl(string const & jsonBuffer, StoreSingleMwmInterface & store)
+bool LoadCountriesImpl(string const & jsonBuffer, StoreInterface & store)
{
try
{
base::Json root(jsonBuffer.c_str());
- LoadGroupSingleMwmsImpl(0 /* depth */, root.get(), kInvalidCountryId, store);
- return true;
- }
- catch (base::Json::Exception const & e)
- {
- LOG(LERROR, (e.Msg()));
- return false;
- }
-}
-
-namespace
-{
-class StoreTwoComponentMwmInterface
-{
-public:
- virtual ~StoreTwoComponentMwmInterface() = default;
- virtual Country * Insert(string const & id, MwmSize mapSize, MwmSize /* routingSize */,
- size_t depth, CountryId const & parent) = 0;
-};
-
-class StoreCountriesTwoComponentMwms : public StoreTwoComponentMwmInterface
-{
- CountryTree & m_countries;
-
-public:
- StoreCountriesTwoComponentMwms(CountryTree & countries, Affiliations & /* affiliations */,
- CountryNameSynonyms & /* countryNameSynonyms */)
- : m_countries(countries)
- {
- }
-
- // StoreTwoComponentMwmInterface overrides:
- virtual Country * Insert(string const & id, MwmSize mapSize, MwmSize routingSize, size_t depth,
- CountryId const & parent) override
- {
- Country country(id, parent);
- if (mapSize)
- {
- CountryFile countryFile(id);
- countryFile.SetRemoteSize(mapSize);
- country.SetFile(countryFile);
- }
- return &m_countries.AddAtDepth(depth, country);
- }
-};
-
-class StoreFile2InfoTwoComponentMwms : public StoreTwoComponentMwmInterface
-{
- OldMwmMapping m_idsMapping;
- map<string, CountryInfo> & m_file2info;
-
-public:
- explicit StoreFile2InfoTwoComponentMwms(map<string, CountryInfo> & file2info)
- : m_file2info(file2info)
- {
- }
- // StoreTwoComponentMwmInterface overrides:
- virtual Country * Insert(string const & id, MwmSize mapSize, MwmSize /* routingSize */,
- size_t /* depth */, CountryId const & /* parent */) override
- {
- if (mapSize == 0)
- return nullptr;
-
- CountryInfo info(id);
- m_file2info[id] = info;
- return nullptr;
- }
-};
-} // namespace
-
-MwmSubtreeAttrs LoadGroupTwoComponentMwmsImpl(size_t depth, json_t * node, CountryId const & parent,
- StoreTwoComponentMwmInterface & store)
-{
- // @TODO(bykoianko) After we stop supporting two component mwms (with routing files)
- // remove code below.
- CountryId file;
- FromJSONObjectOptionalField(node, "f", file);
- if (file.empty())
- FromJSONObject(node, "n", file); // If file is empty, it's the same as the name.
-
- // We expect that mwm and routing files should be less than 2GB.
- int mwmSize, routingSize;
- FromJSONObjectOptionalField(node, "s", mwmSize);
- FromJSONObjectOptionalField(node, "rs", routingSize);
- ASSERT_LESS_OR_EQUAL(0, mwmSize, ());
- ASSERT_LESS_OR_EQUAL(0, routingSize, ());
-
- Country * addedNode = store.Insert(file, static_cast<MwmSize>(mwmSize),
- static_cast<MwmSize>(routingSize), depth, parent);
-
- MwmCounter countryCounter = 0;
- MwmSize countrySize = 0;
- vector<json_t *> children;
- FromJSONObjectOptionalField(node, "g", children);
- if (children.empty())
- {
- countryCounter = 1; // It's a leaf. Any leaf contains one mwm.
- countrySize = mwmSize + routingSize;
- }
- else
- {
- for (json_t * child : children)
- {
- MwmSubtreeAttrs const childAttr =
- LoadGroupTwoComponentMwmsImpl(depth + 1, child, file, store);
- countryCounter += childAttr.first;
- countrySize += childAttr.second;
- }
- }
-
- if (addedNode != nullptr)
- addedNode->SetSubtreeAttrs(countryCounter, countrySize);
-
- return make_pair(countryCounter, countrySize);
-}
-
-bool LoadCountriesTwoComponentMwmsImpl(string const & jsonBuffer,
- StoreTwoComponentMwmInterface & store)
-{
- try
- {
- base::Json root(jsonBuffer.c_str());
- LoadGroupTwoComponentMwmsImpl(0 /* depth */, root.get(), kInvalidCountryId, store);
+ LoadGroupImpl(0 /* depth */, root.get(), kInvalidCountryId, store);
return true;
}
catch (base::Json::Exception const & e)
@@ -528,8 +400,7 @@ bool LoadCountriesTwoComponentMwmsImpl(string const & jsonBuffer,
int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countries,
Affiliations & affiliations,
CountryNameSynonyms & countryNameSynonyms,
- MwmTopCityGeoIds & mwmTopCityGeoIds,
- OldMwmMapping * mapping /* = nullptr */)
+ MwmTopCityGeoIds & mwmTopCityGeoIds)
{
countries.Clear();
affiliations.clear();
@@ -540,21 +411,10 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countri
base::Json root(jsonBuffer.c_str());
FromJSONObject(root.get(), "v", version);
- if (version::IsSingleMwm(version))
- {
- StoreCountriesSingleMwms store(countries, affiliations, countryNameSynonyms,
- mwmTopCityGeoIds);
- if (!LoadCountriesSingleMwmsImpl(jsonBuffer, store))
- return -1;
- if (mapping)
- *mapping = store.GetMapping();
- }
- else
- {
- StoreCountriesTwoComponentMwms store(countries, affiliations, countryNameSynonyms);
- if (!LoadCountriesTwoComponentMwmsImpl(jsonBuffer, store))
- return -1;
- }
+ StoreCountries store(countries, affiliations, countryNameSynonyms,
+ mwmTopCityGeoIds);
+ if (!LoadCountriesImpl(jsonBuffer, store))
+ return -1;
}
catch (base::Json::Exception const & e)
{
@@ -566,16 +426,15 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countri
int64_t LoadCountriesFromFile(string const & path, CountryTree & countries,
Affiliations & affiliations,
CountryNameSynonyms & countryNameSynonyms,
- MwmTopCityGeoIds & mwmTopCityGeoIds, OldMwmMapping * mapping)
+ MwmTopCityGeoIds & mwmTopCityGeoIds)
{
string json;
ReaderPtr<Reader>(GetPlatform().GetReader(path)).ReadAsString(json);
return LoadCountriesFromBuffer(json, countries, affiliations, countryNameSynonyms,
- mwmTopCityGeoIds, mapping);
+ mwmTopCityGeoIds);
}
-void LoadCountryFile2CountryInfo(string const & jsonBuffer, map<string, CountryInfo> & id2info,
- bool & isSingleMwm)
+void LoadCountryFile2CountryInfo(string const & jsonBuffer, map<string, CountryInfo> & id2info)
{
ASSERT(id2info.empty(), ());
@@ -584,17 +443,9 @@ void LoadCountryFile2CountryInfo(string const & jsonBuffer, map<string, CountryI
{
base::Json root(jsonBuffer.c_str());
FromJSONObjectOptionalField(root.get(), "v", version);
- isSingleMwm = version::IsSingleMwm(version);
- if (isSingleMwm)
- {
- StoreFile2InfoSingleMwms store(id2info);
- LoadCountriesSingleMwmsImpl(jsonBuffer, store);
- }
- else
- {
- StoreFile2InfoTwoComponentMwms store(id2info);
- LoadCountriesTwoComponentMwmsImpl(jsonBuffer, store);
- }
+
+ StoreFile2Info store(id2info);
+ LoadCountriesImpl(jsonBuffer, store);
}
catch (base::Json::Exception const & e)
{
diff --git a/storage/country_tree.hpp b/storage/country_tree.hpp
index 5a1c879ea6..3188f61ef2 100644
--- a/storage/country_tree.hpp
+++ b/storage/country_tree.hpp
@@ -119,14 +119,12 @@ private:
int64_t LoadCountriesFromBuffer(std::string const & buffer, CountryTree & countries,
Affiliations & affiliations,
CountryNameSynonyms & countryNameSynonyms,
- MwmTopCityGeoIds & mwmTopCityGeoIds,
- OldMwmMapping * mapping = nullptr);
+ MwmTopCityGeoIds & mwmTopCityGeoIds);
int64_t LoadCountriesFromFile(std::string const & path, CountryTree & countries,
Affiliations & affiliations,
CountryNameSynonyms & countryNameSynonyms,
- MwmTopCityGeoIds & mwmTopCityGeoIds,
- OldMwmMapping * mapping = nullptr);
+ MwmTopCityGeoIds & mwmTopCityGeoIds);
void LoadCountryFile2CountryInfo(std::string const & jsonBuffer,
- std::map<std::string, CountryInfo> & id2info, bool & isSingleMwm);
+ std::map<std::string, CountryInfo> & id2info);
} // namespace storage
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 5463592268..b018e36856 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -110,22 +110,16 @@ MapFilesDownloader::Progress Storage::GetOverallProgress(CountriesVec const & co
Storage::Storage(string const & pathToCountriesFile /* = COUNTRIES_FILE */,
string const & dataDir /* = string() */)
: m_downloader(make_unique<HttpMapFilesDownloader>())
- , m_currentSlotId(0)
, m_dataDir(dataDir)
- , m_downloadMapOnTheMap(nullptr)
- , m_maxMwmSizeBytes(0)
{
SetLocale(languages::GetCurrentTwine());
- LoadCountriesFile(pathToCountriesFile, m_dataDir);
+ LoadCountriesFile(pathToCountriesFile);
CalcMaxMwmSizeBytes();
}
Storage::Storage(string const & referenceCountriesTxtJsonForTesting,
unique_ptr<MapFilesDownloader> mapDownloaderForTesting)
: m_downloader(move(mapDownloaderForTesting))
- , m_currentSlotId(0)
- , m_downloadMapOnTheMap(nullptr)
- , m_maxMwmSizeBytes(0)
{
m_currentVersion =
LoadCountriesFromBuffer(referenceCountriesTxtJsonForTesting, m_countries, m_affiliations,
@@ -167,65 +161,6 @@ bool Storage::HaveDownloadedCountries() const
return !m_localFiles.empty();
}
-Storage * Storage::GetPrefetchStorage()
-{
- CHECK_THREAD_CHECKER(m_threadChecker, ());
- ASSERT(m_prefetchStorage.get() != nullptr, ());
-
- return m_prefetchStorage.get();
-}
-
-void Storage::PrefetchMigrateData()
-{
- CHECK_THREAD_CHECKER(m_threadChecker, ());
-
- m_prefetchStorage.reset(new Storage(COUNTRIES_FILE, "migrate"));
- m_prefetchStorage->EnableKeepDownloadingQueue(false);
- m_prefetchStorage->Init([](CountryId const &, LocalFilePtr const) {},
- [](CountryId const &, LocalFilePtr const) { return false; });
-}
-
-void Storage::Migrate(CountriesVec const & existedCountries)
-{
- CHECK_THREAD_CHECKER(m_threadChecker, ());
-
- platform::migrate::SetMigrationFlag();
-
- Clear();
- m_countries.Clear();
-
- OldMwmMapping mapping;
- LoadCountriesFile(COUNTRIES_FILE, m_dataDir, &mapping);
-
- vector<CountryId> prefetchedMaps;
- m_prefetchStorage->GetLocalRealMaps(prefetchedMaps);
-
- // Move prefetched maps into current storage.
- for (auto const & countryId : prefetchedMaps)
- {
- string prefetchedFilename =
- m_prefetchStorage->GetLatestLocalFile(countryId)->GetPath(MapFileType::Map);
- CountryFile const countryFile = GetCountryFile(countryId);
- auto localFile = PreparePlaceForCountryFiles(GetCurrentDataVersion(), m_dataDir, countryFile);
- string localFilename = localFile->GetPath(MapFileType::Map);
- LOG_SHORT(LINFO, ("Move", prefetchedFilename, "to", localFilename));
- base::RenameFileX(prefetchedFilename, localFilename);
- }
-
- // Remove empty migrate folder
- Platform::RmDir(m_prefetchStorage->m_dataDir);
-
- // Cover old big maps with small ones and prepare them to add into download queue
- stringstream ss;
- for (auto const & country : existedCountries)
- {
- ASSERT(!mapping[country].empty(), ());
- for (auto const & smallCountry : mapping[country])
- ss << (ss.str().empty() ? "" : ";") << smallCountry;
- }
- settings::Set(kDownloadQueueKey, ss.str());
-}
-
void Storage::Clear()
{
CHECK_THREAD_CHECKER(m_threadChecker, ());
@@ -281,8 +216,7 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs)
LocalCountryFile const & localFile = *i;
string const & name = localFile.GetCountryName();
- if (name != WORLD_FILE_NAME && name != WORLD_COASTS_FILE_NAME &&
- name != WORLD_COASTS_OBSOLETE_FILE_NAME)
+ if (name != WORLD_FILE_NAME && name != WORLD_COASTS_FILE_NAME)
{
auto const version = localFile.GetVersion();
if (version < minVersion)
@@ -721,15 +655,12 @@ CountryId Storage::GetCurrentDownloadingCountryId() const
return IsDownloadInProgress() ? m_queue.front().GetCountryId() : storage::CountryId();
}
-void Storage::LoadCountriesFile(string const & pathToCountriesFile, string const & dataDir,
- OldMwmMapping * mapping /* = nullptr */)
+void Storage::LoadCountriesFile(string const & pathToCountriesFile)
{
- m_dataDir = dataDir;
-
if (m_countries.IsEmpty())
{
m_currentVersion = LoadCountriesFromFile(pathToCountriesFile, m_countries, m_affiliations,
- m_countryNameSynonyms, m_mwmTopCityGeoIds, mapping);
+ m_countryNameSynonyms, m_mwmTopCityGeoIds);
LOG_SHORT(LINFO, ("Loaded countries list for version:", m_currentVersion));
if (m_currentVersion < 0)
LOG(LERROR, ("Can't load countries file", pathToCountriesFile));
@@ -1029,8 +960,8 @@ void Storage::GetOutdatedCountries(vector<Country const *> & countries) const
CountryId const & countryId = p.first;
string const name = GetCountryFile(countryId).GetName();
LocalFilePtr file = GetLatestLocalFile(countryId);
- if (file && file->GetVersion() != GetCurrentDataVersion() && name != WORLD_COASTS_FILE_NAME &&
- name != WORLD_COASTS_OBSOLETE_FILE_NAME && name != WORLD_FILE_NAME)
+ if (file && file->GetVersion() != GetCurrentDataVersion() && name != WORLD_COASTS_FILE_NAME
+ && name != WORLD_FILE_NAME)
{
countries.push_back(&CountryLeafByCountryId(countryId));
}
@@ -1142,10 +1073,6 @@ void Storage::RegisterCountryFiles(CountryId const & countryId, string const & d
void Storage::RegisterFakeCountryFiles(platform::LocalCountryFile const & localFile)
{
- if (localFile.GetCountryName() ==
- (platform::migrate::NeedMigrate() ? WORLD_COASTS_FILE_NAME : WORLD_COASTS_OBSOLETE_FILE_NAME))
- return;
-
LocalFilePtr fakeCountryLocalFile = make_shared<LocalCountryFile>(localFile);
fakeCountryLocalFile->SyncWithDisk();
m_localFilesForFakeCountries[fakeCountryLocalFile->GetCountryFile()] = fakeCountryLocalFile;
diff --git a/storage/storage.hpp b/storage/storage.hpp
index ab8379573e..cf7a87384d 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -215,7 +215,7 @@ private:
/// @name Communicate with GUI
//@{
- int m_currentSlotId;
+ int m_currentSlotId = 0;
struct CountryObservers
{
@@ -248,20 +248,17 @@ private:
CountryNameGetter m_countryNameGetter;
- std::unique_ptr<Storage> m_prefetchStorage;
-
// |m_affiliations| is a mapping from countryId to the list of names of
// geographical objects (such as countries) that encompass this countryId.
// Note. Affiliations is inherited from ancestors of the countryId in country tree.
// |m_affiliations| is filled during Storage initialization or during migration process.
// It is filled with data of countries.txt (field "affiliations").
// Once filled |m_affiliations| is not changed.
- // Note. |m_affiliations| is empty in case of countries_obsolete.txt.
Affiliations m_affiliations;
CountryNameSynonyms m_countryNameSynonyms;
MwmTopCityGeoIds m_mwmTopCityGeoIds;
- MwmSize m_maxMwmSizeBytes;
+ MwmSize m_maxMwmSizeBytes = 0;
ThreadChecker m_threadChecker;
@@ -274,8 +271,7 @@ private:
void DownloadNextCountryFromQueue();
- void LoadCountriesFile(std::string const & pathToCountriesFile, std::string const & dataDir,
- OldMwmMapping * mapping = nullptr);
+ void LoadCountriesFile(std::string const & pathToCountriesFile);
void ReportProgress(CountryId const & countryId, MapFilesDownloader::Progress const & p);
void ReportProgressForHierarchy(CountryId const & countryId,
@@ -499,14 +495,6 @@ public:
/// Delete local maps and aggregate their Id if needed
void DeleteAllLocalMaps(CountriesVec * existedCountries = nullptr);
- /// Prefetch MWMs before migrate
- Storage * GetPrefetchStorage();
- void PrefetchMigrateData();
-
- /// Switch on new storage version, remove old mwm
- /// and add required mwm's into download queue.
- void Migrate(CountriesVec const & existedCountries);
-
// Clears local files registry and downloader's queue.
void Clear();
@@ -598,7 +586,6 @@ public:
private:
friend struct UnitClass_StorageTest_DeleteCountry;
- friend struct UnitClass_TwoComponentStorageTest_DeleteCountry;
void SaveDownloadQueue();
void RestoreDownloadQueue();
diff --git a/storage/storage_integration_tests/CMakeLists.txt b/storage/storage_integration_tests/CMakeLists.txt
index d6ee702928..5459a0fa0f 100644
--- a/storage/storage_integration_tests/CMakeLists.txt
+++ b/storage/storage_integration_tests/CMakeLists.txt
@@ -6,7 +6,6 @@ add_definitions("-DOMIM_UNIT_TEST_WITH_QT_EVENT_LOOP")
set(
SRC
lightweight_matching_tests.cpp
- migrate_tests.cpp
storage_3levels_tests.cpp
storage_downloading_tests.cpp
storage_group_download_tests.cpp
diff --git a/storage/storage_integration_tests/download_calc_size_test.cpp b/storage/storage_integration_tests/download_calc_size_test.cpp
index 62b64e3c3d..7d634eb5ff 100644
--- a/storage/storage_integration_tests/download_calc_size_test.cpp
+++ b/storage/storage_integration_tests/download_calc_size_test.cpp
@@ -13,8 +13,6 @@ using namespace storage;
void InitStorage(Storage & storage, Storage::UpdateCallback const & didDownload,
Storage::ProgressFunction const & progress)
{
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
-
auto const changeCountryFunction = [&](CountryId const & /* countryId */) {
if (!storage.IsDownloadInProgress())
{
diff --git a/storage/storage_integration_tests/migrate_tests.cpp b/storage/storage_integration_tests/migrate_tests.cpp
deleted file mode 100644
index d9b3d195bd..0000000000
--- a/storage/storage_integration_tests/migrate_tests.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#include "testing/testing.hpp"
-
-#include "storage/storage_integration_tests/test_defines.hpp"
-
-#include "map/framework.hpp"
-
-#include "platform/local_country_file_utils.hpp"
-#include "platform/platform.hpp"
-#include "platform/platform_tests_support/scoped_dir.hpp"
-#include "platform/platform_tests_support/writable_dir_changer.hpp"
-
-#include "base/file_name_utils.hpp"
-#include "base/scope_guard.hpp"
-#include "base/string_utils.hpp"
-#include "base/thread.hpp"
-
-#include <cstdint>
-
-using namespace platform;
-using namespace storage;
-
-static FrameworkParams const kFrameworkParams(false /* m_enableLocalAds */, false /* m_enableDiffs */);
-
-UNIT_TEST(StorageFastMigrationTests)
-{
- WritableDirChanger writableDirChanger(kMapTestDir);
-
- Framework f(kFrameworkParams);
- auto & s = f.GetStorage();
-
- uint32_t version;
- TEST(settings::Get("LastMigration", version), ("LastMigration didn't set"));
-
- TEST_GREATER_OR_EQUAL(s.GetCurrentDataVersion(), version, ());
-}
-
-// This test on migration from big square and two component mwms to smaller square and one component
-// ones. According to |kMinRequiredVersion| constant at local_country_file_utils.cpp this migration
-// took place at 02.03.2016. For the time being this migration is not supported and is not tested.
-// The test bellow fails because when a prefeched storage, to download map or maps according to
-// current position, is created with code
-// |m_prefetchStorage.reset(new Storage(COUNTRIES_FILE, "migrate"));| does not create
-// the directory ./migrate/ now. And late in this test creation a directory
-// ./migrate/YYMMDD/ with Platform::MkDirChecked() fails because there's no ./migrate/
-// directory.
-// @TODO The code on the migration mentioned above should be removed. When this code is removed
-// test below should be removed as well. Until code on the code is not removed from the project
-// this test should be kept in case we decide to recover this feature.
-
-// UNIT_TEST(StorageMigrationTests)
-//{
-// CountriesVec const kOldCountries = {"Estonia"};
-// CountriesVec const kNewCountries = {"Estonia_East", "Estonia_West"};
-// CountriesVec const kPrefetchCountries = {"Russia_Moscow"};
-//
-// WritableDirChanger writableDirChanger(kMapTestDir);
-//
-// settings::Set("DisableFastMigrate", true);
-//
-// Framework f(kFrameworkParams);
-// auto & s = f.GetStorage();
-//
-// auto statePrefetchChanged = [&](CountryId const & id)
-// {
-// Status const nextStatus = f.GetStorage().GetPrefetchStorage()->CountryStatusEx(id);
-// LOG_SHORT(LINFO, (id, "status :", nextStatus));
-// if (!f.GetStorage().GetPrefetchStorage()->IsDownloadInProgress())
-// {
-// LOG_SHORT(LINFO, ("All prefetched. Ready to migrate."));
-// testing::StopEventLoop();
-// }
-// };
-//
-// auto stateChanged = [&](CountryId const & id)
-// {
-// if (!f.GetStorage().IsDownloadInProgress())
-// {
-// LOG_SHORT(LINFO, ("All downloaded. Check consistency."));
-// testing::StopEventLoop();
-// }
-// };
-//
-// auto progressChanged = [](CountryId const & id, LocalAndRemoteSize const & sz)
-// {
-// LOG_SHORT(LINFO, (id, "downloading progress:", sz));
-// };
-//
-// // Somewhere in Moscow, Russia
-// ms::LatLon curPos(55.7, 37.7);
-//
-// s.SetDownloadingServersForTesting({"http://direct.mapswithme.com/"});
-// s.Subscribe(stateChanged, progressChanged);
-// for (auto const & countryId : kOldCountries)
-// s.DownloadNode(countryId);
-//
-// // Wait for downloading complete.
-// testing::RunEventLoop();
-//
-// TEST_EQUAL(s.GetDownloadedFilesCount(), kOldCountries.size(), ());
-// for (auto const & countryId : kOldCountries)
-// TEST(s.IsNodeDownloaded(countryId), (countryId));
-//
-// TEST_NOT_EQUAL(f.PreMigrate(curPos, statePrefetchChanged, progressChanged), kInvalidCountryId,
-// ()); TEST(f.GetStorage().GetPrefetchStorage()->IsDownloadInProgress(), ("Empty queue"));
-// // Wait for downloading complete.
-// testing::RunEventLoop();
-//
-// TEST_EQUAL(s.GetDownloadedFilesCount(), kPrefetchCountries.size(), ());
-// for (auto const & countryId : kPrefetchCountries)
-// TEST(s.GetPrefetchStorage()->IsNodeDownloaded(countryId), (countryId));
-//
-// f.Migrate();
-// // Wait for downloading complete.
-// testing::RunEventLoop();
-//
-// TEST_EQUAL(s.GetDownloadedFilesCount(), kPrefetchCountries.size() + kNewCountries.size(), ());
-// for (auto const & countryId : kNewCountries)
-// TEST(s.IsNodeDownloaded(countryId), (countryId));
-// for (auto const & countryId : kPrefetchCountries)
-// TEST(s.IsNodeDownloaded(countryId), (countryId));
-//
-// s.DeleteAllLocalMaps();
-//}
diff --git a/storage/storage_integration_tests/storage_3levels_tests.cpp b/storage/storage_integration_tests/storage_3levels_tests.cpp
index 47400a6aea..3ee8294468 100644
--- a/storage/storage_integration_tests/storage_3levels_tests.cpp
+++ b/storage/storage_integration_tests/storage_3levels_tests.cpp
@@ -41,7 +41,6 @@ UNIT_TEST(SmallMwms_3levels_Test)
Framework f(FrameworkParams(false /* m_enableLocalAds */, false /* m_enableDiffs */));
auto & storage = f.GetStorage();
std::string const version = strings::to_string(storage.GetCurrentDataVersion());
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
TEST_EQUAL(3, GetLevelCount(storage, kCountryId), ());
diff --git a/storage/storage_integration_tests/storage_downloading_tests.cpp b/storage/storage_integration_tests/storage_downloading_tests.cpp
index d5e2780441..0245200796 100644
--- a/storage/storage_integration_tests/storage_downloading_tests.cpp
+++ b/storage/storage_integration_tests/storage_downloading_tests.cpp
@@ -68,8 +68,7 @@ void InitStorage(Storage & storage, Storage::ProgressFunction const & onProgress
UNIT_TEST(SmallMwms_ReDownloadExistedMWMIgnored_Test)
{
WritableDirChanger writableDirChanger(kMapTestDir);
- Storage storage(COUNTRIES_FILE);
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+ Storage storage;
InitStorage(storage, [](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {});
TEST(!storage.IsDownloadInProgress(), ());
@@ -89,8 +88,7 @@ UNIT_CLASS_TEST(Runner, SmallMwms_InterruptDownloadResumeDownload_Test)
// Start download but interrupt it
{
- Storage storage(COUNTRIES_FILE);
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+ Storage storage;
auto onProgressFn = [](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {
TEST_EQUAL(countryId, kCountryId, ());
@@ -110,7 +108,7 @@ UNIT_CLASS_TEST(Runner, SmallMwms_InterruptDownloadResumeDownload_Test)
// Continue download
{
- Storage storage(COUNTRIES_FILE);
+ Storage storage;
auto onProgressFn = [](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {
TEST_EQUAL(countryId, kCountryId, ());
@@ -143,7 +141,6 @@ UNIT_CLASS_TEST(Runner, DownloadIntegrity_Test)
SCOPE_GUARD(deleteTestFileGuard, bind(&FileWriter::DeleteFileX, ref(mapPath)));
Storage storage(COUNTRIES_FILE);
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
InitStorage(storage, [](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {});
TEST(!storage.IsDownloadInProgress(), ());
@@ -168,7 +165,6 @@ UNIT_CLASS_TEST(Runner, DownloadIntegrity_Test)
SCOPE_GUARD(deleteTestFileGuard, bind(&FileWriter::DeleteFileX, ref(mapPath)));
Storage storage(COUNTRIES_FILE);
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
auto onProgressFn = [i, j](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {
TEST_EQUAL(countryId, kCountryId, ());
@@ -189,7 +185,6 @@ UNIT_CLASS_TEST(Runner, DownloadIntegrity_Test)
coding::SHA1::Hash newHash;
{
Storage storage(COUNTRIES_FILE);
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
InitStorage(storage, [](CountryId const & countryId, LocalAndRemoteSize const & mapSize) {});
TEST(storage.IsDownloadInProgress(), ());
diff --git a/storage/storage_integration_tests/storage_group_download_tests.cpp b/storage/storage_integration_tests/storage_group_download_tests.cpp
index 7a281ef629..416b21e95f 100644
--- a/storage/storage_integration_tests/storage_group_download_tests.cpp
+++ b/storage/storage_integration_tests/storage_group_download_tests.cpp
@@ -250,9 +250,7 @@ void TestDownloadDelete(bool downloadOneByOne, bool deleteOneByOne)
{
WritableDirChanger writableDirChanger(kMapTestDir);
- Storage storage(COUNTRIES_FILE);
-
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+ Storage storage;
string const version = strings::to_string(storage.GetCurrentDataVersion());
auto onUpdatedFn = [&](CountryId const &, storage::LocalFilePtr const localCountryFile) {
diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp
index 5c64865e9a..5b780d25f6 100644
--- a/storage/storage_integration_tests/storage_http_tests.cpp
+++ b/storage/storage_integration_tests/storage_http_tests.cpp
@@ -58,8 +58,6 @@ string const GetResumeFullPath(string const & countryId, string const & version)
void InitStorage(Storage & storage, Storage::UpdateCallback const & didDownload,
Storage::ProgressFunction const & progress)
{
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
-
auto const changeCountryFunction = [&](CountryId const & /* countryId */) {
if (!storage.IsDownloadInProgress())
{
@@ -76,20 +74,19 @@ void InitStorage(Storage & storage, Storage::UpdateCallback const & didDownload,
class StorageHttpTest
{
-protected:
- WritableDirChanger const m_writableDirChanger;
- Storage m_storage;
- string const m_version;
- tests_support::ScopedDir const m_cleanupVersionDir;
-
public:
StorageHttpTest()
- : m_writableDirChanger(kMapTestDir), m_storage(COUNTRIES_FILE),
+ : m_writableDirChanger(kMapTestDir),
m_version(strings::to_string(m_storage.GetCurrentDataVersion())),
m_cleanupVersionDir(m_version)
{
- TEST(version::IsSingleMwm(m_storage.GetCurrentDataVersion()), ());
}
+
+protected:
+ WritableDirChanger const m_writableDirChanger;
+ Storage m_storage;
+ string const m_version;
+ tests_support::ScopedDir const m_cleanupVersionDir;
};
} // namespace
diff --git a/storage/storage_integration_tests/storage_update_tests.cpp b/storage/storage_integration_tests/storage_update_tests.cpp
index f558890784..005ef60498 100644
--- a/storage/storage_integration_tests/storage_update_tests.cpp
+++ b/storage/storage_integration_tests/storage_update_tests.cpp
@@ -94,7 +94,6 @@ UNIT_TEST(SmallMwms_Update_Test)
Framework f(kFrameworkParams);
auto & storage = f.GetStorage();
string const version = strings::to_string(storage.GetCurrentDataVersion());
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
TEST_EQUAL(version, kMwmVersion1, ());
auto onChangeCountryFn = [&](CountryId const & countryId) {
if (!storage.IsDownloadInProgress())
@@ -131,7 +130,6 @@ UNIT_TEST(SmallMwms_Update_Test)
Framework f(kFrameworkParams);
auto & storage = f.GetStorage();
string const version = strings::to_string(storage.GetCurrentDataVersion());
- TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
TEST_EQUAL(version, kMwmVersion2, ());
auto onChangeCountryFn = [&](CountryId const & countryId) {
if (!storage.IsDownloadInProgress())
diff --git a/storage/storage_tests/country_info_getter_tests.cpp b/storage/storage_tests/country_info_getter_tests.cpp
index 22fc3c8acd..146af48ecb 100644
--- a/storage/storage_tests/country_info_getter_tests.cpp
+++ b/storage/storage_tests/country_info_getter_tests.cpp
@@ -79,40 +79,39 @@ Cont Flatten(vector<Cont> const & cs)
UNIT_TEST(CountryInfoGetter_GetByPoint_Smoke)
{
- auto const getter = CreateCountryInfoGetterObsolete();
+ auto const getter = CreateCountryInfoGetter();
CountryInfo info;
// Minsk
getter->GetRegionInfo(MercatorBounds::FromLatLon(53.9022651, 27.5618818), info);
- TEST_EQUAL(info.m_name, "Belarus", ());
+ TEST_EQUAL(info.m_name, "Belarus, Minsk Region", ());
getter->GetRegionInfo(MercatorBounds::FromLatLon(-6.4146288, -38.0098101), info);
- TEST_EQUAL(info.m_name, "Brazil, Northeast", ());
+ TEST_EQUAL(info.m_name, "Brazil, Rio Grande do Norte", ());
getter->GetRegionInfo(MercatorBounds::FromLatLon(34.6509, 135.5018), info);
- TEST_EQUAL(info.m_name, "Japan, Kinki", ());
+ TEST_EQUAL(info.m_name, "Japan, Kinki Region_Osaka_Osaka", ());
}
UNIT_TEST(CountryInfoGetter_GetRegionsCountryIdByRect_Smoke)
{
- auto const getter = CreateCountryInfoGetterObsolete();
+ auto const getter = CreateCountryInfoGetter();
- m2::PointD const p = MercatorBounds::FromLatLon(53.9022651, 27.5618818);
+ m2::PointD const p = MercatorBounds::FromLatLon(52.537695, 32.203884);
- // Inside mwm.
+ // Single mwm.
m2::PointD const halfSize = m2::PointD(0.1, 0.1);
auto const countries =
getter->GetRegionsCountryIdByRect(m2::RectD(p - halfSize, p + halfSize), false /* rough */);
- TEST_EQUAL(countries, vector<storage::CountryId>{"Belarus"}, ());
+ TEST_EQUAL(countries, vector<storage::CountryId>{"Russia_Bryansk Oblast"}, ());
// Several countries.
- m2::PointD const halfSize2 = m2::PointD(5.0, 5.0);
+ m2::PointD const halfSize2 = m2::PointD(0.5, 0.5);
auto const countries2 =
getter->GetRegionsCountryIdByRect(m2::RectD(p - halfSize2, p + halfSize2), false /* rough */);
auto const expected = vector<storage::CountryId>{
- "Belarus", "Latvia", "Lithuania", "Poland", "Russia_Central", "Russia_Northwestern",
- "Ukraine"};
+ "Belarus_Homiel Region", "Russia_Bryansk Oblast", "Ukraine_Chernihiv Oblast"};
TEST_EQUAL(countries2, expected, ());
// No one found.
@@ -123,21 +122,16 @@ UNIT_TEST(CountryInfoGetter_GetRegionsCountryIdByRect_Smoke)
// Inside mwm (rough).
auto const countries4 =
getter->GetRegionsCountryIdByRect(m2::RectD(p - halfSize, p + halfSize), true /* rough */);
- TEST_EQUAL(countries, vector<storage::CountryId>{"Belarus"}, ());
+ TEST_EQUAL(countries, vector<storage::CountryId>{"Russia_Bryansk Oblast"}, ());
// Several countries (rough).
auto const countries5 =
getter->GetRegionsCountryIdByRect(m2::RectD(p - halfSize2, p + halfSize2), true /* rough */);
- auto const expected2 = vector<storage::CountryId>{"Belarus",
- "Latvia",
- "Lithuania",
- "Poland",
- "Russia_Central",
- "Russia_Far Eastern",
- "Russia_Northwestern",
- "Sweden",
- "Ukraine",
- "USA_Alaska"};
+ auto const expected2 = vector<storage::CountryId>{"Belarus_Homiel Region",
+ "Belarus_Maglieu Region",
+ "Russia_Bryansk Oblast",
+ "Ukraine_Chernihiv Oblast",
+ "US_Alaska"};
TEST_EQUAL(countries5, expected2, ());
}
@@ -147,26 +141,17 @@ UNIT_TEST(CountryInfoGetter_ValidName_Smoke)
ReaderPtr<Reader>(GetPlatform().GetReader(COUNTRIES_FILE)).ReadAsString(buffer);
map<string, CountryInfo> id2info;
- bool isSingleMwm;
- storage::LoadCountryFile2CountryInfo(buffer, id2info, isSingleMwm);
+ storage::LoadCountryFile2CountryInfo(buffer, id2info);
Storage storage;
- if (version::IsSingleMwm(storage.GetCurrentDataVersion()))
- {
- TEST(!IsEmptyName(id2info, "Belgium_West Flanders"), ());
- TEST(!IsEmptyName(id2info, "France_Ile-de-France_Paris"), ());
- }
- else
- {
- TEST(!IsEmptyName(id2info, "Germany_Baden-Wurttemberg"), ());
- TEST(!IsEmptyName(id2info, "France_Paris & Ile-de-France"), ());
- }
+ TEST(!IsEmptyName(id2info, "Belgium_West Flanders"), ());
+ TEST(!IsEmptyName(id2info, "France_Ile-de-France_Paris"), ());
}
UNIT_TEST(CountryInfoGetter_SomeRects)
{
- auto const getter = CreateCountryInfoGetterObsolete();
+ auto const getter = CreateCountryInfoGetter();
m2::RectD rects[3];
getter->CalcUSALimitRect(rects);
@@ -213,9 +198,7 @@ UNIT_TEST(CountryInfoGetter_HitsInTheMiddleOfNowhere)
UNIT_TEST(CountryInfoGetter_GetLimitRectForLeafSingleMwm)
{
auto const getter = CreateCountryInfoGetter();
- Storage storage(COUNTRIES_FILE);
- if (!version::IsSingleMwm(storage.GetCurrentDataVersion()))
- return;
+ Storage storage;
m2::RectD const boundingBox = getter->GetLimitRectForLeaf("Angola");
m2::RectD const expectedBoundingBox = {9.205259 /* minX */, -18.34456 /* minY */,
@@ -224,27 +207,13 @@ UNIT_TEST(CountryInfoGetter_GetLimitRectForLeafSingleMwm)
TEST(AlmostEqualRectsAbs(boundingBox, expectedBoundingBox), ());
}
-UNIT_TEST(CountryInfoGetter_GetLimitRectForLeafTwoComponentMwm)
-{
- auto const getter = CreateCountryInfoGetterObsolete();
- Storage storage(COUNTRIES_FILE);
- if (version::IsSingleMwm(storage.GetCurrentDataVersion()))
- return;
-
- m2::RectD const boundingBox = getter->GetLimitRectForLeaf("Angola");
- m2::RectD const expectedBoundingBox = {11.50151 /* minX */, -18.344569 /* minY */,
- 24.08212 /* maxX */, -4.393187 /* maxY */};
-
- TEST(AlmostEqualRectsAbs(boundingBox, expectedBoundingBox), ());
-}
-
UNIT_TEST(CountryInfoGetter_RegionRects)
{
auto const getterRaw = CountryInfoReader::CreateCountryInfoReader(GetPlatform());
CHECK(getterRaw != nullptr, ());
CountryInfoReader const * const getter = static_cast<CountryInfoReader const *>(getterRaw.get());
- Storage storage(COUNTRIES_FILE);
+ Storage storage;
auto const & countries = getter->GetCountries();
@@ -268,7 +237,7 @@ UNIT_TEST(CountryInfoGetter_Countries_And_Polygons)
CHECK(getterRaw != nullptr, ());
CountryInfoReader const * const getter = static_cast<CountryInfoReader const *>(getterRaw.get());
- Storage storage(COUNTRIES_FILE);
+ Storage storage;
double const kRectSize = 10;
@@ -304,7 +273,7 @@ BENCHMARK_TEST(CountryInfoGetter_RegionsByRect)
auto const getterRaw = CountryInfoReader::CreateCountryInfoReader(GetPlatform());
CountryInfoReader * getter = static_cast<CountryInfoReader *>(getterRaw.get());
- Storage storage(COUNTRIES_FILE);
+ Storage storage;
auto const & countryDefs = getter->GetCountries();
diff --git a/storage/storage_tests/helpers.cpp b/storage/storage_tests/helpers.cpp
index 87e17e1828..47eeeefb79 100644
--- a/storage/storage_tests/helpers.cpp
+++ b/storage/storage_tests/helpers.cpp
@@ -10,11 +10,6 @@
namespace storage
{
-std::unique_ptr<CountryInfoGetter> CreateCountryInfoGetterObsolete()
-{
- return CountryInfoReader::CreateCountryInfoReaderObsolete(GetPlatform());
-}
-
std::unique_ptr<storage::CountryInfoGetter> CreateCountryInfoGetter()
{
return CountryInfoReader::CreateCountryInfoReader(GetPlatform());
diff --git a/storage/storage_tests/helpers.hpp b/storage/storage_tests/helpers.hpp
index 090851cffa..2ff0db7405 100644
--- a/storage/storage_tests/helpers.hpp
+++ b/storage/storage_tests/helpers.hpp
@@ -8,7 +8,6 @@ namespace storage
{
class CountryInfoGetter;
-std::unique_ptr<CountryInfoGetter> CreateCountryInfoGetterObsolete();
std::unique_ptr<CountryInfoGetter> CreateCountryInfoGetter();
bool AlmostEqualRectsAbs(const m2::RectD & r1, const m2::RectD & r2);
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index 5588b79e2e..a34c6a450e 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -92,9 +92,9 @@ private:
uint64_t m_request = 0;
};
-string const kSingleMwmCountriesTxt = string(R"({
+string const kCountriesTxt = string(R"({
"id": "Countries",
- "v": )" + strings::to_string(version::FOR_TESTING_SINGLE_MWM1) + R"(,
+ "v": )" + strings::to_string(version::FOR_TESTING_MWM1) + R"(,
"g": [
{
"id": "Abkhazia",
@@ -216,57 +216,6 @@ string const kSingleMwmCountriesTxt = string(R"({
}
]})");
-string const kTwoComponentMwmCountriesTxt =
- string(R"({
- "v": )" + strings::to_string(version::FOR_TESTING_TWO_COMPONENT_MWM1) + R"(,
- "n": "Countries",
- "g": [
- {
- "n":"Africa",
- "g":[
- {
- "n":"Algeria",
- "c":"dz",
- "s":33912897,
- "rs":56864398
- },
- {
- "n":"Angola",
- "c":"ao",
- "s":7384993,
- "rs":9429135
- }]
- },
- {
- "n":"Europe",
- "g":[
- {
- "n":"Albania",
- "c":"al",
- "s":9785225,
- "rs":4438392
- },
- {
- "n":"France",
- "c":"fr",
- "g":[
- {
- "n":"Alsace",
- "c":"fr",
- "f":"France_Alsace",
- "s":58811438,
- "rs":9032707
- },
- {
- "n":"Aquitaine",
- "c":"fr",
- "f":"France_Aquitaine",
- "s":111693256,
- "rs":32365165
- }]
- }
- ]}]})");
-
bool ParentOf(Storage const & storage, string const & parent, string const & country)
{
Country const c = storage.CountryByCountryId(country);
@@ -400,18 +349,6 @@ unique_ptr<CountryDownloaderChecker> AbsentCountryDownloaderChecker(Storage & st
}
// Checks following state transitions:
-// NotDownloaded -> InQueue -> Downloading -> OnDisk.
-unique_ptr<CountryDownloaderChecker> QueuedCountryDownloaderChecker(Storage & storage,
- CountryId const & countryId,
- MapFileType type)
-{
- return make_unique<CountryDownloaderChecker>(
- storage, countryId, type,
- vector<Status>{Status::ENotDownloaded, Status::EInQueue, Status::EDownloading,
- Status::EOnDisk});
-}
-
-// Checks following state transitions:
// NotDownloaded -> Downloading -> NotDownloaded.
unique_ptr<CountryDownloaderChecker> CancelledCountryDownloaderChecker(Storage & storage,
CountryId const & countryId,
@@ -548,27 +485,13 @@ void InitStorage(Storage & storage, TaskRunner & runner,
class StorageTest
{
-protected:
- Storage storage;
- TaskRunner runner;
- WritableDirChanger writableDirChanger;
-
public:
StorageTest() : writableDirChanger(kMapTestDir) { InitStorage(storage, runner); }
-};
-class TwoComponentStorageTest
-{
protected:
Storage storage;
TaskRunner runner;
WritableDirChanger writableDirChanger;
-
-public:
- TwoComponentStorageTest() : storage(COUNTRIES_OBSOLETE_FILE), writableDirChanger(kMapTestDir)
- {
- InitStorage(storage, runner);
- }
};
} // namespace
@@ -611,39 +534,12 @@ UNIT_CLASS_TEST(StorageTest, CountryDownloading)
}
}
-UNIT_CLASS_TEST(TwoComponentStorageTest, CountriesDownloading)
-{
- CountryId const uruguayCountryId = storage.FindCountryIdByFile("Uruguay");
- TEST(IsCountryIdValid(uruguayCountryId), ());
- storage.DeleteCountry(uruguayCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupUruguayFiles,
- bind(&Storage::DeleteCountry, &storage, uruguayCountryId, MapFileType::Map));
-
- CountryId const venezuelaCountryId = storage.FindCountryIdByFile("Venezuela");
- TEST(IsCountryIdValid(venezuelaCountryId), ());
- storage.DeleteCountry(venezuelaCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupVenezuelaFiles,
- bind(&Storage::DeleteCountry, &storage, venezuelaCountryId, MapFileType::Map));
-
- unique_ptr<CountryDownloaderChecker> uruguayChecker =
- AbsentCountryDownloaderChecker(storage, uruguayCountryId, MapFileType::Map);
- unique_ptr<CountryDownloaderChecker> venezuelaChecker =
- QueuedCountryDownloaderChecker(storage, venezuelaCountryId, MapFileType::Map);
- uruguayChecker->StartDownload();
- venezuelaChecker->StartDownload();
- runner.Run();
-}
-
UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry)
{
- Storage storage(COUNTRIES_OBSOLETE_FILE);
- bool const isSingleMwm = version::IsSingleMwm(storage.GetCurrentDataVersion());
- if (isSingleMwm)
- storage.SetCurrentDataVersionForTesting(version::FOR_TESTING_SINGLE_MWM_LATEST);
- int64_t const v1 = isSingleMwm ? version::FOR_TESTING_SINGLE_MWM1
- : version::FOR_TESTING_TWO_COMPONENT_MWM1;
- int64_t const v2 = isSingleMwm ? version::FOR_TESTING_SINGLE_MWM2
- : version::FOR_TESTING_TWO_COMPONENT_MWM2;
+ Storage storage;
+ storage.SetCurrentDataVersionForTesting(version::FOR_TESTING_MWM_LATEST);
+ int64_t const v1 = version::FOR_TESTING_MWM1;
+ int64_t const v2 = version::FOR_TESTING_MWM2;
storage.Init(&OnCountryDownloaded, [](CountryId const &, LocalFilePtr const) { return false; });
storage.RegisterAllLocalMaps(false /* enableDiffs */);
@@ -697,102 +593,6 @@ UNIT_CLASS_TEST(StorageTest, DeletePendingCountry)
}
}
-UNIT_CLASS_TEST(TwoComponentStorageTest, CountriesAndDeleteSingleMwm)
-{
- if (!version::IsSingleMwm(storage.GetCurrentDataVersion()))
- return;
-
- CountryId const uruguayCountryId = storage.FindCountryIdByFile("Uruguay");
- TEST(IsCountryIdValid(uruguayCountryId), ());
- storage.DeleteCountry(uruguayCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupUruguayFiles,
- bind(&Storage::DeleteCountry, &storage, uruguayCountryId, MapFileType::Map));
-
- CountryId const venezuelaCountryId = storage.FindCountryIdByFile("Venezuela");
- TEST(IsCountryIdValid(venezuelaCountryId), ());
- storage.DeleteCountry(venezuelaCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupVenezuelaFiles,
- bind(&Storage::DeleteCountry, &storage, venezuelaCountryId, MapFileType::Map));
-
- {
- unique_ptr<CountryDownloaderChecker> uruguayChecker = make_unique<CountryDownloaderChecker>(
- storage, uruguayCountryId, MapFileType::Map,
- vector<Status>{Status::ENotDownloaded, Status::EDownloading, Status::EOnDisk});
-
- unique_ptr<CountryDownloaderChecker> venezuelaChecker = make_unique<CountryDownloaderChecker>(
- storage, venezuelaCountryId, MapFileType::Map,
- vector<Status>{Status::ENotDownloaded, Status::EInQueue, Status::EDownloading,
- Status::EOnDisk});
-
- uruguayChecker->StartDownload();
- venezuelaChecker->StartDownload();
- runner.Run();
- }
-
- {
- unique_ptr<CountryDownloaderChecker> uruguayChecker = make_unique<CountryDownloaderChecker>(
- storage, uruguayCountryId, MapFileType::Map,
- vector<Status>{Status::EOnDisk, Status::ENotDownloaded});
-
- unique_ptr<CountryDownloaderChecker> venezuelaChecker = make_unique<CountryDownloaderChecker>(
- storage, venezuelaCountryId, MapFileType::Map,
- vector<Status>{Status::EOnDisk, Status::ENotDownloaded});
-
- storage.DeleteCountry(uruguayCountryId, MapFileType::Map);
- storage.DeleteCountry(venezuelaCountryId, MapFileType::Map);
- runner.Run();
- }
-
- LocalFilePtr uruguayFile = storage.GetLatestLocalFile(uruguayCountryId);
- TEST(!uruguayFile.get(), (*uruguayFile));
-
- LocalFilePtr venezuelaFile = storage.GetLatestLocalFile(venezuelaCountryId);
- TEST(!venezuelaFile.get(), ());
-}
-
-UNIT_CLASS_TEST(TwoComponentStorageTest, DownloadTwoCountriesAndDelete)
-{
- if (version::IsSingleMwm(storage.GetCurrentDataVersion()))
- return;
-
- CountryId const uruguayCountryId = storage.FindCountryIdByFile("Uruguay");
- TEST(IsCountryIdValid(uruguayCountryId), ());
- storage.DeleteCountry(uruguayCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupUruguayFiles,
- bind(&Storage::DeleteCountry, &storage, uruguayCountryId, MapFileType::Map));
-
- CountryId const venezuelaCountryId = storage.FindCountryIdByFile("Venezuela");
- TEST(IsCountryIdValid(venezuelaCountryId), ());
- storage.DeleteCountry(venezuelaCountryId, MapFileType::Map);
- SCOPE_GUARD(cleanupVenezuelaFiles,
- bind(&Storage::DeleteCountry, &storage, venezuelaCountryId, MapFileType::Map));
-
- {
- // Map file will be deleted for Uruguay, thus, routing file should also be deleted. Therefore,
- // Uruguay should pass through following states: NotDownloaded -> Downloading -> NotDownloaded.
- unique_ptr<CountryDownloaderChecker> uruguayChecker = make_unique<CountryDownloaderChecker>(
- storage, uruguayCountryId, MapFileType::Map,
- vector<Status>{Status::ENotDownloaded, Status::EDownloading, Status::ENotDownloaded});
- // Venezuela should pass through the following states:
- // NotDownloaded -> InQueue (Venezuela is added after Uruguay) -> Downloading -> NotDownloaded.
- unique_ptr<CountryDownloaderChecker> venezuelaChecker = make_unique<CountryDownloaderChecker>(
- storage, venezuelaCountryId, MapFileType::Map,
- vector<Status>{Status::ENotDownloaded, Status::EInQueue, Status::EDownloading,
- Status::ENotDownloaded});
- uruguayChecker->StartDownload();
- venezuelaChecker->StartDownload();
- storage.DeleteCountry(uruguayCountryId, MapFileType::Map);
- storage.DeleteCountry(venezuelaCountryId, MapFileType::Map);
- runner.Run();
- }
-
- LocalFilePtr uruguayFile = storage.GetLatestLocalFile(uruguayCountryId);
- TEST(!uruguayFile.get(), (*uruguayFile));
-
- LocalFilePtr venezuelaFile = storage.GetLatestLocalFile(venezuelaCountryId);
- TEST(!venezuelaFile.get(), ());
-}
-
UNIT_CLASS_TEST(StorageTest, CancelDownloadingWhenAlmostDone)
{
CountryId const countryId = storage.FindCountryIdByFile("Uruguay");
@@ -813,33 +613,7 @@ UNIT_CLASS_TEST(StorageTest, DeleteCountry)
{
tests_support::ScopedFile map("Wonderland.mwm", ScopedFile::Mode::Create);
LocalCountryFile file = LocalCountryFile::MakeForTesting("Wonderland",
- version::FOR_TESTING_SINGLE_MWM1);
- TEST(file.OnDisk(MapFileType::Map), ());
-
- CountryIndexes::PreparePlaceOnDisk(file);
- string const bitsPath = CountryIndexes::GetPath(file, CountryIndexes::Index::Bits);
- {
- FileWriter writer(bitsPath);
- string const data = "bits";
- writer.Write(data.data(), data.size());
- }
-
- storage.RegisterFakeCountryFiles(file);
- TEST(map.Exists(), ());
- TEST(Platform::IsFileExistsByFullPath(bitsPath), (bitsPath));
-
- storage.DeleteCustomCountryVersion(file);
- TEST(!map.Exists(), ());
- TEST(!Platform::IsFileExistsByFullPath(bitsPath), (bitsPath));
-
- map.Reset();
-}
-
-UNIT_CLASS_TEST(TwoComponentStorageTest, DeleteCountry)
-{
- tests_support::ScopedFile map("Wonderland.mwm", ScopedFile::Mode::Create);
- LocalCountryFile file = LocalCountryFile::MakeForTesting("Wonderland",
- version::FOR_TESTING_TWO_COMPONENT_MWM1);
+ version::FOR_TESTING_MWM1);
TEST(file.OnDisk(MapFileType::Map), ());
CountryIndexes::PreparePlaceOnDisk(file);
@@ -922,7 +696,7 @@ UNIT_TEST(StorageTest_GetRootId)
{
Storage storage(string(R"({
"id": "Countries",
- "v": )" + strings::to_string(version::FOR_TESTING_SINGLE_MWM1) + R"(,
+ "v": )" + strings::to_string(version::FOR_TESTING_MWM1) + R"(,
"g": []
})"), make_unique<TestMapFilesDownloader>());
@@ -932,7 +706,7 @@ UNIT_TEST(StorageTest_GetRootId)
UNIT_TEST(StorageTest_GetChildren)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
CountryId const world = storage.GetRootId();
TEST_EQUAL(world, "Countries", ());
@@ -955,7 +729,7 @@ UNIT_TEST(StorageTest_GetChildren)
UNIT_TEST(StorageTest_GetAffiliations)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
vector<string> const abkhaziaId = {"Abkhazia"};
for (auto const & s : {"Georgia", "Russia", "Europe"})
@@ -1082,9 +856,7 @@ UNIT_CLASS_TEST(StorageTest, DownloadedMap)
UNIT_CLASS_TEST(StorageTest, IsPointCoveredByDownloadedMaps)
{
- bool const isSingleMwm = version::IsSingleMwm(storage.GetCurrentDataVersion());
- auto const countryInfoGetter =
- isSingleMwm ? CreateCountryInfoGetter() : CreateCountryInfoGetterObsolete();
+ auto const countryInfoGetter = CreateCountryInfoGetter();
ASSERT(countryInfoGetter, ());
string const uruguayId = string("Uruguay");
m2::PointD const montevideoUruguay = MercatorBounds::FromLatLon(-34.8094, -56.1558);
@@ -1102,58 +874,9 @@ UNIT_CLASS_TEST(StorageTest, IsPointCoveredByDownloadedMaps)
}
}
-UNIT_TEST(StorageTest_TwoInstance)
-{
- Platform & platform = GetPlatform();
- string const writableDir = platform.WritableDir();
-
- string const testDir1 = string("testdir1");
- Storage storage1(COUNTRIES_OBSOLETE_FILE, testDir1);
- platform::tests_support::ScopedDir removeTestDir1(testDir1);
- UNUSED_VALUE(removeTestDir1);
- string const versionDir1 =
- base::JoinPath(testDir1, strings::to_string(storage1.GetCurrentDataVersion()));
- platform::tests_support::ScopedDir removeVersionDir1(versionDir1);
- UNUSED_VALUE(removeVersionDir1);
- TaskRunner runner1;
- InitStorage(storage1, runner1);
-
- string const testDir2 = string("testdir2");
- Storage storage2(COUNTRIES_FILE, testDir2);
- platform::tests_support::ScopedDir removeTestDir2(testDir2);
- UNUSED_VALUE(removeTestDir2);
- string const versionDir2 =
- base::JoinPath(testDir2, strings::to_string(storage2.GetCurrentDataVersion()));
- platform::tests_support::ScopedDir removeVersionDir2(versionDir2);
- UNUSED_VALUE(removeVersionDir2);
- TaskRunner runner2;
- InitStorage(storage2, runner2);
-
- string const uruguayId = string("Uruguay"); // This countryId is valid for single and two component mwms.
- storage1.DeleteCountry(uruguayId, MapFileType::Map);
- {
- SCOPE_GUARD(cleanupCountryFiles,
- bind(&Storage::DeleteCountry, &storage1, uruguayId, MapFileType::Map));
- auto const checker = AbsentCountryDownloaderChecker(storage1, uruguayId, MapFileType::Map);
- checker->StartDownload();
- runner1.Run();
- TEST(platform.IsFileExistsByFullPath(base::JoinPath(writableDir, versionDir1)), ());
- }
-
- storage2.DeleteCountry(uruguayId, MapFileType::Map);
- {
- SCOPE_GUARD(cleanupCountryFiles,
- bind(&Storage::DeleteCountry, &storage2, uruguayId, MapFileType::Map));
- auto const checker = AbsentCountryDownloaderChecker(storage2, uruguayId, MapFileType::Map);
- checker->StartDownload();
- runner2.Run();
- TEST(platform.IsFileExistsByFullPath(base::JoinPath(writableDir, versionDir1)), ());
- }
-}
-
UNIT_TEST(StorageTest_ChildrenSizeSingleMwm)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
Country const abkhaziaCountry = storage.CountryLeafByCountryId("Abkhazia");
TEST_EQUAL(abkhaziaCountry.GetSubtreeMwmCounter(), 1, ());
@@ -1168,22 +891,9 @@ UNIT_TEST(StorageTest_ChildrenSizeSingleMwm)
TEST_EQUAL(southKoreaCountry.GetSubtreeMwmSizeBytes(), 48394664, ());
}
-UNIT_TEST(StorageTest_ChildrenSizeTwoComponentMwm)
-{
- Storage storage(kTwoComponentMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
-
- Country const abkhaziaCountry = storage.CountryLeafByCountryId("Algeria");
- TEST_EQUAL(abkhaziaCountry.GetSubtreeMwmCounter(), 1, ());
- TEST_EQUAL(abkhaziaCountry.GetSubtreeMwmSizeBytes(), 90777295, ());
-
- Country const algeriaCountry = storage.CountryByCountryId("Europe");
- TEST_EQUAL(algeriaCountry.GetSubtreeMwmCounter(), 3, ());
- TEST_EQUAL(algeriaCountry.GetSubtreeMwmSizeBytes(), 226126183, ());
-}
-
UNIT_TEST(StorageTest_ParentSingleMwm)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
TEST(ParentOf(storage, "Countries", "Abkhazia"), ());
TEST(ParentOf(storage, "Algeria", "Algeria_Central"), ());
@@ -1191,19 +901,9 @@ UNIT_TEST(StorageTest_ParentSingleMwm)
TEST(ParentOf(storage, kInvalidCountryId, "Countries"), ());
}
-UNIT_TEST(StorageTest_ParentTwoComponentsMwm)
-{
- Storage storage(kTwoComponentMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
-
- TEST(ParentOf(storage, "Countries", "Africa"), ());
- TEST(ParentOf(storage, "Africa", "Algeria"), ());
- TEST(ParentOf(storage, "France", "France_Alsace"), ());
- TEST(ParentOf(storage, kInvalidCountryId, "Countries"), ());
-}
-
UNIT_TEST(StorageTest_GetNodeStatusesSingleMwm)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
NodeStatuses nodeStatuses;
storage.GetNodeStatuses("Abkhazia", nodeStatuses);
@@ -1219,7 +919,7 @@ UNIT_TEST(StorageTest_GetNodeStatusesSingleMwm)
UNIT_TEST(StorageTest_GetNodeAttrsSingleMwm)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
NodeAttrs nodeAttrs;
storage.GetNodeAttrs("Abkhazia", nodeAttrs);
@@ -1320,7 +1020,7 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
TestMwmBuilder builder(country2, feature::DataHeader::MapType::Country);
}
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
storage.RegisterAllLocalMaps(false /* enableDiffs */);
country1.SyncWithDisk();
@@ -1372,7 +1072,7 @@ UNIT_TEST(StorageTest_ParseStatus)
UNIT_TEST(StorageTest_ForEachInSubtree)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
CountriesVec leafVec;
auto const forEach = [&leafVec](CountryId const & descendantId, bool groupNode) {
@@ -1396,7 +1096,7 @@ UNIT_TEST(StorageTest_ForEachInSubtree)
UNIT_TEST(StorageTest_ForEachAncestorExceptForTheRoot)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
// Two parent case.
auto const forEachParentDisputableTerritory = [](CountryId const & parentId,
@@ -1447,9 +1147,6 @@ UNIT_TEST(StorageTest_ForEachAncestorExceptForTheRoot)
UNIT_CLASS_TEST(StorageTest, CalcLimitRect)
{
- if (!version::IsSingleMwm(storage.GetCurrentDataVersion()))
- return;
-
auto const countryInfoGetter = CreateCountryInfoGetter();
ASSERT(countryInfoGetter, ());
@@ -1490,7 +1187,7 @@ UNIT_TEST(StorageTest_CountriesNamesTest)
"Indisputable Territory Of Country2":"Territoire incontestable. Pays 2"
})json");
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
// set russian locale
storage.SetLocaleForTesting(kRuJson, "ru");
@@ -1598,7 +1295,7 @@ UNIT_TEST(StorageTest_CountriesNamesTest)
UNIT_TEST(StorageTest_DeleteNodeWithoutDownloading)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
TaskRunner runner;
InitStorage(storage, runner);
@@ -1611,7 +1308,7 @@ UNIT_TEST(StorageTest_DeleteNodeWithoutDownloading)
UNIT_TEST(StorageTest_GetOverallProgressSmokeTest)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
TaskRunner runner;
InitStorage(storage, runner);
@@ -1623,7 +1320,7 @@ UNIT_TEST(StorageTest_GetOverallProgressSmokeTest)
UNIT_TEST(StorageTest_GetQueuedChildrenSmokeTest)
{
- Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
+ Storage storage(kCountriesTxt, make_unique<TestMapFilesDownloader>());
TaskRunner runner;
InitStorage(storage, runner);