Updates compatibility verifier for boot 3.2 compatibility

This commit is contained in:
spencergibb
2023-06-13 13:49:37 -04:00
parent 9cb8802f74
commit 3c0b55bac9
3 changed files with 26 additions and 26 deletions

View File

@@ -36,7 +36,7 @@ public class CompatibilityVerifierProperties {
* the patch version if you don't want to specify a concrete value. Example:
* {@code 3.4.x}
*/
private List<String> compatibleBootVersions = List.of("3.0.x", "3.1.x");
private List<String> compatibleBootVersions = List.of("3.2.x");
public boolean isEnabled() {
return this.enabled;

View File

@@ -36,8 +36,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
final Map<String, CompatibilityPredicate> ACCEPTED_VERSIONS = new HashMap<>() {
{
this.put("3.0", is3_0());
this.put("3.1", is3_1());
this.put("3.2", is3_2());
}
};
@@ -72,26 +71,27 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
return SpringBootVersion.getVersion();
}
CompatibilityPredicate is3_0() {
CompatibilityPredicate is3_2() {
return new CompatibilityPredicate() {
@Override
public String toString() {
return "Predicate for Boot 3.0";
return "Predicate for Boot 3.2";
}
@Override
public boolean isCompatible() {
try {
// since 3.0
Class.forName(
"org.springframework.boot.autoconfigure.validation.ValidationConfigurationCustomizer");
return true;
// try {
// since 3.2
// TODO: find new class/method in boot since 3.2
// Class.forName(
// "org.springframework.boot.autoconfigure.validation.ValidationConfigurationCustomizer");
return true;
}
catch (ClassNotFoundException e) {
return false;
}
// }
// catch (ClassNotFoundException e) {
// return false;
// }
}
};

View File

@@ -176,18 +176,18 @@ public class SpringBootDependencyTests {
@Test
public void should_match_against_current_manifest() {
try {
verifyCurrentVersionFromManifest("3.0");
verifyCurrentVersionFromManifest("3.0.x");
verifyCurrentVersionFromManifest("3.2");
verifyCurrentVersionFromManifest("3.2.x");
}
catch (AssertionError e) {
if (e.getMessage() != null && e.getMessage().contains("3.1.")) {
// we're likely running a boot 3.1 compatibility test, try 3.1
verifyCurrentVersionFromManifest("3.1");
verifyCurrentVersionFromManifest("3.1.x");
}
else {
throw e;
}
// if (e.getMessage() != null && e.getMessage().contains("3.3.")) {
// we're likely running a boot 3.3 compatibility test, try 3.3
// verifyCurrentVersionFromManifest("3.3");
// verifyCurrentVersionFromManifest("3.3.x");
// }
// else {
throw e;
// }
}
}
@@ -212,7 +212,7 @@ public class SpringBootDependencyTests {
}
};
versionVerifier.ACCEPTED_VERSIONS.clear();
versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_0());
versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_2());
VerificationResult verificationResult = versionVerifier.verify();
@@ -230,7 +230,7 @@ public class SpringBootDependencyTests {
}
};
versionVerifier.ACCEPTED_VERSIONS.clear();
versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_0());
versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_2());
VerificationResult verificationResult = versionVerifier.verify();