Merge remote-tracking branch 'remotes/origin/master' into ks-20191119-scheduler

This commit is contained in:
Ken Stevens 2019-12-05 18:03:02 -05:00
commit 6c432733d5
8 changed files with 100 additions and 9 deletions

View File

@ -81,7 +81,7 @@ public class HapiFlywayMigrateDatabaseCommandTest {
@Test @Test
public void testMigrateFrom340_NoFlyway() throws IOException, SQLException { public void testMigrateFrom340_NoFlyway() throws IOException, SQLException {
File location = getLocation("migrator_h2_test_340_current"); File location = getLocation("migrator_h2_test_340_current_noflyway");
String url = "jdbc:h2:" + location.getAbsolutePath() + ";create=true"; String url = "jdbc:h2:" + location.getAbsolutePath() + ";create=true";
DriverTypeEnum.ConnectionProperties connectionProperties = DriverTypeEnum.H2_EMBEDDED.newConnectionProperties(url, "", ""); DriverTypeEnum.ConnectionProperties connectionProperties = DriverTypeEnum.H2_EMBEDDED.newConnectionProperties(url, "", "");

View File

@ -82,11 +82,6 @@
<artifactId>jdom2</artifactId> <artifactId>jdom2</artifactId>
<version>2.0.6</version> <version>2.0.6</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.28</version>
</dependency>
<!-- Needed for JEE/Servlet support --> <!-- Needed for JEE/Servlet support -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>

View File

@ -24,12 +24,17 @@ import ca.uhn.fhir.jpa.util.DeleteConflict;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import java.util.*; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
public class DeleteConflictList implements Iterable<DeleteConflict> { public class DeleteConflictList implements Iterable<DeleteConflict> {
private final List<DeleteConflict> myList = new ArrayList<>(); private final List<DeleteConflict> myList = new ArrayList<>();
private final Set<String> myResourceIdsMarkedForDeletion; private final Set<String> myResourceIdsMarkedForDeletion;
private int myRemoveModCount;
/** /**
* Constructor * Constructor
@ -69,11 +74,38 @@ public class DeleteConflictList implements Iterable<DeleteConflict> {
@Override @Override
public Iterator<DeleteConflict> iterator() { public Iterator<DeleteConflict> iterator() {
return myList.iterator(); // Note that handlers may add items to this list, so we're using a special iterator
// that is ok with this. Only removals from the list should trigger a concurrent modification
// issue
return new Iterator<DeleteConflict>() {
private final int myOriginalRemoveModCont = myRemoveModCount;
private int myNextIndex = 0;
@Override
public boolean hasNext() {
checkForCoModification();
return myNextIndex < myList.size();
}
@Override
public DeleteConflict next() {
checkForCoModification();
return myList.get(myNextIndex++);
}
private void checkForCoModification() {
Validate.isTrue(myOriginalRemoveModCont == myRemoveModCount);
}
};
} }
public boolean removeIf(Predicate<DeleteConflict> theFilter) { public boolean removeIf(Predicate<DeleteConflict> theFilter) {
return myList.removeIf(theFilter); boolean retVal = myList.removeIf(theFilter);
if (retVal) {
myRemoveModCount++;
}
return retVal;
} }
public void addAll(DeleteConflictList theNewConflicts) { public void addAll(DeleteConflictList theNewConflicts) {

View File

@ -64,6 +64,10 @@ public class CascadingDeleteInterceptorR4Test extends BaseResourceProviderR4Test
e.setSubject(new Reference(myPatientId)); e.setSubject(new Reference(myPatientId));
myEncounterId = ourClient.create().resource(e).execute().getId().toUnqualifiedVersionless(); myEncounterId = ourClient.create().resource(e).execute().getId().toUnqualifiedVersionless();
CarePlan cp = new CarePlan();
cp.setEncounter(new Reference(myEncounterId));
ourClient.create().resource(cp).execute();
Observation o = new Observation(); Observation o = new Observation();
o.setStatus(Observation.ObservationStatus.FINAL); o.setStatus(Observation.ObservationStatus.FINAL);
o.setSubject( new Reference(myPatientId)); o.setSubject( new Reference(myPatientId));

View File

@ -101,6 +101,22 @@
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<dumpOnExit>true</dumpOnExit>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Tell Maven which Java source version you want to use --> <!-- Tell Maven which Java source version you want to use -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.migrate; package ca.uhn.fhir.jpa.migrate;
/*-
* #%L
* HAPI FHIR JPA Server - Migration
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask; import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask;
import org.flywaydb.core.api.MigrationInfoService; import org.flywaydb.core.api.MigrationInfoService;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.migrate; package ca.uhn.fhir.jpa.migrate;
/*-
* #%L
* HAPI FHIR JPA Server - Migration
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask; import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import org.flywaydb.core.api.MigrationInfoService; import org.flywaydb.core.api.MigrationInfoService;

View File

@ -50,6 +50,10 @@
ValueSet Precalculation sometimes failed on Oracle DBs due to an invalid SQL function. This ValueSet Precalculation sometimes failed on Oracle DBs due to an invalid SQL function. This
has been corrected. has been corrected.
</action> </action>
<action type="fix">
A ConcurrentModificationException was sometimes thrown when performing a cascading delete.
This has been corrected.
</action>
</release> </release>
<release version="4.1.0" date="2019-11-13" description="Jitterbug"> <release version="4.1.0" date="2019-11-13" description="Jitterbug">
<action type="add"> <action type="add">