Search in sources :

Example 1 with BatchTransactionRequester

use of com.quorum.tessera.recovery.resend.BatchTransactionRequester in project tessera by ConsenSys.

the class BatchTransactionRequesterProviderTest method provider.

@Test
public void provider() {
    try (var enclaveMockedStatic = mockStatic(Enclave.class);
        var recoveryClientMockedStatic = mockStatic(RecoveryClient.class)) {
        enclaveMockedStatic.when(Enclave::create).thenReturn(mock(Enclave.class));
        recoveryClientMockedStatic.when(RecoveryClient::create).thenReturn(mock(RecoveryClient.class));
        BatchTransactionRequester batchTransactionRequester = BatchTransactionRequesterProvider.provider();
        assertThat(batchTransactionRequester).isNotNull().isExactlyInstanceOf(RestBatchTransactionRequester.class);
        enclaveMockedStatic.verify(Enclave::create);
        recoveryClientMockedStatic.verify(RecoveryClient::create);
    }
}
Also used : Enclave(com.quorum.tessera.enclave.Enclave) BatchTransactionRequester(com.quorum.tessera.recovery.resend.BatchTransactionRequester) Test(org.junit.Test)

Example 2 with BatchTransactionRequester

use of com.quorum.tessera.recovery.resend.BatchTransactionRequester in project tessera by ConsenSys.

the class RecoveryProviderTest method provider.

@Test
public void provider() {
    try (var staticStagingEntityDAO = mockStatic(StagingEntityDAO.class);
        var staticDiscovery = mockStatic(Discovery.class);
        var staticBatchTransactionRequester = mockStatic(BatchTransactionRequester.class);
        var staticTransactionManager = mockStatic(TransactionManager.class)) {
        staticStagingEntityDAO.when(StagingEntityDAO::create).thenReturn(mock(StagingEntityDAO.class));
        staticDiscovery.when(Discovery::create).thenReturn(mock(Discovery.class));
        staticBatchTransactionRequester.when(BatchTransactionRequester::create).thenReturn(mock(BatchTransactionRequester.class));
        TransactionManager transactionManager = mock(TransactionManager.class);
        staticTransactionManager.when(TransactionManager::create).thenReturn(transactionManager);
        Recovery recovery = RecoveryProvider.provider();
        assertThat(recovery).isNotNull().isExactlyInstanceOf(RecoveryImpl.class);
        staticStagingEntityDAO.verify(StagingEntityDAO::create);
        staticStagingEntityDAO.verifyNoMoreInteractions();
        verifyNoMoreInteractions(transactionManager);
        staticDiscovery.verify(Discovery::create);
        staticDiscovery.verifyNoMoreInteractions();
        staticBatchTransactionRequester.verify(BatchTransactionRequester::create);
        staticBatchTransactionRequester.verifyNoMoreInteractions();
        staticTransactionManager.verify(TransactionManager::create);
        staticTransactionManager.verifyNoMoreInteractions();
    }
}
Also used : BatchTransactionRequester(com.quorum.tessera.recovery.resend.BatchTransactionRequester) TransactionManager(com.quorum.tessera.transaction.TransactionManager) StagingEntityDAO(com.quorum.tessera.data.staging.StagingEntityDAO) Discovery(com.quorum.tessera.discovery.Discovery) Recovery(com.quorum.tessera.recovery.Recovery) Test(org.junit.Test)

Example 3 with BatchTransactionRequester

use of com.quorum.tessera.recovery.resend.BatchTransactionRequester in project tessera by ConsenSys.

the class RecoveryProvider method provider.

public static Recovery provider() {
    StagingEntityDAO stagingEntityDAO = StagingEntityDAO.create();
    Discovery discovery = Discovery.create();
    BatchTransactionRequester batchTransactionRequester = BatchTransactionRequester.create();
    TransactionManager transactionManager = TransactionManager.create();
    return new RecoveryImpl(stagingEntityDAO, discovery, batchTransactionRequester, transactionManager);
}
Also used : BatchTransactionRequester(com.quorum.tessera.recovery.resend.BatchTransactionRequester) TransactionManager(com.quorum.tessera.transaction.TransactionManager) StagingEntityDAO(com.quorum.tessera.data.staging.StagingEntityDAO) Discovery(com.quorum.tessera.discovery.Discovery)

Aggregations

BatchTransactionRequester (com.quorum.tessera.recovery.resend.BatchTransactionRequester)3 StagingEntityDAO (com.quorum.tessera.data.staging.StagingEntityDAO)2 Discovery (com.quorum.tessera.discovery.Discovery)2 TransactionManager (com.quorum.tessera.transaction.TransactionManager)2 Test (org.junit.Test)2 Enclave (com.quorum.tessera.enclave.Enclave)1 Recovery (com.quorum.tessera.recovery.Recovery)1