use of org.springframework.util.LinkedMultiValueMap in project openlmis-stockmanagement by OpenLMIS.
the class UuidUtilTest method shouldRetrieveIdsFromMap.
@Test
public void shouldRetrieveIdsFromMap() {
UUID id1 = randomUUID();
UUID id2 = randomUUID();
UUID id3 = randomUUID();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add(ID, id1.toString());
params.add(ID, id2.toString());
params.add(ID, id3.toString());
params.add("ids", randomUUID());
params.add("someParameter", randomUUID());
assertThat(UuidUtil.getIds(params), hasItems(id1, id2, id3));
}
use of org.springframework.util.LinkedMultiValueMap in project SONG by overture-stack.
the class InfoSearchTest method search2.
@SneakyThrows
private List<InfoSearchResponse> search2(boolean includeInfo, String... searchTermStrings) {
val searchTerms = parseSearchTerms(searchTermStrings);
val map = new LinkedMultiValueMap<String, String>();
searchTerms.forEach(x -> map.put(x.getKey(), newArrayList(x.getValue())));
return service.infoSearch(STUDY, includeInfo, map);
}
use of org.springframework.util.LinkedMultiValueMap in project carina by qaprosoft.
the class HockeyAppManager method scanAppForBuild.
/**
* @param appIds takes in the application Ids
* @param buildType takes in the particular build to download (i.e. Prod.AdHoc, QA.Debug, Prod-Release, QA-Internal etc...)
* @param version takes in either "latest" to take the first build that matches the criteria or allows to consume a version to download that
* build.
* @return
*/
private String scanAppForBuild(List<String> appIds, String buildType, String version) {
for (String appId : appIds) {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
queryParams.add("page", "1");
queryParams.add("include_build_urls", "true");
RequestEntity<String> retrieveBuilds = buildRequestEntity(hockeyAppUrl, "api/2/apps/" + appId + "/app_versions", queryParams, HttpMethod.GET);
JsonNode buildResults = restTemplate.exchange(retrieveBuilds, JsonNode.class).getBody();
for (JsonNode node : buildResults.get("app_versions")) {
if (checkBuild(version, node) && checkTitleForCorrectPattern(buildType.toLowerCase(), node) || checkNotesForCorrectBuild(buildType.toLowerCase(), node)) {
LOGGER.info("Downloading Version: " + node);
versionNumber = node.get("shortversion").asText();
revision = node.get("version").asText();
List<String> packageUrls = new ArrayList<>();
packageUrls.add("build_url");
packageUrls.add("download_url");
for (String packageUrl : packageUrls) {
if (node.has(packageUrl)) {
return node.get(packageUrl).asText();
}
}
}
}
}
throw new RuntimeException(String.format("Unable to find build to download, version provided (%s)", version));
}
use of org.springframework.util.LinkedMultiValueMap in project spring-data-commons by spring-projects.
the class ReflectionRepositoryInvokerUnitTests method failedParameterConversionCapturesContext.
// DATACMNS-700
@Test
public void failedParameterConversionCapturesContext() throws Exception {
RepositoryInvoker invoker = getInvokerFor(mock(SimpleRepository.class));
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.add("value", "value");
Method method = SimpleRepository.class.getMethod("findByClass", int.class);
try {
invoker.invokeQueryMethod(method, parameters, Pageable.unpaged(), Sort.unsorted());
} catch (QueryMethodParameterConversionException o_O) {
assertThat(o_O.getParameter()).isEqualTo(new MethodParameters(method).getParameters().get(0));
assertThat(o_O.getSource()).isEqualTo("value");
assertThat(o_O.getCause()).isInstanceOf(ConversionFailedException.class);
}
}
use of org.springframework.util.LinkedMultiValueMap in project spring-data-commons by spring-projects.
the class ReflectionRepositoryInvokerUnitTests method considersFormattingAnnotationsOnQueryMethodParameters.
// DATACMNS-589
@Test
public void considersFormattingAnnotationsOnQueryMethodParameters() throws Exception {
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("date", "2013-07-18T10:49:00.000+02:00");
Method method = PersonRepository.class.getMethod("findByCreatedUsingISO8601Date", Date.class, Pageable.class);
PersonRepository repository = mock(PersonRepository.class);
getInvokerFor(repository, expectInvocationOf(method)).invokeQueryMethod(method, parameters, Pageable.unpaged(), Sort.unsorted());
}
Aggregations