Remove Rollout(Group) builders (#2603)

* Fix entityManager.merge for ds and sm

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Remove Rollout(Group) builders

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Remove EntityFactory

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-08-11 14:01:03 +03:00
committed by GitHub
parent 861483f0d6
commit 124fef189e
66 changed files with 776 additions and 1753 deletions

View File

@@ -39,7 +39,6 @@ import org.eclipse.hawkbit.repository.DistributionSetInvalidationManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
@@ -57,6 +56,7 @@ import org.eclipse.hawkbit.repository.artifact.ArtifactRepository;
import org.eclipse.hawkbit.repository.artifact.exception.ArtifactStoreException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionStatusCreate;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.DeploymentRequest;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -129,8 +129,6 @@ public abstract class AbstractIntegrationTest {
*/
protected static final int DEFAULT_DS_TYPES = RepositoryConstants.DEFAULT_DS_TYPES_IN_TENANT + 1;
@Autowired
protected EntityFactory entityFactory;
@Autowired
protected SoftwareModuleManagement<? extends SoftwareModule> softwareModuleManagement;
@Autowired
@@ -457,9 +455,9 @@ public abstract class AbstractIntegrationTest {
}
controllerManagement.addUpdateActionStatus(
entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.RUNNING));
ActionStatusCreate.builder().actionId(savedAction.getId()).status(Action.Status.RUNNING).build());
controllerManagement.addUpdateActionStatus(
entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.FINISHED));
ActionStatusCreate.builder().actionId(savedAction.getId()).status(Action.Status.FINISHED).build());
return controllerManagement.findActionWithDetails(savedAction.getId())
.orElseThrow(() -> new EntityNotFoundException(Action.class, savedAction.getId()));

View File

@@ -38,7 +38,6 @@ import org.eclipse.hawkbit.repository.DistributionSetInvalidationManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RolloutHandler;
import org.eclipse.hawkbit.repository.RolloutManagement;
@@ -49,8 +48,8 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement.AutoAssignDist
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetTypeManagement;
import org.eclipse.hawkbit.repository.builder.DynamicRolloutGroupTemplate;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionStatusCreate;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -161,7 +160,6 @@ public class TestdataFactory {
private final RolloutManagement rolloutManagement;
private final RolloutHandler rolloutHandler;
private final QuotaManagement quotaManagement;
private final EntityFactory entityFactory;
private final TenantAware tenantAware;
public TestdataFactory(
@@ -178,8 +176,7 @@ public class TestdataFactory {
final TargetTagManagement<? extends TargetTag> targetTagManagement,
final DeploymentManagement deploymentManagement,
final RolloutManagement rolloutManagement, final RolloutHandler rolloutHandler,
final QuotaManagement quotaManagement,
final EntityFactory entityFactory, final TenantAware tenantAware) {
final QuotaManagement quotaManagement, final TenantAware tenantAware) {
this.controllerManagement = controllerManagement;
this.softwareModuleManagement = softwareModuleManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
@@ -192,7 +189,6 @@ public class TestdataFactory {
this.targetTypeManagement = targetTypeManagement;
this.targetTagManagement = targetTagManagement;
this.deploymentManagement = deploymentManagement;
this.entityFactory = entityFactory;
this.artifactManagement = artifactManagement;
this.rolloutManagement = rolloutManagement;
this.rolloutHandler = rolloutHandler;
@@ -229,6 +225,10 @@ public class TestdataFactory {
return createDistributionSet(prefix, DEFAULT_VERSION, false);
}
public DistributionSet createDistributionSetLocked(final String prefix) {
return distributionSetManagement.lock(createDistributionSet(prefix));
}
/**
* Creates {@link DistributionSet} in repository including three
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
@@ -241,6 +241,11 @@ public class TestdataFactory {
return createDistributionSet(UUID.randomUUID().toString(), DEFAULT_VERSION, false);
}
public DistributionSet createDistributionSetLocked() {
return distributionSetManagement.lock(createDistributionSet());
}
/**
* Creates {@link DistributionSet} in repository including three
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
@@ -1027,21 +1032,22 @@ public class TestdataFactory {
final int groupSize, final String filterQuery, final DistributionSet distributionSet,
final String successCondition, final String errorCondition, final Action.ActionType actionType,
final Integer weight, final boolean confirmationRequired, final boolean dynamic,
final DynamicRolloutGroupTemplate dynamicRolloutGroupTemplate) {
final RolloutManagement.DynamicRolloutGroupTemplate dynamicRolloutGroupTemplate) {
final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder().withDefaults()
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, successCondition)
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, errorCondition)
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
final Rollout rollout = rolloutManagement.create(
entityFactory.rollout().create()
RolloutManagement.Create.builder()
.name(rolloutName)
.description(rolloutDescription)
.targetFilterQuery(filterQuery)
.distributionSetId(distributionSet)
.actionType(actionType)
.distributionSet(distributionSet)
.actionType(actionType == null ? Action.ActionType.FORCED : actionType)
.weight(weight)
.dynamic(dynamic),
.dynamic(dynamic)
.build(),
groupSize, confirmationRequired, conditions, dynamicRolloutGroupTemplate);
// Run here, because Scheduler is disabled during tests
@@ -1259,7 +1265,8 @@ public class TestdataFactory {
}
private Action sendUpdateActionStatusToTarget(final Status status, final Action updActA, final Collection<String> msgs) {
return controllerManagement.addUpdateActionStatus(entityFactory.actionStatus().create(updActA.getId()).status(status).messages(msgs));
return controllerManagement.addUpdateActionStatus(
ActionStatusCreate.builder().actionId(updActA.getId()).status(status).messages(msgs).build());
}
private Rollout startAndReloadRollout(final Rollout rollout) {