Example usage for org.springframework.http HttpMethod GET

List of usage examples for org.springframework.http HttpMethod GET

Introduction

In this page you can find the example usage for org.springframework.http HttpMethod GET.

Prototype

HttpMethod GET

To view the source code for org.springframework.http HttpMethod GET.

Click Source Link

Usage

From source file:com.gopivotal.cla.github.GitHubConditionalTest.java

@Test
public void noLinks() {
    ResponseEntity<Set> response = new ResponseEntity<Set>(Sets.asSet(), HttpStatus.OK);
    when(this.restOperations.exchange(URL, HttpMethod.GET, REQUEST_ENTITY, Set.class)).thenReturn(response);

    this.gitHubType.getTrigger();

    assertTrue(this.gitHubType.initializedCalled);
}

From source file:fi.helsinki.opintoni.server.FlammaServer.java

public void expectEnglishStudentNews() {
    server.expect(requestTo(flammaBaseUrl + "/infotaulu/atom-tiedotteet-opiskelijalle-en.xml"))
            .andExpect(method(HttpMethod.GET))
            .andRespond(withSuccess(toText("flamma/englishstudentnews.xml"), MediaType.TEXT_XML));
}

From source file:fragment.web.AccessDecisionTest.java

@Test
public void testAnonymousUrls() throws Exception {
    Authentication auth = createAnonymousToken();
    Object[][] anonymousAccessValid = { { HttpMethod.GET, "/portal/portal/" },
            { HttpMethod.GET, "/portal/portal" }, { HttpMethod.GET, "/portal/portal/login" },
            { HttpMethod.POST, "/portal/portal/login" },
            { HttpMethod.GET, "/portal/portal/getGoogleAnalytics" },
            { HttpMethod.GET, "/portal/portal/register" }, { HttpMethod.POST, "/portal/portal/register" },
            { HttpMethod.GET, "/portal/portal/validate_username" },
            { HttpMethod.GET, "/portal/portal/loggedout" }, { HttpMethod.GET, "/portal/portal/reset_password" },
            { HttpMethod.POST, "/portal/portal/reset_password" },
            { HttpMethod.GET, "/portal/portal/verify_email" },
            { HttpMethod.GET, "/portal/portal/verify_user" } };
    Object[][] anonymousAccessInvalid = { { HttpMethod.GET, "/portal/portal/home" },
            { HttpMethod.GET, "/portal/portal/profile" }, { HttpMethod.GET, "/portal/portal/profile/edit" },
            { HttpMethod.POST, "/portal/portal/profile" }, { HttpMethod.GET, "/portal/portal/users" },
            { HttpMethod.POST, "/portal/portal/users" }, { HttpMethod.GET, "/portal/portal/users/new" },
            { HttpMethod.GET, "/portal/portal/users/1" }, { HttpMethod.PUT, "/portal/portal/users/1" },
            { HttpMethod.GET, "/portal/portal/tenants" }, { HttpMethod.POST, "/portal/portal/tenants" },
            { HttpMethod.GET, "/portal/portal/tenants/new" }, { HttpMethod.GET, "/portal/portal/tenants/1" },
            { HttpMethod.GET, "/portal/portal/tenants/1/edit" }, { HttpMethod.PUT, "/portal/portal/tenants/1" },
            { HttpMethod.GET, "/portal/portal/tasks/" }, { HttpMethod.GET, "/portal/portal/tasks/1/" },
            { HttpMethod.GET, "/portal/portal/tasks/approval-task/1" },
            { HttpMethod.POST, "/portal/portal/tasks/approval-task" },
            { HttpMethod.POST, "/portal/portal/acceptCookies" } };
    verify(auth, anonymousAccessValid, anonymousAccessInvalid);
}

From source file:comsat.sample.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:some.test.config.OAuthConfiguration.java

/**
 * Configure scopes for specific controller/httpmethods/roles here.
 *//*  w  ww . ja  v  a 2 s . c  o  m*/
@Override
public void configure(final HttpSecurity http) throws Exception {

    //J-
    http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER).and().requestMatchers()
            .antMatchers("/secured/**").and().authorizeRequests().antMatchers(HttpMethod.GET, "/secured/**")
            .access("#oauth2.hasScope('testscope')");
    //J+
}

From source file:fi.helsinki.opintoni.server.UnisportServer.java

public void expectAuthorization() {
    server.expect(/* w w w  .  j a va2  s .c om*/
            requestTo(unisportBaseUrl + "/api/v1/en/ext/opintoni/authorization?eppn=opiskelija@helsinki.fi"))
            .andExpect(method(HttpMethod.GET))
            .andRespond(withSuccess(toText("unisport/user.json"), MediaType.APPLICATION_JSON));
}

From source file:com.capside.enterpriseseminar.DemoAPIIT.java

@Test
public void testGetStatisticsWithJSON() throws IOException {
    final String localTeamName = "R. Madrid";
    final String visitorTeamName = "Barcelona";
    ResponseEntity<String> response = restTemplate.exchange("/games/stats/{firstTeam:.*}-vs-{secondTeam:.*}",
            HttpMethod.GET, null, String.class, localTeamName, visitorTeamName);
    JsonNode json = mapper.readTree(response.getBody());
    assertEquals("Invocation was a success.", HttpStatus.OK, response.getStatusCode());
    assertEquals("Local team", localTeamName, json.findValue("statistics").findValue("firstTeam").asText());
    assertEquals("Visitor team", visitorTeamName,
            json.findValue("statistics").findValue("secondTeam").asText());
}

From source file:io.spring.initializr.web.project.LegacyStsControllerIntegrationTests.java

@Override
protected String htmlHome() {
    HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML));
    return getRestTemplate()
            .exchange(createUrl("/sts"), HttpMethod.GET, new HttpEntity<Void>(headers), String.class).getBody();
}

From source file:org.trustedanalytics.h2oscoringengine.publisher.steps.CheckingIfAppExistsStepTest.java

@Before
public void setUp() {
    this.restTemplateMock = mock(RestTemplate.class);
    this.appsNumberResponseMock = mock(ResponseEntity.class);
    when(restTemplateMock.exchange(testCfAppInSpaceEndpoint, HttpMethod.GET,
            HttpCommunication.simpleJsonRequest(), String.class, testSpaceGuid, testAppName))
                    .thenReturn(appsNumberResponseMock);
}

From source file:fi.helsinki.opintoni.server.OodiServer.java

public void expectStudentEnrollmentsRequest(String studentNumber, String responseFile) {
    server.expect(requestTo(enrollmentsUrl(studentNumber))).andExpect(method(HttpMethod.GET)).andRespond(
            withSuccess(SampleDataFiles.toText("oodi/" + responseFile), MediaType.APPLICATION_JSON));
}