use of io.nem.symbol.sdk.model.mosaic.MosaicInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchByOwnerAddressInvalid.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByOwnerAddressInvalid(RepositoryType type) {
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
Address address = Account.generateNewAccount(getNetworkType()).getAddress();
criteria.ownerAddress(address);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(getMosaicRepository(type));
List<MosaicInfo> mosaics = get(streamer.search(criteria).toList().toObservable());
Assertions.assertTrue(mosaics.isEmpty());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method getMosaicViaMosaicId.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMosaicViaMosaicId(RepositoryType type) {
MosaicInfo mosaicInfo = get(getMosaicRepository(type).getMosaic(mosaicId));
assertEquals(mosaicId, mosaicInfo.getMosaicId());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchByOwnerAddress.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByOwnerAddress(RepositoryType type) {
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
Address address = testAccount.getAddress();
criteria.ownerAddress(address);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(getMosaicRepository(type));
List<MosaicInfo> mosaics = get(streamer.search(criteria).toList().toObservable());
mosaics.forEach(m -> Assertions.assertEquals(address, m.getOwnerAddress()));
Assertions.assertFalse(mosaics.isEmpty());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryOkHttpImplTest method shouldGetMosaic.
@Test
public void shouldGetMosaic() throws Exception {
MosaicId mosaicId = MapperUtils.toMosaicId("481110499AAA");
Address ownerAddress = Account.generateNewAccount(networkType).getAddress();
MosaicDTO mosaicDto = new MosaicDTO();
MosaicInfoDTO mosaicInfoDto = new MosaicInfoDTO();
mosaicDto.setOwnerAddress(ownerAddress.encoded());
mosaicDto.setId("481110499AAA");
mosaicDto.setRevision(123L);
mosaicDto.setFlags(5);
mosaicDto.setDivisibility(6);
mosaicDto.setDuration(BigInteger.valueOf(7));
mosaicDto.supply(BigInteger.valueOf(1000));
mosaicDto.startHeight(BigInteger.valueOf(100));
mosaicDto.setVersion(1);
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.model.mosaic.MosaicInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryOkHttpImplTest method shouldGetMosaics.
@Test
public void shouldGetMosaics() throws Exception {
MosaicId mosaicId = MapperUtils.toMosaicId("481110499AAA");
Address ownerAddress = Account.generateNewAccount(networkType).getAddress();
MosaicDTO mosaicDto = new MosaicDTO();
MosaicInfoDTO mosaicInfoDto = new MosaicInfoDTO();
mosaicDto.setOwnerAddress(ownerAddress.encoded());
mosaicDto.setId("481110499AAA");
mosaicDto.setRevision(123L);
mosaicDto.setFlags(5);
mosaicDto.setDivisibility(6);
mosaicDto.setDuration(BigInteger.valueOf(7));
mosaicDto.supply(BigInteger.valueOf(1000));
mosaicDto.startHeight(BigInteger.valueOf(100));
mosaicDto.setVersion(1);
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