Code format hawkbit ddi api (#1940)

* Code format hawkbit-repository

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

* Code format hawkbit-ddi-api

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

---------

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

View File

@@ -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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(

View File

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

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -20,9 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import jakarta.validation.constraints.NotNull;
import java.util.Objects;
/**
* Update action resource.
*/
@@ -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<DdiConfirmationBaseAction> {
@JsonProperty("id")
@@ -230,10 +229,10 @@ public class DdiConfirmationBaseAction extends RepresentationModel<DdiConfirmati
* @param id of the update action
* @param confirmation chunk details
* @param actionHistory containing current action status and a list of feedback messages
* received earlier from the controller.
* received earlier from the controller.
*/
public DdiConfirmationBaseAction(final String id, final DdiDeployment confirmation,
final DdiActionHistory actionHistory) {
final DdiActionHistory actionHistory) {
this.id = id;
this.confirmation = confirmation;
this.actionHistory = actionHistory;

View File

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

View File

@@ -9,6 +9,10 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -16,11 +20,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.hateoas.RepresentationModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* {@link DdiControllerBase} resource content.
*/
@@ -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<DdiControllerBase> {
@JsonProperty
@@ -63,8 +62,7 @@ public class DdiControllerBase extends RepresentationModel<DdiControllerBase> {
/**
* Constructor.
*
* @param config
* configuration of the SP target
* @param config configuration of the SP target
*/
public DdiControllerBase(final DdiConfig config) {
this.config = config;

View File

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

View File

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

View File

@@ -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;
}

View File

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

View File

@@ -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) {

View File

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

View File

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

View File

@@ -15,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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,14 +19,12 @@ import java.io.IOException;
import java.util.Collections;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@@ -58,22 +56,13 @@ public class DdiStatusTest {
ddiStatus.getResult().getProgress().getOf());
assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails());
}
private static Stream<Arguments> ddiStatusPossibilities(){
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
return Stream.of(
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.emptyList())),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.singletonList("testMessage"))),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, 12, Collections.emptyList())));
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
public void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// 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<Arguments> ddiStatusPossibilities() {
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
return Stream.of(
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.emptyList())),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, null, Collections.singletonList("testMessage"))),
Arguments.of(ddiResult, new DdiStatus(PROCEEDING, ddiResult, 12, Collections.emptyList())));
}
}

View File

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