Search in sources :

Example 1 with MetadataInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.

the class MetadataRepositoryVertxImplTest method assertMetadataList.

private void assertMetadataList(MetadataPage expected, List<Metadata> resultList) {
    int index = 0;
    Assertions.assertEquals(expected.getData().size(), resultList.size());
    Assertions.assertEquals(3, resultList.size());
    for (Metadata metadata : resultList) {
        MetadataInfoDTO metadataDTO = expected.getData().get(index++);
        assertMetadata(metadataDTO, metadata);
    }
}
Also used : Metadata(io.nem.symbol.sdk.model.metadata.Metadata) MetadataInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO)

Example 2 with MetadataInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.

the class MetadataRepositoryVertxImplTest method createMetadataDto.

private MetadataInfoDTO createMetadataDto(String name, MetadataTypeEnum type, String targetId) {
    MetadataInfoDTO dto = new MetadataInfoDTO();
    dto.setId(name);
    Address sourceAddress = Account.generateNewAccount(networkType).getAddress();
    Address targetAddress = Account.generateNewAccount(networkType).getAddress();
    MetadataEntryDTO metadataEntry = new MetadataEntryDTO();
    metadataEntry.setVersion(1);
    metadataEntry.setCompositeHash("ompositeHash " + name);
    metadataEntry.setMetadataType(type);
    metadataEntry.setScopedMetadataKey("10");
    metadataEntry.sourceAddress(sourceAddress.encoded());
    metadataEntry.setTargetId(targetId);
    metadataEntry.setTargetAddress(targetAddress.encoded());
    metadataEntry.setValue(ConvertUtils.fromStringToHex(name + " message"));
    dto.setMetadataEntry(metadataEntry);
    return dto;
}
Also used : Address(io.nem.symbol.sdk.model.account.Address) MetadataInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO) MetadataEntryDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataEntryDTO)

Example 3 with MetadataInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.

the class MetadataRepositoryVertxImplTest method getMetadata.

@Test
public void getMetadata() throws Exception {
    MetadataInfoDTO metadataDTO = getMetadataEntriesDTO().getData().get(0);
    mockRemoteCall(metadataDTO);
    Metadata metadata = repository.getMetadata("abc").toFuture().get();
    assertMetadata(metadataDTO, metadata);
}
Also used : Metadata(io.nem.symbol.sdk.model.metadata.Metadata) MetadataInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO) Test(org.junit.jupiter.api.Test)

Example 4 with MetadataInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.

the class MetadataRepositoryVertxImplTest method getMetadataEntriesDTO.

private MetadataPage getMetadataEntriesDTO() {
    MetadataPage metadataPage = new MetadataPage();
    metadataPage.setPagination(new Pagination().pageNumber(1).pageSize(2));
    List<MetadataInfoDTO> data = new ArrayList<>();
    data.add(createMetadataDto(ConvertUtils.toSize16Hex(BigInteger.valueOf(10)), MetadataTypeEnum.NUMBER_0, null));
    data.add(createMetadataDto(ConvertUtils.toSize16Hex(BigInteger.valueOf(20)), MetadataTypeEnum.NUMBER_1, "11111"));
    data.add(createMetadataDto(ConvertUtils.toSize16Hex(BigInteger.valueOf(30)), MetadataTypeEnum.NUMBER_2, "22222"));
    metadataPage.setData(data);
    return metadataPage;
}
Also used : MetadataPage(io.nem.symbol.sdk.openapi.vertx.model.MetadataPage) Pagination(io.nem.symbol.sdk.openapi.vertx.model.Pagination) ArrayList(java.util.ArrayList) MetadataInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO)

Aggregations

MetadataInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO)4 Metadata (io.nem.symbol.sdk.model.metadata.Metadata)2 Address (io.nem.symbol.sdk.model.account.Address)1 MetadataEntryDTO (io.nem.symbol.sdk.openapi.vertx.model.MetadataEntryDTO)1 MetadataPage (io.nem.symbol.sdk.openapi.vertx.model.MetadataPage)1 Pagination (io.nem.symbol.sdk.openapi.vertx.model.Pagination)1 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1