summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/persistence
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-01-17 22:38:52 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-01-17 22:38:52 +0000
commitf9fd396dd0dc8ec336ee011bab1c3728a1c25c54 (patch)
tree320cf8944c4da888cfb35131f89c37f531f57033 /storage/src/tests/persistence
parentc7610b3a6585ad09a170da9658909d2a157ef44e (diff)
Wire in skeleton for implementation of the BucketExecutor interface.
Diffstat (limited to 'storage/src/tests/persistence')
-rw-r--r--storage/src/tests/persistence/common/filestortestfixture.cpp35
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp14
2 files changed, 20 insertions, 29 deletions
diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp
index 57c63747ece..b695fb508af 100644
--- a/storage/src/tests/persistence/common/filestortestfixture.cpp
+++ b/storage/src/tests/persistence/common/filestortestfixture.cpp
@@ -37,8 +37,7 @@ void
FileStorTestFixture::SetUp()
{
setupPersistenceThreads(1);
- _node->setPersistenceProvider(
- std::make_unique<spi::dummy::DummyPersistence>(_node->getTypeRepo()));
+ _node->setPersistenceProvider(std::make_unique<spi::dummy::DummyPersistence>(_node->getTypeRepo()));
_node->getPersistenceProvider().initialize();
}
@@ -64,8 +63,7 @@ FileStorTestFixture::createBucket(const document::BucketId& bid)
bool
FileStorTestFixture::bucketExistsInDb(const document::BucketId& bucket) const
{
- StorBucketDatabase::WrappedEntry entry(
- _node->getStorageBucketDatabase().get(bucket, "bucketExistsInDb"));
+ StorBucketDatabase::WrappedEntry entry(_node->getStorageBucketDatabase().get(bucket, "bucketExistsInDb"));
return entry.exist();
}
@@ -73,13 +71,13 @@ FileStorTestFixture::TestFileStorComponents::TestFileStorComponents(
FileStorTestFixture& fixture,
const StorageLinkInjector& injector)
: _fixture(fixture),
- manager(new FileStorManager(fixture._config->getConfigId(),
- fixture._node->getPersistenceProvider(),
- fixture._node->getComponentRegister(),
- *fixture._node))
+ manager(nullptr)
{
injector.inject(top);
- top.push_back(StorageLink::UP(manager));
+ auto fsm = std::make_unique<FileStorManager>(fixture._config->getConfigId(), fixture._node->getPersistenceProvider(),
+ fixture._node->getComponentRegister(), *fixture._node);
+ manager = fsm.get();
+ top.push_back(std::move(fsm));
top.open();
}
@@ -91,8 +89,7 @@ FileStorTestFixture::makeSelfAddress() {
}
void
-FileStorTestFixture::TestFileStorComponents::sendDummyGet(
- const document::BucketId& bid)
+FileStorTestFixture::TestFileStorComponents::sendDummyGet(const document::BucketId& bid)
{
std::ostringstream id;
id << "id:foo:testdoctype1:n=" << bid.getId() << ":0";
@@ -103,14 +100,12 @@ FileStorTestFixture::TestFileStorComponents::sendDummyGet(
}
void
-FileStorTestFixture::TestFileStorComponents::sendDummyGetDiff(
- const document::BucketId& bid)
+FileStorTestFixture::TestFileStorComponents::sendDummyGetDiff(const document::BucketId& bid)
{
std::vector<api::GetBucketDiffCommand::Node> nodes;
nodes.push_back(0);
nodes.push_back(1);
- std::shared_ptr<api::GetBucketDiffCommand> cmd(
- new api::GetBucketDiffCommand(makeDocumentBucket(bid), nodes, 12345));
+ auto cmd = std::make_shared<api::GetBucketDiffCommand>(makeDocumentBucket(bid), nodes, 12345);
cmd->setAddress(makeSelfAddress());
cmd->setPriority(255);
top.sendDown(cmd);
@@ -124,10 +119,8 @@ FileStorTestFixture::TestFileStorComponents::sendPut(
{
std::ostringstream id;
id << "id:foo:testdoctype1:n=" << bid.getId() << ":" << docIdx;
- document::Document::SP doc(
- _fixture._node->getTestDocMan().createDocument("foobar", id.str()));
- std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(makeDocumentBucket(bid), doc, timestamp));
+ document::Document::SP doc(_fixture._node->getTestDocMan().createDocument("foobar", id.str()));
+ auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), doc, timestamp);
cmd->setAddress(makeSelfAddress());
top.sendDown(cmd);
}
@@ -135,9 +128,7 @@ FileStorTestFixture::TestFileStorComponents::sendPut(
void
FileStorTestFixture::setClusterState(const std::string& state)
{
- _node->getStateUpdater().setClusterState(
- lib::ClusterState::CSP(new lib::ClusterState(state)));
+ _node->getStateUpdater().setClusterState(std::make_shared<lib::ClusterState>(state));
}
-
} // ns storage
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 3bd92d31ca7..cae24c5c6ce 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -238,14 +238,14 @@ struct TestFileStorComponents {
DummyStorageLink top;
FileStorManager* manager;
- explicit TestFileStorComponents(FileStorTestBase& test,
- bool use_small_config = false)
- : manager(new FileStorManager((use_small_config ? test.smallConfig : test.config)->getConfigId(),
- test._node->getPersistenceProvider(),
- test._node->getComponentRegister(),
- *test._node))
+ explicit TestFileStorComponents(FileStorTestBase& test, bool use_small_config = false)
+ : manager(nullptr)
{
- top.push_back(unique_ptr<StorageLink>(manager));
+ auto fsm = std::make_unique<FileStorManager>((use_small_config ? test.smallConfig : test.config)->getConfigId(),
+ test._node->getPersistenceProvider(),
+ test._node->getComponentRegister(), *test._node);
+ manager = fsm.get();
+ top.push_back(std::move(fsm));
top.open();
}
};