Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/common/cloudprotocol/desiredstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ void UpdateItemInfoFromJSON(const common::utils::CaseInsensitiveObjectWrapper& j
{
AosIdentity identity;

auto err = ParseAosIdentity(json.GetObject("identity"), identity);
auto err = ParseAosIdentity(json.GetObject("item"), identity);
AOS_ERROR_CHECK_AND_THROW(err, "can't parse item");

if (!identity.mID.has_value()) {
AOS_ERROR_THROW(ErrorEnum::eNotFound, "item ID is missing");
AOS_ERROR_THROW(ErrorEnum::eNotFound, "item id is missing");
}

err = updateItemInfo.mItemID.Assign(identity.mID->c_str());
AOS_ERROR_CHECK_AND_THROW(err, "can't parse item ID");
AOS_ERROR_CHECK_AND_THROW(err, "can't parse itemID");

if (!identity.mType.has_value()) {
AOS_ERROR_THROW(ErrorEnum::eNotFound, "item type is missing");
Expand All @@ -72,11 +72,11 @@ void UpdateItemInfoFromJSON(const common::utils::CaseInsensitiveObjectWrapper& j
AOS_ERROR_CHECK_AND_THROW(err, "can't parse owner");

if (!identity.mID.has_value()) {
AOS_ERROR_THROW(ErrorEnum::eNotFound, "owner ID is missing");
AOS_ERROR_THROW(ErrorEnum::eNotFound, "owner id is missing");
}

err = updateItemInfo.mOwnerID.Assign(identity.mID->c_str());
AOS_ERROR_CHECK_AND_THROW(err, "can't parse owner ID");
AOS_ERROR_CHECK_AND_THROW(err, "can't parse ownerID");
}

err = updateItemInfo.mIndexDigest.Assign(json.GetValue<std::string>("indexDigest").c_str());
Expand All @@ -92,11 +92,11 @@ void DesiredInstanceInfoFromJSON(const common::utils::CaseInsensitiveObjectWrapp
AOS_ERROR_CHECK_AND_THROW(err, "can't parse item");

if (!identity.mID.has_value()) {
AOS_ERROR_THROW(ErrorEnum::eNotFound, "item ID is missing");
AOS_ERROR_THROW(ErrorEnum::eNotFound, "item id is missing");
}

err = instance.mItemID.Assign(identity.mID->c_str());
AOS_ERROR_CHECK_AND_THROW(err, "can't parse item ID");
AOS_ERROR_CHECK_AND_THROW(err, "can't parse itemID");
}

{
Expand All @@ -106,11 +106,11 @@ void DesiredInstanceInfoFromJSON(const common::utils::CaseInsensitiveObjectWrapp
AOS_ERROR_CHECK_AND_THROW(err, "can't parse subject");

if (!identity.mID.has_value()) {
AOS_ERROR_THROW(ErrorEnum::eNotFound, "subject ID is missing");
AOS_ERROR_THROW(ErrorEnum::eNotFound, "subject id is missing");
}

err = instance.mSubjectID.Assign(identity.mID->c_str());
AOS_ERROR_CHECK_AND_THROW(err, "can't parse subject ID");
AOS_ERROR_CHECK_AND_THROW(err, "can't parse subjectID");
}

instance.mPriority = json.GetValue<size_t>("priority");
Expand Down Expand Up @@ -191,7 +191,7 @@ Poco::JSON::Object::Ptr UpdateItemInfoToJSON(const UpdateItemInfo& updateItemInf
identity.mID = updateItemInfo.mItemID.CStr();
identity.mType = updateItemInfo.mType;

object->set("identity", CreateAosIdentity(identity));
object->set("item", CreateAosIdentity(identity));
}

object->set("version", updateItemInfo.mVersion.CStr());
Expand Down
4 changes: 2 additions & 2 deletions src/common/cloudprotocol/tests/desiredstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ TEST_F(CloudProtocolDesiredStatus, Items)
"messageType": "desiredStatus",
"items": [
{
"identity": {
"item": {
"id": "item1",
"type": "service"
},
Expand All @@ -242,7 +242,7 @@ TEST_F(CloudProtocolDesiredStatus, Items)
"indexDigest": "sha256:36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80"
},
{
"identity": {
"item": {
"id": "item2",
"type": "component"
},
Expand Down
Loading