Extract QL support in a top level module (#2808)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.Node;
|
||||
import org.eclipse.hawkbit.ql.Node;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class NodeTest {
|
||||
@@ -7,14 +7,14 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.ActionFields;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.exception.QueryException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
@@ -22,9 +22,9 @@ import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.qfields.ActionFields;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
|
||||
@@ -65,7 +65,9 @@ class RsqlActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertRSQLQuery(ActionFields.ID.name() + "=in=(" + action.getId() + ",10000000)", 1);
|
||||
assertRSQLQuery(ActionFields.ID.name() + "=out=(" + action.getId() + ",10000000)", 10);
|
||||
}/**
|
||||
}
|
||||
|
||||
/**
|
||||
* Test action by status
|
||||
*/
|
||||
@Test
|
||||
@@ -73,10 +75,10 @@ class RsqlActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
assertRSQLQuery(ActionFields.ACTIVE.name() + "==" + true, 5);
|
||||
assertRSQLQuery(ActionFields.ACTIVE.name() + "!=" + true, 6);
|
||||
assertRSQLQuery(ActionFields.ACTIVE.name() + "=in=(" + true + ")", 5);
|
||||
assertRSQLQuery(ActionFields.ACTIVE.name() + "=out=(" + true +")", 6);
|
||||
assertRSQLQuery(ActionFields.ACTIVE.name() + "=out=(" + true + ")", 6);
|
||||
|
||||
final String rsql = ActionFields.ACTIVE.name() + "==true2";
|
||||
assertThatExceptionOfType(QueryException.class)
|
||||
assertThatExceptionOfType(RSQLParameterSyntaxException.class)
|
||||
.as("RSQLParameterUnsupportedFieldException because active cannot be compared with 'true2'")
|
||||
.isThrownBy(() -> assertRSQLQuery(rsql, 5));
|
||||
}
|
||||
@@ -89,10 +91,10 @@ class RsqlActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
assertRSQLQuery(ActionFields.STATUS.name() + "==" + Status.RUNNING, 5);
|
||||
assertRSQLQuery(ActionFields.STATUS.name() + "!=" + Status.RUNNING, 6);
|
||||
assertRSQLQuery(ActionFields.STATUS.name() + "=in=(" + Status.RUNNING + ")", 5);
|
||||
assertRSQLQuery(ActionFields.STATUS.name() + "=out=(" + Status.RUNNING +")", 6);
|
||||
assertRSQLQuery(ActionFields.STATUS.name() + "=out=(" + Status.RUNNING + ")", 6);
|
||||
|
||||
final String rsql = ActionFields.STATUS.name() + "==not_a_status";
|
||||
assertThatExceptionOfType(QueryException.class)
|
||||
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
|
||||
.as("RSQLParameterUnsupportedFieldException because status cannot be compared with 'not_a_status'")
|
||||
.isThrownBy(() -> assertRSQLQuery(rsql, 5));
|
||||
}
|
||||
@@ -127,11 +129,10 @@ class RsqlActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
}
|
||||
|
||||
private void assertRSQLQuery(final String rsql, final long expectedEntities) {
|
||||
final Slice<Action> findEntity = deploymentManagement.findActionsByTarget(rsql, target.getControllerId(),
|
||||
PageRequest.of(0, 100));
|
||||
final Slice<Action> findEntity = deploymentManagement.findActionsByTarget(rsql, target.getControllerId(), PAGE);
|
||||
final long countAllEntities = deploymentManagement.countActionsByTarget(rsql, target.getControllerId());
|
||||
assertThat(findEntity).isNotNull();
|
||||
assertThat(findEntity.getContent()).hasSize((int)expectedEntities);
|
||||
assertThat(findEntity.getContent()).hasSize((int) expectedEntities);
|
||||
assertThat(countAllEntities).isEqualTo(expectedEntities);
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.eclipse.hawkbit.repository.jpa.rsql.RsqlParser.parse;
|
||||
import static org.eclipse.hawkbit.ql.rsql.RsqlParser.parse;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFields;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -7,17 +7,17 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.RolloutFields;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||
import org.eclipse.hawkbit.repository.qfields.RolloutFields;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -60,7 +60,8 @@ class RsqlRolloutFieldTest extends AbstractJpaIntegrationTest {
|
||||
private Rollout createRollout(final String name, final int amountGroups, final long distributionSetId, final String targetFilterQuery) {
|
||||
return rolloutManagement.create(
|
||||
Create.builder()
|
||||
.distributionSet(distributionSetManagement.find(distributionSetId).get()).name(name).targetFilterQuery(targetFilterQuery)
|
||||
.distributionSet(distributionSetManagement.find(distributionSetId).get()).name(name)
|
||||
.targetFilterQuery(targetFilterQuery)
|
||||
.build(),
|
||||
amountGroups,
|
||||
false,
|
||||
@@ -7,11 +7,10 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.RolloutGroupFields;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
@@ -19,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||
import org.eclipse.hawkbit.repository.qfields.RolloutGroupFields;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -98,11 +98,11 @@ class RsqlRolloutGroupFieldTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(countTargetsAll).isEqualTo(expectedTargets);
|
||||
}
|
||||
|
||||
private Rollout createRollout(final String name, final int amountGroups, final long distributionSetId,
|
||||
final String targetFilterQuery) {
|
||||
private Rollout createRollout(final String name, final int amountGroups, final long distributionSetId, final String targetFilterQuery) {
|
||||
return rolloutManagement.create(
|
||||
Create.builder()
|
||||
.distributionSet(distributionSetManagement.find(distributionSetId).get()).name(name).targetFilterQuery(targetFilterQuery)
|
||||
.distributionSet(distributionSetManagement.find(distributionSetId).get()).name(name)
|
||||
.targetFilterQuery(targetFilterQuery)
|
||||
.build(),
|
||||
amountGroups, false, new RolloutGroupConditionBuilder().withDefaults()
|
||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, "100").build());
|
||||
@@ -7,16 +7,16 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleFields;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule.MetadataValueCreate;
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleFields;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -96,7 +96,7 @@ class RsqlSoftwareModuleFieldTest extends AbstractJpaIntegrationTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test filter software module by name which contain mutated vowels
|
||||
* Test filter software module by name which contain mutated vowels
|
||||
*/
|
||||
@Test
|
||||
void testFilterByParameterNameWithUmlaut() {
|
||||
@@ -7,14 +7,14 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Constants;
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleTypeFields;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleTypeFields;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -7,16 +7,16 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.qfields.TagFields;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.qfields.TagFields;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@@ -15,19 +15,22 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFields;
|
||||
import org.eclipse.hawkbit.ql.QueryException;
|
||||
import org.eclipse.hawkbit.ql.QueryField;
|
||||
import org.eclipse.hawkbit.ql.jpa.QLSupport;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetTypeFields;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.QLSupport;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFields;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetTypeFields;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -344,27 +347,26 @@ class RsqlTargetFieldTest extends AbstractJpaIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void rsqlValidTargetFields() {
|
||||
final QLSupport qlSupport = QLSupport.getInstance();
|
||||
qlSupport.validate(
|
||||
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.validate(
|
||||
validate(
|
||||
"ASSIGNEDDS.name == abcd and ASSIGNEDDS.version == 0123 and INSTALLEDDS.name == abcd and INSTALLEDDS.version == 0123",
|
||||
TargetFields.class, JpaTarget.class);
|
||||
qlSupport.validate(
|
||||
validate(
|
||||
"ATTRIBUTE.subkey1 == test and ATTRIBUTE.subkey2 == test and METADATA.metakey1 == abcd and METADATA.metavalue2 == asdfg",
|
||||
TargetFields.class, JpaTarget.class);
|
||||
qlSupport.validate(
|
||||
validate(
|
||||
"CREATEDAT =lt= ${NOW_TS} and LASTMODIFIEDAT =ge= ${OVERDUE_TS}",
|
||||
TargetFields.class, JpaTarget.class);
|
||||
qlSupport.validate(
|
||||
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.validate("wrongfield == abcd", TargetFields.class, JpaTarget.class));
|
||||
.isThrownBy(() -> validate("wrongfield == abcd", TargetFields.class, JpaTarget.class));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -418,8 +420,15 @@ class RsqlTargetFieldTest extends AbstractJpaIntegrationTest {
|
||||
}
|
||||
|
||||
private void assertRSQLQueryThrowsException(final String rsql) {
|
||||
final QLSupport qlSupport = QLSupport.getInstance();
|
||||
assertThatExceptionOfType(RSQLParameterUnsupportedFieldException.class)
|
||||
.isThrownBy(() -> qlSupport.validate(rsql, TargetFields.class, JpaTarget.class));
|
||||
.isThrownBy(() -> validate(rsql, TargetFields.class, JpaTarget.class));
|
||||
}
|
||||
|
||||
private <A extends Enum<A> & QueryField> void validate(final String query, final Class<A> queryFieldType, final Class<?> jpaType) {
|
||||
try {
|
||||
QLSupport.getInstance().validate(query, queryFieldType, jpaType);
|
||||
} catch (final QueryException e) {
|
||||
throw ExceptionMapper.mapRe(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFilterQueryFields;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFilterQueryFields;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -7,20 +7,20 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
|
||||
import org.eclipse.hawkbit.repository.qfields.QueryField;
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleFields;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFields;
|
||||
import org.eclipse.hawkbit.ql.QueryField;
|
||||
import org.eclipse.hawkbit.ql.jpa.utils.QlToSql;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaRepositoryConfiguration;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.utils.HawkbitQlToSql;
|
||||
import org.eclipse.hawkbit.repository.qfields.SoftwareModuleFields;
|
||||
import org.eclipse.hawkbit.repository.qfields.TargetFields;
|
||||
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -40,7 +40,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
class RsqlToSqlTest {
|
||||
|
||||
private static final boolean FULL = Boolean.getBoolean("full");
|
||||
private HawkbitQlToSql rsqlToSQL;
|
||||
private QlToSql rsqlToSQL;
|
||||
|
||||
@Test
|
||||
void printPG() {
|
||||
@@ -106,16 +106,22 @@ class RsqlToSqlTest {
|
||||
@Test
|
||||
void printComplex() {
|
||||
print(JpaTarget.class, TargetFields.class, "attribute.key1==00 and (attribute.key2==02 or attribute.key2==01)");
|
||||
print(JpaTarget.class, TargetFields.class, "(attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01");
|
||||
print(JpaTarget.class, TargetFields.class, "(attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01 and updateStatus!=pending");
|
||||
print(JpaTarget.class, TargetFields.class, "((attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==03 and updateStatus!=pending)");
|
||||
print(JpaTarget.class, TargetFields.class, "((attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01 and updateStatus!=pending)");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"(attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"(attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01 and updateStatus!=pending");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"((attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==03 and updateStatus!=pending)");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"((attribute.key1==00 or attribute.key1==01) and (attribute.key2==02 or attribute.key2==01) and attribute.key3==01 and updateStatus!=pending)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void printVeryComplex() {
|
||||
print(JpaTarget.class, TargetFields.class, "(attribute.key1==00 or attribute.key1==01) and ((attribute.key2==02 or attribute.key2==01) and (attribute.key4==02 or attribute.key5==01)) and attribute.key3==01 and updateStatus!=pending");
|
||||
print(JpaTarget.class, TargetFields.class, "(attribute.key1==00 or attribute.key1==01) and ((attribute.key2==02 or attribute.key2==01) or (attribute.key4==02 or attribute.key5==01)) and attribute.key3==01 and updateStatus!=pending");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"(attribute.key1==00 or attribute.key1==01) and ((attribute.key2==02 or attribute.key2==01) and (attribute.key4==02 or attribute.key5==01)) and attribute.key3==01 and updateStatus!=pending");
|
||||
print(JpaTarget.class, TargetFields.class,
|
||||
"(attribute.key1==00 or attribute.key1==01) and ((attribute.key2==02 or attribute.key2==01) or (attribute.key4==02 or attribute.key5==01)) and attribute.key3==01 and updateStatus!=pending");
|
||||
}
|
||||
|
||||
private static String from(final String sql) {
|
||||
@@ -124,7 +130,7 @@ class RsqlToSqlTest {
|
||||
|
||||
@PersistenceContext
|
||||
private void setEntityManager(final EntityManager entityManager) {
|
||||
rsqlToSQL = new HawkbitQlToSql(entityManager);
|
||||
rsqlToSQL = new QlToSql(entityManager);
|
||||
}
|
||||
|
||||
private <T, A extends Enum<A> & QueryField> void print(final Class<T> domainClass, final Class<A> fieldsClass, final String rsql) {
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rsql;
|
||||
package org.eclipse.hawkbit.ql.rsql;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -16,9 +16,9 @@ import java.util.concurrent.Callable;
|
||||
|
||||
import org.apache.commons.text.StringSubstitutor;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.repository.helper.SystemSecurityContextHolder;
|
||||
import org.eclipse.hawkbit.repository.helper.TenantConfigurationManagementHolder;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
@@ -1199,7 +1199,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void assignDistributionSetAndAddFinishedActionStatus() {
|
||||
final PageRequest pageRequest = PageRequest.of(0, 100, Direction.ASC, ActionStatusFields.ID.getJpaEntityFieldName());
|
||||
final PageRequest pageRequest = PageRequest.of(0, 100, Direction.ASC, ActionStatusFields.ID.getName());
|
||||
|
||||
final DeploymentResult deployResWithDsA = prepareComplexRepo("undep-A-T", 2, "dep-A-T", 4, 1, "dsA");
|
||||
final DeploymentResult deployResWithDsB = prepareComplexRepo("undep-B-T", 3, "dep-B-T", 5, 1, "dsB");
|
||||
|
||||
Reference in New Issue
Block a user