From 13329f30a6a0693b39392a80af4384926c84282f Mon Sep 17 00:00:00 2001 From: timofeevmd Date: Wed, 26 Jun 2024 14:13:45 +0400 Subject: [PATCH] update user flow scn Signed-off-by: timofeevmd Signed-off-by: timofeevmd --- .../kotlin/jp/co/soramitsu/load/UserFlow.kt | 74 ++++++++++--------- .../jp/co/soramitsu/load/toolbox/Wrench13.kt | 2 +- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/main/kotlin/jp/co/soramitsu/load/UserFlow.kt b/src/main/kotlin/jp/co/soramitsu/load/UserFlow.kt index 35984ac..c8ea487 100644 --- a/src/main/kotlin/jp/co/soramitsu/load/UserFlow.kt +++ b/src/main/kotlin/jp/co/soramitsu/load/UserFlow.kt @@ -39,7 +39,7 @@ class UserFlow : Wrench13() { val userFlowScn = scenario("userFlowScn") .feed(csv("preconditionList.csv").circular()) .exec { Session -> - iroha2Client = buildClient(SimulationConfig.simulation.configuration()) + //iroha2Client = buildClient(SimulationConfig.simulation.configuration()) anotherDevKeyPairSender = adminKeyPair domainIdSender = Session.get("domainIdSender")!!.asDomainId() anotherDevAccountIdSender = Session.get("anotherDevAccountIdSender")!!.asAccountId() @@ -47,96 +47,97 @@ class UserFlow : Wrench13() { anotherDevAssetIdSender = Session.get("anotherDevAssetIdSender")!!.asAssetId() Session }.exec { Session -> + iroha2Client = builder("peer-0/api") runBlocking { QueryBuilder.findAssetsByAccountId(anotherDevAccountIdSender) .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> - /*println("QUERY BODY") - println(query)*/ iroha2Client.sendQuery(query) } } Session }.exec { Session -> + iroha2Client = builder("peer-1/api") runBlocking { QueryBuilder.findAccountsByDomainId(domainIdSender) .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> - /*println("QUERY BODY") - println(query)*/ iroha2Client.sendQuery(query) } } Session }.exec { Session -> + iroha2Client = builder("peer-2/api") runBlocking { QueryBuilder.findAllAssets() .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> - /*println("QUERY BODY") - println(query)*/ iroha2Client.sendQuery(query) } } Session }.exec { Session -> + iroha2Client = builder("peer-3/api") runBlocking { QueryBuilder.findAllAssets() .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> - /*println("QUERY BODY") - println(query)*/ iroha2Client.sendQuery(query) } } Session - }/*.exec { Session -> + }.exec { Session -> + iroha2Client = builder("peer-4/api") runBlocking { - val assetDefinition = "xor_" + UUID.randomUUID() + "_" + UUID.randomUUID() - val assetDefinitionId = AssetDefinitionId( - domainIdSender, - assetDefinition.asName() - ) - iroha2Client.sendTransaction { - account(anotherDevAccountIdSender) - registerAssetDefinition(assetDefinitionId, AssetValueType.numeric()) - buildSigned(anotherDevKeyPairSender) - } + QueryBuilder.findAllTransactions() + .account(anotherDevAccountIdSender) + .buildSigned(anotherDevKeyPairSender) + .let { query -> + iroha2Client.sendQuery(query) + } } Session }.exec { Session -> + iroha2Client = builder("peer-0/api") runBlocking { - txs = QueryBuilder.findTransactionsByAccountId(anotherDevAccountIdSender) + QueryBuilder.findTransactionByHash(hash) + .account(anotherDevAccountIdSender) + .buildSigned(anotherDevKeyPairSender) + .let { query -> + iroha2Client.sendQuery(query) + } + } + Session + }.exec { Session -> + iroha2Client = builder("peer-1/api") + runBlocking { + QueryBuilder.findAccountsByDomainId(domainIdSender) .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> iroha2Client.sendQuery(query) } - - hash = SignedTransaction.encode(txs[2].transaction.value).hash() } Session }.exec { Session -> + iroha2Client = builder("peer-2/api") runBlocking { - val assetDefinition = "xor_" + UUID.randomUUID() + "_" + UUID.randomUUID() - val assetDefinitionId = AssetDefinitionId( - domainIdSender, - assetDefinition.asName() - ) - iroha2Client.sendTransaction { - account(anotherDevAccountIdSender) - registerAssetDefinition(assetDefinitionId, AssetValueType.numeric()) - buildSigned(anotherDevKeyPairSender) - } + QueryBuilder.findAllAssets() + .account(anotherDevAccountIdSender) + .buildSigned(anotherDevKeyPairSender) + .let { query -> + iroha2Client.sendQuery(query) + } } Session - }*/.exec { Session -> + }.exec { Session -> + iroha2Client = builder("peer-3/api") runBlocking { - QueryBuilder.findAllTransactions() + QueryBuilder.findAllAssets() .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> @@ -145,8 +146,9 @@ class UserFlow : Wrench13() { } Session }.exec { Session -> + iroha2Client = builder("peer-4/api") runBlocking { - QueryBuilder.findTransactionByHash(hash) + QueryBuilder.findAllTransactions() .account(anotherDevAccountIdSender) .buildSigned(anotherDevKeyPairSender) .let { query -> diff --git a/src/main/kotlin/jp/co/soramitsu/load/toolbox/Wrench13.kt b/src/main/kotlin/jp/co/soramitsu/load/toolbox/Wrench13.kt index 72fbd8d..3a0b3c8 100644 --- a/src/main/kotlin/jp/co/soramitsu/load/toolbox/Wrench13.kt +++ b/src/main/kotlin/jp/co/soramitsu/load/toolbox/Wrench13.kt @@ -72,7 +72,7 @@ open class Wrench13 { return builder(randomPeer) } - private fun builder(randomPeer: String): AdminIroha2Client { + fun builder(randomPeer: String): AdminIroha2Client { val peerUrl = URIBuilder().let { it.scheme = SimulationConfig.simulation.targetProtocol() it.host = SimulationConfig.simulation.targetURL()