Search in sources :

Example 1 with FinalizationRepository

use of io.nem.symbol.sdk.api.FinalizationRepository in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtHeight.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtHeight(RepositoryType type) {
    FinalizationRepository repository = getRepositoryFactory(type).createFinalizationRepository();
    FinalizationProof finalizationProof = get(repository.getFinalizationProofAtHeight(BigInteger.ONE));
    Assertions.assertEquals(1L, finalizationProof.getFinalizationEpoch());
    Assertions.assertEquals(1L, finalizationProof.getFinalizationPoint());
    Assertions.assertEquals(BigInteger.ONE, finalizationProof.getHeight());
    Assertions.assertEquals(1, finalizationProof.getVersion());
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) FinalizationRepository(io.nem.symbol.sdk.api.FinalizationRepository) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with FinalizationRepository

use of io.nem.symbol.sdk.api.FinalizationRepository in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtCurrentFinalizedHeight.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtCurrentFinalizedHeight(RepositoryType type) {
    RepositoryFactory repositoryFactory = getRepositoryFactory(type);
    FinalizedBlock finalizedBlock = get(repositoryFactory.createChainRepository().getChainInfo()).getLatestFinalizedBlock();
    FinalizationRepository repository = repositoryFactory.createFinalizationRepository();
    FinalizationProof finalizationProof = get(repository.getFinalizationProofAtHeight(finalizedBlock.getHeight()));
    Assertions.assertEquals(finalizationProof.getFinalizationEpoch(), finalizationProof.getFinalizationEpoch());
    Assertions.assertEquals(finalizationProof.getFinalizationPoint(), finalizationProof.getFinalizationPoint());
    Assertions.assertEquals(finalizationProof.getHeight(), finalizationProof.getHeight());
    Assertions.assertEquals(1, finalizationProof.getVersion());
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) FinalizedBlock(io.nem.symbol.sdk.model.blockchain.FinalizedBlock) FinalizationRepository(io.nem.symbol.sdk.api.FinalizationRepository) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with FinalizationRepository

use of io.nem.symbol.sdk.api.FinalizationRepository in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtEpochLatest.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtEpochLatest(RepositoryType type) {
    RepositoryFactory repositoryFactory = getRepositoryFactory(type);
    FinalizedBlock finalizedBlock = get(repositoryFactory.createChainRepository().getChainInfo()).getLatestFinalizedBlock();
    FinalizationRepository repository = repositoryFactory.createFinalizationRepository();
    FinalizationProof finalizationProof = get(repository.getFinalizationProofAtEpoch(finalizedBlock.getFinalizationEpoch()));
    Assertions.assertEquals(finalizationProof.getFinalizationEpoch(), finalizationProof.getFinalizationEpoch());
    Assertions.assertEquals(finalizationProof.getFinalizationPoint(), finalizationProof.getFinalizationPoint());
    Assertions.assertEquals(finalizationProof.getHeight(), finalizationProof.getHeight());
    Assertions.assertEquals(1, finalizationProof.getVersion());
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) FinalizedBlock(io.nem.symbol.sdk.model.blockchain.FinalizedBlock) FinalizationRepository(io.nem.symbol.sdk.api.FinalizationRepository) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with FinalizationRepository

use of io.nem.symbol.sdk.api.FinalizationRepository in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtEpoch.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtEpoch(RepositoryType type) {
    FinalizationRepository repository = getRepositoryFactory(type).createFinalizationRepository();
    FinalizationProof finalizationProof = get(repository.getFinalizationProofAtEpoch(1));
    Assertions.assertEquals(1L, finalizationProof.getFinalizationEpoch());
    Assertions.assertEquals(1L, finalizationProof.getFinalizationPoint());
    Assertions.assertEquals(BigInteger.ONE, finalizationProof.getHeight());
    Assertions.assertEquals(1, finalizationProof.getVersion());
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) FinalizationRepository(io.nem.symbol.sdk.api.FinalizationRepository) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

FinalizationRepository (io.nem.symbol.sdk.api.FinalizationRepository)4 FinalizationProof (io.nem.symbol.sdk.model.finalization.FinalizationProof)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 EnumSource (org.junit.jupiter.params.provider.EnumSource)4 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)2 FinalizedBlock (io.nem.symbol.sdk.model.blockchain.FinalizedBlock)2