resolved review comments
This commit is contained in:
parent
292a4d3858
commit
658da406a4
|
@ -39,6 +39,7 @@ import ca.uhn.hapi.fhir.batch2.test.support.TestJobStep3InputType;
|
||||||
import ca.uhn.test.concurrency.PointcutLatch;
|
import ca.uhn.test.concurrency.PointcutLatch;
|
||||||
import jakarta.annotation.Nonnull;
|
import jakarta.annotation.Nonnull;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Nested;
|
import org.junit.jupiter.api.Nested;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import ca.uhn.fhir.batch2.model.WorkChunkStatusEnum;
|
||||||
import ca.uhn.hapi.fhir.batch2.test.support.JobMaintenanceStateInformation;
|
import ca.uhn.hapi.fhir.batch2.test.support.JobMaintenanceStateInformation;
|
||||||
import ca.uhn.hapi.fhir.batch2.test.support.TestJobParameters;
|
import ca.uhn.hapi.fhir.batch2.test.support.TestJobParameters;
|
||||||
import ca.uhn.test.concurrency.PointcutLatch;
|
import ca.uhn.test.concurrency.PointcutLatch;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
|
@ -38,6 +39,11 @@ public interface IWorkChunkStateTransitions extends IWorkChunkCommon, WorkChunkT
|
||||||
|
|
||||||
Logger ourLog = LoggerFactory.getLogger(IWorkChunkStateTransitions.class);
|
Logger ourLog = LoggerFactory.getLogger(IWorkChunkStateTransitions.class);
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
default void before() {
|
||||||
|
getTestManager().enableMaintenanceRunner(false);
|
||||||
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvSource({
|
@CsvSource({
|
||||||
"false, READY",
|
"false, READY",
|
||||||
|
@ -89,7 +95,6 @@ public interface IWorkChunkStateTransitions extends IWorkChunkCommon, WorkChunkT
|
||||||
default void advanceJobStepAndUpdateChunkStatus_forGatedJob_updatesBothREADYAndQUEUEDChunks() {
|
default void advanceJobStepAndUpdateChunkStatus_forGatedJob_updatesBothREADYAndQUEUEDChunks() {
|
||||||
// setup
|
// setup
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
|
|
||||||
String state = """
|
String state = """
|
||||||
1|COMPLETED
|
1|COMPLETED
|
||||||
|
@ -117,7 +122,6 @@ public interface IWorkChunkStateTransitions extends IWorkChunkCommon, WorkChunkT
|
||||||
default void enqueueWorkChunkForProcessing_enqueuesOnlyREADYChunks() throws InterruptedException {
|
default void enqueueWorkChunkForProcessing_enqueuesOnlyREADYChunks() throws InterruptedException {
|
||||||
// setup
|
// setup
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
// first step is always complete
|
// first step is always complete
|
||||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.hapi.fhir.batch2.test;
|
||||||
|
|
||||||
import ca.uhn.fhir.batch2.model.JobInstance;
|
import ca.uhn.fhir.batch2.model.JobInstance;
|
||||||
import ca.uhn.fhir.batch2.model.WorkChunk;
|
import ca.uhn.fhir.batch2.model.WorkChunk;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
@ -47,6 +48,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestConstants {
|
public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestConstants {
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
default void before() {
|
||||||
|
getTestManager().enableMaintenanceRunner(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
default void testStoreAndFetchWorkChunk_NoData() {
|
default void testStoreAndFetchWorkChunk_NoData() {
|
||||||
JobInstance instance = createInstance();
|
JobInstance instance = createInstance();
|
||||||
|
@ -69,8 +75,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
JobInstance instance = createInstance();
|
JobInstance instance = createInstance();
|
||||||
String instanceId = getTestManager().getSvc().storeNewInstance(instance);
|
String instanceId = getTestManager().getSvc().storeNewInstance(instance);
|
||||||
|
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
|
|
||||||
String id = getTestManager().storeWorkChunk(JOB_DEFINITION_ID, FIRST_STEP_ID, instanceId, 0, CHUNK_DATA, theGatedExecution);
|
String id = getTestManager().storeWorkChunk(JOB_DEFINITION_ID, FIRST_STEP_ID, instanceId, 0, CHUNK_DATA, theGatedExecution);
|
||||||
assertNotNull(id);
|
assertNotNull(id);
|
||||||
|
|
||||||
|
@ -81,7 +85,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
default void testNonGatedWorkChunkInReady_IsQueuedDuringMaintenance() throws InterruptedException {
|
default void testNonGatedWorkChunkInReady_IsQueuedDuringMaintenance() throws InterruptedException {
|
||||||
// setup
|
// setup
|
||||||
int expectedCalls = 1;
|
int expectedCalls = 1;
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
PointcutLatch sendingLatch = getTestManager().disableWorkChunkMessageHandler();
|
PointcutLatch sendingLatch = getTestManager().disableWorkChunkMessageHandler();
|
||||||
sendingLatch.setExpectedCount(expectedCalls);
|
sendingLatch.setExpectedCount(expectedCalls);
|
||||||
String state = "1|READY,1|QUEUED";
|
String state = "1|READY,1|QUEUED";
|
||||||
|
@ -107,7 +110,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
default void testStoreAndFetchWorkChunk_WithData() {
|
default void testStoreAndFetchWorkChunk_WithData() {
|
||||||
// setup
|
// setup
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
JobDefinition<?> jobDefinition = getTestManager().withJobDefinition(false);
|
JobDefinition<?> jobDefinition = getTestManager().withJobDefinition(false);
|
||||||
JobInstance instance = createInstance();
|
JobInstance instance = createInstance();
|
||||||
String instanceId = getTestManager().getSvc().storeNewInstance(instance);
|
String instanceId = getTestManager().getSvc().storeNewInstance(instance);
|
||||||
|
@ -142,7 +144,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
// setup
|
// setup
|
||||||
String state = "2|IN_PROGRESS,2|COMPLETED";
|
String state = "2|IN_PROGRESS,2|COMPLETED";
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
|
|
||||||
JobDefinition<?> jobDefinition = getTestManager().withJobDefinition(false);
|
JobDefinition<?> jobDefinition = getTestManager().withJobDefinition(false);
|
||||||
String instanceId = getTestManager().createAndStoreJobInstance(jobDefinition);
|
String instanceId = getTestManager().createAndStoreJobInstance(jobDefinition);
|
||||||
|
@ -172,7 +173,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
// setup
|
// setup
|
||||||
String state = "1|IN_PROGRESS,1|ERRORED";
|
String state = "1|IN_PROGRESS,1|ERRORED";
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
||||||
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
||||||
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
||||||
|
@ -214,7 +214,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
// setup
|
// setup
|
||||||
String state = "1|IN_PROGRESS,1|FAILED";
|
String state = "1|IN_PROGRESS,1|FAILED";
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
||||||
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
||||||
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
||||||
|
@ -246,7 +245,6 @@ public interface IWorkChunkStorageTests extends IWorkChunkCommon, WorkChunkTestC
|
||||||
1|IN_PROGRESS,1|COMPLETED
|
1|IN_PROGRESS,1|COMPLETED
|
||||||
""";
|
""";
|
||||||
getTestManager().disableWorkChunkMessageHandler();
|
getTestManager().disableWorkChunkMessageHandler();
|
||||||
getTestManager().enableMaintenanceRunner(false);
|
|
||||||
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
JobDefinition<?> jobDef = getTestManager().withJobDefinition(false);
|
||||||
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
String instanceId = getTestManager().createAndStoreJobInstance(jobDef);
|
||||||
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
JobMaintenanceStateInformation info = new JobMaintenanceStateInformation(
|
||||||
|
|
Loading…
Reference in New Issue