diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2022-06-02 11:27:16 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-02 20:03:18 +0000 |
commit | c0bbac0bced00b12f6fddf6bdcd73510a08ca4e5 (patch) | |
tree | dab1cd9d02294ef9479349ca2e98e79861200529 /server/sonar-ce | |
parent | 1dfb0dffa770b324711e1a95fe814226e1220306 (diff) | |
download | sonarqube-c0bbac0bced00b12f6fddf6bdcd73510a08ca4e5.tar.gz sonarqube-c0bbac0bced00b12f6fddf6bdcd73510a08ca4e5.zip |
SONAR-16292 JMX metric "PendingCount" should return total value of pending tasks instead of 0
Diffstat (limited to 'server/sonar-ce')
3 files changed, 4 insertions, 91 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index 1385558c175..ff9eea4f9f0 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -52,7 +52,6 @@ import org.sonar.ce.db.ReadOnlyPropertiesDao; import org.sonar.ce.issue.index.NoAsyncIssueIndexing; import org.sonar.ce.logging.CeProcessLogging; import org.sonar.ce.monitoring.CEQueueStatusImpl; -import org.sonar.ce.monitoring.DistributedCEQueueStatusImpl; import org.sonar.ce.platform.CECoreExtensionsInstaller; import org.sonar.ce.platform.ComputeEngineExtensionInstaller; import org.sonar.ce.platform.DatabaseCompatibility; @@ -422,6 +421,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { // System ServerLogging.class, + CEQueueStatusImpl.class, // SonarSource editions PlatformEditionProvider.class, @@ -456,8 +456,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { // no cleaning job on sonarcloud and no distributed information container.add( NoopCeCleaningSchedulerImpl.class, - StandaloneCeDistributedInformation.class, - CEQueueStatusImpl.class); + StandaloneCeDistributedInformation.class); } else if (props.valueAsBoolean(CLUSTER_ENABLED.getKey())) { container.add( new CeCleaningModule(), @@ -467,14 +466,11 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { // system info DbSection.class, - ProcessInfoProvider.class, - - DistributedCEQueueStatusImpl.class); + ProcessInfoProvider.class); } else { container.add( new CeCleaningModule(), - StandaloneCeDistributedInformation.class, - CEQueueStatusImpl.class); + StandaloneCeDistributedInformation.class); } } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImpl.java deleted file mode 100644 index 1caab5cb937..00000000000 --- a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.ce.monitoring; - -import org.sonar.api.utils.System2; -import org.sonar.db.DbClient; - -public class DistributedCEQueueStatusImpl extends CEQueueStatusImpl { - public DistributedCEQueueStatusImpl(DbClient dbClient, System2 system2) { - super(dbClient, system2); - } - - @Override - public long getPendingCount() { - return 0; - } -} diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java deleted file mode 100644 index c6e1c68f238..00000000000 --- a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/DistributedCEQueueStatusImplTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.ce.monitoring; - -import org.junit.Test; -import org.mockito.Mockito; -import org.sonar.api.utils.System2; -import org.sonar.db.DbClient; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyNoInteractions; - -public class DistributedCEQueueStatusImplTest extends CommonCEQueueStatusImplTest { - private DistributedCEQueueStatusImpl underTest = new DistributedCEQueueStatusImpl(getDbClient(), mock(System2.class)); - - public DistributedCEQueueStatusImplTest() { - super(mock(DbClient.class, Mockito.RETURNS_DEEP_STUBS)); - } - - @Override - protected CEQueueStatusImpl getUnderTest() { - return underTest; - } - - @Test - public void getPendingCount_returns_0_without_querying_database() { - assertThat(underTest.getPendingCount()).isZero(); - - verifyNoInteractions(getDbClient()); - } -} |