Skip to content

Commit

Permalink
documented/named InitDataModel to make it clear that this is a tempor…
Browse files Browse the repository at this point in the history
…ary hack for a test
  • Loading branch information
yufengwangca committed Dec 17, 2024
1 parent f382d72 commit 200f6a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/controller/tests/TestServerCommandDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ class DispatchTestDataModel : public CodegenDataModelProvider
}

protected:
// Since the current unit tests do not involve any cluster implementations, we override InitDataModel
// Since the current unit tests do not involve any cluster implementations, we override InitDataModelForTesting
// to do nothing, thereby preventing calls to the Ember-specific InitDataModelHandler.
void InitDataModel() override {}
void InitDataModelForTesting() override {}
};

class TestServerCommandDispatch : public chip::Test::AppContext
Expand Down
4 changes: 2 additions & 2 deletions src/data-model-providers/codegen/CodegenDataModelProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ CHIP_ERROR CodegenDataModelProvider::Startup(DataModel::InteractionModelContext
}
}

InitDataModel();
InitDataModelForTesting();

return CHIP_NO_ERROR;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ ConcreteCommandPath CodegenDataModelProvider::NextGeneratedCommand(const Concret
return ConcreteCommandPath(before.mEndpointId, before.mClusterId, commandId);
}

void CodegenDataModelProvider::InitDataModel()
void CodegenDataModelProvider::InitDataModelForTesting()
{
// Call the Ember-specific InitDataModelHandler
InitDataModelHandler();
Expand Down
5 changes: 4 additions & 1 deletion src/data-model-providers/codegen/CodegenDataModelProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ class CodegenDataModelProvider : public DataModel::Provider
void Temporary_ReportAttributeChanged(const AttributePathParams & path) override;

protected:
virtual void InitDataModel();
// Temporary hack for a test: Initializes the data model for testing purposes only.
// This method serves as a placeholder and should NOT be used outside of specific tests.
// It is expected to be removed or replaced with a proper implementation in the future.TODO:(#36837).
virtual void InitDataModelForTesting();

private:
// Iteration is often done in a tight loop going through all values.
Expand Down

0 comments on commit 200f6a9

Please sign in to comment.