From d3f7c95d961eb5d2a690c34847bf7c86b7abe9a6 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Mon, 8 Aug 2022 20:44:12 -0700 Subject: [PATCH] Remove redundant namespace references Signed-off-by: methylDragon --- src/ClientConfig.cc | 14 ++++----- src/ClientConfig_TEST.cc | 14 ++++----- src/CollectionIdentifier_TEST.cc | 12 ++++---- src/FuelClient.cc | 50 ++++++++++++++++---------------- src/FuelClient_TEST.cc | 34 +++++++++++----------- src/LocalCache_TEST.cc | 42 +++++++++++++-------------- src/ModelIdentifier_TEST.cc | 6 ++-- src/ModelIter_TEST.cc | 4 +-- src/RestClient.cc | 6 ++-- src/Result_TEST.cc | 2 +- src/WorldIdentifier_TEST.cc | 12 ++++---- src/WorldIter.cc | 2 +- src/WorldIter_TEST.cc | 4 +-- src/Zip.cc | 24 +++++++-------- src/Zip_TEST.cc | 24 +++++++-------- test/integration/zip.cc | 50 ++++++++++++++++---------------- 16 files changed, 150 insertions(+), 150 deletions(-) diff --git a/src/ClientConfig.cc b/src/ClientConfig.cc index f96d7de3..6c968115 100644 --- a/src/ClientConfig.cc +++ b/src/ClientConfig.cc @@ -39,7 +39,7 @@ class ignition::fuel_tools::ClientConfigPrivate public: ClientConfigPrivate() { std::string homePath; - ignition::common::env(IGN_HOMEDIR, homePath); + common::env(IGN_HOMEDIR, homePath); this->cacheLocation = common::joinPaths( homePath, ".ignition", "fuel"); @@ -202,9 +202,9 @@ std::string ServerConfig::AsPrettyString(const std::string &_prefix) const ClientConfig::ClientConfig() : dataPtr(new ClientConfigPrivate) { std::string ignFuelPath = ""; - if (ignition::common::env("IGN_FUEL_CACHE_PATH", ignFuelPath)) + if (common::env("IGN_FUEL_CACHE_PATH", ignFuelPath)) { - if (!ignition::common::isDirectory(ignFuelPath)) + if (!common::isDirectory(ignFuelPath)) { ignerr << "[" << ignFuelPath << "] is not a directory" << std::endl; return; @@ -243,7 +243,7 @@ void ClientConfig::Clear() bool ClientConfig::LoadConfig(const std::string &_file) { // Sanity check: Verify that the configuration file exists. - if (!ignition::common::exists(_file)) + if (!common::exists(_file)) { ignerr << "Unable to find configuration file [" << _file<< "]" << std::endl; return false; @@ -414,8 +414,8 @@ bool ClientConfig::LoadConfig(const std::string &_file) // Default cache path. std::string homePath; - ignition::common::env(IGN_HOMEDIR, homePath); - std::string cacheLocation = ignition::common::joinPaths( + common::env(IGN_HOMEDIR, homePath); + std::string cacheLocation = common::joinPaths( homePath, ".ignition", "fuel"); // The user wants to overwrite the default cache path. @@ -424,7 +424,7 @@ bool ClientConfig::LoadConfig(const std::string &_file) // Do not overwrite the cache location if IGN_FUEL_CACHE_PATH is set. std::string ignFuelPath = ""; - if (ignition::common::env("IGN_FUEL_CACHE_PATH", ignFuelPath)) + if (common::env("IGN_FUEL_CACHE_PATH", ignFuelPath)) { ignwarn << "IGN_FUEL_CACHE_PATH is set to [" << ignFuelPath << "]. The " << "path in the configuration file will be ignored" << std::endl; diff --git a/src/ClientConfig_TEST.cc b/src/ClientConfig_TEST.cc index 8ce0ec9a..82ca5b74 100644 --- a/src/ClientConfig_TEST.cc +++ b/src/ClientConfig_TEST.cc @@ -36,23 +36,23 @@ using namespace fuel_tools; void removeFileTemp(const std::string &_path) { #ifndef _WIN32 - EXPECT_TRUE(ignition::common::removeFile(_path)); + EXPECT_TRUE(common::removeFile(_path)); #else - ignition::common::removeFile(_path); + common::removeFile(_path); #endif } ///////////////////////////////////////////////// /// \brief Get home directory. /// \return Home directory or empty string if home wasn't found. -/// \ToDo: Move this function to ignition::common::Filesystem +/// \ToDo: Move this function to common::Filesystem std::string homePath() { std::string homePath; #ifndef _WIN32 - ignition::common::env("HOME", homePath); + common::env("HOME", homePath); #else - ignition::common::env("USERPROFILE", homePath); + common::env("USERPROFILE", homePath); #endif return homePath; @@ -61,7 +61,7 @@ std::string homePath() ///////////////////////////////////////////////// /// \brief Get cache directory. /// \return Cache directory -/// \ToDo: Move this function to ignition::common::Filesystem +/// \ToDo: Move this function to common::Filesystem std::string cachePath() { #ifndef _WIN32 @@ -101,7 +101,7 @@ TEST(ClientConfig, CustomDefaultConfiguration) EXPECT_EQ("https://fuel.ignitionrobotics.org", config.Servers().front().Url().Str()); - std::string defaultCacheLocation = ignition::common::joinPaths( + std::string defaultCacheLocation = common::joinPaths( homePath(), ".ignition", "fuel"); EXPECT_EQ(defaultCacheLocation, config.CacheLocation()); } diff --git a/src/CollectionIdentifier_TEST.cc b/src/CollectionIdentifier_TEST.cc index 6fe674f3..e8af863a 100644 --- a/src/CollectionIdentifier_TEST.cc +++ b/src/CollectionIdentifier_TEST.cc @@ -32,7 +32,7 @@ TEST(CollectionIdentifier, SetFields) CollectionIdentifier id; id.SetName("hello"); id.SetOwner("osrf"); - ignition::fuel_tools::ServerConfig srv1; + ServerConfig srv1; srv1.SetUrl(common::URI("https://localhost:8001/")); id.SetServer(srv1); @@ -45,13 +45,13 @@ TEST(CollectionIdentifier, SetFields) /// \brief Unique Name TEST(CollectionIdentifier, UniqueName) { - ignition::fuel_tools::ServerConfig srv1; + ServerConfig srv1; srv1.SetUrl(common::URI("https://localhost:8001/")); - ignition::fuel_tools::ServerConfig srv2; + ServerConfig srv2; srv2.SetUrl(common::URI("https://localhost:8002")); - ignition::fuel_tools::ServerConfig srv3; + ServerConfig srv3; srv3.SetUrl(common::URI("https://localhost:8003")); CollectionIdentifier id; @@ -75,7 +75,7 @@ TEST(CollectionIdentifier, CopyConstructorDeepCopy) id.SetName("hello"); id.SetOwner("watermelon"); - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("https://localhost:8001")); id.SetServer(srv); @@ -96,7 +96,7 @@ TEST(CollectionIdentifier, AssignmentOperatorDeepCopy) CollectionIdentifier id; id.SetName("hello"); id.SetOwner("pineapple"); - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("https://localhost:8001")); id.SetServer(srv); diff --git a/src/FuelClient.cc b/src/FuelClient.cc index 3eb6c2f8..6e764551 100644 --- a/src/FuelClient.cc +++ b/src/FuelClient.cc @@ -270,7 +270,7 @@ Result FuelClient::ModelDetails(const ModelIdentifier &_id, Result FuelClient::ModelDetails(const ModelIdentifier &_id, ModelIdentifier &_model, const std::vector &_headers) const { - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; auto serverUrl = _id.Server().Url().Str(); @@ -326,7 +326,7 @@ Result FuelClient::WorldDetails(const WorldIdentifier &_id, if (serverUrl.empty() || _id.Owner().empty() || _id.Name().empty()) return Result(ResultType::FETCH_ERROR); - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; auto version = _id.Server().Version(); @@ -436,7 +436,7 @@ Result FuelClient::UploadModel(const std::string &_pathToModelDir, const ModelIdentifier &_id, const std::vector &_headers, bool _private) { - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; std::multimap form; @@ -473,7 +473,7 @@ Result FuelClient::DeleteModel(const ModelIdentifier &) } void FuelClient::AddServerConfigParametersToHeaders( - const ignition::fuel_tools::ServerConfig &_serverConfig, + const ServerConfig &_serverConfig, std::vector &_headers) const { bool privateTokenDefined = false; @@ -497,7 +497,7 @@ void FuelClient::AddServerConfigParametersToHeaders( Result FuelClient::DeleteUrl(const ignition::common::URI &_uri, const std::vector &_headers) { - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; std::string server; @@ -607,7 +607,7 @@ Result FuelClient::DownloadModel(const ModelIdentifier &_id, AddServerConfigParametersToHeaders( _id.Server(), headersIncludingServerConfig); // Request - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; resp = rest.Request(HttpMethod::GET, _id.Server().Url().Str(), _id.Server().Version(), route.Str(), {}, @@ -660,16 +660,16 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id, // Locate any dependencies from the input model and download them. std::string path; - ignition::msgs::FuelMetadata meta; - if (this->CachedModel(ignition::common::URI(_id.UniqueName()), path)) + msgs::FuelMetadata meta; + if (this->CachedModel(common::URI(_id.UniqueName()), path)) { std::string metadataPath = - ignition::common::joinPaths(path, "metadata.pbtxt"); + common::joinPaths(path, "metadata.pbtxt"); std::string modelConfigPath = - ignition::common::joinPaths(path, "model.config"); + common::joinPaths(path, "model.config"); - bool foundMetadataPath = ignition::common::exists(metadataPath); - bool foundModelConfigPath = ignition::common::exists(modelConfigPath); + bool foundMetadataPath = common::exists(metadataPath); + bool foundModelConfigPath = common::exists(modelConfigPath); if (foundMetadataPath || foundModelConfigPath) { @@ -688,7 +688,7 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id, } else { - if (!ignition::msgs::ConvertFuelMetadata(inputStr, meta)) + if (!msgs::ConvertFuelMetadata(inputStr, meta)) { return Result(ResultType::UPLOAD_ERROR); } @@ -696,7 +696,7 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id, for (int i = 0; i < meta.dependencies_size(); ++i) { - ignition::common::URI dependencyURI(meta.dependencies(i).uri()); + common::URI dependencyURI(meta.dependencies(i).uri()); ModelIdentifier dependencyID; if(!this->ParseModelUrl(dependencyURI, dependencyID)) @@ -774,7 +774,7 @@ Result FuelClient::DownloadWorld(WorldIdentifier &_id) _id.Server(), headersIncludingServerConfig); // Request - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; resp = rest.Request(HttpMethod::GET, _id.Server().Url().Str(), _id.Server().Version(), route.Str(), {}, @@ -924,7 +924,7 @@ std::vector FuelClient::DownloadModels( Result FuelClient::DownloadWorlds( const std::vector &_ids, size_t _jobs) { - std::deque> tasks; + std::deque> tasks; // Check for finished tasks by checking if the status of their futures is // "ready". If a task is finished, check if it succeeded and print out an // error message if it failed. When a task is finished, it gets erased from @@ -947,7 +947,7 @@ Result FuelClient::DownloadWorlds( { for (auto taskIt = finishedIt; taskIt != tasks.end(); ++taskIt) { - ignition::fuel_tools::Result result = taskIt->get(); + Result result = taskIt->get(); if (result) { ++itemCount; @@ -1354,7 +1354,7 @@ Result FuelClient::DownloadModel(const common::URI &_modelUrl, id.SetVersion(model.Identification().Version()); } - _path = ignition::common::joinPaths(this->Config().CacheLocation(), + _path = common::joinPaths(this->Config().CacheLocation(), id.Server().Url().Path().Str(), id.Owner(), "models", id.Name(), id.VersionStr()); @@ -1474,10 +1474,10 @@ Result FuelClient::CachedModelFile(const common::URI &_fileUrl, // Check if file exists filePath = common::joinPaths(modelPath, filePath); - std::vector tokens = ignition::common::split(filePath, "/"); + std::vector tokens = common::split(filePath, "/"); std::string sTemp; for (auto s : tokens) - sTemp = ignition::common::joinPaths(sTemp, s); + sTemp = common::joinPaths(sTemp, s); filePath = sTemp; if (common::exists(filePath)) @@ -1524,7 +1524,7 @@ Result FuelClient::CachedWorldFile(const common::URI &_fileUrl, ////////////////////////////////////////////////// Result FuelClient::PatchModel( - const ignition::fuel_tools::ModelIdentifier &_model, + const ModelIdentifier &_model, const std::vector &_headers) { return this->PatchModel(_model, _headers, ""); @@ -1532,11 +1532,11 @@ Result FuelClient::PatchModel( ////////////////////////////////////////////////// Result FuelClient::PatchModel( - const ignition::fuel_tools::ModelIdentifier &_model, + const ModelIdentifier &_model, const std::vector &_headers, const std::string &_pathToModelDir) { - ignition::fuel_tools::Rest rest; + Rest rest; RestResponse resp; auto serverUrl = _model.Server().Url().Str(); @@ -1603,7 +1603,7 @@ bool FuelClientPrivate::FillModelForm(const std::string &_pathToModelDir, return false; } - ignition::msgs::FuelMetadata meta; + msgs::FuelMetadata meta; // Try the `metadata.pbtxt` file first since it contains more information // than `model.config`. @@ -1631,7 +1631,7 @@ bool FuelClientPrivate::FillModelForm(const std::string &_pathToModelDir, std::string inputStr((std::istreambuf_iterator(inputFile)), std::istreambuf_iterator()); - if (!ignition::msgs::ConvertFuelMetadata(inputStr, meta)) + if (!msgs::ConvertFuelMetadata(inputStr, meta)) { ignerr << "Unable to convert model config[" << _pathToModelDir << "].\n"; return false; diff --git a/src/FuelClient_TEST.cc b/src/FuelClient_TEST.cc index 111dd579..712787e6 100644 --- a/src/FuelClient_TEST.cc +++ b/src/FuelClient_TEST.cc @@ -89,7 +89,7 @@ void createLocalModel(ClientConfig &_conf) "model.dae"))); } - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("http://localhost:8007/")); _conf.AddServer(srv); } @@ -120,8 +120,8 @@ void createLocalWorld(ClientConfig &_conf) "strawberry.world"))); } - ignition::fuel_tools::ServerConfig srv; - srv.SetUrl(ignition::common::URI("http://localhost:8007/")); + ServerConfig srv; + srv.SetUrl(common::URI("http://localhost:8007/")); _conf.AddServer(srv); } @@ -130,7 +130,7 @@ class FuelClientTest : public ::testing::Test { public: void SetUp() override { - ignition::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -146,7 +146,7 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://some.example.org/1.0/german/models/Cardboard Box"}; - EXPECT_TRUE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_TRUE(client.ParseModelUrl(common::URI(url), id)); EXPECT_EQ(id.Server().Url().Str(), "https://some.example.org"); EXPECT_EQ(id.Server().Version(), "1.0"); @@ -165,7 +165,7 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/1.0/german/models/Cardboard Box/4"}; - EXPECT_TRUE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_TRUE(client.ParseModelUrl(common::URI(url), id)); EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org"); EXPECT_EQ(id.Server().Version(), "1.0"); @@ -184,7 +184,7 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/5.0/german/models/Cardboard Box/6"}; - EXPECT_TRUE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_TRUE(client.ParseModelUrl(common::URI(url), id)); EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org"); EXPECT_EQ(id.Server().Version(), "1.0"); @@ -201,7 +201,7 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/german/models/Cardboard Box"}; - EXPECT_TRUE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_TRUE(client.ParseModelUrl(common::URI(url), id)); EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org"); EXPECT_FALSE(id.Server().Version().empty()); @@ -220,7 +220,7 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/german/models/Cardboard Box/tip"}; - EXPECT_TRUE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_TRUE(client.ParseModelUrl(common::URI(url), id)); EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org"); EXPECT_EQ(id.Server().Version(), "1.0"); @@ -233,7 +233,7 @@ TEST_F(FuelClientTest, ParseModelURL) { FuelClient client; ModelIdentifier id; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI("http://bad.url"), + EXPECT_FALSE(client.ParseModelUrl(common::URI("http://bad.url"), id)); } @@ -241,13 +241,13 @@ TEST_F(FuelClientTest, ParseModelURL) { FuelClient client; ModelIdentifier id; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI("bad url"), + EXPECT_FALSE(client.ParseModelUrl(common::URI("bad url"), id)); } { FuelClient client; ModelIdentifier id; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI("ba://url"), + EXPECT_FALSE(client.ParseModelUrl(common::URI("ba://url"), id)); } { @@ -255,21 +255,21 @@ TEST_F(FuelClientTest, ParseModelURL) ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/german/models/Cardboard Box/banana"}; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_FALSE(client.ParseModelUrl(common::URI(url), id)); } { FuelClient client; ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/banana/german/models/Cardboard Box"}; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_FALSE(client.ParseModelUrl(common::URI(url), id)); } { FuelClient client; ModelIdentifier id; const std::string url{ "https://fuel.ignitionrobotics.org/99/german/models/Cardboard Box"}; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_FALSE(client.ParseModelUrl(common::URI(url), id)); } { FuelClient client; @@ -277,7 +277,7 @@ TEST_F(FuelClientTest, ParseModelURL) const std::string url{ "https://fuel.ignitionrobotics.org/2/2/german/models" "/Cardboard Box/banana"}; - EXPECT_FALSE(client.ParseModelUrl(ignition::common::URI(url), id)); + EXPECT_FALSE(client.ParseModelUrl(common::URI(url), id)); } } @@ -1070,7 +1070,7 @@ TEST_F(FuelClientTest, DownloadWorld) ASSERT_TRUE(common::createDirectories("test_cache")); ServerConfig server; - server.SetUrl(ignition::common::URI( + server.SetUrl(common::URI( "https://fuel.ignitionrobotics.org")); ClientConfig config; diff --git a/src/LocalCache_TEST.cc b/src/LocalCache_TEST.cc index 011a9756..994aeeca 100644 --- a/src/LocalCache_TEST.cc +++ b/src/LocalCache_TEST.cc @@ -88,7 +88,7 @@ void createLocal6Models(ClientConfig &_conf) common::joinPaths(serverPath, "trudy", "models", "tm2", "2", "model.config"))); - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("http://localhost:8001/")); _conf.AddServer(srv); } @@ -122,8 +122,8 @@ void createLocal3Models(ClientConfig &_conf) common::joinPaths(serverPath, "trudy", "models", "tm1", "3", "model.config"))); - ignition::fuel_tools::ServerConfig srv; - srv.SetUrl(ignition::common::URI("http://localhost:8007/")); + ServerConfig srv; + srv.SetUrl(common::URI("http://localhost:8007/")); _conf.AddServer(srv); } @@ -174,8 +174,8 @@ void createLocal6Worlds(ClientConfig &_conf) common::joinPaths(serverPath, "trudy", "worlds", "tm2", "2", "world.world"))); - ignition::fuel_tools::ServerConfig srv; - srv.SetUrl(ignition::common::URI("http://localhost:8001/")); + ServerConfig srv; + srv.SetUrl(common::URI("http://localhost:8001/")); _conf.AddServer(srv); } @@ -208,7 +208,7 @@ void createLocal3Worlds(ClientConfig &_conf) common::joinPaths(serverPath, "trudy", "worlds", "tm1", "3", "world.world"))); - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("http://localhost:8007/")); _conf.AddServer(srv); } @@ -218,7 +218,7 @@ class LocalCacheTest : public ::testing::Test { public: void SetUp() override { - ignition::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -234,7 +234,7 @@ TEST_F(LocalCacheTest, AllModels) createLocal6Models(conf); createLocal3Models(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); auto iter = cache.AllModels(); std::set uniqueNames; @@ -263,7 +263,7 @@ TEST_F(LocalCacheTest, MatchingModels) createLocal6Models(conf); createLocal3Models(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); ModelIdentifier am1; am1.SetServer(conf.Servers().front()); @@ -307,12 +307,12 @@ TEST_F(LocalCacheTest, MatchingModel) conf.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache")); createLocal6Models(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); - ignition::fuel_tools::ServerConfig srv1; + ServerConfig srv1; srv1.SetUrl(common::URI("http://localhost:8001/")); - ignition::fuel_tools::ServerConfig srv2; + ServerConfig srv2; srv2.SetUrl(common::URI("http://localhost:8002/")); ModelIdentifier am1; @@ -364,7 +364,7 @@ TEST_F(LocalCacheTest, AllWorlds) createLocal6Worlds(conf); createLocal3Worlds(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); auto iter = cache.AllWorlds(); std::set uniqueNames; @@ -376,10 +376,10 @@ TEST_F(LocalCacheTest, AllWorlds) EXPECT_EQ(9u, uniqueNames.size()); #ifdef _WIN32 EXPECT_NE(uniqueNames.end(), uniqueNames.find( - ignition::common::joinPaths("localhost8001", "alice", "worlds", "am1"))); + common::joinPaths("localhost8001", "alice", "worlds", "am1"))); #else EXPECT_NE(uniqueNames.end(), uniqueNames.find( - ignition::common::joinPaths("localhost:8001", "alice", "worlds", "am1"))); + common::joinPaths("localhost:8001", "alice", "worlds", "am1"))); #endif } @@ -397,7 +397,7 @@ TEST_F(LocalCacheTest, MatchingWorlds) createLocal6Worlds(conf); createLocal3Worlds(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); WorldIdentifier am1; am1.SetServer(conf.Servers().front()); @@ -429,13 +429,13 @@ TEST_F(LocalCacheTest, MatchingWorld) conf.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache")); createLocal6Worlds(conf); - ignition::fuel_tools::LocalCache cache(&conf); + LocalCache cache(&conf); - ignition::fuel_tools::ServerConfig srv1; - srv1.SetUrl(ignition::common::URI("http://localhost:8001/")); + ServerConfig srv1; + srv1.SetUrl(common::URI("http://localhost:8001/")); - ignition::fuel_tools::ServerConfig srv2; - srv2.SetUrl(ignition::common::URI("http://localhost:8002/")); + ServerConfig srv2; + srv2.SetUrl(common::URI("http://localhost:8002/")); WorldIdentifier am1; am1.SetServer(srv1); diff --git a/src/ModelIdentifier_TEST.cc b/src/ModelIdentifier_TEST.cc index b1dd87ef..224e8c3f 100644 --- a/src/ModelIdentifier_TEST.cc +++ b/src/ModelIdentifier_TEST.cc @@ -57,13 +57,13 @@ TEST(ModelIdentifier, SetFields) /// \brief Unique Name TEST(ModelIdentifier, UniqueName) { - ignition::fuel_tools::ServerConfig srv1; + ServerConfig srv1; srv1.SetUrl(common::URI("https://localhost:8001/")); - ignition::fuel_tools::ServerConfig srv2; + ServerConfig srv2; srv2.SetUrl(common::URI("https://localhost:8002")); - ignition::fuel_tools::ServerConfig srv3; + ServerConfig srv3; srv3.SetUrl(common::URI("https://localhost:8003")); ModelIdentifier id; diff --git a/src/ModelIter_TEST.cc b/src/ModelIter_TEST.cc index d23fcb5b..97fdb6c2 100644 --- a/src/ModelIter_TEST.cc +++ b/src/ModelIter_TEST.cc @@ -44,7 +44,7 @@ namespace ignition public: static ModelIter ModelIterThreeModelIds() { - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("https://ignitionrobotics.org")); std::vector ids; @@ -66,7 +66,7 @@ namespace ignition public: static ModelIter ModelIterThreeModels() { - ignition::fuel_tools::ServerConfig srv; + ServerConfig srv; srv.SetUrl(common::URI("https://ignitionrobotics.org")); std::vector models; diff --git a/src/RestClient.cc b/src/RestClient.cc index be2a17ea..0e2d01fa 100644 --- a/src/RestClient.cc +++ b/src/RestClient.cc @@ -147,7 +147,7 @@ struct curl_httppost *BuildFormPost( std::string path = value.substr(1); // Default upload filename - std::string uploadFilename = ignition::common::basename(path); + std::string uploadFilename = common::basename(path); // If the value has a semicolon, then use the string preceding the // semicolon as the local filesystem path and the string following @@ -158,7 +158,7 @@ struct curl_httppost *BuildFormPost( uploadFilename = value.substr(value.find(";") + 1); } - std::string basename = ignition::common::basename(path); + std::string basename = common::basename(path); std::string contentType = "application/octet-stream"; // Figure out the content type based on the file extension. @@ -166,7 +166,7 @@ struct curl_httppost *BuildFormPost( if (dotIdx != std::string::npos) { std::string extension = - ignition::common::lowercase(basename.substr(dotIdx)); + common::lowercase(basename.substr(dotIdx)); if (kContentTypes.find(extension) != kContentTypes.end()) { contentType = kContentTypes.at(extension); diff --git a/src/Result_TEST.cc b/src/Result_TEST.cc index 0559fa01..f64e8db1 100644 --- a/src/Result_TEST.cc +++ b/src/Result_TEST.cc @@ -81,7 +81,7 @@ TEST(Result, TypeCanBeSet) /// \brief Check that there are readable strings returned TEST(Result, ReadableStringsHaveLength) { - ignition::fuel_tools::Result r(ResultType::FETCH); + Result r(ResultType::FETCH); EXPECT_FALSE(Result(ResultType::DELETE).ReadableResult().empty()); EXPECT_FALSE(Result(ResultType::FETCH).ReadableResult().empty()); diff --git a/src/WorldIdentifier_TEST.cc b/src/WorldIdentifier_TEST.cc index 52d4cf0d..ec157070 100644 --- a/src/WorldIdentifier_TEST.cc +++ b/src/WorldIdentifier_TEST.cc @@ -43,15 +43,15 @@ TEST(WorldIdentifier, SetFields) /// \brief Unique Name TEST(WorldIdentifier, UniqueName) { - ignition::fuel_tools::ServerConfig srv1; - srv1.SetUrl(ignition::common::URI("https://localhost:8001/")); + ServerConfig srv1; + srv1.SetUrl(common::URI("https://localhost:8001/")); - ignition::fuel_tools::ServerConfig srv2; - srv2.SetUrl(ignition::common::URI("https://localhost:8002")); + ServerConfig srv2; + srv2.SetUrl(common::URI("https://localhost:8002")); - ignition::fuel_tools::ServerConfig srv3; + ServerConfig srv3; - srv3.SetUrl(ignition::common::URI("https://localhost:8003/")); + srv3.SetUrl(common::URI("https://localhost:8003/")); WorldIdentifier id; id.SetName("hello"); diff --git a/src/WorldIter.cc b/src/WorldIter.cc index dd0aa630..915b3aef 100644 --- a/src/WorldIter.cc +++ b/src/WorldIter.cc @@ -129,7 +129,7 @@ WorldIterRestIds::WorldIterRestIds(const Rest &_rest, // Get the next page from the headers. if (resp.headers.find("Link") != resp.headers.end()) { - std::vector links = ignition::common::split( + std::vector links = common::split( resp.headers["Link"], ","); for (const auto &l : links) { diff --git a/src/WorldIter_TEST.cc b/src/WorldIter_TEST.cc index e0283f39..0836d012 100644 --- a/src/WorldIter_TEST.cc +++ b/src/WorldIter_TEST.cc @@ -43,8 +43,8 @@ namespace ignition public: static WorldIter WorldIterThreeWorldIds() { - ignition::fuel_tools::ServerConfig srv; - srv.SetUrl(ignition::common::URI("https://ignitionrobotics.org")); + ServerConfig srv; + srv.SetUrl(common::URI("https://ignitionrobotics.org")); std::vector ids; for (int i = 0; i < 3; i++) diff --git a/src/Zip.cc b/src/Zip.cc index a4529f48..7eb3b9ff 100644 --- a/src/Zip.cc +++ b/src/Zip.cc @@ -35,7 +35,7 @@ using namespace fuel_tools; bool CompressFile(zip *_archive, const std::string &_file, const std::string &_entry) { - if (ignition::common::isDirectory(_file)) + if (common::isDirectory(_file)) { if (zip_add_dir(_archive, _entry.c_str()) < 0) { @@ -43,12 +43,12 @@ bool CompressFile(zip *_archive, const std::string &_file, return false; } - ignition::common::DirIter endIt; - for (ignition::common::DirIter dirIt(_file); dirIt != endIt; ++dirIt) + common::DirIter endIt; + for (common::DirIter dirIt(_file); dirIt != endIt; ++dirIt) { std::string file = *dirIt; - std::string entryName = ignition::common::joinPaths(_entry, - ignition::common::basename(file)); + std::string entryName = common::joinPaths(_entry, + common::basename(file)); if (!CompressFile(_archive, file, entryName)) { @@ -56,7 +56,7 @@ bool CompressFile(zip *_archive, const std::string &_file, } } } - else if (ignition::common::isFile(_file)) + else if (common::isFile(_file)) { std::ifstream in(_file.c_str(), std::ifstream::ate | std::ifstream::binary); @@ -83,7 +83,7 @@ bool CompressFile(zip *_archive, const std::string &_file, ///////////////////////////////////////////////// bool Zip::Compress(const std::string &_src, const std::string &_dst) { - if (!ignition::common::exists(_src)) + if (!common::exists(_src)) { ignerr << "Directory does not exist: " << _src << std::endl; return false; @@ -97,7 +97,7 @@ bool Zip::Compress(const std::string &_src, const std::string &_dst) return false; } - std::string entry = ignition::common::basename(_src); + std::string entry = common::basename(_src); if (!CompressFile(archive, _src, entry)) { ignerr << "Error compressing file: " << _src << std::endl; @@ -113,7 +113,7 @@ bool Zip::Compress(const std::string &_src, const std::string &_dst) bool Zip::Extract(const std::string &_src, const std::string &_dst) { - if (!ignition::common::exists(_src)) + if (!common::exists(_src)) { ignerr << "Source archive does not exist: " << _src << std::endl; return false; @@ -138,13 +138,13 @@ bool Zip::Extract(const std::string &_src, auto entryname = std::string(sb.name); common::changeFromUnixPath(entryname); - std::string dst = ignition::common::joinPaths(_dst, entryname); + std::string dst = common::joinPaths(_dst, entryname); // Check if the entryname contains a / at the end. if so it's a directory - auto pos = entryname.rfind(ignition::common::separator("")); + auto pos = entryname.rfind(common::separator("")); if (pos != std::string::npos && pos == (entryname.size() - 1)) { - if (!ignition::common::createDirectories(dst)) + if (!common::createDirectories(dst)) { ignerr << "Error creating directory [" << dst << "]. " << "Do you have the right permissions?" << std::endl; diff --git a/src/Zip_TEST.cc b/src/Zip_TEST.cc index 9d70b5e0..de89ba87 100644 --- a/src/Zip_TEST.cc +++ b/src/Zip_TEST.cc @@ -150,7 +150,7 @@ class ZipTest : public ::testing::Test { public: void SetUp() override { - ignition::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -173,27 +173,27 @@ TEST_F(ZipTest, CompressAndExtract) { std::string newTempDir; ASSERT_TRUE(createAndSwitchToTempDir(newTempDir)); - auto d = ignition::common::joinPaths(newTempDir, "d1", "d2"); - ASSERT_TRUE(ignition::common::createDirectories(d)); - auto f = ignition::common::joinPaths(d, "new_file"); + auto d = common::joinPaths(newTempDir, "d1", "d2"); + ASSERT_TRUE(common::createDirectories(d)); + auto f = common::joinPaths(d, "new_file"); ASSERT_TRUE(createNewEmptyFile(f)); - EXPECT_TRUE(ignition::common::exists(f)); + EXPECT_TRUE(common::exists(f)); // Compress. - auto d1 = ignition::common::joinPaths(newTempDir, "d1"); - auto zipOutFile = ignition::common::joinPaths(newTempDir, "new_file.zip"); + auto d1 = common::joinPaths(newTempDir, "d1"); + auto zipOutFile = common::joinPaths(newTempDir, "new_file.zip"); EXPECT_TRUE(Zip::Compress(d1, zipOutFile)); - EXPECT_TRUE(ignition::common::exists(zipOutFile)); + EXPECT_TRUE(common::exists(zipOutFile)); // Extract. - auto extractOutDir = ignition::common::joinPaths(newTempDir, "extract"); + auto extractOutDir = common::joinPaths(newTempDir, "extract"); EXPECT_TRUE(Zip::Extract(zipOutFile, extractOutDir)); auto extractOutFile = - ignition::common::joinPaths(extractOutDir, "d1", "d2", "new_file"); - EXPECT_TRUE(ignition::common::exists(extractOutFile)); + common::joinPaths(extractOutDir, "d1", "d2", "new_file"); + EXPECT_TRUE(common::exists(extractOutFile)); // Clean. - ignition::common::removeAll(newTempDir); + common::removeAll(newTempDir); } ////////////////////////////////////////////////// diff --git a/test/integration/zip.cc b/test/integration/zip.cc index 6691426c..679a1706 100644 --- a/test/integration/zip.cc +++ b/test/integration/zip.cc @@ -31,7 +31,7 @@ class ZipIntegrationTest : public ::testing::Test { public: void SetUp() override { - ignition::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -48,24 +48,24 @@ TEST_F(ZipIntegrationTest, Extract) // check extracted contents std::string boxPath = common::joinPaths(dst, "box"); - EXPECT_TRUE(ignition::common::exists(boxPath)) << boxPath; - EXPECT_TRUE(ignition::common::isDirectory(boxPath)) << boxPath; + EXPECT_TRUE(common::exists(boxPath)) << boxPath; + EXPECT_TRUE(common::isDirectory(boxPath)) << boxPath; std::string boxFilePath = common::joinPaths(boxPath, "file"); - EXPECT_TRUE(ignition::common::exists(boxFilePath)) << boxFilePath; - EXPECT_TRUE(ignition::common::isFile(boxFilePath)) << boxFilePath; + EXPECT_TRUE(common::exists(boxFilePath)) << boxFilePath; + EXPECT_TRUE(common::isFile(boxFilePath)) << boxFilePath; std::string boxDirPath = common::joinPaths(boxPath, "dir"); - EXPECT_TRUE(ignition::common::exists(boxDirPath)) << boxDirPath; - EXPECT_TRUE(ignition::common::isDirectory(boxDirPath)) << boxDirPath; + EXPECT_TRUE(common::exists(boxDirPath)) << boxDirPath; + EXPECT_TRUE(common::isDirectory(boxDirPath)) << boxDirPath; std::string boxFile2Path = common::joinPaths(boxDirPath, "file2"); - EXPECT_TRUE(ignition::common::exists(boxFile2Path)) << boxFile2Path; - EXPECT_TRUE(ignition::common::isFile(boxFile2Path)); + EXPECT_TRUE(common::exists(boxFile2Path)) << boxFile2Path; + EXPECT_TRUE(common::isFile(boxFile2Path)); // cleanup - EXPECT_TRUE(ignition::common::removeAll(boxPath)); - EXPECT_FALSE(ignition::common::exists(boxPath)); + EXPECT_TRUE(common::removeAll(boxPath)); + EXPECT_FALSE(common::exists(boxPath)); } ///////////////////////////////////////////////// @@ -78,8 +78,8 @@ TEST_F(ZipIntegrationTest, Compress) std::string src = common::joinPaths(std::string(TEST_PATH), "media", "box"); EXPECT_TRUE(Zip::Compress(src, archivePath)); - EXPECT_TRUE(ignition::common::exists(archivePath)); - EXPECT_TRUE(ignition::common::isFile(archivePath)); + EXPECT_TRUE(common::exists(archivePath)); + EXPECT_TRUE(common::isFile(archivePath)); // extract the zip archive and verify contents std::string dst = std::string(PROJECT_BINARY_PATH); @@ -87,27 +87,27 @@ TEST_F(ZipIntegrationTest, Compress) // check extracted contents std::string boxPath = common::joinPaths(dst, "box"); - EXPECT_TRUE(ignition::common::exists(boxPath)); - EXPECT_TRUE(ignition::common::isDirectory(boxPath)); + EXPECT_TRUE(common::exists(boxPath)); + EXPECT_TRUE(common::isDirectory(boxPath)); std::string boxFilePath = common::joinPaths(boxPath, "file"); - EXPECT_TRUE(ignition::common::exists(boxFilePath)); - EXPECT_TRUE(ignition::common::isFile(boxFilePath)); + EXPECT_TRUE(common::exists(boxFilePath)); + EXPECT_TRUE(common::isFile(boxFilePath)); std::string boxDirPath = common::joinPaths(boxPath, "dir"); - EXPECT_TRUE(ignition::common::exists(boxDirPath)); - EXPECT_TRUE(ignition::common::isDirectory(boxDirPath)); + EXPECT_TRUE(common::exists(boxDirPath)); + EXPECT_TRUE(common::isDirectory(boxDirPath)); std::string boxFile2Path = common::joinPaths(boxDirPath, "file2"); - EXPECT_TRUE(ignition::common::exists(boxFile2Path)); - EXPECT_TRUE(ignition::common::isFile(boxFile2Path)); + EXPECT_TRUE(common::exists(boxFile2Path)); + EXPECT_TRUE(common::isFile(boxFile2Path)); // cleanup - EXPECT_TRUE(ignition::common::removeAll(archivePath)); - EXPECT_FALSE(ignition::common::exists(archivePath)); + EXPECT_TRUE(common::removeAll(archivePath)); + EXPECT_FALSE(common::exists(archivePath)); - EXPECT_TRUE(ignition::common::removeAll(boxPath)); - EXPECT_FALSE(ignition::common::exists(boxPath)); + EXPECT_TRUE(common::removeAll(boxPath)); + EXPECT_FALSE(common::exists(boxPath)); } /////////////////////////////////////////////////