jpa test split (#3959)

* create fhir-version specific hapi-fhir-jpaserver-test projects

* moved dstu2 tests out to dstu2 test project.

* moved dstu2 tests out to dstu2 test project.

* finished moving dstu2 tests out to dstu2 test project.

* finished moving dstu2 tests out to dstu2 test project.

* dstu3 test project compiles

* start moving dstu3 resources

* letting azure pileine know about the new modules

* finished moving dstu3 resources.  this might pass

* OK this one should pass for sure

* OK this one should pass for sure

* change test poms to test scope

* move the rest of R4 test classes

* move the rest of R4 test classes

* moar r4 moves

* moar r4 moves

* moar r4 moves

* finished with r4

* finished with r4

* started r5

* started r5

* Cache busting based on source branch name

* Fix other cache key

* cache pegged to SHa1

* test cleanup

Co-authored-by: Ken Stevens <ken@smilecdr.com>
Co-authored-by: markiantorno <markiantorno@gmail.com>
Co-authored-by: Tadgh <garygrantgraham@gmail.com>
This commit is contained in:
Ken Stevens 2022-08-31 22:46:17 -04:00 committed by GitHub
parent d9134fc553
commit 68c343902a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
709 changed files with 1574 additions and 1120 deletions

View File

@ -18,6 +18,14 @@ stages:
- template: test-job-template.yml - template: test-job-template.yml
parameters: parameters:
modules: modules:
- name: hapi_fhir_jpaserver_test_dstu2
module: hapi-fhir-jpaserver-test-dstu2
- name: hapi_fhir_jpaserver_test_dstu3
module: hapi-fhir-jpaserver-test-dstu3
- name: hapi_fhir_jpaserver_test_r4
module: hapi-fhir-jpaserver-test-r4
- name: hapi_fhir_jpaserver_test_r5
module: hapi-fhir-jpaserver-test-r5
- name: hapi_fhir_jpaserver_test_utilities - name: hapi_fhir_jpaserver_test_utilities
module: hapi-fhir-jpaserver-test-utilities module: hapi-fhir-jpaserver-test-utilities
- name: hapi_fhir_structures_r4 - name: hapi_fhir_structures_r4
@ -52,9 +60,9 @@ stages:
module: hapi-fhir-jaxrsserver-base module: hapi-fhir-jaxrsserver-base
- name: hapi_fhir_jpa - name: hapi_fhir_jpa
module: hapi-fhir-jpa module: hapi-fhir-jpa
# Put to top, but kept in order here # Put to top, but kept in order here
# - name: hapi_fhir_jpaserver_base # - name: hapi_fhir_jpaserver_base
# module: hapi-fhir-jpaserver-base # module: hapi-fhir-jpaserver-base
- name: hapi_fhir_jpaserver_cql - name: hapi_fhir_jpaserver_cql
module: hapi-fhir-jpaserver-cql module: hapi-fhir-jpaserver-cql
- name: hapi_fhir_jpaserver_elastic_test_utilities - name: hapi_fhir_jpaserver_elastic_test_utilities
@ -67,9 +75,9 @@ stages:
module: hapi-fhir-jpaserver-searchparam module: hapi-fhir-jpaserver-searchparam
- name: hapi_fhir_jpaserver_subscription - name: hapi_fhir_jpaserver_subscription
module: hapi-fhir-jpaserver-subscription module: hapi-fhir-jpaserver-subscription
# Put to top, but kept in order here # Put to top, but kept in order here
# - name: hapi_fhir_jpaserver_test_utilities # - name: hapi_fhir_jpaserver_test_utilities
# module: hapi-fhir-jpaserver-test-utilities # module: hapi-fhir-jpaserver-test-utilities
- name: hapi_fhir_jpaserver_uhnfhirtest - name: hapi_fhir_jpaserver_uhnfhirtest
module: hapi-fhir-jpaserver-uhnfhirtest module: hapi-fhir-jpaserver-uhnfhirtest
- name: hapi_fhir_server - name: hapi_fhir_server
@ -100,9 +108,9 @@ stages:
module: hapi-fhir-structures-dstu3 module: hapi-fhir-structures-dstu3
- name: hapi_fhir_structures_hl7org_dstu2 - name: hapi_fhir_structures_hl7org_dstu2
module: hapi-fhir-structures-hl7org-dstu2 module: hapi-fhir-structures-hl7org-dstu2
# Put to top, but kept in order here # Put to top, but kept in order here
# - name: hapi_fhir_structures_r4 # - name: hapi_fhir_structures_r4
# module: hapi-fhir-structures-r4 # module: hapi-fhir-structures-r4
- name: hapi_fhir_structures_r5 - name: hapi_fhir_structures_r5
module: hapi-fhir-structures-r5 module: hapi-fhir-structures-r5
- name: hapi_fhir_test_utilities - name: hapi_fhir_test_utilities

View File

@ -96,6 +96,27 @@
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId> <artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-dstu2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-dstu3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-r4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-r5</artifactId>
<version>${project.version}</version>
</dependency>
<!-- TODO KHS temporarily disable these tests because they are blocking ci <!-- TODO KHS temporarily disable these tests because they are blocking ci
<dependency> <dependency>

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.2.0-PRE2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<packaging>jar</packaging>
<name>HAPI FHIR JPA Server Test Dstu2</name>
<artifactId>hapi-fhir-jpaserver-test-dstu2</artifactId>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<!--<useManifestOnlyJar>false</useManifestOnlyJar>-->
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<runOrder>alphabetical</runOrder>
<includes>
<include>**/*IT.java</include>
</includes>
<useModulePath>false</useModulePath>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit_version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
<argLine>@{argLine} ${surefire_jvm_args}</argLine>
<forkCount>0.6C</forkCount>
<excludes>*StressTest*</excludes>
<skip>${skipFailsafe}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>NOPARALLEL</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<excludes>
<exclude>**/stresstest/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>CI</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -17,7 +17,13 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import java.io.*; import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL; import java.net.URL;
import java.util.Collection; import java.util.Collection;

View File

@ -9,8 +9,6 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper;
import ca.uhn.fhir.jpa.test.config.TestDstu2Config;
import ca.uhn.fhir.jpa.test.BaseJpaTest;
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao; import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao; import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao;
@ -23,6 +21,8 @@ import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController;
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader;
import ca.uhn.fhir.jpa.test.BaseJpaTest;
import ca.uhn.fhir.jpa.test.config.TestDstu2Config;
import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt;
@ -58,6 +58,7 @@ import ca.uhn.fhir.model.dstu2.resource.ValueSet;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory; import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -72,8 +73,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.fail; import java.util.List;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {TestDstu2Config.class}) @ContextConfiguration(classes = {TestDstu2Config.class})
@ -262,5 +263,11 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
myJpaValidationSupportChain.invalidateCaches(); myJpaValidationSupportChain.invalidateCaches();
} }
protected List<IIdType> toUnqualifiedVersionlessIds(Bundle theFound) {
List<IIdType> retVal = new ArrayList<>();
for (Bundle.Entry next : theFound.getEntry()) {
retVal.add(next.getResource().getId().toUnqualifiedVersionless());
}
return retVal;
}
} }

View File

@ -37,7 +37,6 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -1,27 +1,31 @@
package ca.uhn.fhir.jpa.dao.dstu2; package ca.uhn.fhir.jpa.dao.dstu2;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.model.dstu2.resource.Device;
import ca.uhn.fhir.model.dstu2.resource.Observation;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult; import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import javax.servlet.http.HttpServletRequest;
import ca.uhn.fhir.model.dstu2.resource.*; import java.util.List;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
import ca.uhn.fhir.model.primitive.StringDt; import static org.hamcrest.MatcherAssert.assertThat;
import ca.uhn.fhir.rest.api.Constants; import static org.hamcrest.Matchers.contains;
import ca.uhn.fhir.rest.param.*; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.mock;
public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test { public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {

View File

@ -5,8 +5,8 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.BaseStorageDao; import ca.uhn.fhir.jpa.dao.BaseStorageDao;
import ca.uhn.fhir.jpa.dao.DaoTestUtils;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao; import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3Test;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants; import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
@ -609,7 +609,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
myOrganizationDao.delete(orgId, mySrd); myOrganizationDao.delete(orgId, mySrd);
fail(); fail();
} catch (ResourceVersionConflictException e) { } catch (ResourceVersionConflictException e) {
FhirResourceDaoDstu3Test.assertConflictException(e); DaoTestUtils.assertConflictException(e);
} }

View File

@ -9,8 +9,6 @@ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.param.StringAndListParam; import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam; import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.util.TestUtil;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,10 +1,7 @@
package ca.uhn.fhir.jpa.dao.dstu2; package ca.uhn.fhir.jpa.dao.dstu2;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import ca.uhn.fhir.util.TestUtil;
public class FhirSystemDaoDstu2SearchTest extends BaseJpaDstu2SystemTest { public class FhirSystemDaoDstu2SearchTest extends BaseJpaDstu2SystemTest {

View File

@ -10,10 +10,8 @@ import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -1,13 +1,19 @@
package ca.uhn.fhir.jpa.subscription; package ca.uhn.fhir.jpa.subscription;
import org.hl7.fhir.instance.model.api.*;
import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu2.resource.*; import ca.uhn.fhir.model.dstu2.resource.Observation;
import ca.uhn.fhir.model.dstu2.valueset.*; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.resource.Subscription;
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dstu2.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseResource;
public class FhirDstu2Util { public class FhirDstu2Util {

View File

@ -1,8 +1,8 @@
package ca.uhn.fhir.jpa.subscription.email; package ca.uhn.fhir.jpa.subscription.email;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test; import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl; import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Observation;
@ -33,7 +33,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import static ca.uhn.fhir.jpa.subscription.resthook.RestHookTestDstu3Test.logAllInterceptors; import static ca.uhn.fhir.jpa.dao.DaoTestUtils.logAllInterceptors;
import static org.awaitility.Awaitility.await; import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;

View File

@ -40,7 +40,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.jpa.subscription.resthook.RestHookTestDstu3Test.logAllInterceptors; import static ca.uhn.fhir.jpa.dao.DaoTestUtils.logAllInterceptors;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -3,8 +3,8 @@ package ca.uhn.fhir.jpa.subscription.resthook;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test; import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Observation;

View File

@ -18,6 +18,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
@ -29,7 +30,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.MatcherAssert.assertThat;
// This is currently disabled as the criteria mechanism was a non-standard experiment // This is currently disabled as the criteria mechanism was a non-standard experiment
@Disabled @Disabled
@ -121,7 +121,7 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
ourLog.info("WS Messages: {}", mySocketImplementation.getMessages()); ourLog.info("WS Messages: {}", mySocketImplementation.getMessages());
waitForSize(2, mySocketImplementation.getMessages()); waitForSize(2, mySocketImplementation.getMessages());
assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId, "ping " + mySubscriptionId)); MatcherAssert.assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId, "ping " + mySubscriptionId));
} }
@Test @Test
@ -145,6 +145,6 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
waitForSize(2, mySocketImplementation.getMessages()); waitForSize(2, mySocketImplementation.getMessages());
ourLog.info("WS Messages: {}", mySocketImplementation.getMessages()); ourLog.info("WS Messages: {}", mySocketImplementation.getMessages());
assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId)); MatcherAssert.assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId));
} }
} }

View File

@ -19,6 +19,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -30,7 +31,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.MatcherAssert.assertThat;
/** /**
* Adds a FHIR subscription with criteria through the rest interface. Then creates a websocket with the id of the * Adds a FHIR subscription with criteria through the rest interface. Then creates a websocket with the id of the
@ -141,7 +141,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
ourLog.info("WS Messages: {}", mySocketImplementation.getMessages()); ourLog.info("WS Messages: {}", mySocketImplementation.getMessages());
waitForSize(2, mySocketImplementation.getMessages()); waitForSize(2, mySocketImplementation.getMessages());
assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId, "ping " + mySubscriptionId)); MatcherAssert.assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId, "ping " + mySubscriptionId));
} }
@Test @Test
@ -165,6 +165,6 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
ourLog.info("WS Messages: {}", mySocketImplementation.getMessages()); ourLog.info("WS Messages: {}", mySocketImplementation.getMessages());
waitForSize(1, mySocketImplementation.getMessages()); waitForSize(1, mySocketImplementation.getMessages());
assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId)); MatcherAssert.assertThat(mySocketImplementation.getMessages(), contains("bound " + mySubscriptionId));
} }
} }

View File

@ -17,7 +17,13 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import java.io.*; import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL; import java.net.URL;
import java.util.Collection; import java.util.Collection;

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.2.0-PRE2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<packaging>jar</packaging>
<name>HAPI FHIR JPA Server Test Dstu3</name>
<artifactId>hapi-fhir-jpaserver-test-dstu3</artifactId>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<!--<useManifestOnlyJar>false</useManifestOnlyJar>-->
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<runOrder>alphabetical</runOrder>
<includes>
<include>**/*IT.java</include>
</includes>
<useModulePath>false</useModulePath>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit_version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
<argLine>@{argLine} ${surefire_jvm_args}</argLine>
<forkCount>0.6C</forkCount>
<excludes>*StressTest*</excludes>
<skip>${skipFailsafe}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>NOPARALLEL</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<excludes>
<exclude>**/stresstest/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>CI</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -20,12 +20,11 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #L% * #L%
*/ */
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.StringType;
import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.StringType;
@ResourceDef(name = "Observation", profile = CustomObservationDstu3.PROFILE) @ResourceDef(name = "Observation", profile = CustomObservationDstu3.PROFILE)
public class CustomObservationDstu3 extends Observation { public class CustomObservationDstu3 extends Observation {

View File

@ -4,7 +4,7 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.jpa.util.CoordCalculatorTest; import ca.uhn.fhir.jpa.util.CoordCalculatorTestUtil;
import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.param.TokenParam;
import org.hl7.fhir.dstu3.model.Location; import org.hl7.fhir.dstu3.model.Location;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -32,8 +32,8 @@ public class FhirResourceDaoDstu3SearchDistanceTest extends BaseJpaDstu3Test {
@Test @Test
public void testNearSearchDistanceNoDistance() { public void testNearSearchDistanceNoDistance() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_CHIN; double latitude = CoordCalculatorTestUtil.LATITUDE_CHIN;
double longitude = CoordCalculatorTest.LONGITUDE_CHIN; double longitude = CoordCalculatorTestUtil.LONGITUDE_CHIN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue(); String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
@ -50,8 +50,8 @@ public class FhirResourceDaoDstu3SearchDistanceTest extends BaseJpaDstu3Test {
@Test @Test
public void testNearSearchDistanceZero() { public void testNearSearchDistanceZero() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_CHIN; double latitude = CoordCalculatorTestUtil.LATITUDE_CHIN;
double longitude = CoordCalculatorTest.LONGITUDE_CHIN; double longitude = CoordCalculatorTestUtil.LONGITUDE_CHIN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue(); String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
@ -70,17 +70,17 @@ public class FhirResourceDaoDstu3SearchDistanceTest extends BaseJpaDstu3Test {
@Test @Test
public void testNearSearchApproximate() { public void testNearSearchApproximate() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_UHN; double latitude = CoordCalculatorTestUtil.LATITUDE_UHN;
double longitude = CoordCalculatorTest.LONGITUDE_UHN; double longitude = CoordCalculatorTestUtil.LONGITUDE_UHN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue(); String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
{ // In the box { // In the box
double bigEnoughDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN * 2; double bigEnoughDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN * 2;
SearchParameterMap map = myMatchUrlService.translateMatchUrl( SearchParameterMap map = myMatchUrlService.translateMatchUrl(
"Location?" + "Location?" +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + ":" + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + ":" + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + "|http://unitsofmeasure.org|km", myFhirContext.getResourceDefinition("Location")); Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + "|http://unitsofmeasure.org|km", myFhirContext.getResourceDefinition("Location"));
@ -88,11 +88,11 @@ public class FhirResourceDaoDstu3SearchDistanceTest extends BaseJpaDstu3Test {
assertThat(ids, contains(locId)); assertThat(ids, contains(locId));
} }
{ // Outside the box { // Outside the box
double tooSmallDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN / 2; double tooSmallDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN / 2;
SearchParameterMap map = myMatchUrlService.translateMatchUrl( SearchParameterMap map = myMatchUrlService.translateMatchUrl(
"Location?" + "Location?" +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + ":" + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + ":" + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + "|http://unitsofmeasure.org|km", myFhirContext.getResourceDefinition("Location")); Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + "|http://unitsofmeasure.org|km", myFhirContext.getResourceDefinition("Location"));

View File

@ -17,9 +17,9 @@ import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Quantity; import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
@ -29,7 +29,6 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;

View File

@ -20,10 +20,10 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.matchesPattern; import static org.hamcrest.Matchers.matchesPattern;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@SuppressWarnings({"Duplicates"}) @SuppressWarnings({"Duplicates"})

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.DaoTestUtils;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants; import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
@ -107,7 +108,6 @@ import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.matchesPattern;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -865,7 +865,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
myOrganizationDao.delete(orgId, mySrd); myOrganizationDao.delete(orgId, mySrd);
fail(); fail();
} catch (ResourceVersionConflictException e) { } catch (ResourceVersionConflictException e) {
assertConflictException(e); DaoTestUtils.assertConflictException(e);
} }
myPatientDao.delete(patId, mySrd); myPatientDao.delete(patId, mySrd);
@ -1007,7 +1007,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
myObservationDao.deleteByUrl("Observation?_has:DiagnosticReport:result:identifier=foo|IDENTIFIER", mySrd); myObservationDao.deleteByUrl("Observation?_has:DiagnosticReport:result:identifier=foo|IDENTIFIER", mySrd);
fail(); fail();
} catch (ResourceVersionConflictException e) { } catch (ResourceVersionConflictException e) {
assertConflictException(e); DaoTestUtils.assertConflictException(e);
} }
myObservationDao.read(obs1id); myObservationDao.read(obs1id);
@ -3410,11 +3410,6 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
} }
public static void assertConflictException(ResourceVersionConflictException e) {
assertThat(e.getMessage(), matchesPattern(
Msg.code(550) + Msg.code(515) + "Unable to delete [a-zA-Z]+/[0-9]+ because at least one resource has a reference to this resource. First reference found was resource [a-zA-Z]+/[0-9]+ in path [a-zA-Z]+.[a-zA-Z]+"));
}
private static List<String> toStringList(List<UriType> theUriType) { private static List<String> toStringList(List<UriType> theUriType) {
ArrayList<String> retVal = new ArrayList<>(); ArrayList<String> retVal = new ArrayList<>();
for (UriType next : theUriType) { for (UriType next : theUriType) {

View File

@ -2,11 +2,11 @@ package ca.uhn.fhir.jpa.dao.dstu3;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;

View File

@ -1,22 +1,23 @@
package ca.uhn.fhir.jpa.dao.dstu3; package ca.uhn.fhir.jpa.dao.dstu3;
import static org.hamcrest.Matchers.containsInAnyOrder; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import static org.hamcrest.Matchers.empty; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.List;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam;
import org.hl7.fhir.dstu3.model.Organization; import org.hl7.fhir.dstu3.model.Organization;
import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Patient;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; import java.util.List;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.Constants; import static org.hamcrest.MatcherAssert.assertThat;
import ca.uhn.fhir.rest.param.*; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
public class FhirSearchDaoDstu3Test extends BaseJpaDstu3Test { public class FhirSearchDaoDstu3Test extends BaseJpaDstu3Test {

View File

@ -10,7 +10,6 @@ import ca.uhn.fhir.jpa.dao.r4.FhirSystemDaoR4;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor; import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.model.entity.ResourceTag; import ca.uhn.fhir.jpa.model.entity.ResourceTag;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
import ca.uhn.fhir.jpa.provider.SystemProviderDstu2Test;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
@ -1670,7 +1669,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test @Test
public void testTransactionFromBundle() throws Exception { public void testTransactionFromBundle() throws Exception {
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/transaction_link_patient_eve.xml"); InputStream bundleRes = FhirSystemDaoDstu3Test.class.getResourceAsStream("/transaction_link_patient_eve.xml");
String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8); String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8);
Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr); Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr);
@ -1711,7 +1710,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test @Test
public void testTransactionFromBundle6() throws Exception { public void testTransactionFromBundle6() throws Exception {
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/simone_bundle3.xml"); InputStream bundleRes = FhirSystemDaoDstu3Test.class.getResourceAsStream("/simone_bundle3.xml");
String bundle = IOUtils.toString(bundleRes, StandardCharsets.UTF_8); String bundle = IOUtils.toString(bundleRes, StandardCharsets.UTF_8);
Bundle output = mySystemDao.transaction(mySrd, myFhirContext.newXmlParser().parseResource(Bundle.class, bundle)); Bundle output = mySystemDao.transaction(mySrd, myFhirContext.newXmlParser().parseResource(Bundle.class, bundle));
ourLog.info(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); ourLog.info(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output));
@ -1720,7 +1719,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test @Test
public void testTransactionFromBundleJosh() throws Exception { public void testTransactionFromBundleJosh() throws Exception {
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/josh-bundle.json"); InputStream bundleRes = FhirSystemDaoDstu3Test.class.getResourceAsStream("/josh-bundle.json");
String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8); String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8);
Bundle bundle = myFhirContext.newJsonParser().parseResource(Bundle.class, bundleStr); Bundle bundle = myFhirContext.newJsonParser().parseResource(Bundle.class, bundleStr);
@ -2224,7 +2223,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Disabled @Disabled
public void testTransactionWithBundledValidationSourceAndTarget() throws Exception { public void testTransactionWithBundledValidationSourceAndTarget() throws Exception {
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/questionnaire-sdc-profile-example-ussg-fht.xml"); InputStream bundleRes = FhirSystemDaoDstu3Test.class.getResourceAsStream("/questionnaire-sdc-profile-example-ussg-fht.xml");
String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8); String bundleStr = IOUtils.toString(bundleRes, StandardCharsets.UTF_8);
Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr); Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr);

View File

@ -10,18 +10,18 @@ import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.test.concurrency.PointcutLatch; import ca.uhn.test.concurrency.PointcutLatch;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@ -41,8 +41,8 @@ public class ExpungeHookTest extends BaseJpaDstu3Test {
@BeforeEach @BeforeEach
public void before() { public void before() {
myDaoConfig.setExpungeEnabled(true); myDaoConfig.setExpungeEnabled(true);
myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC);
myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true);
myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING, myEverythingLatch); myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING, myEverythingLatch);
myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE, myExpungeResourceLatch); myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE, myExpungeResourceLatch);
} }
@ -52,6 +52,8 @@ public class ExpungeHookTest extends BaseJpaDstu3Test {
assertTrue(myInterceptorService.unregisterInterceptor(myEverythingLatch)); assertTrue(myInterceptorService.unregisterInterceptor(myEverythingLatch));
assertTrue(myInterceptorService.unregisterInterceptor(myExpungeResourceLatch)); assertTrue(myInterceptorService.unregisterInterceptor(myExpungeResourceLatch));
myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy());
myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets());
} }
@Test @Test
@ -68,41 +70,41 @@ public class ExpungeHookTest extends BaseJpaDstu3Test {
assertPatientGone(id); assertPatientGone(id);
} }
@Test @Test
public void expungeEverythingAndRecreate() throws InterruptedException { public void expungeEverythingAndRecreate() throws InterruptedException {
// Create a patient. // Create a patient.
Patient thePatient = new Patient(); Patient thePatient = new Patient();
thePatient.setId("ABC123"); thePatient.setId("ABC123");
Meta theMeta = new Meta(); Meta theMeta = new Meta();
theMeta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"); theMeta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient");
thePatient.setMeta(theMeta); thePatient.setMeta(theMeta);
IIdType id = myPatientDao.update(thePatient, mySrd).getId(); IIdType id = myPatientDao.update(thePatient, mySrd).getId();
assertNotNull(myPatientDao.read(id)); assertNotNull(myPatientDao.read(id));
// Expunge it directly. // Expunge it directly.
myPatientDao.delete(id); myPatientDao.delete(id);
ExpungeOptions options = new ExpungeOptions(); ExpungeOptions options = new ExpungeOptions();
options.setExpungeEverything(true); options.setExpungeEverything(true);
options.setExpungeDeletedResources(true); options.setExpungeDeletedResources(true);
options.setExpungeOldVersions(true); options.setExpungeOldVersions(true);
myPatientDao.expunge(id.toUnqualifiedVersionless(), options, mySrd); myPatientDao.expunge(id.toUnqualifiedVersionless(), options, mySrd);
assertPatientGone(id); assertPatientGone(id);
// Create it a second time.
myPatientDao.update(thePatient, mySrd);
assertNotNull(myPatientDao.read(id));
// Expunge everything with the service. // Create it a second time.
myEverythingLatch.setExpectedCount(1); myPatientDao.update(thePatient, mySrd);
myExpungeService.expunge(null, null, options, mySrd); assertNotNull(myPatientDao.read(id));
myEverythingLatch.awaitExpected();
assertPatientGone(id);
// Create it a third time. // Expunge everything with the service.
myPatientDao.update(thePatient, mySrd); myEverythingLatch.setExpectedCount(1);
assertNotNull(myPatientDao.read(id)); myExpungeService.expunge(null, null, options, mySrd);
} myEverythingLatch.awaitExpected();
assertPatientGone(id);
// Create it a third time.
myPatientDao.update(thePatient, mySrd);
assertNotNull(myPatientDao.read(id));
}
private void assertPatientGone(IIdType theId) { private void assertPatientGone(IIdType theId) {
try { try {

View File

@ -40,7 +40,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
@Autowired @Autowired
private IPackageCacheManager myPackageCacheManager; private IPackageCacheManager myPackageCacheManager;
private Server myServer; private Server myServer;
private NpmR4Test.FakeNpmServlet myFakeNpmServlet; private FakeNpmServlet myFakeNpmServlet;
@Autowired @Autowired
private INpmPackageVersionDao myPackageVersionDao; private INpmPackageVersionDao myPackageVersionDao;
private int myPort; private int myPort;
@ -51,7 +51,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
myServer = new Server(0); myServer = new Server(0);
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
myFakeNpmServlet = new NpmR4Test.FakeNpmServlet(); myFakeNpmServlet = new FakeNpmServlet();
ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet); ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet);
proxyHandler.addServletWithMapping(servletHolder, "/*"); proxyHandler.addServletWithMapping(servletHolder, "/*");
myServer.setHandler(proxyHandler); myServer.setHandler(proxyHandler);

View File

@ -2,7 +2,6 @@ package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.jpa.graphql.GraphQLProvider; import ca.uhn.fhir.jpa.graphql.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider; import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider; import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider;
@ -10,6 +9,7 @@ import ca.uhn.fhir.jpa.provider.ValueSetOperationProvider;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl; import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl;
import ca.uhn.fhir.jpa.subscription.match.config.WebsocketDispatcherConfig; import ca.uhn.fhir.jpa.subscription.match.config.WebsocketDispatcherConfig;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.parser.StrictErrorHandler;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;

View File

@ -1,16 +1,13 @@
package ca.uhn.fhir.jpa.provider.dstu3; package ca.uhn.fhir.jpa.provider.dstu3;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import ca.uhn.fhir.util.TestUtil; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CorsDstu3Test extends BaseResourceProviderDstu3Test { public class CorsDstu3Test extends BaseResourceProviderDstu3Test {

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.provider.dstu3; package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.provider.GraphQLProviderTestUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.util.UrlUtil; import ca.uhn.fhir.util.UrlUtil;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -14,8 +15,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import static ca.uhn.fhir.jpa.provider.GraphQLR4ProviderTest.DATA_PREFIX;
import static ca.uhn.fhir.jpa.provider.GraphQLR4ProviderTest.DATA_SUFFIX;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test { public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
@ -32,14 +31,14 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp); ourLog.info(resp);
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" + assertEquals(TestUtil.stripWhitespace(GraphQLProviderTestUtil.DATA_PREFIX +"{\n" +
" \"name\":[{\n" + " \"name\":[{\n" +
" \"family\":\"FAM\",\n" + " \"family\":\"FAM\",\n" +
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
" },{\n" + " },{\n" +
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
" }]\n" + " }]\n" +
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); "}" + GraphQLProviderTestUtil.DATA_SUFFIX), TestUtil.stripWhitespace(resp));
} }
} }
@ -54,7 +53,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp); ourLog.info(resp);
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" + assertEquals(TestUtil.stripWhitespace(GraphQLProviderTestUtil.DATA_PREFIX +"{\n" +
" \"PatientList\":[{\n" + " \"PatientList\":[{\n" +
" \"name\":[{\n" + " \"name\":[{\n" +
" \"family\":\"FAM\",\n" + " \"family\":\"FAM\",\n" +
@ -67,7 +66,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
" }]\n" + " }]\n" +
" }]\n" + " }]\n" +
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); "}" + GraphQLProviderTestUtil.DATA_SUFFIX), TestUtil.stripWhitespace(resp));
} }
} }

View File

@ -2,22 +2,17 @@ package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException; import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.CapabilityStatement; import org.hl7.fhir.dstu3.model.CapabilityStatement;
import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.PrimitiveType; import org.hl7.fhir.dstu3.model.PrimitiveType;
import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.StringType;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.provider.dstu3; package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.util.CoordCalculatorTest; import ca.uhn.fhir.jpa.util.CoordCalculatorTestUtil;
import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Location; import org.hl7.fhir.dstu3.model.Location;
import org.hl7.fhir.dstu3.model.PractitionerRole; import org.hl7.fhir.dstu3.model.PractitionerRole;
@ -24,16 +24,16 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
@Test @Test
public void testNearSearchApproximate() { public void testNearSearchApproximate() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_UHN; double latitude = CoordCalculatorTestUtil.LATITUDE_UHN;
double longitude = CoordCalculatorTest.LONGITUDE_UHN; double longitude = CoordCalculatorTestUtil.LONGITUDE_UHN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless(); IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
{ // In the box { // In the box
double bigEnoughDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN * 2; double bigEnoughDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN * 2;
String url = "/Location?" + String url = "/Location?" +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km"); Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
@ -49,9 +49,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
assertEquals(locId.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart()); assertEquals(locId.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());
} }
{ // Outside the box { // Outside the box
double tooSmallDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN / 2; double tooSmallDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN / 2;
String url = "/Location?" + String url = "/Location?" +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km"); Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
@ -72,8 +72,8 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
@Test @Test
public void testNearSearchDistanceNoDistanceChained() { public void testNearSearchDistanceNoDistanceChained() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_CHIN; double latitude = CoordCalculatorTestUtil.LATITUDE_CHIN;
double longitude = CoordCalculatorTest.LONGITUDE_CHIN; double longitude = CoordCalculatorTestUtil.LONGITUDE_CHIN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless(); IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
@ -100,8 +100,8 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
@Test @Test
public void testNearSearchApproximateChained() { public void testNearSearchApproximateChained() {
Location loc = new Location(); Location loc = new Location();
double latitude = CoordCalculatorTest.LATITUDE_UHN; double latitude = CoordCalculatorTestUtil.LATITUDE_UHN;
double longitude = CoordCalculatorTest.LONGITUDE_UHN; double longitude = CoordCalculatorTestUtil.LONGITUDE_UHN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude); Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position); loc.setPosition(position);
myCaptureQueriesListener.clear(); myCaptureQueriesListener.clear();
@ -112,9 +112,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
pr.addLocation().setReference(locId.getValue()); pr.addLocation().setReference(locId.getValue());
IIdType prId = myPractitionerRoleDao.create(pr).getId().toUnqualifiedVersionless(); IIdType prId = myPractitionerRoleDao.create(pr).getId().toUnqualifiedVersionless();
{ // In the box { // In the box
double bigEnoughDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN * 2; double bigEnoughDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN * 2;
String url = "PractitionerRole?location." + String url = "PractitionerRole?location." +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
"location." + Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km"); "location." + Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
@ -133,9 +133,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
} }
{ // Outside the box { // Outside the box
double tooSmallDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN / 2; double tooSmallDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN / 2;
String url = "PractitionerRole?location." + String url = "PractitionerRole?location." +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTest.LONGITUDE_CHIN + Location.SP_NEAR + "=" + CoordCalculatorTestUtil.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTestUtil.LONGITUDE_CHIN +
"&" + "&" +
"location." + Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km"); "location." + Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");

View File

@ -4,13 +4,11 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.StructureDefinition; import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -4,7 +4,6 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.dao.data.ISearchDao;
import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.provider.r4.ResourceProviderR4Test;
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;
@ -326,7 +325,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
ourRestServer.registerInterceptor(interceptor); ourRestServer.registerInterceptor(interceptor);
try { try {
String input = IOUtils.toString(ResourceProviderR4Test.class.getResourceAsStream("/bug872-ext-with-hl7-url.json"), Charsets.UTF_8); String input = IOUtils.toString(ResourceProviderDstu3Test.class.getResourceAsStream("/bug872-ext-with-hl7-url.json"), Charsets.UTF_8);
HttpPost post = new HttpPost(ourServerBase + "/Patient/aaa"); HttpPost post = new HttpPost(ourServerBase + "/Patient/aaa");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON)); post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));

View File

@ -4,7 +4,6 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest;
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConcept;
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
@ -735,7 +734,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
String url = ourServerBase + String url = ourServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" + "/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM) + UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA"; "&code=AA";
ourLog.info("* Requesting: {}", url); ourLog.info("* Requesting: {}", url);

View File

@ -2,7 +2,6 @@ package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -19,9 +18,9 @@ import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse; import org.hl7.fhir.dstu3.model.QuestionnaireResponse;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Collection; import java.util.Collection;

Some files were not shown because too many files have changed in this diff Show More