Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
36ed5d8984
|
@ -19,7 +19,7 @@ before_script:
|
|||
- export MAVEN_SKIP_RC=true
|
||||
|
||||
script:
|
||||
# - mvn -e -B clean install && cd hapi-fhir-cobertura && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
|
||||
- mvn -e -B clean install && cd hapi-fhir-cobertura && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID -P COBERTURA clean cobertura:cobertura coveralls:report
|
||||
# - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
|
||||
- mvn -e -B clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
|
||||
|
||||
|
||||
|
|
|
@ -138,6 +138,34 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Date;
|
|||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.apache.commons.lang3.time.FastDateFormat;
|
||||
|
@ -16,14 +17,15 @@ import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
|||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
||||
static final long NANOS_PER_MILLIS = 1000000L;
|
||||
static final long NANOS_PER_SECOND = 1000000000L;
|
||||
|
||||
private static final FastDateFormat ourHumanDateFormat = FastDateFormat.getDateInstance(FastDateFormat.MEDIUM);
|
||||
private static final FastDateFormat ourHumanDateTimeFormat = FastDateFormat.getDateTimeInstance(FastDateFormat.MEDIUM, FastDateFormat.MEDIUM);
|
||||
|
||||
private String myFractionalSeconds;
|
||||
private TemporalPrecisionEnum myPrecision = TemporalPrecisionEnum.SECOND;
|
||||
private TemporalPrecisionEnum myPrecision = null;
|
||||
private TimeZone myTimeZone;
|
||||
|
||||
private boolean myTimeZoneZulu = false;
|
||||
|
||||
/**
|
||||
|
@ -186,11 +188,13 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
if (getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
cal.setTime(getValue());
|
||||
GregorianCalendar cal;
|
||||
if (getTimeZone() != null) {
|
||||
cal.setTimeZone(getTimeZone());
|
||||
cal = new GregorianCalendar(getTimeZone());
|
||||
} else {
|
||||
cal = new GregorianCalendar();
|
||||
}
|
||||
cal.setTime(getValue());
|
||||
return cal;
|
||||
}
|
||||
|
||||
|
@ -199,6 +203,9 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
*/
|
||||
abstract boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision);
|
||||
|
||||
/**
|
||||
* Returns true if the timezone is set to GMT-0:00 (Z)
|
||||
*/
|
||||
public boolean isTimeZoneZulu() {
|
||||
return myTimeZoneZulu;
|
||||
}
|
||||
|
@ -229,7 +236,7 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
String value = theValue;
|
||||
boolean fractionalSecondsSet = false;
|
||||
|
||||
if (value.length() > 0 && (value.charAt(0) == ' ' || value.charAt(value.length()-1) == ' ')) {
|
||||
if (value.length() > 0 && (value.charAt(0) == ' ' || value.charAt(value.length() - 1) == ' ')) {
|
||||
value = value.trim();
|
||||
}
|
||||
|
||||
|
@ -394,12 +401,12 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
|
||||
/**
|
||||
* Sets the value for this type using the given Java Date object as the time, and using the default precision for
|
||||
* this datatype, as well as the local timezone as determined by the local operating
|
||||
* this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating
|
||||
* system. Both of these properties may be modified in subsequent calls if neccesary.
|
||||
*/
|
||||
@Override
|
||||
public BaseDateTimeDt setValue(Date theValue) {
|
||||
setValue(theValue, getDefaultPrecisionForDatatype());
|
||||
setValue(theValue, getPrecision());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -415,11 +422,14 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
* @throws DataFormatException
|
||||
*/
|
||||
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException {
|
||||
if (getTimeZone() == null) {
|
||||
setTimeZone(TimeZone.getDefault());
|
||||
}
|
||||
myPrecision = thePrecision;
|
||||
myFractionalSeconds = "";
|
||||
if (theValue != null) {
|
||||
myFractionalSeconds = Integer.toString((int) (theValue.getTime() % 1000));
|
||||
String fractionalSeconds = Integer.toString((int) (theValue.getTime() % 1000));
|
||||
myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0');
|
||||
}
|
||||
super.setValue(theValue);
|
||||
}
|
||||
|
@ -490,11 +500,195 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateLengthIsAtLeast(String theValue, int theLength) {
|
||||
if (theValue.length() < theLength) {
|
||||
throwBadDateFormat(theValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the year, e.g. 2015
|
||||
*/
|
||||
public Integer getYear() {
|
||||
return getFieldValue(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the month with 0-index, e.g. 0=January
|
||||
*/
|
||||
public Integer getMonth() {
|
||||
return getFieldValue(Calendar.MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the month with 1-index, e.g. 1=the first day of the month
|
||||
*/
|
||||
public Integer getDay() {
|
||||
return getFieldValue(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hour of the day in a 24h clock, e.g. 13=1pm
|
||||
*/
|
||||
public Integer getHour() {
|
||||
return getFieldValue(Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minute of the hour in the range 0-59
|
||||
*/
|
||||
public Integer getMinute() {
|
||||
return getFieldValue(Calendar.MINUTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the second of the minute in the range 0-59
|
||||
*/
|
||||
public Integer getSecond() {
|
||||
return getFieldValue(Calendar.SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the milliseconds within the current second.
|
||||
* <p>
|
||||
* Note that this method returns the
|
||||
* same value as {@link #getNanos()} but with less precision.
|
||||
* </p>
|
||||
*/
|
||||
public Integer getMillis() {
|
||||
return getFieldValue(Calendar.MILLISECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nanoseconds within the current second
|
||||
* <p>
|
||||
* Note that this method returns the
|
||||
* same value as {@link #getMillis()} but with more precision.
|
||||
* </p>
|
||||
*/
|
||||
public Long getNanos() {
|
||||
if (isBlank(myFractionalSeconds)) {
|
||||
return null;
|
||||
}
|
||||
String retVal = StringUtils.rightPad(myFractionalSeconds, 9, '0');
|
||||
retVal = retVal.substring(0, 9);
|
||||
return Long.parseLong(retVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the year, e.g. 2015
|
||||
*/
|
||||
public BaseDateTimeDt setYear(int theYear) {
|
||||
setFieldValue(Calendar.YEAR, theYear, null, 0, 9999);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the month with 0-index, e.g. 0=January
|
||||
*/
|
||||
public BaseDateTimeDt setMonth(int theMonth) {
|
||||
setFieldValue(Calendar.MONTH, theMonth, null, 0, 11);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the month with 1-index, e.g. 1=the first day of the month
|
||||
*/
|
||||
public BaseDateTimeDt setDay(int theDay) {
|
||||
setFieldValue(Calendar.DAY_OF_MONTH, theDay, null, 0, 31);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hour of the day in a 24h clock, e.g. 13=1pm
|
||||
*/
|
||||
public BaseDateTimeDt setHour(int theHour) {
|
||||
setFieldValue(Calendar.HOUR_OF_DAY, theHour, null, 0, 23);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minute of the hour in the range 0-59
|
||||
*/
|
||||
public BaseDateTimeDt setMinute(int theMinute) {
|
||||
setFieldValue(Calendar.MINUTE, theMinute, null, 0, 59);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the second of the minute in the range 0-59
|
||||
*/
|
||||
public BaseDateTimeDt setSecond(int theSecond) {
|
||||
setFieldValue(Calendar.SECOND, theSecond, null, 0, 59);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the milliseconds within the current second.
|
||||
* <p>
|
||||
* Note that this method sets the
|
||||
* same value as {@link #setNanos(long)} but with less precision.
|
||||
* </p>
|
||||
*/
|
||||
public BaseDateTimeDt setMillis(int theMillis) {
|
||||
setFieldValue(Calendar.MILLISECOND, theMillis, null, 0, 999);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nanoseconds within the current second
|
||||
* <p>
|
||||
* Note that this method sets the
|
||||
* same value as {@link #setMillis(int)} but with more precision.
|
||||
* </p>
|
||||
*/
|
||||
public BaseDateTimeDt setNanos(long theNanos) {
|
||||
validateValueInRange(theNanos, 0, NANOS_PER_SECOND-1);
|
||||
String fractionalSeconds = StringUtils.leftPad(Long.toString(theNanos), 9, '0');
|
||||
|
||||
// Strip trailing 0s
|
||||
for (int i = fractionalSeconds.length(); i > 0; i--) {
|
||||
if (fractionalSeconds.charAt(i-1) != '0') {
|
||||
fractionalSeconds = fractionalSeconds.substring(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int millis = (int)(theNanos / NANOS_PER_MILLIS);
|
||||
setFieldValue(Calendar.MILLISECOND, millis, fractionalSeconds, 0, 999);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void setFieldValue(int theField, int theValue, String theFractionalSeconds, int theMinimum, int theMaximum) {
|
||||
validateValueInRange(theValue, theMinimum, theMaximum);
|
||||
Calendar cal;
|
||||
if (getValue() == null) {
|
||||
cal = new GregorianCalendar(0, 0, 0);
|
||||
} else {
|
||||
cal = getValueAsCalendar();
|
||||
}
|
||||
if (theField != -1) {
|
||||
cal.set(theField, theValue);
|
||||
}
|
||||
if (theFractionalSeconds != null) {
|
||||
myFractionalSeconds = theFractionalSeconds;
|
||||
} else if (theField == Calendar.MILLISECOND) {
|
||||
myFractionalSeconds = StringUtils.leftPad(Integer.toString(theValue), 3, '0');
|
||||
}
|
||||
super.setValue(cal.getTime());
|
||||
}
|
||||
|
||||
private void validateValueInRange(long theValue, long theMinimum, long theMaximum) {
|
||||
if (theValue < theMinimum || theValue > theMaximum) {
|
||||
throw new IllegalArgumentException("Value " + theValue + " is not between allowable range: " + theMinimum + " - " + theMaximum);
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getFieldValue(int theField) {
|
||||
if (getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
Calendar cal = getValueAsCalendar();
|
||||
return cal.get(theField);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DecimalDt extends BasePrimitive<BigDecimal> implements Comparable<D
|
|||
if (getValue() == null && theObj.getValue() == null) {
|
||||
return 0;
|
||||
}
|
||||
if (getValue() != null && theObj.getValue() == null) {
|
||||
if (getValue() != null && (theObj == null || theObj.getValue() == null)) {
|
||||
return 1;
|
||||
}
|
||||
if (getValue() == null && theObj.getValue() != null) {
|
||||
|
|
|
@ -185,5 +185,4 @@ public class InstantDt extends BaseDateTimeDt {
|
|||
return DEFAULT_PRECISION;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,22 +32,6 @@ import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
|||
@DatatypeDef(name = "uri")
|
||||
public class UriDt extends BasePrimitive<String> {
|
||||
|
||||
/**
|
||||
* Creates a new UriDt instance which uses the given OID as the content (and prepends "urn:oid:" to the OID string
|
||||
* in the value of the newly created UriDt, per the FHIR specification).
|
||||
*
|
||||
* @param theOid
|
||||
* The OID to use (<code>null</code> is acceptable and will result in a UriDt instance with a
|
||||
* <code>null</code> value)
|
||||
* @return A new UriDt instance
|
||||
*/
|
||||
public static UriDt fromOid(String theOid) {
|
||||
if (theOid == null) {
|
||||
return new UriDt();
|
||||
}
|
||||
return new UriDt("urn:oid:" + theOid);
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(UriDt.class);
|
||||
|
||||
/**
|
||||
|
@ -119,18 +103,15 @@ public class UriDt extends BasePrimitive<String> {
|
|||
URI retVal;
|
||||
try {
|
||||
retVal = new URI(theValue).normalize();
|
||||
} catch (URISyntaxException e1) {
|
||||
ourLog.debug("Failed to normalize URL '{}', message was: {}", theValue, e1.toString());
|
||||
return theValue;
|
||||
}
|
||||
String urlString = retVal.toString();
|
||||
if (urlString.endsWith("/") && urlString.length() > 1) {
|
||||
try {
|
||||
retVal = new URI(urlString.substring(0, urlString.length() - 1));
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
ourLog.debug("Failed to normalize URL '{}', message was: {}", urlString, e.toString());
|
||||
}
|
||||
ourLog.debug("Failed to normalize URL '{}', message was: {}", theValue, e.toString());
|
||||
return theValue;
|
||||
}
|
||||
|
||||
return retVal.toASCIIString();
|
||||
}
|
||||
|
||||
|
@ -139,4 +120,20 @@ public class UriDt extends BasePrimitive<String> {
|
|||
return theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new UriDt instance which uses the given OID as the content (and prepends "urn:oid:" to the OID string
|
||||
* in the value of the newly created UriDt, per the FHIR specification).
|
||||
*
|
||||
* @param theOid
|
||||
* The OID to use (<code>null</code> is acceptable and will result in a UriDt instance with a
|
||||
* <code>null</code> value)
|
||||
* @return A new UriDt instance
|
||||
*/
|
||||
public static UriDt fromOid(String theOid) {
|
||||
if (theOid == null) {
|
||||
return new UriDt();
|
||||
}
|
||||
return new UriDt("urn:oid:" + theOid);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
|||
import ca.uhn.fhir.rest.api.SummaryEnum;
|
||||
import ca.uhn.fhir.rest.api.ValidationModeEnum;
|
||||
import ca.uhn.fhir.rest.client.BaseHttpClientInvocation;
|
||||
import ca.uhn.fhir.rest.method.OperationParameter.IConverter;
|
||||
import ca.uhn.fhir.rest.method.OperationParameter.IOperationParamConverter;
|
||||
import ca.uhn.fhir.rest.param.CollectionBinder;
|
||||
import ca.uhn.fhir.rest.param.DateAndListParam;
|
||||
import ca.uhn.fhir.rest.param.NumberAndListParam;
|
||||
|
@ -499,7 +499,7 @@ public class MethodUtil {
|
|||
if (parameterType.equals(ValidationModeEnum.class) == false) {
|
||||
throw new ConfigurationException("Parameter annotated with @" + Validate.class.getSimpleName() + "." + Validate.Mode.class.getSimpleName() + " must be of type " + ValidationModeEnum.class.getName());
|
||||
}
|
||||
param = new OperationParameter(theContext, Constants.EXTOP_VALIDATE, Constants.EXTOP_VALIDATE_MODE, 0, 1).setConverter(new IConverter() {
|
||||
param = new OperationParameter(theContext, Constants.EXTOP_VALIDATE, Constants.EXTOP_VALIDATE_MODE, 0, 1).setConverter(new IOperationParamConverter() {
|
||||
@Override
|
||||
public Object incomingServer(Object theObject) {
|
||||
if (isNotBlank(theObject.toString())) {
|
||||
|
@ -522,7 +522,7 @@ public class MethodUtil {
|
|||
if (parameterType.equals(String.class) == false) {
|
||||
throw new ConfigurationException("Parameter annotated with @" + Validate.class.getSimpleName() + "." + Validate.Profile.class.getSimpleName() + " must be of type " + String.class.getName());
|
||||
}
|
||||
param = new OperationParameter(theContext, Constants.EXTOP_VALIDATE, Constants.EXTOP_VALIDATE_PROFILE, 0, 1).setConverter(new IConverter() {
|
||||
param = new OperationParameter(theContext, Constants.EXTOP_VALIDATE, Constants.EXTOP_VALIDATE_PROFILE, 0, 1).setConverter(new IOperationParamConverter() {
|
||||
@Override
|
||||
public Object incomingServer(Object theObject) {
|
||||
return theObject.toString();
|
||||
|
|
|
@ -63,6 +63,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
||||
import ca.uhn.fhir.util.FhirTerser;
|
||||
import ca.uhn.fhir.util.ParametersUtil;
|
||||
import ca.uhn.fhir.util.ReflectionUtil;
|
||||
|
||||
public class OperationParameter implements IParameter {
|
||||
|
||||
|
@ -74,7 +75,7 @@ public class OperationParameter implements IParameter {
|
|||
private boolean myAllowGet;
|
||||
|
||||
private final FhirContext myContext;
|
||||
private IConverter myConverter;
|
||||
private IOperationParamConverter myConverter;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Class<? extends Collection> myInnerCollectionType;
|
||||
private int myMax;
|
||||
|
@ -203,7 +204,7 @@ public class OperationParameter implements IParameter {
|
|||
mySearchParameterBinding = new SearchParameter(myName, myMin > 0);
|
||||
mySearchParameterBinding.setCompositeTypes(COMPOSITE_TYPES);
|
||||
mySearchParameterBinding.setType(myContext, theParameterType, theInnerCollectionType, theOuterCollectionType);
|
||||
myConverter = new QueryParameterConverter();
|
||||
myConverter = new OperationParamConverter();
|
||||
} else {
|
||||
throw new ConfigurationException("Invalid type for @OperationParam: " + myParameterType.getName());
|
||||
}
|
||||
|
@ -212,7 +213,7 @@ public class OperationParameter implements IParameter {
|
|||
|
||||
}
|
||||
|
||||
public OperationParameter setConverter(IConverter theConverter) {
|
||||
public OperationParameter setConverter(IOperationParamConverter theConverter) {
|
||||
myConverter = theConverter;
|
||||
return this;
|
||||
}
|
||||
|
@ -242,6 +243,25 @@ public class OperationParameter implements IParameter {
|
|||
List<Object> matchingParamValues = new ArrayList<Object>();
|
||||
|
||||
if (theRequest.getRequestType() == RequestTypeEnum.GET) {
|
||||
translateQueryParametersIntoServerArgumentForGet(theRequest, matchingParamValues);
|
||||
} else {
|
||||
translateQueryParametersIntoServerArgumentForPost(theRequest, matchingParamValues);
|
||||
}
|
||||
|
||||
if (matchingParamValues.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (myInnerCollectionType == null) {
|
||||
return matchingParamValues.get(0);
|
||||
}
|
||||
|
||||
Collection<Object> retVal = ReflectionUtil.newInstance(myInnerCollectionType);
|
||||
retVal.addAll(matchingParamValues);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void translateQueryParametersIntoServerArgumentForGet(RequestDetails theRequest, List<Object> matchingParamValues) {
|
||||
if (mySearchParameterBinding != null) {
|
||||
|
||||
List<QualifiedParamList> params = new ArrayList<QualifiedParamList>();
|
||||
|
@ -318,9 +338,9 @@ public class OperationParameter implements IParameter {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
private void translateQueryParametersIntoServerArgumentForPost(RequestDetails theRequest, List<Object> matchingParamValues) {
|
||||
IBaseResource requestContents = (IBaseResource) theRequest.getUserData().get(REQUEST_CONTENTS_USERDATA_KEY);
|
||||
RuntimeResourceDefinition def = myContext.getResourceDefinition(requestContents);
|
||||
if (def.getName().equals("Parameters")) {
|
||||
|
@ -365,29 +385,6 @@ public class OperationParameter implements IParameter {
|
|||
}
|
||||
}
|
||||
|
||||
if (matchingParamValues.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (myInnerCollectionType == null) {
|
||||
return matchingParamValues.get(0);
|
||||
}
|
||||
|
||||
try {
|
||||
Collection<Object> retVal = myInnerCollectionType.newInstance();
|
||||
retVal.addAll(matchingParamValues);
|
||||
return retVal;
|
||||
} catch (InstantiationException e) {
|
||||
throw new InternalErrorException("Failed to instantiate " + myInnerCollectionType, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InternalErrorException("Failed to instantiate " + myInnerCollectionType, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void throwInvalidMode(String paramValues) {
|
||||
throw new InvalidRequestException("Invalid mode value: \"" + paramValues + "\"");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void tryToAddValues(List<IBase> theParamValues, List<Object> theMatchingParamValues) {
|
||||
for (Object nextValue : theParamValues) {
|
||||
|
@ -419,7 +416,11 @@ public class OperationParameter implements IParameter {
|
|||
}
|
||||
}
|
||||
|
||||
public interface IConverter {
|
||||
public static void throwInvalidMode(String paramValues) {
|
||||
throw new InvalidRequestException("Invalid mode value: \"" + paramValues + "\"");
|
||||
}
|
||||
|
||||
interface IOperationParamConverter {
|
||||
|
||||
Object incomingServer(Object theObject);
|
||||
|
||||
|
@ -427,9 +428,9 @@ public class OperationParameter implements IParameter {
|
|||
|
||||
}
|
||||
|
||||
private class QueryParameterConverter implements IConverter {
|
||||
class OperationParamConverter implements IOperationParamConverter {
|
||||
|
||||
public QueryParameterConverter() {
|
||||
public OperationParamConverter() {
|
||||
Validate.isTrue(mySearchParameterBinding != null);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.model.api.IQueryParameterAnd;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
@ -301,7 +300,9 @@ public class DateRangeParam implements IQueryParameterAnd<DateParam> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the range from a pair of dates, inclusive on both ends
|
||||
* Sets the range from a pair of dates, inclusive on both ends. Note that if
|
||||
* theLowerBound is after theUpperBound, thie method will automatically reverse
|
||||
* the order of the arguments in order to create an inclusive range.
|
||||
*
|
||||
* @param theLowerBound
|
||||
* A qualified date param representing the lower date bound (optionally may include time), e.g.
|
||||
|
@ -313,8 +314,18 @@ public class DateRangeParam implements IQueryParameterAnd<DateParam> {
|
|||
* theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
|
||||
*/
|
||||
public void setRangeFromDatesInclusive(IPrimitiveType<Date> theLowerBound, IPrimitiveType<Date> theUpperBound) {
|
||||
myLowerBound = theLowerBound != null ? new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, theLowerBound) : null;
|
||||
myUpperBound = theUpperBound != null ? new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, theUpperBound) : null;
|
||||
IPrimitiveType<Date> lowerBound = theLowerBound;
|
||||
IPrimitiveType<Date> upperBound = theUpperBound;
|
||||
if (lowerBound != null && lowerBound.getValue() != null && upperBound != null && upperBound.getValue() != null) {
|
||||
if (lowerBound.getValue().after(upperBound.getValue())) {
|
||||
IPrimitiveType<Date> temp = lowerBound;
|
||||
lowerBound = upperBound;
|
||||
upperBound = temp;
|
||||
}
|
||||
}
|
||||
|
||||
myLowerBound = lowerBound != null ? new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, lowerBound) : null;
|
||||
myUpperBound = upperBound != null ? new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, upperBound) : null;
|
||||
validateAndThrowDataFormatExceptionIfInvalid();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,26 +45,31 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public String getPrefix(String theUri) throws XMLStreamException {
|
||||
return myTarget.getPrefix(theUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void setPrefix(String thePrefix, String theUri) throws XMLStreamException {
|
||||
myTarget.setPrefix(thePrefix, theUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void setDefaultNamespace(String theUri) throws XMLStreamException {
|
||||
myTarget.setDefaultNamespace(theUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void setNamespaceContext(NamespaceContext theContext) throws XMLStreamException {
|
||||
myTarget.setNamespaceContext(theContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public NamespaceContext getNamespaceContext() {
|
||||
return myTarget.getNamespaceContext();
|
||||
}
|
||||
|
@ -94,16 +99,19 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeEmptyElement(String theNamespaceURI, String theLocalName) throws XMLStreamException {
|
||||
myTarget.writeEmptyElement(theNamespaceURI, theLocalName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeEmptyElement(String thePrefix, String theLocalName, String theNamespaceURI) throws XMLStreamException {
|
||||
myTarget.writeEmptyElement(thePrefix, theLocalName, theNamespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeEmptyElement(String theLocalName) throws XMLStreamException {
|
||||
myTarget.writeEmptyElement(theLocalName);
|
||||
}
|
||||
|
@ -127,11 +135,13 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeAttribute(String thePrefix, String theNamespaceURI, String theLocalName, String theValue) throws XMLStreamException {
|
||||
myTarget.writeAttribute(thePrefix, theNamespaceURI, theLocalName, theValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeAttribute(String theNamespaceURI, String theLocalName, String theValue) throws XMLStreamException {
|
||||
myTarget.writeAttribute(theNamespaceURI, theLocalName, theValue);
|
||||
}
|
||||
|
@ -152,36 +162,43 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeProcessingInstruction(String theTarget) throws XMLStreamException {
|
||||
myTarget.writeProcessingInstruction(theTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeProcessingInstruction(String theTarget, String theData) throws XMLStreamException {
|
||||
myTarget.writeProcessingInstruction(theTarget, theData);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeCData(String theData) throws XMLStreamException {
|
||||
myTarget.writeCData(theData);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeDTD(String theDtd) throws XMLStreamException {
|
||||
myTarget.writeDTD(theDtd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeEntityRef(String theName) throws XMLStreamException {
|
||||
myTarget.writeEntityRef(theName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeStartDocument() throws XMLStreamException {
|
||||
myTarget.writeStartDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public void writeStartDocument(String theVersion) throws XMLStreamException {
|
||||
myTarget.writeStartDocument(theVersion);
|
||||
}
|
||||
|
@ -206,9 +223,7 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
static void writeCharacters(char[] theText, int theStart, int theLen, XMLStreamWriter target, int insidePre) throws XMLStreamException {
|
||||
if (theLen == 0) {
|
||||
return;
|
||||
} else {
|
||||
if (theLen > 0) {
|
||||
if (insidePre > 0) {
|
||||
target.writeCharacters(theText, theStart, theLen);
|
||||
} else {
|
||||
|
@ -240,6 +255,7 @@ public class NonPrettyPrintWriterWrapper implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@CoverageIgnore
|
||||
public Object getProperty(String theName) throws IllegalArgumentException {
|
||||
return myTarget.getProperty(theName);
|
||||
}
|
||||
|
|
|
@ -1,37 +1,19 @@
|
|||
package ca.uhn.fhir.util;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2016 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides server ports
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class PortUtil {
|
||||
|
||||
private static List<Integer> ourPorts = new ArrayList<Integer>();
|
||||
/*
|
||||
* Non instantiable
|
||||
*/
|
||||
private PortUtil() {
|
||||
// nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* This is really only used for unit tests but is included in the library so it can be reused across modules. Use with caution.
|
||||
|
@ -41,20 +23,13 @@ public class PortUtil {
|
|||
try {
|
||||
server = new ServerSocket(0);
|
||||
int port = server.getLocalPort();
|
||||
ourPorts.add(port);
|
||||
server.close();
|
||||
Thread.sleep(500);
|
||||
return port;
|
||||
} catch (IOException e) {
|
||||
throw new Error(e);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Integer> list() {
|
||||
return ourPorts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class FhirValidator {
|
|||
myContext = theFhirContext;
|
||||
|
||||
if (ourPhlocPresentOnClasspath == null) {
|
||||
ourPhlocPresentOnClasspath = SchematronProvider.isScematronAvailable(theFhirContext);
|
||||
ourPhlocPresentOnClasspath = SchematronProvider.isSchematronAvailable(theFhirContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.validation.schematron;
|
|||
import java.lang.reflect.Constructor;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.util.CoverageIgnore;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
import ca.uhn.fhir.validation.IValidatorModule;
|
||||
|
||||
|
@ -32,7 +33,8 @@ public class SchematronProvider {
|
|||
private static final String I18N_KEY_NO_PHLOC_WARNING = FhirValidator.class.getName() + ".noPhlocWarningOnStartup";
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirValidator.class);
|
||||
|
||||
public static boolean isScematronAvailable(FhirContext theFhirContext) {
|
||||
@CoverageIgnore
|
||||
public static boolean isSchematronAvailable(FhirContext theFhirContext) {
|
||||
try {
|
||||
Class.forName("com.phloc.schematron.ISchematronResource");
|
||||
return true;
|
||||
|
@ -42,6 +44,8 @@ public class SchematronProvider {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@CoverageIgnore
|
||||
public static Class<? extends IValidatorModule> getSchematronValidatorClass() {
|
||||
try {
|
||||
return (Class<? extends IValidatorModule>) Class.forName("ca.uhn.fhir.validation.schematron.SchematronBaseValidator");
|
||||
|
@ -50,6 +54,7 @@ public class SchematronProvider {
|
|||
}
|
||||
}
|
||||
|
||||
@CoverageIgnore
|
||||
public static IValidatorModule getSchematronValidatorInstance(FhirContext myContext) {
|
||||
try {
|
||||
Class<? extends IValidatorModule> cls = getSchematronValidatorClass();
|
||||
|
|
|
@ -77,5 +77,10 @@ ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.successfulUpdate=Successfully update
|
|||
ca.uhn.fhir.jpa.dao.SearchBuilder.invalidQuantityPrefix=Unable to handle quantity prefix "{0}" for value: {1}
|
||||
ca.uhn.fhir.jpa.dao.SearchBuilder.invalidNumberPrefix=Unable to handle number prefix "{0}" for value: {1}
|
||||
|
||||
ca.uhn.fhir.jpa.provider.BaseJpaProvider.cantCombintAtAndSince=Unable to combine _at and _since parameters for history operation
|
||||
|
||||
ca.uhn.fhir.jpa.term.BaseHapiTerminologySvc.cannotCreateDuplicateCodeSystemUri=Can not create multiple code systems with URI "{0}", already have one with resource ID: {1}
|
||||
ca.uhn.fhir.jpa.term.BaseHapiTerminologySvc.expansionTooLarge=Expansion of ValueSet produced too many codes (maximum {0}) - Operation aborted!
|
||||
ca.uhn.fhir.jpa.term.BaseHapiTerminologySvc.expansionTooLarge=Expansion of ValueSet produced too many codes (maximum {0}) - Operation aborted!
|
||||
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the site. I don't know why this works...
|
||||
Need to investigate this. -->
|
||||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-jacoco</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HAPI FHIR - JaCoCo Test Coverage</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-schematron</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Use an older version of SLF4j just to make sure we compile correctly against old SLF4j - Some people can't upgrade and we have no real need for recent features. -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Database -->
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlets</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xmlunit</groupId>
|
||||
<artifactId>xmlunit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<classifier>jdk15</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<classifier>jdk15-sources</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>directory-naming</groupId>
|
||||
<artifactId>naming-java</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ebaysf.web</groupId>
|
||||
<artifactId>cors-filter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xmlunit</groupId>
|
||||
<artifactId>xmlunit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||
<artifactId>websocket-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||
<artifactId>websocket-client</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||
<artifactId>websocket-server</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipDeploy>true</skipDeploy>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-merge</id>
|
||||
<goals>
|
||||
<goal>merge</goal>
|
||||
</goals>
|
||||
<phase>install</phase>
|
||||
<configuration>
|
||||
<fileSets>
|
||||
<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
|
||||
<directory>${basedir}/..</directory>
|
||||
<includes>
|
||||
<include>hapi-fhir-base/target/jacoco.exec</include>
|
||||
<include>hapi-fhir-structures-dstu/target/jacoco.exec</include>
|
||||
<include>hapi-fhir-structures-dstu2/target/jacoco.exec</include>
|
||||
<include>hapi-fhir-structures-hl7org-dstu2/target/jacoco.exec</include>
|
||||
<include>hapi-fhir-structures-dstu3/target/jacoco.exec</include>
|
||||
<include>hapi-fhir-jpaserver-base/target/jacoco.exec</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eluder.coveralls</groupId>
|
||||
<artifactId>coveralls-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<sourceEncoding>UTF-8</sourceEncoding>
|
||||
<serviceName>travis-ci</serviceName>
|
||||
<serviceJobId>${env.TRAVIS_JOB_ID}</serviceJobId>
|
||||
<sourceDirectories>
|
||||
<sourceDirectory>../hapi-fhir-structures-dstu/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-structures-dstu2/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-structures-hl7org-dstu2/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-jpaserver-base/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-base/src/main/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-jpaserver-base/src/main/java</sourceDirectory>
|
||||
</sourceDirectories>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>../hapi-fhir-base/src/main/java</source>
|
||||
<source>../hapi-fhir-jpaserver-base/src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!--
|
||||
<execution>
|
||||
<id>add-test-source</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>../hapi-fhir-structures-dstu/src/test/java</source>
|
||||
<source>../hapi-fhir-structures-dstu2/src/test/java</source>
|
||||
<source>../hapi-fhir-structures-hl7org-dstu2/src/test/java</source>
|
||||
<source>../hapi-fhir-structures-dstu3/src/test/java</source>
|
||||
<source>../hapi-fhir-jpaserver-base/src/test/java</source>
|
||||
<source>../hapi-fhir-base/src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
-->
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-base/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-jpaserver-base/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-dstu/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-dstu2/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-hl7org-dstu2/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-dstu3/src/test/resources</directory>
|
||||
</testResource>
|
||||
</testResources>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>cobertura</report>
|
||||
</reports>
|
||||
<configuration>
|
||||
<check>
|
||||
<haltOnFailure>true</haltOnFailure>
|
||||
</check>
|
||||
</configuration>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>${maven_project_info_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
</project>
|
|
@ -335,13 +335,36 @@
|
|||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}../hapi-fhir-base/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- These tests all use a shared database, so it's easier if they run in a predictable order -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
<!--<reuseForks>false</reuseForks>-->
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
<forkCount>1</forkCount>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
|
@ -56,12 +55,14 @@ import org.hibernate.search.annotations.Field;
|
|||
import org.hibernate.search.annotations.Fields;
|
||||
import org.hibernate.search.annotations.Indexed;
|
||||
import org.hibernate.search.annotations.Store;
|
||||
import org.hibernate.search.indexes.interceptor.DontInterceptEntityInterceptor;
|
||||
|
||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||
import ca.uhn.fhir.jpa.search.DeferConceptIndexingInterceptor;
|
||||
|
||||
//@formatter:off
|
||||
@Entity
|
||||
@Indexed()
|
||||
@Indexed(interceptor=DeferConceptIndexingInterceptor.class)
|
||||
@Table(name="TRM_CONCEPT", uniqueConstraints= {
|
||||
@UniqueConstraint(name="IDX_CONCEPT_CS_CODE", columnNames= {"CODESYSTEM_PID", "CODE"})
|
||||
}, indexes= {
|
||||
|
|
|
@ -35,8 +35,6 @@ import javax.persistence.ManyToOne;
|
|||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||
|
||||
@Entity
|
||||
@Table(name="TRM_CONCEPT_PC_LINK")
|
||||
public class TermConceptParentChildLink implements Serializable {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.jpa.provider;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
|
@ -28,9 +30,10 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jboss.logging.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
|
||||
public class BaseJpaProvider {
|
||||
|
@ -41,6 +44,9 @@ public class BaseJpaProvider {
|
|||
|
||||
private FhirContext myContext;
|
||||
|
||||
/**
|
||||
* @param theRequest The servlet request
|
||||
*/
|
||||
public void endRequest(HttpServletRequest theRequest) {
|
||||
MDC.remove(REMOTE_ADDR);
|
||||
MDC.remove(REMOTE_UA);
|
||||
|
@ -54,10 +60,25 @@ public class BaseJpaProvider {
|
|||
return myContext;
|
||||
}
|
||||
|
||||
protected DateRangeParam processSinceOrAt(Date theSince, DateRangeParam theAt) {
|
||||
boolean haveAt = theAt != null && (theAt.getLowerBoundAsInstant() != null || theAt.getUpperBoundAsInstant() != null);
|
||||
if (haveAt && theSince != null) {
|
||||
String msg = getContext().getLocalizer().getMessage(BaseJpaProvider.class, "cantCombintAtAndSince");
|
||||
throw new InvalidRequestException(msg);
|
||||
}
|
||||
|
||||
if (haveAt) {
|
||||
return theAt;
|
||||
}
|
||||
|
||||
return new DateRangeParam(theSince, null);
|
||||
}
|
||||
|
||||
public void setContext(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
|
||||
public void startRequest(HttpServletRequest theRequest) {
|
||||
if (theRequest == null) {
|
||||
return;
|
||||
|
|
|
@ -65,24 +65,29 @@ public abstract class BaseJpaResourceProvider<T extends IBaseResource> extends B
|
|||
HttpServletRequest theRequest,
|
||||
@IdParam IIdType theId,
|
||||
@Since Date theSince,
|
||||
// @At DateRangeParam theAt,
|
||||
@At DateRangeParam theAt,
|
||||
RequestDetails theRequestDetails) {
|
||||
//@formatter:on
|
||||
|
||||
startRequest(theRequest);
|
||||
try {
|
||||
// DateRangeParam sinceOrAt = processSinceOrAt(theSince)
|
||||
return myDao.history(theId, theSince, null, theRequestDetails);
|
||||
DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt);
|
||||
return myDao.history(theId, sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails);
|
||||
} finally {
|
||||
endRequest(theRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@History
|
||||
public IBundleProvider getHistoryForResourceType(HttpServletRequest theRequest, @Since Date theDate, RequestDetails theRequestDetails) {
|
||||
public IBundleProvider getHistoryForResourceType(
|
||||
HttpServletRequest theRequest,
|
||||
@Since Date theSince,
|
||||
@At DateRangeParam theAt,
|
||||
RequestDetails theRequestDetails) {
|
||||
startRequest(theRequest);
|
||||
try {
|
||||
return myDao.history(theDate, null, theRequestDetails);
|
||||
DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt);
|
||||
return myDao.history(sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails);
|
||||
} finally {
|
||||
endRequest(theRequest);
|
||||
}
|
||||
|
|
|
@ -28,10 +28,12 @@ import org.springframework.beans.factory.annotation.Required;
|
|||
|
||||
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
|
||||
import ca.uhn.fhir.model.api.TagList;
|
||||
import ca.uhn.fhir.rest.annotation.At;
|
||||
import ca.uhn.fhir.rest.annotation.GetTags;
|
||||
import ca.uhn.fhir.rest.annotation.History;
|
||||
import ca.uhn.fhir.rest.annotation.Since;
|
||||
import ca.uhn.fhir.rest.method.RequestDetails;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
|
||||
public class BaseJpaSystemProvider<T, MT> extends BaseJpaProvider {
|
||||
|
@ -48,10 +50,11 @@ public class BaseJpaSystemProvider<T, MT> extends BaseJpaProvider {
|
|||
}
|
||||
|
||||
@History
|
||||
public IBundleProvider historyServer(HttpServletRequest theRequest, @Since Date theDate, RequestDetails theRequestDetails) {
|
||||
public IBundleProvider historyServer(HttpServletRequest theRequest, @Since Date theDate, @At DateRangeParam theAt, RequestDetails theRequestDetails) {
|
||||
startRequest(theRequest);
|
||||
try {
|
||||
return myDao.history(theDate, null, theRequestDetails);
|
||||
DateRangeParam range = super.processSinceOrAt(theDate, theAt);
|
||||
return myDao.history(range.getLowerBoundAsInstant(), range.getUpperBoundAsInstant(), theRequestDetails);
|
||||
} finally {
|
||||
endRequest(theRequest);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
|
|||
}
|
||||
|
||||
if (moreThanOneTrue(haveId, haveIdentifier, haveValueSet)) {
|
||||
throw new InvalidRequestException("$expand must EITHER be invoked at the type level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.");
|
||||
throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.");
|
||||
}
|
||||
|
||||
startRequest(theServletRequest);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package ca.uhn.fhir.jpa.search;
|
||||
|
||||
import org.hibernate.search.indexes.interceptor.DontInterceptEntityInterceptor;
|
||||
|
||||
public class DeferConceptIndexingInterceptor extends DontInterceptEntityInterceptor
|
||||
//implements EntityIndexingInterceptor<TermConcept>
|
||||
{
|
||||
// nothing for now
|
||||
}
|
|
@ -15,7 +15,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3;
|
||||
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
|
||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||
|
||||
|
|
|
@ -41,4 +41,10 @@ public class BaseFhirDaoTest extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return ourCtx;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import javax.persistence.EntityManager;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.hibernate.search.jpa.Search;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -26,6 +27,7 @@ import org.springframework.transaction.TransactionStatus;
|
|||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.entity.ForcedId;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTag;
|
||||
|
@ -55,9 +57,10 @@ import ca.uhn.fhir.rest.method.IRequestOperationCallback;
|
|||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.util.BundleUtil;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class BaseJpaTest {
|
||||
public abstract class BaseJpaTest {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseJpaTest.class);
|
||||
protected ServletRequestDetails mySrd;
|
||||
|
@ -74,6 +77,32 @@ public class BaseJpaTest {
|
|||
return theSearch.getResources(0, theSearch.size());
|
||||
}
|
||||
|
||||
protected abstract FhirContext getContext();
|
||||
|
||||
protected List<String> toUnqualifiedVersionlessIdValues(IBaseBundle theFound) {
|
||||
List<String> retVal = new ArrayList<String>();
|
||||
|
||||
List<IBaseResource> res = BundleUtil.toListOfResources(getContext(), theFound);
|
||||
int size = res.size();
|
||||
ourLog.info("Found {} results", size);
|
||||
for (IBaseResource next : res) {
|
||||
retVal.add(next.getIdElement().toUnqualifiedVersionless().getValue());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
protected List<String> toUnqualifiedIdValues(IBaseBundle theFound) {
|
||||
List<String> retVal = new ArrayList<String>();
|
||||
|
||||
List<IBaseResource> res = BundleUtil.toListOfResources(getContext(), theFound);
|
||||
int size = res.size();
|
||||
ourLog.info("Found {} results", size);
|
||||
for (IBaseResource next : res) {
|
||||
retVal.add(next.getIdElement().toUnqualified().getValue());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
protected List<IIdType> toUnqualifiedVersionlessIds(Bundle theFound) {
|
||||
List<IIdType> retVal = new ArrayList<IIdType>();
|
||||
for (Entry next : theFound.getEntry()) {
|
||||
|
|
|
@ -31,17 +31,21 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static AnnotationConfigApplicationContext ourAppCtx;
|
||||
private static FhirContext ourCtx;
|
||||
private static IFhirResourceDao<Device> ourDeviceDao;
|
||||
private static IFhirResourceDao<DiagnosticReport> ourDiagnosticReportDao;
|
||||
private static IFhirResourceDao<Encounter> ourEncounterDao;
|
||||
private static AnnotationConfigApplicationContext ourAppCtx;
|
||||
private static IFhirResourceDao<Location> ourLocationDao;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoDstu1Test.class);
|
||||
private static IFhirResourceDao<Observation> ourObservationDao;
|
||||
private static IFhirResourceDao<Organization> ourOrganizationDao;
|
||||
private static IFhirResourceDao<Patient> ourPatientDao;
|
||||
private static FhirContext ourCtx;
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return ourCtx;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateDuplicateIdFails() {
|
||||
|
@ -125,6 +129,12 @@ public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
ourAppCtx.close();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
|
@ -139,10 +149,4 @@ public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
|||
ourCtx = ourAppCtx.getBean(FhirContext.class);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
ourAppCtx.close();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,27 +53,25 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static AnnotationConfigApplicationContext ourCtx;
|
||||
private static EntityManager ourEntityManager;
|
||||
private static FhirContext ourFhirContext;
|
||||
private static IFhirResourceDao<Location> ourLocationDao;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirSystemDaoDstu1Test.class);
|
||||
private static IFhirResourceDao<Observation> ourObservationDao;
|
||||
private static IFhirResourceDao<Patient> ourPatientDao;
|
||||
private static IFhirSystemDao<List<IResource>, MetaDt> ourSystemDao;
|
||||
private static EntityManager ourEntityManager;
|
||||
private static PlatformTransactionManager ourTxManager;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
ourCtx.close();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
super.purgeDatabase(ourEntityManager, ourTxManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return ourFhirContext;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetResourceCounts() {
|
||||
Observation obs = new Observation();
|
||||
|
@ -382,7 +380,6 @@ public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
|||
assertThat(encodeResourceToString, not(containsString("smsp")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the correct way to do this, not {@link #testTransactionWithCidIds()}
|
||||
*/
|
||||
|
@ -479,6 +476,11 @@ public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
ourCtx.close();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
|
|
|
@ -73,31 +73,17 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
//@formatter:on
|
||||
public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() throws Exception {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
protected ApplicationContext myAppCtx;
|
||||
@Autowired
|
||||
protected IFulltextSearchSvc mySearchDao;
|
||||
@Autowired
|
||||
@Qualifier("myConceptMapDaoDstu2")
|
||||
protected IFhirResourceDao<ConceptMap> myConceptMapDao;
|
||||
@Autowired
|
||||
@Qualifier("myAppointmentDaoDstu2")
|
||||
protected IFhirResourceDao<Appointment> myAppointmentDao;
|
||||
@Autowired
|
||||
@Qualifier("myBundleDaoDstu2")
|
||||
protected IFhirResourceDao<Bundle> myBundleDao;
|
||||
@Autowired
|
||||
@Qualifier("myMedicationDaoDstu2")
|
||||
protected IFhirResourceDao<Medication> myMedicationDao;
|
||||
@Autowired
|
||||
@Qualifier("myMedicationOrderDaoDstu2")
|
||||
protected IFhirResourceDao<MedicationOrder> myMedicationOrderDao;
|
||||
@Qualifier("myConceptMapDaoDstu2")
|
||||
protected IFhirResourceDao<ConceptMap> myConceptMapDao;
|
||||
@Autowired
|
||||
protected DaoConfig myDaoConfig;
|
||||
@Autowired
|
||||
|
@ -112,11 +98,9 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
@Autowired
|
||||
@Qualifier("myEncounterDaoDstu2")
|
||||
protected IFhirResourceDao<Encounter> myEncounterDao;
|
||||
|
||||
// @PersistenceContext()
|
||||
// @PersistenceContext()
|
||||
@Autowired
|
||||
protected EntityManager myEntityManager;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("myFhirContextDstu2")
|
||||
protected FhirContext myFhirCtx;
|
||||
|
@ -127,6 +111,17 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
@Autowired
|
||||
@Qualifier("myLocationDaoDstu2")
|
||||
protected IFhirResourceDao<Location> myLocationDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("myMediaDaoDstu2")
|
||||
protected IFhirResourceDao<Media> myMediaDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("myMedicationDaoDstu2")
|
||||
protected IFhirResourceDao<Medication> myMedicationDao;
|
||||
@Autowired
|
||||
@Qualifier("myMedicationOrderDaoDstu2")
|
||||
protected IFhirResourceDao<MedicationOrder> myMedicationOrderDao;
|
||||
@Autowired
|
||||
@Qualifier("myObservationDaoDstu2")
|
||||
protected IFhirResourceDao<Observation> myObservationDao;
|
||||
|
@ -137,9 +132,6 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
@Qualifier("myPatientDaoDstu2")
|
||||
protected IFhirResourceDaoPatient<Patient> myPatientDao;
|
||||
@Autowired
|
||||
@Qualifier("myMediaDaoDstu2")
|
||||
protected IFhirResourceDao<Media> myMediaDao;
|
||||
@Autowired
|
||||
@Qualifier("myPractitionerDaoDstu2")
|
||||
protected IFhirResourceDao<Practitioner> myPractitionerDao;
|
||||
@Autowired
|
||||
|
@ -152,6 +144,8 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
@Qualifier("myResourceProvidersDstu2")
|
||||
protected Object myResourceProviders;
|
||||
@Autowired
|
||||
protected IFulltextSearchSvc mySearchDao;
|
||||
@Autowired
|
||||
@Qualifier("myStructureDefinitionDaoDstu2")
|
||||
protected IFhirResourceDao<StructureDefinition> myStructureDefinitionDao;
|
||||
@Autowired
|
||||
|
@ -171,21 +165,11 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
@Autowired
|
||||
@Qualifier("myValueSetDaoDstu2")
|
||||
protected IFhirResourceDaoValueSet<ValueSet, CodingDt, CodeableConceptDt> myValueSetDao;
|
||||
|
||||
@Before
|
||||
public void beforeCreateInterceptor() {
|
||||
myInterceptor = mock(IServerInterceptor.class);
|
||||
myDaoConfig.setInterceptors(myInterceptor);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void beforeResetConfig() {
|
||||
myDaoConfig.setHardSearchLimit(1000);
|
||||
myDaoConfig.setHardTagListLimit(1000);
|
||||
myDaoConfig.setIncludeLimit(2000);
|
||||
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
||||
}
|
||||
|
||||
@Before
|
||||
@Transactional
|
||||
public void beforeFlushFT() {
|
||||
|
@ -204,6 +188,19 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
purgeDatabase(entityManager, myTxManager);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void beforeResetConfig() {
|
||||
myDaoConfig.setHardSearchLimit(1000);
|
||||
myDaoConfig.setHardTagListLimit(1000);
|
||||
myDaoConfig.setIncludeLimit(2000);
|
||||
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return myFhirCtx;
|
||||
}
|
||||
|
||||
protected <T extends IBaseResource> T loadResourceFromClasspath(Class<T> type, String resourceName) throws IOException {
|
||||
InputStream stream = FhirResourceDaoDstu2SearchNoFtTest.class.getResourceAsStream(resourceName);
|
||||
if (stream == null) {
|
||||
|
@ -221,4 +218,9 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() throws Exception {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import ca.uhn.fhir.rest.param.StringAndListParam;
|
|||
import ca.uhn.fhir.rest.param.StringOrListParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
||||
|
@ -41,7 +40,6 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSuggestIgnoresBase64Content() {
|
||||
Patient patient = new Patient();
|
||||
|
@ -52,7 +50,7 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
med.getSubject().setReference(ptId);
|
||||
med.getSubtype().setText("Systolic Blood Pressure");
|
||||
med.getContent().setContentType("LCws");
|
||||
med.getContent().setData(new Base64BinaryDt(new byte[] {44,44,44,44,44,44,44,44}));
|
||||
med.getContent().setData(new Base64BinaryDt(new byte[] { 44, 44, 44, 44, 44, 44, 44, 44 }));
|
||||
med.getContent().setTitle("bbbb syst");
|
||||
myMediaDao.create(med, mySrd);
|
||||
ourLog.info(myFhirCtx.newJsonParser().encodeResourceToString(med));
|
||||
|
@ -150,7 +148,6 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchAndReindex() {
|
||||
Patient patient;
|
||||
|
@ -240,7 +237,7 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
request = mock(HttpServletRequest.class);
|
||||
StringAndListParam param;
|
||||
|
||||
ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] {ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart()});
|
||||
ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] { ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart() });
|
||||
|
||||
param = new StringAndListParam();
|
||||
param.addAnd(new StringOrListParam().addOr(new StringParam("obsvalue1")));
|
||||
|
@ -332,7 +329,7 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
request = mock(HttpServletRequest.class);
|
||||
StringAndListParam param;
|
||||
|
||||
ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] {ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart()});
|
||||
ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] { ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart() });
|
||||
|
||||
param = new StringAndListParam();
|
||||
param.addAnd(new StringOrListParam().addOr(new StringParam("obsvalue1")));
|
||||
|
@ -377,10 +374,8 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When processing transactions, we do two passes. Make sure we don't update the lucene index twice since that would
|
||||
* be inefficient
|
||||
* When processing transactions, we do two passes. Make sure we don't update the lucene index twice since that would be inefficient
|
||||
*/
|
||||
@Test
|
||||
public void testSearchDontReindexForUpdateWithIndexDisabled() {
|
||||
|
|
|
@ -792,19 +792,19 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
|||
{
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||
assertThat(patients, hasItems(id1a, id1b, id2));
|
||||
assertThat(patients, containsInAnyOrder(id1a, id1b, id2));
|
||||
}
|
||||
{
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.setLastUpdated(new DateRangeParam(beforeAny, null));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||
assertThat(patients, hasItems(id1a, id1b, id2));
|
||||
assertThat(patients, containsInAnyOrder(id1a, id1b, id2));
|
||||
}
|
||||
{
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.setLastUpdated(new DateRangeParam(beforeR2, null));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||
assertThat(patients, hasItems(id2));
|
||||
assertThat(patients, containsInAnyOrder(id2));
|
||||
assertThat(patients, not(hasItems(id1a, id1b)));
|
||||
}
|
||||
{
|
||||
|
@ -812,13 +812,13 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
|||
params.setLastUpdated(new DateRangeParam(beforeAny, beforeR2));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||
assertThat(patients.toString(), patients, not(hasItems(id2)));
|
||||
assertThat(patients.toString(), patients, (hasItems(id1a, id1b)));
|
||||
assertThat(patients.toString(), patients, (containsInAnyOrder(id1a, id1b)));
|
||||
}
|
||||
{
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.setLastUpdated(new DateRangeParam(null, beforeR2));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||
assertThat(patients, (hasItems(id1a, id1b)));
|
||||
assertThat(patients, (containsInAnyOrder(id1a, id1b)));
|
||||
assertThat(patients, not(hasItems(id2)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,9 +106,6 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
@Qualifier("myCarePlanDaoDstu3")
|
||||
protected IFhirResourceDao<CarePlan> myCarePlanDao;
|
||||
@Autowired
|
||||
@Qualifier("myConditionDaoDstu3")
|
||||
protected IFhirResourceDao<Condition> myConditionDao;
|
||||
@Autowired
|
||||
@Qualifier("myCodeSystemDaoDstu3")
|
||||
protected IFhirResourceDao<CodeSystem> myCodeSystemDao;
|
||||
@Autowired
|
||||
|
@ -118,6 +115,9 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
@Qualifier("myConceptMapDaoDstu3")
|
||||
protected IFhirResourceDao<ConceptMap> myConceptMapDao;
|
||||
@Autowired
|
||||
@Qualifier("myConditionDaoDstu3")
|
||||
protected IFhirResourceDao<Condition> myConditionDao;
|
||||
@Autowired
|
||||
protected DaoConfig myDaoConfig;
|
||||
@Autowired
|
||||
@Qualifier("myDeviceDaoDstu3")
|
||||
|
@ -213,7 +213,6 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
@Autowired
|
||||
@Qualifier("myValueSetDaoDstu3")
|
||||
protected IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> myValueSetDao;
|
||||
|
||||
@After()
|
||||
public void afterGrabCaches() {
|
||||
ourValueSetDao = myValueSetDao;
|
||||
|
@ -251,6 +250,11 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
myDaoConfig.setIncludeLimit(2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return myFhirCtx;
|
||||
}
|
||||
|
||||
protected <T extends IBaseResource> T loadResourceFromClasspath(Class<T> type, String resourceName) throws IOException {
|
||||
InputStream stream = FhirResourceDaoDstu2SearchNoFtTest.class.getResourceAsStream(resourceName);
|
||||
if (stream == null) {
|
||||
|
|
|
@ -1491,7 +1491,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
List<Date> preDates = Lists.newArrayList();
|
||||
List<String> ids = Lists.newArrayList();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(100);
|
||||
preDates.add(new Date());
|
||||
patient.setId(id);
|
||||
patient.getName().get(0).getFamily().get(0).setValue(methodName + "_i");
|
||||
|
|
|
@ -160,12 +160,13 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
|
|||
myPatientDao.create(p, mySrd).getId();
|
||||
|
||||
InstantDt start = InstantDt.withCurrentTime();
|
||||
ourLog.info("First time: {}", start.getValueAsString());
|
||||
Thread.sleep(100);
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
IIdType id = myPatientDao.create(p, mySrd).getId();
|
||||
ourLog.info("Created patient, got it: {}", id);
|
||||
ourLog.info("Created patient, got ID: {}", id);
|
||||
|
||||
Thread.sleep(100);
|
||||
|
||||
|
@ -174,7 +175,9 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
|
|||
p.addName().addFamily("Hello");
|
||||
p.setId("Patient/" + methodName);
|
||||
|
||||
myPatientDao.update(p, "Patient?_lastUpdated=gt" + start.getValueAsString(), mySrd);
|
||||
String matchUrl = "Patient?_lastUpdated=gt" + start.getValueAsString();
|
||||
ourLog.info("URL is: {}", matchUrl);
|
||||
myPatientDao.update(p, matchUrl, mySrd);
|
||||
|
||||
p = myPatientDao.read(id.toVersionless(), mySrd);
|
||||
assertThat(p.getIdElement().toVersionless().toString(), not(containsString("test")));
|
||||
|
|
|
@ -63,7 +63,6 @@ import ca.uhn.fhir.rest.server.IResourceProvider;
|
|||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class ResourceProviderDstu1Test extends BaseJpaTest {
|
||||
|
@ -88,6 +87,10 @@ public class ResourceProviderDstu1Test extends BaseJpaTest {
|
|||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return ourCtx;
|
||||
}
|
||||
|
||||
// private static JpaConformanceProvider ourConfProvider;
|
||||
|
||||
|
@ -121,11 +124,11 @@ public class ResourceProviderDstu1Test extends BaseJpaTest {
|
|||
}
|
||||
ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
|
||||
|
||||
Bundle found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("testCountParam_01")).limitTo(10).execute();
|
||||
Bundle found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("testCountParam_01")).count(10).execute();
|
||||
assertEquals(100, found.getTotalResults().getValue().intValue());
|
||||
assertEquals(10, found.getEntries().size());
|
||||
|
||||
found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("testCountParam_01")).limitTo(999).execute();
|
||||
found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("testCountParam_01")).count(999).execute();
|
||||
assertEquals(100, found.getTotalResults().getValue().intValue());
|
||||
assertEquals(50, found.getEntries().size());
|
||||
|
||||
|
|
|
@ -1559,6 +1559,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
@Test
|
||||
public void testSearchLastUpdatedParamRp() throws InterruptedException {
|
||||
String methodName = "testSearchLastUpdatedParamRp";
|
||||
ourLog.info("Starting " + methodName);
|
||||
|
||||
int sleep = 100;
|
||||
Thread.sleep(sleep);
|
||||
|
@ -1668,8 +1669,10 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
|
||||
@Test
|
||||
public void testSearchReturnsSearchDate() throws Exception {
|
||||
ourLog.info("Starting testSearchReturnsSearchDate");
|
||||
|
||||
Date before = new Date();
|
||||
Thread.sleep(1);
|
||||
Thread.sleep(100);
|
||||
|
||||
//@formatter:off
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle found = ourClient
|
||||
|
@ -1680,7 +1683,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
Thread.sleep(1);
|
||||
Thread.sleep(100);
|
||||
Date after = new Date();
|
||||
|
||||
InstantDt updated = ResourceMetadataKeyEnum.UPDATED.get(found);
|
||||
|
|
|
@ -3,7 +3,8 @@ package ca.uhn.fhir.jpa.provider;
|
|||
import static org.hamcrest.Matchers.blankOrNullString;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -11,13 +12,10 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hamcrest.text.IsBlankString;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.config.TestDstu1Config;
|
||||
|
@ -32,19 +30,22 @@ import ca.uhn.fhir.model.dstu.resource.Observation;
|
|||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class SystemProviderDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static AnnotationConfigApplicationContext ourAppCtx;
|
||||
private static IGenericClient ourClient;
|
||||
private static FhirContext ourCtx;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SystemProviderDstu1Test.class);
|
||||
private static Server ourServer;
|
||||
private static AnnotationConfigApplicationContext ourAppCtx;
|
||||
private static FhirContext ourCtx;
|
||||
private static IGenericClient ourClient;
|
||||
|
||||
@Override
|
||||
protected FhirContext getContext() {
|
||||
return ourCtx;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionFromBundle() throws Exception {
|
||||
|
@ -65,7 +66,12 @@ public class SystemProviderDstu1Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() throws Exception {
|
||||
ourServer.stop();
|
||||
ourAppCtx.stop();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
|
@ -112,18 +118,9 @@ public class SystemProviderDstu1Test extends BaseJpaTest {
|
|||
ourServer.setHandler(proxyHandler);
|
||||
ourServer.start();
|
||||
|
||||
|
||||
ourCtx.getRestfulClientFactory().setSocketTimeout(600 * 1000);
|
||||
ourClient = ourCtx.newRestfulGenericClient(serverBase);
|
||||
ourClient.setLogRequestAndResponse(true);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() throws Exception {
|
||||
ourServer.stop();
|
||||
ourAppCtx.stop();
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import static org.hamcrest.Matchers.containsString;
|
|||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
|
@ -17,21 +18,17 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrlPattern;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -44,6 +41,7 @@ import org.apache.http.client.methods.HttpPost;
|
|||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.hl7.fhir.dstu3.model.BaseResource;
|
||||
import org.hl7.fhir.dstu3.model.Bundle;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
|
@ -98,27 +96,23 @@ import org.junit.AfterClass;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.api.SummaryEnum;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.HasParam;
|
||||
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
|
||||
import ca.uhn.fhir.rest.param.StringAndListParam;
|
||||
import ca.uhn.fhir.rest.param.StringOrListParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.util.BundleUtil;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
@ -131,21 +125,11 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
protected List<String> toUnqualifiedVersionlessIdValues(IBaseBundle theFound) {
|
||||
List<String> retVal = new ArrayList<String>();
|
||||
|
||||
List<IBaseResource> res = BundleUtil.toListOfResources(myFhirCtx, theFound);
|
||||
int size = res.size();
|
||||
ourLog.info("Found {} results", size);
|
||||
for (IBaseResource next : res) {
|
||||
retVal.add(next.getIdElement().toUnqualifiedVersionless().getValue());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasParameter() throws Exception {
|
||||
IIdType pid0, pid1;
|
||||
IIdType pid0;
|
||||
{
|
||||
Patient patient = new Patient();
|
||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
|
@ -156,7 +140,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
Patient patient = new Patient();
|
||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
patient.addName().addFamily("Tester").addGiven("Joe");
|
||||
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
||||
myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
||||
}
|
||||
{
|
||||
Observation obs = new Observation();
|
||||
|
@ -176,10 +160,56 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
}
|
||||
|
||||
String uri = ourServerBase + "/Patient?_has:Observation:subject:identifier=" + UrlUtil.escape("urn:system|FOO");
|
||||
List<String> ids = searchAndReturnUnqualifiedIdValues(uri);
|
||||
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
|
||||
assertThat(ids, contains(pid0.getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHistoryWithAtParameter() throws Exception {
|
||||
String methodName = "testHistoryWithFromAndTo";
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addName().addFamily(methodName);
|
||||
IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
List<Date> preDates = Lists.newArrayList();
|
||||
List<String> ids = Lists.newArrayList();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Thread.sleep(100);
|
||||
preDates.add(new Date());
|
||||
patient.setId(id);
|
||||
patient.getName().get(0).getFamily().get(0).setValue(methodName + "_i");
|
||||
ids.add(myPatientDao.update(patient, mySrd).getId().toUnqualified().getValue());
|
||||
}
|
||||
|
||||
List<String> idValues;
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + id.getIdPart() + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
|
||||
assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
|
||||
assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
|
||||
assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt2060");
|
||||
assertThat(idValues, empty());
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=" + InstantDt.withCurrentTime().getYear());
|
||||
assertThat(idValues, hasSize(10)); // 10 is the page size
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=ge" + InstantDt.withCurrentTime().getYear());
|
||||
assertThat(idValues, hasSize(10));
|
||||
|
||||
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt" + InstantDt.withCurrentTime().getYear());
|
||||
assertThat(idValues, hasSize(0));
|
||||
}
|
||||
|
||||
private String toStr(Date theDate) {
|
||||
return new InstantDt(theDate).getValueAsString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasParameterNoResults() throws Exception {
|
||||
|
||||
|
@ -195,11 +225,10 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
private List<String> searchAndReturnUnqualifiedIdValues(String uri) throws IOException, ClientProtocolException {
|
||||
private List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException, ClientProtocolException {
|
||||
List<String> ids;
|
||||
HttpGet get = new HttpGet(uri);
|
||||
|
||||
|
||||
CloseableHttpResponse response = ourHttpClient.execute(get);
|
||||
try {
|
||||
String resp = IOUtils.toString(response.getEntity().getContent());
|
||||
|
@ -212,7 +241,21 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
return ids;
|
||||
}
|
||||
|
||||
private List<String> searchAndReturnUnqualifiedIdValues(String uri) throws IOException, ClientProtocolException {
|
||||
List<String> ids;
|
||||
HttpGet get = new HttpGet(uri);
|
||||
|
||||
CloseableHttpResponse response = ourHttpClient.execute(get);
|
||||
try {
|
||||
String resp = IOUtils.toString(response.getEntity().getContent());
|
||||
ourLog.info(resp);
|
||||
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, resp);
|
||||
ids = toUnqualifiedIdValues(bundle);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(response);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue submitted by Bryn
|
||||
|
@ -224,7 +267,6 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
ourClient.create().resource(input).execute().getResource();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchByExtendedChars() throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -254,10 +296,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
IOUtils.closeQuietly(resp.getEntity().getContent());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
super.before();
|
||||
|
@ -576,7 +616,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
ourLog.info(responseString);
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
|
||||
assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics());
|
||||
assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)",
|
||||
oo.getIssue().get(0).getDiagnostics());
|
||||
|
||||
} finally {
|
||||
response.getEntity().getContent().close();
|
||||
|
@ -659,7 +700,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
//@formatter:on
|
||||
fail();
|
||||
} catch (PreconditionFailedException e) {
|
||||
assertEquals("HTTP 412 Precondition Failed: Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", e.getMessage());
|
||||
assertEquals("HTTP 412 Precondition Failed: Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources",
|
||||
e.getMessage());
|
||||
}
|
||||
|
||||
// Not deleted yet..
|
||||
|
@ -791,8 +833,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
}
|
||||
|
||||
/*
|
||||
* Try it with a raw socket call. The Apache client won't let us use the unescaped "|" in the URL but we want to
|
||||
* make sure that works too..
|
||||
* Try it with a raw socket call. The Apache client won't let us use the unescaped "|" in the URL but we want to make sure that works too..
|
||||
*/
|
||||
Socket sock = new Socket();
|
||||
sock.setSoTimeout(3000);
|
||||
|
@ -1326,7 +1367,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
response.close();
|
||||
}
|
||||
|
||||
get = new HttpGet(ourServerBase + "/Patient/" + pId.getIdPart() + "/$everything?_lastUpdated=%3E" + new InstantType(new Date(time2)).getValueAsString() + "&_lastUpdated=%3C" + new InstantType(new Date(time3)).getValueAsString());
|
||||
get = new HttpGet(ourServerBase + "/Patient/" + pId.getIdPart() + "/$everything?_lastUpdated=%3E" + new InstantType(new Date(time2)).getValueAsString() + "&_lastUpdated=%3C"
|
||||
+ new InstantType(new Date(time3)).getValueAsString());
|
||||
response = ourHttpClient.execute(get);
|
||||
try {
|
||||
assertEquals(200, response.getStatusLine().getStatusCode());
|
||||
|
@ -1918,7 +1960,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
Patient patient = new Patient();
|
||||
patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001");
|
||||
patient.addName().addFamily("Tester").addGiven("testSearchTokenParam1");
|
||||
patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem").setDisplay("testSearchTokenParamDisplay");
|
||||
patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem")
|
||||
.setDisplay("testSearchTokenParamDisplay");
|
||||
myPatientDao.create(patient, mySrd);
|
||||
|
||||
patient = new Patient();
|
||||
|
@ -2635,7 +2678,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
ourLog.info(responseString);
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
|
||||
assertThat(oo.getIssue().get(0).getDiagnostics(), containsString("Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"2\""));
|
||||
assertThat(oo.getIssue().get(0).getDiagnostics(), containsString(
|
||||
"Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"2\""));
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
|
@ -2659,7 +2703,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
ourLog.info(resp);
|
||||
assertEquals(412, response.getStatusLine().getStatusCode());
|
||||
assertThat(resp, not(containsString("Resource has no id")));
|
||||
assertThat(resp, stringContainsInOrder(">ERROR<", "[Patient.contact]", "<pre>SHALL at least contain a contact's details or a reference to an organization", "<issue><severity value=\"error\"/>"));
|
||||
assertThat(resp,
|
||||
stringContainsInOrder(">ERROR<", "[Patient.contact]", "<pre>SHALL at least contain a contact's details or a reference to an organization", "<issue><severity value=\"error\"/>"));
|
||||
} finally {
|
||||
IOUtils.closeQuietly(response.getEntity().getContent());
|
||||
response.close();
|
||||
|
@ -2785,7 +2830,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
assertEquals(200, response.getStatusLine().getStatusCode());
|
||||
assertThat(resp, not(containsString("Resource has no id")));
|
||||
assertThat(resp, containsString("<pre>No issues detected during validation</pre>"));
|
||||
assertThat(resp, stringContainsInOrder("<issue>", "<severity value=\"information\"/>", "<code value=\"informational\"/>", "<diagnostics value=\"No issues detected during validation\"/>", "</issue>"));
|
||||
assertThat(resp,
|
||||
stringContainsInOrder("<issue>", "<severity value=\"information\"/>", "<code value=\"informational\"/>", "<diagnostics value=\"No issues detected during validation\"/>", "</issue>"));
|
||||
} finally {
|
||||
IOUtils.closeQuietly(response.getEntity().getContent());
|
||||
response.close();
|
||||
|
@ -2810,7 +2856,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
assertEquals(200, response.getStatusLine().getStatusCode());
|
||||
assertThat(resp, not(containsString("Resource has no id")));
|
||||
assertThat(resp, containsString("<pre>No issues detected during validation</pre>"));
|
||||
assertThat(resp, stringContainsInOrder("<issue>", "<severity value=\"information\"/>", "<code value=\"informational\"/>", "<diagnostics value=\"No issues detected during validation\"/>", "</issue>"));
|
||||
assertThat(resp,
|
||||
stringContainsInOrder("<issue>", "<severity value=\"information\"/>", "<code value=\"informational\"/>", "<diagnostics value=\"No issues detected during validation\"/>", "</issue>"));
|
||||
} finally {
|
||||
IOUtils.closeQuietly(response.getEntity().getContent());
|
||||
response.close();
|
||||
|
|
|
@ -172,7 +172,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
|
|||
.execute();
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the type level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
|
||||
assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
|
||||
}
|
||||
//@formatter:on
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
|
|||
.execute();
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the type level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
|
||||
assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
|
||||
}
|
||||
//@formatter:on
|
||||
|
||||
|
|
|
@ -137,6 +137,36 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
|
|
|
@ -46,6 +46,13 @@ public class DateRangeParamTest {
|
|||
|
||||
DateRangeParam range = new DateRangeParam(startDateTime, endDateTime);
|
||||
assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
|
||||
assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());
|
||||
|
||||
// Now try with arguments reversed (should still create same range)
|
||||
range = new DateRangeParam(endDateTime, startDateTime);
|
||||
assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
|
||||
assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());
|
||||
|
||||
} finally {
|
||||
TimeZone.setDefault(tz);
|
||||
}
|
||||
|
|
|
@ -146,6 +146,36 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
|
|
|
@ -32,10 +32,166 @@ public class BaseDateTimeDtDstu2Test {
|
|||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static Locale ourDefaultLocale;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseDateTimeDtDstu2Test.class);
|
||||
|
||||
private SimpleDateFormat myDateInstantParser;
|
||||
|
||||
private FastDateFormat myDateInstantZoneParser;
|
||||
|
||||
@Test
|
||||
public void testFromTime() {
|
||||
long millis;
|
||||
InstantDt dt;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void validate(long millis, String expected) {
|
||||
InstantDt dt;
|
||||
dt = new InstantDt(new Date(millis));
|
||||
dt.setTimeZoneZulu(true);
|
||||
assertEquals(expected, dt.getValueAsString());
|
||||
|
||||
assertEquals(millis % 1000, dt.getMillis().longValue());
|
||||
assertEquals((millis % 1000) * BaseDateTimeDt.NANOS_PER_MILLIS, dt.getNanos().longValue());
|
||||
|
||||
dt = new InstantDt();
|
||||
dt.setTimeZone(TimeZone.getTimeZone("GMT+0:00"));
|
||||
dt.setValue(new Date(millis));
|
||||
assertEquals(expected.replace("Z", "+00:00"), dt.getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetPartialsYearFromExisting() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsMonthFromExisting() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsDayFromExisting() {
|
||||
InstantDt dt = new InstantDt("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() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsMinuteFromExisting() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsSecondFromExisting() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsMillisFromExisting() {
|
||||
InstantDt dt = new InstantDt("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setMillis(12);
|
||||
assertEquals(12, dt.getMillis().intValue());
|
||||
assertEquals(12 * BaseDateTimeDt.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 testSetPartialsNanosFromExisting() {
|
||||
InstantDt dt = new InstantDt("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 testSetPartialsInvalid() {
|
||||
InstantDt dt = new InstantDt("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");
|
||||
dt.setNanos(0);
|
||||
dt.setNanos(BaseDateTimeDt.NANOS_PER_SECOND - 1);
|
||||
try {
|
||||
dt.setNanos(BaseDateTimeDt.NANOS_PER_SECOND);
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertEquals("Value 1000000000 is not between allowable range: 0 - 999999999", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPartials() {
|
||||
InstantDt dt = new InstantDt("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 InstantDt();
|
||||
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());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myDateInstantParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class DecimalDtTest {
|
||||
|
||||
@Test
|
||||
public void testRoundWithMode() {
|
||||
DecimalDt dt = new DecimalDt("1.66666666");
|
||||
dt.round(3, RoundingMode.FLOOR);
|
||||
assertEquals("1.66", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValue() {
|
||||
DecimalDt dt = new DecimalDt("1.66666666");
|
||||
assertEquals(1, dt.getValueAsInteger());
|
||||
assertEquals("1.66666666", dt.getValueAsNumber().toString());
|
||||
assertEquals("1.66666666", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetValue() {
|
||||
DecimalDt dt = new DecimalDt();
|
||||
dt.setValueAsInteger(123);
|
||||
assertEquals("123", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRound() {
|
||||
DecimalDt dt = new DecimalDt("1.66666666");
|
||||
dt.round(3);
|
||||
assertEquals("1.67", dt.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareTo() {
|
||||
DecimalDt dt = new DecimalDt("1.66666666");
|
||||
assertEquals(1, dt.compareTo(null));
|
||||
assertEquals(1, dt.compareTo(new DecimalDt()));
|
||||
assertEquals(1, dt.compareTo(new DecimalDt("0.1")));
|
||||
assertEquals(-1, dt.compareTo(new DecimalDt("99")));
|
||||
assertEquals(0, dt.compareTo(new DecimalDt("1.66666666")));
|
||||
assertEquals(0, new DecimalDt().compareTo(new DecimalDt()));
|
||||
assertEquals(-1, new DecimalDt().compareTo(new DecimalDt("1.0")));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class UriDtTest {
|
||||
|
||||
@Test
|
||||
public void testFromOid() {
|
||||
UriDt uri = UriDt.fromOid("0.1.2.3.4");
|
||||
assertEquals("urn:oid:0.1.2.3.4", uri.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFromOidNull() {
|
||||
UriDt uri = UriDt.fromOid(null);
|
||||
assertEquals(null, uri.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsObject() {
|
||||
UriDt dt = new UriDt("http://example.com/foo");
|
||||
assertTrue(dt.equals(dt));
|
||||
assertFalse(dt.equals(null));
|
||||
assertFalse(dt.equals(new UriDt()));
|
||||
assertTrue(dt.equals(new UriDt("http://example.com/foo")));
|
||||
assertTrue(dt.equals(new UriDt("http://example.com/foo/")));
|
||||
assertFalse(dt.equals(new UriDt("http://blah.com/foo/")));
|
||||
assertFalse(dt.equals(new StringDt("http://example.com/foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsString() {
|
||||
UriDt dt = new UriDt("http://example.com/foo");
|
||||
assertTrue(dt.equals("http://example.com/foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
UriDt dt = new UriDt("http://example.com/foo");
|
||||
assertEquals(-1671329151, dt.hashCode());
|
||||
|
||||
dt = new UriDt();
|
||||
assertEquals(31, dt.hashCode());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetInvalid() {
|
||||
UriDt dt = new UriDt();
|
||||
dt.setValue("blah : // AA");
|
||||
dt.hashCode();
|
||||
}
|
||||
|
||||
}
|
|
@ -1040,8 +1040,11 @@ public class XmlParserDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure whitespace is preserved for pre tags
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeDivWithPre() {
|
||||
public void testEncodeDivWithPrePrettyPrint() {
|
||||
|
||||
Patient p = new Patient();
|
||||
p.getText().setDiv("<div>\n\n<p>A P TAG</p><p><pre>line1\nline2\nline3 <b>BOLD</b></pre></p></div>");
|
||||
|
@ -1059,6 +1062,28 @@ public class XmlParserDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure whitespace is preserved for pre tags
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeDivWithPreNonPrettyPrint() {
|
||||
|
||||
Patient p = new Patient();
|
||||
p.getText().setDiv("<div>\n\n<p>A P TAG</p><p><pre>line1\nline2\nline3 <b>BOLD</b></pre></p></div>");
|
||||
|
||||
String output = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(p);
|
||||
ourLog.info(output);
|
||||
|
||||
//@formatter:off
|
||||
assertThat(output, stringContainsInOrder(
|
||||
"<text><div",
|
||||
"<p>A P TAG</p><p>",
|
||||
"<pre>line1\nline2\nline3 <b>BOLD</b></pre>"
|
||||
));
|
||||
//@formatter:on
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeDoesntIncludeUuidId() {
|
||||
Patient p = new Patient();
|
||||
|
|
|
@ -175,13 +175,34 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!--<redirectTestOutputToFile>false</redirectTestOutputToFile>-->
|
||||
<runOrder>random</runOrder>
|
||||
<reuseForks>false</reuseForks>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -119,8 +119,31 @@ public class XmlParserDstu3Test {
|
|||
ourCtx.setNarrativeGenerator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure whitespace is preserved for pre tags
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeDivWithPre() {
|
||||
public void testEncodeDivWithPreNonPrettyPrint() {
|
||||
|
||||
Patient p = new Patient();
|
||||
p.getText().setDivAsString("<div>\n\n<p>A P TAG</p><p><pre>line1\nline2\nline3 <b>BOLD</b></pre></p></div>");
|
||||
|
||||
String output = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(p);
|
||||
ourLog.info(output);
|
||||
|
||||
//@formatter:off
|
||||
assertThat(output, stringContainsInOrder(
|
||||
"<text><div",
|
||||
"<p>A P TAG</p><p>",
|
||||
"<pre>line1\nline2\nline3 <b>BOLD</b></pre>"
|
||||
));
|
||||
//@formatter:on
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeDivWithPrePrettyPrint() {
|
||||
|
||||
Patient p = new Patient();
|
||||
p.getText().setDivAsString("<div>\n\n<p>A P TAG</p><p><pre>line1\nline2\nline3 <b>BOLD</b></pre></p></div>");
|
||||
|
|
|
@ -177,6 +177,36 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}../hapi-fhir-base/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -806,7 +806,6 @@
|
|||
<runOrder>random</runOrder>
|
||||
<argLine>-Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
<forkCount>1</forkCount>
|
||||
<!--<reuseForks>false</reuseForks> -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -860,6 +859,11 @@
|
|||
</coberturaReports>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.7.7.201606060606</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
|
@ -1123,7 +1127,8 @@
|
|||
<replace dir="target/site" summary="true">
|
||||
<include name="*.html"/>
|
||||
<replacetoken>\t</replacetoken>
|
||||
<replacevalue> </replacevalue>
|
||||
<replacevalue>
|
||||
</replacevalue>
|
||||
</replace>
|
||||
<replace dir="target/site" summary="true">
|
||||
<include name="index.html"/>
|
||||
|
@ -1376,6 +1381,8 @@
|
|||
<plugins>
|
||||
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <reportSets> <reportSet> <reports><report>checkstyle-aggregate</report></reports> </reportSet>
|
||||
</reportSets> <configuration> <configLocation>config/sun_checks.xml</configLocation> <includes> hapi-fhir-base/src/main/java/**/*.java </includes> </configuration> </plugin> -->
|
||||
<!-- <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.7.201606060606</version> <reportSets> <reportSet> <reports> <report>report</report> </reports> <configuration>
|
||||
<dataFileIncludes>${baseDir}/hapi-fhir-base/target/jacoco.exec</dataFileIncludes> </configuration> </reportSet> </reportSets> </plugin> -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-changes-plugin</artifactId>
|
||||
|
@ -1524,7 +1531,6 @@
|
|||
<modules>
|
||||
<module>hapi-deployable-pom</module>
|
||||
<module>hapi-fhir-base</module>
|
||||
<!--<module>hapi-fhir-oauth2</module> -->
|
||||
<module>hapi-fhir-base-test-mindeps-client</module>
|
||||
<module>hapi-fhir-base-test-mindeps-server</module>
|
||||
<module>hapi-tinder-plugin</module>
|
||||
|
@ -1548,6 +1554,7 @@
|
|||
<module>hapi-fhir-dist</module>
|
||||
<module>examples</module>
|
||||
<module>hapi-fhir-base-example-embedded-ws</module>
|
||||
<module>hapi-fhir-jacoco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
|
Loading…
Reference in New Issue