use of io.camunda.zeebe.db.TransactionContext in project zeebe by camunda.
the class ZeebeRocksDbTransactionTest method shouldThrowRecoverableExceptionOnCommit.
@Test(expected = ZeebeDbException.class)
public void shouldThrowRecoverableExceptionOnCommit() throws Exception {
// given
final ZeebeTransaction transaction = mock(ZeebeTransaction.class);
final TransactionContext newContext = new DefaultTransactionContext(transaction);
final Status status = new Status(Code.IOError, SubCode.None, "");
doThrow(new RocksDBException("expected", status)).when(transaction).commitInternal();
// when
newContext.runInTransaction(() -> {
});
}
use of io.camunda.zeebe.db.TransactionContext in project zeebe by camunda.
the class ZeebeRocksDbTransactionTest method shouldWrapExceptionInRuntimeExceptionOnCommit.
@Test(expected = RuntimeException.class)
public void shouldWrapExceptionInRuntimeExceptionOnCommit() throws Exception {
// given
final ZeebeTransaction transaction = mock(ZeebeTransaction.class);
final TransactionContext newContext = new DefaultTransactionContext(transaction);
final Status status = new Status(Code.NotSupported, SubCode.None, "");
doThrow(new RocksDBException("expected", status)).when(transaction).commitInternal();
// when
newContext.runInTransaction(() -> {
});
}
use of io.camunda.zeebe.db.TransactionContext in project zeebe by camunda.
the class ZeebeRocksDbTransactionTest method shouldWrapExceptionInRuntimeExceptionOnRollback.
@Test(expected = RuntimeException.class)
public void shouldWrapExceptionInRuntimeExceptionOnRollback() throws Exception {
// given
final ZeebeTransaction transaction = mock(ZeebeTransaction.class);
final TransactionContext newContext = new DefaultTransactionContext(transaction);
final Status status = new Status(Code.NotSupported, SubCode.None, "");
doThrow(new RocksDBException("expected", status)).when(transaction).rollbackInternal();
// when
newContext.runInTransaction(() -> {
});
}
use of io.camunda.zeebe.db.TransactionContext in project zeebe by zeebe-io.
the class ZeebeRocksDbTransactionTest method shouldThrowRecoverableExceptionOnRollback.
@Test(expected = ZeebeDbException.class)
public void shouldThrowRecoverableExceptionOnRollback() throws Exception {
// given
final ZeebeTransaction transaction = mock(ZeebeTransaction.class);
final TransactionContext newContext = new DefaultTransactionContext(transaction);
final Status status = new Status(Code.IOError, SubCode.None, "");
doThrow(new RocksDBException("expected", status)).when(transaction).rollbackInternal();
// when
newContext.runInTransaction(() -> {
});
}
use of io.camunda.zeebe.db.TransactionContext 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;
}
Aggregations