Merge branch 'master' into feature_enable_push_in_deployment_view
Conflicts: hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/SoftwareModuleMetadatadetailslayout.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetDetails.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionDetails.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
@@ -44,9 +44,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
*/
|
||||
public interface DistributionSetManagement {
|
||||
|
||||
// TODO rename/document the whole with details thing (document what the
|
||||
// details are and maybe find a better name, e.g. with dependencies?)
|
||||
|
||||
/**
|
||||
* Assigns {@link SoftwareModule} to existing {@link DistributionSet}.
|
||||
*
|
||||
@@ -330,7 +327,6 @@ public interface DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<DistributionSet> findDistributionSetsAll(Collection<Long> dist);
|
||||
|
||||
// TODO discuss: use enum instead of the true,false,null switch ?
|
||||
/**
|
||||
* finds all {@link DistributionSet}s.
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
|
||||
/**
|
||||
* Event declaration for the UI to notify the UI that a rollout has been
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public class RolloutChangeEvent extends AbstractEvent {
|
||||
public class RolloutChangeEvent extends DefaultEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
|
||||
/**
|
||||
* Event declaration for the UI to notify the UI that a rollout has been
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupChangeEvent extends AbstractEvent {
|
||||
public class RolloutGroupChangeEvent extends DefaultEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutGroupId;
|
||||
|
||||
@@ -11,14 +11,14 @@ package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Event that gets sent when a distribution set gets assigned to a target.
|
||||
*
|
||||
*/
|
||||
public class TargetAssignDistributionSetEvent extends AbstractEvent {
|
||||
public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
|
||||
private final Collection<SoftwareModule> softwareModules;
|
||||
private final String controllerId;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if artifact deletion failed.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class ArtifactDeleteFailedException extends SpServerRtException {
|
||||
public final class ArtifactDeleteFailedException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class ArtifactUploadFailedException extends SpServerRtException {
|
||||
public final class ArtifactUploadFailedException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if cancelation of actions is performened where the action is not
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class CancelActionNotAllowedException extends SpServerRtException {
|
||||
public final class CancelActionNotAllowedException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* {@link ConcurrentModificationException} is thrown when a given entity in's
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ConcurrentModificationException extends SpServerRtException {
|
||||
public class ConcurrentModificationException extends AbstractServerRtException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_CONCURRENT_MODIFICATION;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if DS creation failed.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class DistributionSetCreationFailedMissingMandatoryModuleException extends SpServerRtException {
|
||||
public final class DistributionSetCreationFailedMissingMandatoryModuleException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTypeUndefinedException extends SpServerRtException {
|
||||
public class DistributionSetTypeUndefinedException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* the {@link EntityAlreadyExistsException} is thrown when a entity is tried to
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EntityAlreadyExistsException extends SpServerRtException {
|
||||
public class EntityAlreadyExistsException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_ALRREADY_EXISTS;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* The {@link EntityLockedException} is thrown when an entity has been locked by
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EntityLockedException extends SpServerRtException {
|
||||
public class EntityLockedException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_ENTITY_LOCKED;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* the {@link EntityNotFoundException} is thrown when a entity is tried find but
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EntityNotFoundException extends SpServerRtException {
|
||||
public class EntityNotFoundException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_NOT_EXISTS;
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* the {@link EntityReadOnlyException} is thrown when a entity is in read only
|
||||
* mode and a user tries to change it.
|
||||
*/
|
||||
public class EntityReadOnlyException extends SpServerRtException {
|
||||
public class EntityReadOnlyException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_READ_ONLY;
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown when force quitting an actions is not allowed. e.g. the action is not
|
||||
* active or it is not canceled before.
|
||||
*
|
||||
*/
|
||||
public final class ForceQuitActionNotAllowedException extends SpServerRtException {
|
||||
public final class ForceQuitActionNotAllowedException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class GridFSDBFileNotFoundException extends SpServerRtException {
|
||||
public final class GridFSDBFileNotFoundException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if a distribution set is assigned to a a target that is incomplete
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class IncompleteDistributionSetException extends SpServerRtException {
|
||||
public final class IncompleteDistributionSetException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Exception which is thrown in case the current security context object does
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InsufficientPermissionException extends SpServerRtException {
|
||||
public class InsufficientPermissionException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if MD5 checksum check fails.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InvalidMD5HashException extends SpServerRtException {
|
||||
public class InvalidMD5HashException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if SHA1 checksum check fails.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InvalidSHA1HashException extends SpServerRtException {
|
||||
public class InvalidSHA1HashException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Exception which is thrown when trying to set an invalid target address.
|
||||
*/
|
||||
public class InvalidTargetAddressException extends SpServerRtException {
|
||||
public class InvalidTargetAddressException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if a multi part exception occurred.
|
||||
*
|
||||
*/
|
||||
public final class MultiPartFileUploadException extends SpServerRtException {
|
||||
public final class MultiPartFileUploadException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Exception used by the REST API in case of RSQL search filter query.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RSQLParameterSyntaxException extends SpServerRtException {
|
||||
public class RSQLParameterSyntaxException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Exception used by the REST API in case of invalid field name in the rsql
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RSQLParameterUnsupportedFieldException extends SpServerRtException {
|
||||
public class RSQLParameterUnsupportedFieldException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* the {@link RolloutIllegalStateException} is thrown when a rollout is changing
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
* rollout, or trying to resume a already finished rollout.
|
||||
*
|
||||
*/
|
||||
public class RolloutIllegalStateException extends SpServerRtException {
|
||||
public class RolloutIllegalStateException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_ROLLOUT_ILLEGAL_STATE;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* the {@link TenantNotExistException} is thrown when e.g. a controller tries to
|
||||
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TenantNotExistException extends SpServerRtException {
|
||||
public class TenantNotExistException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_TENANT_NOT_EXISTS;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if too many status entries have been inserted.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class ToManyAttributeEntriesException extends SpServerRtException {
|
||||
public final class ToManyAttributeEntriesException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Thrown if too many status entries have been inserted.
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class ToManyStatusEntriesException extends SpServerRtException {
|
||||
public final class ToManyStatusEntriesException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -23,7 +23,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class UnsupportedSoftwareModuleForThisDistributionSetException extends SpServerRtException {
|
||||
public class UnsupportedSoftwareModuleForThisDistributionSetException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -27,43 +27,84 @@ import org.eclipse.hawkbit.repository.model.EntityInterceptor;
|
||||
*/
|
||||
public class EntityInterceptorListener {
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>pre persist</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PrePersist
|
||||
protected void prePersist(final Object entity) {
|
||||
public void prePersist(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.prePersist(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>post persist</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PostPersist
|
||||
protected void postPersist(final Object entity) {
|
||||
public void postPersist(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.postPersist(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>post remove</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PostRemove
|
||||
protected void postRemove(final Object entity) {
|
||||
public void postRemove(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.postRemove(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>pre remove</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PreRemove
|
||||
protected void preRemove(final Object entity) {
|
||||
public void preRemove(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.preRemove(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>post load</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PostLoad
|
||||
protected void postLoad(final Object entity) {
|
||||
public void postLoad(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.postLoad(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>pre update</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PreUpdate
|
||||
protected void preUpdate(final Object entity) {
|
||||
public void preUpdate(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.preUpdate(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for lifecyle event <i>post update</i>.
|
||||
*
|
||||
* @param entity
|
||||
* the JPA entity which this listener is associated with
|
||||
*/
|
||||
@PostUpdate
|
||||
protected void postUpdate(final Object entity) {
|
||||
public void postUpdate(final Object entity) {
|
||||
notifyAll(interceptor -> interceptor.postUpdate(entity));
|
||||
}
|
||||
|
||||
private void notifyAll(final Consumer<? super EntityInterceptor> action) {
|
||||
private static void notifyAll(final Consumer<? super EntityInterceptor> action) {
|
||||
EntityInterceptorHolder.getInstance().getEntityInterceptors().forEach(action);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.hamcrest.Matchers;
|
||||
/**
|
||||
* Matcher for {@link BaseEntity}.
|
||||
*/
|
||||
public class BaseEntityMatcher {
|
||||
public final class BaseEntityMatcher {
|
||||
|
||||
private BaseEntityMatcher() {
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
||||
createTestdatabaseAndStart();
|
||||
}
|
||||
|
||||
private static void createTestdatabaseAndStart() {
|
||||
private static synchronized void createTestdatabaseAndStart() {
|
||||
if ("MYSQL".equals(System.getProperty("spring.jpa.database"))) {
|
||||
tesdatabase = new CIMySqlTestDatabase();
|
||||
tesdatabase.before();
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.net.ServerSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Look for a free port.
|
||||
*/
|
||||
public class FreePortFileWriter {
|
||||
|
||||
@@ -24,7 +24,9 @@ public class FreePortFileWriter {
|
||||
|
||||
/**
|
||||
* @param from
|
||||
* port range from (start point)
|
||||
* @param to
|
||||
* port range to (end point)
|
||||
*/
|
||||
public FreePortFileWriter(final int from, final int to, final String filePortPath) {
|
||||
this.from = from;
|
||||
@@ -51,25 +53,21 @@ public class FreePortFileWriter {
|
||||
portFile.getParentFile().mkdirs();
|
||||
if (portFile.exists()) {
|
||||
return false;
|
||||
} else {
|
||||
boolean isFree = false;
|
||||
final ServerSocket sock = new ServerSocket();
|
||||
sock.setReuseAddress(true);
|
||||
sock.bind(new InetSocketAddress(port));
|
||||
if (portFile.createNewFile()) {
|
||||
portFile.deleteOnExit();
|
||||
isFree = true;
|
||||
}
|
||||
sock.close();
|
||||
// is free:
|
||||
return isFree;
|
||||
// We rely on an exception thrown to determine availability or
|
||||
// not availability.
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
// not free.
|
||||
boolean isFree = false;
|
||||
final ServerSocket sock = new ServerSocket();
|
||||
sock.setReuseAddress(true);
|
||||
sock.bind(new InetSocketAddress(port));
|
||||
if (portFile.createNewFile()) {
|
||||
portFile.deleteOnExit();
|
||||
isFree = true;
|
||||
}
|
||||
sock.close();
|
||||
return isFree;
|
||||
// We rely on an exception thrown to determine availability or
|
||||
// not availability and don't want to log the exception.
|
||||
} catch (@SuppressWarnings({ "squid:S2221", "squid:S1166" }) final Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,11 +13,14 @@ import java.util.List;
|
||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public class JpaTestRepositoryManagement implements TestRepositoryManagement {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JpaTestRepositoryManagement.class);
|
||||
@Autowired
|
||||
private TenantAwareCacheManager cacheManager;
|
||||
|
||||
@@ -28,6 +31,7 @@ public class JpaTestRepositoryManagement implements TestRepositoryManagement {
|
||||
private SystemManagement systemManagement;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void clearTestRepository() {
|
||||
deleteAllRepos();
|
||||
cacheManager.getDirectCacheNames().forEach(name -> cacheManager.getDirectCache(name).clear());
|
||||
@@ -43,7 +47,7 @@ public class JpaTestRepositoryManagement implements TestRepositoryManagement {
|
||||
return null;
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("Error hile delete tenant", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -191,16 +191,17 @@ public class TestdataFactory {
|
||||
public DistributionSet createDistributionSet(final String prefix, final String version,
|
||||
final boolean isRequiredMigrationStep) {
|
||||
|
||||
final SoftwareModule appMod = softwareManagement.createSoftwareModule(entityFactory.generateSoftwareModule(
|
||||
findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE), prefix + SM_TYPE_APP,
|
||||
version + "." + new Random().nextInt(100), LOREM.words(20), prefix + " vendor Limited, California"));
|
||||
final SoftwareModule appMod = softwareManagement.createSoftwareModule(
|
||||
entityFactory.generateSoftwareModule(findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE),
|
||||
prefix + SM_TYPE_APP, version + "." + new SecureRandom().nextInt(100), LOREM.words(20),
|
||||
prefix + " vendor Limited, California"));
|
||||
final SoftwareModule runtimeMod = softwareManagement
|
||||
.createSoftwareModule(entityFactory.generateSoftwareModule(findOrCreateSoftwareModuleType(SM_TYPE_RT),
|
||||
prefix + "app runtime", version + "." + new Random().nextInt(100), LOREM.words(20),
|
||||
prefix + "app runtime", version + "." + new SecureRandom().nextInt(100), LOREM.words(20),
|
||||
prefix + " vendor GmbH, Stuttgart, Germany"));
|
||||
final SoftwareModule osMod = softwareManagement
|
||||
.createSoftwareModule(entityFactory.generateSoftwareModule(findOrCreateSoftwareModuleType(SM_TYPE_OS),
|
||||
prefix + " Firmware", version + "." + new Random().nextInt(100), LOREM.words(20),
|
||||
prefix + " Firmware", version + "." + new SecureRandom().nextInt(100), LOREM.words(20),
|
||||
prefix + " vendor Limited Inc, California"));
|
||||
|
||||
return distributionSetManagement
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.helper.SystemManagementHolder;
|
||||
import org.junit.rules.TestRule;
|
||||
@@ -29,16 +28,12 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
public class WithSpringAuthorityRule implements TestRule {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.junit.rules.TestRule#apply(org.junit.runners.model.Statement,
|
||||
* org.junit.runner.Description)
|
||||
*/
|
||||
@Override
|
||||
public Statement apply(final Statement base, final Description description) {
|
||||
return new Statement() {
|
||||
@Override
|
||||
// throwable comes from jnuit evaluate signature
|
||||
@SuppressWarnings("squid:S00112")
|
||||
public void evaluate() throws Throwable {
|
||||
final SecurityContext oldContext = before(description);
|
||||
try {
|
||||
@@ -50,7 +45,7 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
};
|
||||
}
|
||||
|
||||
private SecurityContext before(final Description description) throws Throwable {
|
||||
private SecurityContext before(final Description description) {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
WithUser annotation = description.getAnnotation(WithUser.class);
|
||||
if (annotation == null) {
|
||||
@@ -64,19 +59,14 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
}
|
||||
return oldContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param annotation
|
||||
*/
|
||||
|
||||
private void setSecurityContext(final WithUser annotation) {
|
||||
SecurityContextHolder.setContext(new SecurityContext() {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void setAuthentication(final Authentication authentication) {
|
||||
// nothing todo
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,7 +104,8 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
if (addPermission) {
|
||||
allPermissions.add(permissionName);
|
||||
}
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
// don't want to log this exceptions.
|
||||
} catch (@SuppressWarnings("squid:S1166") IllegalArgumentException | IllegalAccessException e) {
|
||||
// nope
|
||||
}
|
||||
}
|
||||
@@ -130,18 +121,17 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
private void after(final SecurityContext oldContext) {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clears the current security context.
|
||||
*/
|
||||
public void clear()
|
||||
{
|
||||
public void clear() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable
|
||||
* @return
|
||||
* @return the callable result
|
||||
* @throws Exception
|
||||
*/
|
||||
public <T> T runAsPrivileged(final Callable<T> callable) throws Exception {
|
||||
@@ -149,10 +139,10 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param withUser
|
||||
* @param callable
|
||||
* @return
|
||||
* @return callable result
|
||||
* @throws Exception
|
||||
*/
|
||||
public <T> T runAs(final WithUser withUser, final Callable<T> callable) throws Exception {
|
||||
@@ -167,15 +157,13 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
after(oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void createTenant(final String tenantId) throws Exception {
|
||||
|
||||
private void createTenant(final String tenantId) {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
setSecurityContext(privilegedUser());
|
||||
try
|
||||
{
|
||||
try {
|
||||
SystemManagementHolder.getInstance().getSystemManagement().getTenantMetadata(tenantId);
|
||||
}finally
|
||||
{
|
||||
} finally {
|
||||
after(oldContext);
|
||||
}
|
||||
}
|
||||
@@ -183,7 +171,7 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
public static WithUser withUser(final String principal, final String... authorities) {
|
||||
return withUserAndTenant(principal, "default", true, true, authorities);
|
||||
}
|
||||
|
||||
|
||||
public static WithUser withUser(final String principal, final boolean allSpPermision, final String... authorities) {
|
||||
return withUserAndTenant(principal, "default", true, allSpPermision, authorities);
|
||||
}
|
||||
@@ -198,6 +186,15 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
|
||||
public static WithUser withUserAndTenant(final String principal, final String tenant,
|
||||
final boolean autoCreateTenant, final boolean allSpPermission, final String... authorities) {
|
||||
return createWithUser(principal, tenant, autoCreateTenant, allSpPermission, authorities);
|
||||
}
|
||||
|
||||
private static WithUser privilegedUser() {
|
||||
return createWithUser("bumlux", "default", true, true, new String[] { "ROLE_CONTROLLER", "ROLE_SYSTEM_CODE" });
|
||||
}
|
||||
|
||||
private static WithUser createWithUser(final String principal, final String tenant, final boolean autoCreateTenant,
|
||||
final boolean allSpPermission, final String... authorities) {
|
||||
return new WithUser() {
|
||||
|
||||
@Override
|
||||
@@ -227,7 +224,7 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
|
||||
@Override
|
||||
public String[] removeFromAllPermission() {
|
||||
return null;
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,65 +232,10 @@ public class WithSpringAuthorityRule implements TestRule {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.WithUser#autoCreateTenant()
|
||||
*/
|
||||
@Override
|
||||
public boolean autoCreateTenant() {
|
||||
return autoCreateTenant;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static WithUser privilegedUser() {
|
||||
return new WithUser() {
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> annotationType() {
|
||||
return WithUser.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String principal() {
|
||||
return "bumlux";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String credentials() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] authorities() {
|
||||
return new String[] { "ROLE_CONTROLLER", "ROLE_SYSTEM_CODE" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allSpPermissions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] removeFromAllPermission() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tenantId() {
|
||||
return "default";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.WithUser#autoCreateTenant()
|
||||
*/
|
||||
@Override
|
||||
public boolean autoCreateTenant() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user