"
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 7e93003e9cd..96c394d0795 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -11,7 +11,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index f06c0efa45d..ce646c625d0 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml
index ea7d862fe7c..dc3ad059655 100644
--- a/hapi-fhir-jpa/pom.xml
+++ b/hapi-fhir-jpa/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index cb0e622aa62..f8b5642bab5 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
index 49d5c3903ed..9962eed3ef3 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
@@ -140,6 +140,18 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
RequestPartitionId requestPartitionId =
myRequestPartitionHelperSvc.determineReadPartitionForRequest(theRequest, details);
+ deleteAll(theRequest, propagation, requestPartitionId, counter);
+
+ purgeAllCaches();
+
+ ourLog.info("COMPLETED GLOBAL $expunge - Deleted {} rows", counter.get());
+ }
+
+ protected void deleteAll(
+ @Nullable RequestDetails theRequest,
+ Propagation propagation,
+ RequestPartitionId requestPartitionId,
+ AtomicInteger counter) {
myTxService
.withRequest(theRequest)
.withPropagation(propagation)
@@ -248,10 +260,6 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
.execute(() -> {
counter.addAndGet(doExpungeEverythingQuery("DELETE from " + Search.class.getSimpleName() + " d"));
});
-
- purgeAllCaches();
-
- ourLog.info("COMPLETED GLOBAL $expunge - Deleted {} rows", counter.get());
}
@Override
@@ -263,7 +271,7 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
myMemoryCacheService.invalidateAllCaches();
}
- private int expungeEverythingByTypeWithoutPurging(
+ protected int expungeEverythingByTypeWithoutPurging(
RequestDetails theRequest, Class theEntityType, RequestPartitionId theRequestPartitionId) {
HapiTransactionService.noTransactionAllowed();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
index e69de29bb2d..6d4426c36c2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
@@ -0,0 +1,19 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Server
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java
index e69de29bb2d..6d4426c36c2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java
@@ -0,0 +1,19 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Server
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
index 8e35474cce4..646a34bf07a 100644
--- a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-hfql/pom.xml b/hapi-fhir-jpaserver-hfql/pom.xml
index ab4b57b1c78..254e53aa47f 100644
--- a/hapi-fhir-jpaserver-hfql/pom.xml
+++ b/hapi-fhir-jpaserver-hfql/pom.xml
@@ -3,7 +3,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-ips/pom.xml b/hapi-fhir-jpaserver-ips/pom.xml
index 9c9b0177659..c284d9ed955 100644
--- a/hapi-fhir-jpaserver-ips/pom.xml
+++ b/hapi-fhir-jpaserver-ips/pom.xml
@@ -3,7 +3,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -40,7 +40,7 @@
test
- net.sourceforge.htmlunit
+ org.htmlunithtmlunittest
diff --git a/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGeneratorSvcImplTest.java b/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGeneratorSvcImplTest.java
index 99de498ddd4..fbdaf9fa0d4 100644
--- a/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGeneratorSvcImplTest.java
+++ b/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGeneratorSvcImplTest.java
@@ -15,11 +15,11 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.SimpleBundleProvider;
import ca.uhn.fhir.test.utilities.HtmlUtil;
import ca.uhn.fhir.util.ClasspathUtil;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlTable;
-import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import org.htmlunit.html.DomElement;
+import org.htmlunit.html.DomNodeList;
+import org.htmlunit.html.HtmlPage;
+import org.htmlunit.html.HtmlTable;
+import org.htmlunit.html.HtmlTableRow;
import com.google.common.collect.Lists;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.AllergyIntolerance;
@@ -49,6 +49,11 @@ import org.hl7.fhir.r4.model.Procedure;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
+import org.htmlunit.html.DomElement;
+import org.htmlunit.html.DomNodeList;
+import org.htmlunit.html.HtmlPage;
+import org.htmlunit.html.HtmlTable;
+import org.htmlunit.html.HtmlTableRow;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml
index b8313787855..94bd39c91a2 100644
--- a/hapi-fhir-jpaserver-mdm/pom.xml
+++ b/hapi-fhir-jpaserver-mdm/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml
index b104e23fcda..5000d617b40 100644
--- a/hapi-fhir-jpaserver-model/pom.xml
+++ b/hapi-fhir-jpaserver-model/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml
index 8da2185e60d..20a05eaa091 100755
--- a/hapi-fhir-jpaserver-searchparam/pom.xml
+++ b/hapi-fhir-jpaserver-searchparam/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml
index 5d2d35a4323..dca57d868d6 100644
--- a/hapi-fhir-jpaserver-subscription/pom.xml
+++ b/hapi-fhir-jpaserver-subscription/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml
index 9167015e41e..d168f8148a2 100644
--- a/hapi-fhir-jpaserver-test-dstu2/pom.xml
+++ b/hapi-fhir-jpaserver-test-dstu2/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml
index f7d7d3b0462..b23b2ed48f0 100644
--- a/hapi-fhir-jpaserver-test-dstu3/pom.xml
+++ b/hapi-fhir-jpaserver-test-dstu3/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml
index 7d66d9765c2..fbcdfb36f6e 100644
--- a/hapi-fhir-jpaserver-test-r4/pom.xml
+++ b/hapi-fhir-jpaserver-test-r4/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java
index 7fdd962e5c0..6aff8e400a7 100644
--- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java
+++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java
@@ -65,7 +65,7 @@ class BaseHapiFhirResourceDaoTest {
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Mock
- private IIdHelperService myIdHelperService;
+ private IIdHelperService myIdHelperService;
@Mock
private EntityManager myEntityManager;
@@ -86,10 +86,10 @@ class BaseHapiFhirResourceDaoTest {
private ISearchParamRegistry mySearchParamRegistry;
@Mock
- private SearchBuilderFactory mySearchBuilderFactory;
+ private SearchBuilderFactory mySearchBuilderFactory;
@Mock
- private ISearchBuilder myISearchBuilder;
+ private ISearchBuilder myISearchBuilder;
@Captor
private ArgumentCaptor mySearchParameterMapCaptor;
diff --git a/hapi-fhir-jpaserver-test-r4b/pom.xml b/hapi-fhir-jpaserver-test-r4b/pom.xml
index 1ea5c6a1838..fc9a0d3a742 100644
--- a/hapi-fhir-jpaserver-test-r4b/pom.xml
+++ b/hapi-fhir-jpaserver-test-r4b/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml
index 7702cbadfc9..df1d9fc41e3 100644
--- a/hapi-fhir-jpaserver-test-r5/pom.xml
+++ b/hapi-fhir-jpaserver-test-r5/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -29,7 +29,7 @@
test
- net.sourceforge.htmlunit
+ org.htmlunithtmlunittest
diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/search/reindex/InstanceReindexServiceImplNarrativeR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/search/reindex/InstanceReindexServiceImplNarrativeR5Test.java
index 90da515b1a9..472d68df121 100644
--- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/search/reindex/InstanceReindexServiceImplNarrativeR5Test.java
+++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/search/reindex/InstanceReindexServiceImplNarrativeR5Test.java
@@ -16,8 +16,8 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.entity.SearchParamPresentEntity;
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
import ca.uhn.fhir.test.utilities.HtmlUtil;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import org.htmlunit.html.HtmlPage;
+import org.htmlunit.html.HtmlTable;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.StringType;
diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml
index 7835f21d097..9a2166c22ea 100644
--- a/hapi-fhir-jpaserver-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
index cdce42511cb..0409211c054 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
+++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../pom.xml
diff --git a/hapi-fhir-server-cds-hooks/pom.xml b/hapi-fhir-server-cds-hooks/pom.xml
index 4783987e814..dd01ffff387 100644
--- a/hapi-fhir-server-cds-hooks/pom.xml
+++ b/hapi-fhir-server-cds-hooks/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml
index 6916512846f..6e163215517 100644
--- a/hapi-fhir-server-mdm/pom.xml
+++ b/hapi-fhir-server-mdm/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml
index e7073b4ed48..dfe33aeeb93 100644
--- a/hapi-fhir-server-openapi/pom.xml
+++ b/hapi-fhir-server-openapi/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -88,7 +88,7 @@
test
- net.sourceforge.htmlunit
+ org.htmlunithtmlunittest
diff --git a/hapi-fhir-server-openapi/src/test/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptorTest.java b/hapi-fhir-server-openapi/src/test/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptorTest.java
index c7f4470da5f..3ea0ddea35a 100644
--- a/hapi-fhir-server-openapi/src/test/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptorTest.java
+++ b/hapi-fhir-server-openapi/src/test/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptorTest.java
@@ -26,9 +26,9 @@ import ca.uhn.fhir.test.utilities.HtmlUtil;
import ca.uhn.fhir.test.utilities.HttpClientExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerExtension;
import ca.uhn.fhir.util.ExtensionConstants;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.HtmlDivision;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.htmlunit.html.DomElement;
+import org.htmlunit.html.HtmlDivision;
+import org.htmlunit.html.HtmlPage;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.PathItem;
diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml
index 4b72020ad08..3a521cd7eae 100644
--- a/hapi-fhir-server/pom.xml
+++ b/hapi-fhir-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml
index 6c7f8c1c78f..717dc503b22 100644
--- a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml
+++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml
@@ -7,7 +7,7 @@
hapi-fhir-serviceloadersca.uhn.hapi.fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../pom.xml
diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml
index 86aac948f89..4892de65b91 100644
--- a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml
+++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml
@@ -7,7 +7,7 @@
hapi-fhir-serviceloadersca.uhn.hapi.fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../pom.xml
@@ -21,7 +21,7 @@
ca.uhn.hapi.fhirhapi-fhir-caching-api
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT
diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml
index 272592c7417..4ac7744f800 100644
--- a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml
+++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml
@@ -7,7 +7,7 @@
hapi-fhir-serviceloadersca.uhn.hapi.fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../pom.xml
diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml
index b57e4eb225e..68182ea7940 100644
--- a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml
+++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml
@@ -7,7 +7,7 @@
hapi-fhirca.uhn.hapi.fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../../pom.xml
diff --git a/hapi-fhir-serviceloaders/pom.xml b/hapi-fhir-serviceloaders/pom.xml
index 4902a9f4f8f..45d0307e9d7 100644
--- a/hapi-fhir-serviceloaders/pom.xml
+++ b/hapi-fhir-serviceloaders/pom.xml
@@ -5,7 +5,7 @@
hapi-deployable-pomca.uhn.hapi.fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
index 26034b2ca9a..4e76a3e78e7 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
index c871663a0aa..2b50aacd7ef 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir-spring-boot-samples
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOThapi-fhir-spring-boot-sample-client-apache
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
index 160992bb7d0..4f5bae777e6 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir-spring-boot-samples
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
index ffe1e1c0257..6ac1fcffe05 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir-spring-boot-samples
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
index c236010d22f..213031cf9f9 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir-spring-boot
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
index 9749dc73399..4c620fb3e24 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml
index fe8de44baaa..08ebc710049 100644
--- a/hapi-fhir-spring-boot/pom.xml
+++ b/hapi-fhir-spring-boot/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-fhir
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../pom.xml
diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml
index 277a9d6dc07..5152c3ba85f 100644
--- a/hapi-fhir-sql-migrate/pom.xml
+++ b/hapi-fhir-sql-migrate/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml
index 9b4b34c786e..a7f5d8ecbaf 100644
--- a/hapi-fhir-storage-batch2-jobs/pom.xml
+++ b/hapi-fhir-storage-batch2-jobs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-batch2-test-utilities/pom.xml b/hapi-fhir-storage-batch2-test-utilities/pom.xml
index a0a10cc15c4..38658c74f86 100644
--- a/hapi-fhir-storage-batch2-test-utilities/pom.xml
+++ b/hapi-fhir-storage-batch2-test-utilities/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml
index 5116f3e588f..42541c03098 100644
--- a/hapi-fhir-storage-batch2/pom.xml
+++ b/hapi-fhir-storage-batch2/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-cr/pom.xml b/hapi-fhir-storage-cr/pom.xml
index 35371deeacf..9ff0f31d888 100644
--- a/hapi-fhir-storage-cr/pom.xml
+++ b/hapi-fhir-storage-cr/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml
index 8a189a15a25..6612210e842 100644
--- a/hapi-fhir-storage-mdm/pom.xml
+++ b/hapi-fhir-storage-mdm/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml
index 74d61aa3131..d58ac7db8c2 100644
--- a/hapi-fhir-storage-test-utilities/pom.xml
+++ b/hapi-fhir-storage-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml
index c464af460e0..c4059235dcf 100644
--- a/hapi-fhir-storage/pom.xml
+++ b/hapi-fhir-storage/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DeleteConflictList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DeleteConflictList.java
index 825a4cc69e7..b5de2225856 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DeleteConflictList.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DeleteConflictList.java
@@ -114,7 +114,7 @@ public class DeleteConflictList implements Iterable {
@Override
public void remove() {
- Assert.isTrue(myLastOperationWasNext);
+ Assert.isTrue(myLastOperationWasNext, "myLastOperationWasNext is not true");
myNextIndex--;
myList.remove(myNextIndex);
myLastOperationWasNext = false;
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index da4b2f7ca2a..dac3392fc7e 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -224,13 +224,6 @@
true
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- org.apache.felixmaven-bundle-plugin
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index 73785e72f84..4532fb82ccf 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java
index b7e149e007f..64bff5e51fa 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java
@@ -863,17 +863,19 @@ public class FhirTerserDstu2Test {
/**
* See http://stackoverflow.com/questions/182636/how-to-determine-the-class-of-a-generic-type
*/
+ @SuppressWarnings({"UnnecessaryLocalVariable", "unchecked"})
private static Class> getListClass(Class theClass) {
- return new ClassGetter>() {
- }.get();
+ Class listClass = List.class;
+ return listClass;
}
/**
* See http://stackoverflow.com/questions/182636/how-to-determine-the-class-of-a-generic-type
*/
+ @SuppressWarnings({"UnnecessaryLocalVariable", "unchecked"})
private static Class>> getListClass2() {
- return new ClassGetter>>() {
- }.get();
+ Class listClass = List.class;
+ return listClass;
}
/**
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index 2808e54b94f..f4cfda0fd24 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
index bcff5de5fb3..cfa190aa1db 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
@@ -9,6 +9,7 @@ import ca.uhn.fhir.parser.XmlParserDstu3Test.TestPatientFor327;
import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ScalarType;
import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ValueType;
import ca.uhn.fhir.util.ClasspathUtil;
+import ca.uhn.fhir.util.JsonUtil;
import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ValidationResult;
@@ -157,7 +158,7 @@ public class JsonParserDstu3Test {
fail();
} catch (DataFormatException e) {
assertEquals(Msg.code(1861) + "Failed to parse JSON encoded FHIR content: Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value\n" +
- " at [Source: UNKNOWN; line: 4, column: 18]", e.getMessage());
+ " at [line: 4, column: 18]", e.getMessage());
}
}
@@ -2324,8 +2325,10 @@ public class JsonParserDstu3Test {
ourCtx.newJsonParser().parseResource(Bundle.class, bundle);
fail();
} catch (DataFormatException e) {
- assertEquals(Msg.code(1861) + "Failed to parse JSON encoded FHIR content: Unexpected close marker '}': expected ']' (for root starting at [Source: UNKNOWN; line: 1])\n" +
- " at [Source: UNKNOWN; line: 4, column: 3]", e.getMessage());
+ // I'm hoping at some point we can get rid of the REDACTED message entirely.
+ // Request filed with Jackson: https://github.com/FasterXML/jackson-core/issues/1158
+ assertEquals(Msg.code(1861) + "Failed to parse JSON encoded FHIR content: Unexpected close marker '}': expected ']' (for root starting at [line: 1])\n" +
+ " at [line: 4, column: 3]", e.getMessage());
}
}
diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml
index 5fee48ad79f..91c113e8e84 100644
--- a/hapi-fhir-structures-hl7org-dstu2/pom.xml
+++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -235,13 +235,6 @@
true
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- org.apache.felixmaven-bundle-plugin
diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml
index ecfd48b5401..f2d1ae5e412 100644
--- a/hapi-fhir-structures-r4/pom.xml
+++ b/hapi-fhir-structures-r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -303,13 +303,6 @@
true
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- org.apache.felixmaven-bundle-plugin
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java
index 5182d2491a9..42ee74b22fb 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java
@@ -1553,17 +1553,19 @@ public class FhirTerserR4Test {
/**
* See http://stackoverflow.com/questions/182636/how-to-determine-the-class-of-a-generic-type
*/
+ @SuppressWarnings({"UnnecessaryLocalVariable", "unchecked"})
private static Class> getListClass(Class theClass) {
- return new ClassGetter>() {
- }.get();
+ Class listClass = List.class;
+ return listClass;
}
/**
* See http://stackoverflow.com/questions/182636/how-to-determine-the-class-of-a-generic-type
*/
+ @SuppressWarnings({"UnnecessaryLocalVariable", "unchecked"})
private static Class>> getListClass2() {
- return new ClassGetter>>() {
- }.get();
+ Class listClass = List.class;
+ return listClass;
}
}
diff --git a/hapi-fhir-structures-r4b/pom.xml b/hapi-fhir-structures-r4b/pom.xml
index 50e766a38f3..937f228073f 100644
--- a/hapi-fhir-structures-r4b/pom.xml
+++ b/hapi-fhir-structures-r4b/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -287,13 +287,6 @@
true
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- org.apache.felixmaven-bundle-plugin
diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml
index 57170dcaece..2c4111ad99a 100644
--- a/hapi-fhir-structures-r5/pom.xml
+++ b/hapi-fhir-structures-r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -276,13 +276,6 @@
true
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- org.apache.felixmaven-bundle-plugin
diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml
index 568f69cdc4c..dcbb597eae8 100644
--- a/hapi-fhir-test-utilities/pom.xml
+++ b/hapi-fhir-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 6.11.6-SNAPSHOT
+ 6.11.7-SNAPSHOT../hapi-deployable-pom/pom.xml
@@ -102,22 +102,8 @@
- net.sourceforge.htmlunit
+ org.htmlunithtmlunit
-
-
- xml-apis
- xml-apis
-
-
- xerces
- xercesImpl
-
-
- org.eclipse.jetty.websocket
- websocket-client
-
-
diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/HtmlUtil.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/HtmlUtil.java
index 2f90b77abe0..beee282dd1b 100644
--- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/HtmlUtil.java
+++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/HtmlUtil.java
@@ -19,14 +19,14 @@
*/
package ca.uhn.fhir.test.utilities;
-import com.gargoylesoftware.htmlunit.BrowserVersion;
-import com.gargoylesoftware.htmlunit.StringWebResponse;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlInput;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser;
import org.awaitility.Awaitility;
+import org.htmlunit.BrowserVersion;
+import org.htmlunit.StringWebResponse;
+import org.htmlunit.WebClient;
+import org.htmlunit.html.HtmlForm;
+import org.htmlunit.html.HtmlInput;
+import org.htmlunit.html.HtmlPage;
+import org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser;
import java.io.IOException;
import java.net.URL;
diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/MockMvcWebConnectionForHtmlUnit3.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/MockMvcWebConnectionForHtmlUnit3.java
new file mode 100644
index 00000000000..2614c9e1338
--- /dev/null
+++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/MockMvcWebConnectionForHtmlUnit3.java
@@ -0,0 +1,763 @@
+/*-
+ * #%L
+ * HAPI FHIR Test Utilities
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.test.utilities;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpSession;
+import org.htmlunit.CookieManager;
+import org.htmlunit.FormEncodingType;
+import org.htmlunit.WebClient;
+import org.htmlunit.WebConnection;
+import org.htmlunit.WebRequest;
+import org.htmlunit.WebResponse;
+import org.htmlunit.WebResponseData;
+import org.htmlunit.util.Cookie;
+import org.apache.http.impl.cookie.BasicClientCookie;
+
+import org.htmlunit.util.KeyDataPair;
+import org.htmlunit.util.NameValuePair;
+import org.springframework.beans.Mergeable;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.lang.Nullable;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
+import org.springframework.mock.web.MockPart;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.RequestBuilder;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.SmartRequestBuilder;
+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.request.RequestPostProcessor;
+import org.springframework.util.Assert;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.util.UriComponents;
+import org.springframework.web.util.UriComponentsBuilder;
+import org.springframework.web.util.UriUtils;
+
+/**
+ * This class is just a duplication or the Spring class by the same name
+ * (MockMvcWebConnection). It exists to use the new org.htmlunit namespace.
+ *
+ * This should no longer be necessary once this is fixed:
+ * https://github.com/spring-projects/spring-framework/issues/30392
+ */
+public final class MockMvcWebConnectionForHtmlUnit3 implements WebConnection {
+
+ private final Map sessions = new HashMap<>();
+
+ private final MockMvc mockMvc;
+
+ @Nullable
+ private final String contextPath;
+
+ private WebClient webClient;
+
+ private static final int MAX_FORWARDS = 100;
+
+
+ /**
+ * Create a new instance that assumes the context path of the application
+ * is {@code ""} (i.e., the root context).
+ *
For example, the URL {@code http://localhost/test/this} would use
+ * {@code ""} as the context path.
+ * @param mockMvc the {@code MockMvc} instance to use; never {@code null}
+ * @param webClient the {@link WebClient} to use. never {@code null}
+ */
+ public MockMvcWebConnectionForHtmlUnit3(MockMvc mockMvc, WebClient webClient) {
+ this(mockMvc, webClient, "");
+ }
+
+ /**
+ * Create a new instance with the specified context path.
+ *
The path may be {@code null} in which case the first path segment
+ * of the URL is turned into the contextPath. Otherwise it must conform
+ * to {@link jakarta.servlet.http.HttpServletRequest#getContextPath()}
+ * which states that it can be an empty string and otherwise must start
+ * with a "/" character and not end with a "/" character.
+ * @param mockMvc the {@code MockMvc} instance to use (never {@code null})
+ * @param webClient the {@link WebClient} to use (never {@code null})
+ * @param contextPath the contextPath to use
+ */
+ public MockMvcWebConnectionForHtmlUnit3(MockMvc mockMvc, WebClient webClient, @Nullable String contextPath) {
+ Assert.notNull(mockMvc, "MockMvc must not be null");
+ Assert.notNull(webClient, "WebClient must not be null");
+ validateContextPath(contextPath);
+
+ this.webClient = webClient;
+ this.mockMvc = mockMvc;
+ this.contextPath = contextPath;
+ }
+
+ /**
+ * Validate the supplied {@code contextPath}.
+ *
If the value is not {@code null}, it must conform to
+ * {@link jakarta.servlet.http.HttpServletRequest#getContextPath()} which
+ * states that it can be an empty string and otherwise must start with
+ * a "/" character and not end with a "/" character.
+ * @param contextPath the path to validate
+ */
+ static void validateContextPath(@Nullable String contextPath) {
+ if (contextPath == null || contextPath.isEmpty()) {
+ return;
+ }
+ Assert.isTrue(contextPath.startsWith("/"), () -> "contextPath '" + contextPath + "' must start with '/'.");
+ Assert.isTrue(!contextPath.endsWith("/"), () -> "contextPath '" + contextPath + "' must not end with '/'.");
+ }
+
+
+ public void setWebClient(WebClient webClient) {
+ Assert.notNull(webClient, "WebClient must not be null");
+ this.webClient = webClient;
+ }
+
+
+ @Override
+ public WebResponse getResponse(WebRequest webRequest) throws IOException {
+ long startTime = System.currentTimeMillis();
+ HtmlUnitRequestBuilder requestBuilder = new HtmlUnitRequestBuilder(this.sessions, this.webClient, webRequest);
+ requestBuilder.setContextPath(this.contextPath);
+
+ MockHttpServletResponse httpServletResponse = getResponse(requestBuilder);
+ String forwardedUrl = httpServletResponse.getForwardedUrl();
+ int forwards = 0;
+ while (forwardedUrl != null && forwards < MAX_FORWARDS) {
+ requestBuilder.setForwardPostProcessor(new ForwardRequestPostProcessor(forwardedUrl));
+ httpServletResponse = getResponse(requestBuilder);
+ forwardedUrl = httpServletResponse.getForwardedUrl();
+ forwards += 1;
+ }
+ if (forwards == MAX_FORWARDS) {
+ throw new IllegalStateException("Forwarded " + forwards + " times in a row, potential infinite forward loop");
+ }
+ storeCookies(webRequest, httpServletResponse.getCookies());
+
+ return new MockWebResponseBuilder(startTime, webRequest, httpServletResponse).build();
+ }
+
+ private MockHttpServletResponse getResponse(RequestBuilder requestBuilder) throws IOException {
+ ResultActions resultActions;
+ try {
+ resultActions = this.mockMvc.perform(requestBuilder);
+ }
+ catch (Exception ex) {
+ throw new IOException(ex);
+ }
+
+ return resultActions.andReturn().getResponse();
+ }
+
+ private void storeCookies(WebRequest webRequest, jakarta.servlet.http.Cookie[] cookies) {
+ Date now = new Date();
+ CookieManager cookieManager = this.webClient.getCookieManager();
+ for (jakarta.servlet.http.Cookie cookie : cookies) {
+ if (cookie.getDomain() == null) {
+ cookie.setDomain(webRequest.getUrl().getHost());
+ }
+ Cookie toManage = createCookie(cookie);
+ Date expires = toManage.getExpires();
+ if (expires == null || expires.after(now)) {
+ cookieManager.addCookie(toManage);
+ }
+ else {
+ cookieManager.removeCookie(toManage);
+ }
+ }
+ }
+
+ @SuppressWarnings("removal")
+ private static org.htmlunit.util.Cookie createCookie(jakarta.servlet.http.Cookie cookie) {
+ Date expires = null;
+ if (cookie.getMaxAge() > -1) {
+ expires = new Date(System.currentTimeMillis() + cookie.getMaxAge() * 1000);
+ }
+ BasicClientCookie result = new BasicClientCookie(cookie.getName(), cookie.getValue());
+ result.setDomain(cookie.getDomain());
+ result.setComment(cookie.getComment());
+ result.setExpiryDate(expires);
+ result.setPath(cookie.getPath());
+ result.setSecure(cookie.getSecure());
+ if (cookie.isHttpOnly()) {
+ result.setAttribute("httponly", "true");
+ }
+ return new org.htmlunit.util.Cookie(result);
+ }
+
+ @Override
+ public void close() {
+ }
+
+
+
+
+ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
+
+ private final Map sessions;
+
+ private final WebClient webClient;
+
+ private final WebRequest webRequest;
+
+ @Nullable
+ private String contextPath;
+
+ @Nullable
+ private RequestBuilder parentBuilder;
+
+ @Nullable
+ private SmartRequestBuilder parentPostProcessor;
+
+ @Nullable
+ private RequestPostProcessor forwardPostProcessor;
+
+
+ /**
+ * Construct a new {@code HtmlUnitRequestBuilder}.
+ * @param sessions a {@link Map} from session {@linkplain HttpSession#getId() IDs}
+ * to currently managed {@link HttpSession} objects; never {@code null}
+ * @param webClient the WebClient for retrieving cookies
+ * @param webRequest the {@link WebRequest} to transform into a
+ * {@link MockHttpServletRequest}; never {@code null}
+ */
+ public HtmlUnitRequestBuilder(Map sessions, WebClient webClient, WebRequest webRequest) {
+ Assert.notNull(sessions, "Sessions Map must not be null");
+ Assert.notNull(webClient, "WebClient must not be null");
+ Assert.notNull(webRequest, "WebRequest must not be null");
+ this.sessions = sessions;
+ this.webClient = webClient;
+ this.webRequest = webRequest;
+ }
+
+
+ /**
+ * Set the contextPath to be used.
+ *
The value may be null in which case the first path segment of the
+ * URL is turned into the contextPath. Otherwise it must conform to
+ * {@link HttpServletRequest#getContextPath()} which states it can be
+ * an empty string, or it must start with a "/" and not end with a "/".
+ * @param contextPath a valid contextPath
+ * @throws IllegalArgumentException if the contextPath is not a valid
+ * {@link HttpServletRequest#getContextPath()}
+ */
+ public void setContextPath(@Nullable String contextPath) {
+ validateContextPath(contextPath);
+ this.contextPath = contextPath;
+ }
+
+ public void setForwardPostProcessor(RequestPostProcessor forwardPostProcessor) {
+ this.forwardPostProcessor = forwardPostProcessor;
+ }
+
+
+ @Override
+ public MockHttpServletRequest buildRequest(ServletContext servletContext) {
+ String httpMethod = this.webRequest.getHttpMethod().name();
+ UriComponents uri = UriComponentsBuilder.fromUriString(this.webRequest.getUrl().toExternalForm()).build();
+
+ MockHttpServletRequest request = new HtmlUnitRequestBuilder.HtmlUnitMockHttpServletRequest(
+ servletContext, httpMethod, (uri.getPath() != null ? uri.getPath() : ""));
+
+ parent(request, this.parentBuilder);
+
+ request.setProtocol("HTTP/1.1");
+ request.setScheme(uri.getScheme() != null ? uri.getScheme() : "");
+ request.setServerName(uri.getHost() != null ? uri.getHost() : ""); // needs to be first for additional headers
+ ports(uri, request);
+ authType(request);
+ contextPath(request, uri);
+ servletPath(uri, request);
+ request.setPathInfo(null);
+
+ Charset charset = this.webRequest.getCharset();
+ charset = (charset != null ? charset : StandardCharsets.ISO_8859_1);
+ request.setCharacterEncoding(charset.name());
+ content(request, charset);
+ contentType(request);
+
+ cookies(request);
+ this.webRequest.getAdditionalHeaders().forEach(request::addHeader);
+ locales(request);
+ params(request);
+ request.setQueryString(uri.getQuery());
+
+ return postProcess(request);
+ }
+
+ private void parent(MockHttpServletRequest request, @Nullable RequestBuilder parent) {
+ if (parent == null) {
+ return;
+ }
+
+ MockHttpServletRequest parentRequest = parent.buildRequest(request.getServletContext());
+
+ // session
+ HttpSession parentSession = parentRequest.getSession(false);
+ if (parentSession != null) {
+ HttpSession localSession = request.getSession();
+ Assert.state(localSession != null, "No local HttpSession");
+ Enumeration attrNames = parentSession.getAttributeNames();
+ while (attrNames.hasMoreElements()) {
+ String attrName = attrNames.nextElement();
+ Object attrValue = parentSession.getAttribute(attrName);
+ localSession.setAttribute(attrName, attrValue);
+ }
+ }
+
+ // header
+ Enumeration headerNames = parentRequest.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ String attrName = headerNames.nextElement();
+ Enumeration attrValues = parentRequest.getHeaders(attrName);
+ while (attrValues.hasMoreElements()) {
+ String attrValue = attrValues.nextElement();
+ request.addHeader(attrName, attrValue);
+ }
+ }
+
+ // parameter
+ Map parentParams = parentRequest.getParameterMap();
+ parentParams.forEach(request::addParameter);
+
+ // cookie
+ jakarta.servlet.http.Cookie[] parentCookies = parentRequest.getCookies();
+ if (!ObjectUtils.isEmpty(parentCookies)) {
+ request.setCookies(parentCookies);
+ }
+
+ // request attribute
+ Enumeration parentAttrNames = parentRequest.getAttributeNames();
+ while (parentAttrNames.hasMoreElements()) {
+ String parentAttrName = parentAttrNames.nextElement();
+ request.setAttribute(parentAttrName, parentRequest.getAttribute(parentAttrName));
+ }
+ }
+
+ private void ports(UriComponents uriComponents, MockHttpServletRequest request) {
+ int serverPort = uriComponents.getPort();
+ request.setServerPort(serverPort);
+ if (serverPort == -1) {
+ int portConnection = this.webRequest.getUrl().getDefaultPort();
+ request.setLocalPort(serverPort);
+ request.setRemotePort(portConnection);
+ }
+ else {
+ request.setRemotePort(serverPort);
+ }
+ }
+
+ private void authType(MockHttpServletRequest request) {
+ String authorization = getHeader("Authorization");
+ String[] authSplit = StringUtils.split(authorization, ": ");
+ if (authSplit != null) {
+ request.setAuthType(authSplit[0]);
+ }
+ }
+
+ @Nullable
+ private String getHeader(String headerName) {
+ return this.webRequest.getAdditionalHeaders().get(headerName);
+ }
+
+ private void contextPath(MockHttpServletRequest request, UriComponents uriComponents) {
+ if (this.contextPath == null) {
+ List pathSegments = uriComponents.getPathSegments();
+ if (pathSegments.isEmpty()) {
+ request.setContextPath("");
+ }
+ else {
+ request.setContextPath("/" + pathSegments.get(0));
+ }
+ }
+ else {
+ String path = uriComponents.getPath();
+ Assert.isTrue(path != null && path.startsWith(this.contextPath),
+ () -> "\"" + uriComponents.getPath() +
+ "\" should start with context path \"" + this.contextPath + "\"");
+ request.setContextPath(this.contextPath);
+ }
+ }
+
+ private void servletPath(UriComponents uriComponents, MockHttpServletRequest request) {
+ String path = uriComponents.getPath();
+ String requestPath = (path != null ? path : "");
+ String servletPath = requestPath.substring(request.getContextPath().length());
+ servletPath = UriUtils.decode(servletPath, StandardCharsets.UTF_8);
+ request.setServletPath(servletPath);
+ }
+
+ private void content(MockHttpServletRequest request, Charset charset) {
+ String requestBody = this.webRequest.getRequestBody();
+ if (requestBody == null) {
+ return;
+ }
+ request.setContent(requestBody.getBytes(charset));
+ }
+
+ private void contentType(MockHttpServletRequest request) {
+ String contentType = getHeader("Content-Type");
+ if (contentType == null) {
+ FormEncodingType encodingType = this.webRequest.getEncodingType();
+ if (encodingType != null) {
+ contentType = encodingType.getName();
+ }
+ }
+ request.setContentType(contentType != null ? contentType : MediaType.ALL_VALUE);
+ }
+
+ private void cookies(MockHttpServletRequest request) {
+ List cookies = new ArrayList<>();
+
+ String cookieHeaderValue = getHeader("Cookie");
+ if (cookieHeaderValue != null) {
+ StringTokenizer tokens = new StringTokenizer(cookieHeaderValue, "=;");
+ while (tokens.hasMoreTokens()) {
+ String cookieName = tokens.nextToken().trim();
+ Assert.isTrue(tokens.hasMoreTokens(),
+ () -> "Expected value for cookie name '" + cookieName +
+ "': full cookie header was [" + cookieHeaderValue + "]");
+ String cookieValue = tokens.nextToken().trim();
+ processCookie(request, cookies, new jakarta.servlet.http.Cookie(cookieName, cookieValue));
+ }
+ }
+
+ Set managedCookies = this.webClient.getCookies(this.webRequest.getUrl());
+ for (org.htmlunit.util.Cookie cookie : managedCookies) {
+ processCookie(request, cookies, new jakarta.servlet.http.Cookie(cookie.getName(), cookie.getValue()));
+ }
+
+ jakarta.servlet.http.Cookie[] parentCookies = request.getCookies();
+ if (parentCookies != null) {
+ Collections.addAll(cookies, parentCookies);
+ }
+
+ if (!ObjectUtils.isEmpty(cookies)) {
+ request.setCookies(cookies.toArray(new jakarta.servlet.http.Cookie[0]));
+ }
+ }
+
+ private void processCookie(MockHttpServletRequest request, List cookies, jakarta.servlet.http.Cookie cookie) {
+ cookies.add(cookie);
+ if ("JSESSIONID".equals(cookie.getName())) {
+ request.setRequestedSessionId(cookie.getValue());
+ request.setSession(httpSession(request, cookie.getValue()));
+ }
+ }
+
+ private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) {
+ MockHttpSession session;
+ synchronized (this.sessions) {
+ session = this.sessions.get(sessionid);
+ if (session == null) {
+ session = new HtmlUnitRequestBuilder.HtmlUnitMockHttpSession(request, sessionid);
+ session.setNew(true);
+ synchronized (this.sessions) {
+ this.sessions.put(sessionid, session);
+ }
+ addSessionCookie(request, sessionid);
+ }
+ else {
+ session.setNew(false);
+ }
+ }
+ return session;
+ }
+
+ private void addSessionCookie(MockHttpServletRequest request, String sessionid) {
+ this.webClient.getCookieManager().addCookie(createCookie(request, sessionid));
+ }
+
+ private void removeSessionCookie(MockHttpServletRequest request, String sessionid) {
+ this.webClient.getCookieManager().removeCookie(createCookie(request, sessionid));
+ }
+
+ private org.htmlunit.util.Cookie createCookie(MockHttpServletRequest request, String sessionid) {
+ return new org.htmlunit.util.Cookie(request.getServerName(), "JSESSIONID", sessionid,
+ request.getContextPath() + "/", null, request.isSecure(), true);
+ }
+
+ private void locales(MockHttpServletRequest request) {
+ String locale = getHeader("Accept-Language");
+ if (locale == null) {
+ request.addPreferredLocale(Locale.getDefault());
+ }
+ }
+
+ private void params(MockHttpServletRequest request) {
+ for (NameValuePair param : this.webRequest.getParameters()) {
+ addRequestParameter(request, param);
+ }
+ }
+
+ private void addRequestParameter(MockHttpServletRequest request, NameValuePair param) {
+ if (param instanceof KeyDataPair pair) {
+ File file = pair.getFile();
+ MockPart part;
+ if (file != null) {
+ part = new MockPart(pair.getName(), file.getName(), readAllBytes(file));
+ }
+ else {
+ // Support empty file upload OR file upload via setData().
+ // For an empty file upload, getValue() returns an empty string, and
+ // getData() returns null.
+ // For a file upload via setData(), getData() returns the file data, and
+ // getValue() returns the file name (if set) or an empty string.
+ part = new MockPart(pair.getName(), pair.getValue(), pair.getData());
+ }
+ MediaType mediaType = (pair.getMimeType() != null ? MediaType.valueOf(pair.getMimeType()) :
+ MediaType.APPLICATION_OCTET_STREAM);
+ part.getHeaders().setContentType(mediaType);
+ request.addPart(part);
+ }
+ else {
+ request.addParameter(param.getName(), param.getValue());
+ }
+ }
+
+ private byte[] readAllBytes(File file) {
+ try {
+ return Files.readAllBytes(file.toPath());
+ }
+ catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ private MockHttpServletRequest postProcess(MockHttpServletRequest request) {
+ if (this.parentPostProcessor != null) {
+ request = this.parentPostProcessor.postProcessRequest(request);
+ }
+ if (this.forwardPostProcessor != null) {
+ request = this.forwardPostProcessor.postProcessRequest(request);
+ }
+ return request;
+ }
+
+
+ /* Mergeable methods */
+
+ @Override
+ public boolean isMergeEnabled() {
+ return true;
+ }
+
+ @Override
+ public Object merge(@Nullable Object parent) {
+ if (parent instanceof RequestBuilder requestBuilder) {
+ if (parent instanceof MockHttpServletRequestBuilder) {
+ MockHttpServletRequestBuilder copiedParent = MockMvcRequestBuilders.get("/");
+ copiedParent.merge(parent);
+ this.parentBuilder = copiedParent;
+ }
+ else {
+ this.parentBuilder = requestBuilder;
+ }
+ if (parent instanceof SmartRequestBuilder smartRequestBuilder) {
+ this.parentPostProcessor = smartRequestBuilder;
+ }
+ }
+ return this;
+ }
+
+
+ /**
+ * An extension to {@link MockHttpServletRequest} that ensures that when a
+ * new {@link HttpSession} is created, it is added to the managed sessions.
+ */
+ private final class HtmlUnitMockHttpServletRequest extends MockHttpServletRequest {
+
+ public HtmlUnitMockHttpServletRequest(ServletContext servletContext, String method, String requestURI) {
+ super(servletContext, method, requestURI);
+ }
+
+ @Override
+ public HttpSession getSession(boolean create) {
+ HttpSession session = super.getSession(false);
+ if (session == null && create) {
+ HtmlUnitRequestBuilder.HtmlUnitMockHttpSession newSession = new HtmlUnitRequestBuilder.HtmlUnitMockHttpSession(this);
+ setSession(newSession);
+ newSession.setNew(true);
+ String sessionid = newSession.getId();
+ synchronized (HtmlUnitRequestBuilder.this.sessions) {
+ HtmlUnitRequestBuilder.this.sessions.put(sessionid, newSession);
+ }
+ addSessionCookie(this, sessionid);
+ session = newSession;
+ }
+ return session;
+ }
+ }
+
+
+ /**
+ * An extension to {@link MockHttpSession} that ensures when
+ * {@link #invalidate()} is called that the {@link HttpSession}
+ * is removed from the managed sessions.
+ */
+ private final class HtmlUnitMockHttpSession extends MockHttpSession {
+
+ private final MockHttpServletRequest request;
+
+ public HtmlUnitMockHttpSession(MockHttpServletRequest request) {
+ super(request.getServletContext());
+ this.request = request;
+ }
+
+ private HtmlUnitMockHttpSession(MockHttpServletRequest request, String id) {
+ super(request.getServletContext(), id);
+ this.request = request;
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ synchronized (HtmlUnitRequestBuilder.this.sessions) {
+ HtmlUnitRequestBuilder.this.sessions.remove(getId());
+ }
+ removeSessionCookie(this.request, getId());
+ }
+ }
+
+ }
+
+
+ final class MockWebResponseBuilder {
+
+ private static final String DEFAULT_STATUS_MESSAGE = "N/A";
+
+
+ private final long startTime;
+
+ private final WebRequest webRequest;
+
+ private final MockHttpServletResponse response;
+
+
+ public MockWebResponseBuilder(long startTime, WebRequest webRequest, MockHttpServletResponse response) {
+ Assert.notNull(webRequest, "WebRequest must not be null");
+ Assert.notNull(response, "HttpServletResponse must not be null");
+ this.startTime = startTime;
+ this.webRequest = webRequest;
+ this.response = response;
+ }
+
+
+ public WebResponse build() throws IOException {
+ WebResponseData webResponseData = webResponseData();
+ long endTime = System.currentTimeMillis();
+ return new WebResponse(webResponseData, this.webRequest, endTime - this.startTime);
+ }
+
+ private WebResponseData webResponseData() throws IOException {
+ List responseHeaders = responseHeaders();
+ int statusCode = (this.response.getRedirectedUrl() != null ?
+ HttpStatus.MOVED_PERMANENTLY.value() : this.response.getStatus());
+ String statusMessage = statusMessage(statusCode);
+ return new WebResponseData(this.response.getContentAsByteArray(), statusCode, statusMessage, responseHeaders);
+ }
+
+ private String statusMessage(int statusCode) {
+ String errorMessage = this.response.getErrorMessage();
+ if (StringUtils.hasText(errorMessage)) {
+ return errorMessage;
+ }
+
+ try {
+ return HttpStatus.valueOf(statusCode).getReasonPhrase();
+ }
+ catch (IllegalArgumentException ex) {
+ // ignore
+ }
+
+ return DEFAULT_STATUS_MESSAGE;
+ }
+
+ private List responseHeaders() {
+ Collection headerNames = this.response.getHeaderNames();
+ List responseHeaders = new ArrayList<>(headerNames.size());
+ for (String headerName : headerNames) {
+ List