aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-migration
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2024-10-07 18:13:33 +0200
committersonartech <sonartech@sonarsource.com>2024-10-14 20:03:03 +0000
commit1ad3667d30dd82213ae47bea2c267188f003b2c7 (patch)
tree422f1f66b48114de0e79de9f7bd53aceff3f7c91 /server/sonar-db-migration
parentce2e686a3e269f937ffb51635928cd1a597b2d07 (diff)
downloadsonarqube-1ad3667d30dd82213ae47bea2c267188f003b2c7.tar.gz
sonarqube-1ad3667d30dd82213ae47bea2c267188f003b2c7.zip
NO-JIRA Stop using deprecated methods from RandomStringUtils
Diffstat (limited to 'server/sonar-db-migration')
-rw-r--r--server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java6
-rw-r--r--server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java6
-rw-r--r--server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java9
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilderTest.java12
4 files changed, 16 insertions, 17 deletions
diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java
index 8b05c83ecf4..77f5867c8b7 100644
--- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java
+++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java
@@ -28,7 +28,7 @@ import org.sonar.core.util.UuidFactory;
import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.CoreDbTester;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.server.platform.db.migration.step.ForceReloadingOfAllPlugins.OVERWRITE_HASH;
@@ -74,8 +74,8 @@ class ForceReloadingOfAllPluginsIT {
Map<String, Object> map = new HashMap<>();
String uuid = uuidFactory.create();
map.put("UUID", uuid);
- map.put("KEE", randomAlphabetic(20));
- map.put("FILE_HASH", randomAlphabetic(32));
+ map.put("KEE", secure().nextAlphabetic(20));
+ map.put("FILE_HASH", secure().nextAlphabetic(32));
map.put("CREATED_AT", System.currentTimeMillis());
map.put("UPDATED_AT", System.currentTimeMillis());
map.put("TYPE", "EXTERNAL");
diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java
index 0fa8d7e5ede..99fbca30912 100644
--- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java
+++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java
@@ -29,7 +29,7 @@ import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.MigrationDbTester;
import org.sonar.server.platform.db.migration.step.DataChange;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
class PopulateNclocForForProjectsIT {
@@ -106,7 +106,7 @@ class PopulateNclocForForProjectsIT {
Map<String, Object> map = new HashMap<>();
String uuid = uuidFactory.create();
map.put("UUID", uuid);
- map.put("KEE", randomAlphabetic(20));
+ map.put("KEE", secure().nextAlphabetic(20));
map.put("QUALIFIER", "TRK");
map.put("PRIVATE", true);
map.put("UPDATED_AT", System.currentTimeMillis());
@@ -119,7 +119,7 @@ class PopulateNclocForForProjectsIT {
String uuid = uuidFactory.create();
map.put("UUID", uuid);
map.put("PROJECT_UUID", projectUuid);
- map.put("KEE", randomAlphabetic(20));
+ map.put("KEE", secure().nextAlphabetic(20));
map.put("BRANCH_TYPE", "PULL_REQUEST");
map.put("UPDATED_AT", System.currentTimeMillis());
map.put("CREATED_AT", System.currentTimeMillis());
diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java
index 6e10a1de332..1e3d3b1109b 100644
--- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java
+++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java
@@ -29,8 +29,7 @@ import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.MigrationDbTester;
import org.sonar.server.platform.db.migration.step.DataChange;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
-import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
class UpdateUserLocalValueInUsersIT {
@@ -82,10 +81,10 @@ class UpdateUserLocalValueInUsersIT {
Map<String, Object> map = new HashMap<>();
String uuid = uuidFactory.create();
map.put("UUID", uuid);
- map.put("LOGIN", randomAlphabetic(20));
- map.put("EXTERNAL_LOGIN", randomAlphabetic(20));
+ map.put("LOGIN", secure().nextAlphabetic(20));
+ map.put("EXTERNAL_LOGIN", secure().nextAlphabetic(20));
map.put("EXTERNAL_IDENTITY_PROVIDER", "sonarqube");
- map.put("EXTERNAL_ID", randomNumeric(5));
+ map.put("EXTERNAL_ID", secure().nextNumeric(5));
map.put("CREATED_AT", System.currentTimeMillis());
map.put("USER_LOCAL", userLocal);
map.put("RESET_PASSWORD", false);
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilderTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilderTest.java
index b041f4f9d4d..6542132ace9 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilderTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilderTest.java
@@ -39,12 +39,12 @@ import org.sonar.server.platform.db.migration.def.IntegerColumnDef;
import org.sonar.server.platform.db.migration.def.TinyIntColumnDef;
import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class RenameColumnsBuilderTest {
- private static final String NEW_COLUMN_NAME = "new_" + randomAlphabetic(6).toLowerCase();
+ private static final String NEW_COLUMN_NAME = "new_" + secure().nextAlphabetic(6).toLowerCase();
private static final DatabaseAndResult[] DATABASES = {
new DatabaseAndResult(new H2(), "ALTER TABLE ${table_name} ALTER COLUMN ${old_column_name} RENAME TO ${new_column_name}"),
@@ -94,8 +94,8 @@ public class RenameColumnsBuilderTest {
DatabaseAndResult database,
ColumnDef columnDef) {
- String oldColumnName = "old_" + randomAlphabetic(6).toLowerCase();
- String tableName = "table_" + randomAlphabetic(6).toLowerCase();
+ String oldColumnName = "old_" + secure().nextAlphabetic(6).toLowerCase();
+ String tableName = "table_" + secure().nextAlphabetic(6).toLowerCase();
List<String> result = new RenameColumnsBuilder(database.dialect(), tableName)
.renameColumn(oldColumnName, columnDef)
@@ -123,7 +123,7 @@ public class RenameColumnsBuilderTest {
DatabaseAndResult database,
ColumnDef columnDef) {
- String tableName = "table_" + randomAlphabetic(6).toLowerCase();
+ String tableName = "table_" + secure().nextAlphabetic(6).toLowerCase();
RenameColumnsBuilder renameColumnsBuilder = new RenameColumnsBuilder(database.dialect(), tableName)
.renameColumn(NEW_COLUMN_NAME, columnDef);
@@ -148,7 +148,7 @@ public class RenameColumnsBuilderTest {
ColumnDef columnDef,
String illegalColumnName) {
- String tableName = "table_" + randomAlphabetic(6).toLowerCase();
+ String tableName = "table_" + secure().nextAlphabetic(6).toLowerCase();
RenameColumnsBuilder renameColumnsBuilder = new RenameColumnsBuilder(database.dialect(), tableName)
.renameColumn(illegalColumnName, columnDef);