remove dummy test
This commit is contained in:
parent
33fbffcff9
commit
daa3bc773e
|
@ -278,7 +278,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
|||
};
|
||||
|
||||
Supplier<IIdType> idSupplier = () -> {
|
||||
myTxTemplate.execute(tx -> {
|
||||
return myTxTemplate.execute(tx -> {
|
||||
IIdType retVal = myIdHelperService.translatePidIdToForcedId(myFhirContext, myResourceName, pid);
|
||||
if (!retVal.hasVersionIdPart()) {
|
||||
IIdType idWithVersion = myMemoryCacheService.getIfPresent(MemoryCacheService.CacheEnum.RESOURCE_CONDITIONAL_CREATE_VERSION, pid.getIdAsLong());
|
||||
|
@ -1626,8 +1626,6 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
|||
entity = myEntityManager.find(ResourceTable.class, pid.getId());
|
||||
resourceId = entity.getIdDt();
|
||||
} else {
|
||||
//FIXME JUAN: This is where the actual resource is replaced with a contained version in the create test. The update test correctly
|
||||
//keeps this as a URN:UUID reference for now.
|
||||
DaoMethodOutcome outcome = create(resource, null, thePerformIndexing, theTransactionDetails, theRequest);
|
||||
|
||||
// Pre-cache the match URL
|
||||
|
|
|
@ -791,7 +791,6 @@ public abstract class BaseTransactionProcessor {
|
|||
String matchUrl = myVersionAdapter.getEntryRequestIfNoneExist(nextReqEntry);
|
||||
matchUrl = performIdSubstitutionsInMatchUrl(theIdSubstitutions, matchUrl);
|
||||
outcome = resourceDao.create(res, matchUrl, false, theTransactionDetails, theRequest);
|
||||
// IS THIS THE MAGIC SAUCE?
|
||||
res.setId(outcome.getId());
|
||||
if (nextResourceId != null) {
|
||||
handleTransactionCreateOrUpdateOutcome(theIdSubstitutions, theIdToPersistedOutcome, nextResourceId, outcome, nextRespEntry, resourceType, res, theRequest);
|
||||
|
@ -1013,7 +1012,7 @@ public abstract class BaseTransactionProcessor {
|
|||
|
||||
for (IIdType next : theAllIds) {
|
||||
IIdType replacement = theIdSubstitutions.get(next);
|
||||
if (replacement != null && replacement.equals(next)) {
|
||||
if (replacement != null && !replacement.equals(next)) {
|
||||
ourLog.debug("Placeholder resource ID \"{}\" was replaced with permanent ID \"{}\"", next, replacement);
|
||||
}
|
||||
}
|
||||
|
@ -1123,7 +1122,6 @@ public abstract class BaseTransactionProcessor {
|
|||
IIdType targetId = resourceReference.getResource().getIdElement();
|
||||
if (targetId.getValue() == null || targetId.getValue().startsWith("#")) {
|
||||
// This means it's a contained resource
|
||||
ourLog.error("THIS THING ISN'T CONTAINED! WHY IS IT CONTAINED!!! ");
|
||||
continue;
|
||||
} else if (theIdSubstitutions.containsValue(targetId)) {
|
||||
newId = targetId;
|
||||
|
|
|
@ -41,7 +41,6 @@ import ca.uhn.fhir.rest.param.TokenParam;
|
|||
import ca.uhn.fhir.util.StopWatch;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.jena.ext.com.google.common.base.Optional;
|
||||
import org.hibernate.internal.SessionImpl;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
|
@ -68,6 +67,7 @@ import java.util.HashSet;
|
|||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -223,7 +223,6 @@ public class TransactionProcessor extends BaseTransactionProcessor {
|
|||
if (param instanceof TokenParam) {
|
||||
Predicate hashPredicate = buildHashPredicateFromTokenParam((TokenParam)param, requestPartitionId, cb, from, next);
|
||||
|
||||
//Some partition witchcraft
|
||||
if (hashPredicate != null) {
|
||||
if (myPartitionSettings.isPartitioningEnabled() && !myPartitionSettings.isIncludePartitionInSearchHashes()) {
|
||||
if (requestPartitionId.isDefaultPartition()) {
|
||||
|
@ -251,13 +250,11 @@ public class TransactionProcessor extends BaseTransactionProcessor {
|
|||
List<ResourceIndexedSearchParamToken> results = query.getResultList();
|
||||
|
||||
for (ResourceIndexedSearchParamToken nextResult : results) {
|
||||
Optional<MatchUrlToResolve> matchedSearch = Optional
|
||||
.fromNullable(hashToSearchMap.get(nextResult.getHashSystemAndValue()))
|
||||
.or(Optional.fromNullable(hashToSearchMap.get(nextResult.getHashValue())));
|
||||
|
||||
if (matchedSearch.isPresent()) {
|
||||
setSearchToResolvedAndPrefetchFoundResourcePid(theTransactionDetails, idsToPreFetch, nextResult, matchedSearch.get());
|
||||
Optional<MatchUrlToResolve> matchedSearch = Optional.ofNullable(hashToSearchMap.get(nextResult.getHashSystemAndValue()));
|
||||
if (!matchedSearch.isPresent()) {
|
||||
matchedSearch = Optional.ofNullable(hashToSearchMap.get(nextResult.getHashValue()));
|
||||
}
|
||||
matchedSearch.ifPresent(matchUrlToResolve -> setSearchToResolvedAndPrefetchFoundResourcePid(theTransactionDetails, idsToPreFetch, nextResult, matchUrlToResolve));
|
||||
}
|
||||
//For each SP Map which did not return a result, tag it as not found.
|
||||
searchParameterMapsToResolve.stream()
|
||||
|
|
|
@ -129,7 +129,6 @@ public class SearchParamWithInlineReferencesExtractor {
|
|||
partitionId = RequestPartitionId.allPartitions();
|
||||
}
|
||||
|
||||
//THIS IS THE NEW SPOT
|
||||
mySearchParamExtractorService.extractFromResource(partitionId, theRequest, theParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference);
|
||||
|
||||
Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet();
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
package ca.uhn.fhir.jpa.dao.r4;
|
||||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
|
||||
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
||||
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.IdType;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.hl7.fhir.r4.model.Task;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
|
||||
@SuppressWarnings({"unchecked", "deprecation", "Duplicates"})
|
||||
public class FhirDummyTest extends BaseJpaR4Test {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirDummyTest.class);
|
||||
|
||||
@AfterEach
|
||||
public final void after() {
|
||||
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
||||
myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical());
|
||||
myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete());
|
||||
myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes());
|
||||
myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields());
|
||||
myDaoConfig.setInternalSynchronousSearchSize(new DaoConfig().getInternalSynchronousSearchSize());
|
||||
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
||||
myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
myInterceptorRegistry.registerInterceptor(myInterceptor);
|
||||
}
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void beforeDisableResultReuse() {
|
||||
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalCreateDoesntMakeContainedResource() {
|
||||
String patientString = "{\n" +
|
||||
"\"resourceType\": \"Patient\",\n" +
|
||||
"\"identifier\": [\n" +
|
||||
"{\n" +
|
||||
"\"system\": \"https://example.org/fhir/memberidentifier\",\n" +
|
||||
"\"value\": \"12345670\"\n" +
|
||||
"},\n" +
|
||||
"{\n" +
|
||||
"\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" +
|
||||
"\"value\": \"12345670TT\"\n" +
|
||||
"}\n" +
|
||||
"]\n" +
|
||||
"}";
|
||||
|
||||
Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString);
|
||||
DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient);
|
||||
String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString();
|
||||
|
||||
String bundleString = "{\n" +
|
||||
" \"resourceType\": \"Bundle\",\n" +
|
||||
" \"type\": \"transaction\",\n" +
|
||||
" \"entry\": [\n" +
|
||||
" {\n" +
|
||||
" \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" +
|
||||
" \"resource\": {\n" +
|
||||
" \"resourceType\": \"Task\",\n" +
|
||||
" \"language\": \"en-US\",\n" +
|
||||
" \"identifier\": [\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/taskidentifier\",\n" +
|
||||
" \"value\": \"101019\"\n" +
|
||||
" }\n" +
|
||||
" ],\n" +
|
||||
" \"basedOn\": [\n" +
|
||||
" {\n" +
|
||||
" \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" },\n" +
|
||||
" \"request\": {\n" +
|
||||
" \"method\": \"PUT\",\n" +
|
||||
" \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" +
|
||||
" \"resource\": {\n" +
|
||||
" \"resourceType\": \"Patient\",\n" +
|
||||
" \"identifier\": [\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/memberidentifier\",\n" +
|
||||
" \"value\": \"12345670\"\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" +
|
||||
" \"value\": \"12345670TT\"\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" },\n" +
|
||||
" \"request\": {\n" +
|
||||
" \"method\": \"POST\",\n" +
|
||||
" \"url\": \"Patient\",\n" +
|
||||
" \"ifNoneExist\": \"identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString);
|
||||
Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle);
|
||||
String taskId2 = transaction2.getEntry().stream()
|
||||
.filter(entry -> entry.getResponse().getLocation().contains("Task"))
|
||||
.map(entry -> entry.getResponse().getLocation())
|
||||
.findFirst().orElse(null);
|
||||
|
||||
Task read2 = myTaskDao.read(new IdType(taskId2));
|
||||
assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId)));
|
||||
}
|
||||
@Test
|
||||
public void testConditionalUpdateDoesntMakeContainedResource() {
|
||||
String patientString = "{\n" +
|
||||
"\"resourceType\": \"Patient\",\n" +
|
||||
"\"identifier\": [\n" +
|
||||
"{\n" +
|
||||
"\"system\": \"https://example.org/fhir/memberidentifier\",\n" +
|
||||
"\"value\": \"12345670\"\n" +
|
||||
"},\n" +
|
||||
"{\n" +
|
||||
"\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" +
|
||||
"\"value\": \"12345670TT\"\n" +
|
||||
"}\n" +
|
||||
"]\n" +
|
||||
"}";
|
||||
|
||||
Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString);
|
||||
DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient);
|
||||
String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString();
|
||||
|
||||
String bundleString = "{\n" +
|
||||
" \"resourceType\": \"Bundle\",\n" +
|
||||
" \"type\": \"transaction\",\n" +
|
||||
" \"entry\": [\n" +
|
||||
" {\n" +
|
||||
// " \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" +
|
||||
" \"resource\": {\n" +
|
||||
" \"id\": \"abc123\",\n" +
|
||||
" \"resourceType\": \"Task\",\n" +
|
||||
" \"language\": \"en-US\",\n" +
|
||||
" \"identifier\": [\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/taskidentifier\",\n" +
|
||||
" \"value\": \"101019\"\n" +
|
||||
" }\n" +
|
||||
" ],\n" +
|
||||
" \"basedOn\": [\n" +
|
||||
" {\n" +
|
||||
" \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" },\n" +
|
||||
" \"request\": {\n" +
|
||||
" \"method\": \"PUT\",\n" +
|
||||
" \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" +
|
||||
" \"resource\": {\n" +
|
||||
" \"resourceType\": \"Patient\",\n" +
|
||||
" \"identifier\": [\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/memberidentifier\",\n" +
|
||||
" \"value\": \"12345670\"\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" +
|
||||
" \"value\": \"12345670TT\"\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" },\n" +
|
||||
" \"request\": {\n" +
|
||||
" \"method\": \"PUT\",\n" +
|
||||
" \"url\": \"/Patient?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString);
|
||||
Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle);
|
||||
String taskId2 = transaction2.getEntry().stream()
|
||||
.filter(entry -> entry.getResponse().getLocation().contains("Task"))
|
||||
.map(entry -> entry.getResponse().getLocation())
|
||||
.findFirst().orElse(null);
|
||||
|
||||
Task read2 = myTaskDao.read(new IdType(taskId2));
|
||||
assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId)));
|
||||
}
|
||||
}
|
|
@ -991,7 +991,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
|| anySearchParameterUsesResolve(searchParams, theSearchParamType);
|
||||
|
||||
if (havePathWithResolveExpression) {
|
||||
//FIXME GGG/JA: At this point, if the Task.basedOn.reference.resource does _not_ have an ID, we will attempt to contain it internally.
|
||||
//TODO GGG/JA: At this point, if the Task.basedOn.reference.resource does _not_ have an ID, we will attempt to contain it internally. Wild
|
||||
myContext.newTerser().containResources(theResource, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue