Commit 9c1ed49
committed
feat: add Java/Maven support to pulumitest
Add comprehensive Java/Maven support to the Pulumi Provider Testing Library (pulumitest),
enabling developers to test Java Pulumi programs with local SDK builds and custom Maven configurations.
- **JavaMavenDependency()**: Add or update local Maven dependencies in pom.xml with system scope for local JAR files
- **JavaMavenProfile()**: Activate Maven profiles via MAVEN_ACTIVE_PROFILES environment variable
- **JavaTargetVersion()**: Set Java compiler source and target versions in pom.xml properties
- **JavaMavenSettings()**: Pass custom Maven settings.xml file via environment variable
- `pulumitest/pomxml.go`: XML manipulation utilities for pom.xml handling using proper XML unmarshaling with attribute capture
- `pulumitest/pomxml_test.go`: Comprehensive unit tests for XML operations
- `pulumitest/testdata/java_simple/`: Test data with sample Pulumi Java program using Random provider
- `pulumitest/opttest/opttest.go`: Added Java options, MavenDependency type, and option functions
- `pulumitest/newStack.go`: Integrated Java/Maven configuration handling during stack creation
- `pulumitest/pulumiTest_test.go`: Added integration tests for Java options
- Uses generic XML node structure that preserves all pom.xml content including attributes
- Proper error handling for missing pom.xml files
- Follows established patterns from GoModReplacement and YarnLink implementations
- Environment variables passed to Maven commands for profile and settings configuration
- Unit tests for pomxml utilities (XML parsing, dependency management, version setting)
- Integration tests verifying all Java options are properly applied to PulumiTest
- Uses Pulumi Random provider for lightweight testing without cloud credentials
All new tests pass successfully.
Fixes #1491 parent fe0a2a7 commit 9c1ed49
File tree
8 files changed
+938
-17
lines changed- pulumitest
- opttest
- testdata/java_simple
- src/main/java/myproject
8 files changed
+938
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
171 | 175 | | |
172 | 176 | | |
173 | 177 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
177 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
178 | 248 | | |
179 | 249 | | |
180 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
116 | 156 | | |
117 | 157 | | |
118 | 158 | | |
| |||
155 | 195 | | |
156 | 196 | | |
157 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
158 | 205 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
173 | 224 | | |
174 | 225 | | |
175 | 226 | | |
| |||
201 | 252 | | |
202 | 253 | | |
203 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
204 | 259 | | |
205 | 260 | | |
206 | 261 | | |
| |||
0 commit comments