private void testDigitalAssetMetadataVault() throws CantCreateDigitalAssetFileException, CantGetDigitalAssetFromLocalStorageException { Logger LOG = Logger.getGlobal(); LOG.info("MAP_TEST_DAMVault"); DigitalAsset digitalAsset = new DigitalAsset(); digitalAsset.setGenesisAmount(100000); digitalAsset.setDescription("TestAsset"); digitalAsset.setName("testName"); digitalAsset.setPublicKey(new ECCKeyPair().getPublicKey()); LOG.info("MAP_DigitalAsset:" + digitalAsset); List<Resource> resources = new ArrayList<>(); digitalAsset.setResources(resources); digitalAsset.setIdentityAssetIssuer(null); DigitalAssetContract digitalAssetContract = new DigitalAssetContract(); digitalAsset.setContract(digitalAssetContract); LOG.info("MAP_DigitalAsset2:" + digitalAsset); DigitalAssetMetadata dam = new DigitalAssetMetadata(digitalAsset); dam.setGenesisTransaction("testGenesisTX"); this.digitalAssetIssuingVault.persistDigitalAssetMetadataInLocalStorage(dam, "testId"); LOG.info( "DAM from vault:\n" + this.digitalAssetIssuingVault .getDigitalAssetMetadataFromLocalStorage("testGenesisTX") .toString()); }
private void testIssueMultipleFullAssets() throws CantDefineContractPropertyException, CantIssueDigitalAssetsException { LOG.info("MAP_TEST_MULTIPLE_FULL_ASSETS"); DigitalAsset digitalAsset = new DigitalAsset(); digitalAsset.setPublicKey(new ECCKeyPair().getPublicKey()); digitalAsset.setDescription("Descripcion de prueba"); digitalAsset.setGenesisAddress( new CryptoAddress("n1zVgphtAoxgDMUzKV5ATeggwvUwnssb7m", CryptoCurrency.BITCOIN)); digitalAsset.setGenesisAmount(1000); List<Resource> resources = new ArrayList<>(); Resource resource = new Resource(); resource.setId(UUID.randomUUID()); resource.setName("Foto 1"); resource.setFileName("imagen2.png"); resource.setResourceType(ResourceType.IMAGE); resource.setResourceDensity(ResourceDensity.HDPI); resource.setResourceBinayData( new byte[] {0xa, 0x2, 0xf, (byte) 0xff, (byte) 0xff, (byte) 0xff}); Resource resource2 = new Resource(); resource2.setId(UUID.randomUUID()); resource2.setName("Foto 1"); resource2.setFileName("imagen2.png"); resource2.setResourceType(ResourceType.IMAGE); resource2.setResourceDensity(ResourceDensity.HDPI); resource2.setResourceBinayData( new byte[] {0xa, 0x2, 0xf, (byte) 0xff, (byte) 0xff, (byte) 0xff}); Resource resource3 = new Resource(); resource3.setId(UUID.randomUUID()); resource3.setName("Foto 1"); resource3.setFileName("imagen2.png"); resource3.setResourceType(ResourceType.IMAGE); resource3.setResourceDensity(ResourceDensity.HDPI); resource3.setResourceBinayData( new byte[] {0xa, 0x2, 0xf, (byte) 0xff, (byte) 0xff, (byte) 0xff}); resources.add(resource); resources.add(resource2); resources.add(resource3); digitalAsset.setResources(resources); IdentityAssetIssuer identityAssetIssuer = new MockIdentityAssetIssuerForTest(); digitalAsset.setName("Asset de prueba"); digitalAsset.setIdentityAssetIssuer(identityAssetIssuer); DigitalAssetContract contract = new DigitalAssetContract(); contract.setContractProperty( new ContractProperty(DigitalAssetContractPropertiesConstants.REDEEMABLE, Boolean.TRUE)); digitalAsset.setContract(contract); System.out.println(digitalAsset.toString()); this.assetIssuingTransactionManager.issueAssets( digitalAsset, 10, "TESTING PUBLICKEY", BlockchainNetworkType.REG_TEST); LOG.info("MAP_END_TEST_MULTIPLE_FULL_ASSETS"); }
private void testIssueSingleAsset() throws CantIssueDigitalAssetsException { Logger LOG = Logger.getGlobal(); LOG.info("MAP_TEST_SINGLE"); DigitalAsset digitalAsset = new DigitalAsset(); digitalAsset.setGenesisAmount(100000); digitalAsset.setDescription("TestAsset"); digitalAsset.setName("testName"); digitalAsset.setPublicKey(new ECCKeyPair().getPublicKey()); LOG.info("MAP_DigitalAsset:" + digitalAsset); List<Resource> resources = new ArrayList<>(); digitalAsset.setResources(resources); digitalAsset.setIdentityAssetIssuer(null); DigitalAssetContract digitalAssetContract = new DigitalAssetContract(); digitalAsset.setContract(digitalAssetContract); LOG.info("MAP_DigitalAsset2:" + digitalAsset); this.issueAssets( digitalAsset, 1, new ECCKeyPair().getPublicKey(), BlockchainNetworkType.REG_TEST); }
@Before public void setUp() throws Exception { pluginId = UUID.randomUUID(); assetIssuingPluginRoot = new AssetIssuingDigitalAssetTransactionPluginRoot(); assetIssuingPluginRoot.setId(pluginId); assetIssuingPluginRoot.setErrorManager(errorManager); assetIssuingPluginRoot.setLogManager(logManager); assetIssuingPluginRoot.setEventManager(eventManager); assetIssuingPluginRoot.setPluginDatabaseSystem(pluginDatabaseSystem); assetIssuingPluginRoot.setPluginFileSystem(pluginFileSystem); assetIssuingPluginRoot.setAssetIssuerManager(assetIssuerWalletManager); assetIssuingPluginRoot.setActorAssetIssuerManager(actorAssetIssuerManager); assetIssuingPluginRoot.setCryptoVaultManager(cryptoVaultManager); assetIssuingPluginRoot.setBitcoinWalletManager(bitcoinWalletManager); assetIssuingPluginRoot.setAssetVaultManager(assetVaultManager); assetIssuingPluginRoot.setCryptoAddressBookManager(cryptoAddressBookManager); assetIssuingPluginRoot.setOutgoingIntraActorManager(outgoingIntraActorManager); assetIssuingPluginRoot.setDeviceUserManager(deviceUserManager); assetIssuingPluginRoot.setBitcoinNetworkManager(bitcoinNetworkManager); resources = new LinkedList<>(); digitalAsset = new DigitalAsset(); digitalAsset.setContract(digitalAssetContract); digitalAsset.setResources(resources); digitalAsset.setDescription(description); digitalAsset.setName(name); digitalAsset.setPublicKey(publicKey); digitalAsset.setState(state); digitalAsset.setIdentityAssetIssuer(identityAssetIssuer); records = new LinkedList<>(); // records.add(mockDatabaseTableRecord); setUpMockitoRules(); }