Try to fix 2 intermittent test failures
This commit is contained in:
parent
3b1d8d1bc0
commit
1a348abaf5
|
@ -47,5 +47,9 @@ public interface IFluentPath {
|
||||||
*/
|
*/
|
||||||
<T extends IBase> Optional<T> evaluateFirst(IBase theInput, String thePath, Class<T> theReturnType);
|
<T extends IBase> Optional<T> evaluateFirst(IBase theInput, String thePath, Class<T> theReturnType);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the expression and throws an exception if it can not parse correctly
|
||||||
|
*/
|
||||||
|
void parse(String theExpression) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,10 +145,9 @@ public class FhirResourceDaoSearchParameterR4 extends BaseHapiFhirResourceDao<Se
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
FHIRPathEngine fhirPathEngine = new FHIRPathEngine(new HapiWorkerContext(theContext, VALIDATION_SUPPORT));
|
|
||||||
try {
|
try {
|
||||||
fhirPathEngine.parse(theExpression);
|
theContext.newFluentPath().parse(theExpression);
|
||||||
} catch (FHIRLexer.FHIRLexerException e) {
|
} catch (Exception e) {
|
||||||
throw new UnprocessableEntityException("Invalid SearchParameter.expression value \"" + theExpression + "\": " + e.getMessage());
|
throw new UnprocessableEntityException("Invalid SearchParameter.expression value \"" + theExpression + "\": " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.thymeleaf.util.ListUtils.sort;
|
|
||||||
|
|
||||||
public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProviderR4Test {
|
public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
|
@ -529,7 +528,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
|
||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
bundle = ourClient
|
bundle = ourClient
|
||||||
.search()
|
.search()
|
||||||
.byUrl(ourServerBase + "/Questionnaire?item-text:contains=Section")
|
.byUrl(ourServerBase + "/Questionnaire?item-text=Section")
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
} else {
|
} else {
|
||||||
|
@ -551,9 +550,9 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
|
||||||
List<Search> searches = mySearchEntityDao.findAll();
|
List<Search> searches = mySearchEntityDao.findAll();
|
||||||
assertEquals(1, searches.size());
|
assertEquals(1, searches.size());
|
||||||
Search search = searches.get(0);
|
Search search = searches.get(0);
|
||||||
String message = "\nWanted: " + sort(ids) + "\n" +
|
String message = "\nWanted: " + (ids) + "\n" +
|
||||||
"Actual: " + sort(actualIds) + "\n" +
|
"Actual: " + (actualIds) + "\n" +
|
||||||
"Found : " + sort(found) + "\n" +
|
"Found : " + (found) + "\n" +
|
||||||
search.toString();
|
search.toString();
|
||||||
assertEquals(message, 200, search.getNumFound());
|
assertEquals(message, 200, search.getNumFound());
|
||||||
assertEquals(message, 200, search.getTotalCount().intValue());
|
assertEquals(message, 200, search.getTotalCount().intValue());
|
||||||
|
|
|
@ -7,7 +7,13 @@ import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.CodeType;
|
||||||
|
import org.hl7.fhir.dstu3.model.Coding;
|
||||||
|
import org.hl7.fhir.dstu3.model.Parameters;
|
||||||
|
import org.hl7.fhir.dstu3.model.PrimitiveType;
|
||||||
|
import org.hl7.fhir.dstu3.model.StringType;
|
||||||
|
import org.hl7.fhir.dstu3.model.Type;
|
||||||
|
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -24,8 +30,13 @@ import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.awaitility.Awaitility.await;
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.junit.Assert.*;
|
import static org.hamcrest.Matchers.empty;
|
||||||
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class TerminologyLoaderSvcIntegrationDstu3Test extends BaseJpaDstu3Test {
|
public class TerminologyLoaderSvcIntegrationDstu3Test extends BaseJpaDstu3Test {
|
||||||
|
|
||||||
|
@ -116,9 +127,7 @@ public class TerminologyLoaderSvcIntegrationDstu3Test extends BaseJpaDstu3Test {
|
||||||
|
|
||||||
myTerminologyDeferredStorageSvc.saveDeferred();
|
myTerminologyDeferredStorageSvc.saveDeferred();
|
||||||
|
|
||||||
runInTransaction(() -> {
|
await().until(() -> runInTransaction(() -> myTermConceptMapDao.count()), greaterThan(0L));
|
||||||
await().until(() -> myTermConceptMapDao.count(), greaterThan(0L));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -49,4 +49,9 @@ public class FluentPathDstu3 implements IFluentPath {
|
||||||
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parse(String theExpression) {
|
||||||
|
myEngine.parse(theExpression);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,10 @@ public class FluentPathR4 implements IFluentPath {
|
||||||
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parse(String theExpression) {
|
||||||
|
myEngine.parse(theExpression);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,10 @@ public class FhirPathR5 implements IFluentPath {
|
||||||
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
return evaluate(theInput, thePath, theReturnType).stream().findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parse(String theExpression) {
|
||||||
|
myEngine.parse(theExpression);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue