@InSequence(23) public void testApplicationMeterUnitPrometheus() { given().header("Accept", TEXT_PLAIN).when().get("/metrics/application/meterMeA") .then().statusCode(200) .and() .body(containsString("meter_me_a_total")) .body(containsString("meter_me_a_rate_per_second")) .body(containsString("meter_me_a_one_min_rate_per_second")) .body(containsString("meter_me_a_five_min_rate_per_second")) .body(containsString("meter_me_a_fifteen_min_rate_per_second")); }
@Test @RunAsClient @InSequence(4) public void testSharedCounterAgain() { Header acceptJson = new Header("Accept", APPLICATION_JSON); given().header(acceptJson).get("/metrics/application").then() .assertThat().body("countMe2", equalTo(2)) .assertThat().body("'org.eclipse.microprofile.metrics.test.MetricAppBean2.meterMe2'.count", equalTo(2)) .assertThat().body("timeMe2.count", equalTo(2)); }
@Test @RunAsClient @InSequence(6) public void testReusedHistogram() { Header acceptJson = new Header("Accept", APPLICATION_JSON); given().header(acceptJson).get("/metrics/application").then() .assertThat().body("reusableHisto.count", equalTo(2)) .assertThat().body("reusableHisto.min", equalTo(1)) .assertThat().body("reusableHisto.max", equalTo(3)); }
@Test public void failChild() throws Exception { String expected = jsonParser.getJson("/ResourceIT/failChild.json"); given().when().get("/parent/1/unknown").then().statusCode(HttpStatus.SC_NOT_FOUND) .body(equalTo(expected)); }
@Test public void failRootCollection() throws Exception { String expected = jsonParser.getJson("/ResourceIT/failRootCollection.json"); given().when().get("/unknown").then().statusCode(HttpStatus.SC_NOT_FOUND) .body(equalTo(expected)); }
@Test public void testChild() throws Exception { String expected = jsonParser.getJson("/ResourceIT/testChild.json"); given().when().get("/parent/1/children/1").then().statusCode(HttpStatus.SC_OK) .body(equalTo(expected)); }
@Test public void failFieldRequest() throws Exception { String expected = jsonParser.getJson("/ResourceIT/failFieldRequest.json"); given().when().get("/parent/1/id").then().statusCode(HttpStatus.SC_NOT_FOUND) .body(equalTo(expected)); }
@Test void testEmbedded() { String expected = jsonParser.getJson("/EmbeddedIT/testEmbedded.json"); given().when().get("/embedded/1").then().statusCode(HttpStatus.SC_OK).body(equalTo(expected)); }
@Test public void testRootCollectionRelationships() { String expected = jsonParser.getJson("/ResourceIT/testRootCollectionRelationships.json"); given() .when().get("/parent/1/relationships/children").then().statusCode(HttpStatus.SC_OK) .body(equalTo(expected)); }
@Test public void testSubCollectionRelationships() throws Exception { String expected = jsonParser.getJson("/ResourceIT/testSubCollectionRelationships.json"); given().when().get("/parent/1/children/1/relationships/parents").then().statusCode(HttpStatus.SC_OK) .body(equalTo(expected)); }
@Test public void failRootCollectionId() { String expected = jsonParser.getJson("/ResourceIT/failRootCollectionId.json"); given().when().get("/parent/6789").then().statusCode(HttpStatus.SC_NOT_FOUND) .body(equalTo(expected)); }
@Test public void parseFailure() { String expected = jsonParser.getJson("/ResourceIT/parseFailure.json"); given().when().get("company/1|apps/2/links/foo").then().statusCode(HttpStatus.SC_NOT_FOUND) .body(equalTo(expected)); }
@Test @RunAsClient @InSequence(5) public void testBase() { given().header("Accept", APPLICATION_JSON).when().get("/metrics/base").then().statusCode(200).and() .contentType(MpMetricTest.APPLICATION_JSON).and().body(containsString("thread.max.count")); }
@Test(priority = 8) public void testGetRelEmptyColl() { String expected = jsonParser.getJson("/ResourceIT/testGetRelEmptyColl.json"); given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get("/parent/4/relationships/children") .then() .statusCode(HttpStatus.SC_OK) .body(equalTo(expected)); }
@Test(priority = 39) public void testPatchExtNoCommit() { String req = jsonParser.getJson("/ResourceIT/testPatchExtNoCommit.req.json"); given() .contentType(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .accept(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .body(req) .patch("/") .then() .statusCode(HttpStatus.SC_FORBIDDEN) .body(equalTo("{\"errors\":[\"ForbiddenAccessException\"]}")); }
@Test(priority = 11) public void testDeleteParent() { given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .delete("/parent/1") .then() .statusCode(HttpStatus.SC_NO_CONTENT) .body(isEmptyOrNullString()); }
@Test(priority = 11) public void testDeleteWithCascade() { given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .delete("/invoice/1") .then() .statusCode(HttpStatus.SC_NO_CONTENT) .body(isEmptyOrNullString()); }
@Test(priority = 14) public void createChildRelateExisting() { String request = jsonParser.getJson("/ResourceIT/createChildRelateExisting.req.json"); String expected = jsonParser.getJson("/ResourceIT/createChildRelateExisting.json"); given() .contentType(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .accept(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .body(request) .patch("/") .then() .statusCode(HttpStatus.SC_OK) .body(equalTo(expected)); }
@Test(priority = 26) public void patchExtBadId() { String request = jsonParser.getJson("/ResourceIT/patchExtBadId.req.json"); String expected = jsonParser.getJson("/ResourceIT/patchExtBadId.json"); given() .contentType(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .accept(JSONAPI_CONTENT_TYPE_WITH_JSON_PATCH_EXTENSION) .body(request) .patch("/") .then() .statusCode(HttpStatus.SC_BAD_REQUEST) .body(equalTo(expected)); }
@Test(priority = 2) public void testPatchAttrNoUpdateSingle() { String request = jsonParser.getJson("/ResourceIT/testPatchAttrNoUpdateSingle.json"); given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(request) .patch("/parent/2") .then() .statusCode(HttpStatus.SC_NO_CONTENT) .body(isEmptyOrNullString()); }