use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.
the class DataApiControllerIT method shouldReturnPayloadTooLargeWhenCreatingNewDataWithDataAlreadySaved.
@Test
public void shouldReturnPayloadTooLargeWhenCreatingNewDataWithDataAlreadySaved() throws Exception {
// Given
OBAccount6 account = new OBAccount6().accountId(UUID.randomUUID().toString());
List<FRAccountData> accountDatas = Collections.singletonList(FRAccountData.builder().account(account).balances(Collections.singletonList(new OBCashBalance1().accountId(account.getAccountId()).type(OBBalanceType1Code.INTERIMAVAILABLE))).build());
FRAccount savedAccount = frAccountRepository.save(FRAccount.builder().id(account.getAccountId()).userID(UUID.randomUUID().toString()).build());
frBalanceRepository.save(FRBalance.builder().accountId(account.getAccountId()).build());
FRUserData userData = new FRUserData();
userData.setAccountDatas(accountDatas);
userData.setUserName(savedAccount.getUserID());
// When
mockMvc.perform(post("/api/data/user").content(mapper.writeValueAsString(userData)).contentType("application/json")).andExpect(status().isPayloadTooLarge());
}
use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.
the class UserDataService method createUserData.
public FRUserData createUserData(FRUserData userData) {
LOGGER.debug("Create data for user {}", userData);
HttpEntity request = new HttpEntity<>(userData, new HttpHeaders());
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(rsStoreRoot + "/api/data/user");
URI uri = builder.build().encode().toUri();
return restTemplate.exchange(uri, HttpMethod.POST, request, FRUserData.class).getBody();
}
use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.
the class UserDataService method exportUserData.
public FRUserData exportUserData(String userId) {
LOGGER.debug("Export data for user {}", userId);
HttpEntity request = new HttpEntity<>(null, new HttpHeaders());
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(rsStoreRoot + "/api/data/user");
builder.queryParam("userId", userId);
URI uri = builder.build().encode().toUri();
return restTemplate.exchange(uri, HttpMethod.GET, request, FRUserData.class).getBody();
}
Aggregations