Fix sub entity attribute formatting (#1326)
* Fix formatting of the sub entity attribute by verifying the formatting against the sub entity attributes list of the related parent property enum. * Verify action API by target property filter
This commit is contained in:
@@ -60,7 +60,7 @@ public abstract class AbstractFieldNameRSQLVisitor<A extends Enum<A> & FieldName
|
||||
|
||||
for (int i = 1; i < graph.length; i++) {
|
||||
|
||||
final String propertyField = graph[i];
|
||||
final String propertyField = getFormattedSubEntityAttribute(propertyEnum ,graph[i]);
|
||||
fieldNameBuilder.append(FieldNameProvider.SUB_ATTRIBUTE_SEPARATOR).append(propertyField);
|
||||
|
||||
// the key of map is not in the graph
|
||||
@@ -110,6 +110,11 @@ public abstract class AbstractFieldNameRSQLVisitor<A extends Enum<A> & FieldName
|
||||
node.getSelector(), getExpectedFieldList()), rootException);
|
||||
}
|
||||
|
||||
private String getFormattedSubEntityAttribute(final A propertyEnum, final String propertyField) {
|
||||
return propertyEnum.getSubEntityAttributes().stream().filter(attr -> attr.equalsIgnoreCase(propertyField))
|
||||
.findFirst().orElse(propertyField);
|
||||
}
|
||||
|
||||
private List<String> getExpectedFieldList() {
|
||||
final List<String> expectedFieldList = Arrays.stream(fieldNameProvider.getEnumConstants())
|
||||
.filter(enumField -> enumField.getSubEntityAttributes().isEmpty()).map(enumField -> {
|
||||
|
||||
@@ -647,7 +647,14 @@ public class TestdataFactory {
|
||||
*/
|
||||
public Target createTarget(final String controllerId, final String targetName) {
|
||||
final Target target = targetManagement
|
||||
.create(entityFactory.target().create().controllerId(controllerId).name(targetName));
|
||||
.create(entityFactory.target().create().controllerId(controllerId).name(targetName));
|
||||
assertTargetProperlyCreated(target);
|
||||
return target;
|
||||
}
|
||||
|
||||
public Target createTarget(final String controllerId, final String targetName, final String address) {
|
||||
final Target target = targetManagement
|
||||
.create(entityFactory.target().create().controllerId(controllerId).name(targetName).address(address));
|
||||
assertTargetProperlyCreated(target);
|
||||
return target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user