List of usage examples for org.springframework.restdocs.payload PayloadDocumentation fieldWithPath
public static FieldDescriptor fieldWithPath(String path)
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 );// w ww .j a v a2s. c o 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 );//from w ww. j a va2 s . c o 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.Snippets.java
private static FieldDescriptor[] getApplicationFieldDescriptors() { return ArrayUtils.addAll(getConfigFieldDescriptors(APPLICATION_CONSTRAINTS), PayloadDocumentation .fieldWithPath("type").attributes(getConstraintsForField(APPLICATION_CONSTRAINTS, "type")) .description("The type of application this is (e.g. hadoop, presto, spark). Can be used to group.") .optional(),/*from ww w. ja va 2 s. c om*/ PayloadDocumentation.fieldWithPath("status") .attributes(getConstraintsForField(APPLICATION_CONSTRAINTS, "status")) .description("The status of the application. Options: " + Arrays.toString(ApplicationStatus.values())), PayloadDocumentation.fieldWithPath("dependencies") .attributes(getConstraintsForField(APPLICATION_CONSTRAINTS, "dependencies")) .description("The dependencies for the application").optional()); }
From source file:com.netflix.genie.web.controllers.Snippets.java
private static FieldDescriptor[] getClusterFieldDescriptors() { return ArrayUtils.addAll(getConfigFieldDescriptors(CLUSTER_CONSTRAINTS), PayloadDocumentation.fieldWithPath("status") .attributes(getConstraintsForField(CLUSTER_CONSTRAINTS, "status")).description( "The status of the cluster. Options: " + Arrays.toString(ClusterStatus.values()))); }