Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iotgateway
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
0Tyler
iotgateway
Commits
48377c5d
Commit
48377c5d
authored
May 01, 2019
by
0Tyler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contract Tester
parent
31f628bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
contract/src/test/java/edu/prlab/tyler/iotgateway/contract/ContractTester.java
...a/edu/prlab/tyler/iotgateway/contract/ContractTester.java
+56
-0
No files found.
contract/src/test/java/edu/prlab/tyler/iotgateway/contract/ContractTester.java
0 → 100644
View file @
48377c5d
package
edu.prlab.tyler.iotgateway.contract
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.runners.MethodSorters
;
import
org.web3j.protocol.core.methods.response.Web3ClientVersion
;
import
org.web3j.protocol.http.HttpService
;
import
org.web3j.quorum.Quorum
;
import
org.web3j.tx.gas.ContractGasProvider
;
import
org.web3j.tx.gas.StaticGasProvider
;
import
java.math.BigInteger
;
@FixMethodOrder
(
value
=
MethodSorters
.
NAME_ASCENDING
)
public
class
ContractTester
{
private
static
final
String
rpcUrl
=
"http://localhost:22001"
;
private
static
final
String
privateKey
=
"7777777777777777777777777777777777777777777777777777777777777777"
;
protected
static
final
ContractGasProvider
DEFAULT_GAS_PROVIDER
=
new
StaticGasProvider
(
BigInteger
.
ZERO
,
BigInteger
.
valueOf
(
1000000000L
)
);
@BeforeEach
public
void
setUp
()
{
}
@Test
public
void
deployContract
()
throws
Exception
{
System
.
out
.
println
(
"test start"
);
Quorum
quorum
=
Quorum
.
build
(
new
HttpService
(
rpcUrl
));
Web3ClientVersion
web3ClientVersion
=
quorum
.
web3ClientVersion
().
sendAsync
().
get
();
String
clientVersion
=
web3ClientVersion
.
getWeb3ClientVersion
();
System
.
out
.
println
(
"web3j版本 : "
+
clientVersion
);
String
userAddress
=
quorum
.
ethAccounts
().
send
().
getAccounts
().
get
(
0
);
System
.
out
.
println
(
"User : "
+
userAddress
);
// ClientTransactionManager manager = new ClientTransactionManager(quorum, userAddress);
// Credentials credentials = Credentials.create(privateKey);
// DeviceContract deviceContract = DeviceContract.deploy(quorum, manager,DEFAULT_GAS_PROVIDER).send();
//
// System.out.println("智慧合約地址:" + deviceContract.getContractAddress());
//
// Assert.assertNotNull(deviceContract);
System
.
out
.
println
(
"test end"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment