Improve Security Core with lombok 2 (#1593)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-03 03:32:53 +02:00
committed by GitHub
parent d2a740823d
commit 1c5a7bbeb3
32 changed files with 108 additions and 474 deletions

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
@@ -18,8 +19,8 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
* Encapsulates a set of filters that may be specified (optionally). Properties
* that are not specified (e.g. <code>null</code> for simple properties) When
* applied, these filters are AND-gated.
*
*/
@Data
public class FilterParams {
private final Collection<TargetUpdateStatus> filterByStatus;
@@ -61,7 +62,6 @@ public class FilterParams {
this.filterByTagNames = filterByTagNames;
this.selectTargetWithNoTargetType = false;
this.filterByTargetType = null;
}
/**
@@ -88,86 +88,4 @@ public class FilterParams {
this.selectTargetWithNoTargetType = selectTargetWithNoType;
this.filterByTargetType = filterByType;
}
/**
* Gets {@link DistributionSet#getId()} to filter the result. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return {@link DistributionSet#getId()} to filter the result
*/
public Long getFilterByDistributionId() {
return filterByDistributionId;
}
/**
* Gets a collection of target states to filter for. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return collection of target states to filter for
*/
public Collection<TargetUpdateStatus> getFilterByStatus() {
return filterByStatus;
}
/**
* Gets the flag for overdue filter; if set to <code>true</code>, the
* overdue filter is activated. Overdued targets a targets that did not
* respond during the configured intervals: poll_itvl + overdue_itvl. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return flag for overdue filter activation
*/
public Boolean getOverdueState() {
return overdueState;
}
/**
* Gets the search text to filter for. This is used to find targets having
* the text anywhere in name or description <br>
* If set to <code>null</code> this filter is disabled.
*
* @return the search text to filter for
*/
public String getFilterBySearchText() {
return filterBySearchText;
}
/**
* Gets the flag indicating if tagging filter is used. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return the flag indicating if tagging filter is used
*/
public Boolean getSelectTargetWithNoTag() {
return selectTargetWithNoTag;
}
/**
* Gets the tags that are used to filter for. The activation of this filter
* is done by {@link #setSelectTargetWithNoTag(Boolean)}.
*
* @return the tags that are used to filter for
*/
public String[] getFilterByTagNames() {
return filterByTagNames;
}
/**
* Gets the flag indicating if no target type filter is used. <br>
* If set to <code>false</code> this filter is disabled.
*
* @return the flag indicating if no target type filter is used
*/
public Boolean getSelectTargetWithNoTargetType() {
return selectTargetWithNoTargetType;
}
/**
* Gets the target type
*
* @return the target type that are used to filter for
*/
public Long getFilterByTargetType() {
return filterByTargetType;
}
}

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository;
import lombok.Data;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@@ -19,9 +20,11 @@ import org.springframework.data.domain.Sort;
* the REST-API is working with {@code offset} and {@code limit} parameter we
* need an offset based page request.
*/
@Data
public final class OffsetBasedPageRequest extends PageRequest {
private static final long serialVersionUID = 1L;
private final long offset;
/**
@@ -52,42 +55,4 @@ public final class OffsetBasedPageRequest extends PageRequest {
super(0, limit, sort);
this.offset = offset;
}
@Override
public long getOffset() {
return offset;
}
@Override
public String toString() {
return "OffsetBasedPageRequest [offset=" + offset + ", getPageSize()=" + getPageSize() + ", getPageNumber()="
+ getPageNumber() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + (int) (offset ^ (offset >>> 32));
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final OffsetBasedPageRequest other = (OffsetBasedPageRequest) obj;
if (offset != other.offset) {
return false;
}
return true;
}
}
}

View File

@@ -11,14 +11,15 @@ package org.eclipse.hawkbit.repository;
import java.util.concurrent.TimeUnit;
import lombok.Data;
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Configuration properties for the repository.
*
*/
@Data
@ConfigurationProperties("hawkbit.server.repository")
public class RepositoryProperties {
@@ -67,68 +68,4 @@ public class RepositoryProperties {
private long dsInvalidationLockTimeout = 5;
private boolean implicitTenantCreateAllowed;
public boolean isEagerPollPersistence() {
return eagerPollPersistence;
}
public void setEagerPollPersistence(final boolean eagerPollPersistence) {
this.eagerPollPersistence = eagerPollPersistence;
}
public long getPollPersistenceFlushTime() {
return pollPersistenceFlushTime;
}
public void setPollPersistenceFlushTime(final long pollPersistenceFlushTime) {
this.pollPersistenceFlushTime = pollPersistenceFlushTime;
}
public int getPollPersistenceQueueSize() {
return pollPersistenceQueueSize;
}
public void setPollPersistenceQueueSize(final int pollPersistenceQueueSize) {
this.pollPersistenceQueueSize = pollPersistenceQueueSize;
}
public boolean isRejectActionStatusForClosedAction() {
return rejectActionStatusForClosedAction;
}
public void setRejectActionStatusForClosedAction(final boolean rejectActionStatusForClosedAction) {
this.rejectActionStatusForClosedAction = rejectActionStatusForClosedAction;
}
public boolean isPublishTargetPollEvent() {
return publishTargetPollEvent;
}
public void setPublishTargetPollEvent(final boolean publishTargetPollEvent) {
this.publishTargetPollEvent = publishTargetPollEvent;
}
public int getActionWeightIfAbsent() {
return actionWeightIfAbsent;
}
public void setActionWeightIfAbsent(final int actionWeightIfAbsent) {
this.actionWeightIfAbsent = actionWeightIfAbsent;
}
public long getDsInvalidationLockTimeout() {
return dsInvalidationLockTimeout;
}
public void setDsInvalidationLockTimeout(final long dsInvalidationLockTimeout) {
this.dsInvalidationLockTimeout = dsInvalidationLockTimeout;
}
public boolean isImplicitTenantCreateAllowed() {
return implicitTenantCreateAllowed;
}
public void setImplicitTenantCreateAllowed(final boolean implicitTenantCreateAllowed) {
this.implicitTenantCreateAllowed = implicitTenantCreateAllowed;
}
}
}

View File

@@ -12,6 +12,8 @@ package org.eclipse.hawkbit.repository.builder;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -21,7 +23,10 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
* Builder to update the auto assign {@link DistributionSet} of a
* {@link TargetFilterQuery} entry. Defines all fields that can be updated.
*/
@Getter
@EqualsAndHashCode
public class AutoAssignDistributionSetUpdate {
private final long targetFilterId;
private Long dsId;
private ActionType actionType;
@@ -90,25 +95,4 @@ public class AutoAssignDistributionSetUpdate {
this.confirmationRequired = confirmationRequired;
return this;
}
public Long getDsId() {
return dsId;
}
public ActionType getActionType() {
return actionType;
}
public Integer getWeight() {
return weight;
}
public Boolean isConfirmationRequired() {
return confirmationRequired;
}
public long getTargetFilterId() {
return targetFilterId;
}
}
}

View File

@@ -19,7 +19,5 @@ package org.eclipse.hawkbit.repository.event;
public enum CustomEvents {
TARGETS_CREATED_EVENT,
DISTRIBUTION_CREATED_EVENT
}
}

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.ActionProperties;
@@ -21,6 +22,7 @@ import java.util.stream.Collectors;
/**
* Abstract class providing information about an assignment.
*/
@Data
public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
private static final long serialVersionUID = 1L;
@@ -46,12 +48,7 @@ public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
.collect(Collectors.toMap(action -> action.getTarget().getControllerId(), ActionProperties::new)));
}
public Map<String, ActionProperties> getActions() {
return actions;
}
public Optional<ActionProperties> getActionPropertiesForController(final String controllerId) {
return Optional.ofNullable(actions.get(controllerId));
}
}

View File

@@ -36,5 +36,4 @@ public class CancelTargetAssignmentEvent extends AbstractAssignmentEvent {
super(applicationId, tenant, a, applicationId);
}
}
}

View File

@@ -44,5 +44,4 @@ public class MultiActionAssignEvent extends MultiActionEvent {
public MultiActionAssignEvent(String tenant, String applicationId, List<Action> actions) {
super(tenant, applicationId, actions);
}
}
}

View File

@@ -44,5 +44,4 @@ public class MultiActionCancelEvent extends MultiActionEvent {
public MultiActionCancelEvent(String tenant, String applicationId, List<Action> actions) {
super(tenant, applicationId, actions);
}
}
}

View File

@@ -14,6 +14,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Data;
import org.eclipse.hawkbit.repository.Identifiable;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Target;
@@ -24,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.Target;
* a deployment action (e.g. a software assignment (update) or a cancellation of
* an update).
*/
@Data
public abstract class MultiActionEvent extends RemoteTenantAwareEvent implements Iterable<String> {
private static final long serialVersionUID = 1L;
@@ -54,19 +56,11 @@ public abstract class MultiActionEvent extends RemoteTenantAwareEvent implements
this.actionIds.addAll(getIdsFromActions(actions));
}
public List<String> getControllerIds() {
return controllerIds;
}
@Override
public Iterator<String> iterator() {
return controllerIds.iterator();
}
public List<Long> getActionIds() {
return actionIds;
}
private static List<String> getControllerIdsFromActions(final List<Action> actions) {
return actions.stream().map(Action::getTarget).map(Target::getControllerId).distinct()
.collect(Collectors.toList());

View File

@@ -9,14 +9,17 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import java.util.Arrays;
/**
* An base definition class for an event which contains an id.
*
*/
@Getter
@EqualsAndHashCode
public class RemoteIdEvent extends RemoteTenantAwareEvent {
private static final long serialVersionUID = 1L;
@@ -60,19 +63,4 @@ public class RemoteIdEvent extends RemoteTenantAwareEvent {
return Arrays.stream(interfaces).filter(TenantAwareBaseEntity.class::isAssignableFrom).findFirst()
.orElse(baseEntity);
}
/**
* @return the entityClass
*/
public String getEntityClass() {
return entityClass;
}
public Long getEntityId() {
return entityId;
}
public String getInterfaceClass() {
return interfaceClass;
}
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
@@ -18,9 +20,11 @@ import com.cronutils.utils.StringUtils;
* A distributed tenant aware event. It's the base class of the other
* distributed events. All the necessary information of distributing events to
* other nodes.
*
*/
@Getter
@EqualsAndHashCode
public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements TenantAwareEvent {
private static final long serialVersionUID = 1L;
private String tenant;
@@ -47,10 +51,4 @@ public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements Te
super(source, applicationId != null ? applicationId : StringUtils.EMPTY);
this.tenant = tenant;
}
@Override
public String getTenant() {
return tenant;
}
}
}

View File

@@ -44,5 +44,4 @@ public class RolloutDeletedEvent extends RemoteIdEvent implements EntityDeletedE
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -44,5 +44,4 @@ public class RolloutGroupDeletedEvent extends RemoteIdEvent implements EntityDel
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.event.remote;
import java.util.Collection;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.DistributionSet;
/**
@@ -18,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
* Event that is published when a rollout is stopped due to invalidation of a
* {@link DistributionSet}.
*/
@Data
public class RolloutStoppedEvent extends RemoteTenantAwareEvent {
private static final long serialVersionUID = 1L;
@@ -50,21 +52,4 @@ public class RolloutStoppedEvent extends RemoteTenantAwareEvent {
this.rolloutId = rolloutId;
this.rolloutGroupIds = rolloutGroupIds;
}
public Collection<Long> getRolloutGroupIds() {
return rolloutGroupIds;
}
public void setRolloutGroupIds(final Collection<Long> rolloutGroupIds) {
this.rolloutGroupIds = rolloutGroupIds;
}
public long getRolloutId() {
return rolloutId;
}
public void setRolloutId(final long rolloutId) {
this.rolloutId = rolloutId;
}
}
}

View File

@@ -44,5 +44,4 @@ public class SoftwareModuleDeletedEvent extends RemoteIdEvent implements EntityD
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -44,5 +44,4 @@ public class SoftwareModuleTypeDeletedEvent extends RemoteIdEvent implements Ent
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -13,12 +13,16 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.model.Action;
/**
* TenantAwareEvent that gets sent when a distribution set gets assigned to a
* target.
*/
@Getter
@EqualsAndHashCode
public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent {
private static final long serialVersionUID = 1L;
@@ -70,13 +74,4 @@ public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent {
this(action.getTenant(), action.getDistributionSet().getId(), Collections.singletonList(action), applicationId,
action.isMaintenanceWindowAvailable());
}
public Long getDistributionSetId() {
return distributionSetId;
}
public boolean isMaintenanceWindowAvailable() {
return maintenanceWindowAvailable;
}
}

View File

@@ -9,12 +9,16 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/**
* Defines the remote event of triggering attribute updates of a {@link Target}.
*/
@Getter
@EqualsAndHashCode
public class TargetAttributesRequestedEvent extends RemoteIdEvent {
private static final long serialVersionUID = 1L;
private String controllerId;
@@ -50,12 +54,4 @@ public class TargetAttributesRequestedEvent extends RemoteIdEvent {
this.controllerId = controllerId;
this.targetAddress = targetAddress;
}
public String getControllerId() {
return controllerId;
}
public String getTargetAddress() {
return targetAddress;
}
}

View File

@@ -9,14 +9,17 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/**
*
* Defines the remote event of deleting a {@link Target}.
*/
@Getter
@EqualsAndHashCode
public class TargetDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
private static final long serialVersionUID = 2L;
@@ -52,13 +55,4 @@ public class TargetDeletedEvent extends RemoteIdEvent implements EntityDeletedEv
this.controllerId = controllerId;
this.targetAddress = targetAddress;
}
public String getControllerId() {
return controllerId;
}
public String getTargetAddress() {
return targetAddress;
}
}
}

View File

@@ -9,11 +9,15 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.eclipse.hawkbit.repository.model.Target;
/**
* Event is send in case a target polls either through DDI or DMF.
*/
@Getter
@EqualsAndHashCode
public class TargetPollEvent extends RemoteTenantAwareEvent {
private static final long serialVersionUID = 1L;
@@ -37,12 +41,4 @@ public class TargetPollEvent extends RemoteTenantAwareEvent {
this.controllerId = target.getControllerId();
this.targetAdress = target.getAddress().toString();
}
public String getControllerId() {
return controllerId;
}
public String getTargetAdress() {
return targetAdress;
}
}
}

View File

@@ -44,4 +44,4 @@ public class TargetTagDeletedEvent extends RemoteIdEvent implements EntityDelete
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -44,5 +44,4 @@ public class TargetTypeDeletedEvent extends RemoteIdEvent implements EntityDelet
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {
super(entityId, tenant, entityClass, applicationId);
}
}
}

View File

@@ -9,17 +9,23 @@
*/
package org.eclipse.hawkbit.repository.event.remote;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/**
*
* Defines the remote event of deleting a {@link org.eclipse.hawkbit.repository.model.TenantConfiguration}.
*/
@Getter
@EqualsAndHashCode
public class TenantConfigurationDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
private static final long serialVersionUID = 2L;
private String configKey;
@ToString.Exclude
private String configValue;
/**
@@ -51,12 +57,4 @@ public class TenantConfigurationDeletedEvent extends RemoteIdEvent implements En
this.configKey = configKey;
this.configValue = configValue;
}
public String getConfigKey() {
return configKey;
}
public String getConfigValue() {
return configValue;
}
}

View File

@@ -9,11 +9,15 @@
*/
package org.eclipse.hawkbit.repository.report.model;
import lombok.Data;
/**
* Bean for holding the system usage stats.
*
*/
@Data
public class SystemUsageReport {
private final long overallTargets;
private final long overallArtifacts;
private final long overallArtifactVolumeInBytes;
@@ -42,24 +46,4 @@ public class SystemUsageReport {
this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes;
this.overallTenants = overallTenants;
}
public long getOverallTargets() {
return overallTargets;
}
public long getOverallArtifacts() {
return overallArtifacts;
}
public long getOverallArtifactVolumeInBytes() {
return overallArtifactVolumeInBytes;
}
public long getOverallActions() {
return overallActions;
}
public long getOverallTenants() {
return overallTenants;
}
}

View File

@@ -54,5 +54,4 @@ public class SystemUsageReportWithTenants extends SystemUsageReport {
public List<TenantUsage> getTenants() {
return Collections.unmodifiableList(tenants);
}
}
}

View File

@@ -9,14 +9,16 @@
*/
package org.eclipse.hawkbit.repository.report.model;
import lombok.Data;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* System usage stats element for a tenant.
*
*/
@Data
public class TenantUsage {
private final String tenantName;
@@ -36,23 +38,6 @@ public class TenantUsage {
this.tenantName = tenantName;
}
public String getTenantName() {
return tenantName;
}
public long getTargets() {
return targets;
}
public TenantUsage setTargets(final long targets) {
this.targets = targets;
return this;
}
public long getArtifacts() {
return artifacts;
}
public Map<String, String> getUsageData() {
return Collections.unmodifiableMap(getLazyUsageData());
}
@@ -64,29 +49,6 @@ public class TenantUsage {
return usageData;
}
public TenantUsage setArtifacts(final long artifacts) {
this.artifacts = artifacts;
return this;
}
public long getOverallArtifactVolumeInBytes() {
return overallArtifactVolumeInBytes;
}
public TenantUsage setOverallArtifactVolumeInBytes(final long overallArtifactVolumeInBytes) {
this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes;
return this;
}
public long getActions() {
return actions;
}
public TenantUsage setActions(final long actions) {
this.actions = actions;
return this;
}
/**
* Add a key and value as usage data to the system usage stats.
*
@@ -100,66 +62,4 @@ public class TenantUsage {
getLazyUsageData().put(key, value);
return this;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (actions ^ (actions >>> 32));
result = prime * result + (int) (artifacts ^ (artifacts >>> 32));
result = prime * result + (int) (overallArtifactVolumeInBytes ^ (overallArtifactVolumeInBytes >>> 32));
result = prime * result + (int) (targets ^ (targets >>> 32));
result = prime * result + ((tenantName == null) ? 0 : tenantName.hashCode());
result = prime * result + ((usageData == null) ? 0 : usageData.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 TenantUsage other = (TenantUsage) obj;
if (actions != other.actions) {
return false;
}
if (artifacts != other.artifacts) {
return false;
}
if (overallArtifactVolumeInBytes != other.overallArtifactVolumeInBytes) {
return false;
}
if (targets != other.targets) {
return false;
}
if (tenantName == null) {
if (other.tenantName != null) {
return false;
}
} else if (!tenantName.equals(other.tenantName)) {
return false;
}
if (usageData == null) {
if (other.usageData != null) {
return false;
}
} else if (!usageData.equals(other.usageData)) {
return false;
}
return true;
}
@Override
public String toString() {
return "TenantUsage [tenantName=" + tenantName + ", targets=" + targets + ", artifacts=" + artifacts
+ ", actions=" + actions + ", overallArtifactVolumeInBytes=" + overallArtifactVolumeInBytes
+ ", usageData=" + usageData + "]";
}
}
}

View File

@@ -221,6 +221,5 @@ public class TenantConfigurationProperties {
context.getAutowireCapableBeanFactory().destroyBean(createdBean);
}
}
}
}
}

View File

@@ -19,5 +19,4 @@ public class TenantConfigurationBooleanValidator implements TenantConfigurationV
public Class<?> validateToClass() {
return Boolean.class;
}
}
}

View File

@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository.builder;
import java.net.URI;
import java.util.Optional;
import lombok.ToString;
import org.eclipse.hawkbit.repository.ValidString;
import org.eclipse.hawkbit.repository.exception.InvalidTargetAddressException;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
@@ -28,6 +30,7 @@ public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T>
protected String address;
@ToString.Exclude
@ValidString
protected String securityToken;

View File

@@ -290,8 +290,8 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
targetFilterQuery.setAutoAssignWeight(
update.getWeight() == null ? repositoryProperties.getActionWeightIfAbsent() : update.getWeight());
final boolean confirmationRequired =
update.isConfirmationRequired() == null ?
isConfirmationFlowEnabled() : update.isConfirmationRequired();
update.getConfirmationRequired() == null ?
isConfirmationFlowEnabled() : update.getConfirmationRequired();
targetFilterQuery.setConfirmationRequired(confirmationRequired);
}
return targetFilterQueryRepository.save(targetFilterQuery);

View File

@@ -69,9 +69,15 @@ public class SystemManagementTest extends AbstractJpaIntegrationTest {
// per tenant data
final List<TenantUsage> tenants = systemManagement.getSystemUsageStatisticsWithTenants().getTenants();
assertThat(tenants).hasSize(3);
final TenantUsage tenantUsage0 = new TenantUsage("tenant0");
tenantUsage0.setArtifacts(1);
tenantUsage0.setOverallArtifactVolumeInBytes(1234);
final TenantUsage tenantUsage1 = new TenantUsage("tenant1");
tenantUsage1.setArtifacts(1);
tenantUsage1.setOverallArtifactVolumeInBytes(1234);
assertThat(tenants).containsOnly(new TenantUsage("default"),
new TenantUsage("tenant0").setArtifacts(1).setOverallArtifactVolumeInBytes(1234),
new TenantUsage("tenant1").setArtifacts(1).setOverallArtifactVolumeInBytes(1234));
tenantUsage0,
tenantUsage1);
}
@Test
@@ -87,9 +93,13 @@ public class SystemManagementTest extends AbstractJpaIntegrationTest {
// per tenant data
final List<TenantUsage> tenants = systemManagement.getSystemUsageStatisticsWithTenants().getTenants();
assertThat(tenants).hasSize(3);
assertThat(tenants).containsOnly(new TenantUsage("default"), new TenantUsage("tenant0").setTargets(100),
new TenantUsage("tenant1").setTargets(100));
final TenantUsage tenantUsage0 = new TenantUsage("tenant0");
tenantUsage0.setTargets(100);
final TenantUsage tenantUsage1 = new TenantUsage("tenant1");
tenantUsage1.setTargets(100);
assertThat(tenants).containsOnly(new TenantUsage("default"),
tenantUsage0,
tenantUsage1);
}
@Test
@@ -104,9 +114,15 @@ public class SystemManagementTest extends AbstractJpaIntegrationTest {
// per tenant data
final List<TenantUsage> tenants = systemManagement.getSystemUsageStatisticsWithTenants().getTenants();
assertThat(tenants).hasSize(3);
final TenantUsage tenantUsage0 = new TenantUsage("tenant0");
tenantUsage0.setTargets(40);
tenantUsage0.setActions(40);
final TenantUsage tenantUsage1 = new TenantUsage("tenant1");
tenantUsage1.setTargets(20);
tenantUsage1.setActions(40);
assertThat(tenants).containsOnly(new TenantUsage("default"),
new TenantUsage("tenant0").setTargets(20).setActions(40),
new TenantUsage("tenant1").setTargets(20).setActions(40));
tenantUsage0,
tenantUsage1);
}
private byte[] createTestTenantsForSystemStatistics(final int tenants, final int artifactSize, final int targets,
@@ -162,5 +178,4 @@ public class SystemManagementTest extends AbstractJpaIntegrationTest {
softwareModuleManagement.delete(module.getId());
});
}
}
}