List of usage examples for org.springframework.restdocs.mockmvc RestDocumentationRequestBuilders get
public static MockHttpServletRequestBuilder get(String urlTemplate, Object... urlVariables)
From source file:com.netflix.genie.web.controllers.ClusterRestControllerIntegrationTests.java
/** * Test creating a cluster without an ID. * * @throws Exception on configuration issue *//*w ww .ja v a2 s . c o m*/ @Test public void canCreateClusterWithoutId() throws Exception { Assert.assertThat(this.jpaClusterRepository.count(), Matchers.is(0L)); final RestDocumentationResultHandler creationResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.CONTENT_TYPE_HEADER, // Request headers Snippets.getClusterRequestPayload(), // Request fields Snippets.LOCATION_HEADER // Response headers ); final String id = this.createConfigResource( new Cluster.Builder(NAME, USER, VERSION, ClusterStatus.UP).build(), creationResultHandler); final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // response headers Snippets.getClusterResponsePayload(), // response payload Snippets.CLUSTER_LINKS // response links ); this.mvc.perform(RestDocumentationRequestBuilders.get(CLUSTERS_API + "/{id}", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(NAME))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(USER))) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(VERSION))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.id:" + id))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.name:" + NAME))) .andExpect(MockMvcResultMatchers.jsonPath(SETUP_FILE_PATH, Matchers.nullValue())) .andExpect(MockMvcResultMatchers.jsonPath(STATUS_PATH, Matchers.is(ClusterStatus.UP.toString()))) .andExpect(MockMvcResultMatchers.jsonPath(CONFIGS_PATH, Matchers.hasSize(0))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH, Matchers.hasSize(0))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH + ".*", Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(SELF_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(COMMANDS_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(CLUSTER_COMMANDS_LINK_PATH, EntityLinkMatcher .matchUri(CLUSTERS_API, COMMANDS_LINK_KEY, COMMANDS_OPTIONAL_HAL_LINK_PARAMETERS, id))) .andDo(getResultHandler); Assert.assertThat(this.jpaClusterRepository.count(), Matchers.is(1L)); }
From source file:com.netflix.genie.web.controllers.ApplicationRestControllerIntegrationTests.java
/** * Test creating an application without an ID. * * @throws Exception on configuration issue *//*from w w w .j a v a2 s. c om*/ @Test public void canCreateApplicationWithoutId() throws Exception { Assert.assertThat(this.jpaApplicationRepository.count(), Matchers.is(0L)); final RestDocumentationResultHandler creationResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.CONTENT_TYPE_HEADER, // Request headers Snippets.getApplicationRequestPayload(), // Request fields Snippets.LOCATION_HEADER // Response headers ); final String id = this .createConfigResource( new Application.Builder(NAME, USER, VERSION, ApplicationStatus.ACTIVE).withType(TYPE) .withDependencies( Sets.newHashSet("s3://mybucket/spark/" + VERSION + "/spark.tar.gz")) .withSetupFile("s3://mybucket/spark/" + VERSION + "/setup-spark.sh") .withConfigs(Sets.newHashSet("s3://mybucket/spark/" + VERSION + "/spark-env.sh")) .withDescription("Spark for Genie") .withTags(Sets.newHashSet("type:" + TYPE, "ver:" + VERSION)).build(), creationResultHandler); final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // response headers Snippets.getApplicationResponsePayload(), // response payload Snippets.APPLICATION_LINKS // response links ); this.mvc.perform(RestDocumentationRequestBuilders.get(APPLICATIONS_API + "/{id}", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(NAME))) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(VERSION))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(USER))) .andExpect(MockMvcResultMatchers.jsonPath(DESCRIPTION_PATH, Matchers.is("Spark for Genie"))) .andExpect(MockMvcResultMatchers.jsonPath(SETUP_FILE_PATH, Matchers.is("s3://mybucket/spark/" + VERSION + "/setup-spark.sh"))) .andExpect(MockMvcResultMatchers.jsonPath(CONFIGS_PATH, Matchers.hasItem("s3://mybucket/spark/" + VERSION + "/spark-env.sh"))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasSize(4))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.id:" + id))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.name:" + NAME))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("ver:" + VERSION))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("type:" + TYPE))) .andExpect(MockMvcResultMatchers.jsonPath(STATUS_PATH, Matchers.is(ApplicationStatus.ACTIVE.toString()))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH, Matchers.hasItem("s3://mybucket/spark/" + VERSION + "/spark.tar.gz"))) .andExpect(MockMvcResultMatchers.jsonPath(TYPE_PATH, Matchers.is(TYPE))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH + ".*", Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(SELF_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(COMMANDS_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(APPLICATION_COMMANDS_LINK_PATH, EntityLinkMatcher .matchUri(APPLICATIONS_API, COMMANDS_LINK_KEY, COMMANDS_OPTIONAL_HAL_LINK_PARAMETERS, id))) .andDo(getResultHandler); Assert.assertThat(this.jpaApplicationRepository.count(), Matchers.is(1L)); }
From source file:com.netflix.genie.web.controllers.CommandRestControllerIntegrationTests.java
/** * Test creating a command without an ID. * * @throws Exception on configuration issue */// w w w . jav a2s .c om @Test public void canCreateCommandWithoutId() throws Exception { Assert.assertThat(this.jpaCommandRepository.count(), Matchers.is(0L)); final RestDocumentationResultHandler creationResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.CONTENT_TYPE_HEADER, // Request headers Snippets.getCommandRequestPayload(), // Request fields Snippets.LOCATION_HEADER // Response headers ); final String id = this.createConfigResource( new Command.Builder(NAME, USER, VERSION, CommandStatus.ACTIVE, EXECUTABLE, CHECK_DELAY) .withDescription(DESCRIPTION).withMemory(MEMORY).withConfigs(CONFIGS) .withDependencies(DEPENDENCIES).withTags(TAGS).build(), creationResultHandler); final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/{method-name}/{step}/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // response headers Snippets.getCommandResponsePayload(), // response payload Snippets.COMMAND_LINKS // response links ); this.mvc.perform(RestDocumentationRequestBuilders.get(COMMANDS_API + "/{id}", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(NAME))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(USER))) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(VERSION))) .andExpect( MockMvcResultMatchers.jsonPath(STATUS_PATH, Matchers.is(CommandStatus.ACTIVE.toString()))) .andExpect(MockMvcResultMatchers.jsonPath(EXECUTABLE_PATH, Matchers.is(EXECUTABLE))) .andExpect(MockMvcResultMatchers.jsonPath(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY))) .andExpect(MockMvcResultMatchers.jsonPath(DESCRIPTION_PATH, Matchers.is(DESCRIPTION))) .andExpect(MockMvcResultMatchers.jsonPath(MEMORY_PATH, Matchers.is(MEMORY))) .andExpect(MockMvcResultMatchers.jsonPath(CONFIGS_PATH, Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath(CONFIGS_PATH, Matchers.hasItems(CONFIG_1, CONFIG_2))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH, Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH, Matchers.hasItems(DEP_1, DEP_2))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasSize(4))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.id:" + id))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItem("genie.name:" + NAME))) .andExpect(MockMvcResultMatchers.jsonPath(TAGS_PATH, Matchers.hasItems(TAG_1, TAG_2))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH + ".*", Matchers.hasSize(3))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(SELF_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(CLUSTERS_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(APPLICATIONS_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_CLUSTERS_LINK_PATH, EntityLinkMatcher.matchUri(COMMANDS_API, CLUSTERS_LINK_KEY, CLUSTERS_OPTIONAL_HAL_LINK_PARAMETERS, id))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_APPS_LINK_PATH, EntityLinkMatcher.matchUri(COMMANDS_API, APPLICATIONS_LINK_KEY, null, id))) .andDo(getResultHandler); Assert.assertThat(this.jpaCommandRepository.count(), Matchers.is(1L)); }
From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTests.java
private void checkJob(final int documentationId, final String id, final String commandArgs) throws Exception { final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/" + documentationId + "/getJob/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // Path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // Response Headers Snippets.getJobResponsePayload(), // Response fields Snippets.JOB_LINKS // Links );// w w w.j a v a 2 s . co m this.mvc.perform(RestDocumentationRequestBuilders.get(JOBS_API + "/{id}", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(JOB_VERSION))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(JOB_USER))) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(JOB_NAME))) .andExpect(MockMvcResultMatchers.jsonPath(DESCRIPTION_PATH, Matchers.is(JOB_DESCRIPTION))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_ARGS_PATH, Matchers.is(commandArgs))) .andExpect(MockMvcResultMatchers.jsonPath(STATUS_PATH, Matchers.is(JobStatus.SUCCEEDED.toString()))) .andExpect(MockMvcResultMatchers.jsonPath(STATUS_MESSAGE_PATH, Matchers.is(JOB_STATUS_MSG))) .andExpect(MockMvcResultMatchers.jsonPath(STARTED_PATH, Matchers.not(new Date(0)))) .andExpect(MockMvcResultMatchers.jsonPath(FINISHED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(ARCHIVE_LOCATION_PATH, Matchers.isEmptyOrNullString())) .andExpect(MockMvcResultMatchers.jsonPath(CLUSTER_NAME_PATH, Matchers.is(CLUSTER1_NAME))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_NAME_PATH, Matchers.is(CMD1_NAME))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH + ".*", Matchers.hasSize(8))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey(SELF_LINK_KEY))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("request"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("execution"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("output"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("status"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("cluster"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("command"))) .andExpect(MockMvcResultMatchers.jsonPath(LINKS_PATH, Matchers.hasKey("applications"))) .andDo(getResultHandler); }
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 w w . j a v a2s .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.JobRestControllerIntegrationTests.java
private void checkJobRequest(final int documentationId, final String id, final String commandArgs, final String setupFile, final String clusterTag, final String commandTag, final String depFile1) throws Exception { final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/" + documentationId + "/getJobRequest/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // Path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // Response Headers Snippets.getJobRequestResponsePayload(), // Response fields Snippets.JOB_REQUEST_LINKS // Links );/*from w ww. ja va 2 s .c o m*/ this.mvc.perform(RestDocumentationRequestBuilders.get(JOBS_API + "/{id}/request", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(JOB_NAME))) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(JOB_VERSION))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(JOB_USER))) .andExpect(MockMvcResultMatchers.jsonPath(DESCRIPTION_PATH, Matchers.is(JOB_DESCRIPTION))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_ARGS_PATH, Matchers.is(commandArgs))) .andExpect(MockMvcResultMatchers.jsonPath(SETUP_FILE_PATH, Matchers.is(setupFile))) .andExpect(MockMvcResultMatchers.jsonPath(CLUSTER_CRITERIAS_PATH, Matchers.hasSize(1))) .andExpect(MockMvcResultMatchers.jsonPath(CLUSTER_CRITERIAS_PATH + "[0].tags", Matchers.hasSize(1))) .andExpect(MockMvcResultMatchers.jsonPath(CLUSTER_CRITERIAS_PATH + "[0].tags[0]", Matchers.is(clusterTag))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_CRITERIA_PATH, Matchers.hasSize(1))) .andExpect(MockMvcResultMatchers.jsonPath(COMMAND_CRITERIA_PATH + "[0]", Matchers.is(commandTag))) .andExpect(MockMvcResultMatchers.jsonPath(GROUP_PATH, Matchers.nullValue())) .andExpect(MockMvcResultMatchers.jsonPath(DISABLE_LOG_ARCHIVAL_PATH, Matchers.is(true))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH, Matchers.hasSize(1))) .andExpect(MockMvcResultMatchers.jsonPath(DEPENDENCIES_PATH + "[0]", Matchers.is(depFile1))) .andExpect(MockMvcResultMatchers.jsonPath(EMAIL_PATH, Matchers.nullValue())) .andExpect(MockMvcResultMatchers.jsonPath(CPU_PATH, Matchers.nullValue())) .andExpect(MockMvcResultMatchers.jsonPath(MEMORY_PATH, Matchers.nullValue())) .andExpect(MockMvcResultMatchers.jsonPath(APPLICATIONS_PATH, Matchers.empty())) .andDo(getResultHandler); }
From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTests.java
private void checkJobExecution(final int documentationId, final String id) throws Exception { final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/" + documentationId + "/getJobExecution/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // Path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // Response Headers Snippets.getJobExecutionResponsePayload(), // Response fields Snippets.JOB_EXECUTION_LINKS // Links );/*from w ww. j a v a 2s . c o m*/ this.mvc.perform(RestDocumentationRequestBuilders.get(JOBS_API + "/{id}/execution", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(id))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(HOST_NAME_PATH, Matchers.is(this.hostname))) .andExpect(MockMvcResultMatchers.jsonPath(PROCESS_ID_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY))) .andExpect( MockMvcResultMatchers.jsonPath(EXIT_CODE_PATH, Matchers.is(JobExecution.SUCCESS_EXIT_CODE))) .andDo(getResultHandler); }
From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTests.java
private void checkJobCluster(final int documentationId, final String id) throws Exception { final RestDocumentationResultHandler getResultHandler = MockMvcRestDocumentation.document( "{class-name}/" + documentationId + "/getJobCluster/", Preprocessors.preprocessRequest(Preprocessors.prettyPrint()), Preprocessors.preprocessResponse(Preprocessors.prettyPrint()), Snippets.ID_PATH_PARAM, // Path parameters Snippets.HAL_CONTENT_TYPE_HEADER, // Response Headers Snippets.getClusterResponsePayload(), // Response fields Snippets.CLUSTER_LINKS // Links );// w w w. j av a2 s .c o m this.mvc.perform(RestDocumentationRequestBuilders.get(JOBS_API + "/{id}/cluster", id)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath(ID_PATH, Matchers.is(CLUSTER1_ID))) .andExpect(MockMvcResultMatchers.jsonPath(CREATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(UPDATED_PATH, Matchers.notNullValue())) .andExpect(MockMvcResultMatchers.jsonPath(NAME_PATH, Matchers.is(CLUSTER1_NAME))) .andExpect(MockMvcResultMatchers.jsonPath(USER_PATH, Matchers.is(CLUSTER1_USER))) .andExpect(MockMvcResultMatchers.jsonPath(VERSION_PATH, Matchers.is(CLUSTER1_VERSION))) .andDo(getResultHandler); }