-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
39 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
62 changes: 24 additions & 38 deletions
62
liteclient/src/test/java/org/ton/java/liteclient/LiteClientThreadsTest.java
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 |
---|---|---|
@@ -1,52 +1,38 @@ | ||
package org.ton.java.liteclient; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.anarsoft.vmlens.concurrent.junit.ConcurrentTestRunner; | ||
import com.anarsoft.vmlens.concurrent.junit.ThreadCount; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.io.FileUtils; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.ton.java.liteclient.api.ResultLastBlock; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@Slf4j | ||
@RunWith(ConcurrentTestRunner.class) | ||
public class LiteClientThreadsTest { | ||
|
||
private LiteClient liteClient; | ||
|
||
@Before | ||
public void executedBeforeEach() throws IOException { | ||
InputStream liteClientStream = LiteClient.class.getClassLoader().getResourceAsStream("lite-client.exe"); | ||
File f = new File("lite-client.exe"); | ||
FileUtils.copyInputStreamToFile(liteClientStream, f); | ||
String pathToLiteClient = f.getAbsolutePath(); | ||
liteClientStream.close(); | ||
|
||
liteClient = LiteClient.builder() | ||
.pathToLiteClientBinary(pathToLiteClient) | ||
.testnet(true) | ||
.build(); | ||
} | ||
|
||
@Test | ||
@ThreadCount(6) | ||
public void testLiteClientLastThreads() throws Exception { | ||
String resultLast = liteClient.executeLast(); | ||
assertThat(resultLast).isNotEmpty(); | ||
ResultLastBlock resultLastBlock = LiteClientParser.parseLast(resultLast); | ||
log.info("testLiteClientLastThreads tonBlockId {}", resultLastBlock); | ||
assertThat(resultLastBlock).isNotNull(); | ||
String resultShards = liteClient.executeAllshards(resultLastBlock); | ||
log.info("testLiteClientLastThreads resultShards {}", resultShards); | ||
assertThat(resultShards).isNotEmpty(); | ||
String resultBlock = liteClient.executeDumpblock(resultLastBlock); | ||
assertThat(resultBlock).isNotEmpty(); | ||
} | ||
} | ||
private LiteClient liteClient; | ||
|
||
@Before | ||
public void executedBeforeEach() { | ||
liteClient = LiteClient.builder().testnet(true).build(); | ||
} | ||
|
||
@Test | ||
@ThreadCount(6) | ||
public void testLiteClientLastThreads() throws Exception { | ||
String resultLast = liteClient.executeLast(); | ||
assertThat(resultLast).isNotEmpty(); | ||
ResultLastBlock resultLastBlock = LiteClientParser.parseLast(resultLast); | ||
log.info("testLiteClientLastThreads tonBlockId {}", resultLastBlock); | ||
assertThat(resultLastBlock).isNotNull(); | ||
String resultShards = liteClient.executeAllshards(resultLastBlock); | ||
log.info("testLiteClientLastThreads resultShards {}", resultShards); | ||
assertThat(resultShards).isNotEmpty(); | ||
String resultBlock = liteClient.executeDumpblock(resultLastBlock); | ||
assertThat(resultBlock).isNotEmpty(); | ||
} | ||
} |