Code format hawkbit-repository-core (#1927)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-05 09:46:55 +02:00
committed by GitHub
parent 67eb170f7c
commit da7fa9e022
27 changed files with 182 additions and 233 deletions

View File

@@ -9,56 +9,57 @@
SPDX-License-Identifier: EPL-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hawkbit-repository-core</artifactId>
<name>hawkBit :: Repository :: Core Implementation Support</name>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hawkbit-repository-core</artifactId>
<name>hawkBit :: Repository :: Core Implementation Support</name>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId>
<optional>true</optional>
</dependency>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId>
<optional>true</optional>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -9,6 +9,10 @@
*/
package org.eclipse.hawkbit.event;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtobufIOUtil;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import org.springframework.messaging.Message;
@@ -17,15 +21,10 @@ import org.springframework.messaging.converter.AbstractMessageConverter;
import org.springframework.messaging.converter.MessageConversionException;
import org.springframework.util.MimeType;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtobufIOUtil;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;
/**
* A customize message converter for the spring cloud events. The converter is
* registered for the application/binary+protostuff type.
*
*
* The clazz-type-information is encoded into the message payload infront with a
* length of {@link #EVENT_TYPE_LENGTH}. This is necessary due in case of
* rabbitMQ batching the message headers will be merged together and custom
@@ -85,8 +84,7 @@ public class BusProtoStuffMessageConverter extends AbstractMessageConverter {
log.error("Cannot read clazz header for given EventType value {}, missing mapping", eventType.getValue());
throw new MessageConversionException("Missing mapping of EventType for value " + eventType.getValue());
}
@SuppressWarnings("unchecked")
final Schema<Object> schema = (Schema<Object>) RuntimeSchema.getSchema(targetClass);
@SuppressWarnings("unchecked") final Schema<Object> schema = (Schema<Object>) RuntimeSchema.getSchema(targetClass);
final Object deserializeEvent = schema.newMessage();
ProtobufIOUtil.mergeFrom(content, deserializeEvent, schema);
return deserializeEvent;
@@ -120,8 +118,7 @@ public class BusProtoStuffMessageConverter extends AbstractMessageConverter {
private static byte[] writeContent(final Object payload) {
final Class<?> serializeClass = payload.getClass();
@SuppressWarnings("unchecked")
final Schema<Object> schema = (Schema<Object>) RuntimeSchema.getSchema(serializeClass);
@SuppressWarnings("unchecked") final Schema<Object> schema = (Schema<Object>) RuntimeSchema.getSchema(serializeClass);
final LinkedBuffer buffer = LinkedBuffer.allocate();
return ProtobufIOUtil.toByteArray(payload, schema, buffer);
}
@@ -132,8 +129,7 @@ public class BusProtoStuffMessageConverter extends AbstractMessageConverter {
log.error("There is no mapping to EventType for the given class {}", clazz);
throw new MessageConversionException("Missing EventType for given class : " + clazz);
}
@SuppressWarnings("unchecked")
final Schema<Object> schema = (Schema<Object>) RuntimeSchema
@SuppressWarnings("unchecked") final Schema<Object> schema = (Schema<Object>) RuntimeSchema
.getSchema((Class<?>) EventType.class);
final LinkedBuffer buffer = LinkedBuffer.allocate();
return ProtobufIOUtil.toByteArray(clazzEventType, schema, buffer);

View File

@@ -19,6 +19,7 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTypeDeletedEvent;
@@ -40,7 +41,6 @@ import org.eclipse.hawkbit.repository.event.remote.TargetTypeDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.TenantConfigurationDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdatedEvent;
@@ -83,6 +83,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TenantConfigurationUpd
public class EventType {
private static final Map<Integer, Class<?>> TYPES = new HashMap<>();
private int value;
/**
* The associated event-type-value must remain the same as initially
@@ -170,28 +171,20 @@ public class EventType {
TYPES.put(46, TargetTypeDeletedEvent.class);
}
private int value;
/**
* Constructor.
*
* @param value
* the value to initialize
* @param value the value to initialize
*/
public EventType(final int value) {
this.value = value;
}
public Class<?> getTargetClass() {
return TYPES.get(value);
}
/**
* Returns a {@link EventType} based on the given class type.
*
* @param clazz
* the clazz type to retrieve the corresponding {@link EventType}
* .
* @param clazz the clazz type to retrieve the corresponding {@link EventType}
* .
* @return the corresponding {@link EventType} or {@code null} if the clazz
* does not have a {@link EventType}.
*/
@@ -201,4 +194,8 @@ public class EventType {
return foundEventType.map(EventType::new).orElse(null);
}
public Class<?> getTargetClass() {
return TYPES.get(value);
}
}

View File

@@ -15,15 +15,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* {@link QuotaManagement} implementation based on spring boot
* {@link ConfigurationProperties}.
*
*/
public class PropertiesQuotaManagement implements QuotaManagement {
private final HawkbitSecurityProperties securityProperties;
/**
* @param securityProperties
* that holds the quota definitions
* @param securityProperties that holds the quota definitions
*/
public PropertiesQuotaManagement(final HawkbitSecurityProperties securityProperties) {
this.securityProperties = securityProperties;
@@ -84,11 +82,6 @@ public class PropertiesQuotaManagement implements QuotaManagement {
return securityProperties.getDos().getMaxTargetsPerRolloutGroup();
}
@Override
public int getMaxActionsPerTarget() {
return securityProperties.getDos().getMaxActionsPerTarget();
}
@Override
public int getMaxTargetDistributionSetAssignmentsPerManualAssignment() {
return securityProperties.getDos().getMaxTargetDistributionSetAssignmentsPerManualAssignment();
@@ -99,6 +92,11 @@ public class PropertiesQuotaManagement implements QuotaManagement {
return securityProperties.getDos().getMaxTargetsPerAutoAssignment();
}
@Override
public int getMaxActionsPerTarget() {
return securityProperties.getDos().getMaxActionsPerTarget();
}
@Override
public long getMaxArtifactSize() {
return securityProperties.getDos().getMaxArtifactSize();

View File

@@ -17,7 +17,6 @@ import org.springframework.context.annotation.PropertySource;
/**
* Default configuration that is common to all repository implementations.
*
*/
@Configuration
@EnableConfigurationProperties({ RepositoryProperties.class, ControllerPollProperties.class,

View File

@@ -22,8 +22,7 @@ public interface RolloutApprovalStrategy {
* important according to the implementation, e.g. user roles of the rollout
* creator, state of the system, ....
*
* @param rollout
* rollout to decide for whether approval is needed.
* @param rollout rollout to decide for whether approval is needed.
* @return true if the rollout according to this strategy needs approval.
*/
boolean isApprovalNeeded(Rollout rollout);
@@ -34,8 +33,7 @@ public interface RolloutApprovalStrategy {
* Implementations may also decide to provide an empty implementation for this
* method.
*
* @param rollout
* rollout to create approval task for.
* @param rollout rollout to create approval task for.
*/
void onApprovalRequired(Rollout rollout);
@@ -43,9 +41,8 @@ public interface RolloutApprovalStrategy {
* Returns the user that made a decision to approve or deny the given rollout.
* Depending on the implementation this may be different to the current user eg.
* when the decision is made in an external system.
*
* @param rollout
* target rollout
*
* @param rollout target rollout
* @return identifier of the user that decided on approval
*/
String getApprovalUser(Rollout rollout);

View File

@@ -33,7 +33,7 @@ public final class RolloutHelper {
/**
* Verifies that the required success condition and action are actually set.
*
*
* @param conditions input conditions and actions
*/
public static void verifyRolloutGroupConditions(final RolloutGroupConditions conditions) {
@@ -48,7 +48,7 @@ public final class RolloutHelper {
/**
* Verifies that the group has the required success condition and action and a
* valid target percentage.
*
*
* @param group the input group
* @return the verified group
*/
@@ -68,7 +68,7 @@ public final class RolloutHelper {
/**
* Verify if the supplied amount of groups is in range
*
*
* @param amountGroup amount of groups
* @param quotaManagement to retrieve maximum number of groups allowed
*/
@@ -81,7 +81,7 @@ public final class RolloutHelper {
/**
* Verify that the supplied percentage is in range
*
*
* @param percentage the percentage
*/
public static void verifyRolloutGroupTargetPercentage(final float percentage) {
@@ -95,7 +95,7 @@ public final class RolloutHelper {
/**
* Modifies the target filter query to only match targets that were created
* after the Rollout.
*
*
* @param rollout Rollout to derive the filter from
* @return resulting target filter query
*/
@@ -117,7 +117,7 @@ public final class RolloutHelper {
/**
* Verifies that the Rollout is in the required status.
*
*
* @param rollout the Rollout
* @param status the Status
*/
@@ -130,7 +130,7 @@ public final class RolloutHelper {
/**
* Filters the groups of a Rollout to match a specific status and adds a group
* to the result.
*
*
* @param status the required status for the groups
* @param group the group to add
* @return list of groups
@@ -187,16 +187,6 @@ public final class RolloutHelper {
return baseFilter;
}
private static boolean isTargetFilterInGroups(final String groupFilter, final List<RolloutGroup> groups) {
return !StringUtils.isEmpty(groupFilter)
&& groups.stream().anyMatch(prevGroup -> !StringUtils.isEmpty(prevGroup.getTargetFilterQuery())
&& prevGroup.getTargetFilterQuery().equals(groupFilter));
}
private static String concatAndTargetFilters(final String... filters) {
return "(" + Arrays.stream(filters).collect(Collectors.joining(");(")) + ")";
}
/**
* @param baseFilter the base filter from the rollout
* @param group group for which the filter string should be created
@@ -211,7 +201,7 @@ public final class RolloutHelper {
/**
* Verifies that no targets are left
*
*
* @param targetCount the count of left targets
*/
public static void verifyRemainingTargets(final long targetCount) {
@@ -254,4 +244,14 @@ public final class RolloutHelper {
public static String getIdFromRetriedTargetFilter(final String targetFilter) {
return targetFilter.substring("failedrollout==".length());
}
private static boolean isTargetFilterInGroups(final String groupFilter, final List<RolloutGroup> groups) {
return !StringUtils.isEmpty(groupFilter)
&& groups.stream().anyMatch(prevGroup -> !StringUtils.isEmpty(prevGroup.getTargetFilterQuery())
&& prevGroup.getTargetFilterQuery().equals(groupFilter));
}
private static String concatAndTargetFilters(final String... filters) {
return "(" + Arrays.stream(filters).collect(Collectors.joining(");(")) + ")";
}
}

View File

@@ -17,6 +17,7 @@ import java.util.stream.Collectors;
import jakarta.validation.constraints.NotNull;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.eclipse.hawkbit.cache.TenancyCacheManager;
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
import org.eclipse.hawkbit.repository.event.remote.RolloutDeletedEvent;
@@ -31,26 +32,21 @@ import org.springframework.cache.Cache;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.event.EventListener;
import com.github.benmanes.caffeine.cache.Caffeine;
/**
* Internal cache for Rollout status.
*
*/
public class RolloutStatusCache {
private static final String CACHE_RO_NAME = "RolloutStatus";
private static final String CACHE_GR_NAME = "RolloutGroupStatus";
private static final long DEFAULT_SIZE = 50_000;
private final TenancyCacheManager cacheManager;
private final TenantAware tenantAware;
/**
* @param tenantAware
* to get current tenant
* @param size
* the maximum size of the cache
* @param tenantAware to get current tenant
* @param size the maximum size of the cache
*/
public RolloutStatusCache(final TenantAware tenantAware, final long size) {
this.tenantAware = tenantAware;
@@ -63,8 +59,7 @@ public class RolloutStatusCache {
}
/**
* @param tenantAware
* to get current tenant
* @param tenantAware to get current tenant
*/
public RolloutStatusCache(final TenantAware tenantAware) {
this(tenantAware, DEFAULT_SIZE);
@@ -74,8 +69,7 @@ public class RolloutStatusCache {
* Retrieves cached list of {@link TotalTargetCountActionStatus} of
* {@link Rollout}s.
*
* @param rollouts
* rolloutIds to retrieve cache entries for
* @param rollouts rolloutIds to retrieve cache entries for
* @return map of cached entries
*/
public Map<Long, List<TotalTargetCountActionStatus>> getRolloutStatus(final List<Long> rollouts) {
@@ -86,8 +80,7 @@ public class RolloutStatusCache {
* Retrieves cached list of {@link TotalTargetCountActionStatus} of
* {@link Rollout}s.
*
* @param rolloutId
* to retrieve cache entries for
* @param rolloutId to retrieve cache entries for
* @return map of cached entries
*/
public List<TotalTargetCountActionStatus> getRolloutStatus(final Long rolloutId) {
@@ -98,8 +91,7 @@ public class RolloutStatusCache {
* Retrieves cached list of {@link TotalTargetCountActionStatus} of
* {@link RolloutGroup}s.
*
* @param rolloutGroups
* rolloutGroupsIds to retrieve cache entries for
* @param rolloutGroups rolloutGroupsIds to retrieve cache entries for
* @return map of cached entries
*/
public Map<Long, List<TotalTargetCountActionStatus>> getRolloutGroupStatus(final List<Long> rolloutGroups) {
@@ -110,8 +102,7 @@ public class RolloutStatusCache {
* Retrieves cached list of {@link TotalTargetCountActionStatus} of
* {@link RolloutGroup}.
*
* @param groupId
* to retrieve cache entries for
* @param groupId to retrieve cache entries for
* @return map of cached entries
*/
public List<TotalTargetCountActionStatus> getRolloutGroupStatus(final Long groupId) {
@@ -122,8 +113,7 @@ public class RolloutStatusCache {
* Put map of {@link TotalTargetCountActionStatus} for multiple
* {@link Rollout}s into cache.
*
* @param put
* map of cached entries
* @param put map of cached entries
*/
public void putRolloutStatus(final Map<Long, List<TotalTargetCountActionStatus>> put) {
putIntoCache(put, getRolloutStatusCache());
@@ -133,23 +123,18 @@ public class RolloutStatusCache {
* Put {@link TotalTargetCountActionStatus} for one {@link Rollout}s into
* cache.
*
* @param rolloutId
* the cache entries belong to
* @param status
* list to cache
*
* @param rolloutId the cache entries belong to
* @param status list to cache
*/
public void putRolloutStatus(final Long rolloutId, final List<TotalTargetCountActionStatus> status) {
putIntoCache(rolloutId, status, getRolloutStatusCache());
}
/**
* Put {@link TotalTargetCountActionStatus} for multiple
* {@link RolloutGroup}s into cache.
*
* @param put
* map of cached entries
* @param put map of cached entries
*/
public void putRolloutGroupStatus(final Map<Long, List<TotalTargetCountActionStatus>> put) {
putIntoCache(put, getGroupStatusCache());
@@ -159,41 +144,13 @@ public class RolloutStatusCache {
* Put {@link TotalTargetCountActionStatus} for multiple
* {@link RolloutGroup}s into cache.
*
* @param groupId
* the cache entries belong to
* @param status
* list to cache
* @param groupId the cache entries belong to
* @param status list to cache
*/
public void putRolloutGroupStatus(final Long groupId, final List<TotalTargetCountActionStatus> status) {
putIntoCache(groupId, status, getGroupStatusCache());
}
private Map<Long, List<TotalTargetCountActionStatus>> retrieveFromCache(final List<Long> ids,
@NotNull final Cache cache) {
return ids.stream().map(id -> cache.get(id, CachedTotalTargetCountActionStatus.class)).filter(Objects::nonNull)
.collect(Collectors.toMap(CachedTotalTargetCountActionStatus::getId,
CachedTotalTargetCountActionStatus::getStatus));
}
private List<TotalTargetCountActionStatus> retrieveFromCache(final Long id, @NotNull final Cache cache) {
final CachedTotalTargetCountActionStatus cacheItem = cache.get(id, CachedTotalTargetCountActionStatus.class);
if (cacheItem == null) {
return Collections.emptyList();
}
return cacheItem.getStatus();
}
private void putIntoCache(final Long id, final List<TotalTargetCountActionStatus> status,
@NotNull final Cache cache) {
cache.put(id, new CachedTotalTargetCountActionStatus(id, status));
}
private void putIntoCache(final Map<Long, List<TotalTargetCountActionStatus>> put, @NotNull final Cache cache) {
put.forEach((k, v) -> cache.put(k, new CachedTotalTargetCountActionStatus(k, v)));
}
@EventListener(classes = AbstractActionEvent.class)
public void invalidateCachedTotalTargetCountActionStatus(final AbstractActionEvent event) {
if (event.getRolloutId() != null) {
@@ -235,13 +192,38 @@ public class RolloutStatusCache {
* Evicts all caches for a given tenant. All caches under a certain tenant
* gets evicted.
*
* @param tenant
* the tenant to evict caches
* @param tenant the tenant to evict caches
*/
public void evictCaches(final String tenant) {
cacheManager.evictCaches(tenant);
}
private Map<Long, List<TotalTargetCountActionStatus>> retrieveFromCache(final List<Long> ids,
@NotNull final Cache cache) {
return ids.stream().map(id -> cache.get(id, CachedTotalTargetCountActionStatus.class)).filter(Objects::nonNull)
.collect(Collectors.toMap(CachedTotalTargetCountActionStatus::getId,
CachedTotalTargetCountActionStatus::getStatus));
}
private List<TotalTargetCountActionStatus> retrieveFromCache(final Long id, @NotNull final Cache cache) {
final CachedTotalTargetCountActionStatus cacheItem = cache.get(id, CachedTotalTargetCountActionStatus.class);
if (cacheItem == null) {
return Collections.emptyList();
}
return cacheItem.getStatus();
}
private void putIntoCache(final Long id, final List<TotalTargetCountActionStatus> status,
@NotNull final Cache cache) {
cache.put(id, new CachedTotalTargetCountActionStatus(id, status));
}
private void putIntoCache(final Map<Long, List<TotalTargetCountActionStatus>> put, @NotNull final Cache cache) {
put.forEach((k, v) -> cache.put(k, new CachedTotalTargetCountActionStatus(k, v)));
}
private @NotNull Cache getRolloutStatusCache() {
return Objects.requireNonNull(cacheManager.getCache(CACHE_RO_NAME), "Cache '" + CACHE_RO_NAME + "' is null!");
}
@@ -251,6 +233,7 @@ public class RolloutStatusCache {
}
private static final class CachedTotalTargetCountActionStatus {
private final long id;
private final List<TotalTargetCountActionStatus> status;

View File

@@ -22,8 +22,7 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractActionStatusCreate<T> {

View File

@@ -12,14 +12,10 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {

View File

@@ -17,10 +17,10 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractMetadataUpdateCreate<T> {
@ValidString
protected String key;

View File

@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Null;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils;

View File

@@ -16,10 +16,10 @@ import org.springframework.util.StringUtils;
/**
* Create builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractRolloutGroupCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String targetFilterQuery;
protected Float targetPercentage;

View File

@@ -14,10 +14,10 @@ import java.util.Optional;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractSoftwareModuleMetadataUpdateCreate<T> extends AbstractMetadataUpdateCreate<T> {
protected Boolean targetVisible;
protected long softwareModuleId;

View File

@@ -12,8 +12,7 @@ package org.eclipse.hawkbit.repository.builder;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {

View File

@@ -17,10 +17,10 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractSoftwareModuleUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String version;

View File

@@ -17,10 +17,10 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public class AbstractTagUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String colour;

View File

@@ -23,10 +23,10 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractBaseEntityBuilder {
@ValidString
protected String name;
@@ -40,14 +40,13 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
@Min(Action.WEIGHT_MIN)
@Max(Action.WEIGHT_MAX)
protected Integer weight;
protected Boolean confirmationRequired;
/**
* Set DS ID of the {@link Action} created during auto assignment
*
* @param distributionSetId
* of the {@link TargetFilterQuery}
*
* @param distributionSetId of the {@link TargetFilterQuery}
* @return this builder
*/
public T autoAssignDistributionSet(final Long distributionSetId) {
@@ -62,9 +61,8 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
/**
* Set {@link ActionType} of the {@link Action} created during auto
* assignment
*
* @param actionType
* of the {@link TargetFilterQuery}
*
* @param actionType of the {@link TargetFilterQuery}
* @return this builder
*/
public T autoAssignActionType(final ActionType actionType) {
@@ -74,9 +72,8 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
/**
* Set weight of the {@link Action} created during auto assignment
*
* @param weight
* of the {@link TargetFilterQuery}
*
* @param weight of the {@link TargetFilterQuery}
* @return this builder
*/
public T autoAssignWeight(final Integer weight) {
@@ -94,9 +91,8 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
/**
* Set name of the filter
*
* @param name
* of the {@link TargetFilterQuery}
*
* @param name of the {@link TargetFilterQuery}
* @return this builder
*/
public T name(final String name) {
@@ -110,9 +106,8 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
/**
* Set query used by the filter
*
* @param query
* of the {@link TargetFilterQuery}
*
* @param query of the {@link TargetFilterQuery}
* @return this builder
*/
public T query(final String query) {
@@ -125,9 +120,8 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
}
/**
* @param confirmationRequired
* if confirmation is required for configured auto assignment
* (considered with confirmation flow active)
* @param confirmationRequired if confirmation is required for configured auto assignment
* (considered with confirmation flow active)
* @return updated builder instance
*/
public T confirmationRequired(final boolean confirmationRequired) {

View File

@@ -9,25 +9,20 @@
*/
package org.eclipse.hawkbit.repository.builder;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils;
import java.util.Collection;
import java.util.Optional;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
protected Collection<Long> compatible;
/**
* @param compatible
* list of ID
* @param compatible list of ID
* @return generic type
*/
public T compatible(final Collection<Long> compatible) {
@@ -36,7 +31,7 @@ public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractTypeUpda
}
/**
* @return List of ID
* @return List of ID
*/
public Optional<Collection<Long>> getCompatible() {
return Optional.ofNullable(compatible);

View File

@@ -21,10 +21,10 @@ import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String controllerId;
@@ -37,7 +37,7 @@ public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T>
protected Long lastTargetQuery;
protected TargetUpdateStatus status;
protected Boolean requestAttributes;
protected Boolean requestAttributes;
protected Long targetTypeId;

View File

@@ -9,16 +9,15 @@
*/
package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils;
import java.util.Optional;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
* @param <T> update or create builder interface
*/
public abstract class AbstractTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {

View File

@@ -10,13 +10,12 @@
package org.eclipse.hawkbit.repository.builder;
import jakarta.annotation.Nullable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.Optional;
/**
* Update implementation.
*/

View File

@@ -10,13 +10,12 @@
package org.eclipse.hawkbit.repository.builder;
import jakarta.annotation.Nullable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.Optional;
/**
* Update implementation.
*/

View File

@@ -13,6 +13,7 @@ package org.eclipse.hawkbit.repository.builder;
* Update implementation.
*/
public class GenericTagUpdate extends AbstractTagUpdateCreate<TagUpdate> implements TagUpdate {
public GenericTagUpdate(final Long id) {
super.id = id;
}

View File

@@ -16,8 +16,7 @@ public class GenericTargetTypeUpdate extends AbstractTargetTypeUpdateCreate<Targ
implements TargetTypeUpdate {
/**
* @param id
* Target type ID
* @param id Target type ID
*/
public GenericTargetTypeUpdate(final Long id) {
super.id = id;

View File

@@ -25,7 +25,8 @@ public final class SystemManagementHolder {
private static final SystemManagementHolder INSTANCE = new SystemManagementHolder();
@Getter @Setter
@Getter
@Setter
@Autowired
private SystemManagement systemManagement;

View File

@@ -15,6 +15,7 @@ import static org.mockito.Mockito.when;
import java.util.HashMap;
import io.qameta.allure.Description;
import org.eclipse.hawkbit.repository.event.remote.entity.RemoteEntityEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
import org.eclipse.hawkbit.repository.model.Target;
@@ -28,8 +29,6 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.converter.MessageConversionException;
import io.qameta.allure.Description;
@ExtendWith(MockitoExtension.class)
public class BusProtoStuffMessageConverterTest {