Search in sources :

Example 6 with PayloadPublisher

use of com.quorum.tessera.transaction.publish.PayloadPublisher 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();
    }
}
Also used : PayloadPublisher(com.quorum.tessera.transaction.publish.PayloadPublisher) Enclave(com.quorum.tessera.enclave.Enclave) Discovery(com.quorum.tessera.discovery.Discovery) LegacyResendManager(com.quorum.tessera.recovery.workflow.LegacyResendManager) EncryptedTransactionDAO(com.quorum.tessera.data.EncryptedTransactionDAO) Test(org.junit.Test)

Example 7 with PayloadPublisher

use of com.quorum.tessera.transaction.publish.PayloadPublisher in project tessera by ConsenSys.

the class PayloadPublisherProviderTest method provider.

@Test
public void provider() {
    ConfigFactory configFactory = mock(ConfigFactory.class);
    Config config = mock(Config.class);
    ServerConfig serverConfig = mock(ServerConfig.class);
    when(config.getP2PServerConfig()).thenReturn(serverConfig);
    when(configFactory.getConfig()).thenReturn(config);
    try (var configFactoryMockedStatic = mockStatic(ConfigFactory.class);
        var discoveryMockedStatic = mockStatic(Discovery.class)) {
        configFactoryMockedStatic.when(ConfigFactory::create).thenReturn(configFactory);
        discoveryMockedStatic.when(Discovery::create).thenReturn(mock(Discovery.class));
        PayloadPublisher payloadPublisher = PayloadPublisherProvider.provider();
        assertThat(payloadPublisher).isNotNull();
        configFactoryMockedStatic.verify(ConfigFactory::create);
        configFactoryMockedStatic.verifyNoMoreInteractions();
        discoveryMockedStatic.verify(Discovery::create);
        discoveryMockedStatic.verifyNoMoreInteractions();
    }
}
Also used : ServerConfig(com.quorum.tessera.config.ServerConfig) PayloadPublisher(com.quorum.tessera.transaction.publish.PayloadPublisher) Config(com.quorum.tessera.config.Config) ServerConfig(com.quorum.tessera.config.ServerConfig) Discovery(com.quorum.tessera.discovery.Discovery) ConfigFactory(com.quorum.tessera.config.ConfigFactory) Test(org.junit.Test)

Aggregations

PayloadPublisher (com.quorum.tessera.transaction.publish.PayloadPublisher)7 EncryptedTransactionDAO (com.quorum.tessera.data.EncryptedTransactionDAO)4 Enclave (com.quorum.tessera.enclave.Enclave)4 BatchPayloadPublisher (com.quorum.tessera.transaction.publish.BatchPayloadPublisher)4 Test (org.junit.Test)4 Discovery (com.quorum.tessera.discovery.Discovery)3 Config (com.quorum.tessera.config.Config)2 ConfigFactory (com.quorum.tessera.config.ConfigFactory)2 EncryptedRawTransactionDAO (com.quorum.tessera.data.EncryptedRawTransactionDAO)2 PayloadDigest (com.quorum.tessera.enclave.PayloadDigest)2 PrivacyHelper (com.quorum.tessera.transaction.PrivacyHelper)2 ResendManager (com.quorum.tessera.transaction.resend.ResendManager)2 ServerConfig (com.quorum.tessera.config.ServerConfig)1 LegacyResendManager (com.quorum.tessera.recovery.workflow.LegacyResendManager)1 CancellableCountDownLatchFactory (com.quorum.tessera.threading.CancellableCountDownLatchFactory)1 ExecutorFactory (com.quorum.tessera.threading.ExecutorFactory)1 TransactionManager (com.quorum.tessera.transaction.TransactionManager)1