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 # 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 # 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 # 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" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>

View File

@@ -11,15 +11,14 @@ package org.eclipse.hawkbit.ddi.json.model;
import java.util.List; 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.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder; 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 * 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 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import org.springframework.hateoas.RepresentationModel; 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} * Download information for all artifacts related to a specific {@link DdiChunk}
*/ */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,21 +9,21 @@
*/ */
package org.eclipse.hawkbit.ddi.json.model; 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.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; 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 * 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: * 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) @JsonIgnoreProperties(ignoreUnknown = true)
public class DdiConfirmationFeedback { 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 @NotNull
@Valid @Valid
@Schema(description = "Action confirmation state") @Schema(description = "Action confirmation state")
private final Confirmation confirmation; private final Confirmation confirmation;
@Schema(description = "(Optional) Individual status code", example = "200") @Schema(description = "(Optional) Individual status code", example = "200")
private final Integer code; private final Integer code;
@Schema(description = "List of detailed message information", example = "[ \"Feedback message\" ]") @Schema(description = "List of detailed message information", example = "[ \"Feedback message\" ]")
private final List<String> details; private final List<String> details;
@@ -77,7 +51,8 @@ public class DdiConfirmationFeedback {
* @param code code for confirmation * @param code code for confirmation
* @param details messages * @param details messages
*/ */
@JsonCreator public DdiConfirmationFeedback( @JsonCreator
public DdiConfirmationFeedback(
@JsonProperty(value = "confirmation", required = true) final Confirmation confirmation, @JsonProperty(value = "confirmation", required = true) final Confirmation confirmation,
@JsonProperty(value = "code") final Integer code, @JsonProperty(value = "code") final Integer code,
@JsonProperty(value = "details") final List<String> details) { @JsonProperty(value = "details") final List<String> details) {
@@ -92,4 +67,27 @@ public class DdiConfirmationFeedback {
} }
return Collections.unmodifiableList(details); 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; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
@@ -16,11 +20,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import org.springframework.hateoas.RepresentationModel; 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. * {@link DdiControllerBase} resource content.
*/ */
@@ -63,8 +62,7 @@ public class DdiControllerBase extends RepresentationModel<DdiControllerBase> {
/** /**
* Constructor. * Constructor.
* *
* @param config * @param config configuration of the SP target
* configuration of the SP target
*/ */
public DdiControllerBase(final DdiConfig config) { public DdiControllerBase(final DdiConfig config) {
this.config = config; this.config = config;

View File

@@ -12,13 +12,13 @@ package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -35,6 +35,53 @@ import lombok.ToString;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class DdiDeployment { 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. * The handling type for the update action.
*/ */
@@ -97,55 +144,4 @@ public class DdiDeployment {
return this.status; 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 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
@@ -18,11 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import org.springframework.hateoas.RepresentationModel; 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. * Update action resource.
*/ */
@@ -221,12 +220,9 @@ public class DdiDeploymentBase extends RepresentationModel<DdiDeploymentBase> {
/** /**
* Constructor. * Constructor.
* *
* @param id * @param id of the update action
* of the update action * @param deployment details
* @param deployment * @param actionHistory containing current action status and a list of feedback
* details
* @param actionHistory
* containing current action status and a list of feedback
* messages received earlier from the controller. * messages received earlier from the controller.
*/ */
public DdiDeploymentBase(final String id, final DdiDeployment deployment, final DdiActionHistory actionHistory) { public DdiDeploymentBase(final String id, final DdiDeployment deployment, final DdiActionHistory actionHistory) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,6 +10,16 @@
package org.eclipse.hawkbit.ddi.json.model; 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.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
@@ -17,16 +27,6 @@ import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test; 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' * 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 java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiControllerBase' * Test serializability of DDI api model 'DdiControllerBase'

View File

@@ -20,14 +20,12 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiDeploymentBase' * 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.io.IOException;
import java.util.Collections; import java.util.Collections;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiDeployment' * 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 java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiMetadata' * 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 java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiPolling' * 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 java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiProgress' * 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 java.io.IOException;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/** /**
* Test serializability of DDI api model 'DdiResult' * Test serializability of DDI api model 'DdiResult'

View File

@@ -19,14 +19,12 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description; import io.qameta.allure.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
@@ -59,15 +57,6 @@ public class DdiStatusTest {
assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails()); 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 @Test
@Description("Verify the correct deserialization of a model with a additional unknown property") @Description("Verify the correct deserialization of a model with a additional unknown property")
public void shouldDeserializeObjectWithUnknownProperty() throws IOException { public void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@@ -113,4 +102,13 @@ public class DdiStatusTest {
assertThatExceptionOfType(MismatchedInputException.class).isThrownBy( assertThatExceptionOfType(MismatchedInputException.class).isThrownBy(
() -> mapper.readValue(serializedDdiStatus, DdiStatus.class)); () -> 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 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.ClassGraph;
import io.github.classgraph.ClassInfo; import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult; 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.Description;
import io.qameta.allure.Feature; import io.qameta.allure.Feature;
import io.qameta.allure.Story; import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import java.util.List;
/** /**
* Check DDI api model classes for '@JsonIgnoreProperties' annotation * Check DDI api model classes for '@JsonIgnoreProperties' annotation