List of usage examples for org.springframework.restdocs.payload PayloadDocumentation responseFields
public static ResponseFieldsSnippet responseFields(List<FieldDescriptor> descriptors)
From source file:io.pivotal.strepsirrhini.chaosloris.docs.DocumentationUtilities.java
static ResponseFieldsSnippet responseFields(FieldDescriptor... descriptors) { return PayloadDocumentation.responseFields(fieldWithPath("_links").ignored()).and(descriptors); }
From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTest.java
private void checkJobStatus(final int documentationId, final String id) { final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document( "{class-name}/" + documentationId + "/getJobStatus/", Snippets.ID_PATH_PARAM, // Path parameters Snippets.JSON_CONTENT_TYPE_HEADER, // Response Headers PayloadDocumentation.responseFields(PayloadDocumentation.fieldWithPath("status") .description("The job status. One of: " + Arrays.toString(JobStatus.values())) .attributes(Snippets.EMPTY_CONSTRAINTS)) // Response fields );// www.j a v a2 s. co m RestAssured.given(this.getRequestSpecification()).filter(getResultFilter).when().port(this.port) .get(JOBS_API + "/{id}/status", id).then() .contentType(Matchers.containsString(MediaType.APPLICATION_JSON_VALUE)) .body(STATUS_PATH, Matchers.is(JobStatus.SUCCEEDED.toString())); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getApplicationResponsePayload() { return PayloadDocumentation.responseFields(getApplicationFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getClusterResponsePayload() { return PayloadDocumentation.responseFields(getClusterFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getCommandResponsePayload() { return PayloadDocumentation.responseFields(getCommandFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTests.java
private void checkJobStatus(final int documentationId, final String id) throws Exception { final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/" + documentationId + "/getJobStatus/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // Path parameters Snippets.JSON_CONTENT_TYPE_HEADER, // Response Headers PayloadDocumentation.responseFields(PayloadDocumentation.fieldWithPath("status") .description("The job status. One of: " + Arrays.toString(JobStatus.values())) .attributes(Snippets.EMPTY_CONSTRAINTS)) // Response fields );// www . j a v a 2 s .co m this.mvc.perform(RestDocumentationRequestBuilders.get(JOBS_API + "/{id}/status", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.jsonPath(STATUS_PATH, Matchers.is(JobStatus.SUCCEEDED.toString()))) .andDo(getResultHandler); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getJobRequestResponsePayload() { return PayloadDocumentation.responseFields(getJobRequestFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getJobResponsePayload() { return PayloadDocumentation.responseFields(getJobFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.Snippets.java
static ResponseFieldsSnippet getJobExecutionResponsePayload() { return PayloadDocumentation.responseFields(getJobExecutionFieldDescriptors()) .and(PayloadDocumentation.fieldWithPath("_links").attributes(Attributes.key(CONSTRAINTS).value("")) .description("<<_hateoas,Links>> to other resources.").ignored()); }
From source file:com.netflix.genie.web.controllers.ClusterRestControllerIntegrationTests.java
/** * Test to make sure we can add configurations to the cluster after it is created. * * @throws Exception on configuration problems */// w w w . j a v a2 s.c om @Test public void canAddConfigsToCluster() throws Exception { Assert.assertThat(this.jpaClusterRepository.count(), Matchers.is(0L)); this.createConfigResource(new Cluster.Builder(NAME, USER, VERSION, ClusterStatus.UP).withId(ID).build(), null); final RestDocumentationResultHandler addResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // path params Snippets.CONTENT_TYPE_HEADER, // request header PayloadDocumentation.requestFields(Snippets.CONFIG_FIELDS) // response fields ); final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // path params Snippets.JSON_CONTENT_TYPE_HEADER, // response headers PayloadDocumentation.responseFields(Snippets.CONFIG_FIELDS) // response fields ); this.canAddElementsToResource(CLUSTERS_API + "/{id}/configs", ID, addResultHandler, getResultHandler); }