Remove deprecated REST Mgmt Methods (#2278)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-02-13 14:32:28 +02:00
committed by GitHub
parent 653df8acdd
commit a1a3881c47
11 changed files with 0 additions and 1010 deletions

View File

@@ -1,79 +0,0 @@
<!--
Copyright (c) 2015 Bosch Software Innovations GmbH and others
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-mgmt-parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hawkbit-mgmt-resource-deprecated</artifactId>
<name>hawkBit :: Management :: REST Resources (DEPRECATED)</name>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-mgmt-resource</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-rest-core</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-mgmt-resource</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-aspects</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -1,266 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import jakarta.persistence.EntityManager;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtDistributionSetMapper;
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtTargetMapper;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtAssignedDistributionSetRequestBody;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtAssignedTargetRequestBody;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtDistributionSetTagAssigmentResult;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtTargetTagAssigmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetRepository;
import org.eclipse.hawkbit.repository.jpa.repository.TargetRepository;
import org.eclipse.hawkbit.repository.jpa.repository.TargetTagRepository;
import org.eclipse.hawkbit.repository.jpa.specifications.DistributionSetSpecification;
import org.eclipse.hawkbit.repository.jpa.specifications.TargetSpecifications;
import org.eclipse.hawkbit.repository.jpa.utils.DeploymentHelper;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.utils.TenantConfigHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.web.bind.annotation.RestController;
/**
* REST Resource handling for {@link DistributionSetTag} CRUD operations.
*/
@Slf4j
@RestController
@SuppressWarnings("java:S5738") // will be removed at some point
public class DeprecatedMgmtResource implements DeprecatedMgmtRestApi {
// logger that logs usage of deprecated API
private static final Logger DEPRECATED_USAGE_LOGGER = LoggerFactory.getLogger("DEPRECATED_USAGE");
private final DistributionSetRepository distributionSetRepository;
private final DistributionSetTagManagement distributionSetTagManagement;
private final DistributionSetManagement distributionSetManagement;
private final TargetRepository targetRepository;
private final TargetTagRepository targetTagRepository;
private final TargetManagement targetManagement;
private final TargetTagManagement targetTagManagement;
private final PlatformTransactionManager txManager;
private final EntityManager entityManager;
private final TenantConfigHelper tenantConfigHelper;
@SuppressWarnings("squid:S107")
DeprecatedMgmtResource(
final DistributionSetRepository distributionSetRepository, final DistributionSetTagManagement distributionSetTagManagement,
final DistributionSetManagement distributionSetManagement,
final TargetRepository targetRepository, final TargetTagRepository targetTagRepository, final TargetManagement targetManagement,
final TargetTagManagement targetTagManagement,
final PlatformTransactionManager txManager, final EntityManager entityManager,
final SystemSecurityContext securityContext, final TenantConfigurationManagement configurationManagement) {
this.distributionSetRepository = distributionSetRepository;
this.distributionSetTagManagement = distributionSetTagManagement;
this.distributionSetManagement = distributionSetManagement;
this.targetRepository = targetRepository;
this.targetTagRepository = targetTagRepository;
this.targetManagement = targetManagement;
this.targetTagManagement = targetTagManagement;
this.txManager = txManager;
this.entityManager = entityManager;
tenantConfigHelper = TenantConfigHelper.usingContext(securityContext, configurationManagement);
}
@Override
public ResponseEntity<MgmtDistributionSetTagAssigmentResult> toggleDistributionSetTagAssignment(
final Long distributionsetTagId,
final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies) {
DEPRECATED_USAGE_LOGGER.debug("[DEPRECATED] Deprecated POST /rest/v1/distributionsettags/{distributionsetTagId}/assigned/toggleTagAssignment called");
log.debug("Toggle distribution set assignment {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId);
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
final DistributionSetTagAssignmentResult assigmentResult =
DeploymentHelper.runInNewTransaction(
txManager,
"toggleDistributionSetTagAssignment",
status -> toggleDistributionSetTagAssignment(findDistributionSetIds(assignedDSRequestBodies), tag.getName()));
final MgmtDistributionSetTagAssigmentResult tagAssigmentResultRest = new MgmtDistributionSetTagAssigmentResult();
tagAssigmentResultRest.setAssignedDistributionSets(
MgmtDistributionSetMapper.toResponseDistributionSets(assigmentResult.getAssignedEntity()));
tagAssigmentResultRest.setUnassignedDistributionSets(
MgmtDistributionSetMapper.toResponseDistributionSets(assigmentResult.getUnassignedEntity()));
log.debug("Toggled assignedDS {} and unassignedDS{}", assigmentResult.getAssigned(), assigmentResult.getUnassigned());
return ResponseEntity.ok(tagAssigmentResultRest);
}
@Override
public ResponseEntity<List<MgmtDistributionSet>> assignDistributionSetsByRequestBody(
final Long distributionsetTagId,
final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies) {
DEPRECATED_USAGE_LOGGER.debug("[DEPRECATED] Deprecated POST /rest/v1/distributionsettags/{distributionsetTagId}/assigned called");
log.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId);
final List<DistributionSet> assignedDs = this.distributionSetManagement
.assignTag(findDistributionSetIds(assignedDSRequestBodies), distributionsetTagId);
log.debug("Assigned DistributionSet {}", assignedDs.size());
return ResponseEntity.ok(MgmtDistributionSetMapper.toResponseDistributionSets(assignedDs));
}
@Override
public ResponseEntity<MgmtTargetTagAssigmentResult> toggleTargetTagAssignment(
final Long targetTagId, final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies) {
DEPRECATED_USAGE_LOGGER.debug("[DEPRECATED] Deprecated POST /rest/v1/targettags/{targetTagId}/assigned/toggleTagAssignment called");
log.debug("Toggle Target assignment {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId);
final TargetTag targetTag = targetTagManagement.get(targetTagId)
.orElseThrow(() -> new EntityNotFoundException(TargetTag.class, targetTagId));
final TargetTagAssignmentResult assigmentResult =
DeploymentHelper.runInNewTransaction(
txManager,
"toggleDistributionSetTagAssignment",
status -> toggleTargetTagAssignment(findTargetControllerIds(assignedTargetRequestBodies), targetTag.getName()));
final MgmtTargetTagAssigmentResult tagAssigmentResultRest = new MgmtTargetTagAssigmentResult();
tagAssigmentResultRest.setAssignedTargets(
MgmtTargetMapper.toResponse(assigmentResult.getAssignedEntity(), tenantConfigHelper));
tagAssigmentResultRest.setUnassignedTargets(
MgmtTargetMapper.toResponse(assigmentResult.getUnassignedEntity(), tenantConfigHelper));
return ResponseEntity.ok(tagAssigmentResultRest);
}
@Override
public ResponseEntity<List<MgmtTarget>> assignTargetsByRequestBody(
final Long targetTagId, final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies) {
DEPRECATED_USAGE_LOGGER.debug("[DEPRECATED] Deprecated POST /rest/v1/targettags/{targetTagId}/assigned called");
log.debug("Assign targets {} for target tag {}", assignedTargetRequestBodies, targetTagId);
final List<Target> assignedTarget = targetManagement
.assignTag(findTargetControllerIds(assignedTargetRequestBodies), targetTagId);
return ResponseEntity.ok(MgmtTargetMapper.toResponse(assignedTarget, tenantConfigHelper));
}
private DistributionSetTagAssignmentResult toggleDistributionSetTagAssignment(final Collection<Long> ids, final String tagName) {
return updateTag(
ids,
() -> distributionSetTagManagement
.findByName(tagName)
.orElseThrow(() -> new EntityNotFoundException(DistributionSetTag.class, tagName)),
(allDs, distributionSetTag) -> {
final List<JpaDistributionSet> toBeChangedDSs = allDs.stream().filter(set -> set.addTag(distributionSetTag)).toList();
final DistributionSetTagAssignmentResult result;
// un-assignment case
if (toBeChangedDSs.isEmpty()) {
final List<JpaDistributionSet> toRemoveSize = new ArrayList<>();
for (final JpaDistributionSet set : allDs) {
if (set.removeTag(distributionSetTag)) {
toRemoveSize.add(set);
}
}
result = new DistributionSetTagAssignmentResult(ids.size() - toRemoveSize.size(),
Collections.emptyList(),
toRemoveSize.stream().map(distributionSetRepository::save).map(DistributionSet.class::cast).toList(),
distributionSetTag);
} else {
result = new DistributionSetTagAssignmentResult(ids.size() - toBeChangedDSs.size(),
toBeChangedDSs.stream().map(distributionSetRepository::save).map(DistributionSet.class::cast).toList(),
Collections.emptyList(), distributionSetTag);
}
return result;
});
}
private <T> T updateTag(
final Collection<Long> dsIds, final Supplier<DistributionSetTag> tagSupplier,
final BiFunction<List<JpaDistributionSet>, DistributionSetTag, T> updater) {
final List<JpaDistributionSet> allDs = dsIds.size() == 1 ?
distributionSetRepository.findById(dsIds.iterator().next()).map(List::of).orElseGet(Collections::emptyList) :
distributionSetRepository.findAll(DistributionSetSpecification.byIdsFetch(dsIds));
if (allDs.size() < dsIds.size()) {
throw new EntityNotFoundException(DistributionSet.class, dsIds, allDs.stream().map(DistributionSet::getId).toList());
}
final DistributionSetTag distributionSetTag = tagSupplier.get();
try {
return updater.apply(allDs, distributionSetTag);
} finally {
// No reason to save the tag
entityManager.detach(distributionSetTag);
}
}
private TargetTagAssignmentResult toggleTargetTagAssignment(final Collection<String> controllerIds, final String tagName) {
final TargetTag tag = targetTagRepository
.findByNameEquals(tagName)
.orElseThrow(() -> new EntityNotFoundException(TargetTag.class, tagName));
final List<JpaTarget> allTargets = targetRepository
.findAll(TargetSpecifications.byControllerIdWithTagsInJoin(controllerIds));
if (allTargets.size() < controllerIds.size()) {
throw new EntityNotFoundException(Target.class, controllerIds,
allTargets.stream().map(Target::getControllerId).toList());
}
final List<JpaTarget> alreadyAssignedTargets = targetRepository.findAll(
TargetSpecifications.hasTagName(tagName).and(TargetSpecifications.hasControllerIdIn(controllerIds)));
// all are already assigned -> unassign
if (alreadyAssignedTargets.size() == allTargets.size()) {
alreadyAssignedTargets.forEach(target -> target.removeTag(tag));
return new TargetTagAssignmentResult(0, Collections.emptyList(),
Collections.unmodifiableList(alreadyAssignedTargets), tag);
}
allTargets.removeAll(alreadyAssignedTargets);
// some or none are assigned -> assign
allTargets.forEach(target -> target.addTag(tag));
final TargetTagAssignmentResult result = new TargetTagAssignmentResult(alreadyAssignedTargets.size(),
targetRepository.saveAll(allTargets), Collections.emptyList(), tag);
// no reason to persist the tag
entityManager.detach(tag);
return result;
}
private static List<Long> findDistributionSetIds(
final List<MgmtAssignedDistributionSetRequestBody> assignedDistributionSetRequestBodies) {
return assignedDistributionSetRequestBodies.stream()
.map(MgmtAssignedDistributionSetRequestBody::getDistributionSetId).toList();
}
private DistributionSetTag findDistributionTagById(final Long distributionsetTagId) {
return distributionSetTagManagement.get(distributionsetTagId)
.orElseThrow(() -> new EntityNotFoundException(DistributionSetTag.class, distributionsetTagId));
}
private List<String> findTargetControllerIds(
final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies) {
return assignedTargetRequestBodies.stream().map(MgmtAssignedTargetRequestBody::getControllerId).toList();
}
}

View File

@@ -1,209 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtAssignedDistributionSetRequestBody;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtAssignedTargetRequestBody;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtDistributionSetTagAssigmentResult;
import org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model.MgmtTargetTagAssigmentResult;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* REST Resource handling for DistributionSetTag CRUD operations.
*
* @deprecated since 0.6.0
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
@Deprecated(forRemoval = true, since = "0.6.0")
@Tag(name = "Deprecated operations", description = "Deprecated REST operations.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = "2147483647")))
@SuppressWarnings("java:S1133") // will be removed at some point
public interface DeprecatedMgmtRestApi {
/**
* Handles the POST request to toggle the assignment of distribution sets by the given tag id.</br>
* From {@link org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi}
*
* @param distributionsetTagId the ID of the distribution set tag to retrieve
* @param assignedDSRequestBodies list of distribution set ids to be toggled
* @return the list of assigned distribution sets and unassigned distribution sets.
* @deprecated since 0.6.0 with toggle assignment deprecation
*/
@Operation(summary = "[DEPRECATED] Toggle the assignment of distribution sets by the given tag id",
description = "Handles the POST request of toggle distribution assignment. The request body must always be a list of distribution " +
"set ids.",
deprecated = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))),
@ApiResponse(responseCode = "401", description = "The request requires user authentication.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403",
description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " +
"data volume restriction applies.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " +
"user in another request at the same time. You may retry your modification request.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " +
"supported by the server for this resource.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " +
"and the client has to wait another second.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
})
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING +
MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING + "/toggleTagAssignment")
@Deprecated(forRemoval = true, since = "0.6.0")
ResponseEntity<MgmtDistributionSetTagAssigmentResult> toggleDistributionSetTagAssignment(
@PathVariable("distributionsetTagId") Long distributionsetTagId,
@RequestBody List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
/**
* Handles the POST request to assign distribution sets to the given tag id..</br>
* From {@link org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi}
*
* @param distributionsetTagId the ID of the distribution set tag to retrieve
* @param assignedDSRequestBodies list of distribution sets ids to be assigned
* @return the list of assigned distribution set.
* @deprecated since 0.6.0 in favor or assign by ds ids
*/
@Operation(summary = "[DEPRECATED] Assign distribution sets to the given tag id",
description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.",
deprecated = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))),
@ApiResponse(responseCode = "401", description = "The request requires user authentication.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403",
description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " +
"data volume restriction applies.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " +
"user in another request at the same time. You may retry your modification request.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " +
"supported by the server for this resource.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " +
"and the client has to wait another second.",
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
})
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING,
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
@Deprecated(forRemoval = true, since = "0.6.0")
ResponseEntity<List<MgmtDistributionSet>> assignDistributionSetsByRequestBody(
@PathVariable("distributionsetTagId") Long distributionsetTagId,
@RequestBody List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
/**
* Handles the POST request to toggle the assignment of targets by the given tag id.<br/>
* From {@link org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi}
*
* @param targetTagId the ID of the target tag to retrieve
* @param assignedTargetRequestBodies list of controller ids to be toggled
* @return the list of assigned targets and unassigned targets.
* @deprecated since 0.6.0 - not very usable with very unclear logic
*/
@Operation(summary = "[DEPRECATED] Toggles target tag assignment", description = "Handles the POST request of toggle target " +
"assignment. The request body must always be a list of controller ids.",
deprecated = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))),
@ApiResponse(responseCode = "401", description = "The request requires user authentication."),
@ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " +
"changed (i.e. read-only) or data volume restriction applies."),
@ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource."),
@ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json."),
@ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " +
"user in another request at the same time. You may retry your modification request."),
@ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " +
"supported by the server for this resource."),
@ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts and the client has to wait another second.")
})
@PostMapping(value = MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING +
MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/toggleTagAssignment",
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
@Deprecated(forRemoval = true, since = "0.6.0")
ResponseEntity<MgmtTargetTagAssigmentResult> toggleTargetTagAssignment(
@PathVariable("targetTagId") Long targetTagId,
@RequestBody List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
/**
* Handles the POST request to assign targets to the given tag id.<br/>
* From {@link org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi}
*
* @param targetTagId the ID of the target tag to retrieve
* @param assignedTargetRequestBodies list of controller ids to be assigned
* @return the list of assigned targets.
* @deprecated since 0.6.0 in favour of {@link org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi#assignTargets}
*/
@Operation(summary = "[DEPRECATED] Assign target(s) to given tagId and return targets",
description = "Handles the POST request of target assignment. Already assigned target will be ignored.",
deprecated = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully assigned"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))),
@ApiResponse(responseCode = "401", description = "The request requires user authentication."),
@ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " +
"changed (i.e. read-only) or data volume restriction applies."),
@ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource."),
@ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json."),
@ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " +
"user in another request at the same time. You may retry your modification request."),
@ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " +
"supported by the server for this resource."),
@ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " +
"and the client has to wait another second.")
})
@PostMapping(value = MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING,
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
@Deprecated(forRemoval = true, since = "0.6.0")
ResponseEntity<List<MgmtTarget>> assignTargetsByRequestBody(
@PathVariable("targetTagId") Long targetTagId,
@RequestBody List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
}

View File

@@ -1,41 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.eclipse.hawkbit.repository.model.AbstractAssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
/**
* Result object for {@link DistributionSetTag} assignments.
*
* @deprecated since 0.6.0 with toggle deprecation
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@Getter
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@SuppressWarnings("java:S1133") // will be removed at some point
public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult<DistributionSet> {
private final DistributionSetTag distributionSetTag;
public DistributionSetTagAssignmentResult(final int alreadyAssigned,
final List<DistributionSet> assigned, final List<DistributionSet> unassigned,
final DistributionSetTag distributionSetTag) {
super(alreadyAssigned, assigned, unassigned);
this.distributionSetTag = distributionSetTag;
}
}

View File

@@ -1,41 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.eclipse.hawkbit.repository.model.AbstractAssignmentResult;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
/**
* Result object for {@link TargetTag} assignments.
*
* @deprecated since 0.6.0 with deprecation of toggle assignments
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@Getter
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@SuppressWarnings("java:S1133") // will be removed at some point
public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target> {
private final TargetTag targetTag;
public TargetTagAssignmentResult(
final int alreadyAssigned, final List<? extends Target> assigned, final List<? extends Target> unassigned,
final TargetTag targetTag) {
super(alreadyAssigned, assigned, unassigned);
this.targetTag = targetTag;
}
}

View File

@@ -1,38 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* Request Body for PUT.
*
* @deprecated since 0.6.0 with toggle assigment deprecation
*/
@Data
@Accessors(chain = true)
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("java:S1133") // will be removed at some point
public class MgmtAssignedDistributionSetRequestBody {
@JsonProperty(value = "id", required = true)
@Schema(example = "24")
private Long distributionSetId;
}

View File

@@ -1,38 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* Request Body for PUT.
*
* @deprecated Since 0.6.0
*/
@Data
@Accessors(chain = true)
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("java:S1133") // will be removed at some point
public class MgmtAssignedTargetRequestBody {
@JsonProperty(required = true)
@Schema(example = "Target1")
private String controllerId;
}

View File

@@ -1,45 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
/**
* A json annotated rest model for DSAssigmentResult to RESTful API representation.
*
* @deprecated since 0.6.0 with deprecation of toggle assignments
*/
@Data
@Accessors(chain = true)
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("java:S1133") // will be removed at some point
public class MgmtDistributionSetTagAssigmentResult {
@JsonProperty
@Schema(description = "Assigned distribution sets")
private List<MgmtDistributionSet> assignedDistributionSets;
@JsonProperty
@Schema(description = "Unassigned distribution sets")
private List<MgmtDistributionSet> unassignedDistributionSets;
}

View File

@@ -1,45 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated.json.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
/**
* A json annotated rest model for TargetTagAssigmentResult to RESTful API representation.
*
* @deprecated since 0.6.0 with deprecation of toggle assignments
*/
@Data
@Accessors(chain = true)
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("java:S1133") // will be removed at some point
public class MgmtTargetTagAssigmentResult {
@JsonProperty
@Schema(description = "Assigned targets")
private List<MgmtTarget> assignedTargets;
@JsonProperty
@Schema(description = "Unassigned targets")
private List<MgmtTarget> unassignedTargets;
}

View File

@@ -1,205 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.resource.deprecated;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.Collection;
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.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.resource.AbstractManagementApiIntegrationTest;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.test.matcher.Expect;
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
import org.eclipse.hawkbit.rest.util.JsonBuilder;
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;
@Feature("Component Tests - Management API")
@Story("Distribution Set Tag Resource")
class MgmtDeprecatedResourceTest extends AbstractManagementApiIntegrationTest {
@Test
@Description("Verifies that tag assignments done through toggle API command are correctly assigned or unassigned.")
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 4) })
void toggleDistributionSetTagAssignment() throws Exception {
final DistributionSetTag tag = testdataFactory.createDistributionSetTags(1).get(0);
final int setsAssigned = 2;
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(setsAssigned);
// 2 DistributionSetUpdateEvent
ResultActions result = toggle(tag, sets);
List<DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList())
.containsAll(sets.stream().map(DistributionSet::getId).toList());
result.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(0), "assignedDistributionSets"))
.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(1), "assignedDistributionSets"));
// 2 DistributionSetUpdateEvent
result = toggle(tag, sets);
updated = distributionSetManagement.findAll(PAGE).getContent();
result.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(0), "unassignedDistributionSets"))
.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(1), "unassignedDistributionSets"));
assertThat(distributionSetManagement.findByTag(tag.getId(), PAGE)).isEmpty();
}
@Test
@Description("Verifies that tag assignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 2) })
void assignDistributionSetsWithRequestBody() throws Exception {
final DistributionSetTag tag = testdataFactory.createDistributionSetTags(1).get(0);
final int setsAssigned = 2;
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(setsAssigned);
final ResultActions result = mvc
.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
.content(JsonBuilder
.ids(sets.stream().map(DistributionSet::getId).toList()))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
final List<DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList())
.containsAll(sets.stream().map(DistributionSet::getId).toList());
result.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(0)))
.andExpect(applyBaseEntityMatcherOnArrayResult(updated.get(1)));
}
@Test
@Description("Verifes that tag assignments done through toggle API command are correctly assigned or unassigned.")
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 4) })
void toggleTargetTagAssignment() throws Exception {
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
final int targetsAssigned = 2;
final List<Target> targets = testdataFactory.createTargets(targetsAssigned);
ResultActions result = toggle(tag, targets);
List<Target> updated = targetManagement.findByTag(PAGE, tag.getId()).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList())
.containsAll(targets.stream().map(Target::getControllerId).toList());
result.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(0), "assignedTargets"))
.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(1), "assignedTargets"));
result = toggle(tag, targets);
updated = targetManagement.findAll(PAGE).getContent();
result.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(0), "unassignedTargets"))
.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(1), "unassignedTargets"));
assertThat(targetManagement.findByTag(PAGE, tag.getId())).isEmpty();
}
@Test
@Description("Verifies that tag assignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 2) })
void assignTargetsByRequestBody() throws Exception {
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
final int targetsAssigned = 2;
final List<Target> targets = testdataFactory.createTargets(targetsAssigned);
final ResultActions result = mvc
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
.content(controllerIdsOld(
targets.stream().map(Target::getControllerId).toList()))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
final List<Target> updated = targetManagement.findByTag(PAGE, tag.getId()).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList())
.containsAll(targets.stream().map(Target::getControllerId).toList());
result.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(0)))
.andExpect(applyTargetEntityMatcherOnArrayResult(updated.get(1)));
}
private ResultActions toggle(final DistributionSetTag tag, final List<DistributionSet> sets) throws Exception {
return mvc
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId()
+ "/assigned/toggleTagAssignment").content(
JsonBuilder.ids(sets.stream().map(DistributionSet::getId).toList()))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
}
private static String controllerIdsOld(final Collection<String> ids) throws JSONException {
final JSONArray list = new JSONArray();
for (final String smID : ids) {
list.put(new JSONObject().put("controllerId", smID));
}
return list.toString();
}
private ResultActions toggle(final TargetTag tag, final List<Target> targets) throws Exception {
return mvc
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId()
+ "/assigned/toggleTagAssignment")
.content(controllerIdsOld(
targets.stream().map(Target::getControllerId).toList()))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
}
}

View File

@@ -27,8 +27,5 @@
<module>hawkbit-mgmt-resource</module>
<module>hawkbit-mgmt-starter</module>
<module>hawkbit-mgmt-server</module>
<!-- Deprecated modules -->
<module>hawkbit-mgmt-resource-deprecated</module>
</modules>
</project>