1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
10 #include "common/plugins/plugin.h"
11 #include "smoke_tests/libs/test_assessor.h"
13 namespace ci = common_installer;
17 std::optional<std::string> CheckArgs(const char* pkgid) {
19 return std::string("Package id is null for tag plugin");
20 if (strcmp(pkgid, ci::kTestPackageId) != 0)
21 return std::string("Package id doesn't match for tag plugin") +
22 "Expected: " + ci::kTestPackageId + " actual: " + pkgid;
26 std::optional<std::string> CheckArgs(xmlDocPtr doc, const char* pkgid) {
28 return std::string("XML doc pointer is null for tag plugin");
29 return CheckArgs(pkgid);
34 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char* package) {
35 ci::TestAssessor::Instance().AddResult(std::make_tuple(
37 ci::Plugin::ActionType::Install,
38 ci::Plugin::ProcessType::Pre),
43 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char* package) {
44 ci::TestAssessor::Instance().AddResult(std::make_tuple(
46 ci::Plugin::ActionType::Upgrade,
47 ci::Plugin::ProcessType::Pre),
51 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char* package) {
52 ci::TestAssessor::Instance().AddResult(std::make_tuple(
54 ci::Plugin::ActionType::Uninstall,
55 ci::Plugin::ProcessType::Pre),
60 extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc,
61 const char* package) {
62 ci::TestAssessor::Instance().AddResult(std::make_tuple(
64 ci::Plugin::ActionType::Install,
65 ci::Plugin::ProcessType::Main),
66 CheckArgs(doc, package));
70 extern "C" int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc,
71 const char* package) {
72 ci::TestAssessor::Instance().AddResult(std::make_tuple(
74 ci::Plugin::ActionType::Upgrade,
75 ci::Plugin::ProcessType::Main),
76 CheckArgs(doc, package));
80 extern "C" int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc,
81 const char* package) {
82 ci::TestAssessor::Instance().AddResult(std::make_tuple(
84 ci::Plugin::ActionType::Uninstall,
85 ci::Plugin::ProcessType::Main),
86 CheckArgs(doc, package));
90 extern "C" int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char* package) {
91 ci::TestAssessor::Instance().AddResult(std::make_tuple(
93 ci::Plugin::ActionType::Install,
94 ci::Plugin::ProcessType::Post),
99 extern "C" int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char* package) {
100 ci::TestAssessor::Instance().AddResult(std::make_tuple(
102 ci::Plugin::ActionType::Upgrade,
103 ci::Plugin::ProcessType::Post),
108 extern "C" int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char* package) {
109 ci::TestAssessor::Instance().AddResult(std::make_tuple(
111 ci::Plugin::ActionType::Uninstall,
112 ci::Plugin::ProcessType::Post),