Support for MS SQL Server and RabbitMQ 3.7 (#656)
* SQL server support. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Complete SQL server setup. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * DB2 support. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Add new rabbit http client version. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Cleanup JDBC driver dependencies. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Complete test utils for MSSQL. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Add and fix comments Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix Javadoc Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Removed super constr call Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed merge bug. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove non null migrations. Won't work in production. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Added config profile for MS SQL server according to MySQL configuration Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com> * Minor fix in status column Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>
This commit is contained in:
@@ -230,7 +230,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThatExceptionOfType(EntityNotFoundException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.assignTag(assignDS, tag.getId()))
|
||||
.withMessageContaining("DistributionSet").withMessageContaining(String.valueOf(tag.getId()));
|
||||
.withMessageContaining("DistributionSet").withMessageContaining(String.valueOf(100L));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -469,7 +469,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6),
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2) })
|
||||
public void assigneDistributionSetAndAutoCloseActiveActions() {
|
||||
public void assignDistributionSetAndAutoCloseActiveActions() {
|
||||
tenantConfigurationManagement
|
||||
.addOrUpdateConfiguration(TenantConfigurationKey.REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED, true);
|
||||
|
||||
@@ -481,8 +481,9 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
assignDistributionSet(ds1, targets);
|
||||
|
||||
List<Action> assignmentOne = actionRepository.findByDistributionSetId(PAGE, ds1.getId()).getContent();
|
||||
assertThat(assignmentOne).hasSize(10).as("Is active").allMatch(Action::isActive).as("Is assigned DS")
|
||||
.allMatch(action -> action.getDistributionSet().getId() == ds1.getId()).as("Is running")
|
||||
assertThat(assignmentOne).hasSize(10).as("Is active").allMatch(Action::isActive)
|
||||
.as("Is assigned to DS " + ds1.getId())
|
||||
.allMatch(action -> action.getDistributionSet().getId().equals(ds1.getId())).as("Is running")
|
||||
.allMatch(action -> action.getStatus() == Status.RUNNING);
|
||||
|
||||
// Second assignment
|
||||
@@ -491,12 +492,14 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
final List<Action> assignmentTwo = actionRepository.findByDistributionSetId(PAGE, ds2.getId()).getContent();
|
||||
assignmentOne = actionRepository.findByDistributionSetId(PAGE, ds1.getId()).getContent();
|
||||
assertThat(assignmentTwo).hasSize(10).as("Is active").allMatch(Action::isActive).as("Is assigned DS")
|
||||
.allMatch(action -> action.getDistributionSet().getId() == ds2.getId()).as("Is running")
|
||||
assertThat(assignmentTwo).hasSize(10).as("Is active").allMatch(Action::isActive)
|
||||
.as("Is assigned to DS " + ds2.getId())
|
||||
.allMatch(action -> action.getDistributionSet().getId().equals(ds2.getId())).as("Is running")
|
||||
.allMatch(action -> action.getStatus() == Status.RUNNING);
|
||||
assertThat(assignmentOne).hasSize(10).as("Is active").allMatch(action -> !action.isActive())
|
||||
.as("Is assigned to DS").allMatch(action -> action.getDistributionSet().getId() == ds1.getId())
|
||||
.as("Is cancelled").allMatch(action -> action.getStatus() == Status.CANCELED);
|
||||
.as("Is assigned to DS " + ds1.getId())
|
||||
.allMatch(action -> action.getDistributionSet().getId().equals(ds1.getId())).as("Is cancelled")
|
||||
.allMatch(action -> action.getStatus() == Status.CANCELED);
|
||||
|
||||
assertThat(targetManagement.findByAssignedDistributionSet(PAGE, ds2.getId()).getContent()).hasSize(10)
|
||||
.as("InstallationDate not set").allMatch(target -> (target.getInstallationDate() == null));
|
||||
|
||||
@@ -33,8 +33,6 @@ public class RandomGeneratedInputStream extends InputStream {
|
||||
* target size of the stream [byte]
|
||||
*/
|
||||
public RandomGeneratedInputStream(final long size) {
|
||||
super();
|
||||
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(pending, null, null, installedSet.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(1)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(1).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, null,
|
||||
installedSet.getId(), Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsExactly(expected)
|
||||
@@ -197,8 +197,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE, new FilterParams(pending, null, null, null, Boolean.FALSE, targTagW.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(2)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(2).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, null, null,
|
||||
Boolean.FALSE, targTagW.getName())))
|
||||
.as("and contains the following elements").containsAll(expected)
|
||||
@@ -215,8 +215,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(pending, null, null, setA.getId(), Boolean.FALSE, targTagW.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(2)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(2).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, null, setA.getId(),
|
||||
Boolean.FALSE, targTagW.getName())))
|
||||
.as("and contains the following elements").containsAll(expected)
|
||||
@@ -233,8 +233,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(pending, null, "%targ-B%", setA.getId(), Boolean.FALSE, targTagW.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(1)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(1).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, "%targ-B%",
|
||||
setA.getId(), Boolean.FALSE, targTagW.getName())))
|
||||
.as("and contains the following elements").containsExactly(expected)
|
||||
@@ -251,8 +251,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(pending, null, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(1)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(1).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, "%targ-A%",
|
||||
setA.getId(), Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsExactly(expected)
|
||||
@@ -268,8 +268,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE, new FilterParams(pending, null, null, setA.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(3)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(3).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, null, setA.getId(),
|
||||
Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsAll(expected)
|
||||
@@ -284,8 +284,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE, new FilterParams(pending, null, null, null, Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(3)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(3).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(pending, null, null, null,
|
||||
Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsAll(expected)
|
||||
@@ -336,8 +336,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE, new FilterParams(unknown, null, null, setA.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(0)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(0).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(unknown, null, null, setA.getId(),
|
||||
Boolean.FALSE, new String[0])))
|
||||
.as("and filter query returns the same result")
|
||||
@@ -403,8 +403,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(null, null, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(1)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(1).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(null, null, "%targ-A%",
|
||||
setA.getId(), Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsExactly(expected)
|
||||
@@ -419,8 +419,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE, new FilterParams(null, null, null, setA.getId(), Boolean.FALSE, new String[0]))
|
||||
.getContent()).as("has number of elements").hasSize(3)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(3).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(null, null, null, setA.getId(),
|
||||
Boolean.FALSE, new String[0])))
|
||||
.as("and contains the following elements").containsAll(expected)
|
||||
@@ -436,8 +436,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(null, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagX.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(0)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(0).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(null, null, "%targ-C%",
|
||||
setA.getId(), Boolean.FALSE, targTagX.getName())))
|
||||
.as("and filter query returns the same result")
|
||||
@@ -452,8 +452,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(null, null, "%targ-A%", setA.getId(), Boolean.FALSE, targTagW.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(0)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(0).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(null, null, "%targ-A%",
|
||||
setA.getId(), Boolean.FALSE, targTagW.getName())))
|
||||
.as("and filter query returns the same result")
|
||||
@@ -469,8 +469,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(targetManagement
|
||||
.findByFilters(PAGE,
|
||||
new FilterParams(null, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagW.getName()))
|
||||
.getContent()).as("has number of elements").hasSize(1)
|
||||
.as("that number is also returned by count query")
|
||||
.getContent())
|
||||
.as("has number of elements").hasSize(1).as("that number is also returned by count query")
|
||||
.hasSize(Ints.saturatedCast(targetManagement.countByFilters(null, null, "%targ-C%",
|
||||
setA.getId(), Boolean.FALSE, targTagW.getName())))
|
||||
.as("and contains the following elements").containsExactly(expected)
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.Spy;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
@@ -74,6 +75,8 @@ public class RSQLUtilityTest {
|
||||
@Mock
|
||||
private CriteriaBuilder criteriaBuilderMock;
|
||||
|
||||
private final Database testDb = Database.H2;
|
||||
|
||||
@Mock
|
||||
private Attribute attribute;
|
||||
|
||||
@@ -86,8 +89,8 @@ public class RSQLUtilityTest {
|
||||
public void wrongRsqlSyntaxThrowSyntaxException() {
|
||||
final String wrongRSQL = "name==abc;d";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class, null, testDb)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterSyntaxException e) {
|
||||
}
|
||||
@@ -98,8 +101,8 @@ public class RSQLUtilityTest {
|
||||
final String wrongRSQL = "unknownField==abc";
|
||||
when(baseSoftwareModuleRootMock.getJavaType()).thenReturn((Class) SoftwareModule.class);
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class, null, testDb)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing an expected RSQLParameterUnsupportedFieldException because of unknown RSQL field");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
}
|
||||
@@ -110,7 +113,7 @@ public class RSQLUtilityTest {
|
||||
public void wrongRsqlMapSyntaxThrowSyntaxException() {
|
||||
String wrongRSQL = TargetFields.ATTRIBUTE + "==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -118,7 +121,7 @@ public class RSQLUtilityTest {
|
||||
|
||||
wrongRSQL = TargetFields.ATTRIBUTE + ".unkwon.wrong==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -126,8 +129,8 @@ public class RSQLUtilityTest {
|
||||
|
||||
wrongRSQL = DistributionSetFields.METADATA + "==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, DistributionSetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(wrongRSQL, DistributionSetFields.class, null, testDb)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
}
|
||||
@@ -138,7 +141,7 @@ public class RSQLUtilityTest {
|
||||
public void wrongRsqlSubEntitySyntaxThrowSyntaxException() {
|
||||
String wrongRSQL = TargetFields.ASSIGNEDDS + "==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -146,7 +149,7 @@ public class RSQLUtilityTest {
|
||||
|
||||
wrongRSQL = TargetFields.ASSIGNEDDS + ".unknownField==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -154,7 +157,7 @@ public class RSQLUtilityTest {
|
||||
|
||||
wrongRSQL = TargetFields.ASSIGNEDDS + ".unknownField.ToMuch==abc";
|
||||
try {
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(wrongRSQL, TargetFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -173,10 +176,10 @@ public class RSQLUtilityTest {
|
||||
.thenReturn(mock(Predicate.class));
|
||||
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verfication
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
}
|
||||
|
||||
@@ -192,13 +195,13 @@ public class RSQLUtilityTest {
|
||||
when(criteriaBuilderMock.upper(eq(pathOfString(baseSoftwareModuleRootMock))))
|
||||
.thenReturn(pathOfString(baseSoftwareModuleRootMock));
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verfication
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
verify(criteriaBuilderMock, times(1)).notLike(eq(pathOfString(baseSoftwareModuleRootMock)),
|
||||
eq("abc".toUpperCase()));
|
||||
eq("abc".toUpperCase()), eq('\\'));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -213,13 +216,35 @@ public class RSQLUtilityTest {
|
||||
when(criteriaBuilderMock.upper(eq(pathOfString(baseSoftwareModuleRootMock))))
|
||||
.thenReturn(pathOfString(baseSoftwareModuleRootMock));
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, Database.H2)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verfication
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
verify(criteriaBuilderMock, times(1)).like(eq(pathOfString(baseSoftwareModuleRootMock)),
|
||||
eq("a\\%".toUpperCase()));
|
||||
eq("a\\%".toUpperCase()), eq('\\'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctRsqlBuildsLikePredicateWithPercentageSQLServer() {
|
||||
reset(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
final String correctRsql = "name==a%";
|
||||
when(baseSoftwareModuleRootMock.get("name")).thenReturn(baseSoftwareModuleRootMock);
|
||||
when(baseSoftwareModuleRootMock.getJavaType()).thenReturn((Class) SoftwareModule.class);
|
||||
when(criteriaBuilderMock.equal(any(Root.class), anyString())).thenReturn(mock(Predicate.class));
|
||||
when(criteriaBuilderMock.<String> greaterThanOrEqualTo(any(Expression.class), any(String.class)))
|
||||
.thenReturn(mock(Predicate.class));
|
||||
when(criteriaBuilderMock.upper(eq(pathOfString(baseSoftwareModuleRootMock))))
|
||||
.thenReturn(pathOfString(baseSoftwareModuleRootMock));
|
||||
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, Database.SQL_SERVER)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
verify(criteriaBuilderMock, times(1)).like(eq(pathOfString(baseSoftwareModuleRootMock)),
|
||||
eq("a[%]".toUpperCase()), eq('\\'));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -232,10 +257,10 @@ public class RSQLUtilityTest {
|
||||
when(criteriaBuilderMock.<String> greaterThanOrEqualTo(any(Expression.class), any(String.class)))
|
||||
.thenReturn(mock(Predicate.class));
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verfication
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
verify(criteriaBuilderMock, times(1)).lessThan(eq(pathOfString(baseSoftwareModuleRootMock)), eq("abc"));
|
||||
}
|
||||
@@ -249,10 +274,10 @@ public class RSQLUtilityTest {
|
||||
when(criteriaBuilderMock.equal(any(Root.class), anyString())).thenReturn(mock(Predicate.class));
|
||||
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verfication
|
||||
// verification
|
||||
verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
|
||||
verify(criteriaBuilderMock, times(1)).equal(eq(baseSoftwareModuleRootMock), eq(TestValueEnum.BUMLUX));
|
||||
}
|
||||
@@ -267,7 +292,7 @@ public class RSQLUtilityTest {
|
||||
|
||||
try {
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, null).toPredicate(baseSoftwareModuleRootMock,
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, null, testDb).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
fail("missing RSQLParameterUnsupportedFieldException for wrong enum value");
|
||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||
@@ -289,8 +314,8 @@ public class RSQLUtilityTest {
|
||||
.thenReturn(mock(Predicate.class));
|
||||
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, setupMacroLookup()).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, setupMacroLookup(), testDb)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verification
|
||||
verify(macroResolver).lookup(overdueProp);
|
||||
@@ -315,8 +340,8 @@ public class RSQLUtilityTest {
|
||||
.thenReturn(mock(Predicate.class));
|
||||
|
||||
// test
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, setupMacroLookup()).toPredicate(baseSoftwareModuleRootMock,
|
||||
criteriaQueryMock, criteriaBuilderMock);
|
||||
RSQLUtility.parse(correctRsql, TestFieldEnum.class, setupMacroLookup(), testDb)
|
||||
.toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
|
||||
|
||||
// verification
|
||||
verify(macroResolver).lookup(overdueProp);
|
||||
|
||||
@@ -11,3 +11,10 @@
|
||||
hawkbit.server.security.dos.maxStatusEntriesPerAction=10
|
||||
hawkbit.server.security.dos.maxAttributeEntriesPerTarget=10
|
||||
# Quota - END
|
||||
|
||||
# Debug utility functions - START
|
||||
logging.level.org.eclipse.persistence=ERROR
|
||||
spring.jpa.properties.eclipselink.logging.level=FINE
|
||||
spring.jpa.properties.eclipselink.logging.level.sql=FINE
|
||||
spring.jpa.properties.eclipselink.logging.parameters=true
|
||||
# Debug utility functions - END
|
||||
|
||||
Reference in New Issue
Block a user