DDI resource - remove dupplicated annotations (#2057)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-17 17:04:56 +02:00
committed by GitHub
parent f9bb48d697
commit 08dc1b933d
3 changed files with 107 additions and 119 deletions

View File

@@ -84,9 +84,9 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts", @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts",
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts( ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId, @PathVariable("controllerId") String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId); @PathVariable("softwareModuleId") Long softwareModuleId);
/** /**
* Root resource for an individual {@link Target}. * Root resource for an individual {@link Target}.
@@ -123,8 +123,8 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}", @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}",
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiControllerBase> getControllerBase( ResponseEntity<DdiControllerBase> getControllerBase(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId); @PathVariable("controllerId") String controllerId);
/** /**
* Handles GET {@link DdiArtifact} download request. This could be full or * Handles GET {@link DdiArtifact} download request. This could be full or
@@ -160,10 +160,11 @@ public interface DdiRootControllerRestApi {
}) })
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING +
"/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}") "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant, ResponseEntity<InputStream> downloadArtifact(
@PathVariable("controllerId") final String controllerId, @PathVariable("tenant") String tenant,
@PathVariable("softwareModuleId") final Long softwareModuleId, @PathVariable("controllerId") String controllerId,
@PathVariable("fileName") final String fileName); @PathVariable("softwareModuleId") Long softwareModuleId,
@PathVariable("fileName") String fileName);
/** /**
* Handles GET {@link DdiArtifact} MD5 checksum file download request. * Handles GET {@link DdiArtifact} MD5 checksum file download request.
@@ -198,10 +199,10 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}" + @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}" +
DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE) DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
ResponseEntity<Void> downloadArtifactMd5( ResponseEntity<Void> downloadArtifactMd5(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId, @PathVariable("controllerId") String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId, @PathVariable("softwareModuleId") Long softwareModuleId,
@PathVariable("fileName") final String fileName); @PathVariable("fileName") String fileName);
/** /**
* Resource for software module. * Resource for software module.
@@ -260,17 +261,16 @@ public interface DdiRootControllerRestApi {
}) })
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}", @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 }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction(@PathVariable("tenant") final String tenant, ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction(
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("tenant") String tenant,
@PathVariable("actionId") @NotNull final Long actionId, @PathVariable("controllerId") @NotEmpty String controllerId,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "c", required = false, defaultValue = "-1") final int resource, @PathVariable("actionId") @NotNull Long actionId,
@RequestParam( @RequestParam(value = "c", required = false, defaultValue = "-1") int resource,
value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "actionHistory", @RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
@Schema(description = """ @Schema(description = """
(Optional) GET parameter to retrieve a given number of messages which are previously provided by the (Optional) GET parameter to retrieve a given number of messages which are previously provided by the
device. Useful if the devices sent state information to the feedback channel and never stored them device. Useful if the devices sent state information to the feedback channel and never stored them
locally.""") final Integer actionHistoryMessageCount); locally.""") Integer actionHistoryMessageCount);
/** /**
* This is the feedback channel for the {@link DdiDeploymentBase} action. * This is the feedback channel for the {@link DdiDeploymentBase} action.
@@ -316,9 +316,10 @@ public interface DdiRootControllerRestApi {
@PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION +
"/{actionId}/" + DdiRestConstants.FEEDBACK, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) "/{actionId}/" + DdiRestConstants.FEEDBACK, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> postDeploymentBaseActionFeedback( ResponseEntity<Void> postDeploymentBaseActionFeedback(
@Valid final DdiActionFeedback feedback, @Valid @RequestBody DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("tenant") String tenant,
@PathVariable("actionId") @NotNull final Long actionId); @PathVariable("controllerId") String controllerId,
@PathVariable("actionId") @NotNull Long actionId);
/** /**
* This is the feedback channel for the config data action. * This is the feedback channel for the config data action.
@@ -358,9 +359,9 @@ public interface DdiRootControllerRestApi {
@PutMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIG_DATA_ACTION, @PutMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIG_DATA_ACTION,
consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> putConfigData( ResponseEntity<Void> putConfigData(
@Valid final DdiConfigData configData, @Valid @RequestBody DdiConfigData configData,
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId); @PathVariable("controllerId") String controllerId);
/** /**
* RequestMethod.GET method for the {@link DdiCancel} action. * RequestMethod.GET method for the {@link DdiCancel} action.
@@ -393,9 +394,9 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}", @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 }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiCancel> getControllerCancelAction( ResponseEntity<DdiCancel> getControllerCancelAction(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("controllerId") @NotEmpty String controllerId,
@PathVariable("actionId") @NotNull final Long actionId); @PathVariable("actionId") @NotNull Long actionId);
/** /**
* RequestMethod.POST method receiving the {@link DdiActionFeedback} from the target. * RequestMethod.POST method receiving the {@link DdiActionFeedback} from the target.
@@ -436,10 +437,10 @@ public interface DdiRootControllerRestApi {
@PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/" + @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/" +
DdiRestConstants.FEEDBACK, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) DdiRestConstants.FEEDBACK, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> postCancelActionFeedback( ResponseEntity<Void> postCancelActionFeedback(
@Valid final DdiActionFeedback feedback, @Valid @RequestBody DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("controllerId") @NotEmpty String controllerId,
@PathVariable("actionId") @NotNull final Long actionId); @PathVariable("actionId") @NotNull Long actionId);
/** /**
* Resource for installed distribution set to retrieve the last successfully finished action. * Resource for installed distribution set to retrieve the last successfully finished action.
@@ -490,12 +491,10 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_BASE_ACTION + "/{actionId}", @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 }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiDeploymentBase> getControllerInstalledAction( ResponseEntity<DdiDeploymentBase> getControllerInstalledAction(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("controllerId") @NotEmpty String controllerId,
@PathVariable("actionId") @NotNull final Long actionId, @PathVariable("actionId") @NotNull Long actionId,
@RequestParam( @RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "actionHistory",
defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount);
/** /**
* Returns the confirmation base with the current auto-confirmation state for a given controllerId and toggle links. In case there are * Returns the confirmation base with the current auto-confirmation state for a given controllerId and toggle links. In case there are
@@ -534,8 +533,8 @@ public interface DdiRootControllerRestApi {
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE, @GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE,
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiConfirmationBase> getConfirmationBase( ResponseEntity<DdiConfirmationBase> getConfirmationBase(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId); @PathVariable("controllerId") @NotEmpty String controllerId);
/** /**
* Resource for confirmation of an action. * Resource for confirmation of an action.
@@ -584,13 +583,12 @@ public interface DdiRootControllerRestApi {
}) })
@GetMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/{actionId}", @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 }) produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<DdiConfirmationBaseAction> getConfirmationBaseAction(@PathVariable("tenant") final String tenant, ResponseEntity<DdiConfirmationBaseAction> getConfirmationBaseAction(
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("tenant") String tenant,
@PathVariable("actionId") @NotNull final Long actionId, @PathVariable("controllerId") @NotEmpty String controllerId,
@RequestParam(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "c", required = false, defaultValue = "-1") final int resource, @PathVariable("actionId") @NotNull Long actionId,
@RequestParam( @RequestParam(value = "c", required = false, defaultValue = "-1") int resource,
value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "actionHistory", @RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount);
/** /**
* This is the feedback channel for the {@link DdiConfirmationBaseAction} action. * This is the feedback channel for the {@link DdiConfirmationBaseAction} action.
@@ -637,10 +635,10 @@ public interface DdiRootControllerRestApi {
DdiRestConstants.FEEDBACK, DdiRestConstants.FEEDBACK,
consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> postConfirmationActionFeedback( ResponseEntity<Void> postConfirmationActionFeedback(
@Valid final DdiConfirmationFeedback feedback, @Valid @RequestBody DdiConfirmationFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId, @PathVariable("controllerId") String controllerId,
@PathVariable("actionId") @NotNull final Long actionId); @PathVariable("actionId") @NotNull Long actionId);
/** /**
* Activate auto confirmation for a given controllerId. Will use the provided initiator and remark field from the provided * Activate auto confirmation for a given controllerId. Will use the provided initiator and remark field from the provided
@@ -685,9 +683,9 @@ public interface DdiRootControllerRestApi {
@PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" + @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" +
DdiRestConstants.AUTO_CONFIRM_ACTIVATE, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) DdiRestConstants.AUTO_CONFIRM_ACTIVATE, consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> activateAutoConfirmation( ResponseEntity<Void> activateAutoConfirmation(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId, @PathVariable("controllerId") @NotEmpty String controllerId,
@Valid @RequestBody(required = false) final DdiActivateAutoConfirmation body); @Valid @RequestBody(required = false) DdiActivateAutoConfirmation body);
/** /**
* Deactivate auto confirmation for a given controller id. * Deactivate auto confirmation for a given controller id.
@@ -728,8 +726,8 @@ public interface DdiRootControllerRestApi {
@PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" + @PostMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" +
DdiRestConstants.AUTO_CONFIRM_DEACTIVATE) DdiRestConstants.AUTO_CONFIRM_DEACTIVATE)
ResponseEntity<Void> deactivateAutoConfirmation( ResponseEntity<Void> deactivateAutoConfirmation(
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId); @PathVariable("controllerId") @NotEmpty String controllerId);
/** /**
* Assign an already installed distribution for a target * Assign an already installed distribution for a target
@@ -773,7 +771,7 @@ public interface DdiRootControllerRestApi {
@PutMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_BASE_ACTION, @PutMapping(value = DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_BASE_ACTION,
consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR }) consumes = { MediaType.APPLICATION_JSON_VALUE, DdiRestConstants.MEDIA_TYPE_CBOR })
ResponseEntity<Void> setAssignedOfflineVersion( ResponseEntity<Void> setAssignedOfflineVersion(
@Valid DdiAssignedVersion ddiAssignedVersion, @Valid @RequestBody DdiAssignedVersion ddiAssignedVersion,
@PathVariable("tenant") final String tenant, @PathVariable("tenant") String tenant,
@PathVariable("controllerId") final String controllerId); @PathVariable("controllerId") String controllerId);
} }

View File

@@ -107,42 +107,31 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Autowired @Autowired
private ConfirmationManagement confirmationManagement; private ConfirmationManagement confirmationManagement;
@Autowired @Autowired
private ApplicationEventPublisher eventPublisher; private ApplicationEventPublisher eventPublisher;
@Autowired(required = false) @Autowired(required = false)
private ServiceMatcher serviceMatcher; private ServiceMatcher serviceMatcher;
@Autowired @Autowired
private BusProperties bus; private BusProperties bus;
@Autowired @Autowired
private ControllerManagement controllerManagement; private ControllerManagement controllerManagement;
@Autowired @Autowired
private ArtifactManagement artifactManagement; private ArtifactManagement artifactManagement;
@Autowired @Autowired
private HawkbitSecurityProperties securityProperties; private HawkbitSecurityProperties securityProperties;
@Autowired @Autowired
private TenantAware tenantAware; private TenantAware tenantAware;
@Autowired @Autowired
private SystemManagement systemManagement; private SystemManagement systemManagement;
@Autowired @Autowired
private ArtifactUrlHandler artifactUrlHandler; private ArtifactUrlHandler artifactUrlHandler;
@Autowired @Autowired
private EntityFactory entityFactory; private EntityFactory entityFactory;
@Override @Override
public ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts( public ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts(
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, final String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId) { final Long softwareModuleId) {
log.debug("getSoftwareModulesArtifacts({})", controllerId); log.debug("getSoftwareModulesArtifacts({})", controllerId);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -158,8 +147,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<DdiControllerBase> getControllerBase( public ResponseEntity<DdiControllerBase> getControllerBase(
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId) { final String controllerId) {
log.debug("getControllerBase({})", controllerId); log.debug("getControllerBase({})", controllerId);
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist(controllerId, IpUtil final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist(controllerId, IpUtil
@@ -179,10 +168,11 @@ public class DdiRootController implements DdiRootControllerRestApi {
} }
@Override @Override
public ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant, public ResponseEntity<InputStream> downloadArtifact(
@PathVariable("controllerId") final String controllerId, final String tenant,
@PathVariable("softwareModuleId") final Long softwareModuleId, final String controllerId,
@PathVariable("fileName") final String fileName) { final Long softwareModuleId,
final String fileName) {
final ResponseEntity<InputStream> result; final ResponseEntity<InputStream> result;
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -212,7 +202,6 @@ public class DdiRootController implements DdiRootControllerRestApi {
total) -> eventPublisher.publishEvent(new DownloadProgressEvent( total) -> eventPublisher.publishEvent(new DownloadProgressEvent(
tenantAware.getCurrentTenant(), statusId, shippedSinceLastEvent, tenantAware.getCurrentTenant(), statusId, shippedSinceLastEvent,
serviceMatcher != null ? serviceMatcher.getBusId() : bus.getId()))); serviceMatcher != null ? serviceMatcher.getBusId() : bus.getId())));
} }
} }
return result; return result;
@@ -253,11 +242,11 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction( public ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction(
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, final String controllerId,
@PathVariable("actionId") final Long actionId, final Long actionId,
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource, final int resource,
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount) { final Integer actionHistoryMessageCount) {
log.debug("getControllerDeploymentBaseAction({},{})", controllerId, resource); log.debug("getControllerDeploymentBaseAction({},{})", controllerId, resource);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -280,10 +269,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<Void> postDeploymentBaseActionFeedback( public ResponseEntity<Void> postDeploymentBaseActionFeedback(
@Valid @RequestBody final DdiActionFeedback feedback, final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, final String controllerId,
@PathVariable("actionId") @NotNull final Long actionId) { final Long actionId) {
log.debug("postDeploymentBaseActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback); log.debug("postDeploymentBaseActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -305,17 +294,18 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<Void> putConfigData( public ResponseEntity<Void> putConfigData(
@Valid @RequestBody final DdiConfigData configData, final DdiConfigData configData,
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId) { final String controllerId) {
controllerManagement.updateControllerAttributes(controllerId, configData.getData(), getUpdateMode(configData)); controllerManagement.updateControllerAttributes(controllerId, configData.getData(), getUpdateMode(configData));
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }
@Override @Override
public ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant") final String tenant, public ResponseEntity<DdiCancel> getControllerCancelAction(
@PathVariable("controllerId") @NotEmpty final String controllerId, final String tenant,
@PathVariable("actionId") @NotNull final Long actionId) { final String controllerId,
final Long actionId) {
log.debug("getControllerCancelAction({})", controllerId); log.debug("getControllerCancelAction({})", controllerId);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -336,10 +326,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<Void> postCancelActionFeedback( public ResponseEntity<Void> postCancelActionFeedback(
@Valid @RequestBody final DdiActionFeedback feedback, final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId, final String controllerId,
@PathVariable("actionId") @NotNull final Long actionId) { final Long actionId) {
log.debug("provideCancelActionFeedback for target [{}]: {}", controllerId, feedback); log.debug("provideCancelActionFeedback for target [{}]: {}", controllerId, feedback);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -352,9 +342,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<DdiDeploymentBase> getControllerInstalledAction( public ResponseEntity<DdiDeploymentBase> getControllerInstalledAction(
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, @PathVariable("actionId") final Long actionId, final String controllerId,
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount) { final Long actionId,
final Integer actionHistoryMessageCount) {
log.debug("getControllerInstalledAction({})", controllerId); log.debug("getControllerInstalledAction({})", controllerId);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -387,11 +378,11 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<DdiConfirmationBaseAction> getConfirmationBaseAction( public ResponseEntity<DdiConfirmationBaseAction> getConfirmationBaseAction(
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, final String controllerId,
@PathVariable("actionId") final Long actionId, final Long actionId,
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource, final int resource,
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) final Integer actionHistoryMessageCount) { final Integer actionHistoryMessageCount) {
log.debug("getConfirmationBaseAction({},{})", controllerId, resource); log.debug("getConfirmationBaseAction({},{})", controllerId, resource);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -411,10 +402,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<Void> postConfirmationActionFeedback( public ResponseEntity<Void> postConfirmationActionFeedback(
@Valid @RequestBody final DdiConfirmationFeedback feedback, final DdiConfirmationFeedback feedback,
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId, final String controllerId,
@PathVariable("actionId") @NotNull final Long actionId) { final Long actionId) {
log.debug("provideConfirmationActionFeedback with feedback [controllerId={}, actionId={}]: {}", controllerId, actionId, feedback); log.debug("provideConfirmationActionFeedback with feedback [controllerId={}, actionId={}]: {}", controllerId, actionId, feedback);
final Target target = findTarget(controllerId); final Target target = findTarget(controllerId);
@@ -467,9 +458,9 @@ public class DdiRootController implements DdiRootControllerRestApi {
@Override @Override
public ResponseEntity<Void> setAssignedOfflineVersion( public ResponseEntity<Void> setAssignedOfflineVersion(
@Valid @RequestBody DdiAssignedVersion ddiAssignedVersion, final DdiAssignedVersion ddiAssignedVersion,
@PathVariable("tenant") final String tenant, final String tenant,
@PathVariable("controllerId") final String controllerId) { final String controllerId) {
boolean updated = controllerManagement.updateOfflineAssignedVersion(controllerId, boolean updated = controllerManagement.updateOfflineAssignedVersion(controllerId,
ddiAssignedVersion.getName(), ddiAssignedVersion.getVersion()); ddiAssignedVersion.getName(), ddiAssignedVersion.getVersion());
if (updated) { if (updated) {

View File

@@ -349,8 +349,7 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isOk()); .andExpect(status().isOk());
// verify the initial parameters // verify the initial parameters
final Map<String, String> updatedAttributes = targetManagement final Map<String, String> updatedAttributes = targetManagement.getControllerAttributes(DdiConfigDataTest.TARGET1_ID);
.getControllerAttributes(DdiConfigDataTest.TARGET1_ID); assertThat(updatedAttributes).containsExactlyInAnyOrderEntriesOf(attributes);
assertThat(updatedAttributes).containsExactlyEntriesOf(attributes);
} }
} }