Fix some compile warnings (#2919)
* Fix some compile warnings * Some classes made final * JPA entities made not serializable Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -506,6 +506,7 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
* The name suffix, by default "" is used.
|
||||
*/
|
||||
@NotNull
|
||||
@Builder.Default
|
||||
private String nameSuffix = "";
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,6 @@ public interface SoftwareModuleTypeManagement<T extends SoftwareModuleType>
|
||||
|
||||
@Builder.Default
|
||||
private int maxAssignments = 1;
|
||||
@Builder.Default
|
||||
private int minArtifacts;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Map<String, ActionProperties> actions = new HashMap<>();
|
||||
private final HashMap<String, ActionProperties> actions = new HashMap<>();
|
||||
|
||||
protected AbstractAssignmentEvent(final Action a) {
|
||||
super(a.getTenant(), null);
|
||||
@@ -45,8 +45,7 @@ public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
protected AbstractAssignmentEvent(final String tenant, final Object source, final List<Action> a) {
|
||||
super(tenant, source);
|
||||
actions.putAll(a.stream()
|
||||
.collect(Collectors.toMap(action -> action.getTarget().getControllerId(), ActionProperties::new)));
|
||||
actions.putAll(a.stream().collect(Collectors.toMap(action -> action.getTarget().getControllerId(), ActionProperties::new)));
|
||||
}
|
||||
|
||||
public Optional<ActionProperties> getActionPropertiesForController(final String controllerId) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
@@ -23,6 +24,9 @@ import org.springframework.context.ApplicationEvent;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public abstract class AbstractRemoteEvent extends ApplicationEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String id;
|
||||
|
||||
// for serialization libs like jackson
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -31,12 +32,12 @@ public class RolloutStoppedEvent extends RemoteTenantAwareEvent {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Collection<Long> rolloutGroupIds;
|
||||
private ArrayList<Long> rolloutGroupIds;
|
||||
private long rolloutId;
|
||||
|
||||
public RolloutStoppedEvent(final String tenant, final long rolloutId, final Collection<Long> rolloutGroupIds) {
|
||||
super(tenant, rolloutId);
|
||||
this.rolloutId = rolloutId;
|
||||
this.rolloutGroupIds = rolloutGroupIds;
|
||||
this.rolloutGroupIds = new ArrayList<>(rolloutGroupIds);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.service;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
||||
@@ -17,6 +19,9 @@ import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public abstract class AbstractServiceRemoteEvent<T extends AbstractRemoteEvent> extends AbstractRemoteEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final T remoteEvent;
|
||||
|
||||
protected AbstractServiceRemoteEvent(T remoteEvent) {
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
@@ -22,6 +24,9 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@ToString(callSuper = true)
|
||||
public class AssignmentQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
|
||||
private static final SpServerError errorType = SpServerError.SP_QUOTA_EXCEEDED;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -33,22 +32,15 @@ public class IncompatibleTargetTypeException extends AbstractServerRtException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Collection<String> targetTypeNames;
|
||||
private final Collection<String> distributionSetTypeNames;
|
||||
|
||||
public IncompatibleTargetTypeException(final String targetTypeName, final Collection<String> distributionSetTypeNames) {
|
||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||
String.format("Target of type %s is not compatible with distribution set of types %s", targetTypeName, distributionSetTypeNames)
|
||||
);
|
||||
this.targetTypeNames = Collections.singleton(targetTypeName);
|
||||
this.distributionSetTypeNames = distributionSetTypeNames;
|
||||
String.format("Target of type %s is not compatible with distribution set of types %s",
|
||||
targetTypeName, distributionSetTypeNames));
|
||||
}
|
||||
|
||||
public IncompatibleTargetTypeException(final Collection<String> targetTypeNames, final String distributionSetTypeName) {
|
||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||
String.format("Targets of types %s are not compatible with distribution set of type %s", targetTypeNames,
|
||||
distributionSetTypeName));
|
||||
this.targetTypeNames = targetTypeNames;
|
||||
this.distributionSetTypeNames = Collections.singleton(distributionSetTypeName);
|
||||
String.format("Targets of types %s are not compatible with distribution set of type %s",
|
||||
targetTypeNames, distributionSetTypeName));
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
@@ -17,7 +16,7 @@ import org.eclipse.hawkbit.repository.Identifiable;
|
||||
/**
|
||||
* Core information of all entities.
|
||||
*/
|
||||
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
||||
public interface BaseEntity extends Identifiable<Long> {
|
||||
|
||||
static Long getIdOrNull(final BaseEntity entity) {
|
||||
return entity == null ? null : entity.getId();
|
||||
|
||||
@@ -19,10 +19,9 @@ public class EventJacksonMessageConverter extends MappingJackson2MessageConverte
|
||||
|
||||
public static final MimeType APPLICATION_REMOTE_EVENT_JSON = new MimeType("application", "remote-event-json");
|
||||
|
||||
|
||||
public EventJacksonMessageConverter() {
|
||||
super(APPLICATION_REMOTE_EVENT_JSON);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
final ObjectMapper objectMapper = new ObjectMapper();
|
||||
EventType.getNamedTypes().forEach(objectMapper::registerSubtypes);
|
||||
setObjectMapper(objectMapper);
|
||||
}
|
||||
@@ -36,4 +35,4 @@ public class EventJacksonMessageConverter extends MappingJackson2MessageConverte
|
||||
protected Object convertFromInternal(final Message<?> message, final Class<?> targetClass, final Object conversionHint) {
|
||||
return super.convertFromInternal(message, targetClass, conversionHint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -142,6 +143,9 @@ public class JpaConfiguration extends JpaBaseConfiguration {
|
||||
|
||||
static class CustomHibernateJpaDialect extends HibernateJpaDialect {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected CustomHibernateJpaDialect() {
|
||||
super();
|
||||
this.setJdbcExceptionTranslator(JpaExceptionTranslator.getTranslator());
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.acm;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -70,7 +71,7 @@ public class AccessControllerConfiguration {
|
||||
return new AccessController<>() {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Optional<Specification<JpaAction>> getAccessRules(final Operation operation) {
|
||||
return targetAccessController.getAccessRules(map(operation)).map(targetSpec -> (actionRoot, query, cb) -> {
|
||||
final Join<JpaAction, JpaTarget> targetJoin = actionRoot.join(JpaAction_.target);
|
||||
@@ -162,6 +163,9 @@ public class AccessControllerConfiguration {
|
||||
|
||||
private static class RawAuthoritiesAuthentication implements Authentication {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Authentication authentication;
|
||||
private final transient SingletonSupplier<List<? extends GrantedAuthority>> rawAuthoritiesSupplier;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import javax.sql.DataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.DeploymentHelper;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.DeadlockLoserDataAccessException;
|
||||
import org.springframework.dao.PessimisticLockingFailureException;
|
||||
import org.springframework.dao.QueryTimeoutException;
|
||||
import org.springframework.integration.jdbc.lock.DefaultLockRepository;
|
||||
@@ -55,10 +54,8 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
||||
// lock <-> next refresh time
|
||||
private final Map<String, Instant> lockToRefreshTime = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* @param dataSource to use for managing the locks
|
||||
*/
|
||||
public DistributedLockRepository(final DataSource dataSource, final LockProperties lockProperties, final PlatformTransactionManager txManager) {
|
||||
public DistributedLockRepository(
|
||||
final DataSource dataSource, final LockProperties lockProperties, final PlatformTransactionManager txManager) {
|
||||
super(dataSource);
|
||||
this.txManager = txManager;
|
||||
|
||||
@@ -91,14 +88,14 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
||||
if (count < MAX_DELETE_RETRY) {
|
||||
log.debug("Failed to delete cluster lock {}. We try again.", lock, e);
|
||||
return delete(lock, count + 1);
|
||||
} else {
|
||||
} else {
|
||||
log.warn("Failed to delete cluster lock {}!", lock, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(propagation=Propagation.NOT_SUPPORTED)
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
@Override
|
||||
public boolean acquire(final String lock) {
|
||||
try {
|
||||
@@ -106,14 +103,13 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
||||
// because we need to know real (after transaction commit) result Ïto know if it is really successful.
|
||||
// otherwise the super.acquire will return result before been committed and could be false positive
|
||||
final boolean acquired = DeploymentHelper.runInNewTransaction(
|
||||
txManager, "lock-acquire", Isolation.READ_COMMITTED.value(), status -> super.acquire(lock));
|
||||
txManager, "lock-acquire", Isolation.READ_COMMITTED.value(), status -> super.acquire(lock));
|
||||
if (acquired) {
|
||||
// update next refresh time
|
||||
refreshAfterMillis.ifPresent(
|
||||
afterMillis -> lockToRefreshTime.put(lock, Instant.now().plus(afterMillis, ChronoUnit.MILLIS)));
|
||||
refreshAfterMillis.ifPresent(afterMillis -> lockToRefreshTime.put(lock, Instant.now().plus(afterMillis, ChronoUnit.MILLIS)));
|
||||
}
|
||||
return acquired;
|
||||
} catch (final DataIntegrityViolationException | DeadlockLoserDataAccessException e) {
|
||||
} catch (final DataIntegrityViolationException | PessimisticLockingFailureException e) {
|
||||
log.debug("Could not acquire cluster lock {}. I guess another node has it.", lock, e);
|
||||
return false;
|
||||
} catch (final QueryTimeoutException e) {
|
||||
@@ -122,7 +118,7 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"java:S1066"})
|
||||
@SuppressWarnings({ "java:S1066" })
|
||||
@Scheduled(initialDelayString = TIC_PERIOD_MS, fixedDelayString = TIC_PERIOD_MS)
|
||||
public void refresh() {
|
||||
refreshAfterMillis.ifPresentOrElse(afterMillis -> {
|
||||
|
||||
@@ -124,7 +124,8 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
||||
|
||||
static {
|
||||
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED = new EnumMap<>(Database.class);
|
||||
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED.put(Database.POSTGRESQL,
|
||||
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED.put(
|
||||
Database.POSTGRESQL,
|
||||
"DELETE FROM sp_action " + "WHERE id IN (SELECT id FROM sp_action " + "WHERE tenant=" + Jpa.nativeQueryParamPrefix() + "tenant" + " AND status IN (%s)" + " AND last_modified_at<" + Jpa.nativeQueryParamPrefix() + "last_modified_at LIMIT " + ACTION_PAGE_LIMIT + ")");
|
||||
}
|
||||
|
||||
|
||||
@@ -421,8 +421,8 @@ public class JpaDistributionSetManagement
|
||||
|
||||
private List<JpaDistributionSet> updateTag(
|
||||
final Collection<Long> dsIds, final long dsTagId,
|
||||
final BiFunction<DistributionSetTag, JpaDistributionSet, JpaDistributionSet> updater) {
|
||||
final DistributionSetTag tag = distributionSetTagManagement.get(dsTagId);
|
||||
final BiFunction<JpaDistributionSetTag, JpaDistributionSet, JpaDistributionSet> updater) {
|
||||
final JpaDistributionSetTag tag = distributionSetTagManagement.get(dsTagId);
|
||||
final List<JpaDistributionSet> allDs = dsIds.size() == 1 ?
|
||||
jpaRepository.findById(dsIds.iterator().next())
|
||||
.map(List::of)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -36,9 +34,6 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "name", nullable = false, length = NAME_MAX_SIZE)
|
||||
@Size(min = 1, max = NAME_MAX_SIZE)
|
||||
@NotNull
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
/**
|
||||
* Extension for {@link NamedEntity} that are versioned.
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED) // Default constructor needed for JPA entities
|
||||
@Setter
|
||||
@Getter
|
||||
@ToString(callSuper = true)
|
||||
@@ -33,27 +34,13 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "version", nullable = false, length = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||
@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||
@NotNull
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* parameterized constructor.
|
||||
*
|
||||
* @param name of the entity
|
||||
* @param version of the entity
|
||||
* @param description
|
||||
*/
|
||||
AbstractJpaNamedVersionedEntity(final String name, final String version, final String description) {
|
||||
super(name, description);
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
AbstractJpaNamedVersionedEntity() {
|
||||
// Default constructor needed for JPA entities
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -34,9 +32,6 @@ import org.eclipse.hawkbit.repository.model.Type;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public abstract class AbstractJpaTypeEntity extends AbstractJpaNamedEntity implements Type {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "type_key", nullable = false, updatable = false, length = KEY_MAX_SIZE)
|
||||
@Size(min = 1, max = KEY_MAX_SIZE)
|
||||
@NotNull
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
@@ -35,10 +33,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
@NoArgsConstructor // Default constructor for JPA
|
||||
@Entity
|
||||
@Table(name = "sp_ds_type_element")
|
||||
public class DistributionSetTypeElement implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class DistributionSetTypeElement {
|
||||
|
||||
@EmbeddedId
|
||||
private DistributionSetTypeElementCompositeKey key;
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
@@ -25,10 +22,7 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Data
|
||||
@Embeddable
|
||||
public class DistributionSetTypeElementCompositeKey implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class DistributionSetTypeElementCompositeKey {
|
||||
|
||||
@Column(name = "distribution_set_type", nullable = false, updatable = false)
|
||||
private Long dsType;
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import static org.eclipse.hawkbit.repository.model.BaseEntity.getIdOrNull;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
@@ -72,13 +71,9 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
||||
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Getter
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "distribution_set", nullable = false, updatable = false)
|
||||
@JoinColumn(name = "distribution_set", nullable = false, updatable = false)
|
||||
@NotNull
|
||||
private JpaDistributionSet distributionSet;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -46,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final int MESSAGE_ENTRY_LENGTH = 512;
|
||||
|
||||
@Setter
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -40,9 +38,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY)
|
||||
@JoinColumn(
|
||||
name = "software_module", nullable = false, updatable = false)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -68,9 +67,6 @@ public class JpaDistributionSet
|
||||
extends AbstractJpaNamedVersionedEntity
|
||||
implements DistributionSet, WithMetadata<String, String>, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false, targetEntity = JpaDistributionSetType.class)
|
||||
@JoinColumn(name = "ds_type", nullable = false, updatable = false)
|
||||
@NotNull
|
||||
@@ -81,17 +77,14 @@ public class JpaDistributionSet
|
||||
name = "sp_ds_sm",
|
||||
joinColumns = { @JoinColumn(name = "ds_id", nullable = false) },
|
||||
inverseJoinColumns = { @JoinColumn(name = "sm_id", nullable = false) })
|
||||
private Set<SoftwareModule> modules = new HashSet<>();
|
||||
private Set<JpaSoftwareModule> modules = new HashSet<>();
|
||||
|
||||
@ManyToMany(targetEntity = JpaDistributionSetTag.class)
|
||||
@JoinTable(
|
||||
name = "sp_ds_tag",
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ds", nullable = false) },
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(
|
||||
name = "tag", nullable = false) })
|
||||
private Set<DistributionSetTag> tags = new HashSet<>();
|
||||
joinColumns = { @JoinColumn(name = "ds", nullable = false) },
|
||||
inverseJoinColumns = { @JoinColumn(name = "tag", nullable = false) })
|
||||
private Set<JpaDistributionSetTag> tags = new HashSet<>();
|
||||
|
||||
// no cascade option on an ElementCollection, the target objects are always persisted, merged, removed with their parent
|
||||
@Getter
|
||||
@@ -128,7 +121,7 @@ public class JpaDistributionSet
|
||||
}
|
||||
|
||||
@SuppressWarnings("java:S1144") // used via reflection copy utils
|
||||
private JpaDistributionSet setModules(final Set<SoftwareModule> modules) {
|
||||
private JpaDistributionSet setModules(final Set<JpaSoftwareModule> modules) {
|
||||
if (modules == null) {
|
||||
return this; // do not change
|
||||
}
|
||||
@@ -163,14 +156,14 @@ public class JpaDistributionSet
|
||||
}).orElse(true);
|
||||
}
|
||||
|
||||
public void addModule(final SoftwareModule softwareModule) {
|
||||
public void addModule(final JpaSoftwareModule softwareModule) {
|
||||
if (isLocked()) {
|
||||
throw new LockedException(JpaDistributionSet.class, getId(), "ADD_SOFTWARE_MODULE");
|
||||
}
|
||||
|
||||
checkTypeCompatability(softwareModule);
|
||||
|
||||
final Optional<SoftwareModule> found = modules.stream()
|
||||
final Optional<JpaSoftwareModule> found = modules.stream()
|
||||
.filter(module -> module.getId().equals(softwareModule.getId())).findAny();
|
||||
if (found.isPresent()) {
|
||||
return;
|
||||
@@ -199,14 +192,14 @@ public class JpaDistributionSet
|
||||
return Collections.unmodifiableSet(tags);
|
||||
}
|
||||
|
||||
public void addTag(final DistributionSetTag tag) {
|
||||
public void addTag(final JpaDistributionSetTag tag) {
|
||||
if (tags == null) {
|
||||
tags = new HashSet<>();
|
||||
}
|
||||
tags.add(tag);
|
||||
}
|
||||
|
||||
public void removeTag(final DistributionSetTag tag) {
|
||||
public void removeTag(final JpaDistributionSetTag tag) {
|
||||
if (tags != null) {
|
||||
tags.remove(tag);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -35,19 +34,9 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
||||
private List<DistributionSet> assignedToDistributionSet;
|
||||
|
||||
/**
|
||||
* Public constructor.
|
||||
*
|
||||
* @param name of the {@link DistributionSetTag}
|
||||
* @param description of the {@link DistributionSetTag}
|
||||
* @param colour of tag in UI
|
||||
*/
|
||||
public JpaDistributionSetTag(final String name, final String description, final String colour) {
|
||||
super(name, description, colour);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -42,9 +41,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaDistributionSetType extends AbstractJpaTypeEntity implements DistributionSetType, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToMany(
|
||||
mappedBy = "dsType", targetEntity = DistributionSetTypeElement.class,
|
||||
fetch = FetchType.EAGER,
|
||||
@@ -125,7 +121,8 @@ public class JpaDistributionSetType extends AbstractJpaTypeEntity implements Dis
|
||||
.publishEvent(new DistributionSetTypeDeletedEvent(getTenant(), getId(), getClass()));
|
||||
}
|
||||
|
||||
private JpaDistributionSetType replaceOrAddModuleTypes(final Set<SoftwareModuleType> smTypes, final boolean mandatory, final boolean replace) {
|
||||
private JpaDistributionSetType replaceOrAddModuleTypes(final Set<SoftwareModuleType> smTypes, final boolean mandatory,
|
||||
final boolean replace) {
|
||||
if (smTypes == null) {
|
||||
return this; // do not change
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
@@ -63,9 +62,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
||||
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToMany(targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, mappedBy = "rollout")
|
||||
private List<JpaRolloutGroup> rolloutGroups = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -48,9 +47,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Getter
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "rollout", nullable = false, updatable = false)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -67,9 +65,6 @@ public class JpaSoftwareModule
|
||||
extends AbstractJpaNamedVersionedEntity
|
||||
implements SoftwareModule, WithMetadata<MetadataValue, JpaSoftwareModule.JpaMetadataValue>, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "sm_type", nullable = false, updatable = false)
|
||||
@NotNull
|
||||
@@ -178,10 +173,7 @@ public class JpaSoftwareModule
|
||||
|
||||
@Data
|
||||
@Embeddable
|
||||
public static class JpaMetadataValue implements MetadataValue, Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static class JpaMetadataValue implements MetadataValue {
|
||||
|
||||
@Column(name = "meta_value", length = SoftwareModule.METADATA_VALUE_MAX_SIZE)
|
||||
@Size(max = METADATA_VALUE_MAX_SIZE)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
@@ -36,9 +34,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements SoftwareModuleType, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Setter(value = lombok.AccessLevel.PRIVATE) // used via reflection
|
||||
@Column(name = "min_artifacts", nullable = false)
|
||||
@Min(0)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.validation.constraints.Size;
|
||||
@@ -31,9 +29,6 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaTag extends AbstractJpaNamedEntity implements Tag {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "colour", nullable = true, length = Tag.COLOUR_MAX_SIZE)
|
||||
@Size(max = Tag.COLOUR_MAX_SIZE)
|
||||
private String colour;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -84,9 +83,6 @@ import org.springframework.util.ObjectUtils;
|
||||
@SuppressWarnings({ "squid:S2160", "java:S1710" })
|
||||
public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Column(name = "controller_id", length = Target.CONTROLLER_ID_MAX_SIZE, updatable = false, nullable = false)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Optional;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
@@ -46,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "name", length = NamedEntity.NAME_MAX_SIZE, nullable = false)
|
||||
@Size(max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotEmpty
|
||||
@@ -113,7 +109,7 @@ public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity imple
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent() {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent( new TargetFilterQueryUpdatedEvent(this));
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new TargetFilterQueryUpdatedEvent(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@@ -31,9 +29,6 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
@Table(name = "sp_target_tag")
|
||||
public class JpaTargetTag extends JpaTag implements TargetTag, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JpaTargetTag(final String name, final String description, final String colour) {
|
||||
super(name, description, colour);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -40,9 +39,6 @@ import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
@SuppressWarnings("java:S2160") // the super class equals/hashcode shall be used
|
||||
public class JpaTargetType extends AbstractJpaTypeEntity implements TargetType, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToMany(targetEntity = JpaDistributionSetType.class)
|
||||
@JoinTable(
|
||||
name = "sp_target_type_ds_type",
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -39,9 +37,6 @@ import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration, EventAwareEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "conf_key", length = TenantConfiguration.KEY_MAX_SIZE, nullable = false, updatable = false)
|
||||
@Size(min = 1, max = TenantConfiguration.KEY_MAX_SIZE)
|
||||
@NotNull
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EntityManager;
|
||||
@@ -47,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "tenant", nullable = false, updatable = false, length = 40)
|
||||
@Size(min = 1, max = 40)
|
||||
@NotNull
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
@@ -35,10 +33,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
@IdClass(RolloutTargetGroupId.class)
|
||||
@Entity
|
||||
@Table(name = "sp_rollout_target_group")
|
||||
public class RolloutTargetGroup implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class RolloutTargetGroup {
|
||||
|
||||
@Id
|
||||
@ManyToOne(optional = false, targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -24,10 +21,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
@NoArgsConstructor // Default constructor for JPA
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
public class RolloutTargetGroupId implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class RolloutTargetGroupId {
|
||||
|
||||
private Long rolloutGroup;
|
||||
private Long target;
|
||||
|
||||
@@ -136,7 +136,7 @@ public interface BaseEntityRepository<T extends AbstractJpaBaseEntity>
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@SuppressWarnings("uchecked")
|
||||
@SuppressWarnings("unchecked")
|
||||
default Class<? extends BaseEntity> getManagementClass() {
|
||||
final Class<T> domainClass = getDomainClass();
|
||||
final String domainClassSimpleName = domainClass.getSimpleName();
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @param <ID> the type of the id of the entity the repository manages
|
||||
*/
|
||||
@SuppressWarnings("java:S119") // inherited from SimpleJpaRepository
|
||||
public class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
||||
public final class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
||||
implements JpaSpecificationEntityGraphExecutor<T>, NoCountSliceRepository<T>, ACMRepository<T> {
|
||||
|
||||
private final EntityManager entityManager;
|
||||
|
||||
@@ -9,12 +9,17 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.rollout.condition;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Exception indicating that a specific evaluator is missing in the application
|
||||
* context.
|
||||
*/
|
||||
public class EvaluatorNotConfiguredException extends RuntimeException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String MESSAGE_FORMAT = "Cannot find any configured evaluator for action/condition '%s'. Please ensure to configure one in the application context to make use of it.";
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.utils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -94,6 +95,9 @@ public class StatisticsUtils {
|
||||
// Map with user-friendly toString, sorted and without the last ", "
|
||||
private static class MapUFToString extends HashMap<String, Double> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (isEmpty()) {
|
||||
|
||||
@@ -124,6 +124,7 @@ public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest
|
||||
|
||||
protected static <T> T[] toArray(final Iterable<? extends T> it, final Class<T> type) {
|
||||
final List<T> list = toList(it);
|
||||
@SuppressWarnings("unchecked")
|
||||
final T[] array = (T[]) Array.newInstance(type, list.size());
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = list.get(i);
|
||||
|
||||
@@ -46,6 +46,7 @@ class TargetTypeManagementTest extends AbstractAccessControllerManagementTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
void verifyRead() {
|
||||
// permissions to read only type1 target types
|
||||
runAs(withAuthorities(READ_TARGET_TYPE + "/id==" + targetType1.getId()), () -> {
|
||||
|
||||
@@ -150,12 +150,11 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
||||
final String successCondition = "50";
|
||||
final String errorCondition = "80";
|
||||
final String rolloutName = "rolloutTest";
|
||||
final String targetPrefixName = rolloutName;
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("dsFor" + rolloutName);
|
||||
testdataFactory.createTargets(amountTargetsForRollout, targetPrefixName + "-", targetPrefixName);
|
||||
testdataFactory.createTargets(amountTargetsForRollout, rolloutName + "-", rolloutName);
|
||||
|
||||
final Rollout createdRollout = testdataFactory.createRolloutByVariables(rolloutName, "desc", amountGroups,
|
||||
"controllerId==" + targetPrefixName + "-*", distributionSet, successCondition, errorCondition);
|
||||
final Rollout createdRollout = testdataFactory.createRolloutByVariables(
|
||||
rolloutName, "desc", amountGroups,"controllerId==" + rolloutName + "-*", distributionSet, successCondition, errorCondition);
|
||||
|
||||
rolloutManagement.delete(createdRollout.getId());
|
||||
rolloutHandler.handleAll();
|
||||
|
||||
@@ -987,12 +987,14 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
final int noOfDeployedTargets = 4;
|
||||
final int noOfDistributionSets = 3;
|
||||
|
||||
final DeploymentResult deploymentResult = prepareComplexRepo(undeployedTargetPrefix, noOfUndeployedTargets,
|
||||
deployedTargetPrefix, noOfDeployedTargets, noOfDistributionSets, "myTestDS");
|
||||
final DeploymentResult deploymentResult = prepareComplexRepo(
|
||||
undeployedTargetPrefix, noOfUndeployedTargets, deployedTargetPrefix, noOfDeployedTargets, noOfDistributionSets, "myTestDS");
|
||||
|
||||
final List<Long> deployedTargetIDs = deploymentResult.getDeployedTargetIDs();
|
||||
final List<Long> undeployedTargetIDs = deploymentResult.getUndeployedTargetIDs();
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
final Collection<JpaTarget> savedNakedTargets = (Collection) deploymentResult.getUndeployedTargets();
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
final Collection<JpaTarget> savedDeployedTargets = (Collection) deploymentResult.getDeployedTargets();
|
||||
|
||||
// retrieving all Actions created by the assignDistributionSet call
|
||||
|
||||
@@ -123,12 +123,10 @@ public abstract class AbstractIntegrationTest {
|
||||
protected static final Pageable UNPAGED = Pageable.unpaged();
|
||||
|
||||
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
||||
protected static final int DEFAULT_TEST_WEIGHT = 500;
|
||||
protected static final Random RND = TestdataFactory.RND;
|
||||
|
||||
/**
|
||||
* Number of {@link DistributionSetType}s that exist in every test case. One
|
||||
* generated by using
|
||||
* Number of {@link DistributionSetType}s that exist in every test case. One generated by using
|
||||
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and three
|
||||
* {@link SystemManagement#getTenantMetadata()};
|
||||
*/
|
||||
|
||||
@@ -139,6 +139,7 @@ public class SecurityContextSwitch {
|
||||
// in some cases it could be serializable, e.g. if got via {@link java.lang.reflect.AnnotatedElement} (see javadoc) or WithUserImpl,
|
||||
// and in some cases it used to be serialized, e.g. in {@link SecurityContextSerializer#JavaSerialization.serialize},
|
||||
// must not be made transient!
|
||||
@SuppressWarnings("serial")
|
||||
private final WithUser annotation;
|
||||
|
||||
WithUserSecurityContext(final WithUser annotation) {
|
||||
@@ -197,6 +198,9 @@ public class SecurityContextSwitch {
|
||||
|
||||
private static class WithUserImpl implements WithUser, Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String principal;
|
||||
private final String tenant;
|
||||
private final boolean autoCreateTenant;
|
||||
|
||||
Reference in New Issue
Block a user