List of usage examples for org.springframework.http HttpMethod GET
HttpMethod GET
To view the source code for org.springframework.http HttpMethod GET.
Click Source Link
From source file:com.unknownpkg.StupsSwaggerCodegenIT.java
@Test public void getResources() { RestTemplate rest = new RestTemplate(); ResponseEntity<List<SwaggerResource>> responseEntity = rest.exchange( "http://localhost:" + port + "/swagger-resources", HttpMethod.GET, null, swaggerResourceParameterizedType); List<SwaggerResource> swaggerResourceList = responseEntity.getBody(); Assertions.assertThat(swaggerResourceList).isNotEmpty(); SwaggerResource resource = swaggerResourceList.get(0); Assertions.assertThat(resource).isNotNull(); Assertions.assertThat(resource.getSwaggerVersion()).isEqualTo("2.0"); Assertions.assertThat(resource.getName()).isEqualTo("default"); Assertions.assertThat(resource.getLocation()).isEqualTo("/v2/api-docs"); }
From source file:com.alcatel.hello.actuator.ui.SampleActuatorUIApplicationTests.java
@Test public void testHome() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange("http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity.getBody().contains("<title>Hello")); }
From source file:fi.helsinki.opintoni.server.FlammaServer.java
public void expectStudentNews() { server.expect(requestTo(flammaBaseUrl + "/infotaulu/atom-tiedotteet-opiskelijalle.xml")) .andExpect(method(HttpMethod.GET)) .andRespond(withSuccess(toText("flamma/studentnews.xml"), MediaType.TEXT_XML)); }
From source file:org.n52.restfulwpsproxy.wps.GetStatusClient.java
public StatusInfoDocument getStatusInfo(String processId, String jobId) { HttpEntity<?> requestEntity = new HttpEntity<Object>(null, headers); ResponseEntity<StatusInfoDocument> statusInfo = restTemplate.exchange( new RequestUrlBuilder(GET_STATUS).jobID(jobId).build(), HttpMethod.GET, requestEntity, StatusInfoDocument.class); return statusInfo.getBody(); }
From source file:org.moserp.environment.rest.ValueListControllerTest.java
@Test public void testFindByKey() { ValueList valueList = new ValueList(); valueList.setKey(key);/*from w w w. jav a 2 s. co m*/ valueList.addValue(new ValueListItem("TestValue")); valueListRepository.save(valueList); Resources<ValueListItem> valueListItems = restTemplate .exchange(testEnvironment.createRestUri("valueLists/" + key + "/values"), HttpMethod.GET, null, new ParameterizedTypeReference<Resources<ValueListItem>>() { }) .getBody(); assertEquals("size", 1, valueListItems.getContent().size()); assertEquals("value", valueList.getValues().get(0), valueListItems.getContent().iterator().next()); }
From source file:org.zalando.github.spring.MembersTemplateTest.java
@Test public void listMembers() throws Exception { mockServer.expect(requestTo("https://api.github.com/orgs/zalando-stups/members?per_page=25")) .andExpect(method(HttpMethod.GET)) // .andExpect(header("Authorization", "Bearer ACCESS_TOKEN")) .andRespond(withSuccess(new ClassPathResource("listMembers.json", getClass()), MediaType.APPLICATION_JSON)); List<User> issueList = membersTemplate.listMembers("zalando-stups"); Assertions.assertThat(issueList).isNotNull(); Assertions.assertThat(issueList.size()).isEqualTo(1); }
From source file:fi.helsinki.opintoni.server.OodiServer.java
public void expectStudentEnrollmentsRequest(String studentNumber) { server.expect(requestTo(enrollmentsUrl(studentNumber))).andExpect(method(HttpMethod.GET)).andRespond( withSuccess(SampleDataFiles.toText("oodi/enrollments.json"), MediaType.APPLICATION_JSON)); }
From source file:rugal.sample.controller.StudentActionServerSideTest.java
@Test // @Ignore/*w w w . j a va2 s. c o m*/ public void getAddress() { request.setMethod(HttpMethod.GET.name()); request.setRequestURI("/student/{id}"); HashMap<String, String> pathVariablesMap = new HashMap<>(1); pathVariablesMap.put("id", "3"); request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, pathVariablesMap); Class<?>[] parameterTypes = new Class<?>[] { Integer.class }; ModelAndView mv = null; try { mv = handlerAdapter.handle(request, response, new HandlerMethod(studentAction, "retrieve", parameterTypes)); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:at.create.android.ffc.http.FetchContacts.java
/** * Fetches the contacts./*from ww w. ja v a 2 s. c o m*/ */ public void fetch() { setAcceptHeaderApplicationXml(); HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders); restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter()); // Perform the HTTP GET request ResponseEntity<ContactList> responseEntity = restTemplate.exchange(getUrl(), HttpMethod.GET, requestEntity, ContactList.class); contactList = responseEntity.getBody(); }
From source file:org.energyos.espi.thirdparty.repository.impl.ResourceRESTRepositoryImpl.java
public IdentifiedObject get(Authorization authorization, String url) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.set("Authorization", "Bearer " + authorization.getAccessToken()); @SuppressWarnings({ "rawtypes", "unchecked" }) HttpEntity<?> requestEntity = new HttpEntity(requestHeaders); HttpEntity<String> response = template.exchange(url, HttpMethod.GET, requestEntity, String.class); return (IdentifiedObject) marshaller.unmarshal(new StreamSource(response.getBody())); }