Avoid duplicating parsing logic in ModelVersion

This now allows handling of the 999-SNAPSHOT version.

Closes #10879
This commit is contained in:
Alexander Schwartz 2022-03-23 08:36:43 +01:00 committed by Hynek Mlnařík
parent 6efa45f93e
commit 78549fe024

View file

@ -25,6 +25,7 @@ import org.keycloak.common.Version;
import org.keycloak.common.util.Time;
import org.keycloak.connections.jpa.JpaConnectionProvider;
import org.keycloak.migration.MigrationModel;
import org.keycloak.migration.ModelVersion;
import org.keycloak.models.ClientProvider;
import org.keycloak.models.ClientScopeProvider;
import org.keycloak.models.Constants;
@ -57,7 +58,7 @@ public class MigrationModelTest extends KeycloakModelTest {
public void test() {
inComittedTransaction(1, (session , i) -> {
String currentVersion = Version.VERSION_KEYCLOAK.replaceAll("^(\\d+(?:\\.\\d+){0,2}).*$", "$1");
String currentVersion = new ModelVersion(Version.VERSION_KEYCLOAK).toString();
JpaConnectionProvider p = session.getProvider(JpaConnectionProvider.class);
EntityManager em = p.getEntityManager();