View Javadoc
1   package de.dlr.shepard.integrationtests;
2   
3   import static io.restassured.RestAssured.given;
4   
5   import de.dlr.shepard.auth.permission.io.PermissionsIO;
6   import de.dlr.shepard.common.util.Constants;
7   import de.dlr.shepard.context.collection.io.CollectionIO;
8   import io.quarkus.test.junit.QuarkusIntegrationTest;
9   import org.junit.jupiter.api.BeforeAll;
10  import org.junit.jupiter.api.Test;
11  
12  @QuarkusIntegrationTest
13  public class GracePeriodIT extends BaseTestCaseIT {
14  
15    private static CollectionIO collection;
16    private static String collectionsURL;
17    private static String permissionsURL;
18  
19    @BeforeAll
20    public static void setUp() {
21      collection = createCollection("PermissionsTestCollection");
22      collectionsURL = "/" + Constants.COLLECTIONS;
23      permissionsURL = String.format("/%s/%d/%s", Constants.COLLECTIONS, collection.getId(), Constants.PERMISSIONS);
24    }
25  
26    @Test
27    public void retrieve() {
28      given().spec(requestSpecOfDefaultUser).when().get(collectionsURL + "/" + collection.getId()).then().statusCode(200);
29  
30      var permissionsLockingOutUser = new PermissionsIO() {
31        {
32          setReader(new String[] {});
33          setWriter(new String[] {});
34          setManager(new String[] {});
35        }
36      };
37  
38      given()
39        .spec(requestSpecOfDefaultUser)
40        .body(permissionsLockingOutUser)
41        .when()
42        .put(permissionsURL)
43        .then()
44        .statusCode(200)
45        .extract()
46        .as(PermissionsIO.class);
47  
48      given().spec(requestSpecOfDefaultUser).when().get(collectionsURL + "/" + collection.getId()).then().statusCode(200);
49    }
50  }