- fix merges conflicts

- set first chunk to be always created in READY
This commit is contained in:
tyner 2024-04-10 05:41:36 -04:00
parent 1a7e4d4401
commit 0aabdbdf4f
3 changed files with 10 additions and 6 deletions

View File

@ -37,7 +37,7 @@ public interface ITestFixture {
WorkChunk freshFetchWorkChunk(String theChunkId);
String storeWorkChunk(String theJobDefinitionId, String theTargetStepId, String theInstanceId, int theSequence, String theSerializedData);
String storeWorkChunk(String theJobDefinitionId, String theTargetStepId, String theInstanceId, int theSequence, String theSerializedData, boolean theGatedExecution);
void runInTransaction(Runnable theRunnable);
@ -62,6 +62,8 @@ public interface ITestFixture {
*/
String createChunk(String theJobInstanceId);
String createChunk(String theJobInstanceId, boolean theGatedExecution);
/**
* Enable/disable the maintenance runner (So it doesn't run on a scheduler)
*/

View File

@ -19,9 +19,6 @@
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.WorkChunk;
import ca.uhn.fhir.batch2.model.WorkChunkStatusEnum;
import ca.uhn.fhir.batch2.model.JobDefinition;
import ca.uhn.fhir.batch2.model.WorkChunk;
import ca.uhn.fhir.batch2.model.WorkChunkStatusEnum;
@ -61,7 +58,8 @@ public interface IWorkChunkStateTransitions extends IWorkChunkCommon, WorkChunkT
PointcutLatch sendLatch = getTestManager().disableWorkChunkMessageHandler();
sendLatch.setExpectedCount(1);
String jobInstanceId = getTestManager().createAndStoreJobInstance(withJobDefinition(theGatedExecution));
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
String jobInstanceId = getTestManager().createAndStoreJobInstance(jobDef);
String myChunkId = getTestManager().createChunk(jobInstanceId, theGatedExecution);
getTestManager().runMaintenancePass();

View File

@ -64,11 +64,15 @@ public class WorkChunkCreateEvent {
isGatedExecution = theGatedExecution;
}
/**
* Creates the WorkChunkCreateEvent for the first chunk of a job.
*/
public static WorkChunkCreateEvent firstChunk(JobDefinition<?> theJobDefinition, String theInstanceId) {
String firstStepId = theJobDefinition.getFirstStepId();
String jobDefinitionId = theJobDefinition.getJobDefinitionId();
int jobDefinitionVersion = theJobDefinition.getJobDefinitionVersion();
boolean isGatedExecution = theJobDefinition.isGatedExecution();
// the first chunk of a job is always READY, no matter whether the job is gated
boolean isGatedExecution = false;
return new WorkChunkCreateEvent(
jobDefinitionId, jobDefinitionVersion, firstStepId, theInstanceId, 0, null, isGatedExecution);
}