Fix sonar findings (#2705)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -49,6 +49,9 @@ public enum ActionFields implements QueryField {
|
|||||||
this.subEntityAttributes = List.of(subEntityAttributes);
|
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)
|
@Deprecated(since = "0.10.0", forRemoval = true) // remove together with STATUS (with active meaning)
|
||||||
public static Object convertStatusValue(final String value) {
|
public static Object convertStatusValue(final String value) {
|
||||||
final String trimmedValue = value.trim();
|
final String trimmedValue = value.trim();
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ public class MgmtAction extends MgmtBaseEntity {
|
|||||||
@Schema(description = "Type of action", example = "update")
|
@Schema(description = "Type of action", example = "update")
|
||||||
private String type;
|
private String type;
|
||||||
@Deprecated(since = "0.10.0")
|
@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)
|
@Schema(description = "Status of action, use active", example = "finished", deprecated = true)
|
||||||
private String status;
|
private String status;
|
||||||
@Schema(description = "Status of action")
|
@Schema(description = "Status of action")
|
||||||
|
|||||||
@@ -375,26 +375,27 @@ class RsqlTargetFieldTest extends AbstractJpaIntegrationTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void rsqlValidTargetFields() {
|
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" +
|
"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 CONTROLLERID == 0123 and UPDATESTATUS == PENDING and IPADDRESS == 0123 and LASTCONTROLLERREQUESTAT == 0123" +
|
||||||
" and tag == beta",
|
" and tag == beta",
|
||||||
TargetFields.class, JpaTarget.class);
|
TargetFields.class, JpaTarget.class);
|
||||||
QLSupport.getInstance().validate(
|
qlSupport.validate(
|
||||||
"ASSIGNEDDS.name == abcd and ASSIGNEDDS.version == 0123 and INSTALLEDDS.name == abcd and INSTALLEDDS.version == 0123",
|
"ASSIGNEDDS.name == abcd and ASSIGNEDDS.version == 0123 and INSTALLEDDS.name == abcd and INSTALLEDDS.version == 0123",
|
||||||
TargetFields.class, JpaTarget.class);
|
TargetFields.class, JpaTarget.class);
|
||||||
QLSupport.getInstance().validate(
|
qlSupport.validate(
|
||||||
"ATTRIBUTE.subkey1 == test and ATTRIBUTE.subkey2 == test and METADATA.metakey1 == abcd and METADATA.metavalue2 == asdfg",
|
"ATTRIBUTE.subkey1 == test and ATTRIBUTE.subkey2 == test and METADATA.metakey1 == abcd and METADATA.metavalue2 == asdfg",
|
||||||
TargetFields.class, JpaTarget.class);
|
TargetFields.class, JpaTarget.class);
|
||||||
QLSupport.getInstance().validate(
|
qlSupport.validate(
|
||||||
"CREATEDAT =lt= ${NOW_TS} and LASTMODIFIEDAT =ge= ${OVERDUE_TS}",
|
"CREATEDAT =lt= ${NOW_TS} and LASTMODIFIEDAT =ge= ${OVERDUE_TS}",
|
||||||
TargetFields.class, JpaTarget.class);
|
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",
|
"ATTRIBUTE.test.dot == test and ATTRIBUTE.subkey2 == test and METADATA.test.dot == abcd and METADATA.metavalue2 == asdfg",
|
||||||
TargetFields.class, JpaTarget.class);
|
TargetFields.class, JpaTarget.class);
|
||||||
|
|
||||||
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.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) {
|
private void assertRSQLQueryThrowsException(final String rsql) {
|
||||||
|
final QLSupport qlSupport = QLSupport.getInstance();
|
||||||
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
|
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
|
||||||
.isThrownBy(() -> QLSupport.getInstance().validate(rsql, TargetFields.class, JpaTarget.class));
|
.isThrownBy(() -> qlSupport.validate(rsql, TargetFields.class, JpaTarget.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user