]> source.dussan.org Git - sonarqube.git/commitdiff
NO-JIRA fix code smells
authorPierre <pierre.guillot@sonarsource.com>
Wed, 12 Oct 2022 12:32:58 +0000 (14:32 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 12 Oct 2022 20:03:43 +0000 (20:03 +0000)
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepTest.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/package-info.java [new file with mode: 0644]

index b4a880142898acce0793c84601c751cccee4b253..a47f741c33530ac2e8eeb08ced888cdd59b6d77a 100644 (file)
@@ -102,7 +102,8 @@ public class ExtractReportStepTest {
     dbTester.getSession().commit();
     dbTester.getSession().close();
 
-    assertThatThrownBy(() -> underTest.execute(new TestComputationStepContext()))
+    TestComputationStepContext testComputationStepContext = new TestComputationStepContext();
+    assertThatThrownBy(() -> underTest.execute(testComputationStepContext))
       .isInstanceOf(IllegalStateException.class)
       .hasMessage("Decompression failed because unzipped size reached threshold: 4000000000 bytes");
   }
index d6a59d032ff4a56ed9a46d0d85e488a7f2818ae0..4bdc6e5a23825d1723bf0d2e2600f70404730f4d 100644 (file)
@@ -24,7 +24,6 @@ import org.sonar.api.utils.text.JsonWriter;
 import org.sonar.process.systeminfo.SystemInfoUtils;
 import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
 import org.sonar.server.health.Health;
-import org.sonar.server.telemetry.TelemetryDataJsonWriter;
 
 public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
   private static final String[] ORDERED_SECTION_NAMES = {
@@ -36,12 +35,6 @@ public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
     "Compute Engine Tasks", "Compute Engine JVM State", "Compute Engine Database Connection", "Compute Engine Logging", "Compute Engine JVM Properties",
     "Search State", "Search Indexes"};
 
-  private final TelemetryDataJsonWriter dataJsonWriter;
-
-  AbstractSystemInfoWriter(TelemetryDataJsonWriter dataJsonWriter) {
-    this.dataJsonWriter = dataJsonWriter;
-  }
-
   protected void writeSections(Collection<ProtobufSystemInfo.Section> sections, JsonWriter json) {
     SystemInfoUtils
       .order(sections, ORDERED_SECTION_NAMES)
index 71f83793d51dee571967e2484eab85abfa455e0b..4acc73f4890679aa06343a86fe3ac743ac176456 100644 (file)
@@ -27,8 +27,6 @@ import org.sonar.server.platform.monitoring.cluster.AppNodesInfoLoader;
 import org.sonar.server.platform.monitoring.cluster.GlobalInfoLoader;
 import org.sonar.server.platform.monitoring.cluster.NodeInfo;
 import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoader;
-import org.sonar.server.telemetry.TelemetryDataJsonWriter;
-import org.sonar.server.telemetry.TelemetryDataLoader;
 
 public class ClusterSystemInfoWriter extends AbstractSystemInfoWriter {
   private final GlobalInfoLoader globalInfoLoader;
@@ -37,8 +35,7 @@ public class ClusterSystemInfoWriter extends AbstractSystemInfoWriter {
   private final HealthChecker healthChecker;
 
   public ClusterSystemInfoWriter(GlobalInfoLoader globalInfoLoader, AppNodesInfoLoader appNodesInfoLoader, SearchNodesInfoLoader searchNodesInfoLoader,
-    HealthChecker healthChecker, TelemetryDataJsonWriter dataJsonWriter) {
-    super(dataJsonWriter);
+    HealthChecker healthChecker) {
     this.globalInfoLoader = globalInfoLoader;
     this.appNodesInfoLoader = appNodesInfoLoader;
     this.searchNodesInfoLoader = searchNodesInfoLoader;
index 3ae5be33d8a5f445e780b9fe4137e7bd60c5ce80..db6fb7cdd7bd9edf88f23992c9c7cdb857650854 100644 (file)
@@ -27,7 +27,6 @@ import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
 import org.sonar.server.ce.http.CeHttpClient;
 import org.sonar.server.health.Health;
 import org.sonar.server.health.HealthChecker;
-import org.sonar.server.telemetry.TelemetryDataJsonWriter;
 
 import static java.util.Arrays.stream;
 
@@ -36,9 +35,7 @@ public class StandaloneSystemInfoWriter extends AbstractSystemInfoWriter {
   private final HealthChecker healthChecker;
   private final SystemInfoSection[] systemInfoSections;
 
-  public StandaloneSystemInfoWriter(CeHttpClient ceHttpClient, HealthChecker healthChecker,
-    TelemetryDataJsonWriter dataJsonWriter, SystemInfoSection... systemInfoSections) {
-    super(dataJsonWriter);
+  public StandaloneSystemInfoWriter(CeHttpClient ceHttpClient, HealthChecker healthChecker, SystemInfoSection... systemInfoSections) {
     this.ceHttpClient = ceHttpClient;
     this.healthChecker = healthChecker;
     this.systemInfoSections = systemInfoSections;
index 93b09849b45e2b618ba92620f0ddc723b2e3f5f2..f61689bbb793e13e5b061cbcd6380d0f26692356 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.server.platform.monitoring.cluster.AppNodesInfoLoader;
 import org.sonar.server.platform.monitoring.cluster.GlobalInfoLoader;
 import org.sonar.server.platform.monitoring.cluster.NodeInfo;
 import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoader;
-import org.sonar.server.telemetry.TelemetryDataJsonWriter;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -44,9 +43,8 @@ public class ClusterSystemInfoWriterTest {
   private final AppNodesInfoLoader appNodesInfoLoader = mock(AppNodesInfoLoader.class);
   private final SearchNodesInfoLoader searchNodesInfoLoader = mock(SearchNodesInfoLoader.class);
   private final HealthChecker healthChecker = mock(HealthChecker.class);
-  private final TelemetryDataJsonWriter dataJsonWriter = new TelemetryDataJsonWriter();
   private final ClusterSystemInfoWriter underTest = new ClusterSystemInfoWriter(globalInfoLoader, appNodesInfoLoader,
-    searchNodesInfoLoader, healthChecker, dataJsonWriter);
+    searchNodesInfoLoader, healthChecker);
 
   @Before
   public void before() throws InterruptedException {
index f8b400e943b06d4ceeee2b67ac0a88498028493c..91f384d3d1861e7c97ecb712a24003a7ab03ae21 100644 (file)
@@ -30,8 +30,6 @@ import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
 import org.sonar.server.ce.http.CeHttpClient;
 import org.sonar.server.ce.http.CeHttpClientImpl;
 import org.sonar.server.health.TestStandaloneHealthChecker;
-import org.sonar.server.telemetry.TelemetryDataJsonWriter;
-import org.sonar.server.telemetry.TelemetryDataLoader;
 import org.sonar.server.tester.UserSessionRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -49,8 +47,7 @@ public class StandaloneSystemInfoWriterTest {
   private final SystemInfoSection section2 = mock(SystemInfoSection.class);
   private final CeHttpClient ceHttpClient = mock(CeHttpClientImpl.class, Mockito.RETURNS_MOCKS);
   private final TestStandaloneHealthChecker healthChecker = new TestStandaloneHealthChecker();
-  private final TelemetryDataJsonWriter dataJsonWriter = new TelemetryDataJsonWriter();
-  private final StandaloneSystemInfoWriter underTest = new StandaloneSystemInfoWriter(ceHttpClient, healthChecker, dataJsonWriter, section1, section2);
+  private final StandaloneSystemInfoWriter underTest = new StandaloneSystemInfoWriter(ceHttpClient, healthChecker, section1, section2);
 
   @Test
   public void write_json() {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/package-info.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/package-info.java
new file mode 100644 (file)
index 0000000..bc14945
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.saml.ws;
+
+import javax.annotation.ParametersAreNonnullByDefault;