Skip to content

Commit

Permalink
release(v1.3.0-alpha3)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 13, 2021
1 parent 8666663 commit ca3f2fe
Show file tree
Hide file tree
Showing 22 changed files with 191 additions and 172 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>io.camunda</groupId>
<artifactId>zeebe-process-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.3.0-alpha3</version>
<packaging>jar</packaging>

<name>Zeebe Process Test</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.camunda.zeebe.process.test.assertions;

import io.camunda.zeebe.process.test.RecordStreamSourceStore;
import io.camunda.zeebe.process.test.inspections.model.InspectedProcessInstance;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import io.camunda.zeebe.client.api.response.PublishMessageResponse;
import io.camunda.zeebe.process.test.RecordStreamSourceStore;
import io.camunda.zeebe.process.test.inspections.model.InspectedProcessInstance;

public abstract class BpmnAssert {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.client.api.response.Process;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import java.util.List;
import org.assertj.core.api.AbstractAssert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import io.camunda.zeebe.process.test.filters.IncidentRecordStreamFilter;
import io.camunda.zeebe.process.test.filters.StreamFilter;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.RejectionType;
import io.camunda.zeebe.protocol.record.intent.IncidentIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.process.test.filters.IncidentRecordStreamFilter;
import io.camunda.zeebe.process.test.filters.StreamFilter;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.RejectionType;
import io.camunda.zeebe.protocol.record.value.IncidentRecordValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

import io.camunda.zeebe.client.api.response.PublishMessageResponse;
import io.camunda.zeebe.process.test.filters.StreamFilter;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.api.response.PublishMessageResponse;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.RejectionType;
import io.camunda.zeebe.protocol.record.intent.MessageIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.client.api.response.Process;
import io.camunda.zeebe.process.test.filters.StreamFilter;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.api.response.Process;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.RejectionType;
import io.camunda.zeebe.protocol.record.value.BpmnElementType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.client.impl.ZeebeObjectMapper;
import io.camunda.zeebe.process.test.filters.IncidentRecordStreamFilter;
import io.camunda.zeebe.process.test.filters.StreamFilter;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.impl.ZeebeObjectMapper;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.RejectionType;
import io.camunda.zeebe.protocol.record.intent.IncidentIntent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.camunda.zeebe.process.test.extensions;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.process.test.RecordStreamSourceStore;
import io.camunda.zeebe.process.test.testengine.EngineFactory;
import io.camunda.zeebe.process.test.testengine.InMemoryEngine;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import io.camunda.zeebe.client.ZeebeClient;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.camunda.zeebe.process.test.testengine;

import io.camunda.zeebe.process.test.testengine.db.InMemoryDbFactory;
import io.camunda.zeebe.db.ZeebeDb;
import io.camunda.zeebe.engine.processing.EngineProcessors;
import io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor;
import io.camunda.zeebe.engine.state.ZbColumnFamilies;
import io.camunda.zeebe.engine.state.appliers.EventAppliers;
import io.camunda.zeebe.logstreams.log.*;
import io.camunda.zeebe.logstreams.storage.LogStorage;
import io.camunda.zeebe.process.test.testengine.db.InMemoryDbFactory;
import io.camunda.zeebe.test.util.socket.SocketUtil;
import io.camunda.zeebe.util.sched.Actor;
import io.camunda.zeebe.util.sched.ActorScheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,22 @@
import io.camunda.zeebe.client.ZeebeClient;
import java.time.Duration;

/**
* The engine used for running processes. This engine runs fully in memory.
*/
/** The engine used for running processes. This engine runs fully in memory. */
public interface InMemoryEngine {

/**
* Starts the engine
*/
/** Starts the engine */
void start();

/**
* Stops the engine
*/
/** Stops the engine */
void stop();

/**
* @return the {@link RecordStreamSource} of this engine
*/
/** @return the {@link RecordStreamSource} of this engine */
RecordStreamSource getRecordStream();

/**
* @return a newly created {@link ZeebeClient}
*/
/** @return a newly created {@link ZeebeClient} */
ZeebeClient createClient();

/**
* @return the address at which the gateway is reachable
*/
/** @return the address at which the gateway is reachable */
String getGatewayAddress();

/**
Expand All @@ -44,7 +32,7 @@ public interface InMemoryEngine {
/**
* Runs the given function once the engine has reached an idle state.
*
* For more info on the idle state refer to {@link IdleStateMonitor}
* <p>For more info on the idle state refer to {@link IdleStateMonitor}
*
* @param callback the function that should be executed once an idle state has been reached
*/
Expand All @@ -53,7 +41,7 @@ public interface InMemoryEngine {
/**
* Waits for the engine to reach an idle state.
*
* For more info on the idle state refer to {@link IdleStateMonitor}
* <p>For more info on the idle state refer to {@link IdleStateMonitor}
*/
void waitForIdleState();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,58 @@

public interface RecordStreamSource {

/**
* @return an iterable of all {@link Record} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record} on the {@link LogStream} */
Iterable<Record<?>> records();

/**
* @return an iterable of all {@link Record<ProcessInstanceRecordValue>} on the {@link LogStream}
*/
Iterable<Record<ProcessInstanceRecordValue>> processInstanceRecords();

/**
* @return an iterable of all {@link Record<JobRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<JobRecordValue>} on the {@link LogStream} */
Iterable<Record<JobRecordValue>> jobRecords();

/**
* @return an iterable of all {@link Record<JobBatchRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<JobBatchRecordValue>} on the {@link LogStream} */
Iterable<Record<JobBatchRecordValue>> jobBatchRecords();

/**
* @return an iterable of all {@link Record<DeploymentRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<DeploymentRecordValue>} on the {@link LogStream} */
Iterable<Record<DeploymentRecordValue>> deploymentRecords();

/**
* @return an iterable of all {@link Record<Process>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<Process>} on the {@link LogStream} */
Iterable<Record<Process>> processRecords();

/**
* @return an iterable of all {@link Record<VariableRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<VariableRecordValue>} on the {@link LogStream} */
Iterable<Record<VariableRecordValue>> variableRecords();

/**
* @return an iterable of all {@link Record<VariableDocumentRecordValue>} on the {@link LogStream}
*/
Iterable<Record<VariableDocumentRecordValue>> variableDocumentRecords();

/**
* @return an iterable of all {@link Record<IncidentRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<IncidentRecordValue>} on the {@link LogStream} */
Iterable<Record<IncidentRecordValue>> incidentRecords();

/**
* @return an iterable of all {@link Record<TimerRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<TimerRecordValue>} on the {@link LogStream} */
Iterable<Record<TimerRecordValue>> timerRecords();

/**
* @return an iterable of all {@link Record<MessageRecordValue>} on the {@link LogStream}
*/
/** @return an iterable of all {@link Record<MessageRecordValue>} on the {@link LogStream} */
Iterable<Record<MessageRecordValue>> messageRecords();

/**
* @return an iterable of all {@link Record<MessageSubscriptionRecordValue>} on the
* {@link LogStream}
* @return an iterable of all {@link Record<MessageSubscriptionRecordValue>} on the {@link
* LogStream}
*/
Iterable<Record<MessageSubscriptionRecordValue>> messageSubscriptionRecords();

/**
* @return an iterable of all {@link Record<MessageStartEventSubscriptionRecordValue>} on the
* {@link LogStream}
* {@link LogStream}
*/
Iterable<Record<MessageStartEventSubscriptionRecordValue>> messageStartEventSubscriptionRecords();

/**
* @return an iterable of all {@link Record<ProcessMessageSubscriptionRecordValue>} on the
* {@link LogStream}
* @return an iterable of all {@link Record<ProcessMessageSubscriptionRecordValue>} on the {@link
* LogStream}
*/
Iterable<Record<ProcessMessageSubscriptionRecordValue>> processMessageSubscriptionRecords();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package io.camunda.zeebe.process.test.assertions;

import static io.camunda.zeebe.process.test.assertions.BpmnAssert.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.process.test.extensions.ZeebeProcessTest;
import io.camunda.zeebe.process.test.util.Utilities;
import io.camunda.zeebe.process.test.util.Utilities.ProcessPackLoopingServiceTask;
import io.camunda.zeebe.process.test.util.Utilities.ProcessPackMultipleTasks;
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -99,7 +98,9 @@ public void testContainsProcessesByIdFailure() {

// then
assertThatThrownBy(
() -> BpmnAssert.assertThat(deploymentEvent).containsProcessesByBpmnProcessId(WRONG_VALUE))
() ->
BpmnAssert.assertThat(deploymentEvent)
.containsProcessesByBpmnProcessId(WRONG_VALUE))
.isInstanceOf(AssertionError.class)
.hasMessageContainingAll(WRONG_VALUE, ProcessPackLoopingServiceTask.PROCESS_ID);
}
Expand All @@ -112,7 +113,9 @@ public void testContainsProcessesByResourceNameFailure() {

// then
assertThatThrownBy(
() -> BpmnAssert.assertThat(deploymentEvent).containsProcessesByResourceName(WRONG_VALUE))
() ->
BpmnAssert.assertThat(deploymentEvent)
.containsProcessesByResourceName(WRONG_VALUE))
.isInstanceOf(AssertionError.class)
.hasMessageContainingAll(WRONG_VALUE, ProcessPackLoopingServiceTask.PROCESS_ID);
}
Expand All @@ -125,7 +128,9 @@ public void testExtractingProcessByBpmnProcessIdFailure() {

// then
assertThatThrownBy(
() -> BpmnAssert.assertThat(deploymentEvent).extractingProcessByBpmnProcessId(WRONG_VALUE))
() ->
BpmnAssert.assertThat(deploymentEvent)
.extractingProcessByBpmnProcessId(WRONG_VALUE))
.isInstanceOf(AssertionError.class)
.hasMessage(
"Expected to find one process for BPMN process id 'wrong value' but found 0: []");
Expand All @@ -139,7 +144,9 @@ public void testExtractingProcessByResourceName() {

// then
assertThatThrownBy(
() -> BpmnAssert.assertThat(deploymentEvent).extractingProcessByResourceName(WRONG_VALUE))
() ->
BpmnAssert.assertThat(deploymentEvent)
.extractingProcessByResourceName(WRONG_VALUE))
.isInstanceOf(AssertionError.class)
.hasMessage(
"Expected to find one process for resource name 'wrong value' but found 0: []");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.camunda.zeebe.process.test.assertions;

import static io.camunda.zeebe.process.test.assertions.BpmnAssert.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import io.camunda.zeebe.process.test.extensions.ZeebeProcessTest;
import io.camunda.zeebe.process.test.testengine.InMemoryEngine;
import io.camunda.zeebe.process.test.util.Utilities;
import io.camunda.zeebe.process.test.util.Utilities.ProcessPackLoopingServiceTask;
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ActivateJobsResponse;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import io.camunda.zeebe.process.test.extensions.ZeebeProcessTest;
import io.camunda.zeebe.process.test.testengine.InMemoryEngine;
import io.camunda.zeebe.process.test.util.Utilities;
import io.camunda.zeebe.process.test.util.Utilities.ProcessPackLoopingServiceTask;
import io.camunda.zeebe.protocol.record.value.ErrorType;
import java.util.Collections;
import java.util.Map;
Expand Down Expand Up @@ -139,7 +138,8 @@ void testOccurredOnElement() {

engine.waitForIdleState();

final IncidentAssert incidentAssert = BpmnAssert.assertThat(instanceEvent).extractLatestIncident();
final IncidentAssert incidentAssert =
BpmnAssert.assertThat(instanceEvent).extractLatestIncident();

// then
incidentAssert.occurredOnElement(ProcessPackLoopingServiceTask.GATEWAY_ELEMENT_ID);
Expand Down Expand Up @@ -310,7 +310,8 @@ void testOccurredOnElementFailure() {

engine.waitForIdleState();

final IncidentAssert incidentAssert = BpmnAssert.assertThat(instanceEvent).extractLatestIncident();
final IncidentAssert incidentAssert =
BpmnAssert.assertThat(instanceEvent).extractLatestIncident();

// then
assertThatThrownBy(() -> incidentAssert.occurredOnElement(WRONG_VALUE))
Expand Down
Loading

0 comments on commit ca3f2fe

Please sign in to comment.