diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java index 69616e3767..95ae0364e8 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java @@ -61,8 +61,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt @Test @Description("Verfies that a paged result list of DS tags reflects the content on the repository side.") - @ExpectEvents({ - @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) public void getDistributionSetTags() throws Exception { final List tags = testdataFactory.createDistributionSetTags(2); final DistributionSetTag assigned = tags.get(0); @@ -162,8 +161,7 @@ public void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws @Test @Description("Verfies that a single result of a DS tag reflects the content on the repository side.") - @ExpectEvents({ - @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) public void getDistributionSetTag() throws Exception { final List tags = testdataFactory.createDistributionSetTags(2); final DistributionSetTag assigned = tags.get(0); @@ -181,8 +179,7 @@ public void getDistributionSetTag() throws Exception { @Test @Description("Verifies that created DS tags are stored in the repository as send to the API.") - @ExpectEvents({ - @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) }) public void createDistributionSetTags() throws Exception { final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1") .build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java index 06a2b7339f..4174969567 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java @@ -68,8 +68,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT @Test @Description("Verfies that a paged result list of target tags reflects the content on the repository side.") - @ExpectEvents({ - @Expect(type = TargetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) }) public void getTargetTags() throws Exception { final List tags = testdataFactory.createTargetTags(2, ""); final TargetTag assigned = tags.get(0); @@ -132,8 +131,7 @@ public void getTargetTagsFilteredByColor() throws Exception { @Test @Description("Verfies that a single result of a target tag reflects the content on the repository side.") - @ExpectEvents({ - @Expect(type = TargetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) }) public void getTargetTag() throws Exception { final List tags = testdataFactory.createTargetTags(2, ""); final TargetTag assigned = tags.get(0); @@ -152,8 +150,7 @@ public void getTargetTag() throws Exception { @Test @Description("Verifies that created target tags are stored in the repository as send to the API.") - @ExpectEvents({ - @Expect(type = TargetTagCreatedEvent.class, count = 2) }) + @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) }) public void createTargetTags() throws Exception { final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1") .build(); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaDistributionSetTypeManagement.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaDistributionSetTypeManagement.java index afc80f0876..b7b1c30a9b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaDistributionSetTypeManagement.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaDistributionSetTypeManagement.java @@ -278,8 +278,8 @@ private DistributionSetType assignSoftwareModuleTypes( final Collection foundModules = softwareModuleTypeRepository.findAllById(softwareModulesTypeIds); if (foundModules.size() < softwareModulesTypeIds.size()) { - throw new EntityNotFoundException(SoftwareModuleType.class, softwareModulesTypeIds, - foundModules.stream().map(SoftwareModuleType::getId).toList()); + throw new EntityNotFoundException( + SoftwareModuleType.class, softwareModulesTypeIds, foundModules.stream().map(SoftwareModuleType::getId).toList()); } final JpaDistributionSetType type = findDistributionSetTypeAndThrowExceptionIfNotFound(dsTypeId); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/AbstractJpaTenantAwareBaseEntity.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/AbstractJpaTenantAwareBaseEntity.java index d1e7ec7df1..b6b7e24d77 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/AbstractJpaTenantAwareBaseEntity.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/AbstractJpaTenantAwareBaseEntity.java @@ -27,6 +27,7 @@ import org.eclipse.persistence.annotations.Multitenant; import org.eclipse.persistence.annotations.MultitenantType; import org.eclipse.persistence.annotations.TenantDiscriminatorColumn; +import org.hibernate.annotations.TenantId; /** * Holder of the base attributes common to all tenant aware entities. @@ -43,9 +44,11 @@ public abstract class AbstractJpaTenantAwareBaseEntity extends AbstractJpaBaseEn @Serial private static final long serialVersionUID = 1L; - @Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40) + @Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40) // eclipselink +// @Column(name = "tenant", nullable = false, updatable = false, length = 40) // hibernate @Size(min = 1, max = 40) @NotNull + @TenantId // Hibernate MultiTenant support private String tenant; /** diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/DistributionSetTypeElementCompositeKey.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/DistributionSetTypeElementCompositeKey.java index 0aa6e924de..c06a12462e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/DistributionSetTypeElementCompositeKey.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/DistributionSetTypeElementCompositeKey.java @@ -15,9 +15,15 @@ import jakarta.persistence.Column; import jakarta.persistence.Embeddable; +import lombok.AccessLevel; +import lombok.Data; +import lombok.NoArgsConstructor; + /** * Composite key for {@link DistributionSetTypeElement}. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Data @Embeddable public class DistributionSetTypeElementCompositeKey implements Serializable { @@ -30,75 +36,8 @@ public class DistributionSetTypeElementCompositeKey implements Serializable { @Column(name = "software_module_type", nullable = false, updatable = false) private Long smType; - /** - * Default constructor. - */ - DistributionSetTypeElementCompositeKey() { - } - - /** - * Constructor. - * - * @param dsType in the key - * @param smType in the key - */ DistributionSetTypeElementCompositeKey(final JpaDistributionSetType dsType, final JpaSoftwareModuleType smType) { this.dsType = dsType.getId(); this.smType = smType.getId(); } - - public Long getDsType() { - return dsType; - } - - public void setDsType(final Long dsType) { - this.dsType = dsType; - } - - public Long getSmType() { - return smType; - } - - public void setSmType(final Long smType) { - this.smType = smType; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((dsType == null) ? 0 : dsType.hashCode()); - result = prime * result + ((smType == null) ? 0 : smType.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final DistributionSetTypeElementCompositeKey other = (DistributionSetTypeElementCompositeKey) obj; - if (dsType == null) { - if (other.dsType != null) { - return false; - } - } else if (!dsType.equals(other.dsType)) { - return false; - } - if (smType == null) { - if (other.smType != null) { - return false; - } - } else if (!smType.equals(other.smType)) { - return false; - } - return true; - } - -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java index ab3183acb4..d20457173e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java @@ -22,7 +22,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.Setter; import org.eclipse.hawkbit.repository.model.AutoConfirmationStatus; import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.Target; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java index c295b84ea6..4bcf05c77b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java @@ -79,22 +79,26 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen @Setter @ManyToOne(fetch = FetchType.LAZY, optional = false, targetEntity = JpaDistributionSetType.class) - @JoinColumn(name = "ds_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstype_ds")) + @JoinColumn( + name = "ds_id", nullable = false, updatable = false, + foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstype_ds")) @NotNull private DistributionSetType type; - @ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY) + @ManyToMany( + targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY, + cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable( name = "sp_ds_module", joinColumns = { @JoinColumn( - name = "ds_id", nullable = false, insertable = false, updatable = false, foreignKey = - @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_ds")) }, + name = "ds_id", nullable = false, insertable = false, updatable = false, + foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_ds")) }, inverseJoinColumns = { @JoinColumn( name = "module_id", nullable = false, insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) }) - private Set modules; + private Set modules = new HashSet<>(); @ManyToMany(targetEntity = JpaDistributionSetTag.class) @JoinTable( @@ -107,11 +111,12 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen @JoinColumn( name = "TAG", nullable = false, insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_tag")) }) - private Set tags; + private Set tags = new HashSet<>(); @ToString.Exclude - @OneToMany(mappedBy = "distributionSet", fetch = FetchType.LAZY, cascade = { - CascadeType.REMOVE }, targetEntity = JpaDistributionSetMetadata.class) + @OneToMany(mappedBy = "distributionSet", fetch = FetchType.LAZY, + cascade = { CascadeType.REMOVE }, + targetEntity = JpaDistributionSetMetadata.class) private List metadata; @Column(name = "complete") @@ -131,10 +136,8 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen @Column(name = "required_migration_step") private boolean requiredMigrationStep; - /** - * Parameterized constructor. - */ - public JpaDistributionSet(final String name, final String version, final String description, + public JpaDistributionSet( + final String name, final String version, final String description, final DistributionSetType type, final Collection moduleList, final boolean requiredMigrationStep) { super(name, version, description); @@ -152,9 +155,6 @@ public JpaDistributionSet(final String name, final String version, final String this.requiredMigrationStep = requiredMigrationStep; } - /** - * Parameterized constructor. - */ public JpaDistributionSet(final String name, final String version, final String description, final DistributionSetType type, final Collection moduleList) { this(name, version, description, type, moduleList, false); @@ -162,10 +162,6 @@ public JpaDistributionSet(final String name, final String version, final String @Override public Set getModules() { - if (modules == null) { - return Collections.emptySet(); - } - return Collections.unmodifiableSet(modules); } @@ -174,10 +170,6 @@ public void addModule(final SoftwareModule softwareModule) { throw new LockedException(JpaDistributionSet.class, getId(), "ADD_SOFTWARE_MODULE"); } - if (modules == null) { - modules = new HashSet<>(); - } - checkTypeCompatability(softwareModule); final Optional found = modules.stream() @@ -187,8 +179,7 @@ public void addModule(final SoftwareModule softwareModule) { return; } - final long already = modules.stream() - .filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())).count(); + final long already = modules.stream().filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())).count(); if (already >= softwareModule.getType().getMaxAssignments()) { modules.stream().filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())) @@ -211,10 +202,6 @@ public void removeModule(final SoftwareModule softwareModule) { } public Set getTags() { - if (tags == null) { - return Collections.emptySet(); - } - return Collections.unmodifiableSet(tags); } diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetMetadata.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetMetadata.java index 31a79b72b5..77a9bf2e7e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetMetadata.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetMetadata.java @@ -24,7 +24,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.Setter; import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetTag.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetTag.java index a361a658a9..55e95562e5 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetTag.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetTag.java @@ -75,4 +75,4 @@ public void fireDeleteEvent() { getTenant(), getId(), getClass(), EventPublisherHolder.getInstance().getApplicationId())); } -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetType.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetType.java index 8cc9168b6c..79514a1926 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetType.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSetType.java @@ -59,8 +59,10 @@ public class JpaDistributionSetType extends AbstractJpaTypeEntity implements Dis @Serial private static final long serialVersionUID = 1L; - @OneToMany(mappedBy = "dsType", targetEntity = DistributionSetTypeElement.class, fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, - CascadeType.REMOVE }, orphanRemoval = true) + @OneToMany(mappedBy = "dsType", + targetEntity = DistributionSetTypeElement.class, + fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }, + orphanRemoval = true) private Set elements = new HashSet<>(); @Setter diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModuleMetadata.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModuleMetadata.java index 0ad486c94e..2a5c355dd7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModuleMetadata.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModuleMetadata.java @@ -67,5 +67,4 @@ public JpaSoftwareModuleMetadata(final String key, final SoftwareModule software public SwMetadataCompositeKey getId() { return new SwMetadataCompositeKey(softwareModule.getId(), getKey()); } - } \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetRepository.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetRepository.java index d79198f8c9..1a1bfd479a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetRepository.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetRepository.java @@ -85,7 +85,7 @@ public interface DistributionSetRepository extends BaseEntityRepository findAssignedToTargetDistributionSetsById(@Param("ids") Collection ids); /** @@ -97,7 +97,7 @@ public interface DistributionSetRepository extends BaseEntityRepository findAssignedToRolloutDistributionSetsById(@Param("ids") Collection ids); /** diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetTypeRepository.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetTypeRepository.java index 4a5ee23c80..509400ced2 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetTypeRepository.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/DistributionSetTypeRepository.java @@ -23,31 +23,24 @@ import org.springframework.transaction.annotation.Transactional; /** - * {@link PagingAndSortingRepository} and {@link org.springframework.data.repository.CrudRepository} for - * {@link DistributionSetType}. + * {@link PagingAndSortingRepository} and {@link org.springframework.data.repository.CrudRepository} for {@link DistributionSetType}. */ @Transactional(readOnly = true) -public interface DistributionSetTypeRepository - extends BaseEntityRepository { +public interface DistributionSetTypeRepository extends BaseEntityRepository { /** - * Counts all distribution set type where a specific software module type is - * assigned to. + * Counts all distribution set type where a specific software module type is assigned to. *

* No access control applied * - * @param softwareModuleType the software module type to count the distribution set type - * which has this software module type assigned - * @return the number of {@link DistributionSetType}s in the repository - * assigned to the given software module type + * @param softwareModuleType the software module type to count the distribution set type which has this software module type assigned + * @return the number of {@link DistributionSetType}s in the repository assigned to the given software module type */ long countByElementsSmType(JpaSoftwareModuleType softwareModuleType); /** - * Deletes all {@link TenantAwareBaseEntity} of a given tenant. For safety - * reasons (this is a "delete everything" query after all) we add the tenant - * manually to query even if this will by done by {@link EntityManager} - * anyhow. The DB should take care of optimizing this away. + * Deletes all {@link TenantAwareBaseEntity} of a given tenant. For safety reasons (this is a "delete everything" query after all) we add + * the tenant manually to query even if this will by done by {@link EntityManager} anyhow. The DB should take care of optimizing this away. * * @param tenant to delete data from */ @@ -57,8 +50,7 @@ public interface DistributionSetTypeRepository void deleteByTenant(@Param("tenant") String tenant); /** - * Counts the {@link SoftwareModuleType}s which are associated with the - * addressed {@link DistributionSetType}. + * Counts the {@link SoftwareModuleType}s which are associated with the addressed {@link DistributionSetType}. *

* No access control applied * @@ -67,4 +59,4 @@ public interface DistributionSetTypeRepository */ @Query("SELECT COUNT (e.smType) FROM DistributionSetTypeElement e WHERE e.dsType.id = :id") long countSmTypesById(@Param("id") Long id); -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/TargetRepository.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/TargetRepository.java index 87b7a84951..a731eea796 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/TargetRepository.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/repository/TargetRepository.java @@ -91,4 +91,4 @@ void setAssignedAndInstalledDistributionSetAndUpdateStatus(@Param("status") Targ @Transactional @Query("DELETE FROM JpaTarget t WHERE t.tenant = :tenant") void deleteByTenant(@Param("tenant") String tenant); -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SoftwareModuleSpecification.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SoftwareModuleSpecification.java index b85847c424..193502e627 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SoftwareModuleSpecification.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SoftwareModuleSpecification.java @@ -97,4 +97,4 @@ public static Specification fetchType() { return cb.conjunction(); }; } -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/ControllerManagementTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/ControllerManagementTest.java index dc0f396981..99f1c63f71 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/ControllerManagementTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/ControllerManagementTest.java @@ -1584,8 +1584,7 @@ void deleteTargetWithValidThingId() { @Test @Description("Delete a target with a non existing thingId") - @ExpectEvents({ - @Expect(type = TargetDeletedEvent.class, count = 0) }) + @ExpectEvents({ @Expect(type = TargetDeletedEvent.class, count = 0) }) void deleteTargetWithInvalidThingId() { assertThatExceptionOfType(EntityNotFoundException.class) .as("No EntityNotFoundException thrown when deleting a non-existing target") diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/DistributionSetTypeManagementTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/DistributionSetTypeManagementTest.java index 2013f2f6ba..04b725fdee 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/DistributionSetTypeManagementTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/DistributionSetTypeManagementTest.java @@ -134,7 +134,6 @@ public void updateUnassignedDistributionSetTypeModules() { @Test @Description("Verifies that the quota for software module types per distribution set type is enforced as expected.") public void quotaMaxSoftwareModuleTypes() { - final int quota = quotaManagement.getMaxSoftwareModuleTypesPerDistributionSetType(); // create software module types final List moduleTypeIds = new ArrayList<>(); @@ -168,8 +167,7 @@ public void quotaMaxSoftwareModuleTypes() { // assign as many optional modules as possible final DistributionSetType dsType3 = distributionSetTypeManagement .create(entityFactory.distributionSetType().create().key("dst3").name("dst3")); - distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(dsType3.getId(), - moduleTypeIds.subList(0, quota)); + distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(dsType3.getId(), moduleTypeIds.subList(0, quota)); assertThat(distributionSetTypeManagement.get(dsType3.getId())).isNotEmpty(); assertThat(distributionSetTypeManagement.get(dsType3.getId()).get().getOptionalModuleTypes().size()) .isEqualTo(quota); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/SoftwareModuleManagementTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/SoftwareModuleManagementTest.java index 6b0ab0240b..b719e85f50 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/SoftwareModuleManagementTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/management/SoftwareModuleManagementTest.java @@ -491,7 +491,6 @@ public void findSoftwareModuleByAssignedTo() { @Test @Description("Checks that metadata for a software module can be created.") public void createSoftwareModuleMetadata() { - final String knownKey1 = "myKnownKey1"; final String knownValue1 = "myKnownValue1";