Cherry picked changes from master to 3.5.0 branch
This commit is contained in:
parent
3082d5f2db
commit
7097526f81
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<artifactId>hapi-fhir-converter</artifactId>
|
<artifactId>hapi-fhir-converter</artifactId>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
<version>3.5.1-PHRFIX-SNAPSHOT</version>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-client</artifactId>
|
<artifactId>hapi-fhir-client</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<artifactId>hapi-fhir-validation</artifactId>
|
<artifactId>hapi-fhir-validation</artifactId>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
<version>3.5.1-PHRFIX-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>HAPI FHIR - Validation</name>
|
<name>HAPI FHIR - Validation</name>
|
||||||
|
|
||||||
|
@ -18,17 +19,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
<artifactId>hapi-fhir-base</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-utilities</artifactId>
|
<artifactId>hapi-fhir-utilities</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-converter</artifactId>
|
<artifactId>hapi-fhir-converter</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.1-PHRFIX-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -63,49 +64,49 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dstu2.1</artifactId>
|
<artifactId>hapi-fhir-structures-dstu2.1</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-r4</artifactId>
|
<artifactId>hapi-fhir-structures-r4</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
|
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -118,13 +119,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-server</artifactId>
|
<artifactId>hapi-fhir-server</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-client</artifactId>
|
<artifactId>hapi-fhir-client</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>3.5.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -309,9 +309,9 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
||||||
public void testRequiredQuestionWithEnableWhenHdesQuestionHasAnswerTrue() {
|
public void testRequiredQuestionWithEnableWhenHdesQuestionHasAnswerTrue() {
|
||||||
|
|
||||||
Questionnaire q = new Questionnaire();
|
Questionnaire q = new Questionnaire();
|
||||||
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING);
|
q.addItem().setLinkId("link0").setRequired(true).setType(QuestionnaireItemType.STRING);
|
||||||
|
|
||||||
//link1 question is enabled when link0 has answer
|
// create the questionnaire
|
||||||
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
|
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
|
||||||
item1.setLinkId("link1").setRequired(true);
|
item1.setLinkId("link1").setRequired(true);
|
||||||
q.addItem(item1);
|
q.addItem(item1);
|
||||||
|
@ -320,9 +320,11 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
||||||
enable.setQuestion("link0");
|
enable.setQuestion("link0");
|
||||||
enable.setHasAnswer(true);
|
enable.setHasAnswer(true);
|
||||||
|
|
||||||
|
|
||||||
QuestionnaireResponse qa = new QuestionnaireResponse();
|
QuestionnaireResponse qa = new QuestionnaireResponse();
|
||||||
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
|
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
|
||||||
qa.getQuestionnaire().setReference("http://example.com/Questionnaire/q1");
|
qa.getQuestionnaire().setReference("http://example.com/Questionnaire/q1");
|
||||||
|
qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("FOO"));
|
||||||
|
|
||||||
String reference = qa.getQuestionnaire().getReference();
|
String reference = qa.getQuestionnaire().getReference();
|
||||||
when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q);
|
when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q);
|
||||||
|
@ -332,6 +334,34 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
||||||
assertThat(errors.toString(), containsString("No issues"));
|
assertThat(errors.toString(), containsString("No issues"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRequiredQuestionWithEnableWhenHidesQuestion() {
|
||||||
|
|
||||||
|
Questionnaire q = new Questionnaire();
|
||||||
|
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING);
|
||||||
|
|
||||||
|
// create the questionnaire
|
||||||
|
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
|
||||||
|
item1.setLinkId("link1").setRequired(true);
|
||||||
|
q.addItem(item1);
|
||||||
|
QuestionnaireItemEnableWhenComponent enable = new QuestionnaireItemEnableWhenComponent();
|
||||||
|
item1.addEnableWhen(enable);
|
||||||
|
enable.setQuestion("link0");
|
||||||
|
enable.setHasAnswer(true);
|
||||||
|
|
||||||
|
|
||||||
|
QuestionnaireResponse qa = new QuestionnaireResponse();
|
||||||
|
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
|
||||||
|
qa.getQuestionnaire().setReference("http://example.com/Questionnaire/q1");
|
||||||
|
//qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("FOO"));
|
||||||
|
|
||||||
|
String reference = qa.getQuestionnaire().getReference();
|
||||||
|
when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q);
|
||||||
|
ValidationResult errors = myVal.validateWithResult(qa);
|
||||||
|
|
||||||
|
ourLog.info(errors.toString());
|
||||||
|
assertThat(errors.toString(), containsString("No issues"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRequiredQuestionWithEnableWhenHasAnswerTrueWithAnswer() {
|
public void testRequiredQuestionWithEnableWhenHasAnswerTrueWithAnswer() {
|
||||||
|
@ -364,10 +394,12 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRequiredQuestionWithEnableWhenHidesRequiredQuestionnHasAnswerFalse() {
|
public void testRequiredQuestionWithEnableWheHidesRequiredQuestionnHasAnswerFalse() {
|
||||||
|
|
||||||
Questionnaire q = new Questionnaire();
|
Questionnaire q = new Questionnaire();
|
||||||
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING);
|
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING);
|
||||||
|
|
||||||
|
// create the questionnaire
|
||||||
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
|
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
|
||||||
item1.setLinkId("link1").setRequired(true);
|
item1.setLinkId("link1").setRequired(true);
|
||||||
q.addItem(item1);
|
q.addItem(item1);
|
||||||
|
|
Loading…
Reference in New Issue