Fix SonarQube issues (2) (#2205)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -116,6 +116,8 @@ public abstract class AbstractIntegrationTest {
|
||||
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
||||
protected static final int DEFAULT_TEST_WEIGHT = 500;
|
||||
|
||||
protected static final RandomStringUtils RANDOM_STRING_UTILS = RandomStringUtils.secure();
|
||||
|
||||
/**
|
||||
* Number of {@link DistributionSetType}s that exist in every test case. One
|
||||
* generated by using
|
||||
@@ -292,6 +294,14 @@ public abstract class AbstractIntegrationTest {
|
||||
return Comparator.comparing(Target::getControllerId);
|
||||
}
|
||||
|
||||
protected static String randomString(final int len) {
|
||||
return RANDOM_STRING_UTILS.next(len, true, false);
|
||||
}
|
||||
|
||||
protected static byte[] randomBytes(final int len) {
|
||||
return randomString(len).getBytes();
|
||||
}
|
||||
|
||||
protected DistributionSetAssignmentResult assignDistributionSet(final long dsID, final String controllerId) {
|
||||
return assignDistributionSet(dsID, controllerId, ActionType.FORCED);
|
||||
}
|
||||
@@ -477,7 +487,7 @@ public abstract class AbstractIntegrationTest {
|
||||
|
||||
private static String createTempDir() {
|
||||
try {
|
||||
return Files.createTempDirectory(null).toString() + "/" + RandomStringUtils.randomAlphanumeric(20);
|
||||
return Files.createTempDirectory(null).toString() + "/" + randomString(20);
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalStateException("Failed to create temp directory");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractSqlTestDatabase extends AbstractTestExecutionListe
|
||||
|
||||
protected final DatasourceContext context;
|
||||
|
||||
public AbstractSqlTestDatabase(final DatasourceContext context) {
|
||||
protected AbstractSqlTestDatabase(final DatasourceContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user