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.
5 #include <boost/optional/optional.hpp>
7 #include <pkgmgr_parser.h>
9 #include <glib/glist.h>
15 #include "common/plugins/plugin.h"
16 #include "common/utils/glist_range.h"
17 #include "smoke_tests/libs/test_assessor.h"
19 namespace ci = common_installer;
23 boost::optional<std::string> CheckArgs(
28 return std::string("Package id is null for metadata plugin");
30 return std::string("Application id is null for metadata plugin");
31 if (strcmp(pkgid, ci::kTestPackageId) != 0)
32 return std::string("Package id doesn't match for metadata plugin");
33 if (strcmp(appid, ci::kTestApplicationId) != 0)
34 return std::string("Application id doesn't match for metadata plugin");
35 auto range = GListRange<__metadata_t*>(metadata);
36 if (range.Size() != 3)
37 return std::string("Metadata Glist is wrong size for metadata plugin");
41 for (__metadata_t* meta : range) {
43 "http://developer.samsung.com/tizen/metadata/test_metadata/key_a")
44 == 0 && strcmp(meta->value, "value_a") == 0) {
48 "http://developer.samsung.com/tizen/metadata/test_metadata/key_b")
49 == 0 && strcmp(meta->value, "value_b") == 0) {
53 "http://developer.samsung.com/tizen/metadata/test_metadata/key_c")
54 == 0 && strcmp(meta->value, "value_c") == 0) {
59 return std::string("Metadata key_a incorrect or not found");
61 return std::string("Metadata key_b incorrect or not found");
63 return std::string("Metadata key_c incorrect or not found");
69 extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(
73 ci::TestAssessor::Instance().AddResult(std::make_tuple(
74 ci::kMetadataPluginName,
75 ci::Plugin::ActionType::Install,
76 ci::Plugin::ProcessType::Main),
77 CheckArgs(pkgid, appid, metadata));
81 extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(
85 ci::TestAssessor::Instance().AddResult(std::make_tuple(
86 ci::kMetadataPluginName,
87 ci::Plugin::ActionType::Upgrade,
88 ci::Plugin::ProcessType::Main),
89 CheckArgs(pkgid, appid, metadata));
93 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(
97 ci::TestAssessor::Instance().AddResult(std::make_tuple(
98 ci::kMetadataPluginName,
99 ci::Plugin::ActionType::Uninstall,
100 ci::Plugin::ProcessType::Main),
101 CheckArgs(pkgid, appid, metadata));