Skip to content

Commit

Permalink
Fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Feb 6, 2025
1 parent 3e224f4 commit b0111d9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 78 deletions.
21 changes: 0 additions & 21 deletions src/app/data-model-provider/MetadataLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,6 @@ Protocols::InteractionModel::Status ValidateClusterPath(ProviderMetadataTree * p
return Protocols::InteractionModel::Status::UnsupportedEndpoint;
}

Protocols::InteractionModel::Status ValidateClusterPath(ProviderMetadataTree * provider, const ConcreteClusterPath & path,
Protocols::InteractionModel::Status successStatus)
{
if (ServerClusterFinder(provider).Find(path).has_value())
{
return successStatus;
}

auto endpoints = provider->EndpointsIgnoreError();
for (auto & endpointEntry : endpoints)
{
if (endpointEntry.id == path.mEndpointId)
{
// endpoint is valid
return Protocols::InteractionModel::Status::UnsupportedCluster;
}
}

return Protocols::InteractionModel::Status::UnsupportedEndpoint;
}

} // namespace DataModel
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -1905,63 +1905,6 @@ TEST_F(TestCodegenModelViaMocks, AttributeAccessInterfaceListIncrementalRead)
}
}

<<<<<<< HEAD
TEST_F(TestCodegenModelViaMocks, ReadGlobalAttributeAttributeList)
{
UseMockNodeConfig config(gTestNodeConfig);
CodegenDataModelProviderWithContext model;
ScopedMockAccessControl accessControl;

ReadOperation testRequest(kMockEndpoint2, MockClusterId(3), AttributeList::Id);
testRequest.SetSubjectDescriptor(kAdminSubjectDescriptor);

// Data read via the encoder
std::unique_ptr<AttributeValueEncoder> encoder = testRequest.StartEncoding();
ASSERT_EQ(model.ReadAttribute(testRequest.GetRequest(), *encoder), CHIP_NO_ERROR);
ASSERT_EQ(testRequest.FinishEncoding(), CHIP_NO_ERROR);

// Validate after read
std::vector<DecodedAttributeData> attribute_data;
ASSERT_EQ(testRequest.GetEncodedIBs().Decode(attribute_data), CHIP_NO_ERROR);
ASSERT_EQ(attribute_data.size(), 1u);

DecodedAttributeData & encodedData = attribute_data[0];
ASSERT_EQ(encodedData.attributePath, testRequest.GetRequest().path);

ASSERT_EQ(encodedData.dataReader.GetType(), TLV::kTLVType_Array);

std::vector<AttributeId> items;
ASSERT_EQ(DecodeList(encodedData.dataReader, items), CHIP_NO_ERROR);

// Mock data contains ClusterRevision and FeatureMap.
// After this, Global attributes are auto-added
std::vector<AttributeId> expected;

// Encoding in global-attribute-access-interface has a logic of:
// - Append global attributes in front of the first specified
// large number global attribute.
// Since ClusterRevision and FeatureMap are
// global attributes, the order here is reversed for them
for (AttributeId id : GlobalAttributesNotInMetadata)
{
expected.push_back(id);
}
expected.push_back(ClusterRevision::Id);
expected.push_back(FeatureMap::Id);
expected.push_back(MockAttributeId(1));
expected.push_back(MockAttributeId(2));
expected.push_back(MockAttributeId(3));

ASSERT_EQ(items.size(), expected.size());

// Since we have no std::vector formatter, comparing element by element is somewhat
// more readable in case of failure.
for (unsigned i = 0; i < items.size(); i++)
{
EXPECT_EQ(items[i], expected[i]);
}
}

TEST_F(TestCodegenModelViaMocks, EmberAttributeWriteBasicTypes)
{
TestEmberScalarTypeWrite<uint8_t, ZCL_INT8U_ATTRIBUTE_TYPE>(0x12);
Expand Down

0 comments on commit b0111d9

Please sign in to comment.