Package org.springframework.web.client

Examples of org.springframework.web.client.RestOperations


      logger.debug("Running @BeforeOAuth2Context methods");

      for (FrameworkMethod before : befores) {

        RestOperations savedServerClient = clientHolder.getRestTemplate();

        OAuth2ContextConfiguration beforeConfiguration = findOAuthContextConfiguration(before, testClass);
        if (beforeConfiguration != null) {

          OAuth2ProtectedResourceDetails resource = creatResource(target, beforeConfiguration);
View Full Code Here


      else {
        serverOnline.put(port, false);
      }
    }

    final RestOperations savedClient = getRestTemplate();
    postForStatus(savedClient, "/sparklr2/oauth/uncache_approvals", new LinkedMultiValueMap<String, String>());

    return new Statement() {

      @Override
View Full Code Here

    private ObjectMapper mapper = new ObjectMapper();

    @Before
    public void setUp() throws Exception {
        RestOperations restOperations = mock(RestOperations.class);
        given(gitHub.restOperations()).willReturn(restOperations);

        String membersJson = Fixtures.load("/fixtures/github/ghTeamInfo.json");
        GitHubUser[] gitHubUsers = mapper.readValue(membersJson, GitHubUser[].class);
        ResponseEntity<GitHubUser[]> responseEntity = new ResponseEntity<>(gitHubUsers, HttpStatus.OK);

        given(
                restOperations.getForEntity("https://api.github.com/teams/{teamId}/members", GitHubUser[].class,
                        "482984")).willReturn(responseEntity);

        stubRestClient.putResponse("/users/jdoe", Fixtures.load("/fixtures/github/ghUserProfile-jdoe.json"));
        stubRestClient.putResponse("/users/asmith", Fixtures.load("/fixtures/github/ghUserProfile-asmith.json"));
    }
View Full Code Here

        assertThat(signInService.isSpringMember("notmember", gitHub), is(false));
    }

    private void mockIsMemberOfTeam(boolean isMember) {
        RestOperations restOperations = mock(RestOperations.class);
        given(gitHub.restOperations()).willReturn(restOperations);
        BDDMyOngoingStubbing<ResponseEntity<Void>> expectedResult =
                given(restOperations.getForEntity(anyString(), argThat(new ArgumentMatcher<Class<Void>>() {
                    @Override
                    public boolean matches(Object argument) {
                        return true;
                    }
                }), anyString(), anyString()));
View Full Code Here

  }

  @Test
  public void connectFailure() throws Exception {
    final HttpServerErrorException expected = new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR);
    RestOperations restTemplate = mock(RestOperations.class);
    given(restTemplate.execute((URI) any(), eq(HttpMethod.POST), any(), any())).willThrow(expected);

    final CountDownLatch latch = new CountDownLatch(1);
    connect(restTemplate).addCallback(
        new ListenableFutureCallback<WebSocketSession>() {
          @Override
View Full Code Here

TOP

Related Classes of org.springframework.web.client.RestOperations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.