use of io.camunda.zeebe.process.test.engine.protocol.EngineControlGrpc.EngineControlBlockingStub in project zeebe-process-test by camunda.
the class ContainerizedEngine method increaseTime.
@Override
public void increaseTime(final Duration timeToAdd) {
final ManagedChannel channel = getChannel();
final EngineControlBlockingStub stub = getStub(channel);
final IncreaseTimeRequest request = IncreaseTimeRequest.newBuilder().setMilliseconds((int) timeToAdd.toMillis()).build();
stub.increaseTime(request);
closeChannel(channel);
}
use of io.camunda.zeebe.process.test.engine.protocol.EngineControlGrpc.EngineControlBlockingStub in project zeebe-process-test by camunda.
the class ContainerizedEngine method getRecords.
/**
* Gets a list of all records that have occurred on the test engine.
*
* @return a list of records
*/
public List<Record<?>> getRecords() {
final ManagedChannel channel = getChannel();
final EngineControlBlockingStub stub = getStub(channel);
final ObjectMapper mapper = new ObjectMapper();
final List<Record<?>> mappedRecords = new ArrayList<>();
final GetRecordsRequest request = GetRecordsRequest.newBuilder().build();
final Iterator<RecordResponse> response = stub.getRecords(request);
while (response.hasNext()) {
final RecordResponse recordResponse = response.next();
try {
final Record<?> record = mapper.readValue(recordResponse.getRecordJson(), AbstractRecord.class);
mappedRecords.add(record);
} catch (final JsonProcessingException e) {
throw new RuntimeException(e);
}
}
closeChannel(channel);
return mappedRecords;
}
use of io.camunda.zeebe.process.test.engine.protocol.EngineControlGrpc.EngineControlBlockingStub in project zeebe-process-test by camunda.
the class ContainerizedEngine method stop.
@Override
public void stop() {
final ManagedChannel channel = getChannel();
final EngineControlBlockingStub stub = getStub(channel);
final StopEngineRequest request = StopEngineRequest.newBuilder().build();
stub.stopEngine(request);
closeChannel(channel);
}
use of io.camunda.zeebe.process.test.engine.protocol.EngineControlGrpc.EngineControlBlockingStub in project zeebe-process-test by camunda.
the class ContainerizedEngine method reset.
/**
* Reset the test engine. A reset stops the current engine, and replaces it with a new engine.
* Note that you'll need to redeploy your processes because it is an entirely new engine.
*/
public void reset() {
final ManagedChannel channel = getChannel();
final EngineControlBlockingStub stub = getStub(channel);
final ResetEngineRequest request = ResetEngineRequest.newBuilder().build();
stub.resetEngine(request);
closeChannel(channel);
}
use of io.camunda.zeebe.process.test.engine.protocol.EngineControlGrpc.EngineControlBlockingStub in project zeebe-process-test by camunda-cloud.
the class ContainerizedEngine method waitForIdleState.
@Override
public void waitForIdleState(final Duration timeout) {
final ManagedChannel channel = getChannel();
final EngineControlBlockingStub stub = getStub(channel);
final WaitForIdleStateRequest request = WaitForIdleStateRequest.newBuilder().setTimeout(timeout.toMillis()).build();
stub.waitForIdleState(request);
closeChannel(channel);
}
Aggregations