Search in sources :

Example 1 with StubAsyncRunner

use of tech.pegasys.teku.infrastructure.async.StubAsyncRunner in project teku by ConsenSys.

the class BeaconRestApiV1Test method setup.

@BeforeEach
public void setup() {
    final Eth1Address depositContractAddress = new Eth1Address(Bytes.fromHexString("0xdddddddddddddddddddddddddddddddddddddddd"));
    BeaconRestApiConfig beaconRestApiConfig = BeaconRestApiConfig.builder().restApiDocsEnabled(false).eth1DepositContractAddress(depositContractAddress).restApiPort(THE_PORT).build();
    when(app.jettyServer()).thenReturn(server);
    final DataProvider dataProvider = DataProvider.builder().spec(TestSpecFactory.createMinimalPhase0()).recentChainData(storageClient).combinedChainDataClient(combinedChainDataClient).p2pNetwork(null).syncService(syncService).validatorApiChannel(null).blockManager(blockManager).attestationManager(attestationManager).isLivenessTrackingEnabled(false).activeValidatorChannel(activeValidatorChannel).attestationPool(attestationPool).attesterSlashingPool(attesterSlashingPool).proposerSlashingPool(proposerSlashingPool).voluntaryExitPool(voluntaryExitPool).syncCommitteeContributionPool(syncCommitteeContributionPool).build();
    new BeaconRestApi(dataProvider, beaconRestApiConfig, eventChannels, new StubAsyncRunner(), app);
}
Also used : DataProvider(tech.pegasys.teku.api.DataProvider) StubAsyncRunner(tech.pegasys.teku.infrastructure.async.StubAsyncRunner) Eth1Address(tech.pegasys.teku.spec.datastructures.eth1.Eth1Address) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with StubAsyncRunner

use of tech.pegasys.teku.infrastructure.async.StubAsyncRunner in project teku by ConsenSys.

the class BeaconRestApiTest method setup.

@BeforeEach
public void setup() {
    BeaconRestApiConfig beaconRestApiConfig = BeaconRestApiConfig.builder().restApiDocsEnabled(false).restApiPort(THE_PORT).eth1DepositContractAddress(Eth1Address.ZERO).build();
    when(app.jettyServer()).thenReturn(server);
    final DataProvider dataProvider = DataProvider.builder().spec(TestSpecFactory.createMinimalPhase0()).recentChainData(storageClient).combinedChainDataClient(combinedChainDataClient).p2pNetwork(null).syncService(syncService).validatorApiChannel(null).blockManager(blockManager).attestationManager(attestationManager).isLivenessTrackingEnabled(false).activeValidatorChannel(activeValidatorChannel).attestationPool(attestationPool).attesterSlashingPool(attesterSlashingPool).proposerSlashingPool(proposerSlashingPool).voluntaryExitPool(voluntaryExitPool).syncCommitteeContributionPool(syncCommitteeContributionPool).build();
    new BeaconRestApi(dataProvider, beaconRestApiConfig, eventChannels, new StubAsyncRunner(), app);
}
Also used : DataProvider(tech.pegasys.teku.api.DataProvider) StubAsyncRunner(tech.pegasys.teku.infrastructure.async.StubAsyncRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with StubAsyncRunner

use of tech.pegasys.teku.infrastructure.async.StubAsyncRunner in project teku by ConsenSys.

the class FallbackAwareEth1ProviderSelectorTest method shouldWaitUntilProviderSelectorHasBeenNotified.

@Test
void shouldWaitUntilProviderSelectorHasBeenNotified() throws ExecutionException, InterruptedException {
    asyncRunner = new StubAsyncRunner();
    providerSelector = new Eth1ProviderSelector(providers);
    fallbackAwareEth1Provider = new FallbackAwareEth1Provider(providerSelector, asyncRunner);
    when(node1.isValid()).thenReturn(true);
    when(node1.ethSyncing()).thenReturn(SafeFuture.completedFuture(true));
    final SafeFuture<Boolean> ethSyncing = fallbackAwareEth1Provider.ethSyncing();
    providerSelector.notifyValidationCompletion();
    assertThat(ethSyncing.get()).isTrue();
}
Also used : StubAsyncRunner(tech.pegasys.teku.infrastructure.async.StubAsyncRunner) Test(org.junit.jupiter.api.Test)

Example 4 with StubAsyncRunner

use of tech.pegasys.teku.infrastructure.async.StubAsyncRunner in project teku by ConsenSys.

the class SlashingProtectionLoggerTest method beforeEach.

@BeforeEach
public void beforeEach() throws Exception {
    when(slashingProtector.getSigningRecord(any())).thenReturn(Optional.empty());
    this.asyncRunner = new StubAsyncRunner();
    this.validatorLogger = mock(ValidatorLogger.class);
    this.slashingProtectionLogger = new SlashingProtectionLogger(slashingProtector, spec, asyncRunner, validatorLogger);
    this.slashingProtectionLogger.onSlot(UInt64.ONE);
}
Also used : ValidatorLogger(tech.pegasys.teku.infrastructure.logging.ValidatorLogger) StubAsyncRunner(tech.pegasys.teku.infrastructure.async.StubAsyncRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with StubAsyncRunner

use of tech.pegasys.teku.infrastructure.async.StubAsyncRunner in project teku by ConsenSys.

the class Web3jEth1ProviderTest method setup.

@BeforeEach
void setup() {
    asyncRunner = new StubAsyncRunner();
    timeProvider = StubTimeProvider.withTimeInSeconds(1000);
    provider = new Web3jEth1Provider(spec.getGenesisSpecConfig(), new StubMetricsSystem(), Eth1Provider.generateEth1ProviderId(0, "https://eth.test.org:1234/test"), web3, asyncRunner, timeProvider);
}
Also used : StubMetricsSystem(tech.pegasys.teku.infrastructure.metrics.StubMetricsSystem) StubAsyncRunner(tech.pegasys.teku.infrastructure.async.StubAsyncRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

StubAsyncRunner (tech.pegasys.teku.infrastructure.async.StubAsyncRunner)6 BeforeEach (org.junit.jupiter.api.BeforeEach)5 DataProvider (tech.pegasys.teku.api.DataProvider)2 Test (org.junit.jupiter.api.Test)1 ValidatorLogger (tech.pegasys.teku.infrastructure.logging.ValidatorLogger)1 StubMetricsSystem (tech.pegasys.teku.infrastructure.metrics.StubMetricsSystem)1 Eth1Address (tech.pegasys.teku.spec.datastructures.eth1.Eth1Address)1