Added test demonstrating that using the same extension in 2 different resources causes the profile extension scanner to throw up its hands in despair

This commit is contained in:
b.debeaubien 2014-12-10 10:24:04 -05:00
parent c4c26e482f
commit 84ecec2835
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,71 @@
package ca.uhn.fhir.context;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.primitive.StringDt;
import junit.framework.TestCase;
import org.junit.Ignore;
import org.junit.Test;
/**
* Created by Bill de Beaubien on 12/10/2014.
*/
public class DuplicateExtensionTest extends TestCase {
@Test
public void testScannerShouldAddProvidedResources() {
// FhirContext ctx = new FhirContext();
// RuntimeResourceDefinition patientDef = ctx.getResourceDefinition(CustomPatient.class);
// patientDef.toProfile();
//
// RuntimeResourceDefinition observationDef = ctx.getResourceDefinition(CustomObservation.class);
// observationDef.toProfile();
}
@ProvidesResources(resources = CustomObservation.class)
class CustomObservationProvider {
}
@ProvidesResources(resources = CustomPatient.class)
class CustomPatientProvider {
}
@ResourceDef(name = "Patient", id = "CustomPatient")
class CustomPatient extends Patient {
@Child(name="idExt", order = 0)
@Extension(url= "http://foo.org#id", definedLocally=true, isModifier=false)
@Description(shortDefinition = "Contains the id of the resource")
private StringDt myIdExt;
public StringDt getIdExt() {
if (myIdExt == null) {
myIdExt = new StringDt();
}
return myIdExt;
}
public void setIdExt(StringDt theIdExt) {
myIdExt = theIdExt;
}
}
@ResourceDef(name = "Observation", id = "CustomObservation")
class CustomObservation extends Observation {
@Child(name="idExt", order = 0)
@Extension(url= "http://foo.org#id", definedLocally=true, isModifier=false)
@Description(shortDefinition = "Contains the id of the resource")
private StringDt myIdExt;
public StringDt getIdExt() {
if (myIdExt == null) {
myIdExt = new StringDt();
}
return myIdExt;
}
public void setIdExt(StringDt theIdExt) {
myIdExt = theIdExt;
}
}
}

View File

@ -114,6 +114,11 @@
<name>Tahura Chaudhry</name>
<organization>University Health Network</organization>
</developer>
<developer>
<id>b.debeaubien</id>
<name>Bill de Beaubien</name>
<organization>Systems Made Simple</organization>
</developer>
</developers>
<licenses>