* add `min artifacts` requirement on the Software Module Type level for Software Module completeness * removed `complete` Distribution Set property from DB - calculated runtime * Distribution Set and Software Module completeness is calcualted on demand in memory (TODO: implement cache) * locking of Software Module now requires the software module to be `completed` * removed 'complete' search field for DistributionSet type. Still keep (DEPRECATED) limited support for search with 'complete' - only on the first level of expression and with AND. I.e. complete==true, complete==false and id=in=(1, 3) is suppoted, while complete==false or id=in=(1, 3) and id=in(1, 3) and (type==os and complete==true) are not Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -63,6 +63,8 @@ public interface SoftwareModuleTypeManagement<T extends SoftwareModuleType>
|
||||
|
||||
@Builder.Default
|
||||
private int maxAssignments = 1;
|
||||
@Builder.Default
|
||||
private int minArtifacts;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
|
||||
@@ -28,16 +28,7 @@ public class DistributionSetUpdatedEvent extends RemoteEntityEvent<DistributionS
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean complete;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param distributionSet Distribution Set
|
||||
* @param complete <code>true</code> if {@link DistributionSet} is after the update {@link DistributionSet#isComplete()}
|
||||
*/
|
||||
public DistributionSetUpdatedEvent(final DistributionSet distributionSet, final boolean complete) {
|
||||
public DistributionSetUpdatedEvent(final DistributionSet distributionSet) {
|
||||
super(distributionSet);
|
||||
this.complete = complete;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if a software module is being locked while incomplete (i.e. not enough artifacts are assigned).
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class IncompleteSoftwareModuleException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public IncompleteSoftwareModuleException() {
|
||||
super(SpServerError.SP_DS_INCOMPLETE);
|
||||
}
|
||||
|
||||
public IncompleteSoftwareModuleException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_INCOMPLETE, cause);
|
||||
}
|
||||
|
||||
public IncompleteSoftwareModuleException(final String message) {
|
||||
super(SpServerError.SP_DS_INCOMPLETE, message);
|
||||
}
|
||||
}
|
||||
@@ -39,12 +39,6 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
*/
|
||||
Set<SoftwareModule> getModules();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if all defined {@link DistributionSetType#getMandatoryModuleTypes()} of {@link #getType()} are present in
|
||||
* this {@link DistributionSet}.
|
||||
*/
|
||||
boolean isComplete();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this {@link DistributionSet} is locked. If so it's 'functional' properties (e.g. software modules) could not
|
||||
* be modified anymore.
|
||||
@@ -66,4 +60,12 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
* active and not automatically canceled if overridden by a newer update.
|
||||
*/
|
||||
boolean isRequiredMigrationStep();
|
||||
|
||||
/**
|
||||
* Returns if the distribution set could be assumed as completed. I.e. all requirements (e.g. mandatory software module types) are satisfied.
|
||||
*
|
||||
* @return <code>true</code> if all defined {@link DistributionSetType#getMandatoryModuleTypes()} of {@link #getType()} are present in
|
||||
* this {@link DistributionSet}.
|
||||
*/
|
||||
boolean isComplete();
|
||||
}
|
||||
@@ -29,12 +29,6 @@ public interface DistributionSetType extends Type {
|
||||
*/
|
||||
Set<SoftwareModuleType> getOptionalModuleTypes();
|
||||
|
||||
/**
|
||||
* @param distributionSet to check for completeness
|
||||
* @return <code>true</code> if the all mandatory software module types are in the system.
|
||||
*/
|
||||
boolean checkComplete(DistributionSet distributionSet);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in this {@link DistributionSetType}.
|
||||
*
|
||||
|
||||
@@ -70,6 +70,13 @@ public interface SoftwareModule extends NamedVersionedEntity {
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* Returns if the software module could be assumed as completed. I.e. all requirements (e.g. min artifacts) are satisfied.
|
||||
*
|
||||
* @return <code>true</code> if artifacts are more or equals to {@link SoftwareModuleType#getMinArtifacts()} if the software module type.
|
||||
*/
|
||||
boolean isComplete();
|
||||
|
||||
/**
|
||||
* @param artifactId to look for
|
||||
* @return found {@link Artifact}
|
||||
|
||||
@@ -16,7 +16,12 @@ package org.eclipse.hawkbit.repository.model;
|
||||
public interface SoftwareModuleType extends Type {
|
||||
|
||||
/**
|
||||
* @return maximum assignments of an {@link SoftwareModule} of this type to a {@link DistributionSet}.
|
||||
* @return thet minimum number of artifacts a {@link SoftwareModule} of this type should have in order to be completed.
|
||||
*/
|
||||
int getMinArtifacts();
|
||||
|
||||
/**
|
||||
* @return the maximum assignments of a {@link SoftwareModule} of this type to a {@link DistributionSet}.
|
||||
*/
|
||||
int getMaxAssignments();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL;
|
||||
DROP INDEX sp_idx_distribution_set_01;
|
||||
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted);
|
||||
ALTER TABLE sp_distribution_set DROP COLUMN complete;
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL;
|
||||
ALTER TABLE sp_distribution_set DROP INDEX sp_idx_distribution_set_01;
|
||||
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set (tenant, deleted);
|
||||
ALTER TABLE sp_distribution_set DROP COLUMN complete;
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL;
|
||||
DROP INDEX sp_idx_distribution_set_01;
|
||||
CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set USING BTREE (tenant, deleted);
|
||||
ALTER TABLE sp_distribution_set DROP COLUMN complete;
|
||||
@@ -154,6 +154,10 @@ public class QLSupport implements ApplicationListener<ContextRefreshedEvent> {
|
||||
this.virtualPropertyResolver = virtualPropertyResolver;
|
||||
}
|
||||
|
||||
public <A extends Enum<A> & QueryField> Node parse(final String query, final Class<A> queryFieldType) {
|
||||
return parser.parse(ignoreCase || caseInsensitiveDB ? query.toLowerCase() : query, queryFieldType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a JPA {@link Specification} which corresponds with the given RSQL query. The specification can be used to filter for JPA entities
|
||||
* with the given RSQL query.
|
||||
@@ -168,16 +172,20 @@ public class QLSupport implements ApplicationListener<ContextRefreshedEvent> {
|
||||
public <A extends Enum<A> & QueryField, T> Specification<T> buildSpec(final String query, final Class<A> queryFieldType) {
|
||||
if (specBuilder == SpecBuilder.G3) {
|
||||
return new SpecificationBuilder<T>(ignoreCase && !caseInsensitiveDB , database)
|
||||
.specification(parseAndTransform(query, queryFieldType, ignoreCase || caseInsensitiveDB));
|
||||
.specification(transform(parse(query, queryFieldType), queryFieldType));
|
||||
} else {
|
||||
return new SpecificationBuilderLegacy<A, T>(queryFieldType, virtualPropertyResolver, database).specification(query);
|
||||
}
|
||||
}
|
||||
|
||||
public <A extends Enum<A> & QueryField, T> Specification<T> buildSpec(final Node query, final Class<A> queryFieldType) {
|
||||
return new SpecificationBuilder<T>(ignoreCase && !caseInsensitiveDB , database)
|
||||
.specification(transform(query, queryFieldType));
|
||||
}
|
||||
|
||||
@SuppressWarnings("java:S1117") // it is again ignoreCase
|
||||
public <A extends Enum<A> & QueryField> EntityMatcher entityMatcher(final String query, final Class<A> queryFieldType) {
|
||||
final boolean ignoreCase = this.ignoreCase || caseInsensitiveDB; // sync with DB and case sensitivity requirements
|
||||
return EntityMatcher.of(parseAndTransform(query, queryFieldType, ignoreCase), ignoreCase);
|
||||
return EntityMatcher.of(transform(parse(query, queryFieldType), queryFieldType), ignoreCase || caseInsensitiveDB);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,9 +203,7 @@ public class QLSupport implements ApplicationListener<ContextRefreshedEvent> {
|
||||
buildSpec(query, queryFieldType).toPredicate(criteriaQuery.from((Class) jpaType), criteriaQuery, criteriaBuilder);
|
||||
}
|
||||
|
||||
private <A extends Enum<A> & QueryField> Node parseAndTransform(
|
||||
final String query, final Class<A> queryFieldType, final boolean ignoreCase) {
|
||||
Node node = parser.parse(ignoreCase ? query.toLowerCase() : query, queryFieldType);
|
||||
private <A extends Enum<A> & QueryField> Node transform(Node node, final Class<A> queryFieldType) {
|
||||
for (final NodeTransformer transformer : nodeTransformers) {
|
||||
node = transformer.transform(node, queryFieldType);
|
||||
}
|
||||
|
||||
@@ -13,18 +13,21 @@ import static org.eclipse.hawkbit.repository.jpa.configuration.Constants.TX_RT_D
|
||||
import static org.eclipse.hawkbit.repository.jpa.configuration.Constants.TX_RT_MAX;
|
||||
import static org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey.IMPLICIT_LOCK_ENABLED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetFields;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
||||
@@ -36,17 +39,20 @@ import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet_;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.Node;
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.QLSupport;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.ActionRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetTagRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TargetFilterQueryRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.ql.QLSupport;
|
||||
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlParser;
|
||||
import org.eclipse.hawkbit.repository.jpa.specifications.DistributionSetSpecification;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.QuotaHelper;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
@@ -58,7 +64,9 @@ import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.retry.annotation.Backoff;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -67,8 +75,10 @@ import org.springframework.util.ObjectUtils;
|
||||
|
||||
@Service
|
||||
@ConditionalOnBooleanProperty(prefix = "hawkbit.jpa", name = { "enabled", "distribution-set-management" }, matchIfMissing = true)
|
||||
@Slf4j
|
||||
public class JpaDistributionSetManagement
|
||||
extends AbstractJpaRepositoryWithMetadataManagement<JpaDistributionSet, DistributionSetManagement.Create, DistributionSetManagement.Update, DistributionSetRepository, DistributionSetFields, String, String>
|
||||
extends
|
||||
AbstractJpaRepositoryWithMetadataManagement<JpaDistributionSet, DistributionSetManagement.Create, DistributionSetManagement.Update, DistributionSetRepository, DistributionSetFields, String, String>
|
||||
implements DistributionSetManagement<JpaDistributionSet> {
|
||||
|
||||
private final DistributionSetTagManagement<JpaDistributionSetTag> distributionSetTagManagement;
|
||||
@@ -104,6 +114,46 @@ public class JpaDistributionSetManagement
|
||||
this.repositoryProperties = repositoryProperties;
|
||||
}
|
||||
|
||||
private static final String COMPLETE = "complete";
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("java:S3776") // java:S3776 - just too complex
|
||||
public Page<JpaDistributionSet> findByRsql(final String rsql, final Pageable pageable) {
|
||||
if (rsql != null && rsql.toLowerCase().contains(COMPLETE)) {
|
||||
// limited support for 'complete' - could be removed in future
|
||||
final Node node = RsqlParser.parse(rsql);
|
||||
final Specification<JpaDistributionSet> notDeleted = (root, query, cb) -> cb.equal(root.get(DELETED), false);
|
||||
final List<Specification<JpaDistributionSet>> specList = new ArrayList<>();
|
||||
specList.add(notDeleted);
|
||||
final AtomicReference<Node.Comparison> completedComparison = new AtomicReference<>();
|
||||
if (node instanceof Node.Comparison comparison && COMPLETE.equalsIgnoreCase(comparison.getKey())) {
|
||||
// all not deleted, won't add anything to spec
|
||||
completedComparison.set(comparison);
|
||||
} else if (node instanceof Node.Logical logical && logical.getOp() == Node.Logical.Operator.AND) {
|
||||
final List<Node> sanitizedChildren = new ArrayList<>();
|
||||
logical.getChildren().forEach(child -> {
|
||||
if (child instanceof Node.Comparison comparison && COMPLETE.equalsIgnoreCase(comparison.getKey())) {
|
||||
if (completedComparison.get() != null) {
|
||||
throw new RSQLParameterSyntaxException("Multiple 'complete' comparisons are not supported");
|
||||
}
|
||||
completedComparison.set(comparison);
|
||||
} else {
|
||||
sanitizedChildren.add(child);
|
||||
}
|
||||
});
|
||||
specList.add(QLSupport.getInstance()
|
||||
.buildSpec(new Node.Logical(Node.Logical.Operator.AND, sanitizedChildren), DistributionSetFields.class));
|
||||
}
|
||||
if (completedComparison.get() != null) { // really a comparison
|
||||
log.warn("Usage of 'complete' in RSQL is deprecated and will be removed in future: {}", node);
|
||||
final boolean completed = completeComparison(completedComparison);
|
||||
return filter(JpaManagementHelper.findAllWithCountBySpec(jpaRepository, specList, pageable), completed);
|
||||
}
|
||||
}
|
||||
|
||||
return super.findByRsql(rsql, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDistributionSet update(final Update update) {
|
||||
final JpaDistributionSet updated = super.update(update);
|
||||
@@ -199,7 +249,7 @@ public class JpaDistributionSetManagement
|
||||
if (distributionSet.isLocked()) {
|
||||
return jpaDistributionSet;
|
||||
} else {
|
||||
if (!jpaDistributionSet.isComplete()) {
|
||||
if (!distributionSet.isComplete()) {
|
||||
throw new IncompleteDistributionSetException("Could not be locked while incomplete!");
|
||||
}
|
||||
lockSoftwareModules(jpaDistributionSet);
|
||||
@@ -298,16 +348,13 @@ public class JpaDistributionSetManagement
|
||||
@Override
|
||||
public JpaDistributionSet getValidAndComplete(final long id) {
|
||||
final JpaDistributionSet distributionSet = getValid0(id);
|
||||
|
||||
if (!distributionSet.isComplete()) {
|
||||
throw new IncompleteDistributionSetException(
|
||||
"Distribution set of type " + distributionSet.getType().getKey() + " is incomplete: " + distributionSet.getId());
|
||||
}
|
||||
|
||||
if (distributionSet.isDeleted()) {
|
||||
throw new DeletedException(DistributionSet.class, id);
|
||||
}
|
||||
|
||||
return distributionSet;
|
||||
}
|
||||
|
||||
@@ -357,6 +404,24 @@ public class JpaDistributionSetManagement
|
||||
QuotaHelper.assertAssignmentQuota(requested, maxMetaData, String.class, DistributionSet.class);
|
||||
}
|
||||
|
||||
private static boolean completeComparison(final AtomicReference<Node.Comparison> completeComparison) {
|
||||
final Node.Comparison comparison = completeComparison.get();
|
||||
if (comparison.getOp() == Node.Comparison.Operator.EQ) {
|
||||
return Boolean.parseBoolean(String.valueOf(comparison.getValue()));
|
||||
} else if (comparison.getOp() == Node.Comparison.Operator.NE) {
|
||||
return !Boolean.parseBoolean(String.valueOf(comparison.getValue()));
|
||||
} else {
|
||||
throw new RSQLParameterSyntaxException("Unsupported operator for 'complete': " + comparison.getOp());
|
||||
}
|
||||
}
|
||||
|
||||
private static Page<JpaDistributionSet> filter(final Page<JpaDistributionSet> page, final boolean completed) {
|
||||
final List<JpaDistributionSet> filtered = page.getContent().stream()
|
||||
.filter(ds -> ds.isComplete() == completed)
|
||||
.toList();
|
||||
return new PageImpl<>(filtered, page.getPageable(), page.getTotalElements());
|
||||
}
|
||||
|
||||
private static Collection<Long> notFound(final Collection<Long> distributionSetIds, final List<JpaDistributionSet> foundDistributionSets) {
|
||||
final Map<Long, JpaDistributionSet> foundDistributionSetMap = foundDistributionSets.stream()
|
||||
.collect(Collectors.toMap(JpaDistributionSet::getId, Function.identity()));
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.eclipse.hawkbit.repository.QuotaManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleFields;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteSoftwareModuleException;
|
||||
import org.eclipse.hawkbit.repository.exception.LockedException;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
|
||||
import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
|
||||
@@ -142,6 +143,9 @@ public class JpaSoftwareModuleManagement extends
|
||||
if (jpaSoftwareModule.isLocked()) {
|
||||
return jpaSoftwareModule;
|
||||
} else {
|
||||
if (!softwareModule.isComplete()) {
|
||||
throw new IncompleteSoftwareModuleException("Could not be locked while incomplete!");
|
||||
}
|
||||
jpaSoftwareModule.lock();
|
||||
return jpaRepository.save(jpaSoftwareModule);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.io.Serial;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
@@ -45,13 +46,13 @@ import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.DistributionSetTypeUndefinedException;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.exception.LockedException;
|
||||
import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
@@ -122,9 +123,6 @@ public class JpaDistributionSet
|
||||
@Column(name = "meta_value", length = DistributionSet.METADATA_MAX_VALUE_SIZE)
|
||||
private Map<String, String> metadata = new HashMap<>();
|
||||
|
||||
@Column(name = "complete")
|
||||
private boolean complete;
|
||||
|
||||
@Setter
|
||||
@Column(name = "locked")
|
||||
private boolean locked;
|
||||
@@ -161,6 +159,20 @@ public class JpaDistributionSet
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete() {
|
||||
return Optional.ofNullable(type).map(dsType -> {
|
||||
if (getModules().stream().anyMatch(module -> !module.isComplete())) {
|
||||
return false; // incomplete module
|
||||
}
|
||||
final List<SoftwareModuleType> smTypes = getModules().stream()
|
||||
.map(SoftwareModule::getType)
|
||||
.distinct()
|
||||
.toList();
|
||||
return !smTypes.isEmpty() && new HashSet<>(smTypes).containsAll(dsType.getMandatoryModuleTypes());
|
||||
}).orElse(true);
|
||||
}
|
||||
|
||||
public void addModule(final SoftwareModule softwareModule) {
|
||||
if (isLocked()) {
|
||||
throw new LockedException(JpaDistributionSet.class, getId(), "ADD_SOFTWARE_MODULE");
|
||||
@@ -180,9 +192,7 @@ public class JpaDistributionSet
|
||||
.findAny().ifPresent(modules::remove);
|
||||
}
|
||||
|
||||
if (modules.add(softwareModule)) {
|
||||
complete = type.checkComplete(this);
|
||||
}
|
||||
modules.add(softwareModule);
|
||||
}
|
||||
|
||||
public void removeModule(final SoftwareModule softwareModule) {
|
||||
@@ -190,8 +200,8 @@ public class JpaDistributionSet
|
||||
throw new LockedException(JpaDistributionSet.class, getId(), "REMOVE_SOFTWARE_MODULE");
|
||||
}
|
||||
|
||||
if (modules != null && modules.removeIf(m -> m.getId().equals(softwareModule.getId()))) {
|
||||
complete = type.checkComplete(this);
|
||||
if (modules != null) {
|
||||
modules.removeIf(m -> m.getId().equals(softwareModule.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,20 +209,17 @@ public class JpaDistributionSet
|
||||
return Collections.unmodifiableSet(tags);
|
||||
}
|
||||
|
||||
public boolean addTag(final DistributionSetTag tag) {
|
||||
public void addTag(final DistributionSetTag tag) {
|
||||
if (tags == null) {
|
||||
tags = new HashSet<>();
|
||||
}
|
||||
|
||||
return tags.add(tag);
|
||||
tags.add(tag);
|
||||
}
|
||||
|
||||
public boolean removeTag(final DistributionSetTag tag) {
|
||||
if (tags == null) {
|
||||
return false;
|
||||
public void removeTag(final DistributionSetTag tag) {
|
||||
if (tags != null) {
|
||||
tags.remove(tag);
|
||||
}
|
||||
|
||||
return tags.remove(tag);
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
@@ -226,7 +233,7 @@ public class JpaDistributionSet
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent() {
|
||||
publishEventWithEventPublisher(new DistributionSetUpdatedEvent(this, complete));
|
||||
publishEventWithEventPublisher(new DistributionSetUpdatedEvent(this));
|
||||
|
||||
if (deleted) {
|
||||
publishEventWithEventPublisher(new DistributionSetDeletedEvent(getTenant(), getId(), getClass()));
|
||||
|
||||
@@ -112,15 +112,6 @@ public class JpaDistributionSetType extends AbstractJpaTypeEntity implements Dis
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkComplete(final DistributionSet distributionSet) {
|
||||
final List<SoftwareModuleType> smTypes = distributionSet.getModules().stream()
|
||||
.map(SoftwareModule::getType)
|
||||
.distinct()
|
||||
.toList();
|
||||
return !smTypes.isEmpty() && new HashSet<>(smTypes).containsAll(getMandatoryModuleTypes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DistributionSetType [key=" + getKey() + ", isDeleted()=" + isDeleted() + ", getId()=" + getId() + "]";
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.CollectionTable;
|
||||
@@ -146,6 +147,17 @@ public class JpaSoftwareModule
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete() {
|
||||
return Optional.ofNullable(type).map(smType -> {
|
||||
if (smType.getMinArtifacts() > 0) {
|
||||
return getArtifacts().size() >= smType.getMinArtifacts();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}).orElse(true);
|
||||
}
|
||||
|
||||
public void removeArtifact(final Artifact artifact) {
|
||||
if (isLocked()) {
|
||||
throw new LockedException(JpaSoftwareModule.class, getId(), "REMOVE_ARTIFACT");
|
||||
|
||||
@@ -45,6 +45,11 @@ public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements Soft
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Setter(value = lombok.AccessLevel.PRIVATE) // used via reflection
|
||||
@Column(name = "min_artifacts", nullable = false)
|
||||
@Min(0)
|
||||
private int minArtifacts;
|
||||
|
||||
@Setter(value = lombok.AccessLevel.PRIVATE) // used via reflection
|
||||
@Column(name = "max_ds_assignments", nullable = false)
|
||||
@Min(1)
|
||||
|
||||
@@ -57,26 +57,6 @@ public final class DistributionSetSpecification {
|
||||
return (dsRoot, query, cb) -> cb.equal(dsRoot.get(JpaDistributionSet_.deleted), isDeleted);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by its COMPLETED attribute.
|
||||
*
|
||||
* @param isCompleted TRUE/FALSE are compared to the attribute COMPLETED. If NULL the attribute is ignored
|
||||
* @return the {@link DistributionSet} {@link Specification}
|
||||
*/
|
||||
public static Specification<JpaDistributionSet> isCompleted(final Boolean isCompleted) {
|
||||
return (dsRoot, query, cb) -> cb.equal(dsRoot.get(JpaDistributionSet_.complete), isCompleted);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by its VALID attribute.
|
||||
*
|
||||
* @param isValid TRUE/FALSE are compared to the attribute VALID. If NULL the attribute is ignored
|
||||
* @return the {@link DistributionSet} {@link Specification}
|
||||
*/
|
||||
public static Specification<JpaDistributionSet> isValid(final Boolean isValid) {
|
||||
return (dsRoot, query, cb) -> cb.equal(dsRoot.get(JpaDistributionSet_.valid), isValid);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Specification} for retrieving {@link DistributionSet} with given {@link DistributionSet#getId()}s.
|
||||
*
|
||||
|
||||
@@ -31,7 +31,7 @@ class DistributionSetUpdatedEventTest extends AbstractRemoteEntityEventTest<Dist
|
||||
|
||||
@Override
|
||||
protected RemoteEntityEvent<?> createRemoteEvent(final DistributionSet baseEntity, final Class<? extends RemoteEntityEvent<?>> eventType) {
|
||||
return new DistributionSetUpdatedEvent(baseEntity, true);
|
||||
return new DistributionSetUpdatedEvent(baseEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1357,8 +1357,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
List<? extends DistributionSet> allFoundDS = distributionSetManagement.findAll(PAGE).getContent();
|
||||
assertThat(allFoundDS).as("no ds should be founded").isEmpty();
|
||||
|
||||
assertThat(distributionSetRepository.findAll(JpaManagementHelper.combineWithAnd(
|
||||
List.of(DistributionSetSpecification.isDeleted(true), DistributionSetSpecification.isCompleted(true))), PAGE).getContent())
|
||||
assertThat(distributionSetRepository.findAll(DistributionSetSpecification.isDeleted(true), PAGE).getContent())
|
||||
.as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
||||
|
||||
IntStream.range(0, deploymentResult.getDistributionSets().size()).forEach(i -> testdataFactory.sendUpdateActionStatusToTargets(
|
||||
@@ -1369,9 +1368,8 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
// verify that the result is the same, even though distributionSet dsA has been installed
|
||||
// successfully and no activeAction is referring to created distribution sets
|
||||
allFoundDS = distributionSetManagement.findAll(pageRequest).getContent();
|
||||
assertThat(allFoundDS).as("no ds should be founded").isEmpty();
|
||||
assertThat(distributionSetRepository.findAll(JpaManagementHelper.combineWithAnd(
|
||||
List.of(DistributionSetSpecification.isDeleted(true), DistributionSetSpecification.isCompleted(true))), PAGE).getContent())
|
||||
assertThat(allFoundDS).as("no ds should be found").isEmpty();
|
||||
assertThat(distributionSetRepository.findAll(DistributionSetSpecification.isDeleted(true), PAGE).getContent())
|
||||
.as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,15 @@ package org.eclipse.hawkbit.repository.jpa.management;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatNoException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
@@ -33,6 +34,7 @@ import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
@@ -49,13 +51,16 @@ import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThis
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.ActionCancellationType;
|
||||
import org.eclipse.hawkbit.repository.model.ArtifactUpload;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetInvalidation;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Statistic;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
||||
@@ -688,6 +693,95 @@ class DistributionSetManagementTest extends AbstractRepositoryManagementWithMeta
|
||||
.isThrownBy(() -> distributionSetManagement.getValidAndComplete(distributionSetId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that when no SoftwareModules are assigned to a Distribution then the DistributionSet is not complete.
|
||||
*/
|
||||
@Test
|
||||
void incompleteIfNoSoftwareModulesAssigned() {
|
||||
final SoftwareModuleType softwareModuleType = softwareModuleTypeManagement
|
||||
.create(SoftwareModuleTypeManagement.Create.builder().key("newType").name("new Type").build());
|
||||
|
||||
final DistributionSetType distributionSetType = distributionSetTypeManagement
|
||||
.create(DistributionSetTypeManagement.Create.builder()
|
||||
.key("newType").name("new Type").optionalModuleTypes(Set.of(softwareModuleType)).build());
|
||||
final DistributionSet distributionSetIncomplete = testdataFactory.createDistributionSet(
|
||||
"DistributionOne", "3.1.2", distributionSetType, new ArrayList<>());
|
||||
assertThat(distributionSetIncomplete.isComplete()).isFalse();
|
||||
assertThatExceptionOfType(IncompleteDistributionSetException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.lock(distributionSetIncomplete));
|
||||
final long dsId = distributionSetIncomplete.getId();
|
||||
assertThatExceptionOfType(IncompleteDistributionSetException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.getValidAndComplete(dsId));
|
||||
|
||||
final SoftwareModule softwareModule = softwareModuleManagement
|
||||
.create(SoftwareModuleManagement.Create.builder().name("ds").version("1.0.0").type(softwareModuleType).build());
|
||||
assertThat(softwareModule.isComplete()).isTrue();
|
||||
|
||||
distributionSetManagement.assignSoftwareModules(distributionSetIncomplete.getId(), List.of(softwareModule.getId()));
|
||||
|
||||
final DistributionSet distributionSetComplete = distributionSetManagement.get(distributionSetIncomplete.getId());
|
||||
assertThat(distributionSetComplete.isComplete()).isTrue();
|
||||
assertThatNoException().isThrownBy(() -> distributionSetManagement.lock(distributionSetComplete));
|
||||
assertThat(softwareModuleManagement.get(softwareModule.getId()).isComplete()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void incompleteIfNoSoftwareModuleOfMandatorySoftwareModuleTypeAssigned() {
|
||||
final SoftwareModuleType softwareModuleType = softwareModuleTypeManagement
|
||||
.create(SoftwareModuleTypeManagement.Create.builder().key("newType").name("new Type").build());
|
||||
final DistributionSetType distributionSetType = distributionSetTypeManagement
|
||||
.create(DistributionSetTypeManagement.Create.builder()
|
||||
.key("newType").name("new Type").mandatoryModuleTypes(Set.of(softwareModuleType)).build());
|
||||
final DistributionSet distributionSetIncomplete = testdataFactory.createDistributionSet(
|
||||
"DistributionOne", "3.1.2", distributionSetType, new ArrayList<>());
|
||||
assertThat(distributionSetIncomplete.isComplete()).isFalse();
|
||||
assertThatExceptionOfType(IncompleteDistributionSetException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.lock(distributionSetIncomplete));
|
||||
final long dsId = distributionSetIncomplete.getId();
|
||||
assertThatExceptionOfType(IncompleteDistributionSetException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.getValidAndComplete(dsId));
|
||||
|
||||
final SoftwareModule softwareModule = softwareModuleManagement
|
||||
.create(SoftwareModuleManagement.Create.builder().name("ds").version("1.0.0").type(softwareModuleType).build());
|
||||
assertThat(softwareModule.isComplete()).isTrue();
|
||||
|
||||
distributionSetManagement.assignSoftwareModules(distributionSetIncomplete.getId(), List.of(softwareModule.getId()));
|
||||
|
||||
final DistributionSet distributionSetComplete = distributionSetManagement.get(distributionSetIncomplete.getId());
|
||||
assertThat(distributionSetComplete.isComplete()).isTrue();
|
||||
assertThatNoException().isThrownBy(() -> distributionSetManagement.lock(distributionSetComplete));
|
||||
assertThat(softwareModuleManagement.get(softwareModule.getId()).isComplete()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void incompleteIfDistributionSetSoftwareModuleIsIncomplete() {
|
||||
final SoftwareModuleType softwareModuleType = softwareModuleTypeManagement
|
||||
.create(SoftwareModuleTypeManagement.Create.builder().key("newType").name("new Type").minArtifacts(1).build());
|
||||
final SoftwareModule softwareModuleIncomplete = softwareModuleManagement
|
||||
.create(SoftwareModuleManagement.Create.builder().name("ds").version("1.0.0").type(softwareModuleType).build());
|
||||
assertThat(softwareModuleIncomplete.isComplete()).isFalse();
|
||||
|
||||
final DistributionSetType distributionSetType = distributionSetTypeManagement
|
||||
.create(DistributionSetTypeManagement.Create.builder()
|
||||
.key("newType").name("new Type").optionalModuleTypes(Set.of(softwareModuleType)).build());
|
||||
final DistributionSet distributionSetIncomplete = testdataFactory.createDistributionSet(
|
||||
"DistributionOne", "3.1.2", distributionSetType, new ArrayList<>());
|
||||
assertThat(distributionSetIncomplete.isComplete()).isFalse(); // no software modules assigned yet
|
||||
distributionSetManagement.assignSoftwareModules(distributionSetIncomplete.getId(), List.of(softwareModuleIncomplete.getId()));
|
||||
assertThat(distributionSetIncomplete.isComplete()).isFalse(); // has software module assigned, but incomplete
|
||||
|
||||
// add artifact - so it should become complete
|
||||
artifactManagement.create(new ArtifactUpload(
|
||||
new ByteArrayInputStream(randomBytes(10)), null, 10, null,
|
||||
softwareModuleIncomplete.getId(), "file1", false));
|
||||
assertThat(softwareModuleManagement.get(softwareModuleIncomplete.getId()).isComplete()).isTrue();
|
||||
|
||||
final DistributionSet distributionSetComplete = distributionSetManagement.get(distributionSetIncomplete.getId());
|
||||
assertThat(distributionSetComplete.isComplete()).isTrue();
|
||||
assertThatNoException().isThrownBy(() -> distributionSetManagement.lock(distributionSetComplete));
|
||||
assertThat(softwareModuleManagement.get(softwareModuleIncomplete.getId()).isComplete()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Rollouts count by status statistics for a specific Distribution Set
|
||||
*/
|
||||
|
||||
@@ -108,18 +108,6 @@ class DistributionSetTypeManagementTest extends AbstractRepositoryManagementTest
|
||||
assertThat(distributionSetTypeManagement.count()).isEqualTo(existing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that when no SoftwareModules are assigned to a Distribution then the DistributionSet is not complete.
|
||||
*/
|
||||
@Test
|
||||
void incompleteIfDistributionSetHasNoSoftwareModulesAssigned() {
|
||||
final JpaDistributionSetType jpaDistributionSetType = (JpaDistributionSetType) distributionSetTypeManagement
|
||||
.create(Create.builder().key("newType").name("new Type").build());
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet(
|
||||
"DistributionOne", "3.1.2", jpaDistributionSetType, new ArrayList<>());
|
||||
assertThat(jpaDistributionSetType.checkComplete(distributionSet)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the quota for software module types per distribution set type is enforced as expected.
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.jpa.management;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatNoException;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -25,9 +26,12 @@ import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.exception.ArtifactBinaryNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement.Update;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteSoftwareModuleException;
|
||||
import org.eclipse.hawkbit.repository.exception.LockedException;
|
||||
import org.eclipse.hawkbit.repository.jpa.RandomGeneratedInputStream;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
@@ -419,6 +423,30 @@ class SoftwareModuleManagementTest
|
||||
verifyThrownExceptionBy(() -> softwareModuleManagement.update(Update.builder().id(NOT_EXIST_IDL).build()), "SoftwareModule");
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that when no SoftwareModules are assigned to a Distribution then the DistributionSet is not complete.
|
||||
*/
|
||||
@Test
|
||||
void incompleteIfSoftwareModule() {
|
||||
final SoftwareModuleType softwareModuleType = softwareModuleTypeManagement
|
||||
.create(SoftwareModuleTypeManagement.Create.builder().key("newType").name("new Type").minArtifacts(1).build());
|
||||
final SoftwareModule softwareModuleIncomplete = softwareModuleManagement
|
||||
.create(SoftwareModuleManagement.Create.builder().name("ds").version("1.0.0").type(softwareModuleType).build());
|
||||
assertThat(softwareModuleIncomplete.isComplete()).isFalse();
|
||||
assertThatExceptionOfType(IncompleteSoftwareModuleException.class)
|
||||
.isThrownBy(() -> softwareModuleManagement.lock(softwareModuleIncomplete));
|
||||
|
||||
// add artifact - so it should become complete
|
||||
artifactManagement.create(new ArtifactUpload(
|
||||
new ByteArrayInputStream(randomBytes(10)), null, 10, null,
|
||||
softwareModuleIncomplete.getId(), "file1", false));
|
||||
|
||||
final SoftwareModule softwareModuleComplete = softwareModuleManagement.get(softwareModuleIncomplete.getId());
|
||||
assertThat(softwareModuleComplete.isComplete()).isTrue();
|
||||
assertThatNoException().isThrownBy(() -> softwareModuleManagement.lock(softwareModuleComplete));
|
||||
assertThat(softwareModuleManagement.get(softwareModuleIncomplete.getId()).isComplete()).isTrue();
|
||||
}
|
||||
|
||||
private SoftwareModule createSoftwareModuleWithArtifacts(
|
||||
final SoftwareModuleType type, final String name, final String version, final int numberArtifacts) {
|
||||
final long countSoftwareModule = softwareModuleRepository.count();
|
||||
|
||||
Reference in New Issue
Block a user