Improve Security Core with lombok (#1592)
Add lombok to repository modules Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -15,9 +15,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Generic assignment result bean.
|
* Generic assignment result bean.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T> type of the assigned and unassigned {@link BaseEntity}s.
|
||||||
* type of the assigned and unassigned {@link BaseEntity}s.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAssignmentResult<T extends BaseEntity> {
|
public abstract class AbstractAssignmentResult<T extends BaseEntity> {
|
||||||
|
|
||||||
@@ -90,5 +88,4 @@ public abstract class AbstractAssignmentResult<T extends BaseEntity> {
|
|||||||
|
|
||||||
return Collections.unmodifiableList(unassignedEntity);
|
return Collections.unmodifiableList(unassignedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,12 +10,14 @@
|
|||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds properties for {@link Action}
|
* Holds properties for {@link Action}
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class ActionProperties implements Serializable {
|
public class ActionProperties implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -43,42 +45,6 @@ public class ActionProperties implements Serializable {
|
|||||||
this.status = action.getStatus();
|
this.status = action.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(final Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTenant(final String tenant) {
|
|
||||||
this.tenant = tenant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTenant() {
|
|
||||||
return tenant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaintenanceWindowAvailable(final boolean maintenanceWindowAvailable) {
|
|
||||||
this.maintenanceWindowAvailable = maintenanceWindowAvailable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMaintenanceWindowAvailable() {
|
|
||||||
return maintenanceWindowAvailable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action.ActionType getActionType() {
|
|
||||||
return actionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActionType(final Action.ActionType actionType) {
|
|
||||||
this.actionType = actionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action.Status getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isWaitingConfirmation() {
|
public boolean isWaitingConfirmation() {
|
||||||
return status == Action.Status.WAIT_FOR_CONFIRMATION;
|
return status == Action.Status.WAIT_FOR_CONFIRMATION;
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import java.io.InputStream;
|
|||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.ValidString;
|
import org.eclipse.hawkbit.repository.ValidString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to create a new artifact.
|
* Use to create a new artifact.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class ArtifactUpload {
|
public class ArtifactUpload {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -97,40 +99,4 @@ public class ArtifactUpload {
|
|||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
this.filesize = filesize;
|
this.filesize = filesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream() {
|
|
||||||
return inputStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getModuleId() {
|
|
||||||
return moduleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFilename() {
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvidedMd5Sum() {
|
|
||||||
return providedMd5Sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvidedSha1Sum() {
|
|
||||||
return providedSha1Sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvidedSha256Sum() {
|
|
||||||
return providedSha256Sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean overrideExisting() {
|
|
||||||
return overrideExisting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContentType() {
|
|
||||||
return contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFilesize() {
|
|
||||||
return filesize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.Identifiable;
|
import org.eclipse.hawkbit.repository.Identifiable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -18,6 +19,7 @@ import java.io.Serializable;
|
|||||||
* Use to display software modules for the selected distribution.
|
* Use to display software modules for the selected distribution.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class AssignedSoftwareModule implements Serializable, Identifiable<Long> {
|
public class AssignedSoftwareModule implements Serializable, Identifiable<Long> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -40,62 +42,8 @@ public class AssignedSoftwareModule implements Serializable, Identifiable<Long>
|
|||||||
this.assigned = assigned;
|
this.assigned = assigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {@link SoftwareModule}
|
|
||||||
*/
|
|
||||||
public SoftwareModule getSoftwareModule() {
|
|
||||||
return softwareModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return <code>true</code> if assigned
|
|
||||||
*/
|
|
||||||
public boolean isAssigned() {
|
|
||||||
return assigned;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "AssignedSoftwareModule [softwareModule=" + softwareModule + ", assigned=" + assigned + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + (assigned ? 1231 : 1237);
|
|
||||||
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.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 AssignedSoftwareModule other = (AssignedSoftwareModule) obj;
|
|
||||||
if (assigned != other.assigned) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (softwareModule == null) {
|
|
||||||
if (other.softwareModule != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!softwareModule.equals(other.softwareModule)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return softwareModule.getId();
|
return softwareModule.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,16 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
|
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom view on assigning a {@link DistributionSet} to a {@link Target}.
|
* A custom view on assigning a {@link DistributionSet} to a {@link Target}.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DeploymentRequest {
|
public class DeploymentRequest {
|
||||||
|
|
||||||
private final Long distributionSetId;
|
private final Long distributionSetId;
|
||||||
@Valid
|
@Valid
|
||||||
private final TargetWithActionType targetWithActionType;
|
private final TargetWithActionType targetWithActionType;
|
||||||
@@ -76,46 +78,7 @@ public class DeploymentRequest {
|
|||||||
this.distributionSetId = distributionSetId;
|
this.distributionSetId = distributionSetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDistributionSetId() {
|
|
||||||
return distributionSetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getControllerId() {
|
public String getControllerId() {
|
||||||
return targetWithActionType.getControllerId();
|
return targetWithActionType.getControllerId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TargetWithActionType getTargetWithActionType() {
|
|
||||||
return targetWithActionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format(
|
|
||||||
"DeploymentRequest [controllerId=%s, distributionSetId=%d, actionType=%s, forceTime=%d, weight=%d, maintenanceSchedule=%s, maintenanceWindowDuration=%s, maintenanceWindowTimeZone=%s, confirmationRequired=%s]",
|
|
||||||
targetWithActionType.getControllerId(), getDistributionSetId(), targetWithActionType.getActionType(),
|
|
||||||
targetWithActionType.getForceTime(), targetWithActionType.getWeight(),
|
|
||||||
targetWithActionType.getMaintenanceSchedule(), targetWithActionType.getMaintenanceWindowDuration(),
|
|
||||||
targetWithActionType.getMaintenanceWindowTimeZone(), targetWithActionType.isConfirmationRequired());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(distributionSetId, targetWithActionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final DeploymentRequest other = (DeploymentRequest) obj;
|
|
||||||
return Objects.equals(distributionSetId, other.distributionSetId)
|
|
||||||
&& Objects.equals(targetWithActionType, other.targetWithActionType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,5 +123,4 @@ public class DeploymentRequestBuilder {
|
|||||||
return new DeploymentRequest(controllerId, distributionSetId, actionType, forceTime, weight,
|
return new DeploymentRequest(controllerId, distributionSetId, actionType, forceTime, weight,
|
||||||
maintenanceSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone, confirmationRequired);
|
maintenanceSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone, confirmationRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ import java.util.List;
|
|||||||
* how much of the assignments had already been existed.
|
* how much of the assignments had already been existed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DistributionSetAssignmentResult extends AbstractAssignmentResult<Action> {
|
public class DistributionSetAssignmentResult extends AbstractAssignmentResult<Action> {
|
||||||
|
|
||||||
private final DistributionSet distributionSet;
|
private final DistributionSet distributionSet;
|
||||||
@@ -37,12 +40,4 @@ public class DistributionSetAssignmentResult extends AbstractAssignmentResult<Ac
|
|||||||
super(alreadyAssigned, assigned, Collections.emptyList());
|
super(alreadyAssigned, assigned, Collections.emptyList());
|
||||||
this.distributionSet = distributionSet;
|
this.distributionSet = distributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The distribution set that has been assigned
|
|
||||||
*/
|
|
||||||
public DistributionSet getDistributionSet() {
|
|
||||||
return distributionSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,81 +9,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds distribution set filter parameters.
|
* Holds distribution set filter parameters.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
public final class DistributionSetFilter {
|
public final class DistributionSetFilter {
|
||||||
/**
|
|
||||||
* Distribution set filter builder.
|
|
||||||
*/
|
|
||||||
public static class DistributionSetFilterBuilder {
|
|
||||||
private Boolean isDeleted;
|
|
||||||
private Boolean isComplete;
|
|
||||||
private Boolean isValid;
|
|
||||||
private Long typeId;
|
|
||||||
private String searchText;
|
|
||||||
private Boolean selectDSWithNoTag;
|
|
||||||
private Collection<String> tagNames;
|
|
||||||
private String assignedTargetId;
|
|
||||||
private String installedTargetId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build filter.
|
|
||||||
*
|
|
||||||
* @return DistributionSetFilter
|
|
||||||
*/
|
|
||||||
public DistributionSetFilter build() {
|
|
||||||
return new DistributionSetFilter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setAssignedTargetId(final String assignedTargetId) {
|
|
||||||
this.assignedTargetId = assignedTargetId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setInstalledTargetId(final String installedTargetId) {
|
|
||||||
this.installedTargetId = installedTargetId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setIsComplete(final Boolean isComplete) {
|
|
||||||
this.isComplete = isComplete;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setIsDeleted(final Boolean isDeleted) {
|
|
||||||
this.isDeleted = isDeleted;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setIsValid(final Boolean isValid) {
|
|
||||||
this.isValid = isValid;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setSearchText(final String searchText) {
|
|
||||||
this.searchText = searchText;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setSelectDSWithNoTag(final Boolean selectDSWithNoTag) {
|
|
||||||
this.selectDSWithNoTag = selectDSWithNoTag;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setTagNames(final Collection<String> tagNames) {
|
|
||||||
this.tagNames = tagNames;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSetFilterBuilder setTypeId(final Long typeId) {
|
|
||||||
this.typeId = typeId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Boolean isDeleted;
|
private final Boolean isDeleted;
|
||||||
private final Boolean isComplete;
|
private final Boolean isComplete;
|
||||||
@@ -93,61 +29,5 @@ public final class DistributionSetFilter {
|
|||||||
private final Boolean selectDSWithNoTag;
|
private final Boolean selectDSWithNoTag;
|
||||||
private final Collection<String> tagNames;
|
private final Collection<String> tagNames;
|
||||||
private final String assignedTargetId;
|
private final String assignedTargetId;
|
||||||
|
|
||||||
private final String installedTargetId;
|
private final String installedTargetId;
|
||||||
|
|
||||||
/**
|
|
||||||
* Parametric constructor.
|
|
||||||
*
|
|
||||||
* @param builder
|
|
||||||
* DistributionSetFilterBuilder
|
|
||||||
*/
|
|
||||||
public DistributionSetFilter(final DistributionSetFilterBuilder builder) {
|
|
||||||
this.isDeleted = builder.isDeleted;
|
|
||||||
this.isComplete = builder.isComplete;
|
|
||||||
this.isValid = builder.isValid;
|
|
||||||
this.typeId = builder.typeId;
|
|
||||||
this.searchText = builder.searchText;
|
|
||||||
this.selectDSWithNoTag = builder.selectDSWithNoTag;
|
|
||||||
this.tagNames = builder.tagNames;
|
|
||||||
this.assignedTargetId = builder.assignedTargetId;
|
|
||||||
this.installedTargetId = builder.installedTargetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAssignedTargetId() {
|
|
||||||
return assignedTargetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInstalledTargetId() {
|
|
||||||
return installedTargetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIsComplete() {
|
|
||||||
return isComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIsDeleted() {
|
|
||||||
return isDeleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIsValid() {
|
|
||||||
return isValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSearchText() {
|
|
||||||
return searchText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getSelectDSWithNoTag() {
|
|
||||||
return selectDSWithNoTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<String> getTagNames() {
|
|
||||||
return tagNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTypeId() {
|
|
||||||
return typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,13 +9,24 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the information about the invalidation of a distribution set
|
* Holds the information about the invalidation of a distribution set
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DistributionSetInvalidation {
|
public class DistributionSetInvalidation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines if and how actions should be canceled when invalidating a
|
||||||
|
* distribution set
|
||||||
|
*/
|
||||||
|
public enum CancelationType {
|
||||||
|
FORCE, SOFT, NONE
|
||||||
|
}
|
||||||
|
|
||||||
private Collection<Long> distributionSetIds;
|
private Collection<Long> distributionSetIds;
|
||||||
private CancelationType cancelationType;
|
private CancelationType cancelationType;
|
||||||
private boolean cancelRollouts;
|
private boolean cancelRollouts;
|
||||||
@@ -36,37 +47,4 @@ public class DistributionSetInvalidation {
|
|||||||
this.cancelationType = cancelationType;
|
this.cancelationType = cancelationType;
|
||||||
this.cancelRollouts = cancelRollouts;
|
this.cancelRollouts = cancelRollouts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Long> getDistributionSetIds() {
|
|
||||||
return distributionSetIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistributionSetIds(final Collection<Long> distributionSetIds) {
|
|
||||||
this.distributionSetIds = distributionSetIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CancelationType getCancelationType() {
|
|
||||||
return cancelationType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCancelationType(final CancelationType cancelationType) {
|
|
||||||
this.cancelationType = cancelationType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCancelRollouts() {
|
|
||||||
return cancelRollouts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCancelRollouts(final boolean cancelRollouts) {
|
|
||||||
this.cancelRollouts = cancelRollouts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines if and how actions should be canceled when invalidating a
|
|
||||||
* distribution set
|
|
||||||
*/
|
|
||||||
public enum CancelationType {
|
|
||||||
FORCE, SOFT, NONE
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,11 +9,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* object that holds information about the count of affected rollouts,
|
* object that holds information about the count of affected rollouts,
|
||||||
* auto-assignments and actions, when a list of distribution sets gets
|
* auto-assignments and actions, when a list of distribution sets gets
|
||||||
* invalidated
|
* invalidated
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DistributionSetInvalidationCount {
|
public class DistributionSetInvalidationCount {
|
||||||
|
|
||||||
private final long rolloutsCount;
|
private final long rolloutsCount;
|
||||||
@@ -26,17 +29,4 @@ public class DistributionSetInvalidationCount {
|
|||||||
this.autoAssignmentCount = autoAssignmentCount;
|
this.autoAssignmentCount = autoAssignmentCount;
|
||||||
this.actionCount = actionCount;
|
this.actionCount = actionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRolloutsCount() {
|
|
||||||
return rolloutsCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAutoAssignmentCount() {
|
|
||||||
return autoAssignmentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getActionCount() {
|
|
||||||
return actionCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,5 +24,4 @@ public interface DistributionSetMetadata extends MetaData {
|
|||||||
default Long getEntityId() {
|
default Long getEntityId() {
|
||||||
return getDistributionSet().getId();
|
return getDistributionSet().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result object for {@link DistributionSetTag} assignments.
|
* Result object for {@link DistributionSetTag} assignments.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult<DistributionSet> {
|
public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult<DistributionSet> {
|
||||||
|
|
||||||
private final DistributionSetTag distributionSetTag;
|
private final DistributionSetTag distributionSetTag;
|
||||||
@@ -37,9 +40,4 @@ public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult
|
|||||||
super(alreadyAssigned, assigned, unassigned);
|
super(alreadyAssigned, assigned, unassigned);
|
||||||
this.distributionSetTag = distributionSetTag;
|
this.distributionSetTag = distributionSetTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DistributionSetTag getDistributionSetTag() {
|
|
||||||
return distributionSetTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +19,9 @@ import java.time.LocalDateTime;
|
|||||||
* poll time.
|
* poll time.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class PollStatus {
|
public class PollStatus {
|
||||||
|
|
||||||
private final LocalDateTime lastPollDate;
|
private final LocalDateTime lastPollDate;
|
||||||
private final LocalDateTime nextPollDate;
|
private final LocalDateTime nextPollDate;
|
||||||
private final LocalDateTime overdueDate;
|
private final LocalDateTime overdueDate;
|
||||||
@@ -41,29 +45,4 @@ public class PollStatus {
|
|||||||
public boolean isOverdue() {
|
public boolean isOverdue() {
|
||||||
return currentDate.isAfter(overdueDate);
|
return currentDate.isAfter(overdueDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lastPollDate
|
|
||||||
*/
|
|
||||||
public LocalDateTime getLastPollDate() {
|
|
||||||
return lastPollDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getNextPollDate() {
|
|
||||||
return nextPollDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getOverdueDate() {
|
|
||||||
return overdueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getCurrentDate() {
|
|
||||||
return currentDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PollTime [lastPollDate=" + lastPollDate + ", nextPollDate=" + nextPollDate + ", overdueDate="
|
|
||||||
+ overdueDate + ", currentDate=" + currentDate + "]";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -24,5 +24,4 @@ public final class RepositoryModelConstants {
|
|||||||
private RepositoryModelConstants() {
|
private RepositoryModelConstants() {
|
||||||
// Utility class.
|
// Utility class.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RolloutGroupConditionBuilder {
|
public class RolloutGroupConditionBuilder {
|
||||||
|
|
||||||
private final RolloutGroupConditions conditions = new RolloutGroupConditions();
|
private final RolloutGroupConditions conditions = new RolloutGroupConditions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
|
||||||
@@ -18,7 +19,9 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
|
|||||||
* Object which holds all {@link RolloutGroup} conditions together which can
|
* Object which holds all {@link RolloutGroup} conditions together which can
|
||||||
* easily built.
|
* easily built.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class RolloutGroupConditions {
|
public class RolloutGroupConditions {
|
||||||
|
|
||||||
private RolloutGroupSuccessCondition successCondition;
|
private RolloutGroupSuccessCondition successCondition;
|
||||||
private String successConditionExp;
|
private String successConditionExp;
|
||||||
private RolloutGroupSuccessAction successAction;
|
private RolloutGroupSuccessAction successAction;
|
||||||
@@ -27,68 +30,4 @@ public class RolloutGroupConditions {
|
|||||||
private String errorConditionExp;
|
private String errorConditionExp;
|
||||||
private RolloutGroupErrorAction errorAction;
|
private RolloutGroupErrorAction errorAction;
|
||||||
private String errorActionExp;
|
private String errorActionExp;
|
||||||
|
|
||||||
public RolloutGroupSuccessCondition getSuccessCondition() {
|
|
||||||
return successCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessCondition(final RolloutGroupSuccessCondition finishCondition) {
|
|
||||||
successCondition = finishCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuccessConditionExp() {
|
|
||||||
return successConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessConditionExp(final String finishConditionExp) {
|
|
||||||
successConditionExp = finishConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupSuccessAction getSuccessAction() {
|
|
||||||
return successAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessAction(final RolloutGroupSuccessAction successAction) {
|
|
||||||
this.successAction = successAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuccessActionExp() {
|
|
||||||
return successActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessActionExp(final String successActionExp) {
|
|
||||||
this.successActionExp = successActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupErrorCondition getErrorCondition() {
|
|
||||||
return errorCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorCondition(final RolloutGroupErrorCondition errorCondition) {
|
|
||||||
this.errorCondition = errorCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorConditionExp() {
|
|
||||||
return errorConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorConditionExp(final String errorConditionExp) {
|
|
||||||
this.errorConditionExp = errorConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupErrorAction getErrorAction() {
|
|
||||||
return errorAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorAction(final RolloutGroupErrorAction errorAction) {
|
|
||||||
this.errorAction = errorAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorActionExp() {
|
|
||||||
return errorActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorActionExp(final String errorActionExp) {
|
|
||||||
this.errorActionExp = errorActionExp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,13 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents information to validate the correct distribution of targets to
|
* Represents information to validate the correct distribution of targets to
|
||||||
* rollout groups.
|
* rollout groups.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class RolloutGroupsValidation {
|
public class RolloutGroupsValidation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,14 +45,6 @@ public class RolloutGroupsValidation {
|
|||||||
this.targetsPerGroup = targetsPerGroup;
|
this.targetsPerGroup = targetsPerGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTotalTargets() {
|
|
||||||
return totalTargets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Long> getTargetsPerGroup() {
|
|
||||||
return targetsPerGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the count of targets that are in groups
|
* @return the count of targets that are in groups
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,12 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result object for {@link TargetTag} assignments.
|
* Result object for {@link TargetTag} assignments.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target> {
|
public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target> {
|
||||||
|
|
||||||
private final TargetTag targetTag;
|
private final TargetTag targetTag;
|
||||||
@@ -36,8 +39,4 @@ public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target>
|
|||||||
super(alreadyAssigned, assigned, unassigned);
|
super(alreadyAssigned, assigned, unassigned);
|
||||||
this.targetTag = targetTag;
|
this.targetTag = targetTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TargetTag getTargetTag() {
|
|
||||||
return targetTag;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result object for {@link TargetType} assignments.
|
* Result object for {@link TargetType} assignments.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class TargetTypeAssignmentResult extends AbstractAssignmentResult<Target> {
|
public class TargetTypeAssignmentResult extends AbstractAssignmentResult<Target> {
|
||||||
|
|
||||||
private final TargetType targetType;
|
private final TargetType targetType;
|
||||||
@@ -36,8 +39,4 @@ public class TargetTypeAssignmentResult extends AbstractAssignmentResult<Target>
|
|||||||
super(alreadyAssigned, assigned, unassigned);
|
super(alreadyAssigned, assigned, unassigned);
|
||||||
this.targetType = targetType;
|
this.targetType = targetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TargetType getTargetType() {
|
|
||||||
return targetType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.Identifiable;
|
import org.eclipse.hawkbit.repository.Identifiable;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Target with action status.
|
* Target with action status.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class TargetWithActionStatus implements Identifiable<Long> {
|
public class TargetWithActionStatus implements Identifiable<Long> {
|
||||||
|
|
||||||
private Target target;
|
private Target target;
|
||||||
@@ -40,32 +40,8 @@ public class TargetWithActionStatus implements Identifiable<Long> {
|
|||||||
this.lastActionStatusCode = lastActionStatusCode;
|
this.lastActionStatusCode = lastActionStatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target getTarget() {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarget(final Target target) {
|
|
||||||
this.target = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(final Status status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return target.getId();
|
return target.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getLastActionStatusCode() {
|
|
||||||
return lastActionStatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastActionStatusCode(final Integer lastActionStatusCode) {
|
|
||||||
this.lastActionStatusCode = lastActionStatusCode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,29 +9,28 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Max;
|
import jakarta.validation.constraints.Max;
|
||||||
import jakarta.validation.constraints.Min;
|
import jakarta.validation.constraints.Min;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
|
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom view on {@link Target} with {@link ActionType}.
|
* A custom view on {@link Target} with {@link ActionType}.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class TargetWithActionType {
|
public class TargetWithActionType {
|
||||||
|
|
||||||
private final String controllerId;
|
private final String controllerId;
|
||||||
private final ActionType actionType;
|
private final ActionType actionType;
|
||||||
private final long forceTime;
|
private final long forceTime;
|
||||||
@Min(Action.WEIGHT_MIN)
|
@Min(Action.WEIGHT_MIN) @Max(Action.WEIGHT_MAX)
|
||||||
@Max(Action.WEIGHT_MAX)
|
|
||||||
private final Integer weight;
|
private final Integer weight;
|
||||||
private String maintenanceSchedule;
|
|
||||||
private String maintenanceWindowDuration;
|
|
||||||
private String maintenanceWindowTimeZone;
|
|
||||||
private final boolean confirmationRequired;
|
private final boolean confirmationRequired;
|
||||||
|
private final String maintenanceSchedule;
|
||||||
|
private final String maintenanceWindowDuration;
|
||||||
|
private final String maintenanceWindowTimeZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor that uses {@link ActionType#FORCED}
|
* Constructor that uses {@link ActionType#FORCED}
|
||||||
@@ -62,11 +61,7 @@ public class TargetWithActionType {
|
|||||||
public TargetWithActionType(
|
public TargetWithActionType(
|
||||||
final String controllerId, final ActionType actionType, final long forceTime,
|
final String controllerId, final ActionType actionType, final long forceTime,
|
||||||
final Integer weight, final boolean confirmationRequired) {
|
final Integer weight, final boolean confirmationRequired) {
|
||||||
this.controllerId = controllerId;
|
this(controllerId, actionType, forceTime, weight, null, null, null, confirmationRequired);
|
||||||
this.actionType = actionType != null ? actionType : ActionType.FORCED;
|
|
||||||
this.forceTime = forceTime;
|
|
||||||
this.weight = weight;
|
|
||||||
this.confirmationRequired = confirmationRequired;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,109 +93,19 @@ public class TargetWithActionType {
|
|||||||
* @throws InvalidMaintenanceScheduleException
|
* @throws InvalidMaintenanceScheduleException
|
||||||
* if the parameters do not define a valid maintenance schedule.
|
* if the parameters do not define a valid maintenance schedule.
|
||||||
*/
|
*/
|
||||||
public TargetWithActionType(final String controllerId, final ActionType actionType, final long forceTime,
|
public TargetWithActionType(
|
||||||
final Integer weight, final String maintenanceSchedule, final String maintenanceWindowDuration,
|
final String controllerId, final ActionType actionType, final long forceTime, final Integer weight,
|
||||||
final String maintenanceWindowTimeZone, final boolean confirmationRequired) {
|
final String maintenanceSchedule, final String maintenanceWindowDuration, final String maintenanceWindowTimeZone,
|
||||||
this(controllerId, actionType, forceTime, weight, confirmationRequired);
|
final boolean confirmationRequired) {
|
||||||
|
this.controllerId = controllerId;
|
||||||
|
this.actionType = actionType != null ? actionType : ActionType.FORCED;
|
||||||
|
this.forceTime = actionType == ActionType.TIMEFORCED ?
|
||||||
|
forceTime : RepositoryModelConstants.NO_FORCE_TIME;
|
||||||
|
this.weight = weight;
|
||||||
|
this.confirmationRequired = confirmationRequired;
|
||||||
|
|
||||||
this.maintenanceSchedule = maintenanceSchedule;
|
this.maintenanceSchedule = maintenanceSchedule;
|
||||||
this.maintenanceWindowDuration = maintenanceWindowDuration;
|
this.maintenanceWindowDuration = maintenanceWindowDuration;
|
||||||
this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
|
this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionType getActionType() {
|
|
||||||
if (actionType != null) {
|
|
||||||
return actionType;
|
|
||||||
}
|
|
||||||
// default value
|
|
||||||
return ActionType.FORCED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getForceTime() {
|
|
||||||
if (actionType == ActionType.TIMEFORCED) {
|
|
||||||
return forceTime;
|
|
||||||
}
|
|
||||||
return RepositoryModelConstants.NO_FORCE_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getWeight() {
|
|
||||||
return weight;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getControllerId() {
|
|
||||||
return controllerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maintenance schedule for the {@link Action}.
|
|
||||||
*
|
|
||||||
* @return cron expression as {@link String}.
|
|
||||||
*/
|
|
||||||
public String getMaintenanceSchedule() {
|
|
||||||
return this.maintenanceSchedule;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the duration of maintenance window for the {@link Action}.
|
|
||||||
*
|
|
||||||
* @return duration in HH:mm:ss format as {@link String}.
|
|
||||||
*/
|
|
||||||
public String getMaintenanceWindowDuration() {
|
|
||||||
return maintenanceWindowDuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the timezone of maintenance window for the {@link Action}.
|
|
||||||
*
|
|
||||||
* @return the timezone offset from UTC in +/-hh:mm as {@link String}.
|
|
||||||
*/
|
|
||||||
public String getMaintenanceWindowTimeZone() {
|
|
||||||
return maintenanceWindowTimeZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return if a confirmation is required for this assignment (depends on confirmation flow active)
|
|
||||||
*
|
|
||||||
* @return the flag
|
|
||||||
*/
|
|
||||||
public boolean isConfirmationRequired() {
|
|
||||||
return confirmationRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "TargetWithActionType [controllerId=" + controllerId + ", actionType=" + getActionType() + ", forceTime="
|
|
||||||
+ getForceTime() + ", weight=" + getWeight() + ", maintenanceSchedule=" + getMaintenanceSchedule()
|
|
||||||
+ ", maintenanceWindowDuration=" + getMaintenanceWindowDuration() + ", maintenanceWindowTimeZone="
|
|
||||||
+ getMaintenanceWindowTimeZone() + ", confirmationRequired=" + isConfirmationRequired() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(actionType, controllerId, forceTime, weight, confirmationRequired, maintenanceSchedule,
|
|
||||||
maintenanceWindowDuration, maintenanceWindowTimeZone);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("squid:S1067")
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final TargetWithActionType other = (TargetWithActionType) obj;
|
|
||||||
return Objects.equals(actionType, other.actionType) && Objects.equals(controllerId, other.controllerId)
|
|
||||||
&& Objects.equals(forceTime, other.forceTime) && Objects.equals(weight, other.weight)
|
|
||||||
&& Objects.equals(confirmationRequired, other.confirmationRequired)
|
|
||||||
&& Objects.equals(maintenanceSchedule, other.maintenanceSchedule)
|
|
||||||
&& Objects.equals(maintenanceWindowDuration, other.maintenanceWindowDuration)
|
|
||||||
&& Objects.equals(maintenanceWindowTimeZone, other.maintenanceWindowTimeZone);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,175 +20,16 @@ import java.io.Serializable;
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
* type of the configuration value
|
* type of the configuration value
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
public final class TenantConfigurationValue<T extends Serializable> implements Serializable {
|
public final class TenantConfigurationValue<T extends Serializable> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private T value;
|
private T value;
|
||||||
private Long lastModifiedAt;
|
private Long lastModifiedAt;
|
||||||
private String lastModifiedBy;
|
private String lastModifiedBy;
|
||||||
private Long createdAt;
|
private Long createdAt;
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
private boolean global = true;
|
private boolean global = true;
|
||||||
|
|
||||||
private TenantConfigurationValue() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value.
|
|
||||||
*
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
public T getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is global.
|
|
||||||
*
|
|
||||||
* @return true, if is global
|
|
||||||
*/
|
|
||||||
public boolean isGlobal() {
|
|
||||||
return global;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the last modified at.
|
|
||||||
*
|
|
||||||
* @return the last modified at
|
|
||||||
*/
|
|
||||||
public Long getLastModifiedAt() {
|
|
||||||
return lastModifiedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the last modified by.
|
|
||||||
*
|
|
||||||
* @return the last modified by
|
|
||||||
*/
|
|
||||||
public String getLastModifiedBy() {
|
|
||||||
return lastModifiedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the created at.
|
|
||||||
*
|
|
||||||
* @return the created at
|
|
||||||
*/
|
|
||||||
public Long getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the created by.
|
|
||||||
*
|
|
||||||
* @return the created by
|
|
||||||
*/
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder.
|
|
||||||
*
|
|
||||||
* @param <K>
|
|
||||||
* the key type
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public static <K extends Serializable> TenantConfigurationValueBuilder<K> builder() {
|
|
||||||
|
|
||||||
return new TenantConfigurationValueBuilder<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* builds the tenant configuration value including some meta data
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* type of the configuration value
|
|
||||||
*/
|
|
||||||
public static class TenantConfigurationValueBuilder<T extends Serializable> {
|
|
||||||
|
|
||||||
private final TenantConfigurationValue<T> configuration = new TenantConfigurationValue<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the.
|
|
||||||
*
|
|
||||||
* @return the tenant configuration value
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValue<T> build() {
|
|
||||||
return configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sets the configuration value itself
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* the value
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> value(final T value) {
|
|
||||||
this.configuration.value = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the is global attribute.
|
|
||||||
*
|
|
||||||
* @param global
|
|
||||||
* true when there is no tenant specific value, false
|
|
||||||
* otherwise
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> global(final boolean global) {
|
|
||||||
this.configuration.global = global;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the last modified at attribute
|
|
||||||
*
|
|
||||||
* @param lastModifiedAt
|
|
||||||
* timestamp of last modification
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> lastModifiedAt(final Long lastModifiedAt) {
|
|
||||||
this.configuration.lastModifiedAt = lastModifiedAt;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sets the last modified by attribute
|
|
||||||
*
|
|
||||||
* @param lastModifiedBy
|
|
||||||
* the last modified by
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> lastModifiedBy(final String lastModifiedBy) {
|
|
||||||
this.configuration.lastModifiedBy = lastModifiedBy;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sets the created at attribute
|
|
||||||
*
|
|
||||||
* @param createdAt
|
|
||||||
* defined when the configuration has been created
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> createdAt(final Long createdAt) {
|
|
||||||
this.configuration.createdAt = createdAt;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sets the created by attribute
|
|
||||||
*
|
|
||||||
* @param createdBy
|
|
||||||
* defines by whom the configuration has been created
|
|
||||||
* @return the tenant configuration value builder
|
|
||||||
*/
|
|
||||||
public TenantConfigurationValueBuilder<T> createdBy(final String createdBy) {
|
|
||||||
this.configuration.createdBy = createdBy;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,16 +9,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents rollout or rollout group statuses and count of targets in each
|
* Represents rollout or rollout group statuses and count of targets in each
|
||||||
* status.
|
* status.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class TotalTargetCountActionStatus {
|
public class TotalTargetCountActionStatus {
|
||||||
|
|
||||||
private final Action.Status status;
|
private final Action.Status status;
|
||||||
private final Long count;
|
private final Long count;
|
||||||
private Long id;
|
private final Long id;
|
||||||
|
|
||||||
public TotalTargetCountActionStatus(final Long id, final Action.Status status, final Long count) {
|
public TotalTargetCountActionStatus(final Long id, final Action.Status status, final Long count) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@@ -27,28 +30,6 @@ public class TotalTargetCountActionStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TotalTargetCountActionStatus(final Action.Status status, final Long count) {
|
public TotalTargetCountActionStatus(final Action.Status status, final Long count) {
|
||||||
this.status = status;
|
this(null, status, count);
|
||||||
this.count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the status
|
|
||||||
*/
|
|
||||||
public Action.Status getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the count
|
|
||||||
*/
|
|
||||||
public Long getCount() {
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
|||||||
final String filename = artifactUpload.getFilename();
|
final String filename = artifactUpload.getFilename();
|
||||||
final Artifact existing = softwareModule.getArtifactByFilename(filename).orElse(null);
|
final Artifact existing = softwareModule.getArtifactByFilename(filename).orElse(null);
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
if (artifactUpload.overrideExisting()) {
|
if (artifactUpload.isOverrideExisting()) {
|
||||||
LOG.debug("overriding existing artifact with new filename {}", filename);
|
LOG.debug("overriding existing artifact with new filename {}", filename);
|
||||||
} else {
|
} else {
|
||||||
throw new EntityAlreadyExistsException("File with that name already exists in the Software Module");
|
throw new EntityAlreadyExistsException("File with that name already exists in the Software Module");
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class DistributionSetAccessControllerTest extends AbstractAccessControllerTest {
|
|||||||
// verify distributionSetManagement#findByDistributionSetFilter
|
// verify distributionSetManagement#findByDistributionSetFilter
|
||||||
assertThat(distributionSetManagement
|
assertThat(distributionSetManagement
|
||||||
.findByDistributionSetFilter(Pageable.unpaged(),
|
.findByDistributionSetFilter(Pageable.unpaged(),
|
||||||
new DistributionSetFilter.DistributionSetFilterBuilder().setIsDeleted(false).build())
|
DistributionSetFilter.builder().isDeleted(false).build())
|
||||||
.get().map(Identifiable::getId).toList()).containsOnly(permitted.getId());
|
.get().map(Identifiable::getId).toList()).containsOnly(permitted.getId());
|
||||||
|
|
||||||
// verify distributionSetManagement#get
|
// verify distributionSetManagement#get
|
||||||
|
|||||||
@@ -648,8 +648,11 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assignDistributionSet(dsFour.getId(), tSecond.getControllerId());
|
assignDistributionSet(dsFour.getId(), tSecond.getControllerId());
|
||||||
|
|
||||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
final DistributionSetFilter distributionSetFilter =
|
||||||
.setIsComplete(true).setSelectDSWithNoTag(Boolean.FALSE).build();
|
DistributionSetFilter.builder()
|
||||||
|
.isDeleted(false)
|
||||||
|
.isComplete(true)
|
||||||
|
.selectDSWithNoTag(Boolean.FALSE).build();
|
||||||
|
|
||||||
// target first only has an assigned DS-three so check order correct
|
// target first only has an assigned DS-three so check order correct
|
||||||
final List<DistributionSet> tFirstPin = distributionSetManagement
|
final List<DistributionSet> tFirstPin = distributionSetManagement
|
||||||
@@ -769,36 +772,36 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Step
|
@Step
|
||||||
private void validateFindAll(final List<DistributionSet> expectedDistributionsets) {
|
private void validateFindAll(final List<DistributionSet> expectedDistributionsets) {
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder(), expectedDistributionsets);
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder(), expectedDistributionsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void validateDeleted(final DistributionSet deletedDistributionSet, final int notDeletedSize) {
|
private void validateDeleted(final DistributionSet deletedDistributionSet, final int notDeletedSize) {
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsDeleted(Boolean.TRUE),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isDeleted(Boolean.TRUE),
|
||||||
singletonList(deletedDistributionSet));
|
singletonList(deletedDistributionSet));
|
||||||
|
|
||||||
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setIsDeleted(Boolean.FALSE), notDeletedSize, deletedDistributionSet);
|
DistributionSetFilter.builder().isDeleted(Boolean.FALSE), notDeletedSize, deletedDistributionSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void validateCompleted(final DistributionSet dsIncomplete, final int completedSize) {
|
private void validateCompleted(final DistributionSet dsIncomplete, final int completedSize) {
|
||||||
|
|
||||||
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE), completedSize, dsIncomplete);
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE), completedSize, dsIncomplete);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE), singletonList(dsIncomplete));
|
DistributionSetFilter.builder().isComplete(Boolean.FALSE), singletonList(dsIncomplete));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void validateType(final DistributionSetType newType, final DistributionSet dsNewType,
|
private void validateType(final DistributionSetType newType, final DistributionSet dsNewType,
|
||||||
final int standardDsTypeSize) {
|
final int standardDsTypeSize) {
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setTypeId(newType.getId()),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().typeId(newType.getId()),
|
||||||
singletonList(dsNewType));
|
singletonList(dsNewType));
|
||||||
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
assertThatFilterHasSizeAndDoesNotContainDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setTypeId(standardDsType.getId()), standardDsTypeSize, dsNewType);
|
DistributionSetFilter.builder().typeId(standardDsType.getId()), standardDsTypeSize, dsNewType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
@@ -806,40 +809,40 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
final List<DistributionSet> withTestNamePrefix = allDistributionSets.stream()
|
final List<DistributionSet> withTestNamePrefix = allDistributionSets.stream()
|
||||||
.filter(ds -> ds.getName().startsWith(dsNamePrefix)).collect(Collectors.toList());
|
.filter(ds -> ds.getName().startsWith(dsNamePrefix)).collect(Collectors.toList());
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setSearchText(dsNamePrefix),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().searchText(dsNamePrefix),
|
||||||
withTestNamePrefix);
|
withTestNamePrefix);
|
||||||
|
|
||||||
final List<DistributionSet> withTestNameExact = withTestNamePrefix.stream()
|
final List<DistributionSet> withTestNameExact = withTestNamePrefix.stream()
|
||||||
.filter(ds -> ds.getName().equals(dsNamePrefix)).collect(Collectors.toList());
|
.filter(ds -> ds.getName().equals(dsNamePrefix)).collect(Collectors.toList());
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setSearchText(dsNamePrefix + ":"), withTestNameExact);
|
DistributionSetFilter.builder().searchText(dsNamePrefix + ":"), withTestNameExact);
|
||||||
|
|
||||||
final List<DistributionSet> withTestNameExactAndVersionPrefix = withTestNameExact.stream()
|
final List<DistributionSet> withTestNameExactAndVersionPrefix = withTestNameExact.stream()
|
||||||
.filter(ds -> ds.getVersion().startsWith("1")).collect(Collectors.toList());
|
.filter(ds -> ds.getVersion().startsWith("1")).collect(Collectors.toList());
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setSearchText(dsNamePrefix + ":1"),
|
DistributionSetFilter.builder().searchText(dsNamePrefix + ":1"),
|
||||||
withTestNameExactAndVersionPrefix);
|
withTestNameExactAndVersionPrefix);
|
||||||
|
|
||||||
final List<DistributionSet> dsWithExactNameAndVersion = withTestNameExactAndVersionPrefix.stream()
|
final List<DistributionSet> dsWithExactNameAndVersion = withTestNameExactAndVersionPrefix.stream()
|
||||||
.filter(ds -> ds.getVersion().equals("1.0.0")).collect(Collectors.toList());
|
.filter(ds -> ds.getVersion().equals("1.0.0")).collect(Collectors.toList());
|
||||||
assertThat(dsWithExactNameAndVersion).hasSize(1);
|
assertThat(dsWithExactNameAndVersion).hasSize(1);
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setSearchText(dsNamePrefix + ":1.0.0"), dsWithExactNameAndVersion);
|
DistributionSetFilter.builder().searchText(dsNamePrefix + ":1.0.0"), dsWithExactNameAndVersion);
|
||||||
|
|
||||||
final List<DistributionSet> withVersionPrefix = allDistributionSets.stream()
|
final List<DistributionSet> withVersionPrefix = allDistributionSets.stream()
|
||||||
.filter(ds -> ds.getVersion().startsWith("1.0.")).collect(Collectors.toList());
|
.filter(ds -> ds.getVersion().startsWith("1.0.")).collect(Collectors.toList());
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setSearchText(":1.0."),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().searchText(":1.0."),
|
||||||
withVersionPrefix);
|
withVersionPrefix);
|
||||||
|
|
||||||
final List<DistributionSet> withVersionExact = withVersionPrefix.stream()
|
final List<DistributionSet> withVersionExact = withVersionPrefix.stream()
|
||||||
.filter(ds -> ds.getVersion().equals("1.0.0")).collect(Collectors.toList());
|
.filter(ds -> ds.getVersion().equals("1.0.0")).collect(Collectors.toList());
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setSearchText(":1.0.0"),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().searchText(":1.0.0"),
|
||||||
withVersionExact);
|
withVersionExact);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setSearchText(":"),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().searchText(":"),
|
||||||
allDistributionSets);
|
allDistributionSets);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setSearchText(" : "),
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().searchText(" : "),
|
||||||
allDistributionSets);
|
allDistributionSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,21 +852,21 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final List<DistributionSet> dsWithTagB) {
|
final List<DistributionSet> dsWithTagB) {
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setTagNames(singletonList(dsTagA.getName())), dsWithTagA);
|
DistributionSetFilter.builder().tagNames(singletonList(dsTagA.getName())), dsWithTagA);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setTagNames(singletonList(dsTagB.getName())), dsWithTagB);
|
DistributionSetFilter.builder().tagNames(singletonList(dsTagB.getName())), dsWithTagB);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagA.getName(), dsTagB.getName())),
|
DistributionSetFilter.builder().tagNames(Arrays.asList(dsTagA.getName(), dsTagB.getName())),
|
||||||
dsWithTagA);
|
dsWithTagA);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagC.getName(), dsTagB.getName())),
|
DistributionSetFilter.builder().tagNames(Arrays.asList(dsTagC.getName(), dsTagB.getName())),
|
||||||
dsWithTagB);
|
dsWithTagB);
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(
|
assertThatFilterDoesNotContainAnyDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setTagNames(singletonList(dsTagC.getName())));
|
DistributionSetFilter.builder().tagNames(singletonList(dsTagC.getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
@@ -873,28 +876,28 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final List<DistributionSet> completedNotDeleted = new ArrayList<>(completedStandardType);
|
final List<DistributionSet> completedNotDeleted = new ArrayList<>(completedStandardType);
|
||||||
completedNotDeleted.add(dsNewType);
|
completedNotDeleted.add(dsNewType);
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setIsDeleted(Boolean.FALSE),
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE).isDeleted(Boolean.FALSE),
|
||||||
completedNotDeleted);
|
completedNotDeleted);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setIsDeleted(Boolean.TRUE),
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE).isDeleted(Boolean.TRUE),
|
||||||
singletonList(dsDeleted));
|
singletonList(dsDeleted));
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(
|
assertThatFilterDoesNotContainAnyDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.TRUE));
|
DistributionSetFilter.builder().isComplete(Boolean.FALSE).isDeleted(Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void validateDeletedAndCompletedAndType(final List<DistributionSet> deletedAndCompletedAndStandardType,
|
private void validateDeletedAndCompletedAndType(final List<DistributionSet> deletedAndCompletedAndStandardType,
|
||||||
final DistributionSet dsDeleted, final DistributionSetType newType, final DistributionSet dsNewType) {
|
final DistributionSet dsDeleted, final DistributionSetType newType, final DistributionSet dsNewType) {
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsDeleted(Boolean.FALSE)
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isDeleted(Boolean.FALSE)
|
||||||
.setIsComplete(Boolean.TRUE).setTypeId(standardDsType.getId()), deletedAndCompletedAndStandardType);
|
.isComplete(Boolean.TRUE).typeId(standardDsType.getId()), deletedAndCompletedAndStandardType);
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isComplete(Boolean.TRUE)
|
||||||
.setTypeId(standardDsType.getId()).setIsDeleted(Boolean.TRUE), singletonList(dsDeleted));
|
.typeId(standardDsType.getId()).isDeleted(Boolean.TRUE), singletonList(dsDeleted));
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(getDistributionSetFilterBuilder().setIsDeleted(Boolean.TRUE)
|
assertThatFilterDoesNotContainAnyDistributionSet(DistributionSetFilter.builder().isDeleted(Boolean.TRUE)
|
||||||
.setIsComplete(Boolean.FALSE).setTypeId(standardDsType.getId()));
|
.isComplete(Boolean.FALSE).typeId(standardDsType.getId()));
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setTypeId(newType.getId()),
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE).typeId(newType.getId()),
|
||||||
singletonList(dsNewType));
|
singletonList(dsNewType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,19 +906,19 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final List<DistributionSet> completedAndStandardTypeAndSearchText, final DistributionSetType newType,
|
final List<DistributionSet> completedAndStandardTypeAndSearchText, final DistributionSetType newType,
|
||||||
final String text) {
|
final String text) {
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsDeleted(Boolean.FALSE)
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isDeleted(Boolean.FALSE)
|
||||||
.setIsComplete(Boolean.TRUE).setTypeId(standardDsType.getId()).setSearchText(text),
|
.isComplete(Boolean.TRUE).typeId(standardDsType.getId()).searchText(text),
|
||||||
completedAndStandardTypeAndSearchText);
|
completedAndStandardTypeAndSearchText);
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
assertThatFilterDoesNotContainAnyDistributionSet(DistributionSetFilter.builder().isComplete(Boolean.TRUE)
|
||||||
.setIsDeleted(Boolean.TRUE).setTypeId(standardDsType.getId()).setSearchText(text + ":"));
|
.isDeleted(Boolean.TRUE).typeId(standardDsType.getId()).searchText(text + ":"));
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(
|
assertThatFilterDoesNotContainAnyDistributionSet(
|
||||||
getDistributionSetFilterBuilder().setTypeId(standardDsType.getId()).setSearchText(text)
|
DistributionSetFilter.builder().typeId(standardDsType.getId()).searchText(text)
|
||||||
.setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.FALSE));
|
.isComplete(Boolean.FALSE).isDeleted(Boolean.FALSE));
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(getDistributionSetFilterBuilder().setTypeId(newType.getId())
|
assertThatFilterDoesNotContainAnyDistributionSet(DistributionSetFilter.builder().typeId(newType.getId())
|
||||||
.setSearchText(text).setIsComplete(Boolean.TRUE).setIsDeleted(Boolean.FALSE));
|
.searchText(text).isComplete(Boolean.TRUE).isDeleted(Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
@@ -927,26 +930,26 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final List<DistributionSet> completedAndStandardTypeAndFilterString = new ArrayList<>(
|
final List<DistributionSet> completedAndStandardTypeAndFilterString = new ArrayList<>(
|
||||||
completedAndNotDeletedStandardTypeAndFilterString);
|
completedAndNotDeletedStandardTypeAndFilterString);
|
||||||
completedAndStandardTypeAndFilterString.add(dsDeleted);
|
completedAndStandardTypeAndFilterString.add(dsDeleted);
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isComplete(Boolean.TRUE)
|
||||||
.setTypeId(standardDsType.getId()).setSearchText(filterString),
|
.typeId(standardDsType.getId()).searchText(filterString),
|
||||||
completedAndStandardTypeAndFilterString);
|
completedAndStandardTypeAndFilterString);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setIsDeleted(Boolean.FALSE)
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE).isDeleted(Boolean.FALSE)
|
||||||
.setTypeId(standardDsType.getId()).setSearchText(filterString),
|
.typeId(standardDsType.getId()).searchText(filterString),
|
||||||
completedAndNotDeletedStandardTypeAndFilterString);
|
completedAndNotDeletedStandardTypeAndFilterString);
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().isComplete(Boolean.TRUE)
|
||||||
.setIsDeleted(Boolean.TRUE).setTypeId(standardDsType.getId()).setSearchText(filterString),
|
.isDeleted(Boolean.TRUE).typeId(standardDsType.getId()).searchText(filterString),
|
||||||
singletonList(dsDeleted));
|
singletonList(dsDeleted));
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setTypeId(standardDsType.getId()).setSearchText(filterString)
|
DistributionSetFilter.builder().typeId(standardDsType.getId()).searchText(filterString)
|
||||||
.setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.FALSE),
|
.isComplete(Boolean.FALSE).isDeleted(Boolean.FALSE),
|
||||||
singletonList(dsInComplete));
|
singletonList(dsInComplete));
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(getDistributionSetFilterBuilder().setTypeId(newType.getId())
|
assertThatFilterContainsOnlyGivenDistributionSets(DistributionSetFilter.builder().typeId(newType.getId())
|
||||||
.setSearchText(filterString).setIsComplete(Boolean.TRUE).setIsDeleted(Boolean.FALSE),
|
.searchText(filterString).isComplete(Boolean.TRUE).isDeleted(Boolean.FALSE),
|
||||||
singletonList(dsNewType));
|
singletonList(dsNewType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -956,17 +959,13 @@ class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final String text) {
|
final String text) {
|
||||||
|
|
||||||
assertThatFilterContainsOnlyGivenDistributionSets(
|
assertThatFilterContainsOnlyGivenDistributionSets(
|
||||||
getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setTypeId(standardDsType.getId())
|
DistributionSetFilter.builder().isComplete(Boolean.TRUE).typeId(standardDsType.getId())
|
||||||
.setSearchText(text).setTagNames(singletonList(dsTagA.getName())),
|
.searchText(text).tagNames(singletonList(dsTagA.getName())),
|
||||||
completedAndStandartTypeAndSearchTextAndTagA);
|
completedAndStandartTypeAndSearchTextAndTagA);
|
||||||
|
|
||||||
assertThatFilterDoesNotContainAnyDistributionSet(getDistributionSetFilterBuilder()
|
assertThatFilterDoesNotContainAnyDistributionSet(DistributionSetFilter.builder()
|
||||||
.setTypeId(standardDsType.getId()).setSearchText(text).setTagNames(singletonList(dsTagA.getName()))
|
.typeId(standardDsType.getId()).searchText(text).tagNames(singletonList(dsTagA.getName()))
|
||||||
.setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.FALSE));
|
.isComplete(Boolean.FALSE).isDeleted(Boolean.FALSE));
|
||||||
}
|
|
||||||
|
|
||||||
private DistributionSetFilterBuilder getDistributionSetFilterBuilder() {
|
|
||||||
return new DistributionSetFilterBuilder();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertThatFilterContainsOnlyGivenDistributionSets(final DistributionSetFilterBuilder filterBuilder,
|
private void assertThatFilterContainsOnlyGivenDistributionSets(final DistributionSetFilterBuilder filterBuilder,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdatedEvent;
|
|||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
|
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.Tag;
|
import org.eclipse.hawkbit.repository.model.Tag;
|
||||||
@@ -107,15 +107,15 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
|
|||||||
toggleTagAssignment(dsABCs, distributionSetTagManagement.getByName(tagC.getName()).get());
|
toggleTagAssignment(dsABCs, distributionSetTagManagement.getByName(tagC.getName()).get());
|
||||||
|
|
||||||
// search for not deleted
|
// search for not deleted
|
||||||
final DistributionSetFilterBuilder distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
final DistributionSetFilter.DistributionSetFilterBuilder distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
||||||
.setIsComplete(true);
|
.isComplete(true);
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagA.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagA.getName())),
|
||||||
Stream.of(dsAs, dsABs, dsACs, dsABCs));
|
Stream.of(dsAs, dsABs, dsACs, dsABCs));
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagB.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagB.getName())),
|
||||||
Stream.of(dsBs, dsABs, dsBCs, dsABCs));
|
Stream.of(dsBs, dsABs, dsBCs, dsABCs));
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagC.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagC.getName())),
|
||||||
Stream.of(dsCs, dsACs, dsBCs, dsABCs));
|
Stream.of(dsCs, dsACs, dsBCs, dsABCs));
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagX.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagX.getName())),
|
||||||
Stream.empty());
|
Stream.empty());
|
||||||
|
|
||||||
assertThat(distributionSetTagRepository.findAll()).hasSize(5);
|
assertThat(distributionSetTagRepository.findAll()).hasSize(5);
|
||||||
@@ -126,16 +126,16 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
|
|||||||
distributionSetTagManagement.delete(tagB.getName());
|
distributionSetTagManagement.delete(tagB.getName());
|
||||||
assertThat(distributionSetTagRepository.findAll()).hasSize(2);
|
assertThat(distributionSetTagRepository.findAll()).hasSize(2);
|
||||||
|
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagA.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagA.getName())),
|
||||||
Stream.of(dsAs, dsABs, dsACs, dsABCs));
|
Stream.of(dsAs, dsABs, dsACs, dsABCs));
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagB.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagB.getName())),
|
||||||
Stream.empty());
|
Stream.empty());
|
||||||
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.setTagNames(Arrays.asList(tagC.getName())),
|
verifyExpectedFilteredDistributionSets(distributionSetFilterBuilder.tagNames(Arrays.asList(tagC.getName())),
|
||||||
Stream.of(dsCs, dsACs, dsBCs, dsABCs));
|
Stream.of(dsCs, dsACs, dsBCs, dsABCs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void verifyExpectedFilteredDistributionSets(final DistributionSetFilterBuilder distributionSetFilterBuilder,
|
private void verifyExpectedFilteredDistributionSets(final DistributionSetFilter.DistributionSetFilterBuilder distributionSetFilterBuilder,
|
||||||
final Stream<Collection<DistributionSet>> expectedFilteredDistributionSets) {
|
final Stream<Collection<DistributionSet>> expectedFilteredDistributionSets) {
|
||||||
final Collection<Long> retrievedFilteredDsIds = distributionSetManagement
|
final Collection<Long> retrievedFilteredDsIds = distributionSetManagement
|
||||||
.findByDistributionSetFilter(PAGE, distributionSetFilterBuilder.build()).stream()
|
.findByDistributionSetFilter(PAGE, distributionSetFilterBuilder.build()).stream()
|
||||||
@@ -298,8 +298,8 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
|
|||||||
return distributionSetTagManagement.findAll(PAGE).getContent();
|
return distributionSetTagManagement.findAll(PAGE).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private DistributionSetFilterBuilder getDistributionSetFilterBuilder() {
|
private DistributionSetFilter.DistributionSetFilterBuilder getDistributionSetFilterBuilder() {
|
||||||
return new DistributionSetFilterBuilder();
|
return DistributionSetFilter.builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
|
|||||||
Reference in New Issue
Block a user