Add some test logging
This commit is contained in:
parent
8657afb01e
commit
99787d14f1
|
@ -3,10 +3,10 @@ HAPI FHIR
|
|||
|
||||
HAPI FHIR - Java API for HL7 FHIR Clients and Servers
|
||||
|
||||
[![Coverage Status](https://coveralls.io/repos/jamesagnew/hapi-fhir/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamesagnew/hapi-fhir?branch=master)
|
||||
[![Build Status](https://dev.azure.com/jamesagnew214/jamesagnew214/_apis/build/status/jamesagnew.hapi-fhir?branchName=master)](https://dev.azure.com/jamesagnew214/jamesagnew214/_build/latest?definitionId=1&branchName=master)
|
||||
[![codecov](https://codecov.io/gh/jamesagnew/hapi-fhir/branch/master/graph/badge.svg)](https://codecov.io/gh/jamesagnew/hapi-fhir)
|
||||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg)](http://search.maven.org/#search|ga|1|ca.uhn.hapi.fhir)
|
||||
[![License](https://img.shields.io/badge/license-apache%202.0-60C060.svg)](http://jamesagnew.github.io/hapi-fhir/license.html)
|
||||
[![Build Status](https://dev.azure.com/jamesagnew214/jamesagnew214/_apis/build/status/jamesagnew.hapi-fhir?branchName=master)](https://dev.azure.com/jamesagnew214/jamesagnew214/_build/latest?definitionId=1&branchName=master)
|
||||
|
||||
Complete project documentation is available here:
|
||||
http://hapifhir.io
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.dao.data;
|
||||
|
||||
import ca.uhn.fhir.jpa.entity.Search;
|
||||
import ca.uhn.fhir.jpa.entity.SearchResult;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
|
@ -44,4 +45,7 @@ public interface ISearchResultDao extends JpaRepository<SearchResult, Long> {
|
|||
@Modifying
|
||||
@Query("DELETE FROM SearchResult s WHERE s.myId IN :ids")
|
||||
void deleteByIds(@Param("ids") List<Long> theContent);
|
||||
|
||||
@Query("SELECT count(r) FROM SearchResult r WHERE r.mySearchPid = :search")
|
||||
int countForSearch(@Param("search") Long theSearchPid);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,10 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
|||
private static JpaValidationSupportChainR4 ourJpaValidationSupportChainR4;
|
||||
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
|
||||
|
||||
@Autowired
|
||||
protected ISearchDao mySearchEntityDao;
|
||||
@Autowired
|
||||
protected ISearchResultDao mySearchResultDao;
|
||||
@Autowired
|
||||
@Qualifier("myResourceCountsCache")
|
||||
protected ResourceCountCache myResourceCountsCache;
|
||||
|
|
|
@ -6,6 +6,7 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
|
|||
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
||||
import ca.uhn.fhir.jpa.config.TestR4Config;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.entity.Search;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.rest.api.SortOrderEnum;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
|
@ -127,13 +128,22 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
|
|||
List<String> returnedIdValues = toUnqualifiedVersionlessIdValues(resources);
|
||||
assertEquals(myObservationIdsEvenOnly.subList(0, 10), returnedIdValues);
|
||||
assertEquals(1, hitCount.get());
|
||||
assertEquals(myObservationIds.subList(0, 20), interceptedResourceIds);
|
||||
assertEquals("Wrong response from " + outcome.getClass(), myObservationIds.subList(0, 20), interceptedResourceIds);
|
||||
|
||||
// Fetch the next 30 (do cross a fetch boundary)
|
||||
outcome = myPagingProvider.retrieveResultList(mySrd, outcome.getUuid());
|
||||
String searchId = outcome.getUuid();
|
||||
outcome = myPagingProvider.retrieveResultList(mySrd, searchId);
|
||||
resources = outcome.getResources(10, 40);
|
||||
returnedIdValues = toUnqualifiedVersionlessIdValues(resources);
|
||||
assertEquals(myObservationIdsEvenOnly.subList(10, 25), returnedIdValues);
|
||||
if (!myObservationIdsEvenOnly.subList(10,25).equals(returnedIdValues)) {
|
||||
if (resources.size() != 1) {
|
||||
runInTransaction(() -> {
|
||||
Search search = mySearchEntityDao.findByUuidAndFetchIncludes(searchId).get();
|
||||
fail("Failed to load - " + mySearchResultDao.countForSearch(search.getId()) + " results in " + search);
|
||||
});
|
||||
}
|
||||
}
|
||||
assertEquals("Wrong response from " + outcome.getClass(), myObservationIdsEvenOnly.subList(10, 25), returnedIdValues);
|
||||
assertEquals(2, hitCount.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
|
||||
import ca.uhn.fhir.jpa.entity.Search;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
|
@ -56,8 +58,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
|
||||
@Autowired
|
||||
MatchUrlService myMatchUrlService;
|
||||
@Autowired
|
||||
private ISearchDao mySearchEntityDao;
|
||||
|
||||
@After
|
||||
public void afterResetSearchSize() {
|
||||
|
@ -1325,7 +1325,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchDateWrongParam() {
|
||||
Patient p1 = new Patient();
|
||||
|
@ -1371,6 +1370,14 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
String searchId = found.getUuid();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
List<IBaseResource> resources = found.getResources(i, i + 1);
|
||||
if (resources.size() != 1) {
|
||||
int finalI = i;
|
||||
int finalI1 = i;
|
||||
runInTransaction(() -> {
|
||||
Search search = mySearchEntityDao.findByUuidAndFetchIncludes(searchId).get();
|
||||
fail("Failed to load range " + finalI + " - " + (finalI1 + 1) + " - " + mySearchResultDao.countForSearch(search.getId()) + " results in " + search);
|
||||
});
|
||||
}
|
||||
assertThat("Failed to load range " + i + " - " + (i + 1) + " - from provider of type: " + found.getClass(), resources, hasSize(1));
|
||||
Patient nextResource = (Patient) resources.get(0);
|
||||
dates.add(nextResource.getBirthDateElement().getValueAsString());
|
||||
|
|
Loading…
Reference in New Issue