From 50c43bdb29db4c10f5510780bdebeae68b871da4 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Tue, 6 Oct 2015 09:08:25 -0400 Subject: [PATCH] Fix tests --- .../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 16 ++++++++-------- .../uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java | 2 ++ .../jpa/provider/ResourceProviderDstu2Test.java | 2 ++ .../resources/META-INF/fhirtest_persistence.xml | 2 ++ .../src/main/resources/vm/jpa_spring_beans.vm | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 049589ea631..3cc97b102b8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -162,7 +162,7 @@ public abstract class BaseHapiFhirResourceDao extends BaseH private Class myResourceType; private String mySecondaryPrimaryKeyParamName; - @Autowired + @Autowired() private ISearchResultDao mySearchResultDao; private Set addPredicateComposite(RuntimeSearchParam theParamDef, Set thePids, List theNextAnd) { @@ -1784,11 +1784,11 @@ public abstract class BaseHapiFhirResourceDao extends BaseH List results = q.getResultList(); for (ResourceLink resourceLink : results) { if (theReverseMode) { - if (theEverythingModeEnum.isEncounter()) { - if (resourceLink.getSourcePath().equals("Encounter.subject") || resourceLink.getSourcePath().equals("Encounter.patient")) { - nextRoundOmit.add(resourceLink.getSourceResourcePid()); - } - } +// if (theEverythingModeEnum.isEncounter()) { +// if (resourceLink.getSourcePath().equals("Encounter.subject") || resourceLink.getSourcePath().equals("Encounter.patient")) { +// nextRoundOmit.add(resourceLink.getSourceResourcePid()); +// } +// } pidsToInclude.add(resourceLink.getSourceResourcePid()); } else { pidsToInclude.add(resourceLink.getTargetResourcePid()); @@ -2154,8 +2154,8 @@ public abstract class BaseHapiFhirResourceDao extends BaseH CriteriaQuery cq = builder.createTupleQuery(); Root from = cq.from(ResourceTable.class); List predicates = new ArrayList(); - if (theParams.get(BaseResource.RES_ID) != null) { - StringParam idParm = (StringParam) theParams.get(BaseResource.RES_ID).get(0).get(0); + if (theParams.get(BaseResource.SP_RES_ID) != null) { + StringParam idParm = (StringParam) theParams.get(BaseResource.SP_RES_ID).get(0).get(0); predicates.add(builder.equal(from.get("myId"), idParm.getValue())); } predicates.add(builder.equal(from.get("myResourceType"), myResourceName)); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java index 96bb355fc3a..c2a4acc8257 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java @@ -678,6 +678,8 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2Test { @Test public void testTransactionDeleteMatchUrlWithTwoMatch() { + myDaoConfig.setAllowMultipleDelete(false); + String methodName = "testTransactionDeleteMatchUrlWithTwoMatch"; Patient p = new Patient(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java index 1089cb26a3f..a2b469cfe35 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java @@ -771,6 +771,8 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { obs.getEncounter().setReference(encId); IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + ourLog.info("IDs: EncU:" + encUId.getIdPart() + " Enc:" + encId.getIdPart() + " " + patientId.toUnqualifiedVersionless()); + Parameters output = ourClient.operation().onInstance(encId).named("everything").withNoParameters(Parameters.class).execute(); ca.uhn.fhir.model.dstu2.resource.Bundle b = (ca.uhn.fhir.model.dstu2.resource.Bundle) output.getParameterFirstRep().getResource(); List ids = toUnqualifiedVersionlessIds(b); diff --git a/hapi-fhir-jpaserver-example/src/main/resources/META-INF/fhirtest_persistence.xml b/hapi-fhir-jpaserver-example/src/main/resources/META-INF/fhirtest_persistence.xml index 29aef2bb642..3cf4e80f5f0 100644 --- a/hapi-fhir-jpaserver-example/src/main/resources/META-INF/fhirtest_persistence.xml +++ b/hapi-fhir-jpaserver-example/src/main/resources/META-INF/fhirtest_persistence.xml @@ -22,6 +22,8 @@ ca.uhn.fhir.jpa.entity.ResourceTag ca.uhn.fhir.jpa.entity.SubscriptionTable ca.uhn.fhir.jpa.entity.SubscriptionFlaggedResource + ca.uhn.fhir.jpa.entity.Search + ca.uhn.fhir.jpa.entity.SearchResult ca.uhn.fhir.jpa.entity.TagDefinition true diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans.vm index d80186fdc79..8d3998ad76b 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans.vm @@ -23,9 +23,10 @@ + + #if ( ${versionCapitalized} == 'Dstu2' ) -