use of io.nem.symbol.sdk.openapi.vertx.model.MosaicDTO in project nem2-sdk-java by nemtech.
the class MosaicRepositoryVertxImplTest method shouldGetMosaicsFromAccount.
@Test
public void shouldGetMosaicsFromAccount() throws Exception {
Address address = Address.generateRandom(this.networkType);
PublicAccount publicAccount = Account.generateNewAccount(networkType).getPublicAccount();
MosaicId mosaicId = MapperUtils.toMosaicId("481110499AAA");
MosaicDTO mosaicDto = new MosaicDTO();
mosaicDto.setOwnerAddress(address.encoded());
mosaicDto.setId("481110499AAA");
mosaicDto.setRevision(123L);
mosaicDto.setFlags(5);
mosaicDto.setDivisibility(6);
mosaicDto.setVersion(1);
mosaicDto.setDuration(BigInteger.valueOf(7));
mosaicDto.supply(BigInteger.valueOf(1000));
mosaicDto.startHeight(BigInteger.valueOf(100));
mockRemoteCall(toPage(new MosaicInfoDTO().mosaic(mosaicDto).id("ABC")));
List<MosaicInfo> resolvedList = repository.search(new MosaicSearchCriteria().ownerAddress(publicAccount.getAddress())).toFuture().get().getData();
Assertions.assertEquals(1, resolvedList.size());
MosaicInfo mosaicInfo = resolvedList.get(0);
Assertions.assertEquals(mosaicId, mosaicInfo.getMosaicId());
Assertions.assertEquals(mosaicDto.getRevision(), mosaicInfo.getRevision());
Assertions.assertEquals(mosaicDto.getOwnerAddress(), mosaicInfo.getOwnerAddress().encoded(NetworkType.MIJIN_TEST));
Assertions.assertFalse(mosaicInfo.isTransferable());
Assertions.assertEquals(6, mosaicInfo.getDivisibility());
Assertions.assertEquals(BigInteger.valueOf(7), mosaicInfo.getDuration());
Assertions.assertEquals(mosaicDto.getStartHeight(), mosaicInfo.getStartHeight());
Assertions.assertEquals(mosaicDto.getSupply(), mosaicInfo.getSupply());
}
use of io.nem.symbol.sdk.openapi.vertx.model.MosaicDTO in project nem2-sdk-java by nemtech.
the class MosaicRepositoryVertxImplTest method shouldGetMosaic.
@Test
public void shouldGetMosaic() throws Exception {
Address address = Address.generateRandom(this.networkType);
MosaicId mosaicId = MapperUtils.toMosaicId("481110499");
MosaicDTO mosaicDto = new MosaicDTO();
MosaicInfoDTO mosaicInfoDto = new MosaicInfoDTO();
mosaicDto.setOwnerAddress(address.encoded());
mosaicDto.setId("481110499");
mosaicDto.setRevision(123L);
mosaicDto.setVersion(1);
mosaicDto.setFlags(5);
mosaicDto.setDivisibility(6);
mosaicDto.setDuration(BigInteger.valueOf(7));
mosaicDto.supply(BigInteger.valueOf(1000));
mosaicDto.startHeight(BigInteger.valueOf(100));
mosaicInfoDto.setMosaic(mosaicDto);
mockRemoteCall(mosaicInfoDto);
MosaicInfo mosaicInfo = repository.getMosaic(mosaicId).toFuture().get();
Assertions.assertEquals(mosaicId, mosaicInfo.getMosaicId());
Assertions.assertEquals(mosaicDto.getRevision(), mosaicInfo.getRevision());
Assertions.assertEquals(mosaicDto.getOwnerAddress(), mosaicInfo.getOwnerAddress().encoded(networkType));
Assertions.assertFalse(mosaicInfo.isTransferable());
Assertions.assertEquals(6, mosaicInfo.getDivisibility());
Assertions.assertEquals(BigInteger.valueOf(7), mosaicInfo.getDuration());
Assertions.assertEquals(mosaicDto.getStartHeight(), mosaicInfo.getStartHeight());
Assertions.assertEquals(mosaicDto.getSupply(), mosaicInfo.getSupply());
}
use of io.nem.symbol.sdk.openapi.vertx.model.MosaicDTO in project nem2-sdk-java by nemtech.
the class MosaicRepositoryVertxImplTest method shouldGetMosaics.
@Test
public void shouldGetMosaics() throws Exception {
Address address = Address.generateRandom(this.networkType);
MosaicId mosaicId = MapperUtils.toMosaicId("481110499AAA");
MosaicDTO mosaicDto = new MosaicDTO();
MosaicInfoDTO mosaicInfoDto = new MosaicInfoDTO();
mosaicDto.setOwnerAddress(address.encoded());
mosaicDto.setId("481110499AAA");
mosaicDto.setRevision(123L);
mosaicDto.setFlags(5);
mosaicDto.setVersion(1);
mosaicDto.setDivisibility(6);
mosaicDto.setDuration(BigInteger.valueOf(7));
mosaicDto.supply(BigInteger.valueOf(1000));
mosaicDto.startHeight(BigInteger.valueOf(100));
mosaicInfoDto.setMosaic(mosaicDto);
mockRemoteCall(Collections.singletonList(mosaicInfoDto));
List<MosaicInfo> resolvedList = repository.getMosaics(Collections.singletonList(mosaicId)).toFuture().get();
Assertions.assertEquals(1, resolvedList.size());
MosaicInfo mosaicInfo = resolvedList.get(0);
Assertions.assertEquals(mosaicId, mosaicInfo.getMosaicId());
Assertions.assertEquals(mosaicDto.getRevision(), mosaicInfo.getRevision());
Assertions.assertEquals(mosaicDto.getOwnerAddress(), mosaicInfo.getOwnerAddress().encoded(networkType));
Assertions.assertFalse(mosaicInfo.isTransferable());
Assertions.assertEquals(6, mosaicInfo.getDivisibility());
Assertions.assertEquals(BigInteger.valueOf(7), mosaicInfo.getDuration());
Assertions.assertEquals(mosaicDto.getStartHeight(), mosaicInfo.getStartHeight());
Assertions.assertEquals(mosaicDto.getSupply(), mosaicInfo.getSupply());
}
Aggregations