Skip to content

Commit

Permalink
refactor: automatic formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
remcowesterhoud committed Mar 1, 2022
1 parent 6b2a93c commit e69b281
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.camunda.zeebe.process.test.api;

import io.camunda.zeebe.client.ZeebeClient;
import io.netty.util.Timeout;
import java.time.Duration;
import java.util.concurrent.TimeoutException;

Expand Down Expand Up @@ -31,7 +30,8 @@ public interface InMemoryEngine {
*/
void increaseTime(Duration timeToAdd);

/** Waits for the engine to reach an idle state.
/**
* Waits for the engine to reach an idle state.
*
* @param timeout the maximum amount of time to wait before idle state has been reached
* @throws InterruptedException if the current thread was interrupted while waiting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

/**
* Monitor that monitors whether the engine is busy or in idle state. Busy state is a state in which
* the engine is actively writing new events to the logstream. Idle state is a state in which
* the process engine makes no progress and is waiting for new commands or events to trigger</br>
* the engine is actively writing new events to the logstream. Idle state is a state in which the
* process engine makes no progress and is waiting for new commands or events to trigger</br>
*
* <p>On a technical level, idle state is defined by
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.camunda.zeebe.process.test.engine;


import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -95,14 +94,16 @@ void testCallbackIsCalledWhenBusyStateIsReached()
assertThat(callbackFuture).isCompleted();
}

private void changeToIdleState(final EngineStateMonitor monitor, final TestLogStreamReader reader) {
private void changeToIdleState(
final EngineStateMonitor monitor, final TestLogStreamReader reader) {
// We use onCommit here because it is an easy way to trigger the EngineStateMonitor to check the
// engine state and trigger the callbacks
reader.setPosition(reader.getLastEventPosition());
monitor.onCommit();
}

private void changeToBusyState(final EngineStateMonitor monitor, final TestLogStreamReader reader) {
private void changeToBusyState(
final EngineStateMonitor monitor, final TestLogStreamReader reader) {
// We use onReplayed here because it is an easy way to update the lastProcessedEventPosition of
// the EngineStateMonitor
final long position = reader.getLastEventPosition() + 1;
Expand Down Expand Up @@ -138,9 +139,7 @@ public boolean seek(final long position) {
}

@Override
public void seekToFirstEvent() {

}
public void seekToFirstEvent() {}

@Override
public long seekToEnd() {
Expand All @@ -158,9 +157,7 @@ public LoggedEvent peekNext() {
}

@Override
public void close() {

}
public void close() {}

@Override
public boolean hasNext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ void testExtractingProcessInstance() throws InterruptedException, TimeoutExcepti
}

@Test
void testExtractingProcessInstance_messageStartEvent() throws InterruptedException, TimeoutException {
void testExtractingProcessInstance_messageStartEvent()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -183,7 +184,8 @@ void testHasBeenCorrelatedFailure() throws InterruptedException, TimeoutExceptio
}

@Test
void testHasMessageStartEventBeenCorrelatedFailure() throws InterruptedException, TimeoutException {
void testHasMessageStartEventBeenCorrelatedFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -225,7 +227,8 @@ void testHasNotBeenCorrelatedFailure() throws InterruptedException, TimeoutExcep
}

@Test
void testHasMessageStartEventNotBeenCorrelatedFailure() throws InterruptedException, TimeoutException {
void testHasMessageStartEventNotBeenCorrelatedFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -301,7 +304,8 @@ void testExtractingProcessInstanceFailure() throws InterruptedException, Timeout
}

@Test
void testExtractingProcessInstanceFailure_messageStartEvent() throws InterruptedException, TimeoutException {
void testExtractingProcessInstanceFailure_messageStartEvent()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ void testProcessInstanceHasNotPassedElement() throws InterruptedException, Timeo
}

@Test
void testProcessInstanceHasPassedElementMultipleTimes() throws InterruptedException, TimeoutException {
void testProcessInstanceHasPassedElementMultipleTimes()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final int totalLoops = 5;
Expand All @@ -201,7 +202,8 @@ void testProcessInstanceHasPassedElementMultipleTimes() throws InterruptedExcept
}

@Test
void testProcessInstanceHasPassedElementsInOrder() throws InterruptedException, TimeoutException {
void testProcessInstanceHasPassedElementsInOrder()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final Map<String, Object> variables =
Expand Down Expand Up @@ -268,7 +270,8 @@ void testProcessInstanceIsNotWaitingAt() throws InterruptedException, TimeoutExc
}

@Test
void testProcessInstanceIsNotWaitingAtMultipleElements() throws InterruptedException, TimeoutException {
void testProcessInstanceIsNotWaitingAtMultipleElements()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);
final ProcessInstanceEvent instanceEvent =
Expand All @@ -288,7 +291,8 @@ void testProcessInstanceIsNotWaitingAtMultipleElements() throws InterruptedExcep
}

@Test
void testProcessInstanceIsNotWaitingAtNonExistingElement() throws InterruptedException, TimeoutException {
void testProcessInstanceIsNotWaitingAtNonExistingElement()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand All @@ -302,7 +306,8 @@ void testProcessInstanceIsNotWaitingAtNonExistingElement() throws InterruptedExc
}

@Test
void testProcessInstanceIsWaitingExactlyAtElements() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingExactlyAtElements()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);
final ProcessInstanceEvent instanceEvent =
Expand Down Expand Up @@ -513,7 +518,8 @@ void testProcessInstanceIsStartedFailure() throws InterruptedException, TimeoutE
}

@Test
void testProcessInstanceIsNotStartedIfProcessInstanceKeyNoMatch() throws InterruptedException, TimeoutException {
void testProcessInstanceIsNotStartedIfProcessInstanceKeyNoMatch()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
Utilities.startProcessInstance(engine, client, ProcessPackLoopingServiceTask.PROCESS_ID);
Expand Down Expand Up @@ -630,7 +636,8 @@ void testProcessInstanceIsNotTerminatedFailure() throws InterruptedException, Ti
}

@Test
void testProcessInstanceHasPassedElementFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceHasPassedElementFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);

Expand All @@ -654,7 +661,8 @@ void testProcessInstanceHasPassedElementFailure() throws InterruptedException, T
}

@Test
void testProcessInstanceHasNotPassedElementFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceHasNotPassedElementFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final ProcessInstanceEvent instanceEvent =
Expand All @@ -679,7 +687,8 @@ void testProcessInstanceHasNotPassedElementFailure() throws InterruptedException
}

@Test
void testProcessInstanceHasPassedElementsInOrderFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceHasPassedElementsInOrderFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final Map<String, Object> variables =
Expand Down Expand Up @@ -728,7 +737,8 @@ void testProcessInstanceIsWaitingAtFailure() throws InterruptedException, Timeou
}

@Test
void testProcessInstanceIsWaitingAtMultipleElementsFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingAtMultipleElementsFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);
final ProcessInstanceEvent instanceEvent =
Expand Down Expand Up @@ -756,7 +766,8 @@ void testProcessInstanceIsWaitingAtMultipleElementsFailure() throws InterruptedE
}

@Test
void testProcessInstanceWaitingAtNonExistingElementFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceWaitingAtNonExistingElementFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand Down Expand Up @@ -791,7 +802,8 @@ void testProcessInstanceIsNotWaitingAtFailure() throws InterruptedException, Tim
}

@Test
void testProcessInstanceIsNotWaitingAtMulitpleElementsFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceIsNotWaitingAtMulitpleElementsFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand All @@ -816,7 +828,8 @@ void testProcessInstanceIsNotWaitingAtMulitpleElementsFailure() throws Interrupt
}

@Test
void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooManyElements() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooManyElements()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand All @@ -840,7 +853,8 @@ void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooManyElements() thro
}

@Test
void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooLittleElements() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooLittleElements()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand Down Expand Up @@ -869,7 +883,8 @@ void testProcessInstanceIsWaitingExactlyAtElementsFailure_tooLittleElements() th
}

@Test
void testProcessInstanceIsWaitingExactlyAtElementsFailure_combination() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingExactlyAtElementsFailure_combination()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMultipleTasks.RESOURCE_NAME);

Expand Down Expand Up @@ -900,7 +915,8 @@ void testProcessInstanceIsWaitingExactlyAtElementsFailure_combination() throws I
}

@Test
void testProcessInstanceIsWaitingForMessageFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceIsWaitingForMessageFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageEvent.RESOURCE_NAME);
final String correlationKey = "key";
Expand All @@ -923,7 +939,8 @@ void testProcessInstanceIsWaitingForMessageFailure() throws InterruptedException
}

@Test
void testProcessInstanceIsNotWaitingForMessageFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceIsNotWaitingForMessageFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageEvent.RESOURCE_NAME);
final String correlationKey = "key";
Expand Down Expand Up @@ -964,7 +981,8 @@ void testProcessInstanceHasVariableFailure() throws InterruptedException, Timeou
}

@Test
void testProcessInstanceHasVariableWithValueFailure() throws InterruptedException, TimeoutException {
void testProcessInstanceHasVariableWithValueFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final String variable = "variable";
Expand Down Expand Up @@ -1015,7 +1033,8 @@ void testHasCorrelatedMessageByNameFailure() throws InterruptedException, Timeou
}

@Test
void testHasCorrelatedMessageByCorrelationKeyFailure() throws InterruptedException, TimeoutException {
void testHasCorrelatedMessageByCorrelationKeyFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageEvent.RESOURCE_NAME);
final String correlationKey = "key";
Expand Down Expand Up @@ -1099,7 +1118,8 @@ class RegressionTests {
private InMemoryEngine engine;

@Test // regression test for #78
public void testShouldCaptureLatestValueOfVariable() throws InterruptedException, TimeoutException {
public void testShouldCaptureLatestValueOfVariable()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackLoopingServiceTask.RESOURCE_NAME);
final Map<String, Object> variables1 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class WorkerTest {
private InMemoryEngine engine;

@Test
void testJobsCanBeProcessedAsynchronouslyByWorker() throws InterruptedException, TimeoutException {
void testJobsCanBeProcessedAsynchronouslyByWorker()
throws InterruptedException, TimeoutException {
// given
client
.newWorker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ void testExtractingProcessInstance() throws InterruptedException, TimeoutExcepti
}

@Test
void testExtractingProcessInstance_messageStartEvent() throws InterruptedException, TimeoutException {
void testExtractingProcessInstance_messageStartEvent()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -183,7 +184,8 @@ void testHasBeenCorrelatedFailure() throws InterruptedException, TimeoutExceptio
}

@Test
void testHasMessageStartEventBeenCorrelatedFailure() throws InterruptedException, TimeoutException {
void testHasMessageStartEventBeenCorrelatedFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -225,7 +227,8 @@ void testHasNotBeenCorrelatedFailure() throws InterruptedException, TimeoutExcep
}

@Test
void testHasMessageStartEventNotBeenCorrelatedFailure() throws InterruptedException, TimeoutException {
void testHasMessageStartEventNotBeenCorrelatedFailure()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down Expand Up @@ -301,7 +304,8 @@ void testExtractingProcessInstanceFailure() throws InterruptedException, Timeout
}

@Test
void testExtractingProcessInstanceFailure_messageStartEvent() throws InterruptedException, TimeoutException {
void testExtractingProcessInstanceFailure_messageStartEvent()
throws InterruptedException, TimeoutException {
// given
Utilities.deployProcess(client, ProcessPackMessageStartEvent.RESOURCE_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class WorkerTest {
private InMemoryEngine engine;

@Test
void testJobsCanBeProcessedAsynchronouslyByWorker() throws InterruptedException, TimeoutException {
void testJobsCanBeProcessedAsynchronouslyByWorker()
throws InterruptedException, TimeoutException {
// given
client
.newWorker()
Expand Down
Loading

0 comments on commit e69b281

Please sign in to comment.