Sonar Fixes (4) (#2210)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -55,7 +55,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
||||
import org.springframework.cloud.bus.ConditionalOnBusEnabled;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.annotation.AdviceMode;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
@@ -98,7 +97,7 @@ public class TestConfiguration implements AsyncConfigurer {
|
||||
public ScheduledExecutorService scheduledExecutorService() {
|
||||
final AtomicLong count = new AtomicLong(0);
|
||||
return new DelegatingSecurityContextScheduledExecutorService(
|
||||
Executors.newScheduledThreadPool(1, (runnable) -> {
|
||||
Executors.newScheduledThreadPool(1, runnable -> {
|
||||
final Thread thread = Executors.defaultThreadFactory().newThread(runnable);
|
||||
thread.setName(
|
||||
String.format(
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAwareUser;
|
||||
@@ -25,6 +27,7 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class SecurityContextSwitch {
|
||||
|
||||
public static final String DEFAULT_TENANT = "DEFAULT";
|
||||
|
||||
@@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -359,9 +359,9 @@ public class TestdataFactory {
|
||||
final boolean isRequiredMigrationStep, final Collection<SoftwareModule> modules) {
|
||||
|
||||
return distributionSetManagement.create(
|
||||
entityFactory.distributionSet().create().name(prefix != null && prefix.length() > 0 ? prefix : "DS")
|
||||
entityFactory.distributionSet().create().name(prefix != null && !prefix.isEmpty() ? prefix : "DS")
|
||||
.version(version).description(randomDescriptionShort()).type(findOrCreateDefaultTestDsType())
|
||||
.modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList()))
|
||||
.modules(modules.stream().map(SoftwareModule::getId).toList())
|
||||
.requiredMigrationStep(isRequiredMigrationStep));
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ public class TestdataFactory {
|
||||
* @return {@link Artifact} entity.
|
||||
*/
|
||||
public Artifact createArtifact(final String artifactData, final Long moduleId, final String filename) {
|
||||
final InputStream stubInputStream = IOUtils.toInputStream(artifactData, Charset.forName("UTF-8"));
|
||||
final InputStream stubInputStream = IOUtils.toInputStream(artifactData, StandardCharsets.UTF_8);
|
||||
return artifactManagement
|
||||
.create(new ArtifactUpload(stubInputStream, moduleId, filename, false, artifactData.length()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user