use of io.camunda.zeebe.engine.state.ZeebeDbState in project zdb by Zelldon.
the class ZeebeTest method shouldOpenAndReadState.
@Test
public void shouldOpenAndReadState() {
// given
final ZeebeClient client = ZeebeClient.newClientBuilder().gatewayAddress(zeebeContainer.getExternalGatewayAddress()).usePlaintext().build();
final BpmnModelInstance process = Bpmn.createExecutableProcess("process").startEvent().endEvent().done();
final DeploymentEvent deploymentEvent = client.newDeployCommand().addProcessModel(process, "process.bpmn").send().join();
// when
final var readonlyTransactionDb = ReadonlyTransactionDb.Companion.openReadonlyDb(ZeebePaths.Companion.getRuntimePath(tempDir, "1"));
var zeebeState = new ZeebeDbState(readonlyTransactionDb, readonlyTransactionDb.createContext());
// then
final var processState = zeebeState.getProcessState();
final var processes = processState.getProcesses();
assertThat(processes).hasSize(1);
final var deployedProcesses = new ArrayList<DeployedProcess>(processes);
final var deployedProcess = deployedProcesses.get(0);
assertThat(deployedProcess.getVersion()).isEqualTo(1);
assertThat(deployedProcess.getBpmnProcessId()).isEqualTo(BufferUtil.wrapString("process"));
assertThat(deployedProcess.getResourceName()).isEqualTo(BufferUtil.wrapString("process.bpmn"));
assertThat(deployedProcess.getKey()).isEqualTo(deploymentEvent.getProcesses().get(0).getProcessDefinitionKey());
}
use of io.camunda.zeebe.engine.state.ZeebeDbState in project zeebe by camunda.
the class ZeebeStateRule method before.
@Override
protected void before() throws Throwable {
tempFolder.create();
db = createNewDb();
zeebeState = new ZeebeDbState(partition, db, db.createContext());
}
use of io.camunda.zeebe.engine.state.ZeebeDbState in project zeebe by zeebe-io.
the class ZeebeStateRule method before.
@Override
protected void before() throws Throwable {
tempFolder.create();
db = createNewDb();
zeebeState = new ZeebeDbState(partition, db, db.createContext());
}
use of io.camunda.zeebe.engine.state.ZeebeDbState in project zeebe by zeebe-io.
the class StreamProcessor method recoverState.
private ZeebeDbState recoverState() {
final TransactionContext transactionContext = zeebeDb.createContext();
final ZeebeDbState zeebeState = new ZeebeDbState(partitionId, zeebeDb, transactionContext);
processingContext.transactionContext(transactionContext);
processingContext.zeebeState(zeebeState);
processingContext.eventApplier(eventApplierFactory.apply(zeebeState));
return zeebeState;
}
use of io.camunda.zeebe.engine.state.ZeebeDbState in project zeebe by camunda-cloud.
the class StreamProcessor method recoverState.
private ZeebeDbState recoverState() {
final TransactionContext transactionContext = zeebeDb.createContext();
final ZeebeDbState zeebeState = new ZeebeDbState(partitionId, zeebeDb, transactionContext);
processingContext.transactionContext(transactionContext);
processingContext.zeebeState(zeebeState);
processingContext.eventApplier(eventApplierFactory.apply(zeebeState));
return zeebeState;
}
Aggregations