Migration to Spring Boot 2.7.10 (#1320)

* Initial commit
* Fix compile breaks
* Fix hibernate config
* Fix hibernate config
* Fix failing tests
* Improve logging
* Improve logging
* Fix Sonar issues
* Remove BusProperties
* Add BusProperties bean back in
* Fix JPA workaround
* Fix CVE-2021-22044
* Fix test failures
* Fix PR review findings
* Fix CVEs
* Remove H2 version downgrade, fix schema migration, enable legacy mode
* Downgrade Vaadin back to 8.14.3
* Fix EventPublisherHolder
* Fix RemoteTenantAwareEvent
* Fixed EventPublisherAutoConfiguration
* New version of spring-hateoas requires links to be expanded (Mgmt API)
* New version of spring-hateoas requires links to be expanded (Mgmt API)
* Fix PR review findings
* Fix PR review findings
* Fix PR review findings
* Update README.md
* MariaDB Java Client downgrade to maintain compatibility with AWS Aurora
* Temporarily disable RSQL test that depends on DB collation type
* Upgrade to boot 2.7.10
* Upgrade snakeyaml to 1.33
* Upgrade Spring Security OAuth2 to version 5.7.7
* Remove obsolete exclusion of junit-vintage-engine
* Upgrade jackson-bom to 2.14.2
This commit is contained in:
Stefan Behl
2023-03-28 07:16:25 +02:00
committed by GitHub
parent f21925d59b
commit 4a3a79aa6b
71 changed files with 741 additions and 593 deletions

View File

@@ -50,7 +50,7 @@ public interface ActionRepository extends BaseEntityRepository<JpaAction, Long>,
* @return the found {@link Action}
*/
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
Optional<Action> getById(Long actionId);
Optional<Action> getActionById(Long actionId);
/**
* Retrieves all {@link Action}s which are referring the given

View File

@@ -233,11 +233,11 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
* Constructor.
*
* @param defaultEventInterval
* default timer value to use for interval between events. This puts
* an upper bound for the timer value
* default timer value to use for interval between events.
* This puts an upper bound for the timer value
* @param minimumEventInterval
* for loading {@link DistributionSet#getModules()}. This puts a
* lower bound to the timer value
* for loading {@link DistributionSet#getModules()}. This
* puts a lower bound to the timer value
* @param timeUnit
* representing the unit of time to be used for timer.
*/
@@ -252,15 +252,16 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
/**
* This method calculates the time interval until the next event based on the
* desired number of events before the time when interval is reset to default.
* The return value is bounded by {@link EventTimer#defaultEventInterval} and
* This method calculates the time interval until the next event based
* on the desired number of events before the time when interval is
* reset to default. The return value is bounded by
* {@link EventTimer#defaultEventInterval} and
* {@link EventTimer#minimumEventInterval}.
*
* @param eventCount
* number of events desired until the interval is reset to default.
* This is not guaranteed as the interval between events cannot be
* less than the minimum interval
* number of events desired until the interval is reset to
* default. This is not guaranteed as the interval between
* events cannot be less than the minimum interval
* @param timerResetTime
* time when exponential forwarding should reset to default
*
@@ -345,8 +346,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
@Override
public List<Action> findActiveActionsWithHighestWeight(final String controllerId,
final int maxActionCount) {
public List<Action> findActiveActionsWithHighestWeight(final String controllerId, final int maxActionCount) {
return findActiveActionsWithHighestWeightConsideringDefault(controllerId, maxActionCount);
}
@@ -357,7 +357,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
@Override
public Optional<Action> findActionWithDetails(final long actionId) {
return actionRepository.getById(actionId);
return actionRepository.getActionById(actionId);
}
@Override
@@ -394,8 +394,9 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
private Target createTarget(final String controllerId, final URI address, final String name) {
final Target result = targetRepository.save((JpaTarget) entityFactory.target().create()
.controllerId(controllerId).description("Plug and Play target: " + controllerId).name((StringUtils.hasText(name) ? name : controllerId))
.status(TargetUpdateStatus.REGISTERED).lastTargetQuery(System.currentTimeMillis())
.controllerId(controllerId).description("Plug and Play target: " + controllerId)
.name((StringUtils.hasText(name) ? name : controllerId)).status(TargetUpdateStatus.REGISTERED)
.lastTargetQuery(System.currentTimeMillis())
.address(Optional.ofNullable(address).map(URI::toString).orElse(null)).build());
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher()
@@ -457,8 +458,9 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
/**
* Sets {@link Target#getLastTargetQuery()} by native SQL in order to avoid
* raising opt lock revision as this update is not mission critical and in fact
* only written by {@link ControllerManagement}, i.e. the target itself.
* raising opt lock revision as this update is not mission critical and in
* fact only written by {@link ControllerManagement}, i.e. the target
* itself.
*/
private void setLastTargetQuery(final String tenant, final long currentTimeMillis, final List<String> chunk) {
final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size());
@@ -486,8 +488,9 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
/**
* Stores target directly to DB in case either {@link Target#getAddress()} or
* {@link Target#getUpdateStatus()} or {@link Target#getName()} changes or the buffer queue is full.
* Stores target directly to DB in case either {@link Target#getAddress()}
* or {@link Target#getUpdateStatus()} or {@link Target#getName()} changes
* or the buffer queue is full.
*
*/
private Target updateTarget(final JpaTarget toUpdate, final URI address, final String name) {
@@ -601,12 +604,13 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
/**
* Handles the case where the {@link Action.Status#DOWNLOADED} status is
* reported by the device. In case the update is finished, a controllerId will
* be returned to trigger a request for attributes.
* reported by the device. In case the update is finished, a controllerId
* will be returned to trigger a request for attributes.
*
* @param action
* updated action
* @return a present controllerId in case the attributes needs to be requested.
* @return a present controllerId in case the attributes needs to be
* requested.
*/
private Optional<String> handleDownloadedActionStatus(final JpaAction action) {
if (!isDownloadOnly(action)) {
@@ -644,12 +648,13 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
/**
* Handles the case where the {@link Action.Status#FINISHED} status is
* reported by the device. In case the update is finished, a controllerId will
* be returned to trigger a request for attributes.
* reported by the device. In case the update is finished, a controllerId
* will be returned to trigger a request for attributes.
*
* @param action
* updated action
* @return a present controllerId in case the attributes needs to be requested.
* @return a present controllerId in case the attributes needs to be
* requested.
*/
private Optional<String> handleFinishedAndStoreInTargetStatus(final JpaAction action) {
final JpaTarget target = (JpaTarget) action.getTarget();
@@ -689,8 +694,8 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
final UpdateMode mode) {
/*
* Constraints on attribute keys & values are not validated by EclipseLink.
* Hence, they are validated here.
* Constraints on attribute keys & values are not validated by
* EclipseLink. Hence, they are validated here.
*/
if (data.entrySet().stream().anyMatch(e -> !isAttributeEntryValid(e))) {
throw new InvalidTargetAttributeException();
@@ -767,8 +772,8 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
/**
* Registers retrieved status for given {@link Target} and {@link Action} if it
* does not exist yet.
* Registers retrieved status for given {@link Target} and {@link Action} if
* it does not exist yet.
*
* @param actionId
* to the handle status for
@@ -1034,8 +1039,8 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
private void cancelAssignDistributionSetEvent(final Action action) {
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher().publishEvent(
new CancelTargetAssignmentEvent(action, eventPublisherHolder.getApplicationId())));
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher()
.publishEvent(new CancelTargetAssignmentEvent(action, eventPublisherHolder.getApplicationId())));
}
// for testing

View File

@@ -391,8 +391,8 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
targetEntitiesIdsChunks.forEach(this::cancelInactiveScheduledActionsForTargets);
setAssignedDistributionSetAndTargetUpdateStatus(assignmentStrategy, distributionSetEntity,
targetEntitiesIdsChunks);
final Map<TargetWithActionType, JpaAction> assignedActions = createActions(initiatedBy, targetsWithActionType, targetEntities,
assignmentStrategy, distributionSetEntity);
final Map<TargetWithActionType, JpaAction> assignedActions = createActions(initiatedBy, targetsWithActionType,
targetEntities, assignmentStrategy, distributionSetEntity);
// create initial action status when action is created so we remember
// the initial running status because we will change the status
// of the action itself and with this action status we have a nicer
@@ -510,7 +510,8 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
final boolean isConfirmationRequired) {
if (actionStatus.getStatus() == Status.WAIT_FOR_CONFIRMATION) {
if (action.getStatus().equals(Status.RUNNING)) {
// action is in RUNNING state only if it's confirmed during assignment already
// action is in RUNNING state only if it's confirmed during
// assignment already
if (!isConfirmationRequired) {
// confirmation given on assignment dialog
actionStatus.addMessage(
@@ -689,9 +690,9 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
return Collections.unmodifiableList(savedActions);
}
private void closeOrCancelOpenDeviceActions(final List<JpaAction> actions){
private void closeOrCancelOpenDeviceActions(final List<JpaAction> actions) {
final List<Long> targetIds = actions.stream().map(JpaAction::getTarget).map(Target::getId)
.collect(Collectors.toList());
.collect(Collectors.toList());
if (isActionsAutocloseEnabled()) {
onlineDsAssignmentStrategy.closeObsoleteUpdateActions(targetIds);
} else {
@@ -741,7 +742,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
@Override
public Optional<Action> findActionWithDetails(final long actionId) {
return actionRepository.getById(actionId);
return actionRepository.getActionById(actionId);
}
@Override
@@ -783,6 +784,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
public List<Action> findActiveActionsWithHighestWeight(final String controllerId, final int maxActionCount) {
return findActiveActionsWithHighestWeightConsideringDefault(controllerId, maxActionCount);
}
@Override
public int getWeightConsideringDefault(final Action action) {
return super.getWeightConsideringDefault(action);
@@ -1006,7 +1008,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
private boolean isConfirmationFlowEnabled() {
return TenantConfigHelper.usingContext(systemSecurityContext, tenantConfigurationManagement)
.isConfirmationFlowEnabled();
.isConfirmationFlowEnabled();
}
private <T extends Serializable> T getConfigValue(final String key, final Class<T> valueType) {

View File

@@ -109,7 +109,7 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.hibernate.validator.BaseHibernateValidatorConfiguration;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -390,7 +390,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
public MethodValidationPostProcessor methodValidationPostProcessor() {
final MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
processor.setValidator(Validation.byDefaultProvider().configure()
.addProperty(HibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS,
.addProperty(BaseHibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS,
"true")
.buildValidatorFactory().getValidator());
return processor;

View File

@@ -1,3 +1,4 @@
ALTER TABLE sp_artifact DROP COLUMN sha1_hash;
ALTER TABLE sp_artifact CHANGE gridfs_file_name sha1_hash varchar(40) not null;
CREATE INDEX sp_idx_artifact_02 ON sp_artifact (tenant, sha1_hash);
ALTER TABLE sp_artifact ALTER COLUMN gridfs_file_name RENAME TO sha1_hash;
ALTER TABLE sp_artifact ALTER sha1_hash varchar(40) not null;
CREATE INDEX sp_idx_artifact_02 ON sp_artifact (tenant, sha1_hash);

View File

@@ -2,14 +2,14 @@ ALTER TABLE sp_rollout ADD COLUMN deleted BOOLEAN;
UPDATE sp_rollout SET deleted = 0;
ALTER TABLE sp_action MODIFY target BIGINT NOT NULL;
ALTER TABLE sp_action MODIFY distribution_set BIGINT NOT NULL;
ALTER TABLE sp_action MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_action_status MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_rollout MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_rollout MODIFY distribution_set BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup MODIFY rollout BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup MODIFY status INTEGER NOT NULL;
ALTER TABLE sp_action ALTER target BIGINT NOT NULL;
ALTER TABLE sp_action ALTER distribution_set BIGINT NOT NULL;
ALTER TABLE sp_action ALTER status INTEGER NOT NULL;
ALTER TABLE sp_action_status ALTER status INTEGER NOT NULL;
ALTER TABLE sp_rollout ALTER status INTEGER NOT NULL;
ALTER TABLE sp_rollout ALTER distribution_set BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup ALTER rollout BIGINT NOT NULL;
ALTER TABLE sp_rolloutgroup ALTER status INTEGER NOT NULL;
ALTER TABLE sp_ds_type_element DROP CONSTRAINT fk_ds_type_element_element;
ALTER TABLE sp_ds_type_element

View File

@@ -26,6 +26,6 @@ ALTER TABLE sp_target
REFERENCES sp_distribution_set (id);
ALTER TABLE sp_target_info DROP CONSTRAINT fk_targ_stat_targ;
ALTER TABLE sp_target_info DROP INDEX sp_idx_target_info_02;
DROP INDEX sp_idx_target_info_02;
DROP TABLE sp_target_info;
DROP TABLE sp_target_info;

View File

@@ -1,8 +1,8 @@
ALTER TABLE sp_action_status DROP INDEX sp_idx_action_status_01;
ALTER TABLE sp_rollout DROP INDEX sp_idx_rollout_01;
ALTER TABLE sp_rolloutgroup DROP INDEX sp_idx_rolloutgroup_01;
ALTER TABLE sp_target DROP INDEX sp_idx_target_02;
ALTER TABLE sp_target_filter_query DROP INDEX sp_idx_target_filter_query_01;
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_01;
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_02;
DROP INDEX sp_idx_action_status_01;
DROP INDEX sp_idx_rollout_01;
DROP INDEX sp_idx_rolloutgroup_01;
DROP INDEX sp_idx_target_02;
DROP INDEX sp_idx_target_filter_query_01;
DROP INDEX sp_idx_distribution_set_01;
DROP INDEX sp_idx_distribution_set_02;
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted, complete);

View File

@@ -4,7 +4,7 @@ CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_action DROP COLUMN action_type;
ALTER TABLE sp_action CHANGE COLUMN action_type_new action_type integer;
ALTER TABLE sp_action ALTER COLUMN action_type_new RENAME TO action_type;
ALTER TABLE sp_rollout ADD COLUMN action_type_new integer not null;
UPDATE sp_rollout SET action_type_new =
@@ -12,7 +12,7 @@ CASE WHEN (action_type = 'SOFT') THEN 1
WHEN (action_type = 'TIMEFORCED') THEN 2
ELSE 0 END;
ALTER TABLE sp_rollout DROP COLUMN action_type;
ALTER TABLE sp_rollout CHANGE COLUMN action_type_new action_type integer;
ALTER TABLE sp_rollout ALTER COLUMN action_type_new RENAME to action_type;
ALTER TABLE sp_target ADD COLUMN update_status_new integer not null;
UPDATE sp_target SET update_status_new =
@@ -22,4 +22,4 @@ CASE WHEN (update_status = 'IN_SYNC') THEN 1
WHEN (update_status = 'REGISTERED') THEN 4
ELSE 0 END;
ALTER TABLE sp_target DROP COLUMN update_status;
ALTER TABLE sp_target CHANGE COLUMN update_status_new update_status integer;
ALTER TABLE sp_target ALTER COLUMN update_status_new RENAME TO update_status;

View File

@@ -1,12 +1,12 @@
ALTER TABLE sp_action_status_messages CHANGE COLUMN detail_message detail_message varchar(512) not null;
ALTER TABLE sp_action CHANGE COLUMN distribution_set distribution_set bigint not null;
ALTER TABLE sp_action CHANGE COLUMN target target bigint not null;
ALTER TABLE sp_action CHANGE COLUMN status status integer not null;
ALTER TABLE sp_action_status CHANGE COLUMN target_occurred_at target_occurred_at bigint not null;
ALTER TABLE sp_action_status CHANGE COLUMN status status integer not null;
ALTER TABLE sp_rollout CHANGE COLUMN distribution_set distribution_set bigint not null;
ALTER TABLE sp_rollout CHANGE COLUMN status status integer not null;
ALTER TABLE sp_rolloutgroup CHANGE COLUMN rollout rollout bigint not null;
ALTER TABLE sp_rolloutgroup CHANGE COLUMN status status integer not null;
ALTER TABLE sp_artifact CHANGE COLUMN sha1_hash sha1_hash varchar(40) not null;
ALTER TABLE sp_target CHANGE COLUMN controller_id controller_id varchar(64) not null;
ALTER TABLE sp_action_status_messages ALTER detail_message varchar(512) not null;
ALTER TABLE sp_action ALTER distribution_set bigint not null;
ALTER TABLE sp_action ALTER target bigint not null;
ALTER TABLE sp_action ALTER status integer not null;
ALTER TABLE sp_action_status ALTER target_occurred_at bigint not null;
ALTER TABLE sp_action_status ALTER status integer not null;
ALTER TABLE sp_rollout ALTER distribution_set bigint not null;
ALTER TABLE sp_rollout ALTER status integer not null;
ALTER TABLE sp_rolloutgroup ALTER rollout bigint not null;
ALTER TABLE sp_rolloutgroup ALTER status integer not null;
ALTER TABLE sp_artifact ALTER sha1_hash varchar(40) not null;
ALTER TABLE sp_target ALTER controller_id varchar(64) not null;

View File

@@ -1,3 +1,3 @@
ALTER TABLE sp_target CHANGE COLUMN update_status update_status integer not null;
ALTER TABLE sp_rollout CHANGE COLUMN action_type action_type integer not null;
ALTER TABLE sp_action CHANGE COLUMN action_type action_type integer not null;
ALTER TABLE sp_target ALTER update_status integer not null;
ALTER TABLE sp_rollout ALTER action_type integer not null;
ALTER TABLE sp_action ALTER action_type integer not null;

View File

@@ -1,5 +1,5 @@
ALTER TABLE sp_target_info MODIFY update_status VARCHAR(16) not null;
ALTER TABLE sp_action MODIFY action_type VARCHAR(16) not null;
ALTER TABLE sp_rollout MODIFY action_type VARCHAR(16) not null;
ALTER TABLE sp_tenant_configuration MODIFY conf_key VARCHAR(128) not null;
ALTER TABLE sp_tenant_configuration MODIFY conf_value VARCHAR(512) not null;
ALTER TABLE sp_target_info ALTER update_status VARCHAR(16) not null;
ALTER TABLE sp_action ALTER action_type VARCHAR(16) not null;
ALTER TABLE sp_rollout ALTER action_type VARCHAR(16) not null;
ALTER TABLE sp_tenant_configuration ALTER conf_key VARCHAR(128) not null;
ALTER TABLE sp_tenant_configuration ALTER conf_value VARCHAR(512) not null;

View File

@@ -12,7 +12,9 @@ spring.main.allow-bean-definition-overriding=true
### JPA / Datasource - START
spring.jpa.database=H2
spring.jpa.show-sql=false
spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;
# need to use legacy mode for now until we can upgrade EclipseLink
# (see details: https://github.com/eclipse-ee4j/eclipselink/issues/1393)
spring.datasource.url=jdbc:h2:mem:testdb;MODE=LEGACY;
# Logging
spring.datasource.eclipselink.logging.logger=JavaLogger
spring.jpa.properties.eclipselink.logging.level=off

View File

@@ -20,11 +20,11 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionProperties;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.junit.jupiter.api.Test;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
@Feature("Component Tests - Repository")
@Story("RemoteTenantAwareEvent Tests")
@@ -109,7 +109,7 @@ public class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
final Action action = actionRepository.save(generateAction);
final TargetAssignDistributionSetEvent assignmentEvent = new TargetAssignDistributionSetEvent(
action.getTenant(), dsA.getId(), Arrays.asList(action), serviceMatcher.getServiceId(),
action.getTenant(), dsA.getId(), Arrays.asList(action), serviceMatcher.getBusId(),
action.isMaintenanceWindowAvailable());
final TargetAssignDistributionSetEvent remoteEventProtoStuff = createProtoStuffEvent(assignmentEvent);
@@ -135,7 +135,7 @@ public class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
final Action action = actionRepository.save(generateAction);
final CancelTargetAssignmentEvent cancelEvent = new CancelTargetAssignmentEvent(action,
serviceMatcher.getServiceId());
serviceMatcher.getBusId());
final CancelTargetAssignmentEvent remoteEventProtoStuff = createProtoStuffEvent(cancelEvent);
assertCancelTargetAssignmentEvent(action, remoteEventProtoStuff);

View File

@@ -1610,7 +1610,7 @@ class ControllerManagementTest extends AbstractJpaIntegrationTest {
}
private void assertLastActionStatusCodeInAction(final Long actionId, final Integer expectedLastActionStatusCode) {
final Optional<Action> action = actionRepository.getById(actionId);
final Optional<Action> action = actionRepository.getActionById(actionId);
assertThat(action).isPresent();
assertThat(action.get().getLastActionStatusCode()).isEqualTo(Optional.ofNullable(expectedLastActionStatusCode));
}

View File

@@ -996,8 +996,8 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
deploymentManagement.assignDistributionSets(Collections.singletonList(valideRequest1)).get(0)).getId();
final Long valideActionId2 = getFirstAssignedAction(
deploymentManagement.assignDistributionSets(Collections.singletonList(valideRequest2)).get(0)).getId();
assertThat(actionRepository.getById(valideActionId1).get().getWeight()).get().isEqualTo(Action.WEIGHT_MAX);
assertThat(actionRepository.getById(valideActionId2).get().getWeight()).get().isEqualTo(Action.WEIGHT_MIN);
assertThat(actionRepository.getActionById(valideActionId1).get().getWeight()).get().isEqualTo(Action.WEIGHT_MAX);
assertThat(actionRepository.getActionById(valideActionId2).get().getWeight()).get().isEqualTo(Action.WEIGHT_MIN);
}
/**

View File

@@ -117,7 +117,7 @@ public class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
autoActionCleanup.run();
assertThat(actionRepository.count()).isEqualTo(1);
assertThat(actionRepository.getById(action3)).isPresent();
assertThat(actionRepository.getActionById(action3)).isPresent();
}
@@ -149,8 +149,8 @@ public class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
autoActionCleanup.run();
assertThat(actionRepository.count()).isEqualTo(2);
assertThat(actionRepository.getById(action2)).isPresent();
assertThat(actionRepository.getById(action3)).isPresent();
assertThat(actionRepository.getActionById(action2)).isPresent();
assertThat(actionRepository.getActionById(action3)).isPresent();
}
@@ -189,7 +189,7 @@ public class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
autoActionCleanup.run();
assertThat(actionRepository.count()).isEqualTo(1);
assertThat(actionRepository.getById(action3)).isPresent();
assertThat(actionRepository.getActionById(action3)).isPresent();
}

View File

@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -91,9 +92,6 @@ public class RSQLSoftwareModuleFieldTest extends AbstractJpaIntegrationTest {
//wildcard entries
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*$*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*§*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ö*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ä*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ü*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*@*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*/*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*&*", 1);
@@ -101,6 +99,15 @@ public class RSQLSoftwareModuleFieldTest extends AbstractJpaIntegrationTest {
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*\\**", 1);
}
@Test
@Description("Test filter software module by name which contain mutated vowels ")
@Disabled("Temporarily disabled because test depends on collation settings of database")
public void testFilterByParameterNameWithUmlaut() {
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ö*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ä*", 1);
assertRSQLQuery(SoftwareModuleFields.NAME.name() + "==*Ü*", 1);
}
@Test
@Description("Test filter software module by description")
public void testFilterByParameterDescription() {