Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit412f99b

Browse files
committed
[1.1.1]
ProxyBlockApiTest self queue with longer timeout
1 parent167edcd commit412f99b

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

‎src/test/java/io/api/ApiRunner.java‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ public class ApiRunner extends Assert {
1111
privatestaticfinalEtherScanApiapiRopsten;
1212
privatestaticfinalEtherScanApiapiRinkeby;
1313
privatestaticfinalEtherScanApiapiKovan;
14-
privatestaticfinalStringkey;
14+
privatestaticfinalStringapiKey;
1515

1616
static {
17-
finalStringapiKey =System.getenv("API_KEY");
18-
key = (apiKey ==null ||apiKey.isEmpty())
17+
finalStringkey =System.getenv("API_KEY");
18+
apiKey = (key ==null ||key.isEmpty())
1919
?EtherScanApi.DEFAULT_KEY
20-
:apiKey;
20+
:key;
2121

2222
finalQueueManagerqueueManager =newQueueManager(2,2100L,2100L,0);
23-
api =newEtherScanApi(key,EthNetwork.MAINNET,queueManager);
24-
apiKovan =newEtherScanApi(key,EthNetwork.KOVAN,queueManager);
25-
apiRopsten =newEtherScanApi(key,EthNetwork.ROPSTEN,queueManager);
26-
apiRinkeby =newEtherScanApi(key,EthNetwork.RINKEBY,queueManager);
23+
api =newEtherScanApi(ApiRunner.apiKey,EthNetwork.MAINNET,queueManager);
24+
apiKovan =newEtherScanApi(ApiRunner.apiKey,EthNetwork.KOVAN,queueManager);
25+
apiRopsten =newEtherScanApi(ApiRunner.apiKey,EthNetwork.ROPSTEN,queueManager);
26+
apiRinkeby =newEtherScanApi(ApiRunner.apiKey,EthNetwork.RINKEBY,queueManager);
2727
}
2828

29-
publicstaticStringgetKey() {
30-
returnkey;
29+
publicstaticStringgetApiKey() {
30+
returnapiKey;
3131
}
3232

3333
publicstaticEtherScanApigetApi() {

‎src/test/java/io/api/etherscan/EtherScanApiTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void noTimeoutUnlimitedAwait() {
7979
publicvoidtimeout()throwsInterruptedException {
8080
TimeUnit.SECONDS.sleep(5);
8181
Supplier<IHttpExecutor>supplier = () ->newHttpExecutor(300,300);
82-
EtherScanApiapi =newEtherScanApi(getKey(),EthNetwork.KOVAN,supplier);
82+
EtherScanApiapi =newEtherScanApi(getApiKey(),EthNetwork.KOVAN,supplier);
8383
List<Block>blocks =api.account().minedBlocks("0x0010f94b296A852aAac52EA6c5Ac72e03afD032D");
8484
assertNotNull(blocks);
8585
}

‎src/test/java/io/api/etherscan/proxy/ProxyBlockApiTest.java‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
packageio.api.etherscan.proxy;
22

33
importio.api.ApiRunner;
4+
importio.api.etherscan.core.impl.EtherScanApi;
5+
importio.api.etherscan.manager.impl.QueueManager;
6+
importio.api.etherscan.model.EthNetwork;
47
importio.api.etherscan.model.proxy.BlockProxy;
58
importorg.junit.Test;
69

@@ -14,9 +17,16 @@
1417
*/
1518
publicclassProxyBlockApiTestextendsApiRunner {
1619

20+
privatefinalEtherScanApiapi;
21+
22+
publicProxyBlockApiTest() {
23+
finalQueueManagerqueueManager =newQueueManager(1,5100L,5100L,0);
24+
this.api =newEtherScanApi(getApiKey(),EthNetwork.MAINNET,queueManager);
25+
}
26+
1727
@Test
1828
publicvoidcorrect() {
19-
Optional<BlockProxy>block =getApi().proxy().block(5120);
29+
Optional<BlockProxy>block =api.proxy().block(5120);
2030
assertTrue(block.isPresent());
2131
BlockProxyproxy =block.get();
2232
assertNotNull(proxy.getHash());
@@ -49,13 +59,13 @@ public void correct() {
4959

5060
@Test
5161
publicvoidcorrectParamWithEmptyExpectedResult() {
52-
Optional<BlockProxy>block =getApi().proxy().block(99999999999L);
62+
Optional<BlockProxy>block =api.proxy().block(99999999999L);
5363
assertFalse(block.isPresent());
5464
}
5565

5666
@Test
5767
publicvoidcorrectParamNegativeNo() {
58-
Optional<BlockProxy>block =getApi().proxy().block(-1);
68+
Optional<BlockProxy>block =api.proxy().block(-1);
5969
assertTrue(block.isPresent());
6070
assertNotNull(block.get().getHash());
6171
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp