use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeListPagination in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogModelTest method testDataEnrichment.
@Test
@SneakyThrows
public void testDataEnrichment() {
Mockito.when(logDao.getExchangeLogListSearchCount(Mockito.anyString(), Mockito.anyList())).thenReturn(100L);
Mockito.when(logDao.getExchangeLogListPaginated(Mockito.any(Integer.class), Mockito.any(Integer.class), Mockito.anyString(), Mockito.anyList())).thenReturn(logs);
Mockito.when(logDao.getExchangeLogByRangeOfRefGuids(Mockito.anyList())).thenReturn(refLogs);
ExchangeListQuery query = new ExchangeListQuery();
ExchangeListPagination pagin = new ExchangeListPagination();
ExchangeListCriteria exchCrit = new ExchangeListCriteria();
query.setPagination(pagin);
pagin.setListSize(10);
query.setExchangeSearchCriteria(exchCrit);
ListResponseDto exchangeLogListByQuery = exchangeLogModel.getExchangeLogListByQuery(query);
List<ExchangeLogType> exchangeLogList = exchangeLogListByQuery.getExchangeLogList();
ExchangeLogType exchangeLogType1 = exchangeLogList.get(0);
ExchangeLogType exchangeLogType2 = exchangeLogList.get(1);
assertTrue(exchangeLogType1.getRelatedLogData().isEmpty());
assertTrue(!exchangeLogType2.getRelatedLogData().isEmpty());
System.out.println("Done");
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeListPagination in project UVMS-Docker by UnionVMS.
the class ExchangeLogRestIT method getLogListByCriteriaTest.
/**
* Gets the log list by criteria test.
*
* @return the log list by criteria test
* @throws Exception the exception
*/
@Test
public void getLogListByCriteriaTest() throws Exception {
ExchangeListQuery exchangeListQuery = new ExchangeListQuery();
ExchangeListCriteria exchangeListCriteria = new ExchangeListCriteria();
exchangeListCriteria.setIsDynamic(true);
ExchangeListCriteriaPair exchangeListCriteriaPair = new ExchangeListCriteriaPair();
exchangeListCriteriaPair.setKey(SearchField.STATUS);
exchangeListCriteriaPair.setValue("SUCCESSFUL");
exchangeListCriteria.getCriterias().add(exchangeListCriteriaPair);
exchangeListQuery.setExchangeSearchCriteria(exchangeListCriteria);
ExchangeListPagination exchangeListPagination = new ExchangeListPagination();
exchangeListPagination.setPage(1);
exchangeListPagination.setListSize(100);
exchangeListQuery.setPagination(exchangeListPagination);
final HttpResponse response = Request.Post(getBaseUrl() + "exchange/rest/exchange/list").bodyByteArray(writeValueAsString(exchangeListQuery).getBytes()).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
List<List> logList = (List) dataMap.get("logList");
assertFalse(logList.isEmpty());
}
Aggregations