From e794bc3ebebe2c4307dcbdc3c1ab62e24e154577 Mon Sep 17 00:00:00 2001 From: Pierre Guillot Date: Tue, 11 Feb 2020 13:17:56 +0100 Subject: [PATCH] simplify test_real_start --- .../ComputeEngineContainerImplTest.java | 42 +++---------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index 4a62219ab11..62ffbd23e55 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -61,8 +61,6 @@ import static org.sonar.process.ProcessProperties.Property.PATH_HOME; import static org.sonar.process.ProcessProperties.Property.PATH_TEMP; public class ComputeEngineContainerImplTest { - private static final int CONTAINER_ITSELF = 1; - private static final int COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION = CONTAINER_ITSELF + 1; @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); @@ -95,44 +93,14 @@ public class ComputeEngineContainerImplTest { insertProperty(CoreProperties.SERVER_STARTTIME, DateUtils.formatDateTime(new Date())); insertInternalProperty(InternalProperties.SERVER_ID_CHECKSUM, DigestUtils.sha256Hex("a_server_id|" + cleanJdbcUrl())); - underTest - .start(new Props(properties)); + underTest.start(new Props(properties)); MutablePicoContainer picoContainer = underTest.getComponentContainer().getPicoContainer(); try { - assertThat(picoContainer.getComponentAdapters()) - .hasSize( - CONTAINER_ITSELF - + 63 // level 4 - + 7 // content of IssuesChangesNotificationModule - + 6 // content of CeConfigurationModule - + 4 // content of CeQueueModule - + 3 // content of CeHttpModule - + 3 // content of CeTaskCommonsModule - + 4 // content of ProjectAnalysisTaskModule - + 9 // content of CeTaskProcessorModule - + 3 // content of ReportAnalysisFailureNotificationModule - + 3 // CeCleaningModule + its content - + 4 // WebhookModule - + 1 // CeDistributedInformation - ); - assertThat(picoContainer.getParent().getComponentAdapters()).hasSize( - CONTAINER_ITSELF - + 8 // level 3 - ); - assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize( - CONTAINER_ITSELF - + 7 // MigrationConfigurationModule - + 16 // level 2 - ); - assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( - COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION - + 27 // level 1 - + 66 // content of DaoModule - + 3 // content of EsModule - + 50 // content of CorePropertyDefinitions - + 1 // StopFlagContainer - ); + assertThat(picoContainer.getComponentAdapters()).hasSizeGreaterThan(1); + assertThat(picoContainer.getParent().getComponentAdapters()).hasSizeGreaterThan(1); + assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSizeGreaterThan(1); + assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSizeGreaterThan(1); assertThat( picoContainer.getComponentAdapters().stream() .map(ComponentAdapter::getComponentImplementation) -- 2.39.5