"doesn't match expected. " << dump());
}
+void Admin::getPolicyTypeForDescription(const std::string &description,
+ int &policyType, int expectedResult)
+{
+ auto descr_deleter = [](cynara_admin_policy_descr** descr) {
+ if (descr != nullptr)
+ for (int i = 0; descr[i] != nullptr; i++) {
+ free(descr[i]->name);
+ free(descr[i]);
+ }
+ free(descr);
+ };
+ struct cynara_admin_policy_descr **descriptions = nullptr;
+ int ret = cynara_admin_list_policies_descriptions(m_admin, &descriptions);
+ std::unique_ptr<cynara_admin_policy_descr*, decltype(descr_deleter)>
+ descrPtr(descriptions, descr_deleter);
+ RUNNER_ASSERT_MSG(ret == expectedResult,
+ "cynara_admin_list_policies_descriptions returned wrong value: " <<
+ ret << " != " << expectedResult);
+ ret = 0;
+ for (int i = 0; descriptions[i] != nullptr; i++) {
+ if (descriptions[i]->name == description) {
+ policyType = descriptions[i]->result;
+ ret = 1;
+ }
+ }
+ if (!ret)
+ RUNNER_FAIL_MSG("Policy type for description " << description << " not found: ");
+}
+
} // namespace CynaraTestAdmin
struct AppInstallHelper {
using TypePathsMap = std::map<app_install_path_type, std::vector<std::string>>;
- AppInstallHelper(const std::string &appName,
- const std::string &pkgName,
+ AppInstallHelper(const std::string &appNamePrefix,
+ const std::string &pkgNamePrefix,
bool isLocal,
uid_t uid,
- std::string version)
- : m_appName(appName), m_pkgName(pkgName), m_isLocal(isLocal), m_uidGid(uid), m_version(version),
- m_installType(SM_APP_INSTALL_NONE)
+ std::string version,
+ bool isHybrid = false)
+ : m_appName(appNamePrefix), m_pkgName(pkgNamePrefix), m_isLocal(isLocal), m_uidGid(uid), m_version(version),
+ m_installType(SM_APP_INSTALL_NONE), m_isHybrid(isHybrid)
{
setInstallPath();
}
- AppInstallHelper(const std::string &name)
- : AppInstallHelper(name, name, false, geteuid(), TIZEN_VERSION)
+ AppInstallHelper(const std::string &appNamePrefix,
+ const std::string &pkgNamePrefix,
+ uid_t uid)
+ : AppInstallHelper(appNamePrefix, pkgNamePrefix, false, uid, TIZEN_VERSION)
{}
- AppInstallHelper(const std::string &appName, const std::string &pkgName)
- : AppInstallHelper(appName, pkgName, false, geteuid(), TIZEN_VERSION)
+ AppInstallHelper(const std::string &namePrefix)
+ : AppInstallHelper(namePrefix, namePrefix, false, geteuid(), TIZEN_VERSION)
{}
- AppInstallHelper(const std::string &appName, uid_t uid)
- : AppInstallHelper(appName, appName, true, uid, TIZEN_VERSION)
+ AppInstallHelper(const std::string &appNamePrefix, const std::string &pkgNamePrefix)
+ : AppInstallHelper(appNamePrefix, pkgNamePrefix, false, geteuid(), TIZEN_VERSION)
+ {}
+
+ AppInstallHelper(const std::string &namePrefix, uid_t uid)
+ : AppInstallHelper(namePrefix, namePrefix, true, uid, TIZEN_VERSION)
{}
// App info getters and setters
std::string getAuthor() const;
void setInstallType(app_install_type type);
app_install_type getInstallType();
+ bool getIsHybrid() const;
// Path types creation and removal on file system
void createInstallDir();
std::string generateAppLabel() const;
std::string generatePkgLabel() const;
void revokeRules() const;
-
virtual ~AppInstallHelper() {
removePaths();
}
int m_uidGid;
std::string m_version;
app_install_type m_installType;
-
+ bool m_isHybrid;
std::string m_installDir;
TypePathsMap m_dirTypeMap;
TypePathsMap m_fileTypeMap;