[puppet_master] Reomve UpdateMod command
This is using links in intents, which are being removed. The same
functionality can also be achieved by using the AddMod command.
TESTED=N/A
MF-6 #comment Remove UpdateMod command
Change-Id: I8ffdae69bbf5096be77db5a0a2fa83dd44a97f7b
diff --git a/bin/sessionmgr/puppet_master/BUILD.gn b/bin/sessionmgr/puppet_master/BUILD.gn
index 4ed5e98..96beba8 100644
--- a/bin/sessionmgr/puppet_master/BUILD.gn
+++ b/bin/sessionmgr/puppet_master/BUILD.gn
@@ -15,7 +15,6 @@
"command_runners:set_focus_state_command_runner_unittest",
"command_runners:set_kind_of_proto_story_option_command_runner_unittest",
"command_runners:set_link_value_command_runner_unittest",
- "command_runners:update_mod_command_runner_unittest",
]
}
@@ -128,6 +127,5 @@
"//peridot/bin/sessionmgr/puppet_master/command_runners:set_focus_state_command_runner",
"//peridot/bin/sessionmgr/puppet_master/command_runners:set_kind_of_proto_story_option_command_runner",
"//peridot/bin/sessionmgr/puppet_master/command_runners:set_link_value_command_runner",
- "//peridot/bin/sessionmgr/puppet_master/command_runners:update_mod_command_runner",
]
}
diff --git a/bin/sessionmgr/puppet_master/command_runners/BUILD.gn b/bin/sessionmgr/puppet_master/command_runners/BUILD.gn
index 28431f0..98d33b4 100644
--- a/bin/sessionmgr/puppet_master/command_runners/BUILD.gn
+++ b/bin/sessionmgr/puppet_master/command_runners/BUILD.gn
@@ -49,40 +49,6 @@
]
}
-source_set("update_mod_command_runner") {
- sources = [
- "update_mod_command_runner.cc",
- "update_mod_command_runner.h",
- ]
-
- deps = [
- "//garnet/public/lib/fsl",
- "//peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls:update_mod_call",
- ]
-
- public_deps = [
- ":command_runner",
- "//peridot/public/lib/async/cpp:operation",
- ]
-}
-
-executable("update_mod_command_runner_unittest") {
- testonly = true
-
- sources = [
- "update_mod_command_runner_unittest.cc",
- ]
-
- deps = [
- ":update_mod_command_runner",
- "//garnet/public/lib/gtest",
- "//peridot/lib/testing:test_with_session_storage",
- "//peridot/public/lib/async/cpp:future",
- "//peridot/public/lib/entity/cpp:json",
- "//third_party/googletest:gtest_main",
- ]
-}
-
source_set("add_mod_command_runner") {
sources = [
"add_mod_command_runner.cc",
diff --git a/bin/sessionmgr/puppet_master/command_runners/operation_calls/BUILD.gn b/bin/sessionmgr/puppet_master/command_runners/operation_calls/BUILD.gn
index 33b19ac..5023e37 100644
--- a/bin/sessionmgr/puppet_master/command_runners/operation_calls/BUILD.gn
+++ b/bin/sessionmgr/puppet_master/command_runners/operation_calls/BUILD.gn
@@ -23,7 +23,6 @@
":get_link_path_for_parameter_name_call",
":get_types_from_entity_call",
":initialize_chain_call",
- ":update_mod_call",
"//garnet/public/lib/fidl/cpp",
"//garnet/public/lib/fsl",
"//garnet/public/lib/fxl",
@@ -112,18 +111,3 @@
]
}
-source_set("update_mod_call") {
- sources = [
- "update_mod_call.cc",
- "update_mod_call.h",
- ]
-
- deps = [
- ":set_link_value_call",
- "//peridot/bin/sessionmgr/storage:story_storage",
- "//peridot/public/fidl/fuchsia.modular",
- "//peridot/public/lib/async/cpp:future",
- "//peridot/public/lib/async/cpp:operation",
- "//peridot/public/lib/entity/cpp:json",
- ]
-}
diff --git a/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc b/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
index e4cb5ed..b783f33 100644
--- a/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
+++ b/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
@@ -13,7 +13,6 @@
#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/get_link_path_for_parameter_name_call.h"
#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/get_types_from_entity_call.h"
#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/initialize_chain_call.h"
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h"
#include "peridot/lib/fidl/clone.h"
#include "peridot/lib/module_manifest/module_facet_reader.h"
diff --git a/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.cc b/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.cc
deleted file mode 100644
index c7d6bf5..0000000
--- a/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h"
-
-#include <fuchsia/modular/internal/cpp/fidl.h>
-#include <lib/async/cpp/future.h>
-#include <lib/entity/cpp/json.h>
-#include <lib/fsl/vmo/strings.h>
-
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/set_link_value_call.h"
-
-namespace modular {
-
-namespace {
-
-class UpdateModCall : public Operation<fuchsia::modular::ExecuteResult> {
- public:
- UpdateModCall(StoryStorage* const story_storage,
- fuchsia::modular::UpdateMod command, ResultCall done)
- : Operation("UpdateModCommandRunner::UpdateModCall", std::move(done)),
- story_storage_(story_storage),
- command_(std::move(command)) {}
-
- private:
- void Run() override {
- FlowToken flow{this, &result_};
- if (command_.mod_name.is_null() || command_.mod_name->empty()) {
- result_.status = fuchsia::modular::ExecuteStatus::INVALID_COMMAND;
- result_.error_message = "No module name";
- return;
- }
- story_storage_->ReadModuleData(command_.mod_name)
- ->Then([this, flow](fuchsia::modular::ModuleDataPtr module_data) {
- if (!module_data) {
- result_.status = fuchsia::modular::ExecuteStatus::INVALID_MOD;
- result_.error_message = "No module data";
- return;
- // Operation finishes since |flow| goes out of scope.
- }
- Cont1(flow, std::move(module_data));
- });
- }
-
- // Once we have the module data, use it to know what links to update and
- // update them if their names match the given parameters.
- void Cont1(FlowToken flow, fuchsia::modular::ModuleDataPtr module_data) {
- std::vector<modular::FuturePtr<fuchsia::modular::ExecuteResult>>
- did_update_links;
- for (const auto& parameter : *command_.parameters) {
- for (const auto& entry : *module_data->parameter_map.entries) {
- if (parameter.name != entry.name) {
- continue;
- }
- did_update_links.push_back(
- UpdateLinkValue(entry.link_path, parameter.data));
- }
- }
- Wait("UpdateModCommandRunner.UpdateMod.Wait", did_update_links)
- ->Then([this, flow](
- std::vector<fuchsia::modular::ExecuteResult> result_values) {
- for (auto& result : result_values) {
- if (result.status != fuchsia::modular::ExecuteStatus::OK) {
- result_ = std::move(result);
- return;
- // Operation finishes since |flow| goes out of scope.
- }
- }
- result_.status = fuchsia::modular::ExecuteStatus::OK;
- });
- }
-
- FuturePtr<fuchsia::modular::ExecuteResult> UpdateLinkValue(
- const fuchsia::modular::LinkPath& path,
- const fuchsia::modular::IntentParameterData& data) {
- std::string new_value;
- std::string json_string;
- switch (data.Which()) {
- case fuchsia::modular::IntentParameterData::Tag::kEntityReference:
- new_value = EntityReferenceToJson(data.entity_reference());
- break;
- case fuchsia::modular::IntentParameterData::Tag::kJson:
- FXL_CHECK(fsl::StringFromVmo(data.json(), &json_string));
- new_value = json_string;
- break;
- case fuchsia::modular::IntentParameterData::Tag::kEntityType:
- case fuchsia::modular::IntentParameterData::Tag::kLinkName:
- case fuchsia::modular::IntentParameterData::Tag::kLinkPath:
- case fuchsia::modular::IntentParameterData::Tag::Invalid:
- fuchsia::modular::ExecuteResult result;
- result.status = fuchsia::modular::ExecuteStatus::INVALID_COMMAND;
- std::stringstream stream;
- stream << "Unsupported IntentParameterData type:"
- << (uint32_t)data.Which();
- auto ret = Future<fuchsia::modular::ExecuteResult>::CreateCompleted(
- "UpdateModCommandRunner.UpdateLinkValue.ret", std::move(result));
- return ret;
- }
- auto fut = Future<fuchsia::modular::ExecuteResult>::Create(
- "UpdateModCommandRunner.UpdateLinkValue.fut");
- fuchsia::modular::LinkPath out_path;
- path.Clone(&out_path);
- AddSetLinkValueOperation(
- &operations_, story_storage_, std::move(out_path),
- [new_value](fidl::StringPtr* value) { *value = new_value; },
- fut->Completer());
- return fut;
- }
-
- StoryStorage* const story_storage_;
- fuchsia::modular::UpdateMod command_;
- fuchsia::modular::ExecuteResult result_;
- OperationCollection operations_;
-
- FXL_DISALLOW_COPY_AND_ASSIGN(UpdateModCall);
-};
-
-} // namespace
-
-void AddUpdateModOperation(
- OperationContainer* const operation_container,
- StoryStorage* const story_storage, fuchsia::modular::UpdateMod command,
- std::function<void(fuchsia::modular::ExecuteResult)> done) {
- operation_container->Add(
- new UpdateModCall(story_storage, std::move(command), std::move(done)));
-}
-
-} // namespace modular
diff --git a/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h b/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h
deleted file mode 100644
index 817ff56..0000000
--- a/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_OPERATION_CALLS_UPDATE_MOD_CALL_H_
-#define PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_OPERATION_CALLS_UPDATE_MOD_CALL_H_
-
-#include <fuchsia/modular/cpp/fidl.h>
-#include <lib/async/cpp/operation.h>
-
-#include "peridot/bin/sessionmgr/storage/story_storage.h"
-
-namespace modular {
-
-void AddUpdateModOperation(
- OperationContainer* const operation_container,
- StoryStorage* const story_storage, fuchsia::modular::UpdateMod command,
- std::function<void(fuchsia::modular::ExecuteResult)> done);
-
-} // namespace modular
-
-#endif // PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_OPERATION_CALLS_UPDATE_MOD_CALL_H_
diff --git a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.cc b/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.cc
deleted file mode 100644
index 57aa418..0000000
--- a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h"
-
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/update_mod_call.h"
-
-namespace modular {
-
-UpdateModCommandRunner::UpdateModCommandRunner() = default;
-UpdateModCommandRunner::~UpdateModCommandRunner() = default;
-
-void UpdateModCommandRunner::Execute(
- fidl::StringPtr story_id, StoryStorage* const story_storage,
- fuchsia::modular::StoryCommand command,
- std::function<void(fuchsia::modular::ExecuteResult)> done) {
- FXL_CHECK(command.is_update_mod());
-
- AddUpdateModOperation(&operation_queue_, story_storage,
- std::move(command.update_mod()), std::move(done));
-}
-
-} // namespace modular
diff --git a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h b/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h
deleted file mode 100644
index 3f751f4..0000000
--- a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_UPDATE_MOD_COMMAND_RUNNER_H_
-#define PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_UPDATE_MOD_COMMAND_RUNNER_H_
-
-#include <fuchsia/modular/cpp/fidl.h>
-#include <lib/async/cpp/operation.h>
-#include <vector>
-
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/command_runner.h"
-#include "peridot/bin/sessionmgr/storage/story_storage.h"
-
-namespace modular {
-
-class UpdateModCommandRunner : public CommandRunner {
- public:
- UpdateModCommandRunner();
- ~UpdateModCommandRunner() override;
-
- void Execute(
- fidl::StringPtr story_id, StoryStorage* story_storage,
- fuchsia::modular::StoryCommand command,
- std::function<void(fuchsia::modular::ExecuteResult)> done) override;
-
- private:
- OperationQueue operation_queue_;
-};
-
-} // namespace modular
-
-#endif // PERIDOT_BIN_SESSIONMGR_PUPPET_MASTER_COMMAND_RUNNERS_UPDATE_MOD_COMMAND_RUNNER_H_
diff --git a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner_unittest.cc b/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner_unittest.cc
deleted file mode 100644
index c009d7e..0000000
--- a/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner_unittest.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h"
-
-#include <lib/async/cpp/future.h>
-#include <lib/fsl/vmo/strings.h>
-
-#include "gtest/gtest.h"
-#include "peridot/lib/testing/test_with_session_storage.h"
-
-namespace modular {
-namespace {
-
-class UpdateModCommandRunnerTest : public testing::TestWithSessionStorage {
- public:
- void SetUp() override {
- testing::TestWithSessionStorage::SetUp();
- session_storage_ = MakeSessionStorage("page");
- runner_ = MakeRunner();
- story_id_ = CreateStory(session_storage_.get());
- story_storage_ = GetStoryStorage(session_storage_.get(), story_id_);
- }
-
- protected:
- std::unique_ptr<UpdateModCommandRunner> MakeRunner() {
- return std::make_unique<UpdateModCommandRunner>();
- }
-
- fuchsia::modular::ModuleData InitModuleData(
- fidl::VectorPtr<fidl::StringPtr> module_path) {
- fuchsia::modular::ModuleParameterMap parameter_map;
- fuchsia::modular::ModuleData module_data;
- module_data.module_path = std::move(module_path);
- module_data.intent = fuchsia::modular::Intent::New();
- module_data.parameter_map = std::move(parameter_map);
- return module_data;
- }
-
- void AddJsonParamAndCreateLink(fuchsia::modular::ModuleData* module_data,
- const std::string& parameter_name,
- const std::string& link_path,
- const std::string& json_value) {
- fuchsia::modular::IntentParameter parameter;
- parameter.name = parameter_name;
- fsl::SizedVmo vmo;
- FXL_CHECK(fsl::VmoFromString(json_value, &vmo));
- parameter.data.set_json(std::move(vmo).ToTransport());
- fuchsia::modular::ModuleParameterMapEntry parameter_entry;
- parameter_entry.name = parameter_name;
- parameter_entry.link_path = MakeLinkPath(link_path);
- module_data->parameter_map.entries.push_back(std::move(parameter_entry));
- module_data->intent->parameters.push_back(std::move(parameter));
- SetLinkValue(story_storage_.get(), link_path, json_value);
- }
-
- void AddEntityReferenceParamAndCreateLink(
- fuchsia::modular::ModuleData* module_data,
- const std::string& parameter_name, const std::string& link_path,
- const std::string& reference) {
- fuchsia::modular::IntentParameter parameter;
- parameter.name = parameter_name;
- parameter.data.set_entity_reference(reference);
- fuchsia::modular::ModuleParameterMapEntry parameter_entry;
- parameter_entry.name = parameter_name;
- parameter_entry.link_path = MakeLinkPath(link_path);
- module_data->parameter_map.entries.push_back(std::move(parameter_entry));
- module_data->intent->parameters.push_back(std::move(parameter));
-
- std::stringstream stream;
- stream << "{\"@entityRef\":\"" << reference << "\"}";
- SetLinkValue(story_storage_.get(), link_path, stream.str());
- }
-
- std::unique_ptr<SessionStorage> session_storage_;
- std::unique_ptr<StoryStorage> story_storage_;
- std::unique_ptr<UpdateModCommandRunner> runner_;
- std::string story_id_;
-};
-
-// Verifies that an UpdateCommandMod updates the right links associated with the
-// parameters.
-TEST_F(UpdateModCommandRunnerTest, Execute) {
- bool done{};
-
- fidl::VectorPtr<fidl::StringPtr> path;
- path.push_back("mod");
-
- // Create a module with base parameters that will be updated.
- auto module_data = InitModuleData(path.Clone());
- AddEntityReferenceParamAndCreateLink(&module_data, "param1", "link1",
- "reference");
- AddJsonParamAndCreateLink(&module_data, "param2", "link2", "10");
- WriteModuleData(story_storage_.get(), std::move(module_data));
-
- // Update module parameters.
- fuchsia::modular::IntentParameter parameter1;
- parameter1.name = "param1";
- parameter1.data.set_entity_reference("reference2");
- fuchsia::modular::IntentParameter parameter2;
- parameter2.name = "param2";
- fsl::SizedVmo vmo;
- FXL_CHECK(fsl::VmoFromString("20", &vmo));
- parameter2.data.set_json(std::move(vmo).ToTransport());
-
- fuchsia::modular::UpdateMod update_mod;
- update_mod.mod_name = path.Clone();
- update_mod.parameters.push_back(std::move(parameter1));
- update_mod.parameters.push_back(std::move(parameter2));
- fuchsia::modular::StoryCommand command;
- command.set_update_mod(std::move(update_mod));
-
- runner_->Execute(story_id_, story_storage_.get(), std::move(command),
- [&](fuchsia::modular::ExecuteResult result) {
- EXPECT_EQ(fuchsia::modular::ExecuteStatus::OK,
- result.status);
- done = true;
- });
- RunLoopUntil([&] { return done; });
-
- // Verify links were updated.
- auto link1_value = GetLinkValue(story_storage_.get(), "link1");
- EXPECT_EQ(link1_value, "{\"@entityRef\":\"reference2\"}");
- auto link2_value = GetLinkValue(story_storage_.get(), "link2");
- EXPECT_EQ(link2_value, "20");
-}
-
-// Sets a parameter of invalid type in the command.
-TEST_F(UpdateModCommandRunnerTest, ExecuteUnsupportedParameterType) {
- bool done{};
-
- fidl::VectorPtr<fidl::StringPtr> path;
- path.push_back("mod");
-
- // Create a module with base parameters that will be updated.
- auto module_data = InitModuleData(path.Clone());
- AddEntityReferenceParamAndCreateLink(&module_data, "param1", "link1",
- "reference");
- AddJsonParamAndCreateLink(&module_data, "param2", "link2", "10");
- WriteModuleData(story_storage_.get(), std::move(module_data));
-
- // Update module parameters.
- fuchsia::modular::IntentParameter parameter1;
- parameter1.name = "param1";
- parameter1.data.set_link_name("name2");
-
- fuchsia::modular::UpdateMod update_mod;
- update_mod.mod_name = path.Clone();
- update_mod.parameters.push_back(std::move(parameter1));
- fuchsia::modular::StoryCommand command;
- command.set_update_mod(std::move(update_mod));
-
- runner_->Execute(story_id_, story_storage_.get(), std::move(command),
- [&](fuchsia::modular::ExecuteResult result) {
- EXPECT_EQ(fuchsia::modular::ExecuteStatus::INVALID_COMMAND,
- result.status);
- done = true;
- });
- RunLoopUntil([&] { return done; });
-
- // Verify nothing changed.
- auto link1_value = GetLinkValue(story_storage_.get(), "link1");
- EXPECT_EQ(link1_value, "{\"@entityRef\":\"reference\"}");
- auto link2_value = GetLinkValue(story_storage_.get(), "link2");
- EXPECT_EQ(link2_value, "10");
-}
-
-TEST_F(UpdateModCommandRunnerTest, ExecuteNoModuleData) {
- bool done{};
-
- fidl::VectorPtr<fidl::StringPtr> path;
- path.push_back("mod");
-
- fuchsia::modular::UpdateMod update_mod;
- update_mod.mod_name = path.Clone();
- fuchsia::modular::StoryCommand command;
- command.set_update_mod(std::move(update_mod));
-
- runner_->Execute(story_id_, story_storage_.get(), std::move(command),
- [&](fuchsia::modular::ExecuteResult result) {
- EXPECT_EQ(fuchsia::modular::ExecuteStatus::INVALID_MOD,
- result.status);
- EXPECT_EQ("No module data", result.error_message);
- done = true;
- });
-
- RunLoopUntil([&] { return done; });
-}
-
-} // namespace
-} // namespace modular
diff --git a/bin/sessionmgr/puppet_master/dispatch_story_command_executor.cc b/bin/sessionmgr/puppet_master/dispatch_story_command_executor.cc
index f94d68d..f1d245f 100644
--- a/bin/sessionmgr/puppet_master/dispatch_story_command_executor.cc
+++ b/bin/sessionmgr/puppet_master/dispatch_story_command_executor.cc
@@ -152,8 +152,6 @@
"StoryCommand::AddMod"},
{fuchsia::modular::StoryCommand::Tag::kFocusMod,
"StoryCommand::FocusMod"},
- {fuchsia::modular::StoryCommand::Tag::kUpdateMod,
- "StoryCommand::UpdateMod"},
{fuchsia::modular::StoryCommand::Tag::kRemoveMod,
"StoryCommand::RemoveMod"},
{fuchsia::modular::StoryCommand::Tag::kSetLinkValue,
diff --git a/bin/sessionmgr/puppet_master/make_production_impl.cc b/bin/sessionmgr/puppet_master/make_production_impl.cc
index 0d71157..2350afe 100644
--- a/bin/sessionmgr/puppet_master/make_production_impl.cc
+++ b/bin/sessionmgr/puppet_master/make_production_impl.cc
@@ -12,7 +12,6 @@
#include "peridot/bin/sessionmgr/puppet_master/command_runners/set_focus_state_command_runner.h"
#include "peridot/bin/sessionmgr/puppet_master/command_runners/set_kind_of_proto_story_option_command_runner.h"
#include "peridot/bin/sessionmgr/puppet_master/command_runners/set_link_value_command_runner.h"
-#include "peridot/bin/sessionmgr/puppet_master/command_runners/update_mod_command_runner.h"
#include "peridot/bin/sessionmgr/puppet_master/dispatch_story_command_executor.h"
namespace modular {
@@ -45,8 +44,6 @@
module_facet_reader));
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kFocusMod,
new FocusModCommandRunner(std::move(module_focuser)));
- command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kUpdateMod,
- new UpdateModCommandRunner());
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kRemoveMod,
new RemoveModCommandRunner());
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kSetLinkValue,
diff --git a/bin/suggestion_engine/ranking_features/mod_pair_ranking_feature.cc b/bin/suggestion_engine/ranking_features/mod_pair_ranking_feature.cc
index 76b0788..c862e5a 100644
--- a/bin/suggestion_engine/ranking_features/mod_pair_ranking_feature.cc
+++ b/bin/suggestion_engine/ranking_features/mod_pair_ranking_feature.cc
@@ -61,7 +61,6 @@
case fuchsia::modular::StoryCommand::Tag::kSetFocusState:
case fuchsia::modular::StoryCommand::Tag::kFocusMod:
case fuchsia::modular::StoryCommand::Tag::kSetLinkValue:
- case fuchsia::modular::StoryCommand::Tag::kUpdateMod:
case fuchsia::modular::StoryCommand::Tag::kRemoveMod:
case fuchsia::modular::StoryCommand::Tag::Invalid:
continue;
diff --git a/bin/suggestion_engine/suggestion_engine_impl_unittest.cc b/bin/suggestion_engine/suggestion_engine_impl_unittest.cc
index 05f330e..550d396 100644
--- a/bin/suggestion_engine/suggestion_engine_impl_unittest.cc
+++ b/bin/suggestion_engine/suggestion_engine_impl_unittest.cc
@@ -194,24 +194,6 @@
proposal->on_selected.push_back(std::move(command));
}
- void AddUpdateModuleAction(fuchsia::modular::Proposal* proposal,
- const std::string& mod_name,
- const std::string& json_param_name,
- const std::string& json_param_value) {
- fuchsia::modular::IntentParameter parameter;
- parameter.name = json_param_name;
- fsl::SizedVmo vmo;
- FXL_CHECK(fsl::VmoFromString(json_param_value, &vmo));
- parameter.data.set_json(std::move(vmo).ToTransport());
- fuchsia::modular::UpdateMod update_mod;
- update_mod.mod_name.push_back(mod_name);
- update_mod.parameters.push_back(std::move(parameter));
-
- fuchsia::modular::StoryCommand command;
- command.set_update_mod(std::move(update_mod));
- proposal->on_selected.push_back(std::move(command));
- }
-
void AddSetLinkValueAction(fuchsia::modular::Proposal* proposal,
const std::string& mod_name,
const std::string& link_name,
@@ -510,7 +492,6 @@
AddAddModuleAction(&proposal, "mod_name", "mod_url");
AddFocusStoryAction(&proposal);
AddFocusModuleAction(&proposal, "mod_name");
- AddUpdateModuleAction(&proposal, "mod_name", "json_param", "1");
AddSetLinkValueAction(&proposal, "mod_name", "foo_link_name", "foo_value");
proposal_publisher_->Propose(std::move(proposal));
@@ -532,12 +513,11 @@
auto story_id = test_executor_.last_story_id();
auto& commands = test_executor_.last_commands();
- ASSERT_EQ(5u, commands.size());
+ ASSERT_EQ(4u, commands.size());
EXPECT_TRUE(commands.at(0).is_add_mod());
EXPECT_TRUE(commands.at(1).is_set_focus_state());
EXPECT_TRUE(commands.at(2).is_focus_mod());
- EXPECT_TRUE(commands.at(3).is_update_mod());
- EXPECT_TRUE(commands.at(4).is_set_link_value());
+ EXPECT_TRUE(commands.at(3).is_set_link_value());
auto& add_mod = commands.at(0).add_mod();
ASSERT_EQ(1u, add_mod.mod_name->size());
@@ -551,16 +531,7 @@
ASSERT_EQ(1u, focus_mod.mod_name->size());
EXPECT_EQ("mod_name", focus_mod.mod_name->at(0));
- auto& update_mod = commands.at(3).update_mod();
- ASSERT_EQ(1u, update_mod.mod_name->size());
- EXPECT_EQ("mod_name", update_mod.mod_name->at(0));
- EXPECT_EQ("json_param", update_mod.parameters->at(0).name);
- std::string json_value;
- FXL_CHECK(fsl::StringFromVmo(update_mod.parameters->at(0).data.json(),
- &json_value));
- EXPECT_EQ("1", json_value);
-
- auto& set_link_value = commands.at(4).set_link_value();
+ auto& set_link_value = commands.at(3).set_link_value();
ASSERT_EQ(1u, set_link_value.path.module_path->size());
EXPECT_EQ("mod_name", set_link_value.path.module_path->at(0));
EXPECT_EQ("foo_link_name", set_link_value.path.link_name);
diff --git a/public/fidl/fuchsia.modular/story/story_command.fidl b/public/fidl/fuchsia.modular/story/story_command.fidl
index 448da41..c0ca8fb 100644
--- a/public/fidl/fuchsia.modular/story/story_command.fidl
+++ b/public/fidl/fuchsia.modular/story/story_command.fidl
@@ -21,9 +21,6 @@
// Adds a Mod.
AddMod add_mod;
- // Updates mod link params.
- UpdateMod update_mod;
-
// Removes an existing Mod.
RemoveMod remove_mod;
@@ -59,15 +56,6 @@
vector<string>? surface_parent_mod_name;
};
-// Updates a mod link values through its parameters.
-struct UpdateMod {
- vector<string> mod_name;
-
- // For every entry |p| in |parameters|, update the value of the link
- // backing |p.name| to that specified in |p.data|.
- vector<IntentParameter> parameters;
-};
-
// Removes the mod under |mod_name| from the story.
struct RemoveMod {
vector<string> mod_name;