List of usage examples for org.springframework.http HttpMethod POST
HttpMethod POST
To view the source code for org.springframework.http HttpMethod POST.
Click Source Link
From source file:com.appglu.impl.SavedQueriesTemplateTest.java
@Test public void runUpdateQuery() { mockServer.expect(requestTo("http://localhost/appglu/v1/queries/queryName/run")) .andExpect(method(HttpMethod.POST)).andExpect(header("Content-Type", jsonMediaType.toString())) .andExpect(content().string(compactedJson("data/saved_queries_params"))).andRespond(withSuccess() .body(compactedJson("data/saved_queries_update_result")).headers(responseHeaders)); QueryResult result = savedQueriesOperations.runQuery("queryName", queryParams()); Assert.assertNull(result.getRows()); Assert.assertEquals(new Integer(10), result.getRowsAffected()); mockServer.verify();//w w w. ja v a2 s . c o m }
From source file:org.openmhealth.shim.fitbit.FitbitShim.java
protected HttpMethod getRequestTokenMethod() { return HttpMethod.POST; }
From source file:com.orange.ngsi.client.SubscribeContextRequestTest.java
@Test(expected = HttpServerErrorException.class) public void subscribeContextRequestWith500() throws Exception { mockServer.expect(requestTo(baseUrl + "/ngsi10/subscribeContext")).andExpect(method(HttpMethod.POST)) .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); ngsiClient.subscribeContext(baseUrl, null, createSubscribeContextTemperature()).get(); }
From source file:com.orange.ngsi.client.UpdateContextSubscriptionTest.java
@Test(expected = HttpServerErrorException.class) public void subscribeContextRequestWith500() throws Exception { mockServer.expect(requestTo(baseUrl + "/ngsi10/updateContextSubscription")) .andExpect(method(HttpMethod.POST)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); ngsiClient.updateContextSubscription(baseUrl, null, createUpdateContextSubscriptionTemperature()).get(); }
From source file:com.orange.ngsi.client.RegisterContextRequestTest.java
@Test(expected = HttpServerErrorException.class) public void registerContextRequestWith500() throws Exception { mockServer.expect(requestTo(baseUrl + "/ngsi9/registerContext")).andExpect(method(HttpMethod.POST)) .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); ngsiClient.registerContext(baseUrl, null, createRegisterContextTemperature()).get(); }
From source file:com.appglu.impl.SyncTemplateTest.java
@Test public void changesForTables() { mockServer.expect(requestTo("http://localhost/appglu/v1/sync/changes")).andExpect(method(HttpMethod.POST)) .andExpect(header("Content-Type", jsonMediaType.toString())) .andExpect(content().string(compactedJson("data/sync_changes_for_tables_request"))) .andRespond(withStatus(HttpStatus.OK).body(compactedJson("data/sync_changes_for_tables_response")) .headers(responseHeaders)); TableVersion loggedTable = new TableVersion("logged_table"); TableVersion otherTable = new TableVersion("other_table", 1); List<TableChanges> changes = this.syncOperations.changesForTables(loggedTable, otherTable); this.assertChanges(changes); mockServer.verify();/*from w ww. j a va 2 s . com*/ }
From source file:com.embedler.moon.graphql.boot.sample.test.GenericTodoSchemaParserTest.java
@Test public void restViewerByIdTest() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); GraphQLServerRequest qlQuery = new GraphQLServerRequest("{viewer{ id }}"); HttpEntity<GraphQLServerRequest> httpEntity = new HttpEntity<>(qlQuery, headers); ResponseEntity<GraphQLServerResult> responseEntity = restTemplate.exchange( "http://localhost:" + port + "/graphql", HttpMethod.POST, httpEntity, GraphQLServerResult.class); GraphQLServerResult result = responseEntity.getBody(); Assert.assertTrue(CollectionUtils.isEmpty(result.getErrors())); Assert.assertFalse(CollectionUtils.isEmpty(result.getData())); LOGGER.info(objectMapper.writeValueAsString(result.getData())); }
From source file:com.orange.ngsi.client.UnsubscribeContextRequestTest.java
@Test(expected = HttpServerErrorException.class) public void unsubscribeContextRequestWith500() throws Exception { this.mockServer.expect(requestTo(baseUrl + "/ngsi10/unsubscribeContext")).andExpect(method(HttpMethod.POST)) .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); ngsiClient.unsubscribeContext(baseUrl, null, subscriptionID).get(); }
From source file:de.zib.gndms.gndmc.gorfx.GORFXClient.java
@SuppressWarnings("unchecked") public final ResponseEntity<Specifier<Facets>> createTaskFlow(final String type, final Order order, final String dn, final String wid, MultiValueMap<String, String> context) { GNDMSResponseHeader requestHeaders = new GNDMSResponseHeader(); if (dn != null) { requestHeaders.setDN(dn);/* ww w .j av a 2 s.c o m*/ } if (wid != null) { requestHeaders.setWId(wid); } requestHeaders.putAll(context); HttpEntity<Order> requestEntity = new HttpEntity<Order>(order, requestHeaders); RestOperations restTemplate = getRestTemplate(); if (null == restTemplate) { throw new IllegalStateException("No RestTemplate set in GORFXClient."); } return (ResponseEntity<Specifier<Facets>>) (Object) restTemplate .exchange(getServiceURL() + "/gorfx/_" + type, HttpMethod.POST, requestEntity, Specifier.class); }
From source file:io.spring.initializr.actuate.stat.ProjectGenerationStatPublisherTests.java
@Test public void recoverFromError() { ProjectRequest request = createProjectRequest(); this.mockServer.expect(requestTo("http://example.com/elastic/initializr/request")) .andExpect(method(HttpMethod.POST)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); this.mockServer.expect(requestTo("http://example.com/elastic/initializr/request")) .andExpect(method(HttpMethod.POST)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR)); this.mockServer.expect(requestTo("http://example.com/elastic/initializr/request")) .andExpect(method(HttpMethod.POST)) .andRespond(withStatus(HttpStatus.CREATED).body(mockResponse(UUID.randomUUID().toString(), true)) .contentType(MediaType.APPLICATION_JSON)); this.statPublisher.handleEvent(new ProjectGeneratedEvent(request)); this.mockServer.verify(); }