Finalize 1.6 release
This commit is contained in:
parent
83c2e7d1fb
commit
acaf2135c5
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,32 +18,32 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
@ -54,7 +54,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
|
|
|
@ -4,21 +4,17 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.IValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.PrePopulatedValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
|
@ -106,63 +102,4 @@ public class ValidateDirectory {
|
|||
|
||||
}
|
||||
|
||||
public static class PrePopulatedValidationSupport implements IValidationSupport {
|
||||
|
||||
private Map<String, StructureDefinition> myStructureDefinitions;
|
||||
private Map<String, ValueSet> myValueSets;
|
||||
private Map<String, CodeSystem> myCodeSystems;
|
||||
|
||||
public PrePopulatedValidationSupport(Map<String, StructureDefinition> theStructureDefinitions, Map<String, ValueSet> theValueSets, Map<String, CodeSystem> theCodeSystems) {
|
||||
myStructureDefinitions = theStructureDefinitions;
|
||||
myValueSets = theValueSets;
|
||||
myCodeSystems = theCodeSystems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueSetExpansionComponent expandValueSet(FhirContext theContext, ConceptSetComponent theInclude) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext) {
|
||||
return new ArrayList<StructureDefinition>(myStructureDefinitions.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem) {
|
||||
return myCodeSystems.get(theSystem);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) {
|
||||
if (theClass.equals(StructureDefinition.class)) {
|
||||
return (T) myStructureDefinitions.get(theUri);
|
||||
}
|
||||
if (theClass.equals(ValueSet.class)) {
|
||||
return (T) myValueSets.get(theUri);
|
||||
}
|
||||
if (theClass.equals(CodeSystem.class)) {
|
||||
return (T) myCodeSystems.get(theUri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureDefinition fetchStructureDefinition(FhirContext theCtx, String theUrl) {
|
||||
return myStructureDefinitions.get(theUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCodeSystemSupported(FhirContext theContext, String theSystem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -289,5 +289,5 @@ public class ValidatorExamples {
|
|||
|
||||
// END SNIPPET: validateFiles
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package example;
|
||||
|
||||
import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.IValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
|
||||
public class ValidatorExamplesDstu3 {
|
||||
|
||||
public void validateProfileDstu3() {
|
||||
// START SNIPPET: validateFiles
|
||||
|
||||
FhirContext ctx = FhirContext.forDstu3();
|
||||
FhirValidator validator = ctx.newValidator();
|
||||
|
||||
// Typically if you are doing profile validation, you want to disable
|
||||
// the schema/schematron validation since the profile will specify
|
||||
// all the same rules (and more)
|
||||
validator.setValidateAgainstStandardSchema(false);
|
||||
validator.setValidateAgainstStandardSchematron(false);
|
||||
|
||||
// FhirInstanceValidator is the validation module that handles
|
||||
// profile validation. So, create an InstanceValidator module
|
||||
// and register it to the validator.
|
||||
FhirInstanceValidator instanceVal = new FhirInstanceValidator();
|
||||
validator.registerValidatorModule(instanceVal);
|
||||
|
||||
// FhirInstanceValidator requires an instance of "IValidationSupport" in
|
||||
// order to function. This module is used by the validator to actually obtain
|
||||
// all of the resources it needs in order to perform validation. Specifically,
|
||||
// the validator uses it to fetch StructureDefinitions, ValueSets, CodeSystems,
|
||||
// etc, as well as to perform terminology validation.
|
||||
//
|
||||
// The implementation used here (ValidationSupportChain) is allows for
|
||||
// multiple implementations to be used in a chain, where if a specific resource
|
||||
// is needed the whole chain is tried and the first module which is actually
|
||||
// able to answer is used. The first entry in the chain that we register is
|
||||
// the DefaultProfileValidationSupport, which supplies the "built-in" FHIR
|
||||
// StructureDefinitions and ValueSets
|
||||
ValidationSupportChain validationSupportChain = new ValidationSupportChain();
|
||||
validationSupportChain.addValidationSupport(new DefaultProfileValidationSupport());
|
||||
instanceVal.setValidationSupport(validationSupportChain);
|
||||
|
||||
// END SNIPPET: validateFiles
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<!--
|
||||
<exclusion>
|
||||
|
@ -51,19 +51,19 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</parent>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
@ -67,7 +67,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -21,57 +21,57 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli-jpaserver</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli-jpaserver</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>jar</type>
|
||||
<classifier>classes</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<classifier>classes</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -29,33 +29,33 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<classifier>classes</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -19,42 +19,42 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,49 +18,49 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli-app</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<!-- Don't include in standard distribution -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-android</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<!-- Don't include in standard distribution -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -19,42 +19,42 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
|
@ -38,12 +38,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
|
@ -47,32 +47,32 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -370,7 +370,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build_dstu1</id>
|
||||
|
@ -422,22 +422,22 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
|
|
@ -14,6 +14,8 @@ import java.util.Locale;
|
|||
import java.util.TimeZone;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
|
@ -25,9 +27,11 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
|||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.config.TestDstu1Config;
|
||||
|
@ -81,6 +85,8 @@ public class ResourceProviderDstu1Test extends BaseJpaTest {
|
|||
private static Server ourServer;
|
||||
private static String ourServerBase;
|
||||
private static CloseableHttpClient ourHttpClient;
|
||||
private static EntityManager ourEntityManager;
|
||||
private static PlatformTransactionManager ourTxManager;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() throws Exception {
|
||||
|
@ -542,9 +548,10 @@ public class ResourceProviderDstu1Test extends BaseJpaTest {
|
|||
ourAppCtx = new AnnotationConfigApplicationContext(TestDstu1Config.class);
|
||||
|
||||
ourDaoConfig = (DaoConfig) ourAppCtx.getBean(DaoConfig.class);
|
||||
|
||||
ourOrganizationDao = (IFhirResourceDao<Organization>) ourAppCtx.getBean("myOrganizationDaoDstu1", IFhirResourceDao.class);
|
||||
|
||||
ourEntityManager = ourAppCtx.getBean(EntityManager.class);
|
||||
ourTxManager = ourAppCtx.getBean(PlatformTransactionManager.class);
|
||||
|
||||
List<IResourceProvider> rpsDev = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDstu1", List.class);
|
||||
restServer.setResourceProviders(rpsDev);
|
||||
|
||||
|
@ -581,6 +588,12 @@ public class ResourceProviderDstu1Test extends BaseJpaTest {
|
|||
builder.setConnectionManager(connectionManager);
|
||||
ourHttpClient = builder.build();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
super.purgeDatabase(ourEntityManager, ourTxManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -31,40 +31,40 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- At least one "structures" JAR must also be included -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<classifier>classes</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,34 +18,34 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<classifier>classes</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -19,37 +19,37 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
@ -170,7 +170,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate</id>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
package org.hl7.fhir.dstu3.hapi.validation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
/**
|
||||
* This class is an implementation of {@link IValidationSupport} which may be pre-populated
|
||||
* with a collection of validation resources to be used by the validator.
|
||||
*/
|
||||
public class PrePopulatedValidationSupport implements IValidationSupport {
|
||||
|
||||
private Map<String, StructureDefinition> myStructureDefinitions;
|
||||
private Map<String, ValueSet> myValueSets;
|
||||
private Map<String, CodeSystem> myCodeSystems;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public PrePopulatedValidationSupport() {
|
||||
myStructureDefinitions = new HashMap<String,StructureDefinition>();
|
||||
myValueSets = new HashMap<String,ValueSet>();
|
||||
myCodeSystems = new HashMap<String,CodeSystem>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new StructureDefinition resource which will be available to the validator. Note that
|
||||
* {@link StructureDefinition#getUrl() the URL field) in this resource must contain a value as this
|
||||
* value will be used as the logical URL.
|
||||
*/
|
||||
public void addStructureDefinition(StructureDefinition theStructureDefinition) {
|
||||
Validate.notBlank(theStructureDefinition.getUrl(), "theStructureDefinition.getUrl() must not return a value");
|
||||
myStructureDefinitions.put(theStructureDefinition.getUrl(), theStructureDefinition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new ValueSet resource which will be available to the validator. Note that
|
||||
* {@link ValueSet#getUrl() the URL field) in this resource must contain a value as this
|
||||
* value will be used as the logical URL.
|
||||
*/
|
||||
public void addValueSet(ValueSet theValueSet) {
|
||||
Validate.notBlank(theValueSet.getUrl(), "theValueSet.getUrl() must not return a value");
|
||||
myValueSets.put(theValueSet.getUrl(), theValueSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new CodeSystem resource which will be available to the validator. Note that
|
||||
* {@link CodeSystem#getUrl() the URL field) in this resource must contain a value as this
|
||||
* value will be used as the logical URL.
|
||||
*/
|
||||
public void addCodeSystem(CodeSystem theCodeSystem) {
|
||||
Validate.notBlank(theCodeSystem.getUrl(), "theCodeSystem.getUrl() must not return a value");
|
||||
myCodeSystems.put(theCodeSystem.getUrl(), theCodeSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param theStructureDefinitions
|
||||
* The StructureDefinitions to be returned by this module. Keys are the logical URL for the resource, and
|
||||
* values are the resource itself.
|
||||
* @param theValueSets
|
||||
* The ValueSets to be returned by this module. Keys are the logical URL for the resource, and values are
|
||||
* the resource itself.
|
||||
* @param theCodeSystems
|
||||
* The CodeSystems to be returned by this module. Keys are the logical URL for the resource, and values are
|
||||
* the resource itself.
|
||||
*/
|
||||
public PrePopulatedValidationSupport(Map<String, StructureDefinition> theStructureDefinitions, Map<String, ValueSet> theValueSets, Map<String, CodeSystem> theCodeSystems) {
|
||||
myStructureDefinitions = theStructureDefinitions;
|
||||
myValueSets = theValueSets;
|
||||
myCodeSystems = theCodeSystems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueSetExpansionComponent expandValueSet(FhirContext theContext, ConceptSetComponent theInclude) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext) {
|
||||
return new ArrayList<StructureDefinition>(myStructureDefinitions.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem) {
|
||||
return myCodeSystems.get(theSystem);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) {
|
||||
if (theClass.equals(StructureDefinition.class)) {
|
||||
return (T) myStructureDefinitions.get(theUri);
|
||||
}
|
||||
if (theClass.equals(ValueSet.class)) {
|
||||
return (T) myValueSets.get(theUri);
|
||||
}
|
||||
if (theClass.equals(CodeSystem.class)) {
|
||||
return (T) myCodeSystems.get(theUri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureDefinition fetchStructureDefinition(FhirContext theCtx, String theUrl) {
|
||||
return myStructureDefinitions.get(theUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCodeSystemSupported(FhirContext theContext, String theSystem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,135 +0,0 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.hl7.fhir.dstu3.model.DateTimeType;
|
||||
import org.hl7.fhir.dstu3.model.DateType;
|
||||
import org.hl7.fhir.dstu3.model.TemporalPrecisionEnum;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class BaseDateTimeTypeDstu3Test {
|
||||
private static Locale ourDefaultLocale;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseDateTimeTypeDstu3Test.class);
|
||||
private SimpleDateFormat myDateInstantParser;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myDateInstantParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testMinutePrecisionEncode() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 3, 3, 22, 11);
|
||||
|
||||
DateTimeType date = new DateTimeType();
|
||||
date.setValue(cal.getTime(), TemporalPrecisionEnum.MINUTE);
|
||||
date.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
assertEquals("1990-01-02T21:22-05:00", date.getValueAsString());
|
||||
|
||||
date.setTimeZoneZulu(true);
|
||||
assertEquals("1990-01-03T02:22Z", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseInvalid() {
|
||||
try {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("1974-12-25+10:00");
|
||||
fail();
|
||||
} catch (ca.uhn.fhir.parser.DataFormatException e) {
|
||||
assertEquals("Invalid date/time string (invalid length): 1974-12-25+10:00", e.getMessage());
|
||||
}
|
||||
try {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("1974-12-25Z");
|
||||
fail();
|
||||
} catch (ca.uhn.fhir.parser.DataFormatException e) {
|
||||
assertEquals("Invalid date/time string (invalid length): 1974-12-25Z", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
*/
|
||||
@Test
|
||||
public void testPrecisionRespectedForSetValue() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
|
||||
cal.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
|
||||
Date time = cal.getTime();
|
||||
|
||||
DateType date = new DateType();
|
||||
date.setValue(time);
|
||||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
*/
|
||||
@Test
|
||||
public void testPrecisionRespectedForSetValueWithPrecision() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
|
||||
cal.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
|
||||
Date time = cal.getTime();
|
||||
|
||||
DateType date = new DateType();
|
||||
date.setValue(time, TemporalPrecisionEnum.DAY);
|
||||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToHumanDisplay() {
|
||||
DateTimeType dt = new DateTimeType("2012-01-05T12:00:00-08:00");
|
||||
String human = dt.toHumanDisplay();
|
||||
ourLog.info(human);
|
||||
assertThat(human, containsString("2012"));
|
||||
assertThat(human, containsString("12"));
|
||||
}
|
||||
|
||||
public static void afterClass() {
|
||||
Locale.setDefault(ourDefaultLocale);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
/*
|
||||
* We cache the default locale, but temporarily set it to a random value during this test. This helps ensure
|
||||
* that there are no language specific dependencies in the test.
|
||||
*/
|
||||
ourDefaultLocale = Locale.getDefault();
|
||||
|
||||
Locale[] available = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
|
||||
Locale newLocale = available[(int) (Math.random() * available.length)];
|
||||
Locale.setDefault(newLocale);
|
||||
|
||||
ourLog.info("Tests are running in locale: " + newLocale.getDisplayName());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +1,369 @@
|
|||
package org.hl7.fhir.dstu3.model;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.either;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.lang3.time.FastDateFormat;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
||||
public class BaseDateTimeTypeDstu3Test {
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static Locale ourDefaultLocale;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseDateTimeTypeDstu3Test.class);
|
||||
private SimpleDateFormat myDateInstantParser;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
private FastDateFormat myDateInstantZoneParser;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myDateInstantParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
myDateInstantZoneParser = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss.SSSZ", TimeZone.getTimeZone("GMT-02:00"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseInvalidZoneOffset() {
|
||||
public void setTimezoneToZulu() {
|
||||
DateTimeType dt = new DateTimeType(new Date(816411488000L));
|
||||
// assertEquals("1995-11-14T23:58:08", dt.getValueAsString());
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("1995-11-15T04:58:08Z", dt.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for #57
|
||||
*/
|
||||
@Test
|
||||
public void testConstructorRejectsInvalidPrecision() {
|
||||
try {
|
||||
new DateTimeType("2010-01-01T00:00:00.1234-09:00Z");
|
||||
new DateType("2001-01-02T11:13:33");
|
||||
fail();
|
||||
} catch (DataFormatException e) {
|
||||
assertEquals("Invalid FHIR date/time string: 2010-01-01T00:00:00.1234-09:00Z", e.getMessage());
|
||||
assertThat(e.getMessage(), containsString("precision"));
|
||||
}
|
||||
try {
|
||||
new InstantType("2001-01-02");
|
||||
fail();
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.getMessage(), containsString("precision"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateFormatsInvalid() {
|
||||
// No spaces in dates
|
||||
verifyFails("1974 12-25");
|
||||
verifyFails("1974-12 25");
|
||||
|
||||
// No letters
|
||||
verifyFails("A974-12-25");
|
||||
verifyFails("1974-A2-25");
|
||||
verifyFails("1974-12-A5");
|
||||
|
||||
// Date shouldn't have a time zone
|
||||
verifyFails("1974-12-25Z");
|
||||
verifyFails("1974-12-25+10:00");
|
||||
|
||||
// Out of range
|
||||
verifyFails("1974-13-25");
|
||||
verifyFails("1974-12-32");
|
||||
verifyFails("2015-02-29");
|
||||
verifyFails("-016-02-01");
|
||||
verifyFails("2016--2-01");
|
||||
verifyFails("2016-02--1");
|
||||
|
||||
// Invalid length
|
||||
verifyFails("2");
|
||||
verifyFails("20");
|
||||
verifyFails("201");
|
||||
verifyFails("2016-0");
|
||||
verifyFails("2016-02-0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for #57
|
||||
*/
|
||||
@Test
|
||||
public void testDateParsesWithInvalidPrecision() {
|
||||
Condition c = new Condition();
|
||||
c.setDateRecordedElement(new DateType());
|
||||
c.getDateRecordedElement().setValueAsString("2001-01-02T11:13:33");
|
||||
assertEquals(TemporalPrecisionEnum.SECOND, c.getDateRecordedElement().getPrecision());
|
||||
|
||||
String encoded = ourCtx.newXmlParser().encodeResourceToString(c);
|
||||
Assert.assertThat(encoded, Matchers.containsString("value=\"2001-01-02T11:13:33\""));
|
||||
|
||||
c = ourCtx.newXmlParser().parseResource(Condition.class, encoded);
|
||||
|
||||
assertEquals("2001-01-02T11:13:33", c.getDateRecordedElement().getValueAsString());
|
||||
assertEquals(TemporalPrecisionEnum.SECOND, c.getDateRecordedElement().getPrecision());
|
||||
|
||||
ValidationResult outcome = ourCtx.newValidator().validateWithResult(c);
|
||||
String outcomeStr = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.toOperationOutcome());
|
||||
ourLog.info(outcomeStr);
|
||||
|
||||
assertThat(outcomeStr, containsString("date-primitive"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateTimeFormatsInvalid() {
|
||||
// Bad timezone
|
||||
verifyFails("1974-12-01T00:00:00A");
|
||||
verifyFails("1974-12-01T00:00:00=00:00");
|
||||
verifyFails("1974-12-01T00:00:00+");
|
||||
verifyFails("1974-12-01T00:00:00+25:00");
|
||||
verifyFails("1974-12-01T00:00:00+00:61");
|
||||
verifyFails("1974-12-01T00:00:00+00 401");
|
||||
verifyFails("1974-12-01T00:00:00+0");
|
||||
verifyFails("1974-12-01T00:00:00+01");
|
||||
verifyFails("1974-12-01T00:00:00+011");
|
||||
verifyFails("1974-12-01T00:00:00+0110");
|
||||
|
||||
// Out of range
|
||||
verifyFails("1974-12-25T25:00:00Z");
|
||||
verifyFails("1974-12-25T24:00:00Z");
|
||||
verifyFails("1974-12-25T23:60:00Z");
|
||||
verifyFails("1974-12-25T23:59:60Z");
|
||||
|
||||
// Invalid Separators
|
||||
verifyFails("1974-12-25T23 59:00Z");
|
||||
verifyFails("1974-12-25T23:59 00Z");
|
||||
|
||||
// Invalid length
|
||||
verifyFails("1974-12-25T2Z");
|
||||
verifyFails("1974-12-25T22:Z");
|
||||
verifyFails("1974-12-25T22:1Z");
|
||||
verifyFails("1974-12-25T22:11:Z");
|
||||
verifyFails("1974-12-25T22:11:1Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateTimeFormatsInvalidMillis() {
|
||||
verifyFails("1974-12-01T00:00:00.AZ");
|
||||
verifyFails("1974-12-01T00:00:00.-Z");
|
||||
verifyFails("1974-12-01T00:00:00.-1Z");
|
||||
verifyFails("1974-12-01T00:00:00..1111Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateTimeInLocalTimezone() {
|
||||
DateTimeType dt = DateTimeType.now();
|
||||
String str = dt.getValueAsString();
|
||||
char offset = str.charAt(19);
|
||||
if (offset != '+' && offset != '-' && offset != 'Z') {
|
||||
fail("No timezone provided: " + str);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeOffset() throws Exception {
|
||||
String offset = InstantType.withCurrentTime().setTimeZone(TimeZone.getTimeZone("America/Toronto")).getValueAsString();
|
||||
assertThat(offset, either(endsWith("-05:00")).or(endsWith("-04:00")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeZeroOffset() {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2011-01-01T12:00:00-04:00");
|
||||
dt.setTimeZone(TimeZone.getTimeZone("GMT-0:00"));
|
||||
|
||||
String val = dt.getValueAsString();
|
||||
assertEquals("2011-01-01T16:00:00+00:00", val);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFromTime() {
|
||||
long millis;
|
||||
|
||||
millis = 1466022208001L;
|
||||
String expected = "2016-06-15T20:23:28.001Z";
|
||||
validate(millis, expected);
|
||||
|
||||
millis = 1466022208123L;
|
||||
expected = "2016-06-15T20:23:28.123Z";
|
||||
validate(millis, expected);
|
||||
|
||||
millis = 1466022208100L;
|
||||
expected = "2016-06-15T20:23:28.100Z";
|
||||
validate(millis, expected);
|
||||
|
||||
millis = 1466022208000L;
|
||||
expected = "2016-06-15T20:23:28.000Z";
|
||||
validate(millis, expected);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPartials() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
assertEquals(2011, dt.getYear().intValue());
|
||||
assertEquals(2, dt.getMonth().intValue());
|
||||
assertEquals(11, dt.getDay().intValue());
|
||||
assertEquals(15, dt.getHour().intValue());
|
||||
assertEquals(44, dt.getMinute().intValue());
|
||||
assertEquals(13, dt.getSecond().intValue());
|
||||
assertEquals(275, dt.getMillis().intValue());
|
||||
assertEquals(275647578L, dt.getNanos().longValue());
|
||||
|
||||
dt = new InstantType();
|
||||
assertEquals(null, dt.getYear());
|
||||
assertEquals(null, dt.getMonth());
|
||||
assertEquals(null, dt.getDay());
|
||||
assertEquals(null, dt.getHour());
|
||||
assertEquals(null, dt.getMinute());
|
||||
assertEquals(null, dt.getSecond());
|
||||
assertEquals(null, dt.getMillis());
|
||||
assertEquals(null, dt.getNanos());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValueAsCalendar() {
|
||||
assertNull(new InstantType().getValueAsCalendar());
|
||||
|
||||
InstantType dt = new InstantType("2011-01-03T07:11:22.002-08:00");
|
||||
GregorianCalendar cal = dt.getValueAsCalendar();
|
||||
|
||||
assertEquals(2011, cal.get(Calendar.YEAR));
|
||||
assertEquals(7, cal.get(Calendar.HOUR_OF_DAY));
|
||||
assertEquals(2, cal.get(Calendar.MILLISECOND));
|
||||
assertEquals("GMT-08:00", cal.getTimeZone().getID());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstantInLocalTimezone() {
|
||||
InstantType dt = InstantType.withCurrentTime();
|
||||
String str = dt.getValueAsString();
|
||||
char offset = str.charAt(23);
|
||||
if (offset != '+' && offset != '-' && offset != 'Z') {
|
||||
fail("No timezone provided: " + str);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargePrecision() {
|
||||
DateTimeType dt = new DateTimeType("2014-03-06T22:09:58.9121174+04:30");
|
||||
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("Z"));
|
||||
assertEquals("2014-03-06 17:39:58.912", myDateInstantParser.format(dt.getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutePrecisionEncode() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 3, 3, 22, 11);
|
||||
|
||||
DateTimeType date = new DateTimeType();
|
||||
date.setValue(cal.getTime(), TemporalPrecisionEnum.MINUTE);
|
||||
date.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
assertEquals("1990-01-02T21:22-05:00", date.getValueAsString());
|
||||
|
||||
date.setTimeZoneZulu(true);
|
||||
assertEquals("1990-01-03T02:22Z", date.getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testNewInstance() throws InterruptedException {
|
||||
InstantType now = InstantType.withCurrentTime();
|
||||
Thread.sleep(100);
|
||||
InstantType then = InstantType.withCurrentTime();
|
||||
assertTrue(now.getValue().before(then.getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseDate() {
|
||||
new DateType("2012-03-31");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseDay() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013-02-03");
|
||||
|
||||
assertEquals("2013-02-03", myDateInstantParser.format(dt.getValue()).substring(0, 10));
|
||||
assertEquals("2013-02-03", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertNull(dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.DAY, dt.getPrecision());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #381
|
||||
*/
|
||||
@Test
|
||||
public void testParseFailsForInvalidDate() {
|
||||
try {
|
||||
DateTimeType dt = new DateTimeType("9999-13-01");
|
||||
fail(dt.getValue().toString());
|
||||
} catch (DataFormatException e) {
|
||||
// good
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseHandlesMillis() {
|
||||
InstantType dt = new InstantType();
|
||||
dt.setValueAsString("2015-06-22T15:44:32.831-04:00");
|
||||
Date date = dt.getValue();
|
||||
|
||||
InstantType dt2 = new InstantType();
|
||||
dt2.setValue(date);
|
||||
dt2.setTimeZoneZulu(true);
|
||||
String string = dt2.getValueAsString();
|
||||
|
||||
assertEquals("2015-06-22T19:44:32.831Z", string);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseHandlesMillisPartial() {
|
||||
// .12 should be 120ms
|
||||
validateMillisPartial("2015-06-22T00:00:00.1Z", 100);
|
||||
validateMillisPartial("2015-06-22T00:00:00.12Z", 120);
|
||||
validateMillisPartial("2015-06-22T00:00:00.123Z", 123);
|
||||
validateMillisPartial("2015-06-22T00:00:00.1234Z", 123);
|
||||
validateMillisPartial("2015-06-22T00:00:00.01Z", 10);
|
||||
validateMillisPartial("2015-06-22T00:00:00.012Z", 12);
|
||||
validateMillisPartial("2015-06-22T00:00:00.0123Z", 12);
|
||||
validateMillisPartial("2015-06-22T00:00:00.001Z", 1);
|
||||
validateMillisPartial("2015-06-22T00:00:00.0012Z", 1);
|
||||
validateMillisPartial("2015-06-22T00:00:00.00123Z", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Just to be lenient
|
||||
*/
|
||||
@Test
|
||||
public void testParseIgnoresLeadingAndTrailingSpace() {
|
||||
DateTimeType dt = new DateTimeType(" 2014-10-11T12:11:00Z ");
|
||||
assertEquals("2014-10-11 10:11:00.000-0200", myDateInstantZoneParser.format(dt.getValue()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseInvalid() {
|
||||
try {
|
||||
|
@ -51,28 +371,133 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
dt.setValueAsString("1974-12-25+10:00");
|
||||
fail();
|
||||
} catch (ca.uhn.fhir.parser.DataFormatException e) {
|
||||
assertEquals("Invalid date/time string (invalid length): 1974-12-25+10:00", e.getMessage());
|
||||
assertEquals("Invalid date/time format: \"1974-12-25+10:00\"", e.getMessage());
|
||||
}
|
||||
try {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("1974-12-25Z");
|
||||
fail();
|
||||
} catch (ca.uhn.fhir.parser.DataFormatException e) {
|
||||
assertEquals("Invalid date/time string (invalid length): 1974-12-25Z", e.getMessage());
|
||||
assertEquals("Invalid date/time format: \"1974-12-25Z\"", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseInvalidZoneOffset() {
|
||||
try {
|
||||
new DateTimeType("2010-01-01T00:00:00.1234-09:00Z");
|
||||
fail();
|
||||
} catch (DataFormatException e) {
|
||||
assertEquals("Invalid date/time format: \"2010-01-01T00:00:00.1234-09:00Z\"", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = DataFormatException.class)
|
||||
public void testParseMalformatted() throws DataFormatException {
|
||||
new DateTimeType("20120102");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseMilli() throws DataFormatException {
|
||||
InstantType dt = new InstantType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33.234");
|
||||
|
||||
assertEquals("2013-02-03 11:22:33.234", myDateInstantParser.format(dt.getValue()).substring(0, 23));
|
||||
assertEquals("2013-02-03T11:22:33.234", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertNull(dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseMilliZone() throws DataFormatException {
|
||||
InstantType dt = new InstantType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33.234-02:00");
|
||||
|
||||
assertEquals("2013-02-03 11:22:33.234-0200", myDateInstantZoneParser.format(dt.getValue()));
|
||||
assertEquals("2013-02-03T11:22:33.234-02:00", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertEquals(TimeZone.getTimeZone("GMT-02:00"), dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseMilliZulu() throws DataFormatException {
|
||||
InstantType dt = new InstantType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33.234Z");
|
||||
|
||||
assertEquals("2013-02-03 09:22:33.234-0200", myDateInstantZoneParser.format(dt.getValue()));
|
||||
assertEquals("2013-02-03T11:22:33.234Z", dt.getValueAsString());
|
||||
assertEquals(true, dt.isTimeZoneZulu());
|
||||
assertEquals("GMT", dt.getTimeZone().getID());
|
||||
assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseMonth() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013-02");
|
||||
|
||||
ourLog.info("Date: {}", dt.getValue());
|
||||
assertEquals("2013-02", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertNull(dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.MONTH, dt.getPrecision());
|
||||
|
||||
assertEquals("2013-02", myDateInstantParser.format(dt.getValue()).substring(0, 7));
|
||||
}
|
||||
|
||||
@Test(expected = DataFormatException.class)
|
||||
public void testParseMonthNoDashes() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("201302");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSecond() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33");
|
||||
|
||||
assertEquals("2013-02-03 11:22:33", myDateInstantParser.format(dt.getValue()).substring(0, 19));
|
||||
assertEquals("2013-02-03T11:22:33", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertNull(dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSecondulu() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33Z");
|
||||
|
||||
assertEquals("2013-02-03T11:22:33Z", dt.getValueAsString());
|
||||
assertEquals(true, dt.isTimeZoneZulu());
|
||||
assertEquals("GMT", dt.getTimeZone().getID());
|
||||
assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSecondZone() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013-02-03T11:22:33-02:00");
|
||||
|
||||
assertEquals("2013-02-03T11:22:33-02:00", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertEquals(TimeZone.getTimeZone("GMT-02:00"), dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly0millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.000", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00Z", dt.getValueAsString());
|
||||
}
|
||||
|
@ -80,44 +505,44 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly1millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00.1-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00.1-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.001", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("2010-01-01 04:00:00.100", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00.001Z", dt.getValueAsString());
|
||||
assertEquals("2010-01-01T09:00:00.100Z", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly2millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00.12-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00.12-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.012", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("2010-01-01 04:00:00.120", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00.012Z", dt.getValueAsString());
|
||||
assertEquals("2010-01-01T09:00:00.120Z", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly3millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00.123-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00.123-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.123", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00.123Z", dt.getValueAsString());
|
||||
}
|
||||
|
@ -125,31 +550,58 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly4millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00.1234-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00.1234-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.123", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00.123Z", dt.getValueAsString());
|
||||
assertEquals("2010-01-01T09:00:00.1234Z", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseTimeZoneOffsetCorrectly5millis() {
|
||||
myDateInstantParser.setTimeZone(TimeZone.getTimeZone("America/Toronto"));
|
||||
|
||||
|
||||
DateTimeType dt = new DateTimeType("2010-01-01T00:00:00.12345-09:00");
|
||||
|
||||
|
||||
assertEquals("2010-01-01T00:00:00.12345-09:00", dt.getValueAsString());
|
||||
assertEquals("2010-01-01 04:00:00.123", myDateInstantParser.format(dt.getValue()));
|
||||
assertEquals("GMT-09:00", dt.getTimeZone().getID());
|
||||
assertEquals(-32400000L, dt.getTimeZone().getRawOffset());
|
||||
|
||||
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals("2010-01-01T09:00:00.123Z", dt.getValueAsString());
|
||||
assertEquals("2010-01-01T09:00:00.12345Z", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseYear() throws DataFormatException {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString("2013");
|
||||
|
||||
assertEquals("2013", myDateInstantParser.format(dt.getValue()).substring(0, 4));
|
||||
assertEquals("2013", dt.getValueAsString());
|
||||
assertEquals(false, dt.isTimeZoneZulu());
|
||||
assertNull(dt.getTimeZone());
|
||||
assertEquals(TemporalPrecisionEnum.YEAR, dt.getPrecision());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #101
|
||||
*/
|
||||
@Test
|
||||
public void testPrecision() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
|
||||
cal.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.setBirthDateElement(new DateType(cal.getTime(), TemporalPrecisionEnum.DAY));
|
||||
String out = ourCtx.newXmlParser().encodeResourceToString(patient);
|
||||
assertThat(out, containsString("<birthDate value=\"2012-01-02\"/>"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,20 +620,7 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutePrecisionEncode() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 3, 3, 22, 11);
|
||||
|
||||
DateTimeType date = new DateTimeType();
|
||||
date.setValue(cal.getTime(), TemporalPrecisionEnum.MINUTE);
|
||||
date.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
assertEquals("1990-01-02T21:22-05:00", date.getValueAsString());
|
||||
|
||||
date.setTimeZoneZulu(true);
|
||||
assertEquals("1990-01-03T02:22Z", date.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
|
@ -199,6 +638,116 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetPartialsDayFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setDay(15);
|
||||
assertEquals(15, dt.getDay().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-15T15:44:13.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsHourFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setHour(23);
|
||||
assertEquals(23, dt.getHour().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-11T23:44:13.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsInvalid() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setNanos(0);
|
||||
dt.setNanos(BaseDateTimeType.NANOS_PER_SECOND - 1);
|
||||
try {
|
||||
dt.setNanos(BaseDateTimeType.NANOS_PER_SECOND);
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertEquals("Value 1000000000 is not between allowable range: 0 - 999999999", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsMillisFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setMillis(12);
|
||||
assertEquals(12, dt.getMillis().intValue());
|
||||
assertEquals(12 * BaseDateTimeType.NANOS_PER_MILLIS, dt.getNanos().longValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-11T15:44:13.012-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsMinuteFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setMinute(54);
|
||||
assertEquals(54, dt.getMinute().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-11T15:54:13.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsMonthFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setMonth(3);
|
||||
assertEquals(3, dt.getMonth().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-04-11T15:44:13.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsNanosFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setNanos(100000000L);
|
||||
assertEquals(100000000L, dt.getNanos().longValue());
|
||||
assertEquals(100, dt.getMillis().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-11T15:44:13.100-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsSecondFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setSecond(1);
|
||||
assertEquals(1, dt.getSecond().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2011-03-11T15:44:01.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPartialsYearFromExisting() {
|
||||
InstantType dt = new InstantType("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setYear(2016);
|
||||
assertEquals(2016, dt.getYear().intValue());
|
||||
String valueAsString = dt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
assertEquals("2016-03-11T15:44:13.27564757855254768473697463986328969635-08:00", valueAsString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetValueByString() {
|
||||
InstantType i = new InstantType();
|
||||
i.setValueAsString("2014-06-20T20:22:09Z");
|
||||
|
||||
assertNotNull(i.getValue());
|
||||
assertNotNull(i.getValueAsString());
|
||||
|
||||
assertEquals(1403295729000L, i.getValue().getTime());
|
||||
assertEquals("2014-06-20T20:22:09Z", i.getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testToHumanDisplay() {
|
||||
DateTimeType dt = new DateTimeType("2012-01-05T12:00:00-08:00");
|
||||
|
@ -208,4 +757,64 @@ public class BaseDateTimeTypeDstu3Test {
|
|||
assertThat(human, containsString("12"));
|
||||
}
|
||||
|
||||
private void validate(long millis, String expected) {
|
||||
InstantType dt;
|
||||
dt = new InstantType(new Date(millis));
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals(expected, dt.getValueAsString());
|
||||
|
||||
assertEquals(millis % 1000, dt.getMillis().longValue());
|
||||
assertEquals((millis % 1000) * BaseDateTimeType.NANOS_PER_MILLIS, dt.getNanos().longValue());
|
||||
|
||||
dt = new InstantType();
|
||||
dt.setTimeZone(TimeZone.getTimeZone("GMT+0:00"));
|
||||
dt.setValue(new Date(millis));
|
||||
assertEquals(expected.replace("Z", "+00:00"), dt.getValueAsString());
|
||||
}
|
||||
|
||||
private void validateMillisPartial(String input, int expected) {
|
||||
InstantType dt = new InstantType();
|
||||
dt.setValueAsString(input);
|
||||
Date date = dt.getValue();
|
||||
|
||||
assertEquals(expected, date.getTime() % 1000);
|
||||
}
|
||||
|
||||
private void verifyFails(String input) {
|
||||
try {
|
||||
DateTimeType dt = new DateTimeType();
|
||||
dt.setValueAsString(input);
|
||||
fail();
|
||||
} catch (ca.uhn.fhir.parser.DataFormatException e) {
|
||||
assertThat(e.getMessage(), containsString("Invalid date/time format: \"" + input + "\""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void afterClass() {
|
||||
Locale.setDefault(ourDefaultLocale);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
/*
|
||||
* We cache the default locale, but temporarily set it to a random value during this test. This helps ensure that
|
||||
* there are no language specific dependencies in the test.
|
||||
*/
|
||||
ourDefaultLocale = Locale.getDefault();
|
||||
|
||||
Locale[] available = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
|
||||
Locale newLocale = available[(int) (Math.random() * available.length)];
|
||||
Locale.setDefault(newLocale);
|
||||
|
||||
ourLog.info("Tests are running in locale: " + newLocale.getDisplayName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -27,27 +27,27 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<!--<dependency> <groupId>ca.uhn.hapi.fhir</groupId> <artifactId>hapi-fhir-structures-dev</artifactId> <version>0.9</version> </dependency> -->
|
||||
<dependency>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Because Tinder is a part of the HAPI FHIR build process (it generates
|
||||
|
@ -56,7 +56,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>custom-structs</id>
|
||||
|
@ -139,7 +139,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
@ -183,17 +183,17 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<name>HAPI-FHIR</name>
|
||||
<url>https://github.com/jamesagnew/hapi-fhir</url>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -33,27 +33,27 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<!-- At least one "structures" JAR must also be included -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6</version>
|
||||
<classifier>classes</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
Loading…
Reference in New Issue