use of io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.
the class MetadataRepositoryOkHttpImplTest 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;
}
use of io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.
the class MetadataRepositoryOkHttpImplTest 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);
}
use of io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.
the class MetadataRepositoryOkHttpImplTest 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;
}
use of io.nem.symbol.sdk.openapi.okhttp_gson.model.MetadataInfoDTO in project nem2-sdk-java by nemtech.
the class MetadataRepositoryOkHttpImplTest 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);
}
}
Aggregations