List of usage examples for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap
public LinkedMultiValueMap()
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.HostValidationRuleTest.java
@Test public void validate_multipleHostKeysInData_exceptionThrown() { //given/*from w ww. ja va 2 s .c o m*/ MultiValueMap<String, String> requestWithMultipleHostKeys = new LinkedMultiValueMap<>(); requestWithMultipleHostKeys.add(HostValidationRule.HOST_KEY, "http://example.com"); requestWithMultipleHostKeys.add(HostValidationRule.HOST_KEY, "http://example.com"); HostValidationRule rule = new HostValidationRule(new FormDataValidator()); //then thrown.expect(ValidationException.class); //when rule.validate(requestWithMultipleHostKeys); }
From source file:jittr.rest.JittleFacadeRestSecurityIntTest.java
@Test public void passwordGrant() { MultiValueMap<String, String> request = new LinkedMultiValueMap<String, String>(); request.set("username", "habuma"); 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); }
From source file:org.cloudfoundry.identity.uaa.integration.PasswordCheckEndpointIntegrationTests.java
@Test public void passwordPostWithUserDataSucceeds() throws Exception { MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); formData.add("password", "joe@joesplace.blah"); formData.add("userData", "joe,joe@joesplace.blah,joesdogsname"); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = serverRunning.postForMap("/password/score", formData, headers); assertEquals(HttpStatus.OK, response.getStatusCode()); assertTrue(response.getBody().containsKey("score")); assertTrue(response.getBody().containsKey("requiredScore")); assertEquals(0, response.getBody().get("score")); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.PasswordValidationRuleTest.java
@Test public void validate_multiplePasswordKeysInData_exceptionThrown() { //given// ww w.j a va2 s.co m MultiValueMap<String, String> requestWithMultiplePasswordKeys = new LinkedMultiValueMap<>(); requestWithMultiplePasswordKeys.add(PasswordValidationRule.PASSWORD_KEY, "some-password"); requestWithMultiplePasswordKeys.add(PasswordValidationRule.PASSWORD_KEY, "other-password"); PasswordValidationRule rule = new PasswordValidationRule(new FormDataValidator()); //then thrown.expect(ValidationException.class); //when rule.validate(requestWithMultiplePasswordKeys); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.UsernameValidationRuleTest.java
@Test public void validate_multipleUsernameKeysInData_exceptionThrown() { // given//from ww w . j av a2 s .c o m MultiValueMap<String, String> requestWithMultipleUsernameKeys = new LinkedMultiValueMap<>(); requestWithMultipleUsernameKeys.add(UsernameValidationRule.USERNAME_KEY, "some-username"); requestWithMultipleUsernameKeys.add(UsernameValidationRule.USERNAME_KEY, "other-username"); UsernameValidationRule rule = new UsernameValidationRule(new FormDataValidator()); // then thrown.expect(ValidationException.class); // when rule.validate(requestWithMultipleUsernameKeys); }
From source file:fr.keemto.web.LoginWebIT.java
@Test public void shouldRejectValidUserWithWrongCredentials() { MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.add(USERNAME_PARAM, VALID_USERNAME); params.add(PASSWORD_PARAM, "invalid"); LoginStatus status = template.postForObject(URL, params, LoginStatus.class); assertThat(status.isLoggedIn(), is(false)); assertThat(status.getUsername(), equalTo(VALID_USERNAME)); }
From source file:org.messic.android.controllers.LoginController.java
public void login(final Activity context, final boolean remember, final String username, final String password, final ProgressDialog pd) throws Exception { Network.nukeNetwork();/*from www .j a v a 2s.co m*/ final String baseURL = Configuration.getBaseUrl() + "/messiclogin"; MultiValueMap<String, Object> formData = new LinkedMultiValueMap<String, Object>(); formData.add("j_username", username); formData.add("j_password", password); try { RestJSONClient.post(baseURL, formData, MDMLogin.class, new RestJSONClient.RestListener<MDMLogin>() { public void response(MDMLogin response) { MessicPreferences mp = new MessicPreferences(context); mp.setRemember(remember, username, password); Configuration.setToken(response.getMessic_token()); pd.dismiss(); Intent ssa = new Intent(context, BaseActivity.class); context.startActivity(ssa); } public void fail(Exception e) { Log.e("Login", e.getMessage(), e); context.runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(context, "Error", Toast.LENGTH_LONG).show(); } }); } }); } catch (Exception e) { pd.dismiss(); Log.e("login", e.getMessage(), e); throw e; } }
From source file:org.openschedule.api.impl.EventTemplate.java
public EventTemplate(RestTemplate restTemplate, String apiUrlBase) { super(apiUrlBase); Log.v(TAG, "initialize : enter"); this.restTemplate = restTemplate; jsonAcceptingHeaders = new LinkedMultiValueMap<String, String>(); jsonAcceptingHeaders.add("Accept", "application/json"); Log.v(TAG, "initialize : exit"); }
From source file:com.folion.social.CouchbaseConnectionRepository.java
@Override public MultiValueMap<String, Connection<?>> findConnectionsToUsers( MultiValueMap<String, String> providerUsers) { return new LinkedMultiValueMap<>(); }
From source file:de.codecentric.batch.FlatFileJobIntegrationTest.java
protected ExitStatus runJobAndWaitForCompletion(String hostname, String port, String jobName, String jobParameters) throws InterruptedException { MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); parameters.add("jobParameters", jobParameters); String jobExecutionId = restTemplate.postForObject( "http://" + hostname + ":" + port + "/batch/operations/jobs/" + jobName + "", parameters, String.class); ExitStatus exitStatus = getStatus(hostname, port, jobExecutionId); // Wait for end of job while (exitStatus.isRunning()) { Thread.sleep(100);//from w w w . j a v a 2 s .co m exitStatus = getStatus(hostname, port, jobExecutionId); } return exitStatus; }