From 4597d09ca1a81c86a56f416d2a9b4cb27e6ca4c2 Mon Sep 17 00:00:00 2001 From: Pierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:48:04 +0200 Subject: [PATCH] SONAR-16449 remove SonarCloud references in SonarQube codebase --- .../alm/client/github/security/AppToken.java | 6 +- .../container/ComputeEngineContainerImpl.java | 9 +- .../sonar/db/audit/model/UserNewValue.java | 10 -- .../main/java/org/sonar/db/user/UserDto.java | 10 -- .../org/sonar/db/user/UserMapper.xml | 4 - server/sonar-db-dao/src/schema/schema-sq.ddl | 1 - .../db/audit/model/UserNewValueTest.java | 1 - .../java/org/sonar/db/user/UserDaoTest.java | 6 - .../db/user/UserDaoWithPersisterTest.java | 7 +- .../java/org/sonar/db/user/UserTesting.java | 1 - .../db/migration/version/v95/DbVersion95.java | 2 + .../DropOnboardedColumnFromUserTable.java} | 13 +- .../DropOnboardedColumnFromUserTableTest.java | 54 ++++++++ .../schema.sql | 30 +++++ .../org/sonar/process/ProcessProperties.java | 6 - .../sonar/process/ProcessPropertiesTest.java | 1 - .../org/sonar/server/user/UserUpdater.java | 8 -- .../authentication/UserRegistrarImplTest.java | 19 --- .../server/user/UserUpdaterCreateTest.java | 29 ----- .../user/UserUpdaterReactivateTest.java | 31 ----- .../sonar/server/badge/ws/SvgGenerator.java | 19 +-- .../org/sonar/server/ui/ws/GlobalAction.java | 12 +- .../sonar/server/user/ws/CurrentAction.java | 4 +- .../user/ws/SkipOnboardingTutorialAction.java | 71 ---------- .../badge/ws/templates/sonarcloud/badge.svg | 23 ---- .../sonarcloud/quality_gate_failed.svg | 14 -- .../sonarcloud/quality_gate_passed.svg | 14 -- .../sonarcloud/quality_gate_warn.svg | 14 -- .../sonar/server/user/ws/current-example.json | 1 - .../server/badge/ws/MeasureActionTest.java | 4 +- .../badge/ws/QualityGateActionTest.java | 4 +- .../server/badge/ws/SvgGeneratorTest.java | 9 +- .../ws/ChangeLogLevelServiceModuleTest.java | 2 +- .../sonar/server/ui/ws/GlobalActionTest.java | 17 --- .../server/user/ws/CurrentActionTest.java | 10 +- .../ws/SkipOnboardingTutorialActionTest.java | 121 ------------------ .../server/platform/web/WebPagesCache.java | 24 ++-- .../platform/web/WebPagesCacheTest.java | 26 +--- .../scanner/sensor/DefaultSensorStorage.java | 2 +- .../mediumtest/fs/FileSystemMediumTest.java | 2 +- .../scanner/mediumtest/scm/ScmMediumTest.java | 2 +- .../ws/client/user/UsersWsParameters.java | 1 - .../ws/client/users/UsersService.java | 13 -- sonar-ws/src/main/protobuf/ws-users.proto | 2 +- 44 files changed, 135 insertions(+), 524 deletions(-) rename server/{sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java => sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTable.java} (71%) create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest.java create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest/schema.sql delete mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/SkipOnboardingTutorialAction.java delete mode 100644 server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/badge.svg delete mode 100644 server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_failed.svg delete mode 100644 server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_passed.svg delete mode 100644 server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_warn.svg delete mode 100644 server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SkipOnboardingTutorialActionTest.java diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/security/AppToken.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/security/AppToken.java index a321a1c0efe..f9059f8247b 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/security/AppToken.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/security/AppToken.java @@ -25,13 +25,13 @@ import static java.util.Objects.requireNonNull; /** * JWT (Json Web Token) to authenticate API requests on behalf - * of the SonarCloud App. + * of the Github App. * * Token expires after {@link #EXPIRATION_PERIOD_IN_MINUTES} minutes. * * IMPORTANT * Rate limit is 5'000 API requests per hour for ALL the clients - * of the SonarCloud App (all instances of {@link AppToken} from Compute Engines/web servers + * of the Github App (all instances of {@link AppToken} from Compute Engines/web servers * and from the other SonarSource services using the App). For example three calls with * three different tokens will consume 3 hits. Remaining quota will be 4'997. * When the token is expired, the rate limit is 60 calls per hour for the public IP @@ -42,7 +42,7 @@ import static java.util.Objects.requireNonNull; @Immutable public class AppToken implements AccessToken { - // SONARCLOUD-468 maximum allowed by GitHub is 10 minutes but we use 9 minutes just in case clocks are not synchronized + // maximum allowed by GitHub is 10 minutes but we use 9 minutes just in case clocks are not synchronized static final int EXPIRATION_PERIOD_IN_MINUTES = 9; private final String jwt; 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 ff9eea4f9f0..fd41e64a6c4 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 @@ -47,7 +47,6 @@ import org.sonar.ce.CeTaskCommonsModule; import org.sonar.ce.StandaloneCeDistributedInformation; import org.sonar.ce.async.SynchronousAsyncExecution; import org.sonar.ce.cleaning.CeCleaningModule; -import org.sonar.ce.cleaning.NoopCeCleaningSchedulerImpl; import org.sonar.ce.db.ReadOnlyPropertiesDao; import org.sonar.ce.issue.index.NoAsyncIssueIndexing; import org.sonar.ce.logging.CeProcessLogging; @@ -157,7 +156,6 @@ import static org.sonar.core.extension.CoreExtensionsInstaller.noAdditionalSideF import static org.sonar.core.extension.PlatformLevelPredicates.hasPlatformLevel; import static org.sonar.core.extension.PlatformLevelPredicates.hasPlatformLevel4OrNone; import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED; -import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; public class ComputeEngineContainerImpl implements ComputeEngineContainer { @@ -452,12 +450,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { ); - if (props.valueAsBoolean(SONARCLOUD_ENABLED.getKey())) { - // no cleaning job on sonarcloud and no distributed information - container.add( - NoopCeCleaningSchedulerImpl.class, - StandaloneCeDistributedInformation.class); - } else if (props.valueAsBoolean(CLUSTER_ENABLED.getKey())) { + if (props.valueAsBoolean(CLUSTER_ENABLED.getKey())) { container.add( new CeCleaningModule(), diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/UserNewValue.java b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/UserNewValue.java index 3b165f871b2..bd5dc75b561 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/UserNewValue.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/UserNewValue.java @@ -55,9 +55,6 @@ public class UserNewValue extends NewValue { @Nullable private Boolean local; - @Nullable - private Boolean onboarded; - @Nullable private Boolean root; @@ -80,7 +77,6 @@ public class UserNewValue extends NewValue { this.externalLogin = userDto.getExternalLogin(); this.externalIdentityProvider = userDto.getExternalIdentityProvider(); this.local = userDto.isLocal(); - this.onboarded = userDto.isOnboarded(); this.root = userDto.isRoot(); this.lastConnectionDate = userDto.getLastConnectionDate(); } @@ -133,11 +129,6 @@ public class UserNewValue extends NewValue { return this.local; } - @CheckForNull - public Boolean isOnboarded() { - return this.onboarded; - } - @CheckForNull public Boolean isRoot() { return this.root; @@ -161,7 +152,6 @@ public class UserNewValue extends NewValue { addField(sb, "\"externalLogin\": ", this.externalLogin, true); addField(sb, "\"externalIdentityProvider\": ", this.externalIdentityProvider, true); addField(sb, "\"local\": ", ObjectUtils.toString(this.local), false); - addField(sb, "\"onboarded\": ", ObjectUtils.toString(this.onboarded), false); addField(sb, "\"root\": ", ObjectUtils.toString(this.root), false); addField(sb, "\"lastConnectionDate\": ", this.lastConnectionDate == null ? "" : DateUtils.formatDateTime(this.lastConnectionDate), true); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDto.java index d58d4cda753..a6ab38a2d42 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDto.java @@ -53,7 +53,6 @@ public class UserDto implements UserId { private String homepageParameter; private boolean local = true; private boolean root = false; - private boolean onboarded = false; private boolean resetPassword = false; private boolean sonarlintAdSeen = false; @@ -261,15 +260,6 @@ public class UserDto implements UserId { this.root = root; } - public boolean isOnboarded() { - return onboarded; - } - - public UserDto setOnboarded(boolean onboarded) { - this.onboarded = onboarded; - return this; - } - public boolean isResetPassword() { return resetPassword; } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml index b6d4b139e3c..4f34375559b 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml @@ -18,7 +18,6 @@ u.external_identity_provider as "externalIdentityProvider", u.user_local as "local", u.is_root as "root", - u.onboarded as "onboarded", u.reset_password as "resetPassword", u.homepage_type as "homepageType", u.homepage_parameter as "homepageParameter", @@ -237,7 +236,6 @@ crypted_password, hash_method, is_root, - onboarded, last_sonarlint_connection, sonarlint_ad_seen, reset_password, @@ -260,7 +258,6 @@ #{user.cryptedPassword,jdbcType=VARCHAR}, #{user.hashMethod,jdbcType=VARCHAR}, #{user.root,jdbcType=BOOLEAN}, - #{user.onboarded,jdbcType=BOOLEAN}, #{user.lastSonarlintConnectionDate,jdbcType=BIGINT}, #{user.sonarlintAdSeen,jdbcType=BOOLEAN}, #{user.resetPassword,jdbcType=BOOLEAN}, @@ -282,7 +279,6 @@ external_login = #{user.externalLogin, jdbcType=VARCHAR}, external_identity_provider = #{user.externalIdentityProvider, jdbcType=VARCHAR}, user_local = #{user.local, jdbcType=BOOLEAN}, - onboarded = #{user.onboarded, jdbcType=BOOLEAN}, reset_password = #{user.resetPassword, jdbcType=BOOLEAN}, salt = #{user.salt, jdbcType=VARCHAR}, crypted_password = #{user.cryptedPassword, jdbcType=BIGINT}, diff --git a/server/sonar-db-dao/src/schema/schema-sq.ddl b/server/sonar-db-dao/src/schema/schema-sq.ddl index ce605b46a5b..4aa81a9d442 100644 --- a/server/sonar-db-dao/src/schema/schema-sq.ddl +++ b/server/sonar-db-dao/src/schema/schema-sq.ddl @@ -982,7 +982,6 @@ CREATE TABLE "USERS"( "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, "IS_ROOT" BOOLEAN NOT NULL, "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, "HOMEPAGE_TYPE" CHARACTER VARYING(40), "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), "LAST_CONNECTION_DATE" BIGINT, diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/UserNewValueTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/UserNewValueTest.java index 03eae269928..644c47979d1 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/UserNewValueTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/UserNewValueTest.java @@ -40,7 +40,6 @@ public class UserNewValueTest { userDto.setExternalLogin("name"); userDto.setExternalIdentityProvider("github"); userDto.setLocal(false); - userDto.setOnboarded(true); userDto.setLastConnectionDate(System.currentTimeMillis()); UserNewValue userNewValue = new UserNewValue(userDto); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java index f166b7fe7ae..883437e4c8f 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java @@ -343,7 +343,6 @@ public class UserDaoTest { assertThat(user).isNotNull(); assertThat(user.getUuid()).isNotNull(); assertThat(user.isActive()).isTrue(); - assertThat(user.isOnboarded()).isFalse(); assertThat(user.isResetPassword()).isFalse(); assertThat(user.isLocal()).isTrue(); assertThat(user.isRoot()).isFalse(); @@ -366,7 +365,6 @@ public class UserDaoTest { .setEmail("jo@hn.com") .setScmAccounts(",jo.hn,john2,") .setActive(true) - .setOnboarded(true) .setResetPassword(true) .setSalt("1234") .setCryptedPassword("abcd") @@ -389,7 +387,6 @@ public class UserDaoTest { assertThat(user.getName()).isEqualTo("John"); assertThat(user.getEmail()).isEqualTo("jo@hn.com"); assertThat(user.isActive()).isTrue(); - assertThat(user.isOnboarded()).isTrue(); assertThat(user.isResetPassword()).isTrue(); assertThat(user.getScmAccounts()).isEqualTo(",jo.hn,john2,"); assertThat(user.getSalt()).isEqualTo("1234"); @@ -423,7 +420,6 @@ public class UserDaoTest { .setEmail("jo@hn.com") .setActive(true) .setLocal(true) - .setOnboarded(false) .setResetPassword(false)); underTest.update(db.getSession(), newUserDto() @@ -433,7 +429,6 @@ public class UserDaoTest { .setEmail("jodoo@hn.com") .setScmAccounts(",jo.hn,john2,johndoo,") .setActive(false) - .setOnboarded(true) .setResetPassword(true) .setSalt("12345") .setCryptedPassword("abcde") @@ -453,7 +448,6 @@ public class UserDaoTest { assertThat(reloaded.getName()).isEqualTo("John Doo"); assertThat(reloaded.getEmail()).isEqualTo("jodoo@hn.com"); assertThat(reloaded.isActive()).isFalse(); - assertThat(reloaded.isOnboarded()).isTrue(); assertThat(reloaded.isResetPassword()).isTrue(); assertThat(reloaded.getScmAccounts()).isEqualTo(",jo.hn,john2,johndoo,"); assertThat(reloaded.getSalt()).isEqualTo("12345"); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java index ea3bfbe80c5..6a4fadf7b84 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java @@ -83,7 +83,6 @@ public class UserDaoWithPersisterTest { .setEmail("jo@hn.com") .setActive(true) .setLocal(true) - .setOnboarded(false) .setResetPassword(false)); UserDto updatedUser = newUserDto() .setUuid(user.getUuid()) @@ -92,7 +91,6 @@ public class UserDaoWithPersisterTest { .setEmail("jodoo@hn.com") .setScmAccounts(",jo.hn,john2,johndoo,") .setActive(false) - .setOnboarded(true) .setResetPassword(true) .setSalt("12345") .setCryptedPassword("abcde") @@ -111,10 +109,10 @@ public class UserDaoWithPersisterTest { assertThat(newValue) .extracting(UserNewValue::getUserUuid, UserNewValue::getUserLogin, UserNewValue::getName, UserNewValue::getEmail, UserNewValue::isActive, UserNewValue::getScmAccounts, UserNewValue::getExternalId, UserNewValue::getExternalLogin, UserNewValue::getExternalIdentityProvider, - UserNewValue::isLocal, UserNewValue::isOnboarded, UserNewValue::isRoot, UserNewValue::getLastConnectionDate) + UserNewValue::isLocal, UserNewValue::isRoot, UserNewValue::getLastConnectionDate) .containsExactly(updatedUser.getUuid(), updatedUser.getLogin(), updatedUser.getName(), updatedUser.getEmail(), updatedUser.isActive(), updatedUser.getScmAccounts(), updatedUser.getExternalId(), updatedUser.getExternalLogin(), updatedUser.getExternalIdentityProvider(), - updatedUser.isLocal(), updatedUser.isOnboarded(), updatedUser.isRoot(), updatedUser.getLastConnectionDate()); + updatedUser.isLocal(), updatedUser.isRoot(), updatedUser.getLastConnectionDate()); assertThat(newValue.toString()) .contains("name") .contains(DateUtils.formatDateTime(updatedUser.getLastConnectionDate())); @@ -128,7 +126,6 @@ public class UserDaoWithPersisterTest { .setEmail("jo@hn.com") .setActive(true) .setLocal(true) - .setOnboarded(false) .setResetPassword(false)); verify(auditPersister).addUser(eq(db.getSession()), newValueCaptor.capture()); diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/UserTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/UserTesting.java index 042e80f9c4e..c75eec6e83e 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/UserTesting.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/UserTesting.java @@ -36,7 +36,6 @@ public class UserTesting { .setLogin(randomAlphanumeric(30)) .setName(randomAlphanumeric(30)) .setEmail(randomAlphanumeric(30)) - .setOnboarded(nextBoolean()) .setScmAccounts(singletonList(randomAlphanumeric(40))) .setExternalId(randomAlphanumeric(40)) .setExternalLogin(randomAlphanumeric(40)) diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DbVersion95.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DbVersion95.java index e2d0ac509b2..9a92d949627 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DbVersion95.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DbVersion95.java @@ -45,6 +45,8 @@ public class DbVersion95 implements DbVersion { .add(6414, "Drop rules_metadata table", DropRuleMetadataTable.class) .add(6415, "Migrate hotspot rule descriptions", MigrateHotspotRuleDescriptions.class) + + .add(6416, "Remove onboarded column from User table", DropOnboardedColumnFromUserTable.class) ; } } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTable.java similarity index 71% rename from server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java rename to server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTable.java index fb8ca7b3cff..359d617e046 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTable.java @@ -17,11 +17,14 @@ * 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.cleaning; +package org.sonar.server.platform.db.migration.version.v95; -public class NoopCeCleaningSchedulerImpl implements CeCleaningScheduler { - @Override - public void startScheduling() { - // do nothing +import org.sonar.db.Database; +import org.sonar.server.platform.db.migration.step.DropColumnChange; + +public class DropOnboardedColumnFromUserTable extends DropColumnChange { + + protected DropOnboardedColumnFromUserTable(Database db) { + super(db, "users", "onboarded"); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest.java new file mode 100644 index 00000000000..c44d4cdc0b9 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest.java @@ -0,0 +1,54 @@ +/* + * 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.server.platform.db.migration.version.v95; + +import java.sql.SQLException; +import java.sql.Types; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.step.DdlChange; + +public class DropOnboardedColumnFromUserTableTest { + + private static final String COLUMN_NAME = "onboarded"; + private static final String TABLE_NAME = "users"; + + @Rule + public final CoreDbTester db = CoreDbTester.createForSchema(DropOnboardedColumnFromUserTableTest.class, "schema.sql"); + + private final DdlChange dropRuleDescriptionColumn = new DropOnboardedColumnFromUserTable(db.database()); + + @Test + public void migration_should_drop_onboarded_column() throws SQLException { + db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.BOOLEAN, null, false); + dropRuleDescriptionColumn.execute(); + db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME); + } + + @Test + public void migration_should_be_reentrant() throws SQLException { + db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.BOOLEAN, null, false); + dropRuleDescriptionColumn.execute(); + // re-entrant + dropRuleDescriptionColumn.execute(); + db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME); + } +} \ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest/schema.sql new file mode 100644 index 00000000000..e2eca57a0c0 --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v95/DropOnboardedColumnFromUserTableTest/schema.sql @@ -0,0 +1,30 @@ +CREATE TABLE "USERS"( + "UUID" CHARACTER VARYING(255) NOT NULL, + "LOGIN" CHARACTER VARYING(255) NOT NULL, + "NAME" CHARACTER VARYING(200), + "EMAIL" CHARACTER VARYING(100), + "CRYPTED_PASSWORD" CHARACTER VARYING(100), + "SALT" CHARACTER VARYING(40), + "HASH_METHOD" CHARACTER VARYING(10), + "ACTIVE" BOOLEAN DEFAULT TRUE, + "SCM_ACCOUNTS" CHARACTER VARYING(4000), + "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, + "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, + "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, + "IS_ROOT" BOOLEAN NOT NULL, + "USER_LOCAL" BOOLEAN, + "ONBOARDED" BOOLEAN NOT NULL, + "HOMEPAGE_TYPE" CHARACTER VARYING(40), + "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), + "LAST_CONNECTION_DATE" BIGINT, + "CREATED_AT" BIGINT, + "UPDATED_AT" BIGINT, + "RESET_PASSWORD" BOOLEAN NOT NULL, + "LAST_SONARLINT_CONNECTION" BIGINT, + "SONARLINT_AD_SEEN" BOOLEAN DEFAULT FALSE +); +ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); +CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); +CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); +CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); +CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java index 03b636d284c..a23af65a163 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java @@ -174,12 +174,6 @@ public class ProcessProperties { SONAR_UPDATECENTER_ACTIVATE("sonar.updatecenter.activate", "true"), - SONARCLOUD_ENABLED("sonar.sonarcloud.enabled", DEFAULT_FALSE), - SONARCLOUD_HOMEPAGE_URL("sonar.homepage.url", ""), - SONAR_PRISMIC_ACCESS_TOKEN("sonar.prismic.accessToken", ""), - SONAR_ANALYTICS_GTM_TRACKING_ID("sonar.analytics.gtm.trackingId", ""), - ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS("sonar.onboardingTutorial.showToNewUsers", "true"), - /** * Used by Orchestrator to ask for shutdown of monitor process */ diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java index 0d9269a9aa1..b75e4e27e8c 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java @@ -48,7 +48,6 @@ public class ProcessPropertiesTest { assertThat(props.value("sonar.search.javaOpts")).contains("-Xmx"); assertThat(props.valueAsInt("sonar.jdbc.maxActive")).isEqualTo(60); - assertThat(props.valueAsBoolean("sonar.sonarcloud.enabled")).isFalse(); assertThat(props.valueAsBoolean("sonar.updatecenter.activate")).isTrue(); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java index d8d9fca10f3..7df1a44f9b3 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java @@ -55,7 +55,6 @@ import static java.util.stream.Stream.concat; import static org.sonar.api.CoreProperties.DEFAULT_ISSUE_ASSIGNEE; import static org.sonar.core.util.Slug.slugify; import static org.sonar.core.util.stream.MoreCollectors.toList; -import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS; import static org.sonar.server.exceptions.BadRequestException.checkRequest; @ServerSide @@ -118,7 +117,6 @@ public class UserUpdater { if (password != null) { updateUser.setPassword(password); } - setOnboarded(reactivatedUser); updateDto(dbSession, updateUser, reactivatedUser); updateUser(dbSession, reactivatedUser); addUserToDefaultGroup(dbSession, reactivatedUser); @@ -177,7 +175,6 @@ public class UserUpdater { } setExternalIdentity(dbSession, userDto, newUser.externalIdentity()); - setOnboarded(userDto); checkRequest(messages.isEmpty(), messages); return userDto; @@ -306,11 +303,6 @@ public class UserUpdater { "A user with provider id '%s' and identity provider '%s' already exists", dto.getExternalId(), dto.getExternalIdentityProvider()); } - private void setOnboarded(UserDto userDto) { - boolean showOnboarding = config.getBoolean(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey()).orElse(false); - userDto.setOnboarded(!showOnboarding); - } - private static boolean checkNotEmptyParam(@Nullable String value, String param, List messages) { if (isNullOrEmpty(value)) { messages.add(format(Validation.CANT_BE_EMPTY_MESSAGE, param)); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java index e535e6416be..accef48c744 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java @@ -51,7 +51,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS; import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC; public class UserRegistrarImplTest { @@ -167,24 +166,6 @@ public class UserRegistrarImplTest { checkGroupMembership(user.get(), group1, group2, defaultGroup); } - @Test - public void authenticate_new_user_sets_onboarded_flag_to_false_when_onboarding_setting_is_set_to_true() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true); - - UserDto user = underTest.register(newUserRegistration()); - - assertThat(db.users().selectUserByLogin(user.getLogin()).get().isOnboarded()).isFalse(); - } - - @Test - public void authenticate_new_user_sets_onboarded_flag_to_true_when_onboarding_setting_is_set_to_false() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false); - - UserDto user = underTest.register(newUserRegistration()); - - assertThat(db.users().selectUserByLogin(user.getLogin()).get().isOnboarded()).isTrue(); - } - @Test public void authenticate_new_user_sets_external_id_to_provider_login_when_id_is_null() { UserIdentity newUser = UserIdentity.builder() diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java index 55dff0fef63..5d799c5cc0b 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java @@ -53,7 +53,6 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.sonar.db.user.UserTesting.newLocalUser; -import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS; import static org.sonar.server.user.ExternalIdentity.SQ_AUTHORITY; public class UserUpdaterCreateTest { @@ -265,34 +264,6 @@ public class UserUpdaterCreateTest { assertThat(dbClient.userDao().selectByLogin(session, "user").getScmAccountsAsList()).containsOnly("u1"); } - @Test - public void create_not_onboarded_user_if_onboarding_setting_is_set_to_false() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false); - createDefaultGroup(); - - underTest.createAndCommit(db.getSession(), NewUser.builder() - .setLogin("user") - .setName("User") - .build(), u -> { - }); - - assertThat(dbClient.userDao().selectByLogin(session, "user").isOnboarded()).isTrue(); - } - - @Test - public void create_onboarded_user_if_onboarding_setting_is_set_to_true() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true); - createDefaultGroup(); - - underTest.createAndCommit(db.getSession(), NewUser.builder() - .setLogin("user") - .setName("User") - .build(), u -> { - }); - - assertThat(dbClient.userDao().selectByLogin(session, "user").isOnboarded()).isFalse(); - } - @Test public void create_user_and_index_other_user() { createDefaultGroup(); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java index 9698cd53b29..b5448e9caf9 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java @@ -47,7 +47,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS; public class UserUpdaterReactivateTest { @@ -237,36 +236,6 @@ public class UserUpdaterReactivateTest { assertThat(groups.get(userDto.getLogin()).stream().anyMatch(g -> g.equals(defaultGroup.getName()))).isTrue(); } - @Test - public void reactivate_not_onboarded_user_if_onboarding_setting_is_set_to_false() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false); - UserDto user = db.users().insertDisabledUser(u -> u.setOnboarded(false)); - createDefaultGroup(); - - underTest.reactivateAndCommit(db.getSession(), user, NewUser.builder() - .setLogin(user.getLogin()) - .setName(user.getName()) - .build(), u -> { - }); - - assertThat(dbClient.userDao().selectByLogin(session, user.getLogin()).isOnboarded()).isTrue(); - } - - @Test - public void reactivate_onboarded_user_if_onboarding_setting_is_set_to_true() { - settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true); - UserDto user = db.users().insertDisabledUser(u -> u.setOnboarded(true)); - createDefaultGroup(); - - underTest.reactivateAndCommit(db.getSession(), user, NewUser.builder() - .setLogin(user.getLogin()) - .setName(user.getName()) - .build(), u -> { - }); - - assertThat(dbClient.userDao().selectByLogin(session, user.getLogin()).isOnboarded()).isFalse(); - } - @Test public void fail_to_reactivate_user_when_login_already_exists() { createDefaultGroup(); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/badge/ws/SvgGenerator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/badge/ws/SvgGenerator.java index b29b11dfbff..c0715f87fa1 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/badge/ws/SvgGenerator.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/badge/ws/SvgGenerator.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.text.StrSubstitutor; -import org.sonar.api.config.Configuration; import org.sonar.api.measures.Metric; import org.sonar.api.server.ServerSide; @@ -34,7 +33,6 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.sonar.api.measures.Metric.Level.ERROR; import static org.sonar.api.measures.Metric.Level.OK; import static org.sonar.api.measures.Metric.Level.WARN; -import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; @ServerSide public class SvgGenerator { @@ -109,8 +107,7 @@ public class SvgGenerator { .put('\'', 3) .build(); - private static final String TEMPLATES_SONARCLOUD = "templates/sonarcloud"; - private static final String TEMPLATES_SONARQUBE = "templates/sonarqube"; + private static final String TEMPLATES_PATH = "templates/sonarqube"; private static final int MARGIN = 6; private static final int ICON_WIDTH = 20; @@ -130,15 +127,13 @@ public class SvgGenerator { private final String badgeTemplate; private final Map qualityGateTemplates; - public SvgGenerator(Configuration config) { - boolean isOnSonarCloud = config.getBoolean(SONARCLOUD_ENABLED.getKey()).orElse(false); - String templatePath = isOnSonarCloud ? TEMPLATES_SONARCLOUD : TEMPLATES_SONARQUBE; + public SvgGenerator() { this.errorTemplate = readTemplate("templates/error.svg"); - this.badgeTemplate = readTemplate(templatePath + "/badge.svg"); - this.qualityGateTemplates = ImmutableMap.of( - OK, readTemplate(templatePath + "/quality_gate_passed.svg"), - WARN, readTemplate(templatePath + "/quality_gate_warn.svg"), - ERROR, readTemplate(templatePath + "/quality_gate_failed.svg")); + this.badgeTemplate = readTemplate(TEMPLATES_PATH + "/badge.svg"); + this.qualityGateTemplates = Map.of( + OK, readTemplate(TEMPLATES_PATH + "/quality_gate_passed.svg"), + WARN, readTemplate(TEMPLATES_PATH + "/quality_gate_warn.svg"), + ERROR, readTemplate(TEMPLATES_PATH + "/quality_gate_failed.svg")); } public String generateBadge(String label, String value, Color backgroundValueColor) { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/GlobalAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/GlobalAction.java index a5b145d8d41..86bd04823de 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/GlobalAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/GlobalAction.java @@ -59,15 +59,11 @@ import static org.sonar.core.config.WebConstants.SONAR_LF_LOGO_WIDTH_PX; import static org.sonar.core.platform.EditionProvider.Edition; import static org.sonar.core.platform.EditionProvider.Edition.DATACENTER; import static org.sonar.core.platform.EditionProvider.Edition.ENTERPRISE; -import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; -import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_HOMEPAGE_URL; -import static org.sonar.process.ProcessProperties.Property.SONAR_ANALYTICS_GTM_TRACKING_ID; -import static org.sonar.process.ProcessProperties.Property.SONAR_PRISMIC_ACCESS_TOKEN; import static org.sonar.process.ProcessProperties.Property.SONAR_UPDATECENTER_ACTIVATE; public class GlobalAction implements NavigationWsAction, Startable { - private static final Set DYNAMIC_SETTING_KEYS = ImmutableSet.of( + private static final Set DYNAMIC_SETTING_KEYS = Set.of( SONAR_LF_LOGO_URL, SONAR_LF_LOGO_WIDTH_PX, SONAR_LF_ENABLE_GRAVATAR, @@ -116,12 +112,6 @@ public class GlobalAction implements NavigationWsAction, Startable { @Override public void start() { this.systemSettingValuesByKey.put(SONAR_UPDATECENTER_ACTIVATE.getKey(), config.get(SONAR_UPDATECENTER_ACTIVATE.getKey()).orElse(null)); - boolean isOnSonarCloud = config.getBoolean(SONARCLOUD_ENABLED.getKey()).orElse(false); - if (isOnSonarCloud) { - this.systemSettingValuesByKey.put(SONAR_PRISMIC_ACCESS_TOKEN.getKey(), config.get(SONAR_PRISMIC_ACCESS_TOKEN.getKey()).orElse(null)); - this.systemSettingValuesByKey.put(SONAR_ANALYTICS_GTM_TRACKING_ID.getKey(), config.get(SONAR_ANALYTICS_GTM_TRACKING_ID.getKey()).orElse(null)); - this.systemSettingValuesByKey.put(SONARCLOUD_HOMEPAGE_URL.getKey(), config.get(SONARCLOUD_HOMEPAGE_URL.getKey()).orElse(null)); - } } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java index b9f7cfa2f58..fa3fba7c47d 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java @@ -86,7 +86,8 @@ public class CurrentAction implements UsersWsAction { .setChangelog( new Change("6.5", "showOnboardingTutorial is now returned in the response"), new Change("7.1", "'parameter' is replaced by 'component' and 'organization' in the response"), - new Change("9.2", "boolean 'usingSonarLintConnectedMode' and 'sonarLintAdSeen' fields are now returned in the response")); + new Change("9.2", "boolean 'usingSonarLintConnectedMode' and 'sonarLintAdSeen' fields are now returned in the response"), + new Change("9.5", "showOnboardingTutorial is not returned anymore in the response")); } @Override @@ -118,7 +119,6 @@ public class CurrentAction implements UsersWsAction { .addAllScmAccounts(user.getScmAccountsAsList()) .setPermissions(Permissions.newBuilder().addAllGlobal(getGlobalPermissions()).build()) .setHomepage(buildHomepage(dbSession, user)) - .setShowOnboardingTutorial(!user.isOnboarded()) .setUsingSonarLintConnectedMode(user.getLastSonarlintConnectionDate() != null) .setSonarLintAdSeen(user.isSonarlintAdSeen()); ofNullable(emptyToNull(user.getEmail())).ifPresent(builder::setEmail); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/SkipOnboardingTutorialAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/SkipOnboardingTutorialAction.java deleted file mode 100644 index ee8dc004213..00000000000 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/SkipOnboardingTutorialAction.java +++ /dev/null @@ -1,71 +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.server.user.ws; - -import org.sonar.api.server.ws.Request; -import org.sonar.api.server.ws.Response; -import org.sonar.api.server.ws.WebService; -import org.sonar.db.DbClient; -import org.sonar.db.DbSession; -import org.sonar.db.user.UserDto; -import org.sonar.server.user.UserSession; - -import static com.google.common.base.Preconditions.checkState; -import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_SKIP_ONBOARDING_TUTORIAL; - -public class SkipOnboardingTutorialAction implements UsersWsAction { - - private final UserSession userSession; - private final DbClient dbClient; - - public SkipOnboardingTutorialAction(UserSession userSession, DbClient dbClient) { - this.userSession = userSession; - this.dbClient = dbClient; - } - - @Override - public void define(WebService.NewController context) { - context.createAction(ACTION_SKIP_ONBOARDING_TUTORIAL) - .setPost(true) - .setInternal(true) - .setDescription("Stores that the user has skipped the onboarding tutorial and does not want to see it after future logins.
" + - "Requires authentication.") - .setSince("6.5") - .setHandler(this); - } - - @Override - public void handle(Request request, Response response) throws Exception { - userSession.checkLoggedIn(); - try (DbSession dbSession = dbClient.openSession(false)) { - String userLogin = userSession.getLogin(); - UserDto userDto = dbClient.userDao().selectActiveUserByLogin(dbSession, userLogin); - checkState(userDto != null, "User login '%s' cannot be found", userLogin); - if (!userDto.isOnboarded()) { - userDto.setOnboarded(true); - // no need to update Elasticsearch, the field onBoarded - // is not indexed - dbClient.userDao().update(dbSession, userDto); - dbSession.commit(); - } - } - response.noContent(); - } -} diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/badge.svg b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/badge.svg deleted file mode 100644 index 68877b16b1a..00000000000 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/badge.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - ${label} - ${label} - ${value} - ${value} - - - - \ No newline at end of file diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_failed.svg b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_failed.svg deleted file mode 100644 index 629d3b34baf..00000000000 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_failed.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_passed.svg b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_passed.svg deleted file mode 100644 index f8267221aa6..00000000000 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_passed.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_warn.svg b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_warn.svg deleted file mode 100644 index 386c518bc23..00000000000 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/badge/ws/templates/sonarcloud/quality_gate_warn.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/current-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/current-example.json index e6b910560d9..e1644c37888 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/current-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/current-example.json @@ -7,7 +7,6 @@ "local": true, "externalIdentity": "obiwan.kenobi", "externalProvider": "sonarqube", - "showOnboardingTutorial": false, "scmAccounts": ["obiwan:github", "obiwan:bitbucket"], "groups": ["Jedi", "Rebel"], "usingSonarLintConnectedMode": false, diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/MeasureActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/MeasureActionTest.java index 8af23c34a2d..f5d070570d8 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/MeasureActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/MeasureActionTest.java @@ -82,14 +82,14 @@ public class MeasureActionTest { @Rule public DbTester db = DbTester.create(); - private final MapSettings mapSettings = new MapSettings().setProperty("sonar.sonarcloud.enabled", false); + private final MapSettings mapSettings = new MapSettings(); private final Configuration config = mapSettings.asConfig(); private final WsActionTester ws = new WsActionTester( new MeasureAction( db.getDbClient(), new ProjectBadgesSupport(new ComponentFinder(db.getDbClient(), null), db.getDbClient(), config), - new SvgGenerator(mapSettings.asConfig()))); + new SvgGenerator())); @Before public void before(){ diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/QualityGateActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/QualityGateActionTest.java index bd50bf23e0e..5a672956ecd 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/QualityGateActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/QualityGateActionTest.java @@ -68,13 +68,13 @@ public class QualityGateActionTest { @Rule public DbTester db = DbTester.create(); - private final MapSettings mapSettings = new MapSettings().setProperty("sonar.sonarcloud.enabled", false).setProperty(CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, false); + private final MapSettings mapSettings = new MapSettings().setProperty(CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, false); private final Configuration config = mapSettings.asConfig(); private final WsActionTester ws = new WsActionTester( new QualityGateAction(db.getDbClient(), new ProjectBadgesSupport(new ComponentFinder(db.getDbClient(), null), db.getDbClient(), config), - new SvgGenerator(mapSettings.asConfig()))); + new SvgGenerator())); @Before diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/SvgGeneratorTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/SvgGeneratorTest.java index ad93adfd97a..af4ecb5f6fa 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/SvgGeneratorTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/badge/ws/SvgGeneratorTest.java @@ -42,13 +42,10 @@ public class SvgGeneratorTest { @Rule public DbTester db = DbTester.create(); - private MapSettings mapSettings = new MapSettings(); - private SvgGenerator underTest; @Test public void generate_badge() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); initSvgGenerator(); String result = underTest.generateBadge("label", "10", DEFAULT); @@ -58,7 +55,6 @@ public class SvgGeneratorTest { @Test public void generate_quality_gate() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); initSvgGenerator(); String result = underTest.generateQualityGate(ERROR); @@ -68,7 +64,6 @@ public class SvgGeneratorTest { @Test public void generate_deprecated_warning_quality_gate() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); initSvgGenerator(); String result = underTest.generateQualityGate(WARN); @@ -78,7 +73,6 @@ public class SvgGeneratorTest { @Test public void generate_error() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); initSvgGenerator(); String result = underTest.generateError("Error"); @@ -88,7 +82,6 @@ public class SvgGeneratorTest { @Test public void fail_when_unknown_character() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); initSvgGenerator(); assertThatThrownBy(() -> underTest.generateError("Méssage with accent")) @@ -96,7 +89,7 @@ public class SvgGeneratorTest { } private void initSvgGenerator() { - underTest = new SvgGenerator(mapSettings.asConfig()); + underTest = new SvgGenerator(); } private void checkBadge(String svg, String expectedLabel, String expectedValue, SvgGenerator.Color expectedColorValue) { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java index d3ae5836616..21c00a6a403 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java @@ -32,7 +32,7 @@ public class ChangeLogLevelServiceModuleTest { private final ChangeLogLevelServiceModule underTest = new ChangeLogLevelServiceModule(webServer); @Test - public void provide_returns_ChangeLogLevelClusterService_if_cluster_not_on_SonarCloud() { + public void provide_returns_ChangeLogLevelClusterService() { when(webServer.isStandalone()).thenReturn(false); ListContainer container = new ListContainer(); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ui/ws/GlobalActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ui/ws/GlobalActionTest.java index cd3263e4f5b..bb0ecfb6b71 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ui/ws/GlobalActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ui/ws/GlobalActionTest.java @@ -131,23 +131,6 @@ public class GlobalActionTest { "}"); } - @Test - public void return_sonarcloud_settings() { - settings.setProperty("sonar.sonarcloud.enabled", true); - settings.setProperty("sonar.prismic.accessToken", "secret"); - settings.setProperty("sonar.analytics.gtm.trackingId", "gtm_id"); - settings.setProperty("sonar.homepage.url", "https://s3/homepage.json"); - init(); - - assertJson(call()).isSimilarTo("{" + - " \"settings\": {" + - " \"sonar.prismic.accessToken\": \"secret\"," + - " \"sonar.analytics.gtm.trackingId\": \"gtm_id\"," + - " \"sonar.homepage.url\": \"https://s3/homepage.json\"" + - " }" + - "}"); - } - @Test public void return_developer_info_disabled_setting() { init(); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java index 600141ca6ae..e87d715a881 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java @@ -71,8 +71,7 @@ public class CurrentActionTest { .setLocal(true) .setExternalLogin("obiwan") .setExternalIdentityProvider("sonarqube") - .setScmAccounts(newArrayList("obiwan:github", "obiwan:bitbucket")) - .setOnboarded(false)); + .setScmAccounts(newArrayList("obiwan:github", "obiwan:bitbucket"))); userSession.logIn(user); CurrentWsResponse response = call(); @@ -80,9 +79,9 @@ public class CurrentActionTest { assertThat(response) .extracting(CurrentWsResponse::getIsLoggedIn, CurrentWsResponse::getLogin, CurrentWsResponse::getName, CurrentWsResponse::getEmail, CurrentWsResponse::getAvatar, CurrentWsResponse::getLocal, - CurrentWsResponse::getExternalIdentity, CurrentWsResponse::getExternalProvider, CurrentWsResponse::getScmAccountsList, CurrentWsResponse::getShowOnboardingTutorial) + CurrentWsResponse::getExternalIdentity, CurrentWsResponse::getExternalProvider, CurrentWsResponse::getScmAccountsList) .containsExactly(true, "obiwan.kenobi", "Obiwan Kenobi", "obiwan.kenobi@starwars.com", "f5aa64437a1821ffe8b563099d506aef", true, "obiwan", "sonarqube", - newArrayList("obiwan:github", "obiwan:bitbucket"), true); + newArrayList("obiwan:github", "obiwan:bitbucket")); } @Test @@ -185,7 +184,6 @@ public class CurrentActionTest { .setExternalLogin("obiwan.kenobi") .setExternalIdentityProvider("sonarqube") .setScmAccounts(newArrayList("obiwan:github", "obiwan:bitbucket")) - .setOnboarded(true) .setHomepageType("PROJECT") .setHomepageParameter("UUID-of-the-death-star")); userSession @@ -231,7 +229,7 @@ public class CurrentActionTest { assertThat(definition.isInternal()).isTrue(); assertThat(definition.responseExampleAsString()).isNotEmpty(); assertThat(definition.params()).isEmpty(); - assertThat(definition.changelog()).hasSize(3); + assertThat(definition.changelog()).hasSize(4); } private CurrentWsResponse call() { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SkipOnboardingTutorialActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SkipOnboardingTutorialActionTest.java deleted file mode 100644 index da9773eaa86..00000000000 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SkipOnboardingTutorialActionTest.java +++ /dev/null @@ -1,121 +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.server.user.ws; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.server.ws.WebService; -import org.sonar.db.DbTester; -import org.sonar.db.user.UserDto; -import org.sonar.server.exceptions.UnauthorizedException; -import org.sonar.server.tester.UserSessionRule; -import org.sonar.server.ws.TestResponse; -import org.sonar.server.ws.WsActionTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class SkipOnboardingTutorialActionTest { - - @Rule - public UserSessionRule userSession = UserSessionRule.standalone(); - - @Rule - public DbTester db = DbTester.create(); - - - private WsActionTester ws = new WsActionTester(new SkipOnboardingTutorialAction(userSession, db.getDbClient())); - - @Test - public void mark_user_as_onboarded() { - UserDto user = db.users().insertUser(u -> u - .setOnboarded(false)); - userSession.logIn(user); - - call(); - - UserDto userDto = selectUser(user.getLogin()); - assertThat(userDto.isOnboarded()).isTrue(); - } - - @Test - public void does_nothing_if_user_already_onboarded() { - UserDto user = db.users().insertUser(u -> u - .setOnboarded(true)); - userSession.logIn(user); - - call(); - - UserDto userDto = selectUser(user.getLogin()); - assertThat(userDto.isOnboarded()).isTrue(); - assertThat(userDto.getUpdatedAt()).isEqualTo(user.getUpdatedAt()); - } - - @Test - public void fail_for_anonymous() { - userSession.anonymous(); - - assertThatThrownBy(() -> call()) - .isInstanceOf(UnauthorizedException.class) - .hasMessage("Authentication is required"); - } - - @Test - public void fail_with_ISE_when_user_login_in_db_does_not_exist() { - db.users().insertUser(usert -> usert.setLogin("another")); - userSession.logIn("obiwan.kenobi"); - - assertThatThrownBy(() -> call()) - .isInstanceOf(IllegalStateException.class) - .hasMessage("User login 'obiwan.kenobi' cannot be found"); - } - - @Test - public void response_has_no_content() { - UserDto user = db.users().insertUser(u -> u.setOnboarded(false)); - userSession.logIn(user); - - TestResponse response = call(); - - assertThat(response.getStatus()).isEqualTo(204); - assertThat(response.getInput()).isEmpty(); - } - - @Test - public void test_definition() { - WebService.Action def = ws.getDef(); - assertThat(def.isPost()).isTrue(); - assertThat(def.isInternal()).isTrue(); - assertThat(def.since()).isEqualTo("6.5"); - assertThat(def.params()).isEmpty(); - assertThat(def.changelog()).isEmpty(); - } - - private TestResponse call() { - return ws.newRequest().setMethod("POST").execute(); - } - - private UserDto selectUser(String userLogin) { - UserDto userDto = db.getDbClient().userDao().selectByLogin(db.getSession(), userLogin); - assertThat(userDto).isNotNull(); - return userDto; - } - -} diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java index 2c2610d250c..0be09569381 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java @@ -19,7 +19,6 @@ */ package org.sonar.server.platform.web; -import com.google.common.collect.ImmutableSet; import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -27,7 +26,6 @@ import java.util.Objects; import java.util.Set; import javax.servlet.ServletContext; import org.apache.commons.io.IOUtils; -import org.sonar.api.config.Configuration; import org.sonar.server.platform.OfficialDistribution; import org.sonar.server.platform.Platform; import org.sonar.server.platform.Platform.Status; @@ -35,7 +33,6 @@ import org.sonar.server.platform.Platform.Status; import static com.google.common.base.Preconditions.checkState; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; -import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; import static org.sonar.server.platform.Platform.Status.UP; public class WebPagesCache { @@ -45,24 +42,21 @@ public class WebPagesCache { private static final String INSTANCE_PLACEHOLDER = "%INSTANCE%"; private static final String OFFICIAL_PLACEHOLDER = "%OFFICIAL%"; - private static final String SONARCLOUD_INSTANCE_VALUE = "SonarCloud"; private static final String SONARQUBE_INSTANCE_VALUE = "SonarQube"; private static final String INDEX_HTML_PATH = "/index.html"; - private static final Set HTML_PATHS = ImmutableSet.of(INDEX_HTML_PATH); + private static final Set HTML_PATHS = Set.of(INDEX_HTML_PATH); private final Platform platform; - private final Configuration configuration; private final OfficialDistribution officialDistribution; private ServletContext servletContext; private Map indexHtmlByPath; private Status status; - public WebPagesCache(Platform platform, Configuration configuration, OfficialDistribution officialDistribution) { + public WebPagesCache(Platform platform, OfficialDistribution officialDistribution) { this.platform = platform; - this.configuration = configuration; this.indexHtmlByPath = new HashMap<>(); this.officialDistribution = officialDistribution; } @@ -93,19 +87,17 @@ public class WebPagesCache { private String provide(String path) { getClass().getResourceAsStream(INDEX_HTML_PATH); - boolean isSonarCloud = configuration.getBoolean(SONARCLOUD_ENABLED.getKey()).orElse(false); - String instance = isSonarCloud ? SONARCLOUD_INSTANCE_VALUE : SONARQUBE_INSTANCE_VALUE; - return loadHtmlFile(path, status.name(), instance); + return loadHtmlFile(path, status.name()); } - private String loadHtmlFile(String path, String serverStatus, String instance) { + private String loadHtmlFile(String path, String serverStatus) { try (InputStream input = servletContext.getResourceAsStream(path)) { String template = IOUtils.toString(requireNonNull(input), UTF_8); return template - .replaceAll(WEB_CONTEXT_PLACEHOLDER, servletContext.getContextPath()) - .replaceAll(SERVER_STATUS_PLACEHOLDER, serverStatus) - .replaceAll(INSTANCE_PLACEHOLDER, instance) - .replaceAll(OFFICIAL_PLACEHOLDER, String.valueOf(officialDistribution.check())); + .replace(WEB_CONTEXT_PLACEHOLDER, servletContext.getContextPath()) + .replace(SERVER_STATUS_PLACEHOLDER, serverStatus) + .replace(INSTANCE_PLACEHOLDER, WebPagesCache.SONARQUBE_INSTANCE_VALUE) + .replace(OFFICIAL_PLACEHOLDER, String.valueOf(officialDistribution.check())); } catch (Exception e) { throw new IllegalStateException("Fail to load file " + path, e); } diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java index fc1e8d030fc..fbd308bf5f3 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java @@ -24,7 +24,6 @@ import javax.servlet.ServletContext; import org.junit.Before; import org.junit.Test; import org.mockito.stubbing.Answer; -import org.sonar.api.config.internal.MapSettings; import org.sonar.server.platform.OfficialDistribution; import org.sonar.server.platform.Platform; @@ -45,11 +44,10 @@ public class WebPagesCacheTest { private ServletContext servletContext = mock(ServletContext.class); - private OfficialDistribution officialDistribution = mock(OfficialDistribution.class); - private Platform platform = mock(Platform.class); - private MapSettings mapSettings = new MapSettings(); + private final OfficialDistribution officialDistribution = mock(OfficialDistribution.class); + private final Platform platform = mock(Platform.class); - private WebPagesCache underTest = new WebPagesCache(platform, mapSettings.asConfig(), officialDistribution); + private final WebPagesCache underTest = new WebPagesCache(platform, officialDistribution); @Before public void setUp() { @@ -104,24 +102,6 @@ public class WebPagesCacheTest { .contains("SonarQube"); } - @Test - public void sonarcloud_setting_is_false() { - mapSettings.setProperty("sonar.sonarcloud.enabled", false); - doInit(); - - assertThat(underTest.getContent("/foo")) - .contains("SonarQube"); - } - - @Test - public void sonarcloud_setting_is_true() { - mapSettings.setProperty("sonar.sonarcloud.enabled", true); - doInit(); - - assertThat(underTest.getContent("/foo")) - .contains("SonarCloud"); - } - @Test public void content_is_updated_when_status_has_changed() { doInit(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java index 213fc50f608..7aaf4b5eebe 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java @@ -163,7 +163,7 @@ public class DefaultSensorStorage implements SensorStorage { } if (!measure.isFromCore() && NEWLY_CORE_METRICS_KEYS.contains(measure.metric().key())) { - logOnce(measure.metric().key(), "Metric '{}' is an internal metric computed by SonarQube/SonarCloud. Provided value is ignored.", measure.metric().key()); + logOnce(measure.metric().key(), "Metric '{}' is an internal metric computed by SonarQube. Provided value is ignored.", measure.metric().key()); return; } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java index c852d1735c4..f6daaed28b1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java @@ -65,7 +65,7 @@ public class FileSystemMediumTest { @Rule public ScannerMediumTester tester = new ScannerMediumTester() - .setEdition(SonarEdition.SONARCLOUD) + .setEdition(SonarEdition.COMMUNITY) .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addDefaultQProfile("xoo2", "Sonar Way"); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java index 3de346c71aa..c4b149d73f8 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java @@ -62,7 +62,7 @@ public class ScmMediumTest { @Rule public ScannerMediumTester tester = new ScannerMediumTester() - .setEdition(SonarEdition.SONARCLOUD) + .setEdition(SonarEdition.COMMUNITY) .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addRules(new XooRulesDefinition()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java index feacc9b2de9..9d7c9ea824d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersWsParameters.java @@ -27,7 +27,6 @@ public class UsersWsParameters { public static final String ACTION_CREATE = "create"; public static final String ACTION_DEACTIVATE = "deactivate"; public static final String ACTION_UPDATE = "update"; - public static final String ACTION_SKIP_ONBOARDING_TUTORIAL = "skip_onboarding_tutorial"; public static final String ACTION_CURRENT = "current"; public static final String ACTION_UPDATE_IDENTITY_PROVIDER = "update_identity_provider"; public static final String ACTION_DISMISS_SONARLINT_AD = "dismiss_sonarlint_ad"; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java index b90eaecf034..f0b83571dd4 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java @@ -167,19 +167,6 @@ public class UsersService extends BaseService { .setMediaType(MediaTypes.JSON)).content(); } - /** - * - * This is part of the internal API. - * This is a POST request. - * @see Further information about this action online (including a response example) - * @since 6.5 - */ - public void skipOnboardingTutorial() { - call( - new PostRequest(path("skip_onboarding_tutorial")) - .setMediaType(MediaTypes.JSON)).content(); - } - /** * * This is part of the internal API. diff --git a/sonar-ws/src/main/protobuf/ws-users.proto b/sonar-ws/src/main/protobuf/ws-users.proto index ec2af94934e..52579c59150 100644 --- a/sonar-ws/src/main/protobuf/ws-users.proto +++ b/sonar-ws/src/main/protobuf/ws-users.proto @@ -107,7 +107,7 @@ message CurrentWsResponse { repeated string scmAccounts = 8; repeated string groups = 9; optional Permissions permissions = 10; - optional bool showOnboardingTutorial = 11; + reserved 11; // showOnboardingTutorial removed optional string avatar = 12; optional Homepage homepage = 13; reserved 15; // settings removed -- 2.39.5