Code format hawkbit ddi api (#1940)

* Code format hawkbit-repository

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Code format hawkbit-ddi-api

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-05 11:28:54 +02:00
committed by GitHub
parent 0f5c87a0c8
commit d47944758d
41 changed files with 1018 additions and 1151 deletions

View File

@@ -1,10 +1,12 @@
# Eclipse.IoT hawkBit - Direct Device Integration API - Model and Resources
The Direct Device Integration (DDI) API is used by devices for communicating with the HawkBit Update Server through HTTP.
The Direct Device Integration (DDI) API is used by devices for communicating with the HawkBit Update Server through
HTTP.
# Version 1
The model follows [semantic versioning](http://semver.org) with MAJOR version, i.e. breaking changes will result in a new MAJOR version.
The model follows [semantic versioning](http://semver.org) with MAJOR version, i.e. breaking changes will result in a
new MAJOR version.
# Compile

View File

@@ -10,8 +10,9 @@
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>

View File

@@ -11,15 +11,14 @@ package org.eclipse.hawkbit.ddi.json.model;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
/**
* Provide action history information to the controller as part of response to

View File

@@ -11,15 +11,14 @@ package org.eclipse.hawkbit.ddi.json.model;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Download information for all artifacts related to a specific {@link DdiChunk}
*/

View File

@@ -45,12 +45,9 @@ public class DdiArtifactHash {
/**
* Public constructor.
*
* @param sha1
* sha1 hash of the artifact
* @param md5
* md5 hash of the artifact
* @param sha256
* sha256 hash of the artifact
* @param sha1 sha1 hash of the artifact
* @param md5 md5 hash of the artifact
* @param sha256 sha256 hash of the artifact
*/
public DdiArtifactHash(final String sha1, final String md5, final String sha256) {
this.sha1 = sha1;

View File

@@ -29,10 +29,8 @@ public class DdiAssignedVersion {
/**
* Constructor
*
* @param name
* Distribution set name
* @param version
* Distribution set version
* @param name Distribution set name
* @param version Distribution set version
*/
@JsonCreator
public DdiAssignedVersion(@JsonProperty(value = "name", required = true) String name,

View File

@@ -38,10 +38,8 @@ public class DdiCancel {
/**
* Parameterized constructor.
*
* @param id
* of the cancel action
* @param cancelAction
* the action
* @param id of the cancel action
* @param cancelAction the action
*/
@JsonCreator
public DdiCancel(@JsonProperty("id") final String id,

View File

@@ -48,10 +48,8 @@ public class DdiConfigData {
/**
* Constructor.
*
* @param data
* contains the attributes.
* @param mode
* defines the mode of the update (replace, merge, remove)
* @param data contains the attributes.
* @param mode defines the mode of the update (replace, merge, remove)
*/
@JsonCreator
public DdiConfigData(

View File

@@ -9,19 +9,18 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Confirmation base response.
* Set order to place links at last.

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -20,9 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import jakarta.validation.constraints.NotNull;
import java.util.Objects;
/**
* Update action resource.
*/

View File

@@ -9,21 +9,21 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections;
import java.util.List;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import java.util.Collections;
import java.util.List;
/**
* New update actions require confirmation when confirmation flow is switched on. This is the feedback channel for
* confirmation messages for DDI API. The confirmation message has a mandatory field confirmation with possible values:
@@ -35,38 +35,12 @@ import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DdiConfirmationFeedback {
public enum Confirmation {
/**
* Confirm the action.
*/
CONFIRMED("confirmed"),
/**
* Deny the action.
*/
DENIED("denied");
private final String name;
Confirmation(final String name) {
this.name = name;
}
@JsonValue
public String getName() {
return name;
}
}
@NotNull
@Valid
@Schema(description = "Action confirmation state")
private final Confirmation confirmation;
@Schema(description = "(Optional) Individual status code", example = "200")
private final Integer code;
@Schema(description = "List of detailed message information", example = "[ \"Feedback message\" ]")
private final List<String> details;
@@ -77,7 +51,8 @@ public class DdiConfirmationFeedback {
* @param code code for confirmation
* @param details messages
*/
@JsonCreator public DdiConfirmationFeedback(
@JsonCreator
public DdiConfirmationFeedback(
@JsonProperty(value = "confirmation", required = true) final Confirmation confirmation,
@JsonProperty(value = "code") final Integer code,
@JsonProperty(value = "details") final List<String> details) {
@@ -92,4 +67,27 @@ public class DdiConfirmationFeedback {
}
return Collections.unmodifiableList(details);
}
public enum Confirmation {
/**
* Confirm the action.
*/
CONFIRMED("confirmed"),
/**
* Deny the action.
*/
DENIED("denied");
private final String name;
Confirmation(final String name) {
this.name = name;
}
@JsonValue
public String getName() {
return name;
}
}
}

View File

@@ -9,6 +9,10 @@
*/
package org.eclipse.hawkbit.ddi.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.EqualsAndHashCode;
import lombok.Getter;
@@ -16,11 +20,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
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;
/**
* {@link DdiControllerBase} resource content.
*/
@@ -63,8 +62,7 @@ public class DdiControllerBase extends RepresentationModel<DdiControllerBase> {
/**
* Constructor.
*
* @param config
* configuration of the SP target
* @param config configuration of the SP target
*/
public DdiControllerBase(final DdiConfig config) {
this.config = config;

View File

@@ -12,13 +12,13 @@ package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -35,6 +35,53 @@ import lombok.ToString;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DdiDeployment {
@Schema(description = """
Handling for the download part of the provisioning process ('skip': do not download yet, 'attempt': server asks
to download, 'forced': server requests immediate download)""")
private HandlingType download;
@Schema(description = """
Handling for the update part of the provisioning process ('skip': do not update yet,
'attempt': server asks to update, 'forced': server requests immediate update)""")
private HandlingType update;
@JsonProperty("chunks")
@NotNull
@Schema(description = "Software chunks of an update. In server mapped by Software Module")
private List<DdiChunk> chunks;
@Schema(description = """
Separation of download and installation by defining a maintenance window for the installation. Status shows if
currently in a window""")
private DdiMaintenanceWindowStatus maintenanceWindow;
/**
* Constructor.
*
* @param download handling type
* @param update handling type
* @param chunks to handle.
* @param maintenanceWindow specifying whether there is a maintenance schedule associated.
* If it is, the value is either 'available' (i.e. the
* maintenance window is now available as per defined schedule
* and the update can progress) or 'unavailable' (implying that
* maintenance window is not available now and update should not
* be attempted). If there is no maintenance schedule defined,
* the parameter is null.
*/
public DdiDeployment(final HandlingType download, final HandlingType update, final List<DdiChunk> chunks,
final DdiMaintenanceWindowStatus maintenanceWindow) {
this.download = download;
this.update = update;
this.chunks = chunks;
this.maintenanceWindow = maintenanceWindow;
}
public List<DdiChunk> getChunks() {
if (chunks == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(chunks);
}
/**
* The handling type for the update action.
*/
@@ -97,55 +144,4 @@ public class DdiDeployment {
return this.status;
}
}
@Schema(description = """
Handling for the download part of the provisioning process ('skip': do not download yet, 'attempt': server asks
to download, 'forced': server requests immediate download)""")
private HandlingType download;
@Schema(description = """
Handling for the update part of the provisioning process ('skip': do not update yet,
'attempt': server asks to update, 'forced': server requests immediate update)""")
private HandlingType update;
@JsonProperty("chunks")
@NotNull
@Schema(description = "Software chunks of an update. In server mapped by Software Module")
private List<DdiChunk> chunks;
@Schema(description = """
Separation of download and installation by defining a maintenance window for the installation. Status shows if
currently in a window""")
private DdiMaintenanceWindowStatus maintenanceWindow;
/**
* Constructor.
*
* @param download handling type
* @param update handling type
* @param chunks to handle.
* @param maintenanceWindow
* specifying whether there is a maintenance schedule associated.
* If it is, the value is either 'available' (i.e. the
* maintenance window is now available as per defined schedule
* and the update can progress) or 'unavailable' (implying that
* maintenance window is not available now and update should not
* be attempted). If there is no maintenance schedule defined,
* the parameter is null.
*/
public DdiDeployment(final HandlingType download, final HandlingType update, final List<DdiChunk> chunks,
final DdiMaintenanceWindowStatus maintenanceWindow) {
this.download = download;
this.update = update;
this.chunks = chunks;
this.maintenanceWindow = maintenanceWindow;
}
public List<DdiChunk> getChunks() {
if (chunks == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(chunks);
}
}

View File

@@ -11,6 +11,10 @@ package org.eclipse.hawkbit.ddi.json.model;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -18,11 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Update action resource.
*/
@@ -221,12 +220,9 @@ public class DdiDeploymentBase extends RepresentationModel<DdiDeploymentBase> {
/**
* Constructor.
*
* @param id
* of the update action
* @param deployment
* details
* @param actionHistory
* containing current action status and a list of feedback
* @param id of the update action
* @param deployment details
* @param actionHistory containing current action status and a list of feedback
* messages received earlier from the controller.
*/
public DdiDeploymentBase(final String id, final DdiDeployment deployment, final DdiActionHistory actionHistory) {

View File

@@ -30,8 +30,7 @@ public class DdiPolling {
/**
* Constructor.
*
* @param sleep
* between polls
* @param sleep between polls
*/
public DdiPolling(final String sleep) {
this.sleep = sleep;
@@ -39,7 +38,6 @@ public class DdiPolling {
/**
* Constructor.
*
*/
public DdiPolling() {
// needed for json create

View File

@@ -31,9 +31,28 @@ import lombok.ToString;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DdiResult {
@NotNull
@Valid
@Schema(description = "Result of the action execution")
private final FinalResult finished;
@Schema(description = "Progress assumption of the device (currently not supported)")
private final DdiProgress progress;
/**
* Constructor.
*
* @param finished as final result
* @param progress if not yet finished
*/
@JsonCreator
public DdiResult(@JsonProperty("finished") final FinalResult finished,
@JsonProperty("progress") final DdiProgress progress) {
this.finished = finished;
this.progress = progress;
}
/**
* Defined status of the final result.
*
*/
public enum FinalResult {
/**
@@ -62,27 +81,4 @@ public class DdiResult {
return name;
}
}
@NotNull
@Valid
@Schema(description = "Result of the action execution")
private final FinalResult finished;
@Schema(description = "Progress assumption of the device (currently not supported)")
private final DdiProgress progress;
/**
* Constructor.
*
* @param finished
* as final result
* @param progress
* if not yet finished
*/
@JsonCreator
public DdiResult(@JsonProperty("finished") final FinalResult finished,
@JsonProperty("progress") final DdiProgress progress) {
this.finished = finished;
this.progress = progress;
}
}

View File

@@ -34,10 +34,48 @@ import lombok.ToString;
@Schema(description = "Target action status")
public class DdiStatus {
@NotNull
@Valid
@Schema(description = "Status of the action execution")
private final ExecutionStatus execution;
@NotNull
@Valid
@Schema(description = "Result of the action execution")
private final DdiResult result;
@Schema(description = "(Optional) Individual status code", example = "200")
private final Integer code;
@Schema(description = "List of details message information", example = "[ \"Some feedback\" ]")
private final List<String> details;
/**
* Constructor.
*
* @param execution status
* @param result information
* @param code as optional code (can be null)
* @param details as optional addition
*/
@JsonCreator
public DdiStatus(@JsonProperty("execution") final ExecutionStatus execution,
@JsonProperty("result") final DdiResult result, @JsonProperty("code") final Integer code,
@JsonProperty("details") final List<String> details) {
this.execution = execution;
this.result = result;
this.code = code;
this.details = details;
}
public List<String> getDetails() {
if (details == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(details);
}
/**
* The element status contains information about the execution of the
* operation.
*
*/
public enum ExecutionStatus {
/**
@@ -91,50 +129,4 @@ public class DdiStatus {
return name;
}
}
@NotNull
@Valid
@Schema(description = "Status of the action execution")
private final ExecutionStatus execution;
@NotNull
@Valid
@Schema(description = "Result of the action execution")
private final DdiResult result;
@Schema(description = "(Optional) Individual status code", example = "200")
private final Integer code;
@Schema(description = "List of details message information", example = "[ \"Some feedback\" ]")
private final List<String> details;
/**
* Constructor.
*
* @param execution
* status
* @param result
* information
* @param code
* as optional code (can be null)
* @param details
* as optional addition
*/
@JsonCreator
public DdiStatus(@JsonProperty("execution") final ExecutionStatus execution,
@JsonProperty("result") final DdiResult result, @JsonProperty("code") final Integer code,
@JsonProperty("details") final List<String> details) {
this.execution = execution;
this.result = result;
this.code = code;
this.details = details;
}
public List<String> getDetails() {
if (details == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(details);
}
}

View File

@@ -15,6 +15,7 @@ import java.util.List;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -22,10 +23,10 @@ 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 jakarta.validation.constraints.NotNull;
import org.eclipse.hawkbit.ddi.json.model.DdiActionFeedback;
import org.eclipse.hawkbit.ddi.json.model.DdiActivateAutoConfirmation;
import org.eclipse.hawkbit.ddi.json.model.DdiArtifact;
import org.eclipse.hawkbit.ddi.json.model.DdiAssignedVersion;
import org.eclipse.hawkbit.ddi.json.model.DdiAutoConfirmationState;
import org.eclipse.hawkbit.ddi.json.model.DdiCancel;
import org.eclipse.hawkbit.ddi.json.model.DdiConfigData;
@@ -34,7 +35,6 @@ import org.eclipse.hawkbit.ddi.json.model.DdiConfirmationBaseAction;
import org.eclipse.hawkbit.ddi.json.model.DdiConfirmationFeedback;
import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
import org.eclipse.hawkbit.ddi.json.model.DdiAssignedVersion;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
@@ -93,7 +93,6 @@ public interface DdiRootControllerRestApi {
*
* @param tenant of the request
* @param controllerId of the target that matches to controller id
*
* @return the response
*/
@Operation(summary = "Root resource for an individual Target", description = """
@@ -134,7 +133,6 @@ public interface DdiRootControllerRestApi {
* @param controllerId of the target
* @param softwareModuleId of the parent software module
* @param fileName of the related local artifact
*
* @return response of the servlet which in case of success is status code
* {@link HttpStatus#OK} or in case of partial download
* {@link HttpStatus#PARTIAL_CONTENT}.
@@ -170,15 +168,10 @@ public interface DdiRootControllerRestApi {
/**
* Handles GET {@link DdiArtifact} MD5 checksum file download request.
*
* @param tenant
* of the request
* @param controllerId
* of the target
* @param softwareModuleId
* of the parent software module
* @param fileName
* of the related local artifact
*
* @param tenant of the request
* @param controllerId of the target
* @param softwareModuleId of the parent software module
* @param fileName of the related local artifact
* @return {@link ResponseEntity} with status {@link HttpStatus#OK} if
* successful
*/
@@ -214,19 +207,14 @@ public interface DdiRootControllerRestApi {
/**
* Resource for software module.
*
* @param tenant
* of the request
* @param controllerId
* of the target
* @param actionId
* of the {@link DdiDeploymentBase} that matches to active
* @param tenant of the request
* @param controllerId of the target
* @param actionId of the {@link DdiDeploymentBase} that matches to active
* actions.
* @param resource
* an hashcode of the resource which indicates if the action has
* @param resource an hashcode of the resource which indicates if the action has
* been changed, e.g. from 'soft' to 'force' and the eTag needs
* to be re-generated
* @param actionHistoryMessageCount
* specifies the number of messages to be returned from action
* @param actionHistoryMessageCount specifies the number of messages to be returned from action
* history. Regardless of the passed value, in order to restrict
* resource utilization by controllers, maximum number of
* messages that are retrieved from database is limited by
@@ -241,7 +229,6 @@ public interface DdiRootControllerRestApi {
* actionHistoryMessageCount greater than zero: retrieves the
* specified number of messages, limited by maximum allowed
* number.
*
* @return the response
*/
@Operation(summary = "Resource for software module (Deployment Base)", description = """
@@ -287,33 +274,24 @@ public interface DdiRootControllerRestApi {
+ DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}", produces = { MediaTypes.HAL_JSON_VALUE,
MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty
final String controllerId,
@PathVariable("actionId") @NotNull
final Long actionId,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "c", required = false, defaultValue = "-1")
final int resource,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotNull final Long actionId,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "c", required = false, defaultValue = "-1") final int resource,
@RequestParam(
value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "actionHistory",
defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
@Schema(description = """
(Optional) GET parameter to retrieve a given number of messages which are previously provided by the
device. Useful if the devices sent state information to the feedback channel and never stored them
locally.""")
final Integer actionHistoryMessageCount);
locally.""") final Integer actionHistoryMessageCount);
/**
* This is the feedback channel for the {@link DdiDeploymentBase} action.
*
* @param tenant
* of the client
* @param feedback
* to provide
* @param controllerId
* of the target that matches to controller id
* @param actionId
* of the action we have feedback for
*
* @param tenant of the client
* @param feedback to provide
* @param controllerId of the target that matches to controller id
* @param actionId of the action we have feedback for
* @return the response
*/
@Operation(summary = "Feedback channel for the DeploymentBase action", description = """
@@ -360,13 +338,9 @@ public interface DdiRootControllerRestApi {
/**
* This is the feedback channel for the config data action.
*
* @param tenant
* of the client
* @param configData
* as body
* @param controllerId
* to provide data for
*
* @param tenant of the client
* @param configData as body
* @param controllerId to provide data for
* @return status of the request
*/
@Operation(summary = "Feedback channel for the config data action", description = """
@@ -405,13 +379,9 @@ public interface DdiRootControllerRestApi {
/**
* RequestMethod.GET method for the {@link DdiCancel} action.
*
* @param tenant
* of the request
* @param controllerId
* ID of the calling target
* @param actionId
* of the action
*
* @param tenant of the request
* @param controllerId ID of the calling target
* @param actionId of the action
* @return the {@link DdiCancel} response
*/
@Operation(summary = "Cancel an action", description = """
@@ -445,15 +415,10 @@ public interface DdiRootControllerRestApi {
* RequestMethod.POST method receiving the {@link DdiActionFeedback} from
* the target.
*
* @param feedback
* the {@link DdiActionFeedback} from the target.
* @param tenant
* of the client
* @param controllerId
* the ID of the calling target
* @param actionId
* of the action we have feedback for
*
* @param feedback the {@link DdiActionFeedback} from the target.
* @param tenant of the client
* @param controllerId the ID of the calling target
* @param actionId of the action we have feedback for
* @return the {@link DdiActionFeedback} response
*/
@Operation(summary = "Feedback channel for cancel actions", description = """
@@ -495,15 +460,11 @@ public interface DdiRootControllerRestApi {
* Resource for installed distribution set to retrieve the last successfully
* finished action.
*
* @param tenant
* of the request
* @param controllerId
* of the target
* @param actionId
* of the {@link DdiDeploymentBase} that matches to installed
* @param tenant of the request
* @param controllerId of the target
* @param actionId of the {@link DdiDeploymentBase} that matches to installed
* action.
* @param actionHistoryMessageCount
* specifies the number of messages to be returned from action
* @param actionHistoryMessageCount specifies the number of messages to be returned from action
* history. Regardless of the passed value, in order to restrict
* resource utilization by controllers, maximum number of
* messages that are retrieved from database is limited by
@@ -518,7 +479,6 @@ public interface DdiRootControllerRestApi {
* actionHistoryMessageCount greater than zero: retrieves the
* specified number of messages, limited by maximum allowed
* number.
*
* @return the {@link DdiDeploymentBase}. The response is of same format as
* for the /deploymentBase resource.
*/
@@ -561,8 +521,7 @@ public interface DdiRootControllerRestApi {
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotNull final Long actionId,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING
+ "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
final Integer actionHistoryMessageCount);
+ "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount);
/**
* Returns the confirmation base with the current auto-confirmation state
@@ -609,19 +568,14 @@ public interface DdiRootControllerRestApi {
/**
* Resource for confirmation of an action.
*
* @param tenant
* of the request
* @param controllerId
* of the target
* @param actionId
* of the {@link DdiConfirmationBaseAction} that matches to
* @param tenant of the request
* @param controllerId of the target
* @param actionId of the {@link DdiConfirmationBaseAction} that matches to
* active actions in WAITING_FOR_CONFIRMATION status.
* @param resource
* an hashcode of the resource which indicates if the action has
* @param resource an hashcode of the resource which indicates if the action has
* been changed, e.g. from 'soft' to 'force' and the eTag needs
* to be re-generated
* @param actionHistoryMessageCount
* specifies the number of messages to be returned from action
* @param actionHistoryMessageCount specifies the number of messages to be returned from action
* history. Regardless of the passed value, in order to restrict
* resource utilization by controllers, maximum number of
* messages that are retrieved from database is limited by
@@ -636,7 +590,6 @@ public interface DdiRootControllerRestApi {
* actionHistoryMessageCount greater than zero: retrieves the
* specified number of messages, limited by maximum allowed
* number.
*
* @return the response
*/
@Operation(summary = "Confirmation status of an action", description = """
@@ -677,22 +630,16 @@ public interface DdiRootControllerRestApi {
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING
+ "c", required = false, defaultValue = "-1") final int resource,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING
+ "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
final Integer actionHistoryMessageCount);
+ "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount);
/**
* This is the feedback channel for the {@link DdiConfirmationBaseAction}
* action.
*
* @param tenant
* of the client
* @param feedback
* to provide
* @param controllerId
* of the target that matches to controller id
* @param actionId
* of the action we have feedback for
*
* @param tenant of the client
* @param feedback to provide
* @param controllerId of the target that matches to controller id
* @param actionId of the action we have feedback for
* @return the response
*/
@Operation(summary = "Feedback channel for actions waiting for confirmation", description = """
@@ -740,12 +687,9 @@ public interface DdiRootControllerRestApi {
* {@link DdiActivateAutoConfirmation}. If not present, the values will be
* prefilled with a default remark and the CONTROLLER as initiator.
*
* @param tenant
* the controllerId is corresponding too
* @param controllerId
* to activate auto-confirmation for
* @param body
* as {@link DdiActivateAutoConfirmation}
* @param tenant the controllerId is corresponding too
* @param controllerId to activate auto-confirmation for
* @param body as {@link DdiActivateAutoConfirmation}
* @return {@link org.springframework.http.HttpStatus#OK} if successful or
* {@link org.springframework.http.HttpStatus#CONFLICT} in case
* auto-confirmation was active already.
@@ -828,18 +772,13 @@ public interface DdiRootControllerRestApi {
ResponseEntity<Void> deactivateAutoConfirmation(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId);
/**
* Assign an already installed distribution for a target
*
* @param tenant
* of the client
* @param tenant of the client
* to provide
* @param controllerId
* of the target that matches to controller id
* @param ddiAssignedVersion
* as {@link DdiAssignedVersion}
*
* @param controllerId of the target that matches to controller id
* @param ddiAssignedVersion as {@link DdiAssignedVersion}
* @return the response
*/
@Operation(summary = "Set offline assigned version", description = """

View File

@@ -18,15 +18,13 @@ import java.time.Instant;
import java.util.Collections;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test;
/**
* Test serialization of DDI api model 'DdiActionFeedback'

View File

@@ -17,14 +17,12 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiActionHistory'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifactHash'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifact'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiCancelActionToStop'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifact'

View File

@@ -17,14 +17,12 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiChunk'

View File

@@ -17,14 +17,12 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiConfigData'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiConfig'

View File

@@ -10,6 +10,16 @@
package org.eclipse.hawkbit.ddi.json.model;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.DdiMaintenanceWindowStatus.AVAILABLE;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.ATTEMPT;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.FORCED;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
@@ -17,16 +27,6 @@ import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.DdiMaintenanceWindowStatus.AVAILABLE;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.ATTEMPT;
import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.FORCED;
/**
* Test serializability of DDI api model 'DdiConfirmationBase'
*/

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiControllerBase'

View File

@@ -20,14 +20,12 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiDeploymentBase'

View File

@@ -19,14 +19,12 @@ import static org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType.FORC
import java.io.IOException;
import java.util.Collections;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiDeployment'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiMetadata'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiPolling'

View File

@@ -15,14 +15,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiProgress'

View File

@@ -16,14 +16,12 @@ import static org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult.NONE;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiResult'

View File

@@ -19,14 +19,12 @@ import java.io.IOException;
import java.util.Collections;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@@ -59,15 +57,6 @@ public class DdiStatusTest {
assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails());
}
private static Stream<Arguments> ddiStatusPossibilities(){
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
return Stream.of(
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.emptyList())),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.singletonList("testMessage"))),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, 12, Collections.emptyList())));
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
public void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@@ -113,4 +102,13 @@ public class DdiStatusTest {
assertThatExceptionOfType(MismatchedInputException.class).isThrownBy(
() -> mapper.readValue(serializedDdiStatus, DdiStatus.class));
}
private static Stream<Arguments> ddiStatusPossibilities() {
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
return Stream.of(
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.emptyList())),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.singletonList("testMessage"))),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, 12, Collections.emptyList())));
}
}

View File

@@ -12,18 +12,16 @@ package org.eclipse.hawkbit.ddi.json.model;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import java.util.List;
import org.junit.jupiter.api.Test;
/**
* Check DDI api model classes for '@JsonIgnoreProperties' annotation