Feature action cleanup (#704)

* Initial commit
* Tenant configuration enhancements
* Update REST documentation
* Enhance System Configuration view in UI
* Add unit tests
* Fix delete query for H2
* Improve test coverage
* Fix Sonar findings
* Fix Hawkbit bot findings
* Fix PR review findings
* Fix peer review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>
This commit is contained in:
Stefan Behl
2018-07-19 15:23:14 +02:00
committed by GitHub
parent 5e9b0fb884
commit 19caff6e46
28 changed files with 1165 additions and 83 deletions

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@@ -457,4 +458,19 @@ public interface DeploymentManagement {
* if target with given ID does not exist
*/
Optional<DistributionSet> getInstalledDistributionSet(@NotEmpty String controllerId);
/**
* Deletes actions which match one of the given action status and which have
* not been modified since the given (absolute) time-stamp.
*
* @param status
* Set of action status.
* @param lastModified
* A time-stamp in milliseconds.
*
* @return The number of action entries that were deleted.
*/
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
int deleteActionsByStatusAndLastModifiedBefore(@NotNull Set<Action.Status> status, long lastModified);
}

View File

@@ -61,6 +61,7 @@ public class TenantConfigurationProperties {
*
*/
public static class TenantConfigurationKey {
/**
* Header based authentication enabled.
*/
@@ -70,6 +71,7 @@ public class TenantConfigurationProperties {
* Header based authentication authority name.
*/
public static final String AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME = "authentication.header.authority";
/**
* Target token based authentication enabled.
*/
@@ -125,6 +127,21 @@ public class TenantConfigurationProperties {
*/
public static final String REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED = "repository.actions.autoclose.enabled";
/**
* Switch to enable/disable automatic action cleanup.
*/
public static final String ACTION_CLEANUP_ENABLED = "action.cleanup.enabled";
/**
* Specifies the action expiry in milli-seconds.
*/
public static final String ACTION_CLEANUP_ACTION_EXPIRY = "action.cleanup.actionExpiry";
/**
* Specifies the action status.
*/
public static final String ACTION_CLEANUP_ACTION_STATUS = "action.cleanup.actionStatus";
private String keyName;
private String defaultValue = "";
private Class<?> dataType = String.class;

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) 2018 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.tenancy.configuration.validator;
/**
* Specific tenant configuration validator, which validates that the given value
* is a {@link Long}.
*/
public class TenantConfigurationLongValidator implements TenantConfigurationValidator {
@Override
public Class<?> validateToClass() {
return Long.class;
}
}