use of com.quorum.tessera.recovery.workflow.LegacyResendManager in project tessera by ConsenSys.
the class LegacyResendManagerProviderTest method provider.
@Test
public void provider() {
try (var enclaveMockedStatic = mockStatic(Enclave.class);
var encryptedTransactionDAOMockedStatic = mockStatic(EncryptedTransactionDAO.class);
var payloadPublisherMockedStatic = mockStatic(PayloadPublisher.class);
var discoveryMockedStatic = mockStatic(Discovery.class)) {
enclaveMockedStatic.when(Enclave::create).thenReturn(mock(Enclave.class));
encryptedTransactionDAOMockedStatic.when(EncryptedTransactionDAO::create).thenReturn(mock(EncryptedTransactionDAO.class));
payloadPublisherMockedStatic.when(PayloadPublisher::create).thenReturn(mock(PayloadPublisher.class));
discoveryMockedStatic.when(Discovery::create).thenReturn(mock(Discovery.class));
LegacyResendManager legacyResendManager = LegacyResendManagerProvider.provider();
assertThat(legacyResendManager).isNotNull();
enclaveMockedStatic.verify(Enclave::create);
enclaveMockedStatic.verifyNoMoreInteractions();
encryptedTransactionDAOMockedStatic.verify(EncryptedTransactionDAO::create);
encryptedTransactionDAOMockedStatic.verifyNoMoreInteractions();
payloadPublisherMockedStatic.verify(PayloadPublisher::create);
discoveryMockedStatic.verify(Discovery::create);
discoveryMockedStatic.verifyNoMoreInteractions();
}
}
use of com.quorum.tessera.recovery.workflow.LegacyResendManager in project tessera by ConsenSys.
the class P2PRestApp method getSingletons.
@Override
public Set<Object> getSingletons() {
RuntimeContext runtimeContext = RuntimeContext.getInstance();
List<URI> peers = runtimeContext.getPeers();
LOGGER.debug("Found configured peers {}", peers);
peers.stream().map(NodeUri::create).map(NodeUri::asURI).peek(u -> LOGGER.debug("Adding {} to party store", u)).forEach(partyStore::store);
final PartyInfoResource partyInfoResource = new PartyInfoResource(discovery, partyInfoParser, runtimeContext.getP2pClient(), enclave, runtimeContext.isRemoteKeyValidation());
final IPWhitelistFilter iPWhitelistFilter = new IPWhitelistFilter();
final TransactionResource transactionResource = new TransactionResource(transactionManager, batchResendManager, legacyResendManager);
final UpCheckResource upCheckResource = new UpCheckResource();
final PrivacyGroupResource privacyGroupResource = new PrivacyGroupResource(privacyGroupManager);
if (runtimeContext.isRecoveryMode()) {
final RecoveryResource recoveryResource = new RecoveryResource(transactionManager, batchResendManager);
return Set.of(partyInfoResource, iPWhitelistFilter, recoveryResource, upCheckResource);
}
return Set.of(partyInfoResource, iPWhitelistFilter, transactionResource, privacyGroupResource, upCheckResource);
}
use of com.quorum.tessera.recovery.workflow.LegacyResendManager in project tessera by ConsenSys.
the class P2PRestAppTest method setUp.
@Before
public void setUp() {
runtimeContext = mock(RuntimeContext.class);
enclave = mock(Enclave.class);
discovery = mock(Discovery.class);
partyStore = mock(PartyStore.class);
transactionManager = mock(TransactionManager.class);
batchResendManager = mock(BatchResendManager.class);
legacyResendManager = mock(LegacyResendManager.class);
privacyGroupManager = mock(PrivacyGroupManager.class);
p2PRestApp = new P2PRestApp(discovery, enclave, partyStore, transactionManager, batchResendManager, legacyResendManager, privacyGroupManager);
Client client = mock(Client.class);
when(runtimeContext.getP2pClient()).thenReturn(client);
when(runtimeContext.isRemoteKeyValidation()).thenReturn(true);
when(runtimeContext.getPeers()).thenReturn(List.of(peerUri));
}
Aggregations