use of com.quorum.tessera.recovery.Recovery in project tessera by ConsenSys.
the class RecoveryImplTest method testDBStagingAffectedTxNotEmpty.
@Test
public void testDBStagingAffectedTxNotEmpty() {
final Recovery spy = spy(recovery);
when(stagingEntityDAO.countAllAffected()).thenReturn(1L);
assertThat(spy.recover()).isEqualTo(2);
verify(stagingEntityDAO).countAll();
verify(stagingEntityDAO).countAllAffected();
}
use of com.quorum.tessera.recovery.Recovery in project tessera by ConsenSys.
the class RecoveryImplTest method testRecoverPartialSuccess.
@Test
public void testRecoverPartialSuccess() {
final Recovery spy = spy(recovery);
doReturn(RecoveryResult.PARTIAL_SUCCESS).when(spy).request();
doReturn(RecoveryResult.PARTIAL_SUCCESS).when(spy).stage();
doReturn(RecoveryResult.SUCCESS).when(spy).sync();
assertThat(spy.recover()).isEqualTo(1);
verify(spy).request();
verify(spy).stage();
verify(spy).sync();
verify(stagingEntityDAO).countAll();
verify(stagingEntityDAO).countAllAffected();
}
use of com.quorum.tessera.recovery.Recovery in project tessera by ConsenSys.
the class RecoveryImplTest method testRecoverSuccess.
@Test
public void testRecoverSuccess() {
final Recovery spy = spy(recovery);
doReturn(RecoveryResult.SUCCESS).when(spy).request();
doReturn(RecoveryResult.SUCCESS).when(spy).stage();
doReturn(RecoveryResult.SUCCESS).when(spy).sync();
assertThat(spy.recover()).isEqualTo(0);
verify(spy).request();
verify(spy).stage();
verify(spy).sync();
verify(stagingEntityDAO).countAll();
verify(stagingEntityDAO).countAllAffected();
}
use of com.quorum.tessera.recovery.Recovery in project tessera by ConsenSys.
the class RecoveryImplTest method testDBTableNotExisted.
@Test
public void testDBTableNotExisted() {
final Recovery spy = spy(recovery);
when(stagingEntityDAO.countAll()).thenThrow(new PersistenceException("OUCH"));
assertThat(spy.recover()).isEqualTo(2);
verify(stagingEntityDAO).countAll();
}
use of com.quorum.tessera.recovery.Recovery in project tessera by ConsenSys.
the class RecoveryImplTest method testRecoverFailed.
@Test
public void testRecoverFailed() {
final Recovery spy = spy(recovery);
doReturn(RecoveryResult.FAILURE).when(spy).request();
doReturn(RecoveryResult.PARTIAL_SUCCESS).when(spy).stage();
doReturn(RecoveryResult.SUCCESS).when(spy).sync();
assertThat(spy.recover()).isEqualTo(2);
verify(spy).request();
verify(spy).stage();
verify(spy).sync();
verify(stagingEntityDAO).countAll();
verify(stagingEntityDAO).countAllAffected();
}
Aggregations