Add "component" property to command instance
When sending commands, we'll use "component" to route the command to
the target component it was designated for.
As a temporary stop-gap, use "device" as the component name before
we have full implementation of component/trait schema model.
Also removed CommandDictionary from CommandInstance::FromJson since
the validation will be done outside of JSON parsing code in the future
Component Manager class.
BUG: 25841719
Change-Id: I5c649c257fb48ecaaedc1ced84931009f94c2bb3
Reviewed-on: https://weave-review.googlesource.com/1764
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/commands/cloud_command_proxy_unittest.cc b/src/commands/cloud_command_proxy_unittest.cc
index 99ddffa..c022b79 100644
--- a/src/commands/cloud_command_proxy_unittest.cc
+++ b/src/commands/cloud_command_proxy_unittest.cc
@@ -76,28 +76,6 @@
EXPECT_CALL(state_change_queue_, GetLastStateChangeId())
.WillRepeatedly(testing::ReturnPointee(¤t_state_update_id_));
- // Set up the command schema.
- auto json = CreateDictionaryValue(R"({
- 'calc': {
- 'add': {
- 'minimalRole': 'user',
- 'parameters': {
- 'value1': 'integer',
- 'value2': 'integer'
- },
- 'progress': {
- 'status' : 'string'
- },
- 'results': {
- 'sum' : 'integer'
- }
- }
- }
- })");
- CHECK(json.get());
- CHECK(command_dictionary_.LoadCommands(*json, nullptr))
- << "Failed to parse test command dictionary";
-
CreateCommandInstance();
}
@@ -112,9 +90,8 @@
})");
CHECK(command_json.get());
- command_instance_ =
- CommandInstance::FromJson(command_json.get(), Command::Origin::kCloud,
- command_dictionary_, nullptr, nullptr);
+ command_instance_ = CommandInstance::FromJson(
+ command_json.get(), Command::Origin::kCloud, nullptr, nullptr);
CHECK(command_instance_.get());
// Backoff - start at 1s and double with each backoff attempt and no jitter.
@@ -139,7 +116,6 @@
testing::StrictMock<MockStateChangeQueueInterface> state_change_queue_;
testing::StrictMock<provider::test::FakeTaskRunner> task_runner_;
std::queue<base::Closure> task_queue_;
- CommandDictionary command_dictionary_;
std::unique_ptr<CommandInstance> command_instance_;
};