diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2022-02-01 15:16:25 -0600 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-02-22 20:02:46 +0000 |
commit | 60c1a4038e041a342dda9810e6fd761d66b01bdb (patch) | |
tree | 0e76b4252e4d7d257cf4ddcb6f081996bb1e03ab /server/sonar-db-migration | |
parent | 9694d4113bf401b84e86e0223dbea8f5339388d8 (diff) | |
download | sonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.tar.gz sonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.zip |
SONAR-15994 Migrate Sonarqube IOC framework from Pico to Spring
Diffstat (limited to 'server/sonar-db-migration')
24 files changed, 167 insertions, 222 deletions
diff --git a/server/sonar-db-migration/build.gradle b/server/sonar-db-migration/build.gradle index 466b47e251b..1cb23f4fdce 100644 --- a/server/sonar-db-migration/build.gradle +++ b/server/sonar-db-migration/build.gradle @@ -11,7 +11,6 @@ dependencies { compile 'commons-lang:commons-lang' compile 'commons-codec:commons-codec' compile 'com.fasterxml.staxmate:staxmate' - compile 'org.picocontainer:picocontainer' compile project(':server:sonar-db-core') compile project(':server:sonar-process') diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigration.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigration.java index e24c7f9e6e2..7598ec022bf 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigration.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigration.java @@ -26,10 +26,6 @@ public interface DatabaseMigration { * <p> * Migration can not be started twice but calling this method wont raise an error. * </p> - * <p> - * <strong>This method should be named {@code start} but it can not be because it will be called by the pico container - * and this will cause unwanted behavior</strong> - * </p> */ void startIt(); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java index 6351152b24a..a6e8762c030 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java @@ -22,6 +22,7 @@ package org.sonar.server.platform.db.migration; import org.sonar.core.platform.Module; import org.sonar.server.platform.db.migration.history.MigrationHistoryImpl; import org.sonar.server.platform.db.migration.history.MigrationHistoryMeddler; +import org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl; import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; import org.sonar.server.platform.db.migration.step.MigrationStepRegistryImpl; @@ -36,6 +37,7 @@ public class MigrationConfigurationModule extends Module { @Override protected void configureModule() { add( + MigrationHistoryTableImpl.class, // DbVersion implementations DbVersion00.class, DbVersion90.class, diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationEngineModule.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationEngineModule.java index 47aaeadb3a0..5632ee164ae 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationEngineModule.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationEngineModule.java @@ -20,8 +20,8 @@ package org.sonar.server.platform.db.migration; import org.sonar.core.platform.Module; -import org.sonar.server.platform.db.migration.engine.MigrationContainerPopulatorImpl; import org.sonar.server.platform.db.migration.engine.MigrationEngineImpl; +import org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl; /** * Defines the components for the migration engine. @@ -30,7 +30,7 @@ public class MigrationEngineModule extends Module { @Override protected void configureModule() { add( - MigrationContainerPopulatorImpl.class, + MigrationStepsExecutorImpl.class, MigrationEngineImpl.class); } } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/DatabaseCharsetChecker.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/DatabaseCharsetChecker.java index 8e222273a43..d046b1730d7 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/DatabaseCharsetChecker.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/DatabaseCharsetChecker.java @@ -23,6 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import java.sql.Connection; import java.sql.SQLException; import javax.annotation.CheckForNull; +import javax.inject.Inject; + import org.sonar.db.Database; import org.sonar.db.dialect.Dialect; import org.sonar.db.dialect.H2; @@ -46,6 +48,7 @@ public class DatabaseCharsetChecker { private final Database db; private final SqlExecutor sqlExecutor; + @Inject public DatabaseCharsetChecker(Database db) { this(db, new SqlExecutor()); } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImpl.java index 7785c369247..1977660bdbe 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImpl.java @@ -19,42 +19,35 @@ */ package org.sonar.server.platform.db.migration.engine; -import org.picocontainer.ComponentAdapter; -import org.picocontainer.DefaultPicoContainer; -import org.picocontainer.LifecycleStrategy; -import org.picocontainer.MutablePicoContainer; -import org.picocontainer.behaviors.OptInCaching; -import org.picocontainer.monitors.NullComponentMonitor; +import java.util.HashSet; +import java.util.Set; import org.sonar.api.config.PropertyDefinitions; -import org.sonar.core.platform.ComponentContainer; -import org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy; +import org.sonar.core.platform.LazyStrategy; +import org.sonar.core.platform.SpringComponentContainer; +import org.sonar.server.platform.db.migration.step.MigrationStep; +import org.sonar.server.platform.db.migration.step.MigrationSteps; +import org.sonar.server.platform.db.migration.step.MigrationStepsExecutor; -import static java.util.Objects.requireNonNull; +import static java.util.Collections.emptyList; -public class MigrationContainerImpl extends ComponentContainer implements MigrationContainer { +public class MigrationContainerImpl extends SpringComponentContainer implements MigrationContainer { - public MigrationContainerImpl(ComponentContainer parent, MigrationContainerPopulator populator) { - super(createContainer(requireNonNull(parent)), parent.getComponentByType(PropertyDefinitions.class)); - - populateContainer(requireNonNull(populator)); + public MigrationContainerImpl(SpringComponentContainer parent, Class<? extends MigrationStepsExecutor> executor) { + super(parent, parent.getComponentByType(PropertyDefinitions.class), emptyList(), new LazyStrategy()); + add(executor); + addSteps(parent.getComponentByType(MigrationSteps.class)); startComponents(); } - private void populateContainer(MigrationContainerPopulator populator) { - populator.populateContainer(this); - } - - /** - * Creates a PicContainer which extends the specified ComponentContainer <strong>but is not referenced in return</strong>. - */ - private static MutablePicoContainer createContainer(ComponentContainer parent) { - LifecycleStrategy lifecycleStrategy = new StartableCloseableSafeLifecyleStrategy() { - @Override - public boolean isLazy(ComponentAdapter<?> adapter) { - return true; + private void addSteps(MigrationSteps migrationSteps) { + Set<Class<? extends MigrationStep>> classes = new HashSet<>(); + migrationSteps.readAll().forEach(step -> { + Class<? extends MigrationStep> stepClass = step.getStepClass(); + if (!classes.contains(stepClass)) { + add(stepClass); + classes.add(stepClass); } - }; - return new DefaultPicoContainer(new OptInCaching(), lifecycleStrategy, parent.getPicoContainer(), new NullComponentMonitor()); + }); } @Override diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImpl.java index 0b9469d1085..22a92d3c059 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImpl.java @@ -32,37 +32,26 @@ import org.sonar.server.platform.db.migration.version.DbVersion; * Responsible for: * <ul> * <li>adding all the {@link MigrationStep} classes to the container after building it</li> - * <li>adding dependencies for them to the container if there aren't already available in parent container - * (see {@link DbVersion#getSupportComponents()})</li> * <li>adding the {@link MigrationStepsExecutorImpl} to the container</li> * </ul> */ public class MigrationContainerPopulatorImpl implements MigrationContainerPopulator { - private final DbVersion[] dbVersions; private final Class<? extends MigrationStepsExecutor> executorType; - public MigrationContainerPopulatorImpl(DbVersion... dbVersions) { - this(MigrationStepsExecutorImpl.class, dbVersions); + public MigrationContainerPopulatorImpl() { + this(MigrationStepsExecutorImpl.class); } - protected MigrationContainerPopulatorImpl(Class<? extends MigrationStepsExecutor> executorType, DbVersion... dbVersions) { - this.dbVersions = dbVersions; + protected MigrationContainerPopulatorImpl(Class<? extends MigrationStepsExecutor> executorType) { this.executorType = executorType; } @Override public void populateContainer(MigrationContainer container) { container.add(executorType); - populateFromDbVersion(container); populateFromMigrationSteps(container); } - private void populateFromDbVersion(MigrationContainer container) { - Arrays.stream(dbVersions) - .flatMap(DbVersion::getSupportComponents) - .forEach(container::add); - } - private static void populateFromMigrationSteps(MigrationContainer container) { MigrationSteps migrationSteps = container.getComponentByType(MigrationSteps.class); Set<Class<? extends MigrationStep>> classes = new HashSet<>(); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImpl.java index b4cb6d18e1d..0ceee8817f2 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImpl.java @@ -23,35 +23,33 @@ import java.util.List; import java.util.Optional; import org.sonar.api.config.Configuration; import org.sonar.api.utils.AnnotationUtils; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.SpringComponentContainer; import org.sonar.process.ProcessProperties; import org.sonar.server.platform.db.migration.SupportsBlueGreen; import org.sonar.server.platform.db.migration.history.MigrationHistory; import org.sonar.server.platform.db.migration.step.MigrationSteps; import org.sonar.server.platform.db.migration.step.MigrationStepsExecutor; +import org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl; import org.sonar.server.platform.db.migration.step.RegisteredMigrationStep; import static java.lang.String.format; public class MigrationEngineImpl implements MigrationEngine { private final MigrationHistory migrationHistory; - private final ComponentContainer serverContainer; - private final MigrationContainerPopulator populator; + private final SpringComponentContainer serverContainer; private final MigrationSteps migrationSteps; private final Configuration configuration; - public MigrationEngineImpl(MigrationHistory migrationHistory, ComponentContainer serverContainer, - MigrationContainerPopulator populator, MigrationSteps migrationSteps, Configuration configuration) { + public MigrationEngineImpl(MigrationHistory migrationHistory, SpringComponentContainer serverContainer, MigrationSteps migrationSteps, Configuration configuration) { this.migrationHistory = migrationHistory; this.serverContainer = serverContainer; - this.populator = populator; this.migrationSteps = migrationSteps; this.configuration = configuration; } @Override public void execute() { - MigrationContainer migrationContainer = new MigrationContainerImpl(serverContainer, populator); + MigrationContainer migrationContainer = new MigrationContainerImpl(serverContainer, MigrationStepsExecutorImpl.class); boolean blueGreen = configuration.getBoolean(ProcessProperties.Property.BLUE_GREEN_ENABLED.getKey()).orElse(false); try { MigrationStepsExecutor stepsExecutor = migrationContainer.getComponentByType(MigrationStepsExecutor.class); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java index 8aca6291592..e8ab9e4bc25 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java @@ -22,8 +22,8 @@ package org.sonar.server.platform.db.migration.step; import java.util.List; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; +import org.sonar.core.platform.Container; import org.sonar.core.util.logs.Profiler; -import org.sonar.server.platform.db.migration.engine.MigrationContainer; import org.sonar.server.platform.db.migration.history.MigrationHistory; import static com.google.common.base.Preconditions.checkState; @@ -35,10 +35,10 @@ public class MigrationStepsExecutorImpl implements MigrationStepsExecutor { private static final String STEP_START_PATTERN = "{}..."; private static final String STEP_STOP_PATTERN = "{}: {}"; - private final MigrationContainer migrationContainer; + private final Container migrationContainer; private final MigrationHistory migrationHistory; - public MigrationStepsExecutorImpl(MigrationContainer migrationContainer, MigrationHistory migrationHistory) { + public MigrationStepsExecutorImpl(Container migrationContainer, MigrationHistory migrationHistory) { this.migrationContainer = migrationContainer; this.migrationHistory = migrationHistory; } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsProvider.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsProvider.java index ab10e8b1cb9..d5213656d28 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsProvider.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsProvider.java @@ -20,24 +20,16 @@ package org.sonar.server.platform.db.migration.step; import java.util.Arrays; -import org.picocontainer.injectors.ProviderAdapter; import org.sonar.server.platform.db.migration.version.DbVersion; +import org.springframework.context.annotation.Bean; /** * This class is responsible for providing the {@link MigrationSteps} to be injected in classes that need it and * ensures that there's only one such instance. */ -public class MigrationStepsProvider extends ProviderAdapter { - private MigrationSteps migrationSteps; - +public class MigrationStepsProvider { + @Bean("MigrationSteps") public MigrationSteps provide(InternalMigrationStepRegistry migrationStepRegistry, DbVersion... dbVersions) { - if (migrationSteps == null) { - migrationSteps = buildMigrationSteps(migrationStepRegistry, dbVersions); - } - return migrationSteps; - } - - private static MigrationSteps buildMigrationSteps(InternalMigrationStepRegistry migrationStepRegistry, DbVersion[] dbVersions) { Arrays.stream(dbVersions).forEach(dbVersion -> dbVersion.addSteps(migrationStepRegistry)); return migrationStepRegistry.build(); } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DbVersion.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DbVersion.java index 2d831fc1b35..e3be1104258 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DbVersion.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DbVersion.java @@ -19,21 +19,8 @@ */ package org.sonar.server.platform.db.migration.version; -import java.util.stream.Stream; import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; public interface DbVersion { - /** - * Components (if any) supporting the {@link org.sonar.server.platform.db.migration.step.MigrationStep} classes - * added to the registry in {@link #addSteps(MigrationStepRegistry)}. - * <p> - * These components will be added to the {@link org.sonar.server.platform.db.migration.engine.MigrationContainer} in - * which the {@link org.sonar.server.platform.db.migration.step.MigrationStep} classes will be instantiated and run. - * </p> - */ - default Stream<Object> getSupportComponents() { - return Stream.empty(); - } - void addSteps(MigrationStepRegistry registry); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java index 0e4814f45f2..711fc3fc0a2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java @@ -20,7 +20,7 @@ package org.sonar.server.platform.db.migration; import org.junit.Test; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.ListContainer; import static org.assertj.core.api.Assertions.assertThat; @@ -29,11 +29,11 @@ public class MigrationConfigurationModuleTest { @Test public void verify_component_count() { - ComponentContainer container = new ComponentContainer(); + ListContainer container = new ListContainer(); underTest.configure(container); - assertThat(container.getPicoContainer().getComponentAdapters()).isNotEmpty(); + assertThat(container.getAddedObjects()).isNotEmpty(); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationEngineModuleTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationEngineModuleTest.java index 274db07c793..d04ce11ed72 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationEngineModuleTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationEngineModuleTest.java @@ -20,21 +20,19 @@ package org.sonar.server.platform.db.migration; import org.junit.Test; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.ListContainer; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER; public class MigrationEngineModuleTest { private MigrationEngineModule underTest = new MigrationEngineModule(); @Test public void verify_component_count() { - ComponentContainer container = new ComponentContainer(); + ListContainer container = new ListContainer(); underTest.configure(container); - assertThat(container.getPicoContainer().getComponentAdapters()) - .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2); + assertThat(container.getAddedObjects()).hasSize(2); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java index 1e3a9dd4509..f0534766f3c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java @@ -19,31 +19,48 @@ */ package org.sonar.server.platform.db.migration.engine; +import java.sql.SQLException; +import java.util.List; +import org.junit.Before; import org.junit.Test; -import org.picocontainer.Startable; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.api.Startable; +import org.sonar.core.platform.SpringComponentContainer; +import org.sonar.server.platform.db.migration.step.InternalMigrationStepRegistry; +import org.sonar.server.platform.db.migration.step.MigrationStep; +import org.sonar.server.platform.db.migration.step.MigrationStepRegistryImpl; +import org.sonar.server.platform.db.migration.step.MigrationStepsExecutor; +import org.sonar.server.platform.db.migration.step.RegisteredMigrationStep; import static org.assertj.core.api.Assertions.assertThat; public class MigrationContainerImplTest { - private ComponentContainer parent = new ComponentContainer(); - private MigrationContainerPopulator populator = container -> container.add(StartCallCounter.class); - - private MigrationContainerImpl underTest = new MigrationContainerImpl(parent, populator); + private final SpringComponentContainer parent = new SpringComponentContainer(); + private MigrationContainerImpl underTest; + + @Before + public void setUp() { + InternalMigrationStepRegistry registry = new MigrationStepRegistryImpl(); + registry.add(1, "test", NoOpMigrationStep.class); + + parent.add(registry.build()); + parent.startComponents(); + underTest = new MigrationContainerImpl(parent, NoOpExecutor.class); + underTest.add(StartCallCounter.class); + } @Test - public void pico_container_of_migration_container_has_pico_container_of_specified_container_as_parent() { - assertThat(underTest.getPicoContainer().getParent()).isEqualTo(parent.getPicoContainer()); + public void adds_migration_steps_to_migration_container() { + assertThat(underTest.getComponentByType(MigrationStep.class)).isInstanceOf(NoOpMigrationStep.class); } @Test - public void pico_container_of_parent_does_not_have_pico_container_of_migration_container_as_child() { - assertThat(parent.getPicoContainer().removeChildContainer(underTest.getPicoContainer())).isFalse(); + public void context_of_migration_container_has_specified_context_as_parent() { + assertThat(underTest.context().getParent()).isEqualTo(parent.context()); } @Test - public void pico_container_of_migration_container_is_started_in_constructor() { - assertThat(underTest.getPicoContainer().getLifecycleState().isStarted()).isTrue(); + public void context_of_migration_container_is_started_in_constructor() { + assertThat(underTest.context().isActive()).isTrue(); } @Test @@ -58,11 +75,26 @@ public class MigrationContainerImplTest { @Test public void cleanup_does_not_fail_even_if_stop_of_component_fails() { - MigrationContainerImpl underTest = new MigrationContainerImpl(parent, (container -> container.add(StopFailing.class))); + parent.add(StopFailing.class); + MigrationContainerImpl underTest = new MigrationContainerImpl(parent, NoOpExecutor.class); underTest.cleanup(); } + private static class NoOpExecutor implements MigrationStepsExecutor { + @Override + public void execute(List<RegisteredMigrationStep> steps) { + + } + } + + private static class NoOpMigrationStep implements MigrationStep { + @Override + public void execute() throws SQLException { + + } + } + public static final class StartCallCounter implements Startable { private static int startCalls = 0; diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java index fb937d4c77f..2ce177c874e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java @@ -19,16 +19,13 @@ */ package org.sonar.server.platform.db.migration.engine; -import java.util.stream.Stream; import org.junit.Before; import org.junit.Test; import org.sonar.server.platform.db.migration.history.MigrationHistory; import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; import org.sonar.server.platform.db.migration.step.MigrationSteps; import org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl; import org.sonar.server.platform.db.migration.step.RegisteredMigrationStep; -import org.sonar.server.platform.db.migration.version.DbVersion; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; @@ -37,9 +34,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class MigrationContainerPopulatorImplTest { - private MigrationContainer migrationContainer = new SimpleMigrationContainer(); - private MigrationSteps migrationSteps = mock(MigrationSteps.class); - private MigrationContainerPopulatorImpl underTest = new MigrationContainerPopulatorImpl(); + private final SimpleMigrationContainer migrationContainer = new SimpleMigrationContainer(); + private final MigrationSteps migrationSteps = mock(MigrationSteps.class); + private final MigrationContainerPopulatorImpl underTest = new MigrationContainerPopulatorImpl(); @Before public void setUp() { @@ -47,37 +44,13 @@ public class MigrationContainerPopulatorImplTest { } @Test - public void populateContainer_adds_components_of_DbVersion_getSupportComponents() { - MigrationContainerPopulatorImpl underTest = new MigrationContainerPopulatorImpl( - new NoRegistryDbVersion() { - @Override - public Stream<Object> getSupportComponents() { - return Stream.of(Clazz2.class); - } - }, - new NoRegistryDbVersion(), - new NoRegistryDbVersion() { - @Override - public Stream<Object> getSupportComponents() { - return Stream.of(Clazz1.class, Clazz3.class); - } - }); - when(migrationSteps.readAll()).thenReturn(emptyList()); - - underTest.populateContainer(migrationContainer); - - assertThat(migrationContainer.getComponentsByType(Clazz1.class)).isNotNull(); - assertThat(migrationContainer.getComponentsByType(Clazz2.class)).isNotNull(); - assertThat(migrationContainer.getComponentsByType(Clazz3.class)).isNotNull(); - } - - @Test public void populateContainer_adds_MigrationStepsExecutorImpl() { when(migrationSteps.readAll()).thenReturn(emptyList()); // add MigrationStepsExecutorImpl's dependencies migrationContainer.add(mock(MigrationHistory.class)); + migrationContainer.startComponents(); underTest.populateContainer(migrationContainer); assertThat(migrationContainer.getComponentByType(MigrationStepsExecutorImpl.class)).isNotNull(); @@ -90,6 +63,7 @@ public class MigrationContainerPopulatorImplTest { new RegisteredMigrationStep(2, "bar", MigrationStep2.class), new RegisteredMigrationStep(3, "dor", MigrationStep3.class))); + migrationContainer.startComponents(); underTest.populateContainer(migrationContainer); assertThat(migrationContainer.getComponentsByType(MigrationStep1.class)).isNotNull(); @@ -106,6 +80,7 @@ public class MigrationContainerPopulatorImplTest { new RegisteredMigrationStep(4, "foo2", MigrationStep1.class), new RegisteredMigrationStep(5, "dor", MigrationStep3.class))); + migrationContainer.startComponents(); underTest.populateContainer(migrationContainer); assertThat(migrationContainer.getComponentsByType(MigrationStep1.class)).isNotNull(); @@ -143,16 +118,4 @@ public class MigrationContainerPopulatorImplTest { public static final class Clazz3 { } - - /** - * An implementation of DbVersion to be passed to {@link MigrationContainerPopulatorImpl}'s constructor which is - * not supposed to call the {@link DbVersion#addSteps(MigrationStepRegistry)} method and therefor has an - * implementation that throws a {@link UnsupportedOperationException} when called. - */ - private static class NoRegistryDbVersion implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - throw new UnsupportedOperationException("addSteps is not supposed to be called"); - } - } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java index 0506326ca7d..f0b31e5c9aa 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java @@ -19,12 +19,14 @@ */ package org.sonar.server.platform.db.migration.engine; +import java.sql.SQLException; import java.util.List; import java.util.Optional; +import org.junit.Before; import org.junit.Test; import org.sonar.api.config.internal.ConfigurationBridge; import org.sonar.api.config.internal.MapSettings; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.SpringComponentContainer; import org.sonar.process.ProcessProperties; import org.sonar.server.platform.db.migration.SupportsBlueGreen; import org.sonar.server.platform.db.migration.history.MigrationHistory; @@ -38,42 +40,50 @@ import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class MigrationEngineImplTest { - private MigrationHistory migrationHistory = mock(MigrationHistory.class); - private ComponentContainer serverContainer = new ComponentContainer(); - private MigrationStepsExecutor stepsExecutor = mock(MigrationStepsExecutor.class); - private MigrationContainerPopulator populator = container -> container.add(stepsExecutor); - private MigrationSteps migrationSteps = mock(MigrationSteps.class); - - private MapSettings settings = new MapSettings(); - private MigrationEngineImpl underTest = new MigrationEngineImpl(migrationHistory, serverContainer, populator, migrationSteps, new ConfigurationBridge(settings)); + private final MigrationHistory migrationHistory = mock(MigrationHistory.class); + private final SpringComponentContainer serverContainer = new SpringComponentContainer(); + private final MigrationSteps migrationSteps = mock(MigrationSteps.class); + private final StepRegistry stepRegistry = new StepRegistry(); + private final MapSettings settings = new MapSettings(); + private final MigrationEngineImpl underTest = new MigrationEngineImpl(migrationHistory, serverContainer, migrationSteps, new ConfigurationBridge(settings)); + + @Before + public void before() { + serverContainer.add(migrationSteps); + serverContainer.add(migrationHistory); + serverContainer.add(stepRegistry); + serverContainer.startComponents(); + } @Test public void execute_execute_all_steps_of_there_is_no_last_migration_number() { when(migrationHistory.getLastMigrationNumber()).thenReturn(Optional.empty()); - List<RegisteredMigrationStep> steps = singletonList(new RegisteredMigrationStep(1, "doo", MigrationStep.class)); + List<RegisteredMigrationStep> steps = singletonList(new RegisteredMigrationStep(1, "doo", TestMigrationStep.class)); when(migrationSteps.readAll()).thenReturn(steps); underTest.execute(); - verify(migrationSteps).readAll(); - verify(stepsExecutor).execute(steps); + verify(migrationSteps, times(2)).readAll(); + assertThat(stepRegistry.stepRan).isTrue(); } @Test public void execute_execute_steps_from_last_migration_number_plus_1() { when(migrationHistory.getLastMigrationNumber()).thenReturn(Optional.of(50L)); - List<RegisteredMigrationStep> steps = singletonList(new RegisteredMigrationStep(1, "doo", MigrationStep.class)); + List<RegisteredMigrationStep> steps = singletonList(new RegisteredMigrationStep(1, "doo", TestMigrationStep.class)); when(migrationSteps.readFrom(51)).thenReturn(steps); + when(migrationSteps.readAll()).thenReturn(steps); underTest.execute(); verify(migrationSteps).readFrom(51); - verify(stepsExecutor).execute(steps); + assertThat(stepRegistry.stepRan).isTrue(); } @Test @@ -82,11 +92,12 @@ public class MigrationEngineImplTest { when(migrationHistory.getLastMigrationNumber()).thenReturn(Optional.of(50L)); List<RegisteredMigrationStep> steps = singletonList(new RegisteredMigrationStep(1, "doo", TestBlueGreenMigrationStep.class)); when(migrationSteps.readFrom(51)).thenReturn(steps); + when(migrationSteps.readAll()).thenReturn(steps); underTest.execute(); verify(migrationSteps).readFrom(51); - verify(stepsExecutor).execute(steps); + assertThat(stepRegistry.stepRan).isTrue(); } @Test @@ -95,7 +106,7 @@ public class MigrationEngineImplTest { when(migrationHistory.getLastMigrationNumber()).thenReturn(Optional.of(50L)); List<RegisteredMigrationStep> steps = asList( new RegisteredMigrationStep(1, "foo", TestBlueGreenMigrationStep.class), - new RegisteredMigrationStep(2, "bar", MigrationStep.class)); + new RegisteredMigrationStep(2, "bar", TestMigrationStep.class)); when(migrationSteps.readFrom(51)).thenReturn(steps); try { @@ -103,16 +114,43 @@ public class MigrationEngineImplTest { fail(); } catch (IllegalStateException e) { assertThat(e).hasMessage("All migrations canceled. #2 does not support blue/green deployment: bar"); - verifyZeroInteractions(stepsExecutor); + assertThat(stepRegistry.stepRan).isFalse(); + } + } + + private static class NoOpExecutor implements MigrationStepsExecutor { + @Override + public void execute(List<RegisteredMigrationStep> steps) { + // no op + } + } + + private static class StepRegistry { + boolean stepRan = false; + } + + private static class TestMigrationStep implements MigrationStep { + private final StepRegistry registry; + + public TestMigrationStep(StepRegistry registry) { + this.registry = registry; + } + @Override + public void execute() throws SQLException { + registry.stepRan = true; } } @SupportsBlueGreen private static class TestBlueGreenMigrationStep implements MigrationStep { + private final StepRegistry registry; + public TestBlueGreenMigrationStep(StepRegistry registry) { + this.registry = registry; + } @Override - public void execute() { - + public void execute() throws SQLException { + registry.stepRan = true; } } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/SimpleMigrationContainer.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/SimpleMigrationContainer.java index cf7a049ef45..3fc3bb69a9c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/SimpleMigrationContainer.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/SimpleMigrationContainer.java @@ -19,9 +19,9 @@ */ package org.sonar.server.platform.db.migration.engine; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.SpringComponentContainer; -public final class SimpleMigrationContainer extends ComponentContainer implements MigrationContainer { +public final class SimpleMigrationContainer extends SpringComponentContainer implements MigrationContainer { @Override public void cleanup() { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java index c4f61331303..cdd6cf86ac9 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java @@ -29,6 +29,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; +import org.sonar.core.platform.SpringComponentContainer; import org.sonar.server.platform.db.migration.engine.MigrationContainer; import org.sonar.server.platform.db.migration.engine.SimpleMigrationContainer; import org.sonar.server.platform.db.migration.history.MigrationHistory; @@ -59,11 +60,12 @@ public class MigrationStepsExecutorImplTest { public void execute_fails_with_ISE_if_no_instance_of_computation_step_exist_in_container() { List<RegisteredMigrationStep> steps = asList(registeredStepOf(1, MigrationStep1.class)); + ((SpringComponentContainer) migrationContainer).startComponents(); try { underTest.execute(steps); fail("execute should have thrown a IllegalStateException"); } catch (IllegalStateException e) { - assertThat(e).hasMessage("Can not find instance of " + MigrationStep1.class); + assertThat(e).hasMessage("Unable to load component " + MigrationStep1.class); } finally { assertThat(logTester.logs()).hasSize(2); assertLogLevel(LoggerLevel.INFO, "Executing DB migrations..."); @@ -87,6 +89,7 @@ public class MigrationStepsExecutorImplTest { @Test public void execute_execute_the_instance_of_type_specified_in_step_in_stream_order() { migrationContainer.add(MigrationStep1.class, MigrationStep2.class, MigrationStep3.class); + ((SpringComponentContainer) migrationContainer).startComponents(); underTest.execute(asList( registeredStepOf(1, MigrationStep2.class), @@ -119,6 +122,7 @@ public class MigrationStepsExecutorImplTest { registeredStepOf(2, SqlExceptionFailingMigrationStep.class), registeredStepOf(3, MigrationStep3.class)); + ((SpringComponentContainer) migrationContainer).startComponents(); try { underTest.execute(steps); fail("a MigrationStepExecutionException should have been thrown"); @@ -147,6 +151,7 @@ public class MigrationStepsExecutorImplTest { registeredStepOf(2, RuntimeExceptionFailingMigrationStep.class), registeredStepOf(3, MigrationStep3.class)); + ((SpringComponentContainer) migrationContainer).startComponents(); try { underTest.execute(steps); fail("should throw MigrationStepExecutionException"); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsProviderTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsProviderTest.java index 40bc5fb99b5..2f58a1dfa54 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsProviderTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsProviderTest.java @@ -19,7 +19,6 @@ */ package org.sonar.server.platform.db.migration.step; -import java.util.Random; import org.junit.Test; import org.mockito.InOrder; import org.sonar.server.platform.db.migration.version.DbVersion; @@ -30,13 +29,12 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; public class MigrationStepsProviderTest { - private InternalMigrationStepRegistry internalMigrationStepRegistry = mock(InternalMigrationStepRegistry.class); - private MigrationStepsProvider underTest = new MigrationStepsProvider(); + private final InternalMigrationStepRegistry internalMigrationStepRegistry = mock(InternalMigrationStepRegistry.class); + private final MigrationStepsProvider underTest = new MigrationStepsProvider(); @Test public void provide_throws_ISE_with_registry_build_throws_ISE_because_it_is_empty() { @@ -49,7 +47,7 @@ public class MigrationStepsProviderTest { } @Test - public void provide_calls_DbVersion_addStep_in_order_and_only_once() { + public void provide_calls_DbVersion_addStep_in_order() { DbVersion dbVersion1 = newMockFailingOnSecondBuildCall(); DbVersion dbVersion2 = newMockFailingOnSecondBuildCall(); DbVersion dbVersion3 = newMockFailingOnSecondBuildCall(); @@ -64,24 +62,6 @@ public class MigrationStepsProviderTest { inOrder.verify(dbVersion2).addSteps(internalMigrationStepRegistry); inOrder.verify(dbVersion3).addSteps(internalMigrationStepRegistry); inOrder.verifyNoMoreInteractions(); - - // calling a second time with another argument, it's just ignored - DbVersion dbVersion4 = newMockFailingOnSecondBuildCall(); - assertThat(underTest.provide(internalMigrationStepRegistry, dbVersion4)).isSameAs(expected); - verifyZeroInteractions(dbVersion4); - } - - @Test - public void provide_always_returns_the_same_MigrationSteps_instance_and_calls_registry_build_only_once() { - MigrationSteps migrationSteps = mock(MigrationSteps.class); - when(internalMigrationStepRegistry.build()) - .thenReturn(migrationSteps) - .thenThrow(new RuntimeException("method build should not be called twice")); - - for (int i = 0; i < Math.abs(new Random().nextInt(50)) + 1; i++) { - assertThat(underTest.provide(internalMigrationStepRegistry)).isSameAs(migrationSteps); - } - } private static DbVersion newMockFailingOnSecondBuildCall() { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/DbVersion00Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/DbVersion00Test.java index d4941aa97c1..92a05b1c213 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/DbVersion00Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/DbVersion00Test.java @@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v00; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; @@ -29,11 +28,6 @@ public class DbVersion00Test { private DbVersion00 underTest = new DbVersion00(); @Test - public void verify_no_support_component() { - assertThat(underTest.getSupportComponents()).isEmpty(); - } - - @Test public void migrationNumber_starts_at_1153() { verifyMinimumMigrationNumber(underTest, 1); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java index b9c1960fa6b..6549102afc9 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java @@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v90; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; @@ -30,11 +29,6 @@ public class DbVersion90Test { private final DbVersion90 underTest = new DbVersion90(); @Test - public void verify_no_support_component() { - assertThat(underTest.getSupportComponents()).isEmpty(); - } - - @Test public void migrationNumber_starts_at_5001() { verifyMinimumMigrationNumber(underTest, 5001); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91Test.java index 3b118ed75bd..d8650e4bb11 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91Test.java @@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v91; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; @@ -30,11 +29,6 @@ public class DbVersion91Test { private final DbVersion91 underTest = new DbVersion91(); @Test - public void verify_no_support_component() { - assertThat(underTest.getSupportComponents()).isEmpty(); - } - - @Test public void migrationNumber_starts_at_6001() { verifyMinimumMigrationNumber(underTest, 6001); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v92/DbVersion92Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v92/DbVersion92Test.java index 6df422e23e9..bf036b4622c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v92/DbVersion92Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v92/DbVersion92Test.java @@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v92; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; @@ -30,11 +29,6 @@ public class DbVersion92Test { private final DbVersion92 underTest = new DbVersion92(); @Test - public void verify_no_support_component() { - assertThat(underTest.getSupportComponents()).isEmpty(); - } - - @Test public void migrationNumber_starts_at_6101() { verifyMinimumMigrationNumber(underTest, 6101); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v93/DbVersion93Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v93/DbVersion93Test.java index d4479465020..12934c1456f 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v93/DbVersion93Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v93/DbVersion93Test.java @@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v93; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; @@ -30,11 +29,6 @@ public class DbVersion93Test { private final DbVersion93 underTest = new DbVersion93(); @Test - public void verify_no_support_component() { - assertThat(underTest.getSupportComponents()).isEmpty(); - } - - @Test public void migrationNumber_starts_at_6101() { verifyMinimumMigrationNumber(underTest, 6201); } |