+ if (!request.m_authorId.empty()) {
+ os << "author id: " << request.m_authorId << "; ";
+ }
+ return os;
+}
+
+PathsRequest::PathsRequest()
+ : m_req(nullptr)
+ , m_uid(false, 0)
+{
+ int result = security_manager_path_req_new(&m_req);
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ "creation of new request failed. Result: " << result);
+ RUNNER_ASSERT_MSG(m_req != nullptr, "creation of new request did not allocate memory");
+}
+
+PathsRequest::~PathsRequest()
+{
+ security_manager_path_req_free(m_req);
+}
+
+void PathsRequest::setPkgId(std::string pkgId, lib_retcode expectedResult)
+{
+ int result = security_manager_path_req_set_pkg_id(m_req, pkgId.c_str());
+ RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+ "setting pkg id returned wrong value."
+ << " Pkg id: " << pkgId << ";"
+ << " Result: " << result << ";"
+ << " Expected result: " << expectedResult);
+ m_pkgId = std::move(pkgId);
+}
+
+void PathsRequest::addPath(std::string path, app_install_path_type pathType, lib_retcode expectedResult)
+{
+ int result = security_manager_path_req_add_path(m_req, path.c_str(), pathType);
+ RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+ "adding path returned wrong value."
+ << " Path: " << path << ";"
+ << " Path type: " << pathType << ";"
+ << " Result: " << result << ";"
+ << " Expected result: " << expectedResult);
+ m_paths.emplace_back(std::pair<std::string, app_install_path_type>(std::move(path), pathType));
+}
+
+void PathsRequest::setUid(const uid_t uid, lib_retcode expectedResult)
+{
+ int result = security_manager_path_req_set_uid(m_req, uid);
+ RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+ "setting uid returned wrong value."
+ << " Uid: " << uid << ";"
+ << " Result: " << result << ";"
+ << " Expected result: " << expectedResult);
+ m_uid.first = true;
+ m_uid.second = uid;
+}
+
+void PathsRequest::setInstallType(const enum app_install_type &type, lib_retcode expectedResult)
+{
+ int result = security_manager_path_req_set_install_type(m_req, type);
+ RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+ "setting install type returned wrong value."
+ << " Install type: " << type << ";"
+ << " Result: " << result << ";"
+ << " Expected result: " << expectedResult);
+}
+
+std::ostream& operator<<(std::ostream &os, const PathsRequest &request)
+{
+ if (!request.m_pkgId.empty())
+ os << "pkg id: " << request.m_pkgId << "; ";
+ if (!request.m_paths.empty()) {
+ os << "paths: [ " << "< " << request.m_paths[0].first << "; "
+ << request.m_paths[0].second << " >";
+ for (size_t i=1; i < request.m_paths.size(); ++i) {
+ os << "; < " << request.m_paths[i].first << "; "
+ << request.m_paths[i].second << " >";
+ }
+ os << " ]";
+ }
+ if (request.m_uid.first)
+ os << "uid: " << request.m_uid.second << "; ";