Overview
Review and enhance existing XML debug tests to include entity-specific marshalling validation for additional ESPI 4.0 entities.
Current State
Two XML debug test files exist but have limited coverage:
UsageXmlDebugTest.java
- Location:
openespi-common/src/test/java/org/greenbuttonalliance/espi/common/
- Current Coverage: Only tests UsagePoint entity marshalling
- JAXBContext Includes: TimeConfiguration, Authorization, ApplicationInformation (but not tested individually)
- Purpose: Validates
http://naesb.org/espi namespace handling
CustomerXmlDebugTest.java
- Location:
openespi-common/src/test/java/org/greenbuttonalliance/espi/common/
- Current Coverage: Only tests Customer entity marshalling
- JAXBContext Includes: Statement, StatementRef (but not tested individually)
- Purpose: Validates
http://naesb.org/espi/customer namespace handling
Gap Analysis
Both test files validate namespace declarations but don't test individual entity XML structure for several important entities already in their JAXBContext.
Required Enhancements
1. Review Existing Tests
2. Add Missing Entity Tests to UsageXmlDebugTest
Add entity-specific XML marshalling tests for:
3. Add Missing Entity Tests to CustomerXmlDebugTest
Add entity-specific XML marshalling tests for:
Test Requirements
Each entity-specific test should:
- Create entity with populated fields
- Marshal to XML string
- Validate XML structure matches ESPI 4.0 schema
- Verify namespace declarations are correct
- Validate element ordering per XSD propOrder
- Unmarshal back to entity to verify round-trip
Example Pattern
@Test
@DisplayName("Should marshal TimeConfiguration to ESPI XML")
void shouldMarshalTimeConfiguration() throws JAXBException {
// Arrange - create populated entity
TimeConfigurationEntity entity = new TimeConfigurationEntity();
// ... set fields
// Act - marshal to XML
String xml = marshalToString(entity);
// Assert - validate structure
assertThat(xml).contains("http://naesb.org/espi");
assertThat(xml).contains("<TimeConfiguration");
// ... additional assertions
}
Priority Entities
Focus on these high-priority entities first:
- TimeConfiguration - Critical for timezone handling
- Authorization - Critical for OAuth2 security
- ApplicationInformation - Critical for third-party integration
- Statement - Newly implemented Phase 19 entity
- StatementRef - Newly implemented Phase 19 embedded type
Success Criteria
References
- ESPI 4.0 Schema:
openespi-common/src/main/resources/schema/ESPI_4.0/
- usage.xsd: Contains TimeConfiguration, Authorization, ApplicationInformation definitions
- customer.xsd: Contains Statement (lines 373-393), StatementRef (lines 285-307) definitions
Related Issues
Overview
Review and enhance existing XML debug tests to include entity-specific marshalling validation for additional ESPI 4.0 entities.
Current State
Two XML debug test files exist but have limited coverage:
UsageXmlDebugTest.java
openespi-common/src/test/java/org/greenbuttonalliance/espi/common/http://naesb.org/espinamespace handlingCustomerXmlDebugTest.java
openespi-common/src/test/java/org/greenbuttonalliance/espi/common/http://naesb.org/espi/customernamespace handlingGap Analysis
Both test files validate namespace declarations but don't test individual entity XML structure for several important entities already in their JAXBContext.
Required Enhancements
1. Review Existing Tests
UsageXmlDebugTest.javafor completenessCustomerXmlDebugTest.javafor completeness2. Add Missing Entity Tests to UsageXmlDebugTest
Add entity-specific XML marshalling tests for:
3. Add Missing Entity Tests to CustomerXmlDebugTest
Add entity-specific XML marshalling tests for:
Test Requirements
Each entity-specific test should:
Example Pattern
Priority Entities
Focus on these high-priority entities first:
Success Criteria
References
openespi-common/src/main/resources/schema/ESPI_4.0/Related Issues