use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method searchBySignerPublicKeyWhenInvalid.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchBySignerPublicKeyWhenInvalid(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
BlockSearchCriteria criteria = new BlockSearchCriteria();
PublicKey expectedSignerPublicKey = PublicKey.generateRandom();
criteria.setSignerPublicKey(expectedSignerPublicKey);
BlockPaginationStreamer streamer = new BlockPaginationStreamer(blockRepository);
List<BlockInfo> blocks = get(streamer.search(criteria).toList().toObservable());
Assertions.assertTrue(blocks.isEmpty());
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromTransactions(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
PaginationStreamer<TransactionStatement, TransactionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.transactions(receiptRepository);
List<TransactionStatement> list = get(streamer.search(new TransactionStatementSearchCriteria()).take(5).toList().toObservable());
System.out.println(list.size());
list.forEach(s -> {
String hash = s.generateHash();
System.out.println(hash);
System.out.println(s.getHeight());
MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleReceipts(s.getHeight(), hash));
System.out.println(toJson(merkleProofInfo));
});
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method searchByBeneficiaryAddress.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByBeneficiaryAddress(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
BlockInfo block1 = get(blockRepository.getBlockByHeight(BigInteger.ONE));
BlockSearchCriteria criteria = new BlockSearchCriteria();
Address expectedBeneficiaryAddress = block1.getBeneficiaryAddress();
criteria.setBeneficiaryAddress(expectedBeneficiaryAddress);
BlockPaginationStreamer streamer = new BlockPaginationStreamer(blockRepository);
List<BlockInfo> blocks = get(streamer.search(criteria).toList().toObservable());
blocks.forEach(b -> Assertions.assertEquals(expectedBeneficiaryAddress, b.getBeneficiaryAddress()));
Assertions.assertFalse(blocks.isEmpty());
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class ChainRepositoryIntegrationTest method getChainInfo.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getChainInfo(RepositoryType type) {
ChainInfo chainInfo = get(getChainRepository(type).getChainInfo());
assertTrue(chainInfo.getScoreLow().longValue() >= 0);
assertTrue(chainInfo.getScoreHigh().longValue() >= 0);
assertTrue(chainInfo.getHeight().longValue() > 0);
FinalizedBlock finalizedBlock = chainInfo.getLatestFinalizedBlock();
assertTrue(finalizedBlock.getFinalizationEpoch() >= 0);
assertTrue(finalizedBlock.getFinalizationPoint() >= 0);
assertTrue(finalizedBlock.getHeight().longValue() > 0);
assertNotNull(finalizedBlock.getHash());
}
use of org.junit.jupiter.params.provider.EnumSource 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());
}
Aggregations