diff --git a/hawkbit-rest/hawkbit-ddi-api/README.md b/hawkbit-rest/hawkbit-ddi-api/README.md index 3f2aa1fbb..2366783d9 100644 --- a/hawkbit-rest/hawkbit-ddi-api/README.md +++ b/hawkbit-rest/hawkbit-ddi-api/README.md @@ -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 diff --git a/hawkbit-rest/hawkbit-ddi-api/pom.xml b/hawkbit-rest/hawkbit-ddi-api/pom.xml index baa4d6e76..378b88ee3 100644 --- a/hawkbit-rest/hawkbit-ddi-api/pom.xml +++ b/hawkbit-rest/hawkbit-ddi-api/pom.xml @@ -10,64 +10,65 @@ --> - - 4.0.0 - - org.eclipse.hawkbit - hawkbit-rest-parent - ${revision} - - hawkbit-ddi-api - hawkBit :: REST :: DDI API + + 4.0.0 + + org.eclipse.hawkbit + hawkbit-rest-parent + ${revision} + + hawkbit-ddi-api + hawkBit :: REST :: DDI API - - - org.springframework.hateoas - spring-hateoas - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.dataformat - jackson-dataformat-cbor - - - jakarta.validation - jakarta.validation-api - - - org.eclipse.hawkbit - hawkbit-rest-core - ${project.version} - - - org.springdoc - springdoc-openapi-starter-webmvc-ui - + + + org.springframework.hateoas + spring-hateoas + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.dataformat + jackson-dataformat-cbor + + + jakarta.validation + jakarta.validation-api + + + org.eclipse.hawkbit + hawkbit-rest-core + ${project.version} + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + - - - org.springframework.boot - spring-boot-starter-test - test - - - io.github.classgraph - classgraph - test - - - org.assertj - assertj-core - test - - - io.qameta.allure - allure-junit5 - test - - + + + org.springframework.boot + spring-boot-starter-test + test + + + io.github.classgraph + classgraph + test + + + org.assertj + assertj-core + test + + + io.qameta.allure + allure-junit5 + test + + diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedback.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedback.java index 67f992179..0596cc522 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedback.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedback.java @@ -54,7 +54,7 @@ public class DdiActionFeedback { /** * Constructs an action-feedback - * + * * @param time time of feedback * @param status status to be appended to the action */ diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistory.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistory.java index ce0013a78..45e34267e 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistory.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistory.java @@ -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 diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java index e14546ad6..4cb2f37c2 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java @@ -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} */ @@ -28,35 +27,35 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ToString(callSuper = true) @JsonIgnoreProperties(ignoreUnknown = true) @Schema(description = """ - **_links**: - * **download** - HTTPs Download resource for artifacts. The resource supports partial download as specified by RFC7233 (range requests). Keep in mind that the target needs to have the artifact assigned in order to be granted permission to download. - * **md5sum** - HTTPs Download resource for MD5SUM file is an optional auto generated artifact that is especially useful for Linux based devices on order to check artifact consistency after download by using the md5sum command line tool. The MD5 and SHA1 are in addition available as metadata in the deployment command itself. - * **download-http** - HTTP Download resource for artifacts. The resource supports partial download as specified by RFC7233 (range requests). Keep in mind that the target needs to have the artifact assigned in order to be granted permission to download. (note: anonymous download needs to be enabled on the service account for non-TLS access) - * **md5sum-http** - HTTP Download resource for MD5SUM file is an optional auto generated artifact that is especially useful for Linux based devices on order to check artifact consistency after download by using the md5sum command line tool. The MD5 and SHA1 are in addition available as metadata in the deployment command itself. (note: anonymous download needs to be enabled on the service account for non-TLS access) - """, example = """ - { - "filename" : "binaryFile", - "hashes" : { - "sha1" : "e4e667b70ff652cb9d9c8a49f141bd68e06cec6f", - "md5" : "13793b0e3a7830ed685d3ede7ff93048", - "sha256" : "c51368bf045803b429a67bdf04539a373d9fb8caa310fe0431265e6871b4f07a" - }, - "size" : 11, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile.MD5SUM" - } - } - }""") + **_links**: + * **download** - HTTPs Download resource for artifacts. The resource supports partial download as specified by RFC7233 (range requests). Keep in mind that the target needs to have the artifact assigned in order to be granted permission to download. + * **md5sum** - HTTPs Download resource for MD5SUM file is an optional auto generated artifact that is especially useful for Linux based devices on order to check artifact consistency after download by using the md5sum command line tool. The MD5 and SHA1 are in addition available as metadata in the deployment command itself. + * **download-http** - HTTP Download resource for artifacts. The resource supports partial download as specified by RFC7233 (range requests). Keep in mind that the target needs to have the artifact assigned in order to be granted permission to download. (note: anonymous download needs to be enabled on the service account for non-TLS access) + * **md5sum-http** - HTTP Download resource for MD5SUM file is an optional auto generated artifact that is especially useful for Linux based devices on order to check artifact consistency after download by using the md5sum command line tool. The MD5 and SHA1 are in addition available as metadata in the deployment command itself. (note: anonymous download needs to be enabled on the service account for non-TLS access) + """, example = """ + { + "filename" : "binaryFile", + "hashes" : { + "sha1" : "e4e667b70ff652cb9d9c8a49f141bd68e06cec6f", + "md5" : "13793b0e3a7830ed685d3ede7ff93048", + "sha256" : "c51368bf045803b429a67bdf04539a373d9fb8caa310fe0431265e6871b4f07a" + }, + "size" : 11, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/40/filename/binaryFile.MD5SUM" + } + } + }""") public class DdiArtifact extends RepresentationModel { @NotNull diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java index e769ae523..a1ca9cf5c 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java @@ -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; diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiAssignedVersion.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiAssignedVersion.java index 086790fd7..94dd272d6 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiAssignedVersion.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiAssignedVersion.java @@ -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, diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiCancel.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiCancel.java index 9608a3d4a..0c8fb87ca 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiCancel.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiCancel.java @@ -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, diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigData.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigData.java index 48e3c4a9c..4506298c4 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigData.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigData.java @@ -28,14 +28,14 @@ import lombok.ToString; @EqualsAndHashCode @ToString @JsonIgnoreProperties(ignoreUnknown = true) -@Schema(example = """ - { - "mode" : "merge", - "data" : { - "VIN" : "JH4TB2H26CC000000", - "hwRevision" : "2" - } - }""") +@Schema(example = """ + { + "mode" : "merge", + "data" : { + "VIN" : "JH4TB2H26CC000000", + "hwRevision" : "2" + } + }""") public class DdiConfigData { @NotEmpty @@ -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( diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBase.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBase.java index 8142a0e15..242b61f22 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBase.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBase.java @@ -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. @@ -34,25 +33,25 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonPropertyOrder({ "autoConfirm" }) @Schema( description = """ - **_links**: - * **confirmationBase** - confirmation base - * **deactivateAutoConfirm** - where to deactivate auto confirm - * **activateAutoConfirm** - where to activate auto confirm - """, + **_links**: + * **confirmationBase** - confirmation base + * **deactivateAutoConfirm** - where to deactivate auto confirm + * **activateAutoConfirm** - where to activate auto confirm + """, example = """ - { - "autoConfirm" : { - "active" : false - }, - "_links" : { - "activateAutoConfirm" : { - "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/confirmationBase/activateAutoConfirm" - }, - "confirmationBase" : { - "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/confirmationBase/10?c=-2122565939" - } - } - }""") + { + "autoConfirm" : { + "active" : false + }, + "_links" : { + "activateAutoConfirm" : { + "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/confirmationBase/activateAutoConfirm" + }, + "confirmationBase" : { + "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/confirmationBase/10?c=-2122565939" + } + } + }""") public class DdiConfirmationBase extends RepresentationModel { @JsonProperty("autoConfirm") diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseAction.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseAction.java index 45f93c46e..20a055272 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseAction.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseAction.java @@ -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. */ @@ -33,173 +32,173 @@ import java.util.Objects; @JsonIgnoreProperties(ignoreUnknown = true) @JsonPropertyOrder({ "id", "confirmation", "actionHistory" }) @Schema(description = """ - The response body includes the detailed information about the action awaiting confirmation in the same format as - for the deploymentBase operation.""", + The response body includes the detailed information about the action awaiting confirmation in the same format as + for the deploymentBase operation.""", example = """ - { - "id" : "6", - "confirmation" : { - "download" : "forced", - "update" : "forced", - "maintenanceWindow" : "available", - "chunks" : [ { - "part" : "jvm", - "version" : "1.0.62", - "name" : "oneapp runtime", - "artifacts" : [ { - "filename" : "binary.tgz", - "hashes" : { - "sha1" : "3dceccec02e7626184bdbba12b247b67ff04c363", - "md5" : "a9a7df0aa4c72b3b03b654c42d29744b", - "sha256" : "971d8db88fef8e7a3e6d5bbf501d69b07d0c300d9be948aff8b52960ef039358" - }, - "size" : 11, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz.MD5SUM" - } - } - }, { - "filename" : "file.signature", - "hashes" : { - "sha1" : "3dceccec02e7626184bdbba12b247b67ff04c363", - "md5" : "a9a7df0aa4c72b3b03b654c42d29744b", - "sha256" : "971d8db88fef8e7a3e6d5bbf501d69b07d0c300d9be948aff8b52960ef039358" - }, - "size" : 11, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature.MD5SUM" - } - } - } ] - }, { - "part" : "bApp", - "version" : "1.0.96", - "name" : "oneapplication", - "artifacts" : [ { - "filename" : "binary.tgz", - "hashes" : { - "sha1" : "701c0c0fcbee5e96fa5c5b819cb519686940ade3", - "md5" : "f0f6a34c4c9e79d07c2d92c3c3d88560", - "sha256" : "cff472a07c3143741fb03ac6c577acabef72a186a8bfaab00bbb47ca5ebbe554" - }, - "size" : 11, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz.MD5SUM" - } - } - }, { - "filename" : "file.signature", - "hashes" : { - "sha1" : "701c0c0fcbee5e96fa5c5b819cb519686940ade3", - "md5" : "f0f6a34c4c9e79d07c2d92c3c3d88560", - "sha256" : "cff472a07c3143741fb03ac6c577acabef72a186a8bfaab00bbb47ca5ebbe554" - }, - "size" : 11, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature.MD5SUM" - } - } - } ] - }, { - "part" : "os", - "version" : "1.0.44", - "name" : "one Firmware", - "artifacts" : [ { - "filename" : "binary.tgz", - "hashes" : { - "sha1" : "2b09765e953cd138b7da8f4725e48183dab62aec", - "md5" : "9b0aa2f51379cb4a5e0b7d026c2605c9", - "sha256" : "618faa741070b3f8148bad06f088e537a8f7913e734df4dde61fb163725cb4ee" - }, - "size" : 15, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz.MD5SUM" - } - } - }, { - "filename" : "file.signature", - "hashes" : { - "sha1" : "2b09765e953cd138b7da8f4725e48183dab62aec", - "md5" : "9b0aa2f51379cb4a5e0b7d026c2605c9", - "sha256" : "618faa741070b3f8148bad06f088e537a8f7913e734df4dde61fb163725cb4ee" - }, - "size" : 15, - "_links" : { - "download" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature" - }, - "download-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature" - }, - "md5sum-http" : { - "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature.MD5SUM" - }, - "md5sum" : { - "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature.MD5SUM" - } - } - } ], - "metadata" : [ { - "key" : "aMetadataKey", - "value" : "Metadata value as defined in software module" - } ] - } ] - }, - "actionHistory" : { - "status" : "WAIT_FOR_CONFIRMATION", - "messages" : [ "Assignment initiated by user 'TestPrincipal'", "Waiting for the confirmation by the device before processing with the deployment" ] - } - }""") + { + "id" : "6", + "confirmation" : { + "download" : "forced", + "update" : "forced", + "maintenanceWindow" : "available", + "chunks" : [ { + "part" : "jvm", + "version" : "1.0.62", + "name" : "oneapp runtime", + "artifacts" : [ { + "filename" : "binary.tgz", + "hashes" : { + "sha1" : "3dceccec02e7626184bdbba12b247b67ff04c363", + "md5" : "a9a7df0aa4c72b3b03b654c42d29744b", + "sha256" : "971d8db88fef8e7a3e6d5bbf501d69b07d0c300d9be948aff8b52960ef039358" + }, + "size" : 11, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/binary.tgz.MD5SUM" + } + } + }, { + "filename" : "file.signature", + "hashes" : { + "sha1" : "3dceccec02e7626184bdbba12b247b67ff04c363", + "md5" : "a9a7df0aa4c72b3b03b654c42d29744b", + "sha256" : "971d8db88fef8e7a3e6d5bbf501d69b07d0c300d9be948aff8b52960ef039358" + }, + "size" : 11, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/17/filename/file.signature.MD5SUM" + } + } + } ] + }, { + "part" : "bApp", + "version" : "1.0.96", + "name" : "oneapplication", + "artifacts" : [ { + "filename" : "binary.tgz", + "hashes" : { + "sha1" : "701c0c0fcbee5e96fa5c5b819cb519686940ade3", + "md5" : "f0f6a34c4c9e79d07c2d92c3c3d88560", + "sha256" : "cff472a07c3143741fb03ac6c577acabef72a186a8bfaab00bbb47ca5ebbe554" + }, + "size" : 11, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/binary.tgz.MD5SUM" + } + } + }, { + "filename" : "file.signature", + "hashes" : { + "sha1" : "701c0c0fcbee5e96fa5c5b819cb519686940ade3", + "md5" : "f0f6a34c4c9e79d07c2d92c3c3d88560", + "sha256" : "cff472a07c3143741fb03ac6c577acabef72a186a8bfaab00bbb47ca5ebbe554" + }, + "size" : 11, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/16/filename/file.signature.MD5SUM" + } + } + } ] + }, { + "part" : "os", + "version" : "1.0.44", + "name" : "one Firmware", + "artifacts" : [ { + "filename" : "binary.tgz", + "hashes" : { + "sha1" : "2b09765e953cd138b7da8f4725e48183dab62aec", + "md5" : "9b0aa2f51379cb4a5e0b7d026c2605c9", + "sha256" : "618faa741070b3f8148bad06f088e537a8f7913e734df4dde61fb163725cb4ee" + }, + "size" : 15, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/binary.tgz.MD5SUM" + } + } + }, { + "filename" : "file.signature", + "hashes" : { + "sha1" : "2b09765e953cd138b7da8f4725e48183dab62aec", + "md5" : "9b0aa2f51379cb4a5e0b7d026c2605c9", + "sha256" : "618faa741070b3f8148bad06f088e537a8f7913e734df4dde61fb163725cb4ee" + }, + "size" : 15, + "_links" : { + "download" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature" + }, + "download-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature" + }, + "md5sum-http" : { + "href" : "http://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature.MD5SUM" + }, + "md5sum" : { + "href" : "https://link-to-cdn.com/api/v1/TENANT_ID/download/controller/CONTROLLER_ID/softwaremodules/18/filename/file.signature.MD5SUM" + } + } + } ], + "metadata" : [ { + "key" : "aMetadataKey", + "value" : "Metadata value as defined in software module" + } ] + } ] + }, + "actionHistory" : { + "status" : "WAIT_FOR_CONFIRMATION", + "messages" : [ "Assignment initiated by user 'TestPrincipal'", "Waiting for the confirmation by the device before processing with the deployment" ] + } + }""") public class DdiConfirmationBaseAction extends RepresentationModel { @JsonProperty("id") @@ -230,10 +229,10 @@ public class DdiConfirmationBaseAction extends RepresentationModel details; /** * Constructs an confirmation-feedback * - * @param confirmation confirmation value for the action. Valid values are "Confirmed" and "Denied - * @param code code for confirmation + * @param confirmation confirmation value for the action. Valid values are "Confirmed" and "Denied + * @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 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; + } + } } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java index d324f3f3f..20e9468e4 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java @@ -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. */ @@ -31,30 +30,30 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) @Schema(description = """ - **_links**: Actions that the server has for the target - * **deploymentBase** - Detailed deployment operation - * **installedBase** - Detailed operation of last successfully finished action - * **configData** - Link which is provided whenever the provisioning target or device is supposed to push its configuration data (aka. "controller attributes") to the server. Only shown for the initial configuration, after a successful update action, or if requested explicitly (e.g. via the management UI) - """, - example = """ - { - "config" : { - "polling" : { - "sleep" : "12:00:00" - } - }, - "_links" : { - "deploymentBase" : { - "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/deploymentBase/5?c=-2127183556" - }, - "installedBase" : { - "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/installedBase/4" - }, - "configData" : { - "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/configData" - } - } - }""") + **_links**: Actions that the server has for the target + * **deploymentBase** - Detailed deployment operation + * **installedBase** - Detailed operation of last successfully finished action + * **configData** - Link which is provided whenever the provisioning target or device is supposed to push its configuration data (aka. "controller attributes") to the server. Only shown for the initial configuration, after a successful update action, or if requested explicitly (e.g. via the management UI) + """, + example = """ + { + "config" : { + "polling" : { + "sleep" : "12:00:00" + } + }, + "_links" : { + "deploymentBase" : { + "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/deploymentBase/5?c=-2127183556" + }, + "installedBase" : { + "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/installedBase/4" + }, + "configData" : { + "href" : "https://management-api.host.com/TENANT_ID/controller/v1/CONTROLLER_ID/configData" + } + } + }""") public class DdiControllerBase extends RepresentationModel { @JsonProperty @@ -63,8 +62,7 @@ public class DdiControllerBase extends RepresentationModel { /** * Constructor. * - * @param config - * configuration of the SP target + * @param config configuration of the SP target */ public DdiControllerBase(final DdiConfig config) { this.config = config; diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java index a246bccd6..a6c7a27ae 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java @@ -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 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 chunks, + final DdiMaintenanceWindowStatus maintenanceWindow) { + this.download = download; + this.update = update; + this.chunks = chunks; + this.maintenanceWindow = maintenanceWindow; + } + + public List 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 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 chunks, - final DdiMaintenanceWindowStatus maintenanceWindow) { - this.download = download; - this.update = update; - this.chunks = chunks; - this.maintenanceWindow = maintenanceWindow; - } - - public List getChunks() { - if (chunks == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(chunks); - } } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java index 1af0bec4f..63d97d223 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java @@ -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,13 +220,10 @@ public class DdiDeploymentBase extends RepresentationModel { /** * Constructor. * - * @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. + * @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) { this.id = id; diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadata.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadata.java index 6b64182f3..4a98f22b3 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadata.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadata.java @@ -39,7 +39,7 @@ public class DdiMetadata { private final String value; @JsonCreator - public DdiMetadata(@JsonProperty("key") final String key, @JsonProperty("value")final String value) { + public DdiMetadata(@JsonProperty("key") final String key, @JsonProperty("value") final String value) { this.key = key; this.value = value; } diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java index 5f5532ced..6a4e8411c 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java @@ -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 diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiProgress.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiProgress.java index 9bb27b0ad..2524b672d 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiProgress.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiProgress.java @@ -40,7 +40,7 @@ public class DdiProgress { * Constructor. * * @param cnt achieved amount - * @param of maximum levels + * @param of maximum levels */ @JsonCreator public DdiProgress(@JsonProperty("cnt") final Integer cnt, @JsonProperty("of") final Integer of) { diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiResult.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiResult.java index 4ec157079..a84cfb5e6 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiResult.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiResult.java @@ -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; - } } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiStatus.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiStatus.java index 99013ab95..ac04e17e0 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiStatus.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiStatus.java @@ -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 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 details) { + this.execution = execution; + this.result = result; + this.code = code; + this.details = details; + } + + public List 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 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 details) { - this.execution = execution; - this.result = result; - this.code = code; - this.details = details; - } - - public List getDetails() { - if (details == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(details); - } } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiUpdateMode.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiUpdateMode.java index 8bbd349fb..6ab30f3a2 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiUpdateMode.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiUpdateMode.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * Enumerates the supported update modes. Each mode represents an attribute * update strategy. - * + * * @see DdiConfigData */ public enum DdiUpdateMode { diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java index f3e716bd4..7beb654d6 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java @@ -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; @@ -56,7 +56,7 @@ public interface DdiRootControllerRestApi { /** * Returns all artifacts of a given software module and target. - * + * * @param tenant of the client * @param controllerId of the target that matches to controller id * @param softwareModuleId of the software module @@ -65,25 +65,25 @@ public interface DdiRootControllerRestApi { @Operation(summary = "Return all artifacts of a given software module and target", description = "Returns all artifacts that are assigned to the software module") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts", produces = { MediaTypes.HAL_JSON_VALUE, - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity> getSoftwareModulesArtifacts(@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("softwareModuleId") final Long softwareModuleId); @@ -93,33 +93,32 @@ 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 = """ - This base resource can be regularly polled by the controller on the provisioning target or device in order to - retrieve actions that need to be executed. Those are provided as a list of links to give more detailed - information about the action. Links are only available for initial configuration, open actions, or the latest - installed action, respectively. The resource supports Etag based modification checks in order to save traffic. - - Note: deployments have to be confirmed in order to move on to the next action. Cancellations have to be - confirmed or rejected.""") + This base resource can be regularly polled by the controller on the provisioning target or device in order to + retrieve actions that need to be executed. Those are provided as a list of links to give more detailed + information about the action. Links are only available for initial configuration, open actions, or the latest + installed action, respectively. The resource supports Etag based modification checks in order to save traffic. + + Note: deployments have to be confirmed in order to move on to the next action. Cancellations have to be + confirmed or rejected.""") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to " + - "be changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to " + + "be changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) @@ -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}. @@ -142,23 +140,23 @@ public interface DdiRootControllerRestApi { @Operation(summary = "Artifact download", description = "Handles GET DdiArtifact download request. This could be " + "full or partial (as specified by RFC7233 (Range Requests)) download request.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be" + - " changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target or Module not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts" + - " and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be" + + " changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target or Module not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts" + + " and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}") @@ -170,38 +168,33 @@ 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 */ @Operation(summary = "MD5 checksum download", description = "Handles GET {@link DdiArtifact} MD5 checksum file download request.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target or Module not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target or Module not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}" @@ -214,145 +207,130 @@ 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 - * actions. - * @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 - * 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 - * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. - * - * actionHistoryMessageCount less than zero: retrieves the - * maximum allowed number of action status messages from history; - * - * actionHistoryMessageCount equal to zero: does not retrieve any - * message; - * - * actionHistoryMessageCount greater than zero: retrieves the - * specified number of messages, limited by maximum allowed - * number. - * + * @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 + * 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 + * 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 + * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. + * + * actionHistoryMessageCount less than zero: retrieves the + * maximum allowed number of action status messages from history; + * + * actionHistoryMessageCount equal to zero: does not retrieve any + * message; + * + * 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 = """ - Core resource for deployment operations. Contains all information necessary in order to execute the operation. - - Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. - Host, port and path and not guaranteed to be similar to the provided examples below but will be defined at - runtime. - """) + Core resource for deployment operations. Contains all information necessary in order to execute the operation. + + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. + Host, port and path and not guaranteed to be similar to the provided examples below but will be defined at + runtime. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = """ - Successfully retrieved - - In case a device provides state information on the feedback channel and won’t store it locally, - a query for, e.q, the last 10 messages, could be used which will include the previously provided by the - device, - feedback. - - In addition to the straight forward approach to inform the device to download and install the software - in one transaction hawkBit supports the separation of download and installation into separate steps. - - This feature is called Maintenance Window where the device is informed to download the software first - and then when it enters a defined (maintenance) window the installation triggers follows as usual. - """), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", - description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " + - "data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = """ + Successfully retrieved + + In case a device provides state information on the feedback channel and won’t store it locally, + a query for, e.q, the last 10 messages, could be used which will include the previously provided by the + device, + feedback. + + In addition to the straight forward approach to inform the device to download and install the software + in one transaction hawkBit supports the separation of download and installation into separate steps. + + This feature is called Maintenance Window where the device is informed to download the software first + and then when it enters a defined (maintenance) window the installation triggers follows as usual. + """), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", + description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " + + "data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + 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 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 = """ - Feedback channel. It is up to the device how much intermediate feedback is provided. - However, the action will be kept open until the controller on the device reports a finished (either successful - or error). - """) + Feedback channel. It is up to the device how much intermediate feedback is provided. + However, the action will be kept open until the controller on the device reports a finished (either successful + or error). + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "410", description = "Action is not active anymore.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", - schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", - schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "410", description = "Action is not active anymore.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", + schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", + schema = @Schema(hidden = true))) }) @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/" + DdiRestConstants.FEEDBACK, consumes = { - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity postDeploymentBaseActionFeedback(@Valid final DdiActionFeedback feedback, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("actionId") @NotNull final Long actionId); @@ -360,83 +338,75 @@ 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 = """ - The usual behaviour is that when a new device registers at the server it is requested to provide the meta - information that will allow the server to identify the device on a hardware level (e.g. hardware revision, - mac address, serial number etc.).""") + The usual behaviour is that when a new device registers at the server it is requested to provide the meta + information that will allow the server to identify the device on a hardware level (e.g. hardware revision, + mac address, serial number etc.).""") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PutMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIG_DATA_ACTION, consumes = { MediaType.APPLICATION_JSON_VALUE, - DdiRestConstants.MEDIA_TYPE_CBOR }) + DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity putConfigData(@Valid final DdiConfigData configData, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId); /** * 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 = """ - The Hawkbit server might cancel an operation, e.g. an unfinished update has a successor. It is up to the - provisioning target to decide to accept the cancelation or reject it.""") + The Hawkbit server might cancel an operation, e.g. an unfinished update has a successor. It is up to the + provisioning target to decide to accept the cancelation or reject it.""") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, - DdiRestConstants.MEDIA_TYPE_CBOR }) + DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity getControllerCancelAction(@PathVariable("tenant") final String tenant, @PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("actionId") @NotNull final Long actionId); @@ -445,47 +415,42 @@ 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 = """ - It is up to the device how much intermediate feedback is provided. However, the action will be kept open - until the controller on the device reports a finished (either successful or error) or rejects the action, - e.g. the canceled actions have been started already.""") + It is up to the device how much intermediate feedback is provided. However, the action will be kept open + until the controller on the device reports a finished (either successful or error) or rejects the action, + e.g. the canceled actions have been started already.""") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/" + DdiRestConstants.FEEDBACK, consumes = { MediaType.APPLICATION_JSON_VALUE, - DdiRestConstants.MEDIA_TYPE_CBOR }) + DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity postCancelActionFeedback(@Valid final DdiActionFeedback feedback, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") @NotEmpty final String controllerId, @@ -495,74 +460,68 @@ 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 - * 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 - * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. - * - * actionHistoryMessageCount less than zero: retrieves the - * maximum allowed number of action status messages from history; - * - * actionHistoryMessageCount equal to zero: does not retrieve any - * message; - * - * actionHistoryMessageCount greater than zero: retrieves the - * specified number of messages, limited by maximum allowed - * number. - * + * @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 + * 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 + * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. + * + * actionHistoryMessageCount less than zero: retrieves the + * maximum allowed number of action status messages from history; + * + * actionHistoryMessageCount equal to zero: does not retrieve any + * message; + * + * 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. */ @Operation(summary = "Previously installed action", description = """ - Resource to receive information of the previous installation. Can be used to re-retrieve artifacts of - the already finished action, for example in case a re-installation is necessary. The response will be of - the same format as the deploymentBase operation, providing the previous action that has been finished - successfully. As the action is already finished, no further feedback is expected. - - Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. - Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at - runtime. - """) + Resource to receive information of the previous installation. Can be used to re-retrieve artifacts of + the already finished action, for example in case a re-installation is necessary. The response will be of + the same format as the deploymentBase operation, providing the previous action that has been finished + successfully. As the action is already finished, no further feedback is expected. + + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. + Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at + runtime. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = """ - The response body includes the detailed operation for the already finished action in the same format as - for the deploymentBase operation. - - In this case the (optional) query for the last 10 messages, previously provided by the device, are included. - """), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = """ + The response body includes the detailed operation for the already finished action in the same format as + for the deploymentBase operation. + + In this case the (optional) query for the last 10 messages, previously provided by the device, are included. + """), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_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 getControllerInstalledAction(@PathVariable("tenant") final String tenant, @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 @@ -575,161 +534,149 @@ public interface DdiRootControllerRestApi { * @return the state as {@link DdiAutoConfirmationState} */ @Operation(summary = "Resource to request confirmation specific information for the controller", description = """ - Core resource for confirmation related operations. While active actions awaiting confirmation will be - referenced, the current auto-confirmation status will be shown. In case auto-confirmation is active, details - like the initiator, remark and date of activation (as unix timestamp) will be provided. - Reference links to switch the auto-confirmation state are exposed as well. - """) + Core resource for confirmation related operations. While active actions awaiting confirmation will be + referenced, the current auto-confirmation status will be shown. In case auto-confirmation is active, details + like the initiator, remark and date of activation (as unix timestamp) will be provided. + Reference links to switch the auto-confirmation state are exposed as well. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = """ - The response body in case auto-confirmation is active is richer - it contains additional information - such as initiator, remark and when the auto-confirmation had been activated. - """), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = """ + The response body in case auto-confirmation is active is richer - it contains additional information + such as initiator, remark and when the auto-confirmation had been activated. + """), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE, produces = { MediaTypes.HAL_JSON_VALUE, - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity getConfirmationBase(@PathVariable("tenant") final String tenant, @PathVariable("controllerId") @NotEmpty final String controllerId); /** * 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 - * active actions in WAITING_FOR_CONFIRMATION status. - * @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 - * 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 - * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. + * @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 + * 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 + * 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 + * {@link RepositoryConstants#MAX_ACTION_HISTORY_MSG_COUNT}. * - * actionHistoryMessageCount less than zero: retrieves the - * maximum allowed number of action status messages from history; + * actionHistoryMessageCount less than zero: retrieves the + * maximum allowed number of action status messages from history; * - * actionHistoryMessageCount equal to zero: does not retrieve any - * message; - * - * actionHistoryMessageCount greater than zero: retrieves the - * specified number of messages, limited by maximum allowed - * number. + * actionHistoryMessageCount equal to zero: does not retrieve any + * message; * + * 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 = """ - Resource to receive information about a pending confirmation. The response will be of the same format as the - deploymentBase operation. The controller should provide feedback about the confirmation first, before - processing the deployment. - - Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. - Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at - runtime. - """) + Resource to receive information about a pending confirmation. The response will be of the same format as the + deploymentBase operation. The controller should provide feedback about the confirmation first, before + processing the deployment. + + Keep in mind that the provided download links for the artifacts are generated dynamically by the update server. + Host, port and path are not guaranteed to be similar to the provided examples below but will be defined at + runtime. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The response body includes the detailed information about " + - "the action awaiting confirmation in the same format as for the deploymentBase operation."), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "The response body includes the detailed information about " + + "the action awaiting confirmation in the same format as for the deploymentBase operation."), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/{actionId}", produces = { MediaTypes.HAL_JSON_VALUE, - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity getConfirmationBaseAction(@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, @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 = """ - The device will use this resource to either confirm or deny an action which is waiting for confirmation. The - action will be transferred into the RUNNING state in case the device is confirming it. Afterwards it will be - exposed by the deploymentBase. - """) + The device will use this resource to either confirm or deny an action which is waiting for confirmation. The + action will be transferred into the RUNNING state in case the device is confirming it. Afterwards it will be + exposed by the deploymentBase. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target or Action not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "410", description = "Action is not active anymore.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target or Action not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "410", description = "Action is not active anymore.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/{actionId}/" + DdiRestConstants.FEEDBACK, consumes = { - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity postConfirmationActionFeedback(@Valid final DdiConfirmationFeedback feedback, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("actionId") @NotNull final Long actionId); @@ -740,49 +687,46 @@ 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. */ @Operation(summary = "Interface to activate auto-confirmation for a specific device", description = """ - The device can use this resource to activate auto-confirmation. As a result all current active as well as - future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will - be automatically confirmed, as long as auto-confirmation is active. - """) + The device can use this resource to activate auto-confirmation. As a result all current active as well as + future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will + be automatically confirmed, as long as auto-confirmation is active. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" + DdiRestConstants.AUTO_CONFIRM_ACTIVATE, consumes = { - MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) + MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) ResponseEntity activateAutoConfirmation(@PathVariable("tenant") final String tenant, @PathVariable("controllerId") @NotEmpty final String controllerId, @Valid @RequestBody(required = false) final DdiActivateAutoConfirmation body); @@ -795,57 +739,52 @@ public interface DdiRootControllerRestApi { * @return {@link org.springframework.http.HttpStatus#OK} if successfully executed */ @Operation(summary = "Interface to deactivate auto-confirmation for a specific controller", description = """ - The device can use this resource to deactivate auto-confirmation. All active actions will remain unchanged - while all future actions need to be confirmed, before processing with the deployment. - """) + The device can use this resource to deactivate auto-confirmation. All active actions will remain unchanged + while all future actions need to be confirmed, before processing with the deployment. + """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), - @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), - @ApiResponse(responseCode = "401", description = "The request requires user authentication.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + - "changed (i.e. read-only) or data volume restriction applies.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Target not found", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + - "user in another request at the same time. You may retry your modification request.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + - "supported by the server for this resource.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + - "and the client has to wait another second.", - content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) + @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), + @ApiResponse(responseCode = "401", description = "The request requires user authentication.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be " + + "changed (i.e. read-only) or data volume restriction applies.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Target not found", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "409", description = "E.g. in case an entity is created or modified by another " + + "user in another request at the same time. You may retry your modification request.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "415", description = "The request was attempt with a media-type which is not " + + "supported by the server for this resource.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "429", description = "Too many requests. The server will refuse further attempts " + + "and the client has to wait another second.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" + DdiRestConstants.AUTO_CONFIRM_DEACTIVATE) ResponseEntity 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 - * to provide - * @param controllerId - * of the target that matches to controller id - * @param ddiAssignedVersion - * as {@link DdiAssignedVersion} - * + * @param tenant of the client + * to provide + * @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 = """ - Allow to set current running version. - This method is EXPERIMENTAL and may change in future releases. - """) + Allow to set current running version. + This method is EXPERIMENTAL and may change in future releases. + """) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedbackTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedbackTest.java index fb758a86a..993e1f79f 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedbackTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionFeedbackTest.java @@ -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' @@ -57,14 +55,14 @@ class DdiActionFeedbackTest { void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException { // Setup final String time = Instant.now().toString(); - final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10,10)); + final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10, 10)); final DdiStatus ddiStatus = new DdiStatus(DdiStatus.ExecutionStatus.CLOSED, ddiResult, 200, Collections.singletonList("myMessage")); final DdiActionFeedback ddiActionFeedback = new DdiActionFeedback(time, ddiStatus); // Test final String serializedDdiActionFeedback = mapper.writeValueAsString(ddiActionFeedback); final DdiActionFeedback deserializedDdiActionFeedback = mapper.readValue(serializedDdiActionFeedback, - DdiActionFeedback.class); + DdiActionFeedback.class); assertThat(serializedDdiActionFeedback).contains(time); assertThat(deserializedDdiActionFeedback.getTime()).isEqualTo(time); @@ -78,7 +76,7 @@ class DdiActionFeedbackTest { final String serializedDdiActionFeedback = "{\"time\":\"20190809T121314\",\"status\":{\"execution\": [closed],\"result\":null,\"details\":[]}}"; assertThatExceptionOfType(MismatchedInputException.class).isThrownBy( - () -> mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class)); + () -> mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class)); } @Test @@ -95,7 +93,7 @@ class DdiActionFeedbackTest { " }\n" + // "}";// - assertThat(mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class)).satisfies(deserializedDdiActionFeedback -> { + assertThat(mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class)).satisfies(deserializedDdiActionFeedback -> { assertThat(deserializedDdiActionFeedback.getTime()).isNull(); assertThat(deserializedDdiActionFeedback.getStatus()).isNotNull(); assertThat(deserializedDdiActionFeedback.getStatus().getResult()).isNotNull(); diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistoryTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistoryTest.java index 8a16b1ba1..b7dd44055 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistoryTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiActionHistoryTest.java @@ -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' @@ -57,11 +55,11 @@ public class DdiActionHistoryTest { public void shouldDeserializeObjectWithUnknownProperty() throws IOException { // Setup final String serializedDdiActionHistory = """ - { - "status": "SomeAction", - "messages": [ "Some message"], - "unknownProperty": "test" - }"""; + { + "status": "SomeAction", + "messages": [ "Some message"], + "unknownProperty": "test" + }"""; // Test final DdiActionHistory ddiActionHistory = OBJECT_MAPPER.readValue(serializedDdiActionHistory, DdiActionHistory.class); @@ -74,10 +72,10 @@ public class DdiActionHistoryTest { public void shouldFailForObjectWithWrongDataTypes() throws IOException { // Setup final String serializedDdiActionFeedback = """ - { - "status": [SomeAction], - "messages": ["Some message"] - }"""; + { + "status": [SomeAction], + "messages": ["Some message"] + }"""; assertThatExceptionOfType(MismatchedInputException.class).isThrownBy( () -> OBJECT_MAPPER.readValue(serializedDdiActionFeedback, DdiActionHistory.class)); diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHashTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHashTest.java index a27e9c21e..12785d9c4 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHashTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHashTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactTest.java index 2e8beecc3..dc1606fc7 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelActionToStopTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelActionToStopTest.java index 50cc60e08..c9d2ee8ff 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelActionToStopTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelActionToStopTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelTest.java index 05516d96a..baaf4086a 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiCancelTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiChunkTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiChunkTest.java index 31fc9977b..378e9ef50 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiChunkTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiChunkTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigDataTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigDataTest.java index 261aaf8f4..f277fb6e1 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigDataTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigDataTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigTest.java index 8deeded65..cd010d45a 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfigTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java index 1954b0bef..b76fe810b 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiConfirmationBaseTest.java @@ -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' */ diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBaseTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBaseTest.java index a21d47e98..7a8f828c0 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBaseTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBaseTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java index 6ec7bf2a1..45429a922 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBaseTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentTest.java index 2eaae07ca..eb810ebd3 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadataTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadataTest.java index ad4a3b5d4..8b18f81bd 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadataTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiMetadataTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiPollingTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiPollingTest.java index 5830ff9e7..cb962ebd1 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiPollingTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiPollingTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiProgressTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiProgressTest.java index 3495ba2e1..e0421484c 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiProgressTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiProgressTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiResultTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiResultTest.java index 4e562f1e2..0721ed990 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiResultTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiResultTest.java @@ -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' diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java index 6f7c28d78..865c70424 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/DdiStatusTest.java @@ -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; @@ -58,22 +56,13 @@ public class DdiStatusTest { ddiStatus.getResult().getProgress().getOf()); assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails()); } - - private static Stream 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 { // Setup final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," - + "\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}"; + + "\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}"; // Test final DdiStatus ddiStatus = mapper.readValue(serializedDdiStatus, DdiStatus.class); @@ -113,4 +102,13 @@ public class DdiStatusTest { assertThatExceptionOfType(MismatchedInputException.class).isThrownBy( () -> mapper.readValue(serializedDdiStatus, DdiStatus.class)); } + + private static Stream 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()))); + } } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/JsonIgnorePropertiesAnnotationTest.java b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/JsonIgnorePropertiesAnnotationTest.java index 9be307497..2aef1e68b 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/JsonIgnorePropertiesAnnotationTest.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/test/java/org/eclipse/hawkbit/ddi/json/model/JsonIgnorePropertiesAnnotationTest.java @@ -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