Files
secondo/Algebras/DBService2/NodeManagerTestFactory.hpp

40 lines
1013 B
C++
Raw Normal View History

2026-01-23 17:03:45 +08:00
#ifndef DBS_NODE_MANAGER_TEST_FACTORY_H
#define DBS_NODE_MANAGER_TEST_FACTORY_H
#include "Algebras/DBService2/Node.hpp"
#include "Algebras/DBService2/NodeManager.hpp"
#include "Algebras/DBService2/NodeTestFactory.hpp"
namespace DBServiceTest {
class NodeManagerTestFactory {
public:
static std::shared_ptr<DBService::NodeManager> buildNodeManagerWithNodes(
std::string recordDatabase,
std::string nodeType,
int lowestNodePort,
int nrOfNodes,
bool save = true
) {
std::shared_ptr<DBService::NodeManager> nodeManager =
std::make_shared<DBService::NodeManager>(recordDatabase);
// Build nrOrNodes Nodes
std::vector<std::shared_ptr<DBService::Node> > nodes =
NodeTestFactory::buildNodes(
recordDatabase, nodeType, lowestNodePort, nrOfNodes, false
);
for (auto& node : nodes) {
nodeManager->add(node);
}
nodeManager->save();
return nodeManager;
}
};
}
#endif