Add a test
This commit is contained in:
parent
80353e5d42
commit
2edc9910e5
|
@ -618,8 +618,8 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
|
|||
write(theEventWriter, "resourceType", resDef.getName());
|
||||
if (theResourceId != null && theResourceId.hasIdPart()) {
|
||||
write(theEventWriter, "id", theResourceId.getIdPart());
|
||||
final List<HeldExtension> extensions = new ArrayList<HeldExtension>(0);
|
||||
final List<HeldExtension> modifierExtensions = new ArrayList<HeldExtension>(0);
|
||||
final List<HeldExtension> extensions = new ArrayList<>(0);
|
||||
final List<HeldExtension> modifierExtensions = new ArrayList<>(0);
|
||||
// Undeclared extensions
|
||||
extractUndeclaredExtensions(theResourceId, extensions, modifierExtensions, null, null);
|
||||
boolean haveExtension = false;
|
||||
|
@ -707,14 +707,11 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
|
|||
/**
|
||||
* This is useful only for the two cases where extensions are encoded as direct children (e.g. not in some object
|
||||
* called _name): resource extensions, and extension extensions
|
||||
*
|
||||
* @param theChildElem
|
||||
* @param theParent
|
||||
*/
|
||||
private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition<?> theElementDef, RuntimeResourceDefinition theResDef,
|
||||
IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent) throws IOException {
|
||||
List<HeldExtension> extensions = new ArrayList<HeldExtension>(0);
|
||||
List<HeldExtension> modifierExtensions = new ArrayList<HeldExtension>(0);
|
||||
List<HeldExtension> extensions = new ArrayList<>(0);
|
||||
List<HeldExtension> modifierExtensions = new ArrayList<>(0);
|
||||
|
||||
// Undeclared extensions
|
||||
extractUndeclaredExtensions(theElement, extensions, modifierExtensions, theChildElem, theParent);
|
||||
|
|
|
@ -132,6 +132,9 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
@Qualifier("myMedicationRequestDaoDstu3")
|
||||
protected IFhirResourceDao<MedicationRequest> myMedicationRequestDao;
|
||||
@Autowired
|
||||
@Qualifier("myMedicationStatementDaoDstu3")
|
||||
protected IFhirResourceDao<MedicationStatement> myMedicationStatementDao;
|
||||
@Autowired
|
||||
@Qualifier("myNamingSystemDaoDstu3")
|
||||
protected IFhirResourceDao<NamingSystem> myNamingSystemDao;
|
||||
@Autowired
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.junit.*;
|
||||
|
||||
|
@ -156,6 +157,38 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchOnMultivalue() throws FHIRException {
|
||||
SearchParameter displaySp = new SearchParameter();
|
||||
displaySp.addBase("MedicationStatement");
|
||||
displaySp.setCode("display");
|
||||
displaySp.setType(Enumerations.SearchParamType.STRING);
|
||||
displaySp.setTitle("Display");
|
||||
displaySp.setExpression("MedicationStatement.medication.as(CodeableConcept).coding.display");
|
||||
displaySp.setXpathUsage(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL);
|
||||
displaySp.setStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE);
|
||||
mySearchParameterDao.create(displaySp, mySrd);
|
||||
|
||||
mySearchParamRegsitry.forceRefresh();
|
||||
|
||||
MedicationStatement ms1 = new MedicationStatement();
|
||||
ms1.setMedication(new CodeableConcept());
|
||||
ms1.getMedicationCodeableConcept().addCoding().setDisplay("AAA");
|
||||
String id1 = myMedicationStatementDao.create(ms1).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
MedicationStatement ms2 = new MedicationStatement();
|
||||
ms2.setMedication(new CodeableConcept());
|
||||
ms2.getMedicationCodeableConcept().addCoding().setDisplay("BBB");
|
||||
myMedicationStatementDao.create(ms2).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
SearchParameterMap map = new SearchParameterMap();
|
||||
map.setLoadSynchronous(true);
|
||||
map.add("display", new StringParam("AAA"));
|
||||
IBundleProvider results = myMedicationStatementDao.search(map);
|
||||
assertThat(toUnqualifiedVersionlessIdValues(results), contains(id1));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchForExtensionToken() {
|
||||
SearchParameter eyeColourSp = new SearchParameter();
|
||||
|
|
Loading…
Reference in New Issue