Search in sources :

Example 91 with Order

use of org.junit.jupiter.api.Order in project molgenis by molgenis.

the class EntityControllerIT method testUpdateResource.

@Test
@Order(8)
void testUpdateResource() throws IOException {
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("id", 25);
    jsonObject.put("label", "Row 25b");
    jsonObject.put("myBool", false);
    jsonObject.put("myDate", "2000-02-25");
    jsonObject.put("myDateTime", "2000-02-24T21:02:03Z");
    jsonObject.put("myDecimal", 250.1);
    jsonObject.put("myInt", 250);
    jsonObject.put("myLong", 3000000250L);
    jsonObject.put("myString", "String 25b");
    jsonObject.put("myText", "Text 25b");
    jsonObject.put("myXref", null);
    jsonObject.put("myMref", jsonArray);
    given().contentType(APPLICATION_JSON_VALUE).body(jsonObject.toJSONString()).put("/api/data/v3_MyDataset/25").then().statusCode(NO_CONTENT.value());
    String expectedJson = TestResourceUtils.getRenderedString(getClass(), "updateResource.json", ImmutableMap.of("baseUri", RestAssured.baseURI));
    given().get("/api/data/v3_MyDataset/25").then().statusCode(HttpStatus.OK.value()).body(isEqualJson(expectedJson));
}
Also used : JSONObject(net.minidev.json.JSONObject) JSONArray(net.minidev.json.JSONArray) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) AbstractApiTest(org.molgenis.api.tests.AbstractApiTest) Test(org.junit.jupiter.api.Test)

Example 92 with Order

use of org.junit.jupiter.api.Order in project molgenis by molgenis.

the class EntityControllerIT method testPartialUpdateResource.

@Test
@Order(9)
void testPartialUpdateResource() {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("myString", "String 25 - updated partially");
    given().contentType(APPLICATION_JSON_VALUE).body(jsonObject.toJSONString()).patch("/api/data/v3_MyDataset/25").then().statusCode(NO_CONTENT.value());
    given().get("/api/data/v3_MyDataset/25").then().statusCode(HttpStatus.OK.value()).body("data.myString", Matchers.equalTo("String 25 - updated partially"));
}
Also used : JSONObject(net.minidev.json.JSONObject) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) AbstractApiTest(org.molgenis.api.tests.AbstractApiTest) Test(org.junit.jupiter.api.Test)

Example 93 with Order

use of org.junit.jupiter.api.Order in project molgenis by molgenis.

the class RestControllerV2IT method batchDelete.

@Test
@Order(8)
void batchDelete() {
    JSONObject jsonObject = new JSONObject();
    JSONArray entityIds = new JSONArray();
    entityIds.add("55");
    entityIds.add("57");
    jsonObject.put("entityIds", entityIds);
    given(testUserToken).contentType(APPLICATION_JSON).body(jsonObject.toJSONString()).when().delete(API_V2 + "it_emx_datatypes_TypeTestv2").then().statusCode(NO_CONTENT);
}
Also used : JSONObject(net.minidev.json.JSONObject) JSONArray(net.minidev.json.JSONArray) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Example 94 with Order

use of org.junit.jupiter.api.Order in project molgenis by molgenis.

the class RestControllerV2IT method batchRetrieveEntityCollectionTemplateExpression.

@Test
@Order(2)
void batchRetrieveEntityCollectionTemplateExpression() {
    ValidatableResponse response = given(testUserToken).get(API_V2 + "it_emx_datatypes_TypeTestv2").then();
    response.statusCode(OKE);
    response.body("href", Matchers.equalTo("/api/v2/it_emx_datatypes_TypeTestv2"), "items[1]._href", Matchers.equalTo("/api/v2/it_emx_datatypes_TypeTestv2/2"), "items[1].xstring_template0", Matchers.equalTo("lorum str2 ipsum"), "items[1].xstring_template1", Matchers.equalTo("lorum label2 ipsum ref2"), "items[1].xstring_template2", Matchers.equalTo("lorum label2,label3 ipsum ref2,ref3"));
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Example 95 with Order

use of org.junit.jupiter.api.Order in project molgenis by molgenis.

the class RestControllerV2IT method batchCreateLocation.

@Test
@Order(4)
void batchCreateLocation() {
    JSONObject jsonObject = new JSONObject();
    JSONArray entities = new JSONArray();
    JSONObject entity = new JSONObject();
    entity.put("Chromosome", "42");
    entity.put("Position", 42);
    entities.add(entity);
    jsonObject.put("entities", entities);
    String expectedLocation = "/api/v2/it_emx_datatypes_Locationv2?q=Position=in=(\"42\")";
    String expectedHref = "/api/v2/it_emx_datatypes_Locationv2/42";
    given(testUserToken).contentType(APPLICATION_JSON).body(jsonObject.toJSONString()).when().post(API_V2 + "it_emx_datatypes_Locationv2").then().statusCode(RestTestUtils.CREATED).body("location", Matchers.equalTo(expectedLocation), "resources[0].href", Matchers.equalTo(expectedHref));
}
Also used : JSONObject(net.minidev.json.JSONObject) JSONArray(net.minidev.json.JSONArray) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Aggregations

Order (org.junit.jupiter.api.Order)194 Test (org.junit.jupiter.api.Test)184 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)179 lombok.val (lombok.val)67 WithMockUser (org.springframework.security.test.context.support.WithMockUser)31 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)30 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)24 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)24 Launch (io.quarkus.test.junit.main.Launch)23 Service (org.apereo.cas.authentication.principal.Service)23 CLIResult (org.keycloak.it.junit5.extension.CLIResult)23 DistributionTest (org.keycloak.it.junit5.extension.DistributionTest)23 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)21 Entity (org.molgenis.data.Entity)16 File (java.io.File)12 FileWriter (java.io.FileWriter)12 UnknownEntityTypeException (org.molgenis.data.UnknownEntityTypeException)11 EntityType (org.molgenis.data.meta.model.EntityType)11 JSONObject (net.minidev.json.JSONObject)9 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)9