Search in sources :

Example 1 with FinalizationProof

use of io.nem.symbol.sdk.model.finalization.FinalizationProof in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryOkHttpImplTest method getFinalizationProofAtEpoch.

@Test
public void getFinalizationProofAtEpoch() throws Exception {
    FinalizationProofDTO dto = createFinalizationProofDTO();
    mockRemoteCall(dto);
    FinalizationProof finalizationProof = repository.getFinalizationProofAtEpoch(123).toFuture().get();
    validate(finalizationProof, dto);
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) FinalizationProofDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.FinalizationProofDTO) Test(org.junit.jupiter.api.Test)

Example 2 with FinalizationProof

use of io.nem.symbol.sdk.model.finalization.FinalizationProof 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 3 with FinalizationProof

use of io.nem.symbol.sdk.model.finalization.FinalizationProof in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryVertxImplTest method getFinalizationProofAtHeight.

@Test
public void getFinalizationProofAtHeight() throws Exception {
    FinalizationProofDTO dto = createFinalizationProofDTO();
    mockRemoteCall(dto);
    FinalizationProof finalizationProof = repository.getFinalizationProofAtHeight(BigInteger.valueOf(123)).toFuture().get();
    validate(finalizationProof, dto);
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) FinalizationProofDTO(io.nem.symbol.sdk.openapi.vertx.model.FinalizationProofDTO) Test(org.junit.jupiter.api.Test)

Example 4 with FinalizationProof

use of io.nem.symbol.sdk.model.finalization.FinalizationProof in project nem2-sdk-java by nemtech.

the class FinalizationRepositoryOkHttpImplTest method getFinalizationProofAtHeight.

@Test
public void getFinalizationProofAtHeight() throws Exception {
    FinalizationProofDTO dto = createFinalizationProofDTO();
    mockRemoteCall(dto);
    FinalizationProof finalizationProof = repository.getFinalizationProofAtHeight(BigInteger.valueOf(123)).toFuture().get();
    validate(finalizationProof, dto);
}
Also used : FinalizationProof(io.nem.symbol.sdk.model.finalization.FinalizationProof) FinalizationProofDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.FinalizationProofDTO) Test(org.junit.jupiter.api.Test)

Example 5 with FinalizationProof

use of io.nem.symbol.sdk.model.finalization.FinalizationProof 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)

Aggregations

FinalizationProof (io.nem.symbol.sdk.model.finalization.FinalizationProof)8 FinalizationRepository (io.nem.symbol.sdk.api.FinalizationRepository)4 Test (org.junit.jupiter.api.Test)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 FinalizationProofDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.FinalizationProofDTO)2 FinalizationProofDTO (io.nem.symbol.sdk.openapi.vertx.model.FinalizationProofDTO)2