Example usage for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

List of usage examples for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

Introduction

In this page you can find the example usage for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap.

Prototype

public LinkedMultiValueMap() 

Source Link

Document

Create a new LinkedMultiValueMap that wraps a LinkedHashMap .

Usage

From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.UsernameValidationRuleTest.java

@Test
public void validate_allDataValid_doesntThrowException() {
    // given/*  w  w w  .java2s .  c  o m*/
    MultiValueMap<String, String> requestWithUsername = new LinkedMultiValueMap<>();
    requestWithUsername.add(UsernameValidationRule.USERNAME_KEY, "some-username");
    UsernameValidationRule rule = new UsernameValidationRule(new FormDataValidator());

    // when
    rule.validate(requestWithUsername);

    // then
    // no exception is thrown
}

From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.PasswordValidationRuleTest.java

@Test
public void validate_allDataValid_doesntThrowException() {
    //given//from   w  w w .j  ava2 s  . com
    MultiValueMap<String, String> requestWithPassword = new LinkedMultiValueMap<>();
    requestWithPassword.add(PasswordValidationRule.PASSWORD_KEY, "some-password");
    PasswordValidationRule rule = new PasswordValidationRule(new FormDataValidator());

    //when
    rule.validate(requestWithPassword);

    //then
    // no exception is thrown
}

From source file:org.trustedanalytics.h2oscoringengine.publisher.restapi.validation.HostValidationRuleTest.java

@Test
public void validate_allDataValid_doesntThrowException() {
    //given/*w w  w  .  j a v a2 s .  c o  m*/
    MultiValueMap<String, String> requestWithHost = new LinkedMultiValueMap<>();
    requestWithHost.add(HostValidationRule.HOST_KEY, "http://example.com");
    HostValidationRule rule = new HostValidationRule(new FormDataValidator());

    //when
    rule.validate(requestWithHost);

    //then
    // no exception is thrown
}

From source file:com.svds.resttest.operator.BuildWhereClauseNGTest.java

/**
 * Test of buildWhereClause method, of class BuildWhereClause.
 *///from   w  ww .ja  v a2  s .  co  m
@Test
public void testBuildWhereClause() throws Exception {
    System.out.println("buildWhereClause");
    MultiValueMap<String, String> requestParams = new LinkedMultiValueMap<>();
    requestParams.add("operator__episode_title", "stringlike");
    requestParams.add("column__episode_title", "%Cybermen%");
    String expResult = "episode_title LIKE '%Cybermen%' ";
    String result = BuildWhereClause.buildWhereClause(requestParams);
    assertEquals(result, expResult);
}

From source file:org.jnrain.mobile.accounts.kbs.KBSLogoutRequest.java

@Override
public SimpleReturnCode loadDataFromNetwork() throws Exception {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    // request body intentionally empty

    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
    HttpEntity<MultiValueMap<String, String>> req = new HttpEntity<MultiValueMap<String, String>>(params,
            headers);/*  ww w . j  av  a2  s .com*/

    return getRestTemplate().postForObject(
            /* "http://rhymin.jnrain.com/api/logout/", */
            "http://bbs.jnrain.com/rainstyle/apilogout.php", req, SimpleReturnCode.class);
}

From source file:org.jnrain.mobile.accounts.kbs.KBSCheckIDRequest.java

@Override
public KBSRegisterResult loadDataFromNetwork() throws Exception {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("id", _uid);

    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
    HttpEntity<MultiValueMap<String, String>> req = new HttpEntity<MultiValueMap<String, String>>(params,
            headers);//  w w  w  . j  av a2s.c o m

    return getRestTemplate().postForObject("http://bbs.jnrain.com/rainstyle/apicheckid.php", req,
            KBSRegisterResult.class);
}

From source file:org.cloudfoundry.identity.uaa.integration.PasswordCheckEndpointIntegrationTests.java

@Test
public void passwordPostSucceeds() throws Exception {
    MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>();
    formData.add("password", "password1");
    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:cn.org.once.cstack.utils.RestUtils.java

@SuppressWarnings("rawtypes")
public static String sendPostCommand(String url, String volume) {

    RestTemplate restTemplate = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.add("Accept", "text/plain");
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.add("Binds", volume);
    @SuppressWarnings("unchecked")
    HttpEntity request = new HttpEntity(params, headers);
    ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class);
    return response.toString();
}

From source file:au.org.ala.fielddata.mobile.service.LoginService.java

public LoginResponse login(String username, String password, String portalName) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();

    params.set("portalName", portalName);
    params.set("username", username);
    params.set("password", password);

    String url = getServerUrl() + loginUrl;

    LoginResponse result = null;/*  ww w.  j  av a  2  s  .c o m*/
    try {
        result = getRestTemplate().postForObject(url, params, LoginResponse.class);
    } catch (NullPointerException e) {
        // We are getting SSL connection reset errors - at least in the internal network
        // which manifests itself as a NPE.  A retry is usually all that is required to fix it.
        result = getRestTemplate().postForObject(url, params, LoginResponse.class);
    }
    Preferences prefs = new Preferences(ctx);
    prefs.setFieldDataSessionKey(result.ident);
    prefs.setFieldDataPath(result.portal.path);
    prefs.setFieldDataPortalName(result.portal.name);

    return result;
}

From source file:com.bailen.radioOnline.recursos.REJA.java

public Usuario login(String email) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
    params.add("email", email);
    String result = new RestTemplate().postForObject("http://ceatic.ujaen.es:8075/radioapi/v2/login", params,
            String.class);
    //return result;

    try {/* www .j  a v  a 2  s  .  c o m*/

        ObjectMapper a = new ObjectMapper();
        Usuario listilla = a.readValue(result, Usuario.class);
        return listilla;

    } catch (Exception e) {
        return null;
    }

}