[MGNLREST-323] Provide a standard ImportEndpoint for bootstrapping content Created: 09/Aug/21  Updated: 03/Jan/22  Resolved: 10/Nov/21

Status: Closed
Project: Magnolia REST Framework
Component/s: services
Affects Version/s: None
Fix Version/s: 2.2.10, 3.0.0

Type: New Feature Priority: Neutral
Reporter: Mikaël Geljić Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: testing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MGNLREST-335 Provide ITs or tests for the ImportEn... Closed
Relates
relates to MGNLTEST-166 Fixtures should not use testcommands ... Closed
relates to MGNLTEST-163 Make configurable list of test instances Closed
dependency
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Epic Link: SaaS ITs
Sprint: Cloud Service 16, Cloud Service 17, SaaS 18, SaaS 19, SaaS 21
Story Points: 8

 Description   

As of M6.2.11, bootstrapping test fixtures (and light-module fixtures) for integration-tests goes through the testcommands endpoint.

This forces us to build separate runtime images of the product in order to use the test-framework and these facilities. Instead, we're looking towards running tests on vanilla product images. Therefore we aim to support bootstrapping content via REST, in the product itself.

Proposed flow

A dedicated ImportEndpoint at /.rest/import/v1, accepting multipart/form-data— suitable for uploading files as attachments (parts)—and a target path query-parameter.
Target workspace is conventionally inferred from the uploaded bootstrap-file name, e.g. contacts.some-folder.mmonroe.xml.

  • The invoked command is still the standard JcrImportCommand (src); it accepts a "stream" parameter.
  • MgnlCommand#execute takes care of overlaying command parameters onto the command itself via BeanUtils, hence setting the "stream" param here.

The endpoint is expected to answer with No Content (204) if successful.

Current flow this replaces

The testcommands endpoint is a forked implementation of the standard rest-services CommandEndpoint.

Bootstrap files (actual test files) are base64 encoded by the test-framework. Then the test CommandEndpoint parses query parameters, searches for one named "input", decodes it back as a plain String, and pushes the base64-decoded result as a "stream" entry into the command parameter map.


Generated at Mon Feb 12 06:58:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.