Modify json schema
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 22 Apr 2025 05:54:39 +0000 (14:54 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Mon, 28 Apr 2025 03:18:59 +0000 (12:18 +0900)
packageid has been deleted.

Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
22 files changed:
CMakeLists.txt
packaging/tizen-action-framework.spec
src/action/CMakeLists.txt
src/action/action_request_handler.cc
src/action/app_control_executor.cc
src/action/utils/action_model_converter.cc
src/action/utils/action_model_validator.cc [deleted file]
src/action/utils/action_model_validator.hh [deleted file]
src/action/utils/action_validator.cc [new file with mode: 0644]
src/action/utils/action_validator.hh [new file with mode: 0644]
src/common/action_model.cc
src/common/action_model.h
src/common/action_schema.cc
src/common/action_schema.h
src/plugin-daemon/main.cc
test/unit_tests/action_model_converter_test.cc
test/unit_tests/action_model_test.cc
test/unit_tests/action_schema_test.cc
tidl/tizen_action_datatype.tidl
tool/action_tool/tools/execute.cc
tool/action_tool/tools/get_action.cc
tool/action_tool/tools/list_actions.cc

index bf9f7099e040463184249193933321e83688d572..2e99f32743b7f5a422c8e6198bff6df4dec5fcb3 100644 (file)
@@ -51,6 +51,7 @@ PKG_CHECK_MODULES(PKGMGR_INFO_DEPS REQUIRED pkgmgr-info)
 PKG_CHECK_MODULES(PKGMGR_INSTALLER_DEPS REQUIRED pkgmgr-installer)
 PKG_CHECK_MODULES(RPC_PORT_DEPS REQUIRED rpc-port)
 PKG_CHECK_MODULES(TIZEN_DATABASE_DEPS REQUIRED tizen-database)
+PKG_CHECK_MODULES(RAPID_JSON_DEPS REQUIRED RapidJSON)
 
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(tool)
index 014f77f99e4ffe714a8f1fbbfc98c6606b3a39e6..fcb87e7d8ed916b90e8f76aa20aceed0790cffb8 100644 (file)
@@ -27,6 +27,7 @@ BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(pkgmgr-installer)
 BuildRequires:  pkgconfig(rpc-port)
 BuildRequires:  pkgconfig(tizen-database)
+BuildRequires:  pkgconfig(RapidJSON)
 
 %if 0%{?gcov:1}
 BuildRequires:  lcov
index 43e09a99687946e1645cce705a3e77d2babcfe94..7aa6a96edd321f42abe89ff7a30b205c1548c114 100644 (file)
@@ -17,6 +17,7 @@ APPLY_PKG_CONFIG(${TARGET_TIZEN_ACTION} PUBLIC
   PKGMGR_INFO_DEPS
   TIZEN_DATABASE_DEPS
   RPC_PORT_DEPS
+  RAPID_JSON_DEPS
 )
 
 TARGET_LINK_LIBRARIES(${TARGET_TIZEN_ACTION} PUBLIC ${TARGET_TIZEN_ACTION_COMMON} "-ldl")
index f943ddd5410aecda6c310a7de38b8cb5902f129f..37127c785e8942ef8a59c7241f4b509ab3beb6b9 100755 (executable)
 #include "action/action_request_handler.hh"
 #include "action/service.hh"
 #include "action/sqlite_db.hh"
+#include "action/utils/action_model_converter.hh"
+#include "action/utils/action_validator.hh"
 #include "action_request_handler.hh"
 #include "common/utils/logging.hh"
-#include "utils/action_model_converter.hh"
-#include "utils/action_model_validator.hh"
 
 namespace {
 
@@ -115,6 +115,21 @@ std::string GetStringFromParameterType(common::ParameterType type) {
   return "";
 }
 
+void FillActionModelInfo(common::ActionModel& model,
+                         const common::ActionSchema& schema) {
+  model.SetType(schema.GetType());
+  switch (schema.GetType()) {
+    case common::ActionType::AppControl:
+      model.SetExtraInfo(schema.GetAppId());
+      break;
+    case common::ActionType::Plugin:
+      model.SetExtraInfo("plugin-path");  // TODO: Set plugin path
+      break;
+    default:
+      break;
+  }
+}
+
 }  // namespace
 
 namespace action {
@@ -136,10 +151,9 @@ std::vector<rpc::ActionSchema> ActionRequestHandler::OnListActions() {
     common::ActionSchema schema(item);
     rpc::ActionSchema action;
     action.Setaction_id(schema.GetActionId());
-    action.Setpackage_id(schema.GetPackageId());
     action.Setcategory(schema.GetCategory());
     action.Setdescription(schema.GetDescription());
-    action.Settype("app_control");  // TODO
+    action.Settype(ActionModelConverter().ActionTypeToString(schema.GetType()));
     // action.Setparameters();
     // action.Setprivileges();
     actions.push_back(action);
@@ -154,17 +168,17 @@ rpc::ActionSchema ActionRequestHandler::OnGetAction(const std::string& id) {
 
   rpc::ActionSchema action;
   action.Setaction_id(schema.GetActionId());
-  action.Setpackage_id(schema.GetPackageId());
   action.Setcategory(schema.GetCategory());
   action.Setdescription(schema.GetDescription());
-  action.Settype("app_control");  // TODO
+  action.Settype(ActionModelConverter().ActionTypeToString(schema.GetType()));
 
   std::vector<rpc::Parameter> actionparams;
   auto params = schema.GetParameters();
 
   for (auto const& iter : params) {
-    auto param = rpc::Parameter(iter.GetName(), GetStringFromParameterType(iter.GetType()),
-                     "", iter.GetDescription(), iter.GetIsRequired());
+    auto param = rpc::Parameter(iter.GetName(),
+                                GetStringFromParameterType(iter.GetType()),
+                                iter.GetDescription(), iter.GetIsRequired());
 
     actionparams.push_back(param);
   }
@@ -182,22 +196,27 @@ void ActionRequestHandler::OnExecute(const std::string& instance, pid_t pid,
                                      uid_t uid, rpc::ActionModel& action) {
   auto db = std::make_unique<action::SqliteDb>();
   std::string schema_json = db->GetAction(action.Getaction_id());
-  common::ActionSchema schema(schema_json);
-  LOG(DEBUG) << "OnExecute action : " << schema.GetActionId() << " appid: " << schema.GetPackageId();
+  std::string error;
 
-  common::ActionModel model(action.Getjson());
-  if (!ActionModelValidator().CheckValid(schema, model)) {
-    LOG(ERROR) << "Invalid model : " << action.Getjson();
+  if (!ActionValidator().CheckModelValid(schema_json, action.Getjson(),
+                                         error)) {
+    LOG(ERROR) << "Invalid model. error: " << error;
     return;
   }
 
+  common::ActionSchema schema(schema_json);
+  LOG(DEBUG) << "OnExecute action : " << schema.GetActionId();
+
+  common::ActionModel model(action.Getjson());
+  model.SetType(schema.GetType());
+  FillActionModelInfo(model, schema);
+
   auto required_privileges = db->GetRequiredPrivileges(model.GetId());
   if (!CheckPrivileges(pid, uid, required_privileges)) {
     LOG(ERROR) << "Not allowed to execute action due to missing privileges";
     return;
   }
 
-  model.SetType(schema.GetType());
   auto executor = ActionExecutorFactory::CreateExecutor(instance, model);
   executor->SetResultHandler(this);
   executor->Execute(model);
@@ -205,16 +224,17 @@ void ActionRequestHandler::OnExecute(const std::string& instance, pid_t pid,
 }
 
 void ActionRequestHandler::RegisterRequestReplyHandler(
-    const std::string& requester, IRequestReplyHandler* handler) {
+    const std::string& requester,
+    IRequestReplyHandler* handler) {
   reply_handlers_.emplace(requester, handler);
 }
 
 void ActionRequestHandler::UnregisterRequestReplyHandler(
     const std::string& requester) {
   auto it = std::find_if(reply_handlers_.begin(), reply_handlers_.end(),
-      [requester](const auto& iterator) {
-        return iterator.first == requester;
-      });
+                         [requester](const auto& iterator) {
+                           return iterator.first == requester;
+                         });
   if (it != reply_handlers_.end())
     reply_handlers_.erase(it);
   else
@@ -225,10 +245,10 @@ void ActionRequestHandler::OnResult(const std::string& requester,
                                     const std::string& result) {
   LOG(DEBUG) << "OnResult : " << result << ", from : " << requester;
   auto it = std::find_if(reply_handlers_.begin(), reply_handlers_.end(),
-      [requester](const auto& iterator) {
-        return iterator.first == requester;
-      });
-  if (it!= reply_handlers_.end())
+                         [requester](const auto& iterator) {
+                           return iterator.first == requester;
+                         });
+  if (it != reply_handlers_.end())
     it->second->SendRequestReply(result);
   else
     LOG(WARNING) << "No handler found for requester :" << requester;
index 5929b2067bc91c124301fc88859a541403a9c067..af3314789c211ea8e04bed03f1b4abc8855ba08f 100644 (file)
@@ -35,14 +35,12 @@ app_control_h ConvertToAppControl(const common::ActionModel& action_model) {
   }
 
   // TODO: Convert to app_control handle from action model
-  app_control_set_app_id(handle, action_model.GetPackageId().c_str());
+  app_control_set_app_id(handle, action_model.GetAppId().c_str());
 
   auto params = action_model.GetParameters();
 
-  for (auto const& [key, value] : params) {
+  for (auto const& [key, value] : params)
     LOG(DEBUG) << "param name : " << key << ", val : " << value;
-    app_control_add_extra_data(handle, key.c_str(), value.c_str());
-  }
 
   return handle;
 }
index 8b0d1ae358cd381b1fb8a3e53e853408f8fcc89c..27c39b363324bb32ceb2ce7507f801e6033d818e 100644 (file)
@@ -9,7 +9,6 @@ plugin_proxy::ActionModel ActionModelConverter::ConvertToAction(
     const common::ActionModel& model) {
   plugin_proxy::ActionModel action;
   action.Setaction_id(model.GetId());
-  action.Setpackage_id(model.GetPackageId());
   action.Setjson(model.GetJson());
 
   // action.Setresults();
diff --git a/src/action/utils/action_model_validator.cc b/src/action/utils/action_model_validator.cc
deleted file mode 100644 (file)
index 5a02381..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "action_model_validator.hh"
-
-namespace action {
-
-bool ActionModelValidator::CheckValid(
-    const common::ActionSchema& schema,
-    const common::ActionModel& model) const {
-  // TODO: Implement this.
-  return false;
-}
-
-}  // namespace action
diff --git a/src/action/utils/action_model_validator.hh b/src/action/utils/action_model_validator.hh
deleted file mode 100644 (file)
index e72332b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ACTION_ACTION_MODEL_VALIDATOR_HH_
-#define ACTION_ACTION_MODEL_VALIDATOR_HH_
-
-#include "common/action_model.h"
-#include "common/action_schema.h"
-
-namespace action {
-
-class ActionModelValidator {
- public:
-  ActionModelValidator() = default;
-
-  bool CheckValid(const common::ActionSchema& schema,
-                  const common::ActionModel& model) const;
-};
-
-}  // namespace action
-
-#endif  // ACTION_ACTION_MODEL_VALIDATOR_HH_
diff --git a/src/action/utils/action_validator.cc b/src/action/utils/action_validator.cc
new file mode 100644 (file)
index 0000000..7e74118
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "action_validator.hh"
+
+#include <rapidjson/document.h>
+#include <rapidjson/error/en.h>
+#include <rapidjson/schema.h>
+
+namespace action {
+bool ActionValidator::CheckSchemaValid(const std::string& schemajson) const {
+  // TODO: implement this.
+  return false;
+}
+
+bool ActionValidator::CheckModelValid(const std::string& schemajson,
+                                      const std::string& modeljson,
+                                      std::string& errMsg) const {
+  // TODO: implement this.
+  return true;
+}
+
+}  // namespace action
diff --git a/src/action/utils/action_validator.hh b/src/action/utils/action_validator.hh
new file mode 100644 (file)
index 0000000..72f3a53
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ACTION_ACTION_VALIDATOR_HH_
+#define ACTION_ACTION_VALIDATOR_HH_
+
+#include <string>
+
+namespace action {
+
+class ActionValidator {
+ public:
+  ActionValidator() = default;
+  bool CheckSchemaValid(const std::string& schemajson) const;
+  bool CheckModelValid(const std::string& schemajson,
+                  const std::string& modeljson, std::string& errMsg) const;
+};
+
+}  // namespace action
+
+#endif  // ACTION_ACTION_VALIDATOR_HH_
index 2582052845855fab4b813d5fa40943a4e52de788..a384fd59e75e716e03146b7d2c9d4ac977acf1f3 100644 (file)
@@ -44,7 +44,6 @@ ActionModel::ActionModel(std::string json_str)
     : json_str_(std::move(json_str)) {
   Json::Value root = ParseJsonFromString(json_str_);
   action_id_ = root["name"].asString();
-  package_id_ = root["packageId"].asString();
   for (auto const& it : root["params"].getMemberNames()) {
     std::string key = it;
     std::string value = root["params"][key].asString();
@@ -56,8 +55,18 @@ const std::string& ActionModel::GetId() const {
   return action_id_;
 }
 
-const std::string& ActionModel::GetPackageId() const {
-  return package_id_;
+std::string ActionModel::GetAppId() const {
+  if (type_ != ActionType::AppControl)
+    return "";
+
+  return extra_info_;
+}
+
+std::string ActionModel::GetPluginPath() const {
+  if (type_ != ActionType::Plugin)
+    return "";
+
+  return extra_info_;
 }
 
 const ActionType ActionModel::GetType() const {
@@ -77,4 +86,12 @@ const std::string& ActionModel::GetJson() const {
   return json_str_;
 }
 
+const std::string& ActionModel::GetExtraInfo() const {
+  return extra_info_;
+}
+
+void ActionModel::SetExtraInfo(std::string info) {
+  extra_info_ = std::move(info);
+}
+
 }  // namespace common
index 28c061cc36455c60bb9b22c0cf6203814fc1d2c5..b9e5996b7da7ac96b57981b6b3a153bf2050cd2e 100644 (file)
@@ -30,15 +30,19 @@ class ActionModel {
   ActionModel() = default;
   explicit ActionModel(std::string json_str);
   const std::string& GetId() const;
-  const std::string& GetPackageId() const;
+  std::string GetAppId() const;
+  std::string GetPluginPath() const;
   const ActionType GetType() const;
   void SetType(ActionType type);
   const std::vector<std::pair<std::string, std::string>>& GetParameters() const;
   const std::string& GetJson() const;
 
+  const std::string& GetExtraInfo() const;
+  void SetExtraInfo(std::string info);
+
  private:
   std::string action_id_;
-  std::string package_id_;
+  std::string extra_info_;  // app_control: appid, plugin: plugin path
   std::string json_str_;
   ActionType type_ = ActionType::InvalidType;
   std::vector<std::pair<std::string, std::string>> parameters_;
index 100f9852d4cf77eba9d47ae52c87bae633f874e0..d1c0dd82ea06fcaa81f9a924f2d913fcc516db5f 100644 (file)
@@ -74,7 +74,7 @@ ActionSchema::ActionSchema(const std::string& json_str) {
     Json::Value root = ParseJsonFromString(json_str);
 
     action_id_ = root["name"].asString();
-    package_id_ = root["appId"].asString();  // TODO: Change to packageId.
+    appid_ = root["appId"].asString();  // TODO: Change to details::appId
     category_ = root["category"].asString();
     description_ = root["desc"].asString();
     type_ = GetActionTypeFromString(root["type"].asString());
@@ -107,11 +107,11 @@ ActionSchema::ActionSchema(const std::string& json_str) {
   }
 }
 
-ActionSchema::ActionSchema(std::string action_id, std::string package_id,
+ActionSchema::ActionSchema(std::string action_id, std::string appid,
     std::string category, std::string description,
     std::vector<ActionParameter> parameters,
     std::vector<std::string> privileges)
-    : action_id_(std::move(action_id)), package_id_(std::move(package_id)),
+    : action_id_(std::move(action_id)), appid_(std::move(appid)),
       category_(std::move(category)), description_(std::move(description)),
       parameters_(std::move(parameters)), privileges_(std::move(privileges)) {
 }
@@ -124,12 +124,12 @@ void ActionSchema::SetActionId(std::string action_id) {
   action_id_ = std::move(action_id);
 }
 
-const std::string& ActionSchema::GetPackageId() const {
-  return package_id_;
+const std::string& ActionSchema::GetAppId() const {
+  return appid_;
 }
 
-void ActionSchema::SetPackageId(std::string package_id) {
-  package_id_ = std::move(package_id);
+void ActionSchema::SetAppId(std::string appid) {
+  appid_ = std::move(appid);
 }
 
 const std::string& ActionSchema::GetCategory() const {
index dee77bfbfee6a92be6ca8d7ddca2a1401da74243..ea26e1b238a27f0624c290f8c8a35ad2e85afdab 100644 (file)
@@ -29,7 +29,7 @@ class ActionSchema {
  public:
   ActionSchema();
   explicit ActionSchema(const std::string& json_str);
-  explicit ActionSchema(std::string action_id, std::string package_id,
+  explicit ActionSchema(std::string action_id, std::string appid,
       std::string category, std::string description,
       std::vector<ActionParameter> parameters,
       std::vector<std::string> privileges);
@@ -37,8 +37,8 @@ class ActionSchema {
   const std::string& GetActionId() const;
   void SetActionId(std::string action_id);
 
-  const std::string& GetPackageId() const;
-  void SetPackageId(std::string package_id);
+  const std::string& GetAppId() const;
+  void SetAppId(std::string app_id);
 
   const std::string& GetCategory() const;
   void SetCategory(std::string category);
@@ -60,7 +60,7 @@ class ActionSchema {
 
  private:
   std::string action_id_;
-  std::string package_id_;
+  std::string appid_;
   std::string category_;
   ActionType type_ = ActionType::InvalidType;
   std::string description_;
index 8d24427877ffaa80f24f25bb84672437fa4c8c6c..df2f3bbbfd8d72d64c05e7cc5d9355aef108c01f 100644 (file)
@@ -78,8 +78,7 @@ class PluginService
 
  private:
   void PrintAction(const rpc_port::plugin_manager_stub::ActionModel& action) {
-    LOG(INFO) << "Action id: " << action.Getaction_id();
-    LOG(INFO) << "Package id: " << action.Getpackage_id();
+    LOG(INFO) << "Action name: " << action.Getaction_id();
     LOG(INFO) << "Json: " << action.Getjson();
   }
 };
index 1b525448febdedddfcac1155257f025f09d2bc85..b621b6a8715622a4e85a7ef671100165f2259af4 100644 (file)
@@ -7,7 +7,6 @@
 TEST(ActionModelConverterTest, ConvertToAction) {
   std::string json = R"({
     "name": "test_action",
-    "packageId": "com.example.test",
     "params": {
       "param": "value",
     }
@@ -18,7 +17,6 @@ TEST(ActionModelConverterTest, ConvertToAction) {
       ActionModelConverter().ConvertToAction(common_model);
 
   EXPECT_EQ(action.Getaction_id(), "test_action");
-  EXPECT_EQ(action.Getpackage_id(), "com.example.test");
   EXPECT_EQ(action.Getjson(), json);
 }
 
index 23f83dc00b65603cd467136d1eb4b6a1124ff0d7..8bda0902d6652d81affbd5230b04e61c81661243 100644 (file)
@@ -6,7 +6,6 @@ using namespace common;
 TEST(ActionModelTest, JsonInitialization) {
   ActionModel model(R"({
       "name": "new_action",
-      "packageId": "new_package",
       "params": {
         "param1": "hello1",
         "param2": "hello2",
@@ -16,7 +15,6 @@ TEST(ActionModelTest, JsonInitialization) {
   model.SetType(ActionType::AppControl);
 
   EXPECT_EQ("new_action", model.GetId());
-  EXPECT_EQ("new_package", model.GetPackageId());
   EXPECT_EQ(2, model.GetParameters().size());
   const auto& parameters = model.GetParameters();
   EXPECT_EQ(2, parameters.size());
@@ -30,7 +28,7 @@ TEST(ActionModelTest, JsonInitialization) {
 TEST(ActionModelTest, EmptyInitialization) {
   ActionModel model;
   EXPECT_EQ("", model.GetId());
-  EXPECT_EQ("", model.GetPackageId());
+  EXPECT_EQ("", model.GetAppId());
   EXPECT_EQ(0, model.GetParameters().size());
   EXPECT_EQ(ActionType::InvalidType, model.GetType());
 }
index 05afaf890aea8cf17b076fa486f421658f90469c..82ef9e03b75fc9e6aef099265e9f34909483cf7a 100644 (file)
@@ -42,7 +42,7 @@ protected:
 TEST_F(ActionSchemaTest, ValidJsonParsing) {
     ActionSchema schema(valid_json_);
     EXPECT_EQ(schema.GetActionId(), "test_action");
-    EXPECT_EQ(schema.GetPackageId(), "com.example.app");
+    EXPECT_EQ(schema.GetAppId(), "com.example.app");
     EXPECT_EQ(schema.GetCategory(), "test_category");
     EXPECT_EQ(schema.GetDescription(), "Test action description");
     EXPECT_EQ(schema.GetType(), ActionType::AppControl);
@@ -67,7 +67,7 @@ TEST_F(ActionSchemaTest, ValidJsonParsing) {
 TEST_F(ActionSchemaTest, InvalidJsonParsing) {
     ActionSchema invalid_schema(invalid_json_);
     EXPECT_EQ(invalid_schema.GetActionId().empty(), true);
-    EXPECT_EQ(invalid_schema.GetPackageId().empty(), true);
+    EXPECT_EQ(invalid_schema.GetAppId().empty(), true);
     EXPECT_EQ(invalid_schema.GetCategory().empty(), true);
     EXPECT_EQ(invalid_schema.GetDescription().empty(), true);
     EXPECT_EQ(invalid_schema.GetType(), ActionType::InvalidType);
@@ -76,13 +76,13 @@ TEST_F(ActionSchemaTest, InvalidJsonParsing) {
 TEST_F(ActionSchemaTest, SettersAndGetters) {
     ActionSchema schema;
     schema.SetActionId("new_id");
-    schema.SetPackageId("new_package");
+    schema.SetAppId("new_package");
     schema.SetCategory("new_category");
     schema.SetDescription("new_desc");
     schema.SetType(ActionType::Plugin);
 
     EXPECT_EQ(schema.GetActionId(), "new_id");
-    EXPECT_EQ(schema.GetPackageId(), "new_package");
+    EXPECT_EQ(schema.GetAppId(), "new_package");
     EXPECT_EQ(schema.GetCategory(), "new_category");
     EXPECT_EQ(schema.GetDescription(), "new_desc");
     EXPECT_EQ(schema.GetType(), ActionType::Plugin);
@@ -101,7 +101,7 @@ TEST_F(ActionSchemaTest, ParameterTypeConversion) {
 TEST_F(ActionSchemaTest, DefaultConstructor) {
     ActionSchema default_schema;
     EXPECT_TRUE(default_schema.GetActionId().empty());
-    EXPECT_TRUE(default_schema.GetPackageId().empty());
+    EXPECT_TRUE(default_schema.GetAppId().empty());
     EXPECT_TRUE(default_schema.GetCategory().empty());
     EXPECT_TRUE(default_schema.GetDescription().empty());
     EXPECT_EQ(default_schema.GetType(), ActionType::InvalidType);
index e3cbb7d904d41f0aabcca9f94b32c30e7efb7084..fbe76f86664f6359aaa5fe6d5caea7d4b119b8d9 100644 (file)
@@ -3,7 +3,6 @@ protocol 2
 struct Parameter {
     string key;
     string type;
-    string value;
     string description;
     bool is_requied;
 }
@@ -15,7 +14,6 @@ struct Result {
 
 struct ActionSchema {
     string action_id;
-    string package_id;
     string category;
     string description;
     string type;
@@ -27,7 +25,6 @@ struct ActionSchema {
 
 struct ActionModel {
     string action_id;
-    string package_id;
     string json;
 }
 
index 534ed63d360d08d4b1fe6d626bcb8dc1c92a1a71..030dbbb25a14cff65058a7440621d2bf2d4eda90 100644 (file)
@@ -60,7 +60,7 @@ class Execute : public ActionTool,
                       IEventListener {
  public:
   Execute()
-      : ActionTool("execute", "Execute", "execute <action id> <package_id> <json string>"),
+      : ActionTool("execute", "Execute", "execute <action id> <json string>"),
         proxy_(this, kStubAppId) {}
 
   virtual ~Execute() {}
@@ -95,7 +95,7 @@ class Execute : public ActionTool,
   }
 
   int Run(int argc, char** argv) override {
-    if (argc < 4) {
+    if (argc < 3) {
       Usage();
       return -1;
     }
@@ -104,12 +104,10 @@ class Execute : public ActionTool,
     std::vector<rpc_port::tizen_action_service_proxy::Parameter> actionparams;
 
     std::string action_id = std::string(argv[2]);
-    std::string package_id = std::string(argv[3]);
-    std::string json = std::string(argv[4]);
+    std::string json = std::string(argv[3]);
 
     action.Setaction_id(action_id);
-    action.Setpackage_id(package_id);
-    _E("id : %s, package_id : %s", action_id.c_str(), package_id.c_str());
+    _E("action name: %s", action_id.c_str());
     action.Setjson(json);
     try {
       int ret = proxy_.Execute(action);
index f8693093e51e4413428e276e92d51e87729ceb2f..89d2d655751c0a60035ee88452ed2368ac82e270 100644 (file)
@@ -71,7 +71,6 @@ class GetAction : public ActionTool,
     try {
       auto action = proxy_.GetAction(std::move(action_id));
       _D("id: %s --------------------", action.Getaction_id().c_str());
-      _D("package: %s", action.Getpackage_id().c_str());
       _D("category: %s", action.Getcategory().c_str());
       _D("description: %s", action.Getdescription().c_str());
 
index e7db487dcb61307b66fe10876deccee8d47336f6..51d6503ae220ddec967430914ef65c89f0ce3978 100644 (file)
@@ -64,7 +64,7 @@ class ListActions : public ActionTool,
       _D("Actions cnt(%zu)", actions.size());
       for (auto action : actions) {
         _D("id: %s --------------------", action.Getaction_id().c_str());
-        _D("package_id: %s", action.Getpackage_id().c_str());
+        _D("type: %s", action.Gettype().c_str());
         _D("category: %s", action.Getcategory().c_str());
         _D("description: %s", action.Getdescription().c_str());