Skip to content

Commit 5aee545

Browse files
committed
make it standard that test Providers are for now CodegenDataModelProvider. Saves me some typing as I move things around
1 parent 4a71ae1 commit 5aee545

File tree

4 files changed

+4
-165
lines changed

4 files changed

+4
-165
lines changed

src/app/tests/test-interaction-model-api.cpp

-65
Original file line numberDiff line numberDiff line change
@@ -149,70 +149,5 @@ std::optional<ActionReturnStatus> TestImCustomDataModel::Invoke(const InvokeRequ
149149
return std::make_optional<ActionReturnStatus>(CHIP_ERROR_NOT_IMPLEMENTED);
150150
}
151151

152-
DataModel::MetadataList<DataModel::EndpointEntry> TestImCustomDataModel::Endpoints()
153-
{
154-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->Endpoints();
155-
}
156-
157-
DataModel::MetadataList<DataModel::Provider::SemanticTag> TestImCustomDataModel::SemanticTags(EndpointId endpointId)
158-
{
159-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->SemanticTags(endpointId);
160-
}
161-
162-
DataModel::MetadataList<DataModel::DeviceTypeEntry> TestImCustomDataModel::DeviceTypes(EndpointId endpointId)
163-
{
164-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->DeviceTypes(endpointId);
165-
}
166-
167-
ClusterEntry TestImCustomDataModel::FirstServerCluster(EndpointId endpoint)
168-
{
169-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstServerCluster(endpoint);
170-
}
171-
172-
ClusterEntry TestImCustomDataModel::NextServerCluster(const ConcreteClusterPath & before)
173-
{
174-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextServerCluster(before);
175-
}
176-
177-
std::optional<ClusterInfo> TestImCustomDataModel::GetServerClusterInfo(const ConcreteClusterPath & path)
178-
{
179-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GetServerClusterInfo(path);
180-
}
181-
182-
ConcreteClusterPath TestImCustomDataModel::FirstClientCluster(EndpointId endpoint)
183-
{
184-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstClientCluster(endpoint);
185-
}
186-
187-
ConcreteClusterPath TestImCustomDataModel::NextClientCluster(const ConcreteClusterPath & before)
188-
{
189-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextClientCluster(before);
190-
}
191-
192-
AttributeEntry TestImCustomDataModel::FirstAttribute(const ConcreteClusterPath & cluster)
193-
{
194-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstAttribute(cluster);
195-
}
196-
197-
AttributeEntry TestImCustomDataModel::NextAttribute(const ConcreteAttributePath & before)
198-
{
199-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextAttribute(before);
200-
}
201-
202-
std::optional<AttributeInfo> TestImCustomDataModel::GetAttributeInfo(const ConcreteAttributePath & path)
203-
{
204-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GetAttributeInfo(path);
205-
}
206-
207-
MetadataList<DataModel::AcceptedCommandEntry> TestImCustomDataModel::AcceptedCommands(const ConcreteClusterPath & path)
208-
{
209-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->AcceptedCommands(path);
210-
}
211-
212-
MetadataList<CommandId> TestImCustomDataModel::GeneratedCommands(const ConcreteClusterPath & path)
213-
{
214-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GeneratedCommands(path);
215-
}
216-
217152
} // namespace app
218153
} // namespace chip

src/app/tests/test-interaction-model-api.h

+2-17
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/// test-interaction-model-api was created to consolidate and centralize stub functions that are used by the Interaction Model
2020
/// during unit-testing.
2121

22+
#include "data-model-providers/codegen/CodegenDataModelProvider.h"
2223
#include <app/CommandHandler.h>
2324
#include <app/ConcreteCommandPath.h>
2425
#include <app/WriteHandler.h>
@@ -96,7 +97,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPat
9697
/// TODO items for above:
9798
/// - once IM only supports DataModel
9899
/// - break ember-overrides in this h/cpp file
99-
class TestImCustomDataModel : public DataModel::Provider
100+
class TestImCustomDataModel : public CodegenDataModelProvider
100101
{
101102
public:
102103
static TestImCustomDataModel & Instance();
@@ -109,22 +110,6 @@ class TestImCustomDataModel : public DataModel::Provider
109110
AttributeValueDecoder & decoder) override;
110111
std::optional<DataModel::ActionReturnStatus> Invoke(const DataModel::InvokeRequest & request,
111112
chip::TLV::TLVReader & input_arguments, CommandHandler * handler) override;
112-
113-
DataModel::MetadataList<CommandId> GeneratedCommands(const ConcreteClusterPath & path) override;
114-
DataModel::MetadataList<DataModel::AcceptedCommandEntry> AcceptedCommands(const ConcreteClusterPath & path) override;
115-
DataModel::MetadataList<SemanticTag> SemanticTags(EndpointId endpointId) override;
116-
DataModel::MetadataList<DataModel::DeviceTypeEntry> DeviceTypes(EndpointId endpointId) override;
117-
DataModel::MetadataList<DataModel::EndpointEntry> Endpoints() override;
118-
119-
DataModel::ClusterEntry FirstServerCluster(EndpointId endpoint) override;
120-
DataModel::ClusterEntry NextServerCluster(const ConcreteClusterPath & before) override;
121-
std::optional<DataModel::ClusterInfo> GetServerClusterInfo(const ConcreteClusterPath & path) override;
122-
ConcreteClusterPath FirstClientCluster(EndpointId endpoint) override;
123-
ConcreteClusterPath NextClientCluster(const ConcreteClusterPath & before) override;
124-
DataModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override;
125-
DataModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override;
126-
std::optional<DataModel::AttributeInfo> GetAttributeInfo(const ConcreteAttributePath & path) override;
127-
void Temporary_ReportAttributeChanged(const AttributePathParams & path) override {}
128113
};
129114

130115
} // namespace app

src/controller/tests/data_model/DataModelFixtures.cpp

-65
Original file line numberDiff line numberDiff line change
@@ -477,70 +477,5 @@ std::optional<ActionReturnStatus> CustomDataModel::Invoke(const InvokeRequest &
477477
return std::nullopt; // handler status is set by the dispatch
478478
}
479479

480-
DataModel::MetadataList<DataModel::EndpointEntry> CustomDataModel::Endpoints()
481-
{
482-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->Endpoints();
483-
}
484-
485-
DataModel::MetadataList<DataModel::DeviceTypeEntry> CustomDataModel::DeviceTypes(EndpointId endpointId)
486-
{
487-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->DeviceTypes(endpointId);
488-
}
489-
490-
ClusterEntry CustomDataModel::FirstServerCluster(EndpointId endpoint)
491-
{
492-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstServerCluster(endpoint);
493-
}
494-
495-
ClusterEntry CustomDataModel::NextServerCluster(const ConcreteClusterPath & before)
496-
{
497-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextServerCluster(before);
498-
}
499-
500-
std::optional<ClusterInfo> CustomDataModel::GetServerClusterInfo(const ConcreteClusterPath & path)
501-
{
502-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GetServerClusterInfo(path);
503-
}
504-
505-
ConcreteClusterPath CustomDataModel::FirstClientCluster(EndpointId endpoint)
506-
{
507-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstClientCluster(endpoint);
508-
}
509-
510-
ConcreteClusterPath CustomDataModel::NextClientCluster(const ConcreteClusterPath & before)
511-
{
512-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextClientCluster(before);
513-
}
514-
515-
AttributeEntry CustomDataModel::FirstAttribute(const ConcreteClusterPath & cluster)
516-
{
517-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->FirstAttribute(cluster);
518-
}
519-
520-
AttributeEntry CustomDataModel::NextAttribute(const ConcreteAttributePath & before)
521-
{
522-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->NextAttribute(before);
523-
}
524-
525-
std::optional<AttributeInfo> CustomDataModel::GetAttributeInfo(const ConcreteAttributePath & path)
526-
{
527-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GetAttributeInfo(path);
528-
}
529-
530-
DataModel::MetadataList<DataModel::Provider::SemanticTag> CustomDataModel::SemanticTags(EndpointId endpointId)
531-
{
532-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->SemanticTags(endpointId);
533-
}
534-
535-
MetadataList<DataModel::AcceptedCommandEntry> CustomDataModel::AcceptedCommands(const ConcreteClusterPath & path)
536-
{
537-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->AcceptedCommands(path);
538-
}
539-
540-
MetadataList<CommandId> CustomDataModel::GeneratedCommands(const ConcreteClusterPath & path)
541-
{
542-
return CodegenDataModelProviderInstance(nullptr /* delegate */)->GeneratedCommands(path);
543-
}
544-
545480
} // namespace app
546481
} // namespace chip

src/controller/tests/data_model/DataModelFixtures.h

+2-18
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#pragma once
2323

24+
#include "data-model-providers/codegen/CodegenDataModelProvider.h"
2425
#include <app/CommandHandler.h>
2526
#include <app/data-model-provider/Provider.h>
2627
#include <app/util/mock/Constants.h>
@@ -108,7 +109,7 @@ extern CommandHandler::Handle gAsyncCommandHandle;
108109
/// TODO items for above:
109110
/// - once IM only supports DataModel
110111
/// - break ember-overrides in this h/cpp file
111-
class CustomDataModel : public DataModel::Provider
112+
class CustomDataModel : public CodegenDataModelProvider
112113
{
113114
public:
114115
static CustomDataModel & Instance();
@@ -121,23 +122,6 @@ class CustomDataModel : public DataModel::Provider
121122
AttributeValueDecoder & decoder) override;
122123
std::optional<DataModel::ActionReturnStatus> Invoke(const DataModel::InvokeRequest & request,
123124
chip::TLV::TLVReader & input_arguments, CommandHandler * handler) override;
124-
125-
DataModel::MetadataList<CommandId> GeneratedCommands(const ConcreteClusterPath & path) override;
126-
DataModel::MetadataList<DataModel::AcceptedCommandEntry> AcceptedCommands(const ConcreteClusterPath & path) override;
127-
DataModel::MetadataList<SemanticTag> SemanticTags(EndpointId endpointId) override;
128-
DataModel::MetadataList<DataModel::DeviceTypeEntry> DeviceTypes(EndpointId endpointId) override;
129-
DataModel::MetadataList<DataModel::EndpointEntry> Endpoints() override;
130-
131-
DataModel::ClusterEntry FirstServerCluster(EndpointId endpoint) override;
132-
DataModel::ClusterEntry NextServerCluster(const ConcreteClusterPath & before) override;
133-
std::optional<DataModel::ClusterInfo> GetServerClusterInfo(const ConcreteClusterPath & path) override;
134-
ConcreteClusterPath FirstClientCluster(EndpointId endpoint) override;
135-
ConcreteClusterPath NextClientCluster(const ConcreteClusterPath & before) override;
136-
DataModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override;
137-
DataModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override;
138-
std::optional<DataModel::AttributeInfo> GetAttributeInfo(const ConcreteAttributePath & path) override;
139-
140-
void Temporary_ReportAttributeChanged(const AttributePathParams & path) override {}
141125
};
142126

143127
} // namespace DataModelTests

0 commit comments

Comments
 (0)