diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2021-02-24 14:11:53 -0600 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-03-04 20:12:48 +0000 |
commit | d59b2466752eed8e91f178a346b5da9b86e80d3e (patch) | |
tree | 2f725778426c084430191b18d7eea0644aa27864 /server/sonar-webserver-core | |
parent | 41d439e69840c3ddb13b321399f9047536f6a006 (diff) | |
download | sonarqube-d59b2466752eed8e91f178a346b5da9b86e80d3e.tar.gz sonarqube-d59b2466752eed8e91f178a346b5da9b86e80d3e.zip |
SONAR-13515 Telemetry - include external authentication providers
Diffstat (limited to 'server/sonar-webserver-core')
5 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java index c0c518b4e33..266a6db942a 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java @@ -136,6 +136,8 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader { }); data.setAlmIntegrationCountByAlm(countAlmUsage(dbSession)); + data.setExternalAuthenticationProviders(dbClient.userDao().selectExternalIdentityProviders(dbSession)); + } setSecurityCustomConfigIfPresent(data); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java index fe3cb49a125..f3096ecfe32 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java @@ -74,7 +74,7 @@ public class ClusterSystemInfoWriterTest { + "\"Search Nodes\":[{\"Name\":\"searchNodes\",\"\":{\"name\":\"searchNodes\"}}]," + "\"Statistics\":{\"id\":\"\",\"version\":\"\",\"database\":{\"name\":\"\",\"version\":\"\"},\"plugins\":[]," + "\"userCount\":0,\"projectCount\":0,\"usingBranches\":false,\"ncloc\":0,\"projectCountByLanguage\":[]," + - "\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"installationDate\":0,\"installationVersion\":\"\",\"docker\":false}}"); + "\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"externalAuthProviders\":[],\"installationDate\":0,\"installationVersion\":\"\",\"docker\":false}}"); } private static NodeInfo createNodeInfo(String name) { diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java index 20f0badf332..a7e99d4f402 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java @@ -81,7 +81,8 @@ public class StandaloneSystemInfoWriterTest { // response does not contain empty "Section Three" assertThat(writer.toString()).isEqualTo("{\"Health\":\"GREEN\",\"Health Causes\":[],\"Section One\":{\"foo\":\"bar\"},\"Section Two\":{\"one\":1,\"two\":2}," + "\"Statistics\":{\"id\":\"\",\"version\":\"\",\"database\":{\"name\":\"\",\"version\":\"\"},\"plugins\":[],\"userCount\":0,\"projectCount\":0,\"usingBranches\":false," + - "\"ncloc\":0,\"projectCountByLanguage\":[],\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"installationDate\":0,\"installationVersion\":\"\",\"docker\":false}}"); + "\"ncloc\":0,\"projectCountByLanguage\":[],\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"externalAuthProviders\":[],\"installationDate\":0," + + "\"installationVersion\":\"\",\"docker\":false}}"); } private void logInAsSystemAdministrator() { diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDaemonTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDaemonTest.java index ad8c5cea40c..423c00cee02 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDaemonTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDaemonTest.java @@ -71,6 +71,7 @@ public class TelemetryDaemonTest { .setNclocByLanguage(Collections.emptyMap()) .build()) .setNcloc(42L) + .setExternalAuthenticationProviders(Collections.emptyList()) .setDatabase(new TelemetryData.Database("H2", "11")) .setUsingBranches(true) .build(); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java index 981839617a3..dd78c60e233 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java @@ -98,8 +98,8 @@ public class TelemetryDataLoaderImplTest { when(editionProvider.get()).thenReturn(Optional.of(DEVELOPER)); int userCount = 3; - IntStream.range(0, userCount).forEach(i -> db.users().insertUser()); - db.users().insertUser(u -> u.setActive(false)); + IntStream.range(0, userCount).forEach(i -> db.users().insertUser(u -> u.setExternalIdentityProvider("provider" + i))); + db.users().insertUser(u -> u.setActive(false).setExternalIdentityProvider("provider0")); userIndexer.indexAll(); MetricDto lines = db.measures().insertMetric(m -> m.setKey(LINES_KEY)); @@ -155,6 +155,7 @@ public class TelemetryDataLoaderImplTest { .containsEntry("gitlab_cloud", 1L) .containsEntry("github_cloud", 1L) .containsEntry("github_server", 1L); + assertThat(data.getExternalAuthenticationProviders()).containsExactlyInAnyOrder("provider0", "provider1", "provider2"); } private void assertDatabaseMetadata(TelemetryData.Database database) { |