Sonar Fixes (#2234)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -45,7 +45,7 @@ public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements Te
|
||||
*/
|
||||
public RemoteTenantAwareEvent(final Object source, final String tenant, final String applicationId) {
|
||||
// due to a bug in Spring Cloud, we cannot pass null for applicationId
|
||||
super(source, applicationId != null ? applicationId : StringUtils.EMPTY);
|
||||
super(source, applicationId != null ? applicationId : StringUtils.EMPTY, DEFAULT_DESTINATION_FACTORY.getDestination(null));
|
||||
this.tenant = tenant;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.Optional;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||
@@ -26,6 +27,7 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
* @param <E> the type of the entity
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Slf4j
|
||||
public class RemoteEntityEvent<E extends TenantAwareBaseEntity> extends RemoteIdEvent {
|
||||
|
||||
|
||||
@@ -40,9 +40,14 @@ public final class RsqlConfigHolder {
|
||||
*/
|
||||
@Value("${hawkbit.rsql.caseInsensitiveDB:false}")
|
||||
private boolean caseInsensitiveDB;
|
||||
@Autowired
|
||||
|
||||
private RsqlVisitorFactory rsqlVisitorFactory;
|
||||
|
||||
@Autowired
|
||||
public void setRsqlVisitorFactory(final RsqlVisitorFactory rsqlVisitorFactory) {
|
||||
this.rsqlVisitorFactory = rsqlVisitorFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated in favour of G2 RSQL visitor. since 0.6.0
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
@Feature("Unit Tests - Repository")
|
||||
@Story("Regular expression helper")
|
||||
public class RegexCharTest {
|
||||
class RegexCharTest {
|
||||
|
||||
private static final int INDEX_FIRST_PRINTABLE_ASCII_CHAR = 32;
|
||||
private static final int INDEX_LAST_PRINTABLE_ASCII_CHAR = 127;
|
||||
@@ -27,7 +27,7 @@ public class RegexCharTest {
|
||||
|
||||
@Test
|
||||
@Description("Verifies every RegexChar can be used to exclusively find the desired characters in a String.")
|
||||
public void allRegexCharsOnlyFindExpectedChars() {
|
||||
void allRegexCharsOnlyFindExpectedChars() {
|
||||
for (final RegexChar character : RegexChar.values()) {
|
||||
switch (character) {
|
||||
case DIGITS:
|
||||
@@ -51,7 +51,7 @@ public class RegexCharTest {
|
||||
|
||||
@Test
|
||||
@Description("Verifies that combinations of RegexChars can be used to find the desired characters in a String.")
|
||||
public void combinedRegexCharsFindExpectedChars() {
|
||||
void combinedRegexCharsFindExpectedChars() {
|
||||
final RegexCharacterCollection greaterAndLessThan = new RegexCharacterCollection(RegexChar.GREATER_THAN,
|
||||
RegexChar.LESS_THAN);
|
||||
final RegexCharacterCollection equalsAndQuestionMark = new RegexCharacterCollection(RegexChar.EQUALS_SYMBOL,
|
||||
|
||||
@@ -28,14 +28,14 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
@Feature("Unit Tests - Repository")
|
||||
@Story("Security Test")
|
||||
public class RepositoryManagementMethodPreAuthorizeAnnotatedTest {
|
||||
class RepositoryManagementMethodPreAuthorizeAnnotatedTest {
|
||||
|
||||
// if some methods are to be excluded
|
||||
private static final Set<Method> METHOD_SECURITY_EXCLUSION = new HashSet<>();
|
||||
|
||||
@Test
|
||||
@Description("Verifies that repository methods are @PreAuthorize annotated")
|
||||
public void repositoryManagementMethodsArePreAuthorizedAnnotated() {
|
||||
void repositoryManagementMethodsArePreAuthorizedAnnotated() {
|
||||
final String packageName = getClass().getPackage().getName();
|
||||
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {
|
||||
final List<? extends Class<?>> matchingClasses = scanResult.getAllClasses()
|
||||
@@ -59,7 +59,7 @@ public class RepositoryManagementMethodPreAuthorizeAnnotatedTest {
|
||||
* checked. The following methods are excluded due inherited from
|
||||
* {@link Object}, like equals() or toString().
|
||||
*
|
||||
* @param clazz the class to retrieve the public declared methods
|
||||
* @param clazz the class to retrieve the declared methods
|
||||
*/
|
||||
private static void assertDeclaredMethodsContainsPreAuthorizeAnnotations(final Class<?> clazz) {
|
||||
final Method[] declaredMethods = clazz.getDeclaredMethods();
|
||||
@@ -72,7 +72,7 @@ public class RepositoryManagementMethodPreAuthorizeAnnotatedTest {
|
||||
}
|
||||
final PreAuthorize annotation = method.getAnnotation(PreAuthorize.class);
|
||||
assertThat(annotation)
|
||||
.as("The public method " + method.getName() + " in class " + clazz.getName() +
|
||||
.as("The method " + method.getName() + " in class " + clazz.getName() +
|
||||
" is not annotated with @PreAuthorize, security leak?")
|
||||
.isNotNull();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user