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));
}
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"));
}
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);
}
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"));
}
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));
}
Aggregations