diff --git a/hawkbit-artifact/hawkbit-artifact-repository-filesystem/src/test/java/org/eclipse/hawkbit/artifact/repository/ArtifactFilesystemTest.java b/hawkbit-artifact/hawkbit-artifact-repository-filesystem/src/test/java/org/eclipse/hawkbit/artifact/repository/ArtifactFilesystemTest.java index e6f355032..02b68d9b8 100644 --- a/hawkbit-artifact/hawkbit-artifact-repository-filesystem/src/test/java/org/eclipse/hawkbit/artifact/repository/ArtifactFilesystemTest.java +++ b/hawkbit-artifact/hawkbit-artifact-repository-filesystem/src/test/java/org/eclipse/hawkbit/artifact/repository/ArtifactFilesystemTest.java @@ -21,7 +21,6 @@ import io.qameta.allure.Description; import io.qameta.allure.Feature; import io.qameta.allure.Story; import org.apache.commons.io.IOUtils; -import org.assertj.core.api.Assertions; import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash; import org.junit.jupiter.api.Test; diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java index 3a01ac192..e25086048 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java @@ -52,7 +52,8 @@ public class EventPublisherAutoConfiguration { * @return publisher bean */ @Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME) - ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor, final TenantAware tenantAware) { + ApplicationEventMulticaster applicationEventMulticaster( + @Qualifier("asyncExecutor") final Executor executor, final TenantAware tenantAware) { final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher( tenantAware, applicationEventFilter()); simpleApplicationEventMulticaster.setTaskExecutor(executor); diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java index e13da73d8..6733b11e1 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java @@ -11,7 +11,6 @@ package org.eclipse.hawkbit.cache; import java.util.Collection; import java.util.Collections; -import java.util.stream.Collectors; import org.eclipse.hawkbit.tenancy.TenantAware; import org.springframework.cache.Cache; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java index bc3137c19..ef9718c3f 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java @@ -93,7 +93,8 @@ public abstract class AbstractServerRtException extends RuntimeException { * @param error detail * @param cause of the exception */ - protected AbstractServerRtException(final String message, final SpServerError error, final Throwable cause, final Map info) { + protected AbstractServerRtException( + final String message, final SpServerError error, final Throwable cause, final Map info) { super(message, cause); this.error = error; this.info = info; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java index 90897a219..efeff7a1f 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java @@ -152,8 +152,8 @@ public enum SpServerError { SP_REPO_OPERATION_NOT_SUPPORTED( "hawkbit.server.error.operation.notSupported", "Operation or method is (no longer) supported by service."), - SP_MAINTENANCE_SCHEDULE_INVALID( - "hawkbit.server.error.maintenanceScheduleInvalid", + SP_MAINTENANCE_SCHEDULE_INVALID( + "hawkbit.server.error.maintenanceScheduleInvalid", "Information for schedule, duration or timezone is missing; or there is no valid maintenance window available in future."), SP_AUTO_ASSIGN_ACTION_TYPE_INVALID( "hawkbit.server.error.repo.invalidAutoAssignActionType", diff --git a/hawkbit-ddi/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java b/hawkbit-ddi/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java index 2f5dedfda..2a06728e1 100644 --- a/hawkbit-ddi/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java +++ b/hawkbit-ddi/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java @@ -100,7 +100,7 @@ public interface DdiRootControllerRestApi { retrieve actions that need to be executed. Those are provided as a list of links to give more detailed information about the action. Links are only available for initial configuration, open actions, or the latest installed action, respectively. The resource supports Etag based modification checks in order to save traffic. - + Note: deployments have to be confirmed in order to move on to the next action. Cancellations have to be confirmed or rejected.""") @ApiResponses(value = { @@ -222,7 +222,7 @@ public interface DdiRootControllerRestApi { */ @Operation(summary = "Resource for software module (Deployment Base)", description = """ Core resource for deployment operations. Contains all information necessary in order to execute the operation. - + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. Host, port and path and not guaranteed to be similar to the provided examples below but will be defined at runtime. @@ -230,15 +230,15 @@ public interface DdiRootControllerRestApi { @ApiResponses(value = { @ApiResponse(responseCode = "200", description = """ Successfully retrieved - + In case a device provides state information on the feedback channel and won’t store it locally, a query for, e.q, the last 10 messages, could be used which will include the previously provided by the device, feedback. - + In addition to the straight forward approach to inform the device to download and install the software in one transaction hawkBit supports the separation of download and installation into separate steps. - + This feature is called Maintenance Window where the device is informed to download the software first and then when it enters a defined (maintenance) window the installation triggers follows as usual. """), @@ -461,7 +461,7 @@ public interface DdiRootControllerRestApi { the already finished action, for example in case a re-installation is necessary. The response will be of the same format as the deploymentBase operation, providing the previous action that has been finished successfully. As the action is already finished, no further feedback is expected. - + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at runtime. @@ -470,7 +470,7 @@ public interface DdiRootControllerRestApi { @ApiResponse(responseCode = "200", description = """ The response body includes the detailed operation for the already finished action in the same format as for the deploymentBase operation. - + In this case the (optional) query for the last 10 messages, previously provided by the device, are included. """), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -556,7 +556,7 @@ public interface DdiRootControllerRestApi { Resource to receive information about a pending confirmation. The response will be of the same format as the deploymentBase operation. The controller should provide feedback about the confirmation first, before processing the deployment. - + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at runtime. diff --git a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java index 28aff693d..41b6202c4 100644 --- a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java +++ b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java @@ -43,7 +43,8 @@ class DdiConfirmationBaseTest { final String id = "1234"; final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE); final String actionStatus = "TestAction"; - final DdiActionHistory ddiActionHistory = new DdiActionHistory(actionStatus, List.of("Action status message 1", "Action status message 2")); + final DdiActionHistory ddiActionHistory = new DdiActionHistory( + actionStatus, List.of("Action status message 1", "Action status message 2")); final DdiConfirmationBaseAction ddiConfirmationBaseAction = new DdiConfirmationBaseAction(id, ddiDeployment, ddiActionHistory); // Test diff --git a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java index 423ea29f5..1c915d0c3 100644 --- a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java +++ b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java @@ -17,7 +17,6 @@ import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.ATTE import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.FORCED; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -44,7 +43,8 @@ public class DdiDeploymentBaseTest { final String id = "1234"; final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE); final String actionStatus = "TestAction"; - final DdiActionHistory ddiActionHistory = new DdiActionHistory(actionStatus, List.of("Action status message 1", "Action status message 2")); + final DdiActionHistory ddiActionHistory = new DdiActionHistory( + actionStatus, List.of("Action status message 1", "Action status message 2")); final DdiDeploymentBase ddiDeploymentBase = new DdiDeploymentBase(id, ddiDeployment, ddiActionHistory); // Test diff --git a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java index 11357a547..f0b88049c 100644 --- a/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java +++ b/hawkbit-ddi/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java @@ -90,7 +90,7 @@ public class DdiStatusTest { @Description("Verify that deserialization fails for known properties with a wrong datatype") public void shouldFailForObjectWithWrongDataTypes() throws IOException { // Setup - final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," + + final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," + "\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[]}"; // Test diff --git a/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java b/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java index 2b2735861..ae7a8b3bc 100644 --- a/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java +++ b/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java @@ -98,7 +98,10 @@ public class DdiRootController implements DdiRootControllerRestApi { private static final String GIVEN_ACTION_IS_NOT_ASSIGNED_TO_GIVEN_TARGET = "given action ({}) is not assigned to given target ({})."; private static final String FALLBACK_REMARK = "Initiated using the Device Direct Integration API without providing a remark."; - + /** + * File suffix for MDH hash download (see Linux md5sum). + */ + private static final String ARTIFACT_MD5_DWNL_SUFFIX = ".MD5SUM"; @Autowired private ConfirmationManagement confirmationManagement; @Autowired @@ -121,6 +124,7 @@ public class DdiRootController implements DdiRootControllerRestApi { private ArtifactUrlHandler artifactUrlHandler; @Autowired private EntityFactory entityFactory; + @Override public ResponseEntity> getSoftwareModulesArtifacts( final String tenant, @@ -572,6 +576,27 @@ public class DdiRootController implements DdiRootControllerRestApi { return null; } + /** + * Write a md5 file response. + * + * @param response the response + * @param md5Hash of the artifact + * @param filename as provided by the client + * @throws IOException cannot write output stream + */ + private static void writeMD5FileResponse(final HttpServletResponse response, final String md5Hash, final String filename) + throws IOException { + if (md5Hash == null) { + throw new IllegalArgumentException("MD5 hash must not be null"); + } + + final byte[] content = (md5Hash + " " + filename).getBytes(StandardCharsets.US_ASCII); + response.setContentType("text/plain"); + response.setContentLength(content.length); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename + ARTIFACT_MD5_DWNL_SUFFIX); + response.getOutputStream().write(content); + } + private ActionStatus checkAndLogDownload(final HttpServletRequest request, final Target target, final Long module) { final Action action = controllerManagement .getActionForDownloadByTargetAndSoftwareModule(target.getControllerId(), module) @@ -713,7 +738,8 @@ public class DdiRootController implements DdiRootControllerRestApi { return new DdiDeploymentBase(Long.toString(action.getId()), ddiDeployment, actionHistory); } - private DdiConfirmationBaseAction generateDdiConfirmationBase(final Target target, final Action action, final Integer actionHistoryMessageCount) { + private DdiConfirmationBaseAction generateDdiConfirmationBase( + final Target target, final Action action, final Integer actionHistoryMessageCount) { final DdiActionHistory actionHistory = generateDdiActionHistory(action, actionHistoryMessageCount).orElse(null); final DdiDeployment ddiDeployment = generateDdiDeployment(target, action); return new DdiConfirmationBaseAction(Long.toString(action.getId()), ddiDeployment, actionHistory); @@ -753,29 +779,4 @@ public class DdiRootController implements DdiRootControllerRestApi { return DdiAutoConfirmationState.disabled(); }); } - - /** - * File suffix for MDH hash download (see Linux md5sum). - */ - private static final String ARTIFACT_MD5_DWNL_SUFFIX = ".MD5SUM"; - - /** - * Write a md5 file response. - * - * @param response the response - * @param md5Hash of the artifact - * @param filename as provided by the client - * @throws IOException cannot write output stream - */ - private static void writeMD5FileResponse(final HttpServletResponse response, final String md5Hash, final String filename) throws IOException { - if (md5Hash == null) { - throw new IllegalArgumentException("MD5 hash must not be null"); - } - - final byte[] content = (md5Hash + " " + filename).getBytes(StandardCharsets.US_ASCII); - response.setContentType("text/plain"); - response.setContentLength(content.length); - response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename + ARTIFACT_MD5_DWNL_SUFFIX); - response.getOutputStream().write(content); - } } \ No newline at end of file diff --git a/hawkbit-ddi/hawkbit-ddi-starter/src/main/java/org/eclipse/hawkbit/autoconfigure/ddi/DdiApiAutoConfiguration.java b/hawkbit-ddi/hawkbit-ddi-starter/src/main/java/org/eclipse/hawkbit/autoconfigure/ddi/DdiApiAutoConfiguration.java index 891b2b820..3f0e0bab9 100644 --- a/hawkbit-ddi/hawkbit-ddi-starter/src/main/java/org/eclipse/hawkbit/autoconfigure/ddi/DdiApiAutoConfiguration.java +++ b/hawkbit-ddi/hawkbit-ddi-starter/src/main/java/org/eclipse/hawkbit/autoconfigure/ddi/DdiApiAutoConfiguration.java @@ -20,7 +20,5 @@ import org.springframework.context.annotation.Import; */ @Configuration @ConditionalOnClass(DdiApiConfiguration.class) -@Import({ DdiApiConfiguration.class, DdiSecurityProperties.class} ) -public class DdiApiAutoConfiguration { - -} +@Import({ DdiApiConfiguration.class, DdiSecurityProperties.class }) +public class DdiApiAutoConfiguration {} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java index c25cb0e0f..ba7141069 100644 --- a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java +++ b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java @@ -26,11 +26,11 @@ import java.util.UUID; import io.qameta.allure.Description; import io.qameta.allure.Feature; import io.qameta.allure.Story; -import org.eclipse.hawkbit.artifact.repository.urlhandler.ArtifactUrl; -import org.eclipse.hawkbit.artifact.repository.urlhandler.ArtifactUrlHandler; import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystem; import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact; import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash; +import org.eclipse.hawkbit.artifact.repository.urlhandler.ArtifactUrl; +import org.eclipse.hawkbit.artifact.repository.urlhandler.ArtifactUrlHandler; import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey; import org.eclipse.hawkbit.dmf.amqp.api.MessageType; @@ -74,22 +74,16 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest { private static final Long TENANT_ID = 4711L; private static final URI AMQP_URI = IpUtil.createAmqpUri("vHost", "mytest"); - private static final String TEST_TOKEN = "testToken"; - private static final String CONTROLLER_ID = "1"; private AmqpMessageDispatcherService amqpMessageDispatcherService; - private RabbitTemplate rabbitTemplate; - private DefaultAmqpMessageSenderService senderService; - private Target testTarget; @BeforeEach public void beforeEach() throws Exception { - testTarget = targetManagement.create(entityFactory.target().create().controllerId(CONTROLLER_ID) .securityToken(TEST_TOKEN).address(AMQP_URI.toString())); @@ -362,5 +356,4 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest { clazz.getTypeName()); return (T) rabbitTemplate.getMessageConverter().fromMessage(message); } - -} +} \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java index 2f5e50d73..950694820 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java @@ -11,7 +11,6 @@ package org.eclipse.hawkbit.mgmt.rest.resource; import java.text.MessageFormat; import java.util.AbstractMap.SimpleEntry; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -336,7 +335,8 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { } @Override - public ResponseEntity assignSoftwareModules(final Long distributionSetId, final List softwareModuleIDs) { + public ResponseEntity assignSoftwareModules( + final Long distributionSetId, final List softwareModuleIDs) { distributionSetManagement.assignSoftwareModules( distributionSetId, softwareModuleIDs.stream() @@ -404,8 +404,8 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { distributionSetInvalidationManagement .invalidateDistributionSet( new DistributionSetInvalidation(Collections.singletonList(distributionSetId), - MgmtRestModelMapper.convertCancelationType(invalidateRequestBody.getActionCancelationType()), - invalidateRequestBody.isCancelRollouts())); + MgmtRestModelMapper.convertCancelationType(invalidateRequestBody.getActionCancelationType()), + invalidateRequestBody.isCancelRollouts())); return ResponseEntity.ok().build(); } } \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java index 1edc023ca..16069e8a5 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java @@ -15,7 +15,6 @@ import org.eclipse.hawkbit.mgmt.json.model.PagedList; import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType; import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPut; -import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants; import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi; import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility; import org.eclipse.hawkbit.repository.EntityFactory; diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java index 78aaca79f..0c233ec14 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java @@ -39,7 +39,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAttributes; import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirm; import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirmUpdate; import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody; -import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants; import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi; import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility; import org.eclipse.hawkbit.repository.ConfirmationManagement; diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java index 153e5ad11..267bcbb02 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java @@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetType; import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPost; import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut; -import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants; import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTypeRestApi; import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility; import org.eclipse.hawkbit.repository.EntityFactory; diff --git a/hawkbit-monolith/README.md b/hawkbit-monolith/README.md index 20a3fce5e..e07c5c9f1 100644 --- a/hawkbit-monolith/README.md +++ b/hawkbit-monolith/README.md @@ -1,11 +1,11 @@ hawkBit Runtime === -| Folder | Description | -|--------------------------|------------------------------------------------------------------------------------------------------------------------------| -| `.sandbox/` | Content of the hawkBit sandbox installation running on [hawkbit.eclipseprojects.io](https://hawkbit.eclipseprojects.io/UI/). | -| `docker/` | Docker related files, such es Dockerfiles, compose and stack files to quickly start up an hawkBit. | -| `docker/docker_build/` | Docker images build related files, such es Dockerfiles and build shell scripts. | +| Folder | Description | +|------------------------|------------------------------------------------------------------------------------------------------------------------------| +| `.sandbox/` | Content of the hawkBit sandbox installation running on [hawkbit.eclipseprojects.io](https://hawkbit.eclipseprojects.io/UI/). | +| `docker/` | Docker related files, such es Dockerfiles, compose and stack files to quickly start up an hawkBit. | +| `docker/docker_build/` | Docker images build related files, such es Dockerfiles and build shell scripts. | Note: micro service setup requires all services using DB to use same shared DB. So, they don't work with default in memory H2 database. Docker compose with mysql shows an example setup. diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java index 4f5b88df7..731e7cb2b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAutoConfirmationStatus.java @@ -82,9 +82,9 @@ public class JpaAutoConfirmationStatus extends AbstractJpaTenantAwareBaseEntity // nevertheless of the end of line of the file (\r\n, \n or \r) the result will contains \n return """ Assignment automatically confirmed by initiator '%s'.\040 - + Auto confirmation activated by system user: '%s'\040 - + Remark: %s""".formatted(formattedInitiator, createdByRolloutsUser, remarkMessage); } @@ -94,5 +94,4 @@ public class JpaAutoConfirmationStatus extends AbstractJpaTenantAwareBaseEntity + initiator + ", bosch_user=" + getCreatedBy() + ", activatedAt=" + getCreatedAt() + ", remark=" + remark + "]"; } - -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java index 89ddb7e63..e5b96d298 100644 --- a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java +++ b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java @@ -122,9 +122,6 @@ public abstract class AbstractIntegrationTest { * {@link SystemManagement#getTenantMetadata()}; */ protected static final int DEFAULT_DS_TYPES = RepositoryConstants.DEFAULT_DS_TYPES_IN_TENANT + 1; - - private static final String ARTIFACT_DIRECTORY = createTempDir(); - @Autowired protected EntityFactory entityFactory; @Autowired @@ -190,6 +187,7 @@ public abstract class AbstractIntegrationTest { protected ServiceMatcher serviceMatcher; @Autowired protected ApplicationEventPublisher eventPublisher; + private static final String ARTIFACT_DIRECTORY = createTempDir(); @BeforeAll public static void beforeClass() { diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/SecurityManagedConfiguration.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/SecurityManagedConfiguration.java index 050951085..0fd646936 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/SecurityManagedConfiguration.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/SecurityManagedConfiguration.java @@ -50,6 +50,18 @@ public class SecurityManagedConfiguration { ******************"""; public static final int DOS_FILTER_ORDER = -200; + public static FilterRegistrationBean dosFilter(final Collection includeAntPaths, + final HawkbitSecurityProperties.Dos.Filter filterProperties, + final HawkbitSecurityProperties.Clients clientProperties) { + final FilterRegistrationBean filterRegBean = new FilterRegistrationBean<>(); + + filterRegBean.setFilter(new DosFilter(includeAntPaths, filterProperties.getMaxRead(), + filterProperties.getMaxWrite(), filterProperties.getWhitelist(), clientProperties.getBlacklist(), + clientProperties.getRemoteIpHeader())); + + return filterRegBean; + } + /** * Filter to protect the hawkBit server system management interface against too many requests. * @@ -88,18 +100,6 @@ public class SecurityManagedConfiguration { return firewall; } - public static FilterRegistrationBean dosFilter(final Collection includeAntPaths, - final HawkbitSecurityProperties.Dos.Filter filterProperties, - final HawkbitSecurityProperties.Clients clientProperties) { - final FilterRegistrationBean filterRegBean = new FilterRegistrationBean<>(); - - filterRegBean.setFilter(new DosFilter(includeAntPaths, filterProperties.getMaxRead(), - filterProperties.getMaxWrite(), filterProperties.getWhitelist(), clientProperties.getBlacklist(), - clientProperties.getRemoteIpHeader())); - - return filterRegBean; - } - private static class IgnorePathsStrictHttpFirewall extends StrictHttpFirewall { private final Collection pathsToIgnore; diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/HttpUtil.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/HttpUtil.java index 2b763f9d6..8301ead9c 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/HttpUtil.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/HttpUtil.java @@ -9,7 +9,6 @@ */ package org.eclipse.hawkbit.rest.util; -import java.util.Arrays; import java.util.stream.Stream; import lombok.AccessLevel; diff --git a/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java b/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java index 71296ea04..7ab628e37 100644 --- a/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java +++ b/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java @@ -20,9 +20,9 @@ import java.util.function.Supplier; import org.eclipse.hawkbit.ContextAware; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; +import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAwareAuthenticationDetails; import org.eclipse.hawkbit.tenancy.TenantAwareUser; -import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.UserAuthoritiesResolver; import org.springframework.lang.Nullable; import org.springframework.security.core.Authentication; diff --git a/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java b/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java index 2119b9445..2c3e7ea66 100644 --- a/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java +++ b/hawkbit-security/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java @@ -20,8 +20,8 @@ import jakarta.validation.constraints.NotNull; import lombok.extern.slf4j.Slf4j; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; -import org.eclipse.hawkbit.tenancy.TenantAwareAuthenticationDetails; import org.eclipse.hawkbit.tenancy.TenantAware; +import org.eclipse.hawkbit.tenancy.TenantAwareAuthenticationDetails; import org.springframework.security.access.hierarchicalroles.RoleHierarchy; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/hawkbit-security/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/im/authentication/SpPermissionTest.java b/hawkbit-security/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/im/authentication/SpPermissionTest.java index 32655526a..3b4e01275 100644 --- a/hawkbit-security/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/im/authentication/SpPermissionTest.java +++ b/hawkbit-security/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/im/authentication/SpPermissionTest.java @@ -14,13 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Collection; import java.util.LinkedList; import java.util.List; -import java.util.stream.Collectors; import io.qameta.allure.Description; import io.qameta.allure.Feature; import io.qameta.allure.Story; import org.junit.jupiter.api.Test; -import org.springframework.security.core.GrantedAuthority; import org.springframework.util.ReflectionUtils; /**