List of usage examples for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap
public LinkedMultiValueMap()
From source file:demo.AuthorizationCodeProviderCookieTests.java
@Test @OAuth2ContextConfiguration(resource = MyTrustedClient.class, initialize = false) public void testPostToProtectedResource() throws Exception { approveAccessTokenGrant("http://anywhere", true); assertNotNull(context.getAccessToken()); LinkedMultiValueMap<String, String> form = new LinkedMultiValueMap<>(); form.set("foo", "bar"); assertEquals(HttpStatus.CREATED, http.postForStatus("/", getAuthenticatedHeaders(), form).getStatusCode()); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.HostValidationRuleTest.java
@Test public void validate_noHostKeyInData_exceptionThrown() { //given/* w w w . j ava2 s. c o m*/ MultiValueMap<String, String> requestWithoutHostKey = new LinkedMultiValueMap<>(); HostValidationRule rule = new HostValidationRule(new FormDataValidator()); //then thrown.expect(ValidationException.class); //when rule.validate(requestWithoutHostKey); }
From source file:fr.keemto.web.LoginWebIT.java
@Test public void shouldRejectInvalidUsername() { MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.add(USERNAME_PARAM, "invalid-login"); params.add(PASSWORD_PARAM, "fake"); LoginStatus status = template.postForObject(URL, params, LoginStatus.class); assertThat(status.isLoggedIn(), is(false)); assertThat(status.getUsername(), equalTo("invalid-login")); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.PasswordValidationRuleTest.java
@Test public void validate_noPasswordKeyInData_exceptionThrown() { //given/*from w ww.j a va 2s . c o m*/ MultiValueMap<String, String> requestWithoutPasswordKey = new LinkedMultiValueMap<>(); PasswordValidationRule rule = new PasswordValidationRule(new FormDataValidator()); //then thrown.expect(ValidationException.class); //when rule.validate(requestWithoutPasswordKey); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.UsernameValidationRuleTest.java
@Test public void validate_noUsernameKeyInData_exceptionThrown() { // given//from ww w. j ava 2s. co m MultiValueMap<String, String> requestWithoutUsernameKey = new LinkedMultiValueMap<>(); UsernameValidationRule rule = new UsernameValidationRule(new FormDataValidator()); // then thrown.expect(ValidationException.class); // when rule.validate(requestWithoutUsernameKey); }
From source file:io.github.cdelmas.spike.springboot.hello.SampleController.java
@RequestMapping("/") @ResponseBody//from www .j a va 2 s.c o m String home(@RequestHeader("Authorization") String authToken) { MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("Accept", "application/json"); headers.add("Authorization", authToken); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(null, headers); RestTemplate rest = new RestTemplate(); ResponseEntity<Car[]> responseEntity = rest.exchange("https://localhost:8443/cars", HttpMethod.GET, requestEntity, Car[].class); List<Car> cars = asList(responseEntity.getBody()); return "Hello World! " + cars.stream().map(Car::getName).collect(toList()); }
From source file:com.eretailservice.Application1Tests.java
@Test public void passwordGrant() { MultiValueMap<String, String> request = new LinkedMultiValueMap<String, String>(); request.set("username", "jlong"); request.set("password", "password"); request.set("grant_type", "password"); Map<String, Object> token = testRestTemplate.postForObject("/oauth/token", request, Map.class); assertNotNull("Wrong response: " + token, token.get("access_token")); }
From source file:com.electronicpanopticon.spring.web.rest.RestClient.java
/** * This method logs into a service by doing an standard http using the * configuration in this class./*from w w w.j a va 2s.co m*/ * * @param username * the username to log into the application with * @param password * the password to log into the application with * * @return the url that the login redirects to */ public String login(String username, String password) { MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>(); form.add(usernameInputFieldName, username); form.add(passwordInputFieldName, password); URI location = this.template.postForLocation(loginUrl(), form); return location.toString(); }
From source file:org.wallride.web.controller.admin.comment.CommentSearchForm.java
public MultiValueMap<String, String> toQueryParams() { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); if (StringUtils.hasText(keyword)) { params.add("keyword", keyword); }/*from www . j av a 2 s. c om*/ return params; }
From source file:org.cloudfoundry.identity.uaa.integration.VmcAuthenticationTests.java
@Before public void init() { ImplicitResourceDetails resource = testAccounts.getDefaultImplicitResource(); params = new LinkedMultiValueMap<String, String>(); params.set("client_id", resource.getClientId()); params.set("redirect_uri", resource.getRedirectUri(new DefaultAccessTokenRequest())); params.set("response_type", "token"); headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); }