Fix sonar findings (#2705)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-09-29 13:19:08 +03:00
committed by GitHub
parent a2929757d8
commit ebfaa1d51e
3 changed files with 15 additions and 7 deletions

View File

@@ -49,6 +49,9 @@ public enum ActionFields implements QueryField {
this.subEntityAttributes = List.of(subEntityAttributes);
}
/**
* @deprecated since 0.10.0 - use {@link #ACTIVE} instead of {@link #STATUS}
*/
@Deprecated(since = "0.10.0", forRemoval = true) // remove together with STATUS (with active meaning)
public static Object convertStatusValue(final String value) {
final String trimmedValue = value.trim();

View File

@@ -94,6 +94,9 @@ public class MgmtAction extends MgmtBaseEntity {
@Schema(description = "Type of action", example = "update")
private String type;
@Deprecated(since = "0.10.0")
/**
* @deprecated since 0.10.0 - use {@link #active} instead of {@link #status}
*/
@Schema(description = "Status of action, use active", example = "finished", deprecated = true)
private String status;
@Schema(description = "Status of action")

View File

@@ -375,26 +375,27 @@ class RsqlTargetFieldTest extends AbstractJpaIntegrationTest {
*/
@Test
void rsqlValidTargetFields() {
QLSupport.getInstance().validate(
final QLSupport qlSupport = QLSupport.getInstance();
qlSupport.validate(
"ID == '0123' and NAME == abcd and DESCRIPTION == absd and CREATEDAT =lt= 0123 and LASTMODIFIEDAT =gt= 0123" +
" and CONTROLLERID == 0123 and UPDATESTATUS == PENDING and IPADDRESS == 0123 and LASTCONTROLLERREQUESTAT == 0123" +
" and tag == beta",
TargetFields.class, JpaTarget.class);
QLSupport.getInstance().validate(
qlSupport.validate(
"ASSIGNEDDS.name == abcd and ASSIGNEDDS.version == 0123 and INSTALLEDDS.name == abcd and INSTALLEDDS.version == 0123",
TargetFields.class, JpaTarget.class);
QLSupport.getInstance().validate(
qlSupport.validate(
"ATTRIBUTE.subkey1 == test and ATTRIBUTE.subkey2 == test and METADATA.metakey1 == abcd and METADATA.metavalue2 == asdfg",
TargetFields.class, JpaTarget.class);
QLSupport.getInstance().validate(
qlSupport.validate(
"CREATEDAT =lt= ${NOW_TS} and LASTMODIFIEDAT =ge= ${OVERDUE_TS}",
TargetFields.class, JpaTarget.class);
QLSupport.getInstance().validate(
qlSupport.validate(
"ATTRIBUTE.test.dot == test and ATTRIBUTE.subkey2 == test and METADATA.test.dot == abcd and METADATA.metavalue2 == asdfg",
TargetFields.class, JpaTarget.class);
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
.isThrownBy(() -> QLSupport.getInstance().validate("wrongfield == abcd", TargetFields.class, JpaTarget.class));
.isThrownBy(() -> qlSupport.validate("wrongfield == abcd", TargetFields.class, JpaTarget.class));
}
/**
@@ -448,7 +449,8 @@ class RsqlTargetFieldTest extends AbstractJpaIntegrationTest {
}
private void assertRSQLQueryThrowsException(final String rsql) {
final QLSupport qlSupport = QLSupport.getInstance();
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
.isThrownBy(() -> QLSupport.getInstance().validate(rsql, TargetFields.class, JpaTarget.class));
.isThrownBy(() -> qlSupport.validate(rsql, TargetFields.class, JpaTarget.class));
}
}