-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from soramitsu/scenarious/fix/query_batch_count
Scenarious/fix/query_batch_count
- Loading branch information
Showing
9 changed files
with
49,081 additions
and
46,439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package FunctionalTest; | ||
|
||
import jp.co.soramitsu.iroha2.CryptoUtils; | ||
import jp.co.soramitsu.iroha2.ExtensionsKt; | ||
import jp.co.soramitsu.iroha2.client.Iroha2AsyncClient; | ||
import jp.co.soramitsu.iroha2.generated.Asset; | ||
import jp.co.soramitsu.iroha2.model.IrohaUrls; | ||
import jp.co.soramitsu.iroha2.query.QueryAndExtractor; | ||
import jp.co.soramitsu.iroha2.query.QueryBuilder; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
public class SendQuery { | ||
//@Test | ||
public void findAllAssets() { | ||
Iroha2AsyncClient client; | ||
try { | ||
client = builderAsyncClient("/peer-0"); | ||
QueryAndExtractor<List<Asset>> query = QueryBuilder | ||
.findAllAssets() | ||
.account(ExtensionsKt.asAccountId("63f15f9c0ab4c0ff4461d829d27a569305f424ffb75cafaf9c4ab23e073fe2cc@bulb_44e22b24-5da5-4e19-ba2c-44164c8d7672_2a3db748-bd58-459c-9ebe-c5eb96e28d2b")) | ||
.buildSigned(CryptoUtils.keyPairFromHex("63f15f9c0ab4c0ff4461d829d27a569305f424ffb75cafaf9c4ab23e073fe2cc", "14ca5693b524dae42805d9250aea4a92278ae961c900b5d815b1915078588306")); | ||
client.sendQueryAsCompletableFuture(query).get().size(); | ||
} catch (MalformedURLException | InterruptedException | ExecutionException e) { | ||
System.out.println("EXEPTION: " + e.getMessage()); | ||
throw new RuntimeException(e); | ||
} | ||
|
||
} | ||
|
||
private Iroha2AsyncClient builderAsyncClient(String targetPeer) throws MalformedURLException { | ||
List<IrohaUrls> irohaUrls = new ArrayList<>(); | ||
irohaUrls.add(new IrohaUrls( | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp" + targetPeer), | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp"), | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp" + targetPeer)) | ||
); | ||
|
||
return new Iroha2AsyncClient( | ||
irohaUrls, | ||
true, | ||
"iroha2-test:7kUHkgq30JBeVyJVZ4Z1wbGBP3vah3", | ||
1000); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package scenarious.irohaClient; | ||
|
||
import io.gatling.javaapi.core.CoreDsl; | ||
import io.gatling.javaapi.core.ScenarioBuilder; | ||
import io.gatling.javaapi.core.Session; | ||
import jp.co.soramitsu.iroha2.CryptoUtils; | ||
import jp.co.soramitsu.iroha2.ExtensionsKt; | ||
import jp.co.soramitsu.iroha2.client.Iroha2AsyncClient; | ||
import jp.co.soramitsu.iroha2.generated.*; | ||
import jp.co.soramitsu.iroha2.model.IrohaUrls; | ||
import jp.co.soramitsu.iroha2.query.QueryAndExtractor; | ||
import jp.co.soramitsu.iroha2.query.QueryBuilder; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
import static io.gatling.javaapi.core.CoreDsl.csv; | ||
import static io.gatling.javaapi.core.CoreDsl.scenario; | ||
|
||
|
||
public class BatchQueries { | ||
private static Iroha2AsyncClient client; | ||
|
||
public static ScenarioBuilder findAllAssetClientMode = scenario("findAllAssetClientMode") | ||
.feed(csv("preconditionList.csv").circular()).feed(csv("peers.csv").circular()) | ||
.exec(session -> { | ||
try { | ||
client = builderAsyncClient(session.getString("peer")); | ||
} catch (MalformedURLException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return session; | ||
} | ||
).repeat(10).on( | ||
CoreDsl.exec(session -> { | ||
try { | ||
client.sendQueryAsCompletableFuture(buildFindAllAssetsQuery(session)).get(); | ||
return session; | ||
} catch (InterruptedException | ExecutionException e) { | ||
e.printStackTrace(); | ||
e.getMessage(); | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
) | ||
); | ||
|
||
private static QueryAndExtractor<List<Asset>> buildFindAllAssetsQuery(Session session) { | ||
return QueryBuilder | ||
.findAllAssets() | ||
.account(ExtensionsKt.asAccountId(session.getString("anotherDevAccountIdSender"))) | ||
.buildSigned(CryptoUtils.keyPairFromHex(session.getString("publicKeySender"), session.getString("privateKeySender"))); | ||
} | ||
|
||
private static Iroha2AsyncClient builderAsyncClient(String targetPeer) throws MalformedURLException { | ||
List<IrohaUrls> irohaUrls = new ArrayList<>(); | ||
irohaUrls.add(new IrohaUrls( | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp" + targetPeer), | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp"), | ||
new URL("https://iroha2.test.tachi.soramitsu.co.jp" + targetPeer) | ||
) | ||
); | ||
Iroha2AsyncClient client1 = new Iroha2AsyncClient( | ||
irohaUrls, | ||
true, | ||
System.getProperty("remoteLogin") + ":" + System.getProperty("remotePassword"), | ||
1000); | ||
|
||
return client1; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.