[MGNLCE-79] Create integration tests for the rest services Created: 26/Nov/13  Updated: 10/Apr/17  Resolved: 07/Apr/17

Status: Closed
Project: Community Edition
Component/s: None
Affects Version/s: None
Fix Version/s: 5.5.4

Type: Task Priority: Major
Reporter: Daniel Lipp Assignee: Philip Mundt
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MagnoliaRestClient.java    
Issue Links:
Relates
relates to MGNLREST-83 JSON output suddenly changed without ... Closed
dependency
depends upon MAGNOLIA-5536 Update test container to Jetty 9 Closed
is depended upon by MAGNOLIA-6270 Use rest for integration tests of Cac... Accepted
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Epic Link: Improve QA setup
Sprint: Basel 89, Basel 90
Story Points: 8

 Description   

While the rest services have a good unit-test coverage we don't have any integration test that would verify it actually works as a whole.
Those tests should go to magnolia-bundle-parent/magnolia-integration-tests/tests - preferably implemented as java JUnit tests e.g. in info.magnolia.integrationtests.rest, not as groovy scripts.

Note: when being tackled, this ticket might have to be moved to MAGNOLIA in JIRA



 Comments   
Comment by Philip Mundt [ 10/Dec/13 ]

Currently, the rest module won't work in our test environment because of jetty 6 return wrong/multiple Content-Types.
Jetty should be updated: MAGNOLIA-5536

Comment by Tobias Mattsson [ 13/Jan/14 ]

Attaching MagnoliaRestClient.java, a simple client for using the REST API. It supports Basic HTTP authentication. Might be useful for integration tests.

Its created and configured like this:

restClient = new MagnoliaRestClient();
restClient.setHostname("localhost");
restClient.setPort(8080);
restClient.setUsername("superuser");
restClient.setPassword("superuser");
restClient.setServiceBasePath("");

and then used like this:

    if (restClient.nodeExists("website", "/test")) {
        restClient.deleteNode("website", "/test");
    }

    RepositoryNode node = new RepositoryNode();
    node.setName("test");
    node.setType("mgnl:page");
    restClient.createNode("website", "/", node);

    node.getProperties().add(createProperty("title", "Changed title"));
    restClient.updateNode("website", "/test", node);
Comment by Michael Mühlebach [ 10/Mar/17 ]

As seen with MGNLREST-83 testing the correct output of JSON and XML has to be part of the tests as well. Only working with rest client wouldn't have detected this issue as rest client would have read the incorrect format correctly as the transformation error would have occurred in both directions rest --> JSON --> rest cl.

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