Started implementing comprehensive test coverage for the Bloomreach CMS Document Export Plugin. This document tracks the test implementation progress, test cases created, and the testing roadmap.
ExportJsonUtilsTest (7 tests)
- ✅
testExtractHandleWithNullNode- Null input handling - ✅
testExtractHandleWithHandleNode- Returns same node if already handle - ✅
testExtractHandleWithDocumentNodeWhoseParentIsHandle- Returns parent handle - ✅
testExtractHandleWithNodeWhoseParentIsNotHandle- Returns null for non-handle parent - ✅
testExtractHandleWithNodeHavingNullParent- Handles null parent gracefully - ✅
testExtractHandleHandlesRepositoryException- Propagates RepositoryException - ✅
testExtractHandleHandlesRepositoryExceptionOnParentCheck- Exception propagation on parent access
ExportTabularUtilsTest (14 tests)
- ✅
testPropertyValueToStringSingleValue- Single-valued property conversion - ✅
testPropertyValueToStringMultipleValues- Multi-valued property with pipe delimiter - ✅
testPropertyValueToStringMultipleValuesWithEmptyStrings- Preserves empty strings - ✅
testPropertyValueToStringMultipleValuesWithSpecialCharacters- Preserves special chars - ✅
testPropertyValueToStringMultipleValuesWithExceptionInValue- Graceful error handling in arrays - ✅
testPropertyValueToStringEmptyMultipleValues- Empty arrays - ✅
testGetPropertyTypeNameString- Returns 'String' for PropertyType.STRING - ✅
testGetPropertyTypeNameLong- Returns 'Long' - ✅
testGetPropertyTypeNameDouble- Returns 'Double' - ✅
testGetPropertyTypeNameBoolean- Returns 'Boolean' - ✅
testGetPropertyTypeNameDate- Returns 'Date' - ✅
testGetPropertyTypeNameBinary- Returns 'Binary' - ✅
testGetPropertyTypeNameReference- Returns 'Reference' - ✅
testGetPropertyTypeNameUndefined- Returns 'undefined' (lowercase)
ExportJsonWorkflowImplTest (7 tests)
- ✅
testExportJsonDocumentBasicInfo- Document path, name, primary type - ✅
testExportJsonDocumentWithSingleValuedProperty- Single-valued property serialization - ✅
testExportJsonDocumentWithMultiValuedProperty- Array property serialization - ✅
testExportJsonDocumentWithMetadata- Metadata extraction (created, modified, author) - ✅
testExportJsonDocumentHandlesUnserializableProperty- Error resilience for unparseable properties - ✅
testExportJsonDocumentThrowsForInvalidNodeId- RepositoryException propagation for missing nodes - ✅
testInvokeWorkflowIsNoOp- invokeWorkflow() no-op validation
| Class | Status | Tests | Coverage |
|---|---|---|---|
ExportJsonUtils |
✅ Covered | 7 | Handle extraction logic |
ExportTabularUtils |
✅ Covered | 14 | Property conversion, type names |
ExportJsonWorkflowImpl |
✅ Covered | 7 | Basic JSON export scenarios |
ExportTabularWorkflowImpl |
⏳ Pending | - | CSV/TSV export logic |
ExportPdfWorkflowImpl |
⏳ Pending | - | PDF/XSL-FO generation (complex) |
ExportHtmlWorkflowImpl |
⏳ Pending | - | HTML semantic generation |
ExportXmlWorkflowImpl |
⏳ Pending | - | XML serialization |
| Component | Status | Tests | Coverage |
|---|---|---|---|
ExportJsonPlugin |
⏳ Pending | - | Plugin registration, workflow orchestration |
| Dialog Classes (5) | ⏳ Pending | - | Form validation, parameter handling |
| Download Pages (5) | ⏳ Pending | - | HTTP response generation |
- Unit Testing: JUnit 4
- Mocking: EasyMock 4.x
- JSON Validation: Jackson ObjectMapper
- Build System: Maven Surefire
- Mock-based Testing: All JCR objects (Node, Session, Property, Value) mocked
- Reflection-based Context Injection: WorkflowContext injected via reflection for workflow testing
- Expected Exception Testing: assertThrows for error path validation
- Data Validation: JSON parsing to validate output structure
- ExportTabularWorkflowImpl - CSV/TSV generation
- ExportPdfWorkflowImpl - XSL-FO to PDF conversion
- ExportHtmlWorkflowImpl - Semantic HTML with CSS
- ExportXmlWorkflowImpl - XML serialization with namespaces
- Dialog form validation and parameter extraction
- HTTP response header generation
- File download functionality
- Session attribute storage/cleanup
- Wicket component behavior
- End-to-end export workflows
- Multi-valued property handling across formats
- Error recovery and user feedback
- Large document handling
- Missing/null properties
- Binary and reference properties
- Complex nested structures
- Permission errors
- Repository connection failures
-
High Priority (Error-prone, high impact):
- PDF export (FOP integration, complex XSL-FO generation)
- Multi-valued property handling (across all formats)
- HTTP response generation
- Error recovery
-
Medium Priority (Standard functionality):
- Single export workflows
- Metadata extraction
- Form parameter validation
- Basic file download
-
Low Priority (Straightforward, low risk):
- Utility methods (already tested)
- Constants validation
- Plugin initialization
mvn -pl tests clean testmvn -pl tests clean test -Dtest=ExportJsonUtilsTestmvn -pl tests clean test -Dtest=ExportJsonUtilsTest,ExportTabularUtilsTest,ExportJsonWorkflowImplTestmvn -pl tests clean test site:sitetests/src/test/java/org/onehippo/forge/exportjson/repository/
├── ExportJsonUtilsTest.java (7 tests)
├── ExportTabularUtilsTest.java (14 tests)
└── workflow/
└── ExportJsonWorkflowImplTest.java (7 tests)
tests/pom.xml - Maven dependencies and Surefire config
tests/src/test/resources/ - HCM test configuration and fixtures
- Implement Phase 2 (Workflow Tests for remaining export formats)
- Add code coverage reporting (JaCoCo integration)
- Create integration tests for end-to-end workflows
- Document test execution in CI/CD pipeline
- Add pre-commit hooks to run tests automatically
- All utility tests passing with mocked dependencies
- Workflow tests using reflection injection of WorkflowContext
- Error handling tests validate exception propagation
- JSON validation tests parse output and check structure
- Special characters and edge cases covered in property value tests