fixed test
This commit is contained in:
parent
2431fcf6c5
commit
46005a957a
@ -166,7 +166,7 @@ public abstract class EdqsSyncService {
|
|||||||
if (entityIdInfo != null) {
|
if (entityIdInfo != null) {
|
||||||
process(entityIdInfo.tenantId(), RELATION, relation.toData());
|
process(entityIdInfo.tenantId(), RELATION, relation.toData());
|
||||||
} else {
|
} else {
|
||||||
log.info("Relation from entity not found: " + relation.getFromId());
|
log.info("Relation from id not found: {} ", relation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,4 +59,9 @@ public class TenantFields extends AbstractEntityFields {
|
|||||||
public TenantFields(UUID id, Long version) {
|
public TenantFields(UUID id, Long version) {
|
||||||
super(id, 0L, null, version);
|
super(id, 0L, null, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getTenantId() {
|
||||||
|
return getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,11 +207,13 @@ public class RepositoryUtils {
|
|||||||
default -> throw new IllegalStateException();
|
default -> throw new IllegalStateException();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
DataPoint dp = entity.getDataPoint(keyFilter.key(), null);
|
DataKey dataKey = keyFilter.key();
|
||||||
|
DataPoint dp = entity.getDataPoint(dataKey, null);
|
||||||
boolean checkResult = switch (valueType) {
|
boolean checkResult = switch (valueType) {
|
||||||
case STRING -> {
|
case STRING -> {
|
||||||
String str = dp != null ? dp.valueToString() : null;
|
String str = dp != null ? dp.valueToString() : null;
|
||||||
yield str != null && checkKeyFilter(str, keyFilter.predicate());
|
yield (dataKey.type() == EntityKeyType.ENTITY_FIELD) ? (str == null || checkKeyFilter(str, keyFilter.predicate())) :
|
||||||
|
(str != null && checkKeyFilter(str, keyFilter.predicate()));
|
||||||
}
|
}
|
||||||
case BOOLEAN -> {
|
case BOOLEAN -> {
|
||||||
Boolean booleanValue = dp != null ? dp.getBool() : null;
|
Boolean booleanValue = dp != null ? dp.getBool() : null;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
public class RepositoryUtilsTest {
|
public class RepositoryUtilsTest {
|
||||||
|
|
||||||
private static Stream<Arguments> deviceNameFilters() {
|
private static Stream<Arguments> deviceNameFilters() {
|
||||||
return Stream.of(Arguments.of(null, getNameFilter(StringOperation.STARTS_WITH, "lora"), false),
|
return Stream.of(Arguments.of(null, getNameFilter(StringOperation.STARTS_WITH, "lora"), true),
|
||||||
Arguments.of("loranet device 123", getNameFilter(StringOperation.STARTS_WITH, "lora"), true),
|
Arguments.of("loranet device 123", getNameFilter(StringOperation.STARTS_WITH, "lora"), true),
|
||||||
Arguments.of("loranet 123", getNameFilter(StringOperation.STARTS_WITH, "ra"), false),
|
Arguments.of("loranet 123", getNameFilter(StringOperation.STARTS_WITH, "ra"), false),
|
||||||
Arguments.of("loranet 123", getNameFilter(StringOperation.ENDS_WITH, "123"), true),
|
Arguments.of("loranet 123", getNameFilter(StringOperation.ENDS_WITH, "123"), true),
|
||||||
@ -132,7 +132,7 @@ public class RepositoryUtilsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Stream<Arguments> deviceNameComplexFilters() {
|
private static Stream<Arguments> deviceNameComplexFilters() {
|
||||||
return Stream.of(Arguments.of(null, List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "123")), false),
|
return Stream.of(Arguments.of(null, List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "123")), true),
|
||||||
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "123")), true),
|
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "123")), true),
|
||||||
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "124")), false),
|
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.AND, StringOperation.ENDS_WITH, "124")), false),
|
||||||
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.OR, StringOperation.STARTS_WITH, "net")), true),
|
Arguments.of("loranet 123", List.of(getComplexComplexDeviceNameFilter(StringOperation.STARTS_WITH, "lo", ComplexOperation.OR, StringOperation.STARTS_WITH, "net")), true),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user