Spring Boot 2.0 (#721)

* Migration to Boot 2.0.

Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
This commit is contained in:
Kai Zimmermann
2019-01-31 07:29:27 +01:00
committed by GitHub
parent b42b009f9e
commit d52a720480
263 changed files with 2874 additions and 2692 deletions

View File

@@ -34,6 +34,7 @@ public class DdiChunk {
private String name;
@JsonProperty("artifacts")
@JsonInclude(JsonInclude.Include.NON_NULL)
private List<DdiArtifact> artifacts;
@JsonProperty("metadata")

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.NotNull;
import org.springframework.hateoas.ResourceSupport;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -25,11 +24,11 @@ public class DdiDeploymentBase extends ResourceSupport {
@JsonProperty("id")
@NotNull
private final String deplyomentId;
private String id;
@JsonProperty("deployment")
@NotNull
private final DdiDeployment deployment;
private DdiDeployment deployment;
/**
* Action history containing current action status and a list of feedback
@@ -37,7 +36,14 @@ public class DdiDeploymentBase extends ResourceSupport {
*/
@JsonProperty("actionHistory")
@JsonInclude(JsonInclude.Include.NON_NULL)
private final DdiActionHistory actionHistory;
private DdiActionHistory actionHistory;
/**
* Constructor.
*/
public DdiDeploymentBase() {
// needed for json create.
}
/**
* Constructor.
@@ -50,11 +56,8 @@ public class DdiDeploymentBase extends ResourceSupport {
* containing current action status and a list of feedback
* messages received earlier from the controller.
*/
@JsonCreator
public DdiDeploymentBase(@JsonProperty("id") final String id,
@JsonProperty("deplyomentId") final DdiDeployment deployment,
@JsonProperty("actionHistory") final DdiActionHistory actionHistory) {
this.deplyomentId = id;
public DdiDeploymentBase(final String id, final DdiDeployment deployment, final DdiActionHistory actionHistory) {
this.id = id;
this.deployment = deployment;
this.actionHistory = actionHistory;
}
@@ -75,8 +78,7 @@ public class DdiDeploymentBase extends ResourceSupport {
@Override
public String toString() {
return "DeploymentBase [id=" + deplyomentId + ", deployment=" + deployment + " actionHistory="
+ actionHistory + "]";
return "DeploymentBase [id=" + id + ", deployment=" + deployment + " actionHistory=" + actionHistory + "]";
}
}

View File

@@ -25,9 +25,11 @@ import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
@@ -47,7 +49,7 @@ public interface DdiRootControllerRestApi {
* of the software module
* @return the response
*/
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts", produces = {
@GetMapping(value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts", produces = {
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") final String controllerId,
@@ -64,8 +66,7 @@ public interface DdiRootControllerRestApi {
* the HTTP request injected by spring
* @return the response
*/
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}", produces = { MediaTypes.HAL_JSON_VALUE,
MediaType.APPLICATION_JSON_VALUE })
@GetMapping(value = "/{controllerId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") final String controllerId);
@@ -90,7 +91,7 @@ public interface DdiRootControllerRestApi {
* {@link HttpStatus#OK} or in case of partial download
* {@link HttpStatus#PARTIAL_CONTENT}.
*/
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
@GetMapping(value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") final String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId,
@@ -115,7 +116,7 @@ public interface DdiRootControllerRestApi {
* @return {@link ResponseEntity} with status {@link HttpStatus#OK} if
* successful
*/
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
@GetMapping(value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
+ DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
ResponseEntity<Void> downloadArtifactMd5(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") final String controllerId,
@@ -151,9 +152,8 @@ public interface DdiRootControllerRestApi {
* the HTTP request injected by spring
* @return the response
*/
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION
+ "/{actionId}", method = RequestMethod.GET, produces = { MediaTypes.HAL_JSON_VALUE,
MediaType.APPLICATION_JSON_VALUE })
@GetMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}", produces = {
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId,
@@ -176,8 +176,8 @@ public interface DdiRootControllerRestApi {
*
* @return the response
*/
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId);
@@ -196,8 +196,8 @@ public interface DdiRootControllerRestApi {
*
* @return status of the request
*/
@RequestMapping(value = "/{controllerId}/"
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@PutMapping(value = "/{controllerId}/"
+ DdiRestConstants.CONFIG_DATA_ACTION, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> putConfigData(@Valid final DdiConfigData configData,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId);
@@ -215,9 +215,8 @@ public interface DdiRootControllerRestApi {
*
* @return the {@link DdiCancel} response
*/
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION
+ "/{actionId}", method = RequestMethod.GET, produces = { MediaTypes.HAL_JSON_VALUE,
MediaType.APPLICATION_JSON_VALUE })
@GetMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}", produces = {
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId);
@@ -240,8 +239,8 @@ public interface DdiRootControllerRestApi {
* @return the {@link DdiActionFeedback} response
*/
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> postCancelActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId,