aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2021-07-02 16:26:35 +0200
committersonartech <sonartech@sonarsource.com>2021-07-07 20:03:25 +0000
commit130b050813c91466815252a929fe2e29879da9f3 (patch)
tree94d73c226f32d14355b6f5a69938d731b6671dc0 /sonar-scanner-engine/src
parenta5fc8a2122a569dc2305b10594d672df2a25a548 (diff)
downloadsonarqube-130b050813c91466815252a929fe2e29879da9f3.tar.gz
sonarqube-130b050813c91466815252a929fe2e29879da9f3.zip
SONAR-10762 Drop usage of 'user_managed' column
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoaderTest.java16
2 files changed, 8 insertions, 16 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java
index ab2f66462ea..02ce013acaf 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java
@@ -31,7 +31,7 @@ import org.sonarqube.ws.client.GetRequest;
public class DefaultMetricsRepositoryLoader implements MetricsRepositoryLoader {
- private static final String METRICS_SEARCH_URL = "/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=";
+ private static final String METRICS_SEARCH_URL = "/api/metrics/search?ps=500&p=";
private DefaultScannerWsClient wsClient;
public DefaultMetricsRepositoryLoader(DefaultScannerWsClient wsClient) {
@@ -61,7 +61,7 @@ public class DefaultMetricsRepositoryLoader implements MetricsRepositoryLoader {
.create()
.setDirection(metric.getDirection())
.setQualitative(metric.isQualitative())
- .setUserManaged(metric.isCustom())
+ .setUserManaged(false)
.setDescription(metric.getDescription())
.setUuid(metric.getUuid()));
}
@@ -78,7 +78,6 @@ public class DefaultMetricsRepositoryLoader implements MetricsRepositoryLoader {
private String description;
private int direction;
private boolean qualitative;
- private boolean custom;
public String getUuid() {
return uuid;
@@ -108,9 +107,6 @@ public class DefaultMetricsRepositoryLoader implements MetricsRepositoryLoader {
return qualitative;
}
- public boolean isCustom() {
- return custom;
- }
}
private static class WsMetricsResponse {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoaderTest.java
index c1669b025b3..90bc8c6bc8e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoaderTest.java
@@ -24,13 +24,12 @@ import java.io.Reader;
import java.io.StringReader;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.sonar.scanner.WsTestUtil;
import org.sonar.scanner.bootstrap.DefaultScannerWsClient;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doThrow;
@@ -39,13 +38,10 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
public class DefaultMetricsRepositoryLoaderTest {
- private static final String WS_URL = "/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=";
+ private static final String WS_URL = "/api/metrics/search?ps=500&p=";
private DefaultScannerWsClient wsClient;
private DefaultMetricsRepositoryLoader metricsRepositoryLoader;
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
@Before
public void setUp() throws IOException {
wsClient = mock(DefaultScannerWsClient.class);
@@ -68,8 +64,8 @@ public class DefaultMetricsRepositoryLoaderTest {
Reader reader = mock(Reader.class);
when(reader.read(any(char[].class), anyInt(), anyInt())).thenThrow(new IOException());
WsTestUtil.mockReader(wsClient, reader);
- exception.expect(IllegalStateException.class);
- metricsRepositoryLoader.load();
+ assertThatThrownBy(() -> metricsRepositoryLoader.load())
+ .isInstanceOf(IllegalStateException.class);
}
@Test
@@ -78,7 +74,7 @@ public class DefaultMetricsRepositoryLoaderTest {
when(reader.read(any(char[].class), anyInt(), anyInt())).thenReturn(-1);
doThrow(new IOException()).when(reader).close();
WsTestUtil.mockReader(wsClient, reader);
- exception.expect(IllegalStateException.class);
- metricsRepositoryLoader.load();
+ assertThatThrownBy(() -> metricsRepositoryLoader.load())
+ .isInstanceOf(IllegalStateException.class);
}
}