diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2016-08-31 15:51:19 +0200 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2016-08-31 15:51:19 +0200 |
commit | 18008755714b52eec3dbaca1ded566d2e81f2887 (patch) | |
tree | 78e651e9499cbb3fd4ee03a18993b0885c49e7e6 /searchcore/src/tests | |
parent | 4186e7b55afd00d1956f61344706aafd4f8901a7 (diff) |
use std::make_shared more often
Diffstat (limited to 'searchcore/src/tests')
6 files changed, 58 insertions, 86 deletions
diff --git a/searchcore/src/tests/proton/config/config.cpp b/searchcore/src/tests/proton/config/config.cpp index 5a26e3ac016..485f063e436 100644 --- a/searchcore/src/tests/proton/config/config.cpp +++ b/searchcore/src/tests/proton/config/config.cpp @@ -135,8 +135,8 @@ struct ConfigTestFixture { BootstrapConfig::DocumenttypesConfigSP(new DocumenttypesConfig(documenttypesBuilder)), DocumentTypeRepo::SP(new DocumentTypeRepo(documenttypesBuilder)), BootstrapConfig::ProtonConfigSP(new ProtonConfig(protonBuilder)), - BootstrapConfig::FiledistributorrpcConfigSP(new FiledistributorrpcConfig()), - TuneFileDocumentDB::SP(new TuneFileDocumentDB()))); + std::make_shared<FiledistributorrpcConfig>(), + std::make_shared<TuneFileDocumentDB>())); } void reload() { context->reload(); } diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index e5365ba0ede..e3f1e1db16d 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -166,12 +166,12 @@ public: _sa() { assert(_mkdirOk); - BootstrapConfig::SP b(new BootstrapConfig(1, - _documenttypesConfig, - _repo, - BootstrapConfig::ProtonConfigSP(new ProtonConfig()), - BootstrapConfig::FiledistributorrpcConfigSP(new FiledistributorrpcConfig()), - _tuneFileDocumentDB)); + auto b = std::make_shared<BootstrapConfig>(1, + _documenttypesConfig, + _repo, + std::make_shared<ProtonConfig>(), + std::make_shared<FiledistributorrpcConfig>(), + _tuneFileDocumentDB); _configMgr.forwardConfig(b); _configMgr.nextGeneration(0); if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) { abort(); } diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index e401f8e0301..a50a112aecc 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -317,47 +317,41 @@ struct FastAccessFixture DocumentDBConfig::SP createConfig() { - DocumentDBConfig::SP config - (new DocumentDBConfig( - 0, - DocumentDBConfig::RankProfilesConfigSP(new RankProfilesConfig()), - DocumentDBConfig::RankingConstantsConfigSP(new RankingConstantsConfig()), - DocumentDBConfig::IndexschemaConfigSP(new IndexschemaConfig()), - DocumentDBConfig::AttributesConfigSP(new AttributesConfig()), - DocumentDBConfig::SummaryConfigSP(new SummaryConfig()), - DocumentDBConfig::SummarymapConfigSP(new SummarymapConfig()), - DocumentDBConfig::JuniperrcConfigSP(new JuniperrcConfig()), - DocumenttypesConfigSP(new DocumenttypesConfig()), - DocumentTypeRepo::SP(createRepo()), - TuneFileDocumentDB::SP(new TuneFileDocumentDB), - Schema::SP(new Schema), - DocumentDBMaintenanceConfig::SP( - new DocumentDBMaintenanceConfig), - "client", DOC_TYPE)); - return config; + return std::make_shared<DocumentDBConfig>( + 0, + std::make_shared<RankProfilesConfig>(), + std::make_shared<RankingConstantsConfig>(), + std::make_shared<IndexschemaConfig>(), + std::make_shared<AttributesConfig>(), + std::make_shared<SummaryConfig>(), + std::make_shared<SummarymapConfig>(), + std::make_shared<JuniperrcConfig>(), + std::make_shared<DocumenttypesConfig>(), + DocumentTypeRepo::SP(createRepo()), + std::make_shared<TuneFileDocumentDB>(), + std::make_shared<Schema>(), + std::make_shared<DocumentDBMaintenanceConfig>(), + "client", DOC_TYPE); } DocumentDBConfig::SP createConfig(const Schema::SP &schema) { - DocumentDBConfig::SP config - (new DocumentDBConfig( - 0, - DocumentDBConfig::RankProfilesConfigSP(new RankProfilesConfig()), - DocumentDBConfig::RankingConstantsConfigSP(new RankingConstantsConfig()), - DocumentDBConfig::IndexschemaConfigSP(new IndexschemaConfig()), - DocumentDBConfig::AttributesConfigSP(new AttributesConfig()), - DocumentDBConfig::SummaryConfigSP(new SummaryConfig()), - DocumentDBConfig::SummarymapConfigSP(new SummarymapConfig()), - DocumentDBConfig::JuniperrcConfigSP(new JuniperrcConfig()), - DocumenttypesConfigSP(new DocumenttypesConfig()), - DocumentTypeRepo::SP(createRepo()), - TuneFileDocumentDB::SP(new TuneFileDocumentDB), - schema, - DocumentDBMaintenanceConfig::SP( - new DocumentDBMaintenanceConfig), - "client", DOC_TYPE)); - return config; + return std::make_shared<DocumentDBConfig>( + 0, + std::make_shared<RankProfilesConfig>(), + std::make_shared<RankingConstantsConfig>(), + std::make_shared<IndexschemaConfig>(), + std::make_shared<AttributesConfig>(), + std::make_shared<SummaryConfig>(), + std::make_shared<SummarymapConfig>(), + std::make_shared<JuniperrcConfig>(), + std::make_shared<DocumenttypesConfig>(), + DocumentTypeRepo::SP(createRepo()), + std::make_shared<TuneFileDocumentDB>(), + schema, + std::make_shared<DocumentDBMaintenanceConfig>(), + "client", DOC_TYPE); } struct SearchViewComparer diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index a98f07439c9..384de9f207e 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -262,8 +262,8 @@ struct MyConfigSnapshot (new BootstrapConfig(1, documenttypesConfig, _builder.getDocumentTypeRepo(), - BootstrapConfig::ProtonConfigSP(new ProtonConfig()), - BootstrapConfig::FiledistributorrpcConfigSP(new FiledistributorrpcConfig()), + std::make_shared<ProtonConfig>(), + std::make_shared<FiledistributorrpcConfig>(), tuneFileDocumentDB)); config::DirSpec spec(cfgDir); DocumentDBConfigHelper mgr(spec, "searchdocument"); diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index d6d54d31f16..699da256c8e 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -79,8 +79,8 @@ Fixture::Fixture() b(new BootstrapConfig(1, documenttypesConfig, repo, - BootstrapConfig::ProtonConfigSP(new ProtonConfig()), - BootstrapConfig::FiledistributorrpcConfigSP(new FiledistributorrpcConfig()), + std::make_shared<ProtonConfig>(), + std::make_shared<FiledistributorrpcConfig>(), tuneFileDocumentDB)); mgr.forwardConfig(b); mgr.nextGeneration(0); diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index c811c8912b0..ec47b3c3705 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -32,43 +32,21 @@ namespace DocumentDBConfig::SP getConfig(int64_t generation, const Schema::SP &schema) { - typedef DocumentDBConfig::RankProfilesConfigSP RankProfilesConfigSP; - typedef DocumentDBConfig::RankingConstantsConfigSP RankingConstantsConfigSP; - typedef DocumentDBConfig::IndexschemaConfigSP IndexschemaConfigSP; - typedef DocumentDBConfig::AttributesConfigSP AttributesConfigSP; - typedef DocumentDBConfig::SummaryConfigSP SummaryConfigSP; - typedef DocumentDBConfig::SummarymapConfigSP SummarymapConfigSP; - typedef DocumentDBConfig::JuniperrcConfigSP JuniperrcConfigSP; - typedef DocumentDBConfig::DocumenttypesConfigSP DocumenttypesConfigSP; - - RankProfilesConfigSP rp(new vespa::config::search::RankProfilesConfig); - RankingConstantsConfigSP rc(new vespa::config::search::core::RankingConstantsConfig); - IndexschemaConfigSP is(new vespa::config::search::IndexschemaConfig); - AttributesConfigSP a(new vespa::config::search::AttributesConfig); - SummaryConfigSP s(new vespa::config::search::SummaryConfig); - SummarymapConfigSP sm(new vespa::config::search::SummarymapConfig); - JuniperrcConfigSP j(new vespa::config::search::summary::JuniperrcConfig); - DocumenttypesConfigSP dt(new document::DocumenttypesConfig); - document::DocumentTypeRepo::SP dtr(new document::DocumentTypeRepo); - search::TuneFileDocumentDB::SP tf(new search::TuneFileDocumentDB); - DocumentDBMaintenanceConfig::SP ddbm(new DocumentDBMaintenanceConfig); - - return DocumentDBConfig::SP( - new DocumentDBConfig( + return std::make_shared<DocumentDBConfig>( generation, - rp, - rc, - is, - a, - s, - sm, - j, - dt, - dtr, - tf, + std::make_shared<vespa::config::search::RankProfilesConfig>(), + std::make_shared<vespa::config::search::core::RankingConstantsConfig>(), + std::make_shared<vespa::config::search::IndexschemaConfig>(), + std::make_shared<vespa::config::search::AttributesConfig>(), + std::make_shared<vespa::config::search::SummaryConfig>(), + std::make_shared<vespa::config::search::SummarymapConfig>(), + std::make_shared<vespa::config::search::summary::JuniperrcConfig>(), + std::make_shared<document::DocumenttypesConfig>(), + std::make_shared<document::DocumentTypeRepo>(), + std::make_shared<search::TuneFileDocumentDB>(), schema, - ddbm, - "client", "test")); + std::make_shared<DocumentDBMaintenanceConfig>(), + "client", "test"); } Schema::SP @@ -98,9 +76,9 @@ makeBaseConfigSnapshot() BootstrapConfig::SP b(new BootstrapConfig(1, dtcfg, DocumentTypeRepo::SP(new DocumentTypeRepo(*dtcfg)), - BootstrapConfig::ProtonConfigSP(new ProtonConfig()), - BootstrapConfig::FiledistributorrpcConfigSP(new FiledistributorrpcConfig()), - TuneFileDocumentDB::SP(new TuneFileDocumentDB()))); + std::make_shared<ProtonConfig>(), + std::make_shared<FiledistributorrpcConfig>(), + std::make_shared<TuneFileDocumentDB>())); dbcm.forwardConfig(b); dbcm.nextGeneration(0); DocumentDBConfig::SP snap = dbcm.getConfig(); |