|
| 1 | +[](https://github.com/GreenButtonAlliance/OpenESPI-Common-java/actions) |
1 | 2 | [](https://github.com/GreenButtonAlliance/OpenESPI-Common-java/actions/workflows/ci.yml) |
2 | 3 | [](https://sonarcloud.io/dashboard?id=GreenButtonAlliance_OpenESPI-Common-java) |
3 | 4 | [](https://openjdk.org/) |
|
6 | 7 | [](https://jakarta.ee/) |
7 | 8 | [](https://hibernate.org/) |
8 | 9 | [](https://www.apache.org/licenses/LICENSE-2.0) |
9 | | -[](https://github.com/GreenButtonAlliance/OpenESPI-Common-java/actions) |
10 | | -[](https://www.greenbuttonalliance.org/) |
11 | | -[](https://www.naesb.org/) |
| 10 | +[](https://www.naesb.org/) |
12 | 11 | [](https://mapstruct.org/) |
13 | 12 | [](https://projectlombok.org/) |
14 | 13 |
|
@@ -71,4 +70,94 @@ Open IntelliJ and open the project (File > Open...). |
71 | 70 |
|
72 | 71 | ## Testing |
73 | 72 |
|
74 | | -All testing of OpenESPI is performed using the [Test Harness](https://github.com/greenbuttonalliance/OpenESPI-GreenButtonCMDTest.git) project. See the [README](https://github.com/greenbuttonalliance/OpenESPI-GreenButtonCMDTest/blob/master/README.md) file for instructions. |
| 73 | +The project includes comprehensive test classes to verify the Spring Boot 3.5 migration and core functionality: |
| 74 | + |
| 75 | +### Test Classes |
| 76 | + |
| 77 | +1. **`MigrationVerificationTest`** - Verifies core Spring Boot 3.5 migration features: |
| 78 | + - Jakarta EE 9+ Validation API functionality |
| 79 | + - Jakarta XML Binding (JAXB) for DTO marshalling |
| 80 | + - UUID primary key architecture |
| 81 | + - ESPI resource inheritance structure |
| 82 | + - Entity properties with Jakarta annotations |
| 83 | + - Customer domain entities independence |
| 84 | + - SummaryMeasurement DTO business logic |
| 85 | + |
| 86 | +2. **`TestApplication`** - Spring Boot test application: |
| 87 | + - Minimal Spring Boot configuration for testing |
| 88 | + - Entity scanning for domain objects |
| 89 | + - JPA repository configuration |
| 90 | + - Test-specific profile activation |
| 91 | + |
| 92 | +3. **`SpringBootTestConfiguration`** - Test configuration beans: |
| 93 | + - ESPI ID generator service for UUID5 generation |
| 94 | + - JAXB marshallers for domain objects and XML fragments |
| 95 | + - Bean validation factory |
| 96 | + - REST template for testing |
| 97 | + |
| 98 | +### Running Tests |
| 99 | + |
| 100 | +#### Run All Tests (Recommended) |
| 101 | +```bash |
| 102 | +# Execute complete test suite |
| 103 | +mvn clean test |
| 104 | + |
| 105 | +# Run tests with verbose output |
| 106 | +mvn clean test -X |
| 107 | + |
| 108 | +# Run specific test class |
| 109 | +mvn test -Dtest=MigrationVerificationTest |
| 110 | +``` |
| 111 | + |
| 112 | +#### Build with Tests |
| 113 | +```bash |
| 114 | +# Full build with test execution |
| 115 | +mvn clean package |
| 116 | + |
| 117 | +# Install to local repository with tests |
| 118 | +mvn clean install |
| 119 | + |
| 120 | +# Verify build integrity |
| 121 | +mvn clean verify |
| 122 | +``` |
| 123 | + |
| 124 | +#### Development Builds (Skip Tests) |
| 125 | +```bash |
| 126 | +# Fast compilation without tests (development only) |
| 127 | +mvn clean compile -Dmaven.test.skip=true |
| 128 | + |
| 129 | +# Fast package without tests (development only) |
| 130 | +mvn clean package -Dmaven.test.skip=true |
| 131 | + |
| 132 | +# Fast install without tests (development only) |
| 133 | +mvn clean install -Dmaven.test.skip=true |
| 134 | +``` |
| 135 | + |
| 136 | +#### Profile-Specific Testing |
| 137 | +```bash |
| 138 | +# Run with specific Maven profile |
| 139 | +mvn clean test -P <profile-name> |
| 140 | + |
| 141 | +# Example: development profile |
| 142 | +mvn clean test -P development |
| 143 | +``` |
| 144 | + |
| 145 | +### Test Coverage |
| 146 | + |
| 147 | +The test suite verifies: |
| 148 | +- ✅ Jakarta EE 9+ API compatibility |
| 149 | +- ✅ Spring Boot 3.5 auto-configuration |
| 150 | +- ✅ JAXB XML marshalling/unmarshalling |
| 151 | +- ✅ UUID primary key generation and usage |
| 152 | +- ✅ Entity relationship mapping |
| 153 | +- ✅ Bean validation functionality |
| 154 | +- ✅ DTO record structure and ESPI business logic |
| 155 | +- ✅ Compilation integrity across all modules |
| 156 | + |
| 157 | +### Test Reports |
| 158 | + |
| 159 | +Test results are generated in: |
| 160 | +- `target/surefire-reports/` - Test execution reports |
| 161 | +- `target/site/jacoco/` - Code coverage reports (if jacoco plugin enabled) |
| 162 | + |
| 163 | +For integration testing with external Green Button data, refer to the consumer applications that use this common module. |
0 commit comments