public void addSteps(MigrationStepRegistry registry) {
registry
.add(6101, "Change size of column 'selection_expression' in 'Portfolios'", AlterSelectionExpressionInPortfoliosTable.class)
- .add(6102, "Migrate Bitbucket.org authentication plugin settings to built-in authentication settings", MigrateBibucketOrgPluginSettingsToBuiltInSettings.class)
+ .add(6102, "Migrate Bitbucket.org authentication plugin settings to built-in authentication settings", MigrateBitbucketOrgPluginSettingsToBuiltInSettings.class)
.add(6103, "Create column quick_fix_available in 'issues'", AddQuickFixAvailableColumnInIssuesTable.class)
.add(6104, "Create qgate_user_permissions Table", CreateQGateUserPermissionsTable.class)
.add(6105, "Create qgate_group_permissions Table", CreateQGateGroupPermissionsTable.class)
+++ /dev/null
-/*
- * 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.v92;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.step.Upsert;
-
-public class MigrateBibucketOrgPluginSettingsToBuiltInSettings extends DataChange {
-
- public MigrateBibucketOrgPluginSettingsToBuiltInSettings(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Upsert upsert = context.prepareUpsert("update properties set prop_key = ? where prop_key = ?");
- upsert.setString(1, "sonar.auth.bitbucket.workspaces");
- upsert.setString(2, "sonar.auth.bitbucket.teams");
- upsert.execute();
- upsert.commit();
- }
-}
--- /dev/null
+/*
+ * 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.v92;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DataChange;
+import org.sonar.server.platform.db.migration.step.Upsert;
+
+public class MigrateBitbucketOrgPluginSettingsToBuiltInSettings extends DataChange {
+
+ public MigrateBitbucketOrgPluginSettingsToBuiltInSettings(Database db) {
+ super(db);
+ }
+
+ @Override
+ protected void execute(Context context) throws SQLException {
+ Upsert upsert = context.prepareUpsert("update properties set prop_key = ? where prop_key = ?");
+ upsert.setString(1, "sonar.auth.bitbucket.workspaces");
+ upsert.setString(2, "sonar.auth.bitbucket.teams");
+ upsert.execute();
+ upsert.commit();
+ }
+}
+++ /dev/null
-/*
- * 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.v92;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.core.util.UuidFactoryFast;
-import org.sonar.db.CoreDbTester;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class MigrateBibucketOrgPluginSettingsToBuiltInSettingsTest {
-
- private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
-
- @Rule
- public CoreDbTester db = CoreDbTester.createForSchema(MigrateBibucketOrgPluginSettingsToBuiltInSettingsTest.class, "schema.sql");
-
- private final DataChange underTest = new MigrateBibucketOrgPluginSettingsToBuiltInSettings(db.database());
-
- @Test
- public void migration_populate_new_property_based_on_plugin_property() throws SQLException {
- insertProperty("sonar.auth.bitbucket.teams", "restriction-value");
- insertProperty("another.property.not.impacted.by.migration", "some value");
-
- underTest.execute();
-
- assertPropertyMigratedCorrectly();
- }
-
- @Test
- public void migration_dont_fail_if_plugin_property_is_missing() throws SQLException {
- underTest.execute();
-
- String selectSql = "select count(*) as COUNT from properties where PROP_KEY='sonar.auth.bitbucket.workspaces'";
- assertThat(db.select(selectSql).stream().map(row -> row.get("COUNT")).collect(Collectors.toList()))
- .containsExactlyInAnyOrder(0L);
- }
-
- @Test
- public void migration_should_be_reentrant() throws SQLException {
- insertProperty("sonar.auth.bitbucket.teams", "restriction-value");
- insertProperty("another.property.not.impacted.by.migration", "some value");
-
- underTest.execute();
- // re-entrant
- underTest.execute();
-
- assertPropertyMigratedCorrectly();
- }
-
- private void assertPropertyMigratedCorrectly() {
- String selectSql = "select TEXT_VALUE from properties where PROP_KEY='sonar.auth.bitbucket.workspaces'";
- assertThat(db.select(selectSql).stream().map(row -> row.get("TEXT_VALUE")).collect(Collectors.toList()))
- .containsExactlyInAnyOrder("restriction-value");
- }
-
- private void insertProperty(String key, String value) {
- Map<String, Object> map = new HashMap<>();
- map.put("UUID", uuidFactory.create());
- map.put("PROP_KEY", key);
- map.put("IS_EMPTY", false);
- map.put("TEXT_VALUE", value);
- map.put("CREATED_AT", System.currentTimeMillis());
- db.executeInsert("properties", map);
- }
-}
--- /dev/null
+/*
+ * 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.v92;
+
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.core.util.UuidFactory;
+import org.sonar.core.util.UuidFactoryFast;
+import org.sonar.db.CoreDbTester;
+import org.sonar.server.platform.db.migration.step.DataChange;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MigrateBitbucketOrgPluginSettingsToBuiltInSettingsTest {
+
+ private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
+
+ @Rule
+ public CoreDbTester db = CoreDbTester.createForSchema(MigrateBitbucketOrgPluginSettingsToBuiltInSettingsTest.class, "schema.sql");
+
+ private final DataChange underTest = new MigrateBitbucketOrgPluginSettingsToBuiltInSettings(db.database());
+
+ @Test
+ public void migration_populate_new_property_based_on_plugin_property() throws SQLException {
+ insertProperty("sonar.auth.bitbucket.teams", "restriction-value");
+ insertProperty("another.property.not.impacted.by.migration", "some value");
+
+ underTest.execute();
+
+ assertPropertyMigratedCorrectly();
+ }
+
+ @Test
+ public void migration_dont_fail_if_plugin_property_is_missing() throws SQLException {
+ underTest.execute();
+
+ String selectSql = "select count(*) as COUNT from properties where PROP_KEY='sonar.auth.bitbucket.workspaces'";
+ assertThat(db.select(selectSql).stream().map(row -> row.get("COUNT")).collect(Collectors.toList()))
+ .containsExactlyInAnyOrder(0L);
+ }
+
+ @Test
+ public void migration_should_be_reentrant() throws SQLException {
+ insertProperty("sonar.auth.bitbucket.teams", "restriction-value");
+ insertProperty("another.property.not.impacted.by.migration", "some value");
+
+ underTest.execute();
+ // re-entrant
+ underTest.execute();
+
+ assertPropertyMigratedCorrectly();
+ }
+
+ private void assertPropertyMigratedCorrectly() {
+ String selectSql = "select TEXT_VALUE from properties where PROP_KEY='sonar.auth.bitbucket.workspaces'";
+ assertThat(db.select(selectSql).stream().map(row -> row.get("TEXT_VALUE")).collect(Collectors.toList()))
+ .containsExactlyInAnyOrder("restriction-value");
+ }
+
+ private void insertProperty(String key, String value) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("UUID", uuidFactory.create());
+ map.put("PROP_KEY", key);
+ map.put("IS_EMPTY", false);
+ map.put("TEXT_VALUE", value);
+ map.put("CREATED_AT", System.currentTimeMillis());
+ db.executeInsert("properties", map);
+ }
+}
+++ /dev/null
-CREATE TABLE "PROPERTIES"(
- "UUID" VARCHAR(40) NOT NULL,
- "PROP_KEY" VARCHAR(512) NOT NULL,
- "IS_EMPTY" BOOLEAN NOT NULL,
- "TEXT_VALUE" VARCHAR(4000),
- "CLOB_VALUE" CLOB,
- "CREATED_AT" BIGINT NOT NULL,
- "COMPONENT_UUID" VARCHAR(40),
- "USER_UUID" VARCHAR(255)
-);
-ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID");
-CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY");
--- /dev/null
+CREATE TABLE "PROPERTIES"(
+ "UUID" VARCHAR(40) NOT NULL,
+ "PROP_KEY" VARCHAR(512) NOT NULL,
+ "IS_EMPTY" BOOLEAN NOT NULL,
+ "TEXT_VALUE" VARCHAR(4000),
+ "CLOB_VALUE" CLOB,
+ "CREATED_AT" BIGINT NOT NULL,
+ "COMPONENT_UUID" VARCHAR(40),
+ "USER_UUID" VARCHAR(255)
+);
+ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID");
+CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY");
/**
* This is part of the internal API.
* This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/list_bibucketserver_projects">Further information about this action online (including a response example)</a>
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/list_bitbucketserver_projects">Further information about this action online (including a response example)</a>
* @since 8.2
*/
@Generated("sonar-ws-generator")
/**
* This is part of the internal API.
* This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bibucketserver_repos">Further information about this action online (including a response example)</a>
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bitbucketserver_repos">Further information about this action online (including a response example)</a>
* @since 8.2
*/
@Generated("sonar-ws-generator")
/**
* This is part of the internal API.
* This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bibucketserver_repos">Further information about this action online (including a response example)</a>
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bitbucketserver_repos">Further information about this action online (including a response example)</a>
* @since 8.2
*/
@Generated("sonar-ws-generator")
option java_outer_classname = "AlmIntegrations";
option optimize_for = SPEED;
-// WS api/alm_integrations/search_bibucketserver_repos
+// WS api/alm_integrations/search_bitbucketserver_repos
message SearchBitbucketserverReposWsResponse {
optional bool isLastPage = 1;
repeated BBSRepo repositories = 2;
}
-// WS api/alm_integrations/search_bibucketcloud_repos
+// WS api/alm_integrations/search_bitbucketcloud_repos
message SearchBitbucketcloudReposWsResponse {
optional sonarqube.ws.commons.Paging paging = 1;
optional bool isLastPage = 2;
repeated AzureRepo repositories = 2;
}
-// WS api/alm_integrations/list_bibucketserver_projects
+// WS api/alm_integrations/list_bitbucketserver_projects
message ListBitbucketserverProjectsWsResponse {
repeated AlmProject projects = 1;
}