/** * This method implement a delivering test to asset issuer wallet, mocking an event raise and * transactions * * @throws CantDefineContractPropertyException * @throws CantCreateDigitalAssetFileException * @throws CantPersistDigitalAssetException * @throws CantSetObjectException * @throws CantExecuteQueryException * @throws UnexpectedResultReturnedFromDatabaseException * @throws CantPersistsGenesisTransactionException * @throws CantCheckAssetIssuingProgressException * @throws CantStartAgentException * @throws CantGetLoggedInDeviceUserException * @throws CantCreateFileException * @throws CantPersistFileException */ private void testWalletDeliverAssetToAssetIssuerWallet() throws CantDefineContractPropertyException, CantCreateDigitalAssetFileException, CantPersistDigitalAssetException, CantSetObjectException, CantExecuteQueryException, UnexpectedResultReturnedFromDatabaseException, CantPersistsGenesisTransactionException, CantCheckAssetIssuingProgressException, CantStartAgentException, CantGetLoggedInDeviceUserException, CantCreateFileException, CantPersistFileException, CantPersistsTransactionUUIDException, CantPersistsGenesisAddressException { printSomething("Start deliver to Asset wallet test"); String genesisTransaction = "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43"; MockDigitalAssetMetadataForTesting mockDigitalAssetMetadataForTesting = new MockDigitalAssetMetadataForTesting(); DigitalAsset mockDigitalAssetForTesting = mockDigitalAssetMetadataForTesting.getDigitalAsset(); String digitalAssetInnerXML = mockDigitalAssetForTesting.toString(); // PluginTextFile digitalAssetFile=this.pluginFileSystem.createTextFile(this.pluginId, // "digital-asset-swap/", genesisTransaction+".xml", FilePrivacy.PUBLIC, // FileLifeSpan.PERMANENT); // digitalAssetFile.setContent(digitalAssetInnerXML); // digitalAssetFile.persistToMedia(); this.digitalAssetIssuingVault.setWalletPublicKey("walletPublicKeyTest"); this.digitalAssetIssuingVault.persistDigitalAssetMetadataInLocalStorage( mockDigitalAssetMetadataForTesting, "testId"); this.assetIssuingTransactionDao.persistDigitalAsset( mockDigitalAssetForTesting.getPublicKey(), "testLocalPath", 1, BlockchainNetworkType.REG_TEST, "testWalletPublicKey"); this.assetIssuingTransactionDao.persistDigitalAssetTransactionId( mockDigitalAssetForTesting.getPublicKey(), "testId"); this.assetIssuingTransactionDao.persistDigitalAssetHash( "testId", mockDigitalAssetMetadataForTesting.getDigitalAssetHash()); UUID mockUUId = UUID.randomUUID(); this.assetIssuingTransactionDao.persistOutgoingIntraActorUUID("testId", mockUUId); this.assetIssuingTransactionDao.persistGenesisTransaction( mockUUId.toString(), genesisTransaction); this.assetIssuingTransactionDao.updateTransactionProtocolStatus( genesisTransaction, ProtocolStatus.TO_BE_NOTIFIED); this.assetIssuingTransactionDao.updateDigitalAssetTransactionStatus( "testId", TransactionStatus.CRYPTO_SENT); this.assetIssuingTransactionDao.updateDigitalAssetCryptoStatusByTransactionHash( mockDigitalAssetMetadataForTesting.getDigitalAssetHash(), CryptoStatus.PENDING_SUBMIT); testRaiseEvent(); startMonitorAgent(); printSomething("End Deliver test"); }
/** * This method checks that every object in Digital asset is set. * * @throws ObjectNotSetException */ public static void areObjectsSettled(DigitalAsset digitalAsset) throws ObjectNotSetException { if (digitalAsset.getContract() == null) { throw new ObjectNotSetException("Digital Asset Contract is not set"); } if (digitalAsset.getResources() == null) { throw new ObjectNotSetException("Digital Asset Resources is not set"); } if (digitalAsset.getDescription() == null) { throw new ObjectNotSetException("Digital Asset Description is not set"); } if (digitalAsset.getName() == null) { throw new ObjectNotSetException("Digital Asset Name is not set"); } if (digitalAsset.getPublicKey() == null) { throw new ObjectNotSetException("Digital Asset PublicKey is not set"); } if (digitalAsset.getState() == null) { digitalAsset.setState(State.DRAFT); } if (digitalAsset.getIdentityAssetIssuer() == null) { throw new ObjectNotSetException("Digital Asset Identity is not set"); } }