Skip to content

Improve test coverage for storeconfig module#985

Open
onkar717 wants to merge 1 commit intoapache:mainfrom
onkar717:test-coverage-storeconfig
Open

Improve test coverage for storeconfig module#985
onkar717 wants to merge 1 commit intoapache:mainfrom
onkar717:test-coverage-storeconfig

Conversation

@onkar717
Copy link
Copy Markdown
Contributor

@onkar717 onkar717 commented Apr 12, 2026

Summary

This PR improves test coverage for the storeconfig module by adding
unit tests for core classes that previously had little to no test
coverage.

Motivation

While analyzing overall test coverage, the storeconfig module was
identified as one of the largest gaps, with many untested classes.
These classes are responsible for configuration serialization and
XML generation, making them important for reliability.

This PR introduces targeted tests to cover core behaviors, edge cases,
and failure scenarios across the module.

Changes

StoreDescription

Added TestStoreDescription covering:

  • Getters and setters
  • Transient attributes and child handling
  • Identifier and attribute resolution

StoreRegistry

Added TestStoreRegistry covering:

  • Registration and unregistration of descriptions
  • Lookup and factory resolution
  • Handling of missing or invalid classes

StoreAppender

Added TestStoreAppender covering:

  • XML tag generation
  • Attribute and value printing
  • Indentation and formatting behavior
  • Handling of arrays and nested elements

StoreFactoryBase

Added TestStoreFactoryBase covering:

  • Storing elements with and without descriptors
  • Appender and registry interaction
  • XML generation entry points

StoreFileMover

Added TestStoreFileMover covering:

  • File rotation and rename logic
  • Writer creation and handling
  • Failure scenarios and edge cases
  • Property getters and setters

Testing

All tests pass locally:

ant clean test

Targeted validation performed for each new test class with no failures.

Test results:

TestStoreDescription:   Tests run: 10, Failures: 0, Errors: 0
TestStoreRegistry:      Tests run: 9,  Failures: 0, Errors: 0
TestStoreAppender:      Tests run: 16, Failures: 0, Errors: 0
TestStoreFactoryBase:   Tests run: 9,  Failures: 0, Errors: 0
TestStoreFileMover:     Tests run: 7,  Failures: 0, Errors: 0

Coverage Impact

This PR significantly improves coverage for the storeconfig module,
which previously had minimal test coverage.

Core classes are now covered, including:

  • StoreDescription
  • StoreRegistry
  • StoreAppender
  • StoreFactoryBase
  • StoreFileMover

This establishes a strong foundation for further coverage improvements
in remaining classes.

Impact

  • No functional changes
  • Test coverage improvement only

Files Changed

  • TestStoreDescription.java (new)
  • TestStoreRegistry.java (new)
  • TestStoreAppender.java (new)
  • TestStoreFactoryBase.java (new)
  • TestStoreFileMover.java (new)

Notes

This PR is part of ongoing work to systematically improve test
coverage across Tomcat modules, focusing on high-impact gaps.

Checklist

  • Tests added
  • Existing tests pass
  • No functional changes
  • ASF license headers included
  • Changes limited to test code only
  • Build verified with ant clean test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant