Commit a0d113c
feat: Phase 1 - TimeConfiguration ESPI 4.0 schema compliance with JAXB (#51)
* feat: Phase 1 - TimeConfiguration ESPI 4.0 schema compliance with JAXB
Implements Phase 1 of 26-phase NAESB ESPI 4.0 schema compliance plan using
JAXB (Jakarta XML Binding) for XML marshalling/unmarshalling on Spring Boot 4.0.1
and Java 25.
## Implementation
**DTO Layer (JAXB):**
- TimeConfigurationDto: JAXB DTO with @XmlRootElement and XSD propOrder compliance
- Byte array cloning for DST rules (defensive copying)
- Utility methods: getTzOffsetInHours(), getEffectiveOffset(), hasDstRules()
- All 11 XML marshalling/unmarshalling tests passing
**Mapper Layer:**
- TimeConfigurationMapper: MapStruct bidirectional Entity-DTO conversion
- UUID handling: Entity.id → DTO.uuid mapping
- Ignores transient and managed fields
**Repository:**
- Removed 3 XPath-based query methods (non-index queries)
- Retained 2 index-based query methods: findAllIds(), findAllIdsByUsagePointId()
**Database Migration:**
- V4__Create_Time_Configurations.sql: XSD propOrder column sequence
- Indexes on created, updated, tz_offset
## Code Quality (SonarQube Fixes)
**TimeConfigurationDtoTest:**
- Replaced generic "throws Exception" with specific "throws JAXBException" (3 methods)
- Fixed variable naming to match camelCase convention (utcMinusEight, utcPlusFivePointFive)
- Methods that call marshaller/unmarshaller now declare JAXBException
**TimeConfigurationRepositoryTest:**
- Chained assertions for better readability (3 locations)
- Removed unused variables (2 occurrences)
- Used hasSameHashCodeAs() for hashCode assertion
**SonarQube Configuration:**
- Created sonar-project.properties to exclude Oracle-specific SQL rules
- Project uses MySQL, PostgreSQL, H2 - VARCHAR2 rule doesn't apply
- Configured multicriteria exclusions for sql:S6397 and sql:Oracle* rules
## Testing
- ✅ All 11 TimeConfigurationDtoTest tests pass (Spring Boot 4.0 + Java 25)
- ✅ XML marshalling/unmarshalling validated
- ✅ JAXB functionality verified with realistic timezone data
- ✅ Round-trip marshalling integrity confirmed
## Documentation
**Analysis Documents:**
- DTO_APPROACH_COMPARISON.md: JAXB vs Jackson XML evaluation
- PR50_MULTI_PHASE_IMPACT.md: Spring Boot 4.0 upgrade impact on all 26 phases
- PR50_TEST_FAILURE_FIX.md: Timestamp precision test fix
- JUNIE_VS_CLAUDE_GUIDELINES_COMPARISON.md: Test pattern migration guide
**Plan Updates:**
- MULTI_PHASE_SCHEMA_COMPLIANCE_PLAN.md: Updated with Spring Boot 4.0 stack
- Added comprehensive Spring Boot 4.0 test patterns for remaining 25 phases
## Technology Stack
- Java 25 (LTS - Zulu 25.28+85-CA)
- Spring Boot 4.0.1
- Jakarta EE 11
- JAXB (jakarta.xml.bind-api 4.x)
- MapStruct 1.6.3
Team Decision: JAXB selected for all 26 phases due to Jackson 3.0 XML immaturity
in Spring Boot 4.0.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
* fix: Remove duplicate V4 Flyway migration - table already exists in V2
The time_configurations table was already created in V2__MySQL_Specific_Tables.sql
because it contains BLOB columns requiring vendor-specific handling. The V4 migration
was attempting to create the same table, causing CI/CD failures with error:
SQL State: 42S01
Error Code: 1050
Message: Table 'time_configurations' already exists
Changes:
- Deleted openespi-common/src/main/resources/db/migration/V4__Create_Time_Configurations.sql
- Fixed openespi-thirdparty/pom.xml artifactId capitalization for consistency
Related to #51 (Phase 1: TimeConfiguration DTO implementation)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
---------
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent 81322fc commit a0d113c
File tree
14 files changed
+2845
-81
lines changed- openespi-common
- src
- main/java/org/greenbuttonalliance/espi/common
- dto/usage
- mapper/usage
- repositories/usage
- test/java/org/greenbuttonalliance/espi/common
- dto/usage
- repositories/usage
- openespi-thirdparty
14 files changed
+2845
-81
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
7 | 38 | | |
8 | 39 | | |
9 | 40 | | |
| |||
66 | 97 | | |
67 | 98 | | |
68 | 99 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
74 | 112 | | |
75 | 113 | | |
76 | 114 | | |
| |||
1120 | 1158 | | |
1121 | 1159 | | |
1122 | 1160 | | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
0 commit comments